-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the drawer component * Update the drawer * Delete the separate drawer btn component * Update the drawer * Update the theme colors * Update the component & add the docs * Update the drawer breakpoint * Fix the cluster tasks table jumping width issue
- Loading branch information
Showing
5 changed files
with
314 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
import { LitElement, html, css } from 'https://cdn.jsdelivr.net/gh/lit/dist@3/all/lit-all.min.js'; | ||
import {LitElement, html, css} from 'https://cdn.jsdelivr.net/gh/lit/dist@3/all/lit-all.min.js'; | ||
import RPCCall from '/lib/jsonrpc.mjs'; | ||
|
||
customElements.define('cluster-tasks', class ClusterTasks extends LitElement { | ||
static get properties() { | ||
return { | ||
data: { type: Array }, | ||
showBackgroundTasks: { type: Boolean }, | ||
}; | ||
} | ||
class ClusterTasks extends LitElement { | ||
static get properties() { | ||
return { | ||
data: { type: Array }, | ||
showBackgroundTasks: { type: Boolean }, | ||
}; | ||
} | ||
|
||
constructor() { | ||
super(); | ||
this.data = []; | ||
this.showBackgroundTasks = false; | ||
this.loadData(); | ||
} | ||
static get styles() { | ||
return css` | ||
th, td { | ||
&:nth-child(1) { width: 8ch; } | ||
&:nth-child(2) { width: 16ch; } | ||
&:nth-child(3) { width: 10ch; } | ||
&:nth-child(4) { width: 10ch; } | ||
&:nth-child(5) { min-width: 20ch; } | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
` | ||
} | ||
|
||
async loadData() { | ||
this.data = (await RPCCall('ClusterTaskSummary')) || []; | ||
setTimeout(() => this.loadData(), 1000); | ||
this.requestUpdate(); | ||
} | ||
constructor() { | ||
super(); | ||
this.data = []; | ||
this.showBackgroundTasks = false; | ||
this.loadData(); | ||
} | ||
|
||
toggleShowBackgroundTasks(e) { | ||
this.showBackgroundTasks = e.target.checked; | ||
} | ||
async loadData() { | ||
this.data = (await RPCCall('ClusterTaskSummary')) || []; | ||
setTimeout(() => this.loadData(), 1000); | ||
this.requestUpdate(); | ||
} | ||
|
||
render() { | ||
return html` | ||
toggleShowBackgroundTasks(e) { | ||
this.showBackgroundTasks = e.target.checked; | ||
} | ||
|
||
render() { | ||
return html` | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
|
@@ -40,18 +55,18 @@ customElements.define('cluster-tasks', class ClusterTasks extends LitElement { | |
onload="document.body.style.visibility = 'initial'" | ||
/> | ||
<!-- Toggle for showing background tasks --> | ||
<label> | ||
<input | ||
type="checkbox" | ||
@change=${this.toggleShowBackgroundTasks} | ||
?checked=${this.showBackgroundTasks} | ||
/> | ||
Show background tasks | ||
</label> | ||
<table class="table table-dark"> | ||
<thead> | ||
<!-- Toggle for showing background tasks --> | ||
<label> | ||
<input | ||
type="checkbox" | ||
@change=${this.toggleShowBackgroundTasks} | ||
?checked=${this.showBackgroundTasks} | ||
/> | ||
Show background tasks | ||
</label> | ||
<table class="table table-dark"> | ||
<thead> | ||
<tr> | ||
<th>SpID</th> | ||
<th style="min-width: 128px">Task</th> | ||
|
@@ -62,10 +77,7 @@ customElements.define('cluster-tasks', class ClusterTasks extends LitElement { | |
</thead> | ||
<tbody> | ||
${this.data | ||
.filter( | ||
(entry) => | ||
this.showBackgroundTasks || !entry.Name.startsWith('bg:') | ||
) | ||
.filter((entry) =>this.showBackgroundTasks || !entry.Name.startsWith('bg:')) | ||
.map( | ||
(entry) => html` | ||
<tr> | ||
|
@@ -75,9 +87,7 @@ customElements.define('cluster-tasks', class ClusterTasks extends LitElement { | |
<td>${entry.SincePostedStr}</td> | ||
<td> | ||
${entry.OwnerID | ||
? html`<a href="/pages/node_info/?id=${entry.OwnerID}" | ||
>${entry.Owner}</a | ||
>` | ||
? html`<a href="/pages/node_info/?id=${entry.OwnerID}">${entry.Owner}</a>` | ||
: ''} | ||
</td> | ||
</tr> | ||
|
@@ -86,5 +96,7 @@ customElements.define('cluster-tasks', class ClusterTasks extends LitElement { | |
</tbody> | ||
</table> | ||
`; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
customElements.define('cluster-tasks', ClusterTasks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.