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