diff --git a/doc/newsfragments/3037_new.resource_monitor.rst b/doc/newsfragments/3037_new.resource_monitor.rst new file mode 100755 index 000000000..c5036338a --- /dev/null +++ b/doc/newsfragments/3037_new.resource_monitor.rst @@ -0,0 +1 @@ +Add a new summary page on resource view to show the task allocation per host. \ No newline at end of file diff --git a/testplan/web_ui/testing/src/AssertionPane/ResourcePanel.js b/testplan/web_ui/testing/src/AssertionPane/ResourcePanel.js index 327556007..9ce0a6737 100755 --- a/testplan/web_ui/testing/src/AssertionPane/ResourcePanel.js +++ b/testplan/web_ui/testing/src/AssertionPane/ResourcePanel.js @@ -24,7 +24,9 @@ import prettyBytes from "pretty-bytes"; import { getResourceUrl, timeToTimestamp } from "../Common/utils"; import { RED, + LIGHT_RED, GREEN, + LIGHT_GREEN, BLUE, DARK_BLUE, TEAL, @@ -78,6 +80,12 @@ const prettySizeTicks = (options) => { }; }; +const normalizeStartEndTime = (timer) => { + const start = timer[0]?.setup?.start || timer[0]?.run?.start; + const end = timer[0]?.teardown?.end || timer[0]?.run?.end; + return start && end ? [start, end] : null; +}; + const AnchorDiv = ({ elementIds }) => { const anchorDiv = []; for (let uid of elementIds) { @@ -219,6 +227,10 @@ const TimerGraph = ({ timerEntries, startTime, endTime }) => { { data: [], backgroundColor: [], + borderColor: [], + borderWidth: 2, + borderRadius: Number.MAX_VALUE, + borderSkipped: false, barThickness: 6, minBarLength: 2, }, @@ -227,26 +239,13 @@ const TimerGraph = ({ timerEntries, startTime, endTime }) => { timerEntries.forEach((entity) => { labels.push(entity.name); datasets[0].backgroundColor.push( - // TODO: move color to a constant map + entity.status === STATUS_CATEGORY.passed ? LIGHT_GREEN : LIGHT_RED + ); + datasets[0].borderColor.push( entity.status === STATUS_CATEGORY.passed ? GREEN : RED ); - let start = null; - if (!_.isNil(entity.timer[0].setup?.start)) { - start = entity.timer[0].setup.start; - } else if (!_.isNil(entity.timer[0].run?.start)) { - start = entity.timer[0].run.start; - } else { - datasets[0].data.push(null); - return; - } - - if (!_.isNil(entity.timer[0].teardown?.end)) { - datasets[0].data.push([start, entity.timer[0].teardown.end]); - } else if (!_.isNil(entity.timer[0].run?.end)) { - datasets[0].data.push([start, entity.timer[0].run.end]); - } else { - datasets[0].data.push(null); - } + const normalizedTime = normalizeStartEndTime(entity.timer); + datasets[0].data.push(normalizedTime); }); const height = 10 + timerEntries.length * 5; return ( @@ -569,52 +568,84 @@ HostResource.propTypes = { endTime: PropTypes.number, }; -const TopUsageBanner = ({ maxCPU, maxMemory, maxDisk, maxIOPS }) => { +const TopBanner = ({ + maxCPU, + maxMemory, + maxDisk, + maxIOPS, + showSummary, + setShowSummary, +}) => { const itemStyle = { padding: "8px", - border: "1px solid #0597ff", - backgroundColor: "#e5f0f9", borderRadius: "2px", - color: "#115598", fontSize: "14px", fontWeight: "500", cursor: "pointer", }; + const itemBlueStyle = { + ...itemStyle, + border: "1px solid #0597ff", + backgroundColor: "#e5f0f9", + color: "#115598", + }; + const itemGreenStyle = { + ...itemStyle, + border: "1px solid #00875a", + backgroundColor: "#bcefc8", + color: "#0a5b19", + }; + const cpuDiv = _.isNil(maxCPU?.value, true) ? null : ( -