mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Add adaptive histogram sizing toggle
- Patches lagging filters in single-user view -See comment in User.root.svelte for detail
This commit is contained in:
parent
02c31a24bd
commit
dd74f27708
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount, getContext } from 'svelte'
|
import { onMount, getContext } from 'svelte'
|
||||||
import { init } from './utils.js'
|
import { init } from './utils.js'
|
||||||
import { Table, Row, Col, Button, Icon, Card, Spinner } from 'sveltestrap'
|
import { Table, Row, Col, Button, Icon, Card, Spinner, Input } from 'sveltestrap'
|
||||||
import { queryStore, gql, getContextClient } from '@urql/svelte'
|
import { queryStore, gql, getContextClient } from '@urql/svelte'
|
||||||
import Filters from './filters/Filters.svelte'
|
import Filters from './filters/Filters.svelte'
|
||||||
import JobList from './joblist/JobList.svelte'
|
import JobList from './joblist/JobList.svelte'
|
||||||
@ -25,6 +25,13 @@
|
|||||||
let metrics = ccconfig.plot_list_selectedMetrics, isMetricsSelectionOpen = false
|
let metrics = ccconfig.plot_list_selectedMetrics, isMetricsSelectionOpen = false
|
||||||
let w1, w2, histogramHeight = 250
|
let w1, w2, histogramHeight = 250
|
||||||
let selectedCluster = filterPresets?.cluster ? filterPresets.cluster : null
|
let selectedCluster = filterPresets?.cluster ? filterPresets.cluster : null
|
||||||
|
let resize = false
|
||||||
|
/* Resize Context
|
||||||
|
* A) Each viewport change triggers histogram rerender due to variable dimensions clearing canvas if not rerendered
|
||||||
|
* B) Opening filters (and some other things) triggers small change in viewport dimensions (Fix here?)
|
||||||
|
* A+B) Histogram rerenders if filters opened, high performance impact if dataload heavy
|
||||||
|
* Solution: Default to fixed histogram dimensions, allow user to enable automatic resizing
|
||||||
|
*/
|
||||||
|
|
||||||
const client = getContextClient();
|
const client = getContextClient();
|
||||||
$: stats = queryStore({
|
$: stats = queryStore({
|
||||||
@ -130,27 +137,47 @@
|
|||||||
<th scope="row">Total Core Hours</th>
|
<th scope="row">Total Core Hours</th>
|
||||||
<td>{$stats.data.jobsStatistics[0].totalCoreHours}</td>
|
<td>{$stats.data.jobsStatistics[0].totalCoreHours}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Toggle Histogram Resizing</th>
|
||||||
|
<td><Input id="c3" value={resize} type="switch" on:change={() => (resize = !resize)}/></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
</Col>
|
</Col>
|
||||||
<div class="col-4" style="text-align: center;" bind:clientWidth={w1}>
|
<div class="col-4" style="text-align: center;" bind:clientWidth={w1}>
|
||||||
<b>Duration Distribution</b>
|
<b>Duration Distribution</b>
|
||||||
{#key $stats.data.jobsStatistics[0].histDuration}
|
{#key $stats.data.jobsStatistics[0].histDuration}
|
||||||
|
{#if resize == true}
|
||||||
<Histogram
|
<Histogram
|
||||||
data={$stats.data.jobsStatistics[0].histDuration}
|
data={$stats.data.jobsStatistics[0].histDuration}
|
||||||
width={w1 - 25} height={histogramHeight}
|
width={w1 - 25} height={histogramHeight}
|
||||||
xlabel="Current Runtimes [h]"
|
xlabel="Current Runtimes [h]"
|
||||||
ylabel="Number of Jobs"/>
|
ylabel="Number of Jobs"/>
|
||||||
|
{:else}
|
||||||
|
<Histogram
|
||||||
|
data={$stats.data.jobsStatistics[0].histDuration}
|
||||||
|
width={400} height={250}
|
||||||
|
xlabel="Current Runtimes [h]"
|
||||||
|
ylabel="Number of Jobs"/>
|
||||||
|
{/if}
|
||||||
{/key}
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4" style="text-align: center;" bind:clientWidth={w2}>
|
<div class="col-4" style="text-align: center;" bind:clientWidth={w2}>
|
||||||
<b>Number of Nodes Distribution</b>
|
<b>Number of Nodes Distribution</b>
|
||||||
{#key $stats.data.jobsStatistics[0].histNumNodes}
|
{#key $stats.data.jobsStatistics[0].histNumNodes}
|
||||||
|
{#if resize == true}
|
||||||
<Histogram
|
<Histogram
|
||||||
data={$stats.data.jobsStatistics[0].histNumNodes}
|
data={$stats.data.jobsStatistics[0].histNumNodes}
|
||||||
width={w2 - 25} height={histogramHeight}
|
width={w2 - 25} height={histogramHeight}
|
||||||
xlabel="Allocated Nodes [#]"
|
xlabel="Allocated Nodes [#]"
|
||||||
ylabel="Number of Jobs" />
|
ylabel="Number of Jobs" />
|
||||||
|
{:else}
|
||||||
|
<Histogram
|
||||||
|
data={$stats.data.jobsStatistics[0].histNumNodes}
|
||||||
|
width={400} height={250}
|
||||||
|
xlabel="Allocated Nodes [#]"
|
||||||
|
ylabel="Number of Jobs" />
|
||||||
|
{/if}
|
||||||
{/key}
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user