mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
fix plotgrid display error, use plotheight default
This commit is contained in:
parent
f616c7e1c6
commit
fc6970d08a
@ -208,7 +208,6 @@
|
||||
</h4>
|
||||
{#if item.disabled === false && item.metric}
|
||||
<MetricPlot
|
||||
height={300}
|
||||
metric={item.name}
|
||||
timestep={item.metric.timestep}
|
||||
cluster={clusters.find((c) => c.name == cluster)}
|
||||
|
@ -50,7 +50,6 @@
|
||||
const clusters = getContext("clusters");
|
||||
const globalMetrics = getContext("globalMetrics");
|
||||
|
||||
let plotHeight = 300;
|
||||
let hostnameFilter = "";
|
||||
let selectedMetric = ccconfig.system_view_selectedMetric;
|
||||
|
||||
@ -208,7 +207,6 @@
|
||||
</h4>
|
||||
{#if item.disabled === false && item.data}
|
||||
<MetricPlot
|
||||
height={plotHeight}
|
||||
timestep={item.data.metric.timestep}
|
||||
series={item.data.metric.series}
|
||||
metric={item.data.name}
|
||||
|
@ -179,7 +179,6 @@
|
||||
{#if metric.disabled == false && metric.data}
|
||||
<MetricPlot
|
||||
on:zoom={({detail}) => { handleZoom(detail, metric.data.name) }}
|
||||
width={plotWidth}
|
||||
height={plotHeight}
|
||||
timestep={metric.data.metric.timestep}
|
||||
scope={metric.data.scope}
|
||||
|
@ -6,8 +6,7 @@
|
||||
Properties:
|
||||
- `metric String`: The metric name
|
||||
- `scope String?`: Scope of the displayed data [Default: node]
|
||||
- `width Number`: The plot width
|
||||
- `height Number`: The plot height
|
||||
- `height Number?`: The plot height [Default: 300]
|
||||
- `timestep Number`: The timestep used for X-axis rendering
|
||||
- `series [GraphQL.Series]`: The metric data object
|
||||
- `useStatsSeries Bool?`: If this plot uses the statistics Min/Max/Median representation; automatically set to according bool [Default: null]
|
||||
@ -118,8 +117,7 @@
|
||||
|
||||
export let metric;
|
||||
export let scope = "node";
|
||||
export let width;
|
||||
export let height;
|
||||
export let height = 300;
|
||||
export let timestep;
|
||||
export let series;
|
||||
export let useStatsSeries = null;
|
||||
@ -132,15 +130,17 @@
|
||||
export let numaccs = 0;
|
||||
export let zoomState = null;
|
||||
|
||||
let width;
|
||||
|
||||
if (useStatsSeries == null) useStatsSeries = statisticsSeries != null;
|
||||
if (useStatsSeries == false && series == null) useStatsSeries = true;
|
||||
const usesMeanStatsSeries = (useStatsSeries && statisticsSeries.mean.length != 0)
|
||||
|
||||
const usesMeanStatsSeries = (useStatsSeries && statisticsSeries.mean.length != 0)
|
||||
const dispatch = createEventDispatcher();
|
||||
const subClusterTopology = getContext("getHardwareTopology")(cluster, subCluster);
|
||||
const metricConfig = getContext("getMetricConfig")(cluster, subCluster, metric);
|
||||
const clusterCockpitConfig = getContext("cc-config");
|
||||
const renderSleepTime = 100;
|
||||
const renderSleepTime = 200;
|
||||
const normalLineColor = "#000000";
|
||||
const lineWidth =
|
||||
clusterCockpitConfig.plot_general_lineWidth / window.devicePixelRatio;
|
||||
@ -164,8 +164,6 @@
|
||||
let resampleResolutions;
|
||||
let resampleMinimum;
|
||||
|
||||
let wrapperWidth = 0;
|
||||
|
||||
if (resampleConfig) {
|
||||
resampleTrigger = Number(resampleConfig.trigger)
|
||||
resampleResolutions = [...resampleConfig.resolutions];
|
||||
@ -498,23 +496,32 @@
|
||||
// RENDER HANDLING
|
||||
let plotWrapper = null;
|
||||
let uplot = null;
|
||||
// let timeoutId = null;
|
||||
let timeoutId = null;
|
||||
|
||||
function render(func_width, func_height) {
|
||||
function render(ren_width, ren_height) {
|
||||
if (!uplot) { // Init uPlot
|
||||
opts.width = func_width;
|
||||
opts.height = func_height;
|
||||
opts.width = ren_width;
|
||||
opts.height = ren_height;
|
||||
if (zoomState) {
|
||||
opts.scales = {...zoomState}
|
||||
}
|
||||
// console.log('Init Sizes ...', { width: opts.width, height: opts.height })
|
||||
uplot = new uPlot(opts, plotData, plotWrapper);
|
||||
} else { // Update size
|
||||
// console.log('Update uPlot ...', { width: func_width, height: func_height })
|
||||
uplot.setSize({ width: func_width, height: func_height });
|
||||
// console.log('Update uPlot ...', { width: ren_width, height: ren_height })
|
||||
uplot.setSize({ width: ren_width, height: ren_height });
|
||||
}
|
||||
}
|
||||
|
||||
function onSizeChange(chg_width, chg_height) {
|
||||
if (!uplot) return;
|
||||
if (timeoutId != null) clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutId = null;
|
||||
render(chg_width, chg_height);
|
||||
}, renderSleepTime);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
// Setup Wrapper
|
||||
if (series[0].data.length > 0) {
|
||||
@ -525,35 +532,31 @@
|
||||
plotWrapper.style.backgroundColor = backgroundColor();
|
||||
plotWrapper.style.borderRadius = "5px";
|
||||
}
|
||||
// Init Plot
|
||||
render(width, height);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
// if (timeoutId != null) clearTimeout(timeoutId);
|
||||
if (timeoutId != null) clearTimeout(timeoutId);
|
||||
if (uplot) uplot.destroy();
|
||||
});
|
||||
|
||||
$: width = wrapperWidth;
|
||||
|
||||
// This renders uPlot initially and updates it on all size changes
|
||||
$: if (width > 0 && height > 0) {
|
||||
// console.log('Triggered render() ...')
|
||||
|
||||
// if (timeoutId != null) {
|
||||
// clearTimeout(timeoutId);
|
||||
// timeoutId = null;
|
||||
// }
|
||||
// timeoutId = setTimeout(render(width, height), renderSleepTime);
|
||||
|
||||
setTimeout(render(width, height), renderSleepTime);
|
||||
// This updates it on all size changes
|
||||
// Condition for reactive triggering (eg scope change)
|
||||
$: if (series[0].data.length > 0) {
|
||||
onSizeChange(width, height);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Define Wrapper and NoData Card -->
|
||||
{#if series[0].data.length > 0}
|
||||
<div bind:clientWidth={wrapperWidth} bind:this={plotWrapper}/>
|
||||
{:else}
|
||||
<Card class="mx-4" body color="warning"
|
||||
>Cannot render plot: No series data returned for <code>{metric}</code></Card
|
||||
>
|
||||
{/if}
|
||||
<!-- Define Wrapper and NoData Card within $width -->
|
||||
<div bind:clientWidth={width}>
|
||||
{#if series[0].data.length > 0}
|
||||
<div bind:this={plotWrapper}/>
|
||||
{:else}
|
||||
<Card class="mx-4" body color="warning"
|
||||
>Cannot render plot: No series data returned for <code>{metric}</code></Card
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
- `metricUnit Object`: The metrics GQL unit object
|
||||
- `nativeScope String`: The metrics native scope
|
||||
- `scopes [String]`: The scopes returned for this metric
|
||||
- `width Number`: Nested plot width
|
||||
- `rawData [Object]`: Metric data for all scopes returned for this metric
|
||||
- `isShared Bool?`: If this job used shared resources; will adapt threshold indicators accordingly in downstream plots [Default: false]
|
||||
-->
|
||||
@ -38,7 +37,6 @@
|
||||
export let metricUnit;
|
||||
export let nativeScope;
|
||||
export let scopes;
|
||||
export let width;
|
||||
export let rawData;
|
||||
export let isShared = false;
|
||||
|
||||
@ -165,7 +163,6 @@
|
||||
}
|
||||
|
||||
$: data = rawData[selectedScopeIndex];
|
||||
|
||||
$: series = data?.series?.filter(
|
||||
(series) => selectedHost == null || series.hostname == selectedHost,
|
||||
);
|
||||
@ -203,8 +200,6 @@
|
||||
{:else if series != null && !patternMatches}
|
||||
<Timeseries
|
||||
on:zoom={({detail}) => { handleZoom(detail) }}
|
||||
{width}
|
||||
height={300}
|
||||
cluster={job.cluster}
|
||||
subCluster={job.subCluster}
|
||||
timestep={data.timestep}
|
||||
@ -217,8 +212,6 @@
|
||||
{:else if statsSeries[selectedScopeIndex] != null && patternMatches}
|
||||
<Timeseries
|
||||
on:zoom={({detail}) => { handleZoom(detail) }}
|
||||
{width}
|
||||
height={300}
|
||||
cluster={job.cluster}
|
||||
subCluster={job.subCluster}
|
||||
timestep={data.timestep}
|
||||
|
Loading…
Reference in New Issue
Block a user