fd7f1a95e2
* cfg edit 1 * jsonschema deps * feat: lp mig - first few steps * lp mig: default tasks * code comments * docs * lp-mig-progress * shared * comments and todos * fix: curio: rename lotus-provider to curio (#11645) * rename provider to curio * install gotext * fix lint errors, mod tidy * fix typo * fix API_INFO and add gotext to circleCI * add back gotext * add gotext after remerge * lp: channels doc * finish easy-migration TODOs * out generate * merging and more renames * avoid make-all * minor doc stuff * cu: make gen * make gen fix * make gen * tryfix * go mod tidy * minor ez migration fixes * ez setup - ui cleanups * better error message * guided setup colors * better path to saveconfigtolayer * loadconfigwithupgrades fix * readMiner oops * guided - homedir * err if miner is running * prompt error should exit * process already running, miner_id sectors in migration * dont prompt for language a second time * check miner stopped * unlock repo * render and sql oops * curio easyMig - some fixes * easyMigration runs successfully * lint * part 2 of last * message * merge addtl * fixing guided setup for myself * warn-on-no-post * EditorLoads * cleanups and styles * create info * fix tests * make gen * change layout, add help button * Duration custom json * mjs naming --------- Co-authored-by: LexLuthr <88259624+LexLuthr@users.noreply.github.com> Co-authored-by: LexLuthr <lexluthr@protocol.ai> Co-authored-by: LexLuthr <lexluthr@curiostorage.org>
71 lines
1.9 KiB
JavaScript
71 lines
1.9 KiB
JavaScript
import { LitElement, html, css } from 'https://cdn.jsdelivr.net/gh/lit/dist@3/all/lit-all.min.js';
|
|
window.customElements.define('chain-connectivity', class MyElement extends LitElement {
|
|
constructor() {
|
|
super();
|
|
this.data = [];
|
|
this.loadData();
|
|
}
|
|
loadData() {
|
|
const eventSource = new EventSource('/api/debug/chain-state-sse');
|
|
eventSource.onmessage = (event) => {
|
|
this.data = JSON.parse(event.data);
|
|
super.requestUpdate();
|
|
};
|
|
eventSource.onerror = (error) => {
|
|
console.error('Error:', error);
|
|
loadData();
|
|
};
|
|
};
|
|
|
|
static get styles() {
|
|
return [css`
|
|
:host {
|
|
box-sizing: border-box; /* Don't forgert this to include padding/border inside width calculation */
|
|
}
|
|
table {
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
table td, table th {
|
|
border-left: 1px solid #f0f0f0;
|
|
padding: 1px 5px;
|
|
}
|
|
|
|
table tr td:first-child, table tr th:first-child {
|
|
border-left: none;
|
|
}
|
|
|
|
.success {
|
|
color: green;
|
|
}
|
|
.warning {
|
|
color: yellow;
|
|
}
|
|
.error {
|
|
color: red;
|
|
}
|
|
`];
|
|
}
|
|
render = () => html`
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>RPC Address</th>
|
|
<th>Reachability</th>
|
|
<th>Sync Status</th>
|
|
<th>Version</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
${this.data.map(item => html`
|
|
<tr>
|
|
<td>${item.Address}</td>
|
|
<td>${item.Reachable ? html`<span class="success">ok</span>` : html`<span class="error">FAIL</span>`}</td>
|
|
<td>${item.SyncState === "ok" ? html`<span class="success">ok</span>` : html`<span class="warning">${item.SyncState}</span>`}</td>
|
|
<td>${item.Version}</td>
|
|
</tr>
|
|
`)}
|
|
</tbody>
|
|
</table>`
|
|
});
|