decide not to sort alerts by name
timelineGroups.push({group: "alerts", data: []})
createTimelineData(alertSeverity, timelineGroups[timelineGroups.length - 1].data, eventIntervals, isAlert)
+ // leaving this for posterity so future me (or someone else) can try it, but I think ordering by name makes the
+ // patterns shown by timing hide and timing appears more relevant to my eyes.
+ // sort alerts alphabetically for display purposes, but keep the json itself ordered by time.
+ // timelineGroups[timelineGroups.length - 1].data.sort(function (e1 ,e2){
+ // if (e1.label.includes("alert") && e2.label.includes("alert")) {
+ // return e1.label < e2.label ? -1 : e1.label > e2.label;
+ // }
+ // return 0
+ // })
timelineGroups.push({group: "node-state", data: []})
createTimelineData(nodeStateValue, timelineGroups[timelineGroups.length - 1].data, eventIntervals, isNodeState)
const el = document.querySelector('#chart');
const myChart = TimelinesChart();
var ordinalScale = d3.scaleOrdinal()
- .domain(['AlertInfo', 'AlertPending', 'AlertWarning', 'AlertCritical', 'OperatorUnavailable', 'OperatorDegraded', 'OperatorProgressing', 'Update', 'Drain', 'Reboot', 'OperatingSystemUpdate', 'NodeNotReady', 'Passed', 'Skipped', 'Flaked', 'Failed', 'Degraded', 'Upgradeable', 'False', 'Unknown'])
- .range(['#fada5e','#fada5e','#ffa500','#d0312d', '#d0312d', '#ffa500', '#fada5e', '#1e7bd9', '#4294e6', '#6aaef2', '#96cbff', '#fada5e', '#3cb043', '#ceba76', '#ffa500', '#d0312d', '#b65049', '#32b8b6', '#ffffff', '#bbbbbb']);
+ .domain([
+ 'AlertInfo', 'AlertPending', 'AlertWarning', 'AlertCritical', // alerts
+ 'OperatorUnavailable', 'OperatorDegraded', 'OperatorProgressing', // operators
+ 'Update', 'Drain', 'Reboot', 'OperatingSystemUpdate', 'NodeNotReady', // nodes
+ 'Passed', 'Skipped', 'Flaked', 'Failed', // tests
+ 'Degraded', 'Upgradeable', 'False', 'Unknown'])
+ .range([
+ '#fada5e','#fada5e','#ffa500','#d0312d', // alerts
+ '#d0312d', '#ffa500', '#fada5e', // operators
+ '#1e7bd9', '#4294e6', '#6aaef2', '#96cbff', '#fada5e', // nodes
+ '#3cb043', '#ceba76', '#ffa500', '#d0312d', // tests
+ '#b65049', '#32b8b6', '#ffffff', '#bbbbbb']);
myChart.data(timelineGroups).zQualitative(true).enableAnimations(false).leftMargin(240).rightMargin(550).maxLineHeight(20).maxHeight(10000).zColorScale(ordinalScale).onSegmentClick(segmentFunc)
(el);
