change default range to 12h, rework layout in system node views

This commit is contained in:
Christoph Kluge 2024-10-02 14:37:32 +02:00
parent 6019891591
commit 0eb0aa1d3b
3 changed files with 53 additions and 39 deletions

View File

@ -13,6 +13,7 @@
import { import {
Row, Row,
Col, Col,
Input,
InputGroup, InputGroup,
InputGroupText, InputGroupText,
Icon, Icon,
@ -43,7 +44,7 @@
if (from == null || to == null) { if (from == null || to == null) {
to = new Date(Date.now()); to = new Date(Date.now());
from = new Date(to.getTime()); from = new Date(to.getTime());
from.setMinutes(from.getMinutes() - 30); from.setHours(from.getHours() - 12);
} }
const initialized = getContext("initialized") const initialized = getContext("initialized")
@ -135,26 +136,38 @@
{:else if $initq.fetching} {:else if $initq.fetching}
<Spinner /> <Spinner />
{:else} {:else}
<!-- Node Col -->
<Col> <Col>
<InputGroup> <InputGroup>
<InputGroupText><Icon name="hdd" /></InputGroupText> <InputGroupText><Icon name="hdd" /></InputGroupText>
<InputGroupText>{hostname} ({cluster})</InputGroupText> <InputGroupText>Selected Node</InputGroupText>
<Input style="background-color: white;"type="text" value="{hostname} ({cluster})" disabled/>
</InputGroup> </InputGroup>
</Col> </Col>
<!-- Time Col -->
<Col>
<TimeSelection bind:from bind:to />
</Col>
<!-- Concurrent Col -->
<Col> <Col>
{#if $nodeJobsData.fetching} {#if $nodeJobsData.fetching}
<Spinner /> <Spinner />
{:else if $nodeJobsData.data} {:else if $nodeJobsData.data}
Currently running jobs on this node: {$nodeJobsData.data.jobs.count} <InputGroup>
[ <InputGroupText><Icon name="activity" /></InputGroupText>
<a <InputGroupText>Activity</InputGroupText>
href="/monitoring/jobs/?cluster={cluster}&state=running&node={hostname}" <Input style="background-color: white;"type="text" value="{$nodeJobsData.data.jobs.count} Jobs" disabled/>
target="_blank">View in Job List</a <a title="Show jobs running on this node" href="/monitoring/jobs/?cluster={cluster}&state=running&node={hostname}" target="_blank" class="btn btn-outline-secondary" role="button" aria-disabled="true">
> ] <Icon name="view-list" /> Show List
</a>
</InputGroup>
{:else} {:else}
<Input type="text" disabled>
No currently running jobs. No currently running jobs.
</Input>
{/if} {/if}
</Col> </Col>
<!-- Refresh Col-->
<Col> <Col>
<Refresher <Refresher
on:refresh={() => { on:refresh={() => {
@ -164,9 +177,6 @@
}} }}
/> />
</Col> </Col>
<Col>
<TimeSelection bind:from bind:to />
</Col>
{/if} {/if}
</Row> </Row>
<br /> <br />

View File

@ -42,7 +42,7 @@
if (from == null || to == null) { if (from == null || to == null) {
to = new Date(Date.now()); to = new Date(Date.now());
from = new Date(to.getTime()); from = new Date(to.getTime());
from.setMinutes(from.getMinutes() - 30); from.setHours(from.getHours() - 12);
} }
const initialized = getContext("initialized"); const initialized = getContext("initialized");
@ -117,18 +117,23 @@
{:else if $initq.fetching} {:else if $initq.fetching}
<Spinner /> <Spinner />
{:else} {:else}
<!-- Node Col-->
<Col> <Col>
<Refresher <InputGroup>
on:refresh={() => { <InputGroupText><Icon name="hdd" /></InputGroupText>
const diff = Date.now() - to; <InputGroupText>Find Node</InputGroupText>
from = new Date(from.getTime() + diff); <Input
to = new Date(to.getTime() + diff); placeholder="hostname..."
}} type="text"
bind:value={hostnameFilter}
/> />
</InputGroup>
</Col> </Col>
<!-- Range Col-->
<Col> <Col>
<TimeSelection bind:from bind:to /> <TimeSelection bind:from bind:to />
</Col> </Col>
<!-- Metric Col-->
<Col> <Col>
<InputGroup> <InputGroup>
<InputGroupText><Icon name="graph-up" /></InputGroupText> <InputGroupText><Icon name="graph-up" /></InputGroupText>
@ -142,16 +147,15 @@
</select> </select>
</InputGroup> </InputGroup>
</Col> </Col>
<!-- Refresh Col-->
<Col> <Col>
<InputGroup> <Refresher
<InputGroupText><Icon name="hdd" /></InputGroupText> on:refresh={() => {
<InputGroupText>Find Node</InputGroupText> const diff = Date.now() - to;
<Input from = new Date(from.getTime() + diff);
placeholder="hostname..." to = new Date(to.getTime() + diff);
type="text" }}
bind:value={hostnameFilter}
/> />
</InputGroup>
</Col> </Col>
{/if} {/if}
</Row> </Row>

View File

@ -9,7 +9,7 @@
--> -->
<script> <script>
import { createEventDispatcher } from "svelte"; import { createEventDispatcher } from "svelte";
import { Button, Icon, InputGroup } from "@sveltestrap/sveltestrap"; import { Button, Icon, Input, InputGroup } from "@sveltestrap/sveltestrap";
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
@ -32,15 +32,8 @@
</script> </script>
<InputGroup> <InputGroup>
<Button <Input
outline type="select"
on:click={() => dispatch("refresh")}
disabled={refreshInterval != null}
>
<Icon name="arrow-clockwise" /> Refresh
</Button>
<select
class="form-select"
bind:value={refreshInterval} bind:value={refreshInterval}
on:change={refreshIntervalChanged} on:change={refreshIntervalChanged}
> >
@ -49,6 +42,13 @@
<option value={60 * 1000}>Update every minute</option> <option value={60 * 1000}>Update every minute</option>
<option value={2 * 60 * 1000}>Update every two minutes</option> <option value={2 * 60 * 1000}>Update every two minutes</option>
<option value={5 * 60 * 1000}>Update every 5 minutes</option> <option value={5 * 60 * 1000}>Update every 5 minutes</option>
</select> </Input>
<Button
outline
on:click={() => dispatch("refresh")}
disabled={refreshInterval != null}
>
<Icon name="arrow-clockwise" /> Refresh
</Button>
</InputGroup> </InputGroup>