Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: porep UI page refresh and rendering #122

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ build_lotus?=0
curio_docker_user?=curio
curio_base_image=$(curio_docker_user)/curio-all-in-one:latest-debug
ffi_from_source?=0
lotus_version?=v1.27.0
lotus_version?=v1.28.1

ifeq ($(build_lotus),1)
# v1: building lotus image with provided lotus version
Expand Down
72 changes: 33 additions & 39 deletions web/static/pages/pipeline_porep/pipeline-porep-sectors.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,10 @@ customElements.define('pipeline-porep-sectors',class PipelinePorepSectors extend
}
async loadData() {
this.data = await RPCCall('PipelinePorepSectors');
setTimeout(() => this.loadData(), 3000);
this.requestUpdate();

// Poll for updates
setInterval(async () => {
this.data = await RPCCall('ActorSummary');
this.requestUpdate();
}, 30000);
};

render() {
return html`
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="/ux/main.css" onload="document.body.style.visibility = 'initial'">
<style>${PipelinePorepSectors.styles}</style>
<table class="table table-dark porep-state porep-pipeline-table">
<tbody>
${this.renderSectors()}
</tbody>
</table>
`;
}

renderSectors() {
return this.data.map((sector) => html`
<tr>
<td>${sector.Address}</td>
<td rowspan="2">${sector.CreateTime}</td>
<td rowspan="2"><sector-porep-state .sector=${sector}></sector-porep-state></td>
<td rowspan="2">
<a href="/pages/sector/?sp=${sector.Address}&id=${sector.SectorNumber}">DETAILS</a>
</td>
</tr>
<tr>
<td>${sector.SectorNumber}</td>
</tr>
`);
}
} );
customElements.define('sector-porep-state', class SectorPorepState extends LitElement {
static styles = css`
.porep-pipeline-table,
.porep-state {
Expand All @@ -57,11 +22,11 @@ customElements.define('sector-porep-state', class SectorPorepState extends LitEl
.porep-pipeline-table th {
border-left: none;
border-collapse: collapse;
vertical-align: middle;
}

.porep-pipeline-table tr:nth-child(odd) {
border-top: 6px solid #999999;

}

.porep-pipeline-table tr:first-child,
Expand Down Expand Up @@ -107,7 +72,35 @@ customElements.define('sector-porep-state', class SectorPorepState extends LitEl
}

render() {
const sector = this.sector;
return html`
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="/ux/main.css" onload="document.body.style.visibility = 'initial'">
<style>${PipelinePorepSectors.styles}</style>
<table class="table table-dark porep-state porep-pipeline-table">
<tbody>
${this.renderSectors()}
</tbody>
</table>
`;
}

renderSectors() {
return this.data.map((sector) => html`
<tr>
<td>${sector.Address}</td>
<td rowspan="2">${sector.CreateTime}</td>
<td rowspan="2">${this.renderSector(sector)}</td>
<td rowspan="2">
<a href="/pages/sector/?sp=${sector.Address}&id=${sector.SectorNumber}">DETAILS</a>
</td>
</tr>
<tr>
<td>${sector.SectorNumber}</td>
</tr>
`);
}

renderSector(sector) {
return html`
<table class="porep-state">
<tbody>
Expand Down Expand Up @@ -163,4 +156,5 @@ customElements.define('sector-porep-state', class SectorPorepState extends LitEl
</td>
`;
}
});

} );