diff --git a/dist/module.js b/dist/module.js index 5f39d7e..dcdb795 100644 --- a/dist/module.js +++ b/dist/module.js @@ -157,8 +157,7 @@ System.register(["lodash", "./color_legend", "./options_editor", "./tooltip_edit _export("renderComplete", renderComplete = { name: 'statusmap-render-complete' - }); // eventFactory('statusmap-render-complete'); - + }); _export("PanelCtrl", _export("StatusHeatmapCtrl", StatusHeatmapCtrl = /*#__PURE__*/ @@ -267,7 +266,7 @@ System.register(["lodash", "./color_legend", "./options_editor", "./tooltip_edit CoreEvents.fallbackToStringEvents(); PanelEvents.fallbackToStringEvents(); - _export("renderComplete", renderComplete = renderComplete.name); + _export("renderComplete", renderComplete = 'statusmap-render-complete'); } migratePanelConfig(_this.panel); diff --git a/dist/module.js.map b/dist/module.js.map index 97ee401..95b0007 100644 --- a/dist/module.js.map +++ b/dist/module.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/module.ts"],"names":["_","optionsEditorCtrl","tooltipEditorCtrl","migratePanelConfig","kbn","loadPluginCss","MetricsPanelCtrl","CoreEvents","PanelEvents","Bucket","BucketMatrix","BucketMatrixPager","rendering","Polygrafill","ColorModeDiscrete","VALUE_INDEX","TIME_INDEX","colorSchemes","name","value","invert","colorModes","opacityScales","dark","light","renderComplete","StatusHeatmapCtrl","$scope","$injector","annotationsSrv","datasource","color","mode","cardColor","colorScale","exponent","colorScheme","defaultColor","thresholds","cards","cardMinWidth","cardVSpacing","cardHSpacing","cardRound","xAxis","show","yAxis","minWidth","maxWidth","tooltip","freezeOnClick","showItems","items","legend","nullPointMode","yAxisSort","highlightCards","useMax","seriesFilterIndex","usingPagination","pageSize","hasAppEventCompatibleEmitter","events","fallbackToStringEvents","panel","defaultsDeep","panelDefaults","bucketMatrix","bucketMatrixPager","setEnable","setDefaultPageSize","setPageSize","pager","graph","multipleValues","noColorDefined","discreteExtraSeries","dataWarnings","title","tip","noDatapoints","annotations","on","render","onRender","bind","dataReceived","onDataReceived","dataError","onDataError","dataSnapshotLoad","editModeInitialized","onInitEditMode","refresh","postRefresh","onRenderComplete","onCardColorChange","data","chartWidth","renderingCompleted","defaultPageSize","pageSizeViewer","setCurrent","switchToPrev","switchToNext","wndWidth","$","window","width","panelWidthFactor","gridPos","w","panelWidth","Math","ceil","max","ret","calculateInterval","getChartWidth","minCardWidth","minSpacing","maxCardsCount","intervalMs","rangeMs","range","to","valueOf","from","roundIntervalCeil","lowLimitMs","intervalOverride","interval","templateSrv","replace","scopedVars","slice","interval_to_ms","secondsToHms","annotationsPromise","getAnnotations","dashboard","datasourcePromises","then","r","issueQueriesWithInterval","origInterval","res","dataList","newBucketMatrix","convertDataToBuckets","targets","length","result","loading","addEditorTab","unitFormats","getUnitFormats","updateCardsValuesHasColorInfo","updateCardsValuesHasColorInfoSingle","newColor","scope","elem","attrs","ctrl","time","timeSrv","timeRangeForUrl","mostRecentBucket","buckets","xBucketSize","targetIndex","map","queryResult","i","yLabel","target","hasOwnProperty","push","targetKeys","keys","targetTimestampRanges","targetTimestamps","si","s","datapoints","datapoint","idx","uniq","tsTo","tsFrom","minFrom","targetEmptyBuckets","lastTs","topBucket","relTo","relFrom","values","mostRecent","bucketFrom","b","bucket","xid","minValue","Number","MAX_VALUE","maxValue","MIN_SAFE_INTEGER","dataIndex","dp","belong","put","min","bucketsLen"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACOA,MAAAA,C;;AAKEC,MAAAA,iB,mBAAAA,iB;;AACAC,MAAAA,iB,mBAAAA,iB;;AACAC,MAAAA,kB,2BAAAA,kB;;AAGFC,MAAAA,G;;AACCC,MAAAA,a,kBAAAA,a;AAGCC,MAAAA,gB,kBAAAA,gB;;AAEAC,MAAAA,U,2BAAAA,U;AAAYC,MAAAA,W,2BAAAA,W;;AACbC,MAAAA,M,mBAAAA,M;AAAQC,MAAAA,Y,mBAAAA,Y;AAAcC,MAAAA,iB,mBAAAA,iB;;AACvBC,MAAAA,S;;AACEC,MAAAA,W,yBAAAA,W;;AAGDC,MAAAA,iB,wBA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,MAAM,CAACK,QAA/B;AACD;;AACDL,gBAAAA,MAAM,CAACrL,KAAP,GAAeqL,MAAM,CAACK,QAAtB;;AACA,oBAAIL,MAAM,CAACJ,MAAP,CAAc7C,MAAd,GAAuB,CAA3B,EAA8B;AAC5BpF,kBAAAA,YAAY,CAACO,cAAb,GAA8B,IAA9B;AACA8H,kBAAAA,MAAM,CAAC9H,cAAP,GAAwB,IAAxB;AAEA8H,kBAAAA,MAAM,CAACrL,KAAP,GAAe,MAAI,CAAC6C,KAAL,CAAWN,iBAAX,IAAgC,CAAC,CAAjC,GAAqC8I,MAAM,CAACJ,MAAP,CAAc,MAAI,CAACpI,KAAL,CAAWN,iBAAzB,CAArC,GAAmF8I,MAAM,CAACK,QAAzG;AACD;AACF,eAhBD;AAiBD,aA5BD;AA8BA1I,YAAAA,YAAY,CAACsG,WAAb,GAA2BkC,MAAM,CAACG,gBAAlC;AACA5B,YAAAA,UAAU,CAACP,GAAX,CAAe,UAACI,MAAD,EAAY;AACzB,kBAAIqC,UAAkB,GAAGjJ,YAAY,CAACqG,OAAb,CAAqBO,MAArB,EAA6BxB,MAAtD;;AACA,kBAAI6D,UAAU,GAAGjJ,YAAY,CAACsG,WAA9B,EAA2C;AACzCtG,gBAAAA,YAAY,CAACsG,WAAb,GAA2B2C,UAA3B;AACD;AACF,aALD,EApKiH,CA2KjH;;AAEAjJ,YAAAA,YAAY,CAACmF,OAAb,GAAuB4B,UAAvB;AACA,mBAAO/G,YAAP;AACD;;;;QApmB6B7D,gB;;sBAA1BoB,iB,iBACiB,a","sourcesContent":["// Libraries\nimport _ from 'lodash';\nimport { auto } from 'angular';\n\n// Components\nimport './color_legend';\nimport { optionsEditorCtrl } from './options_editor';\nimport { tooltipEditorCtrl } from './tooltip_editor';\nimport { migratePanelConfig } from './panel_config_migration';\n\n// Utils\nimport kbn from 'app/core/utils/kbn';\nimport {loadPluginCss} from 'app/plugins/sdk';\n\n// Types\nimport { MetricsPanelCtrl } from 'app/plugins/sdk';\nimport { AnnotationsSrv } from 'app/features/annotations/annotations_srv';\nimport { CoreEvents, PanelEvents } from './libs/grafana/events/index';\nimport {Bucket, BucketMatrix, BucketMatrixPager } from './statusmap_data';\nimport rendering from './rendering';\nimport { Polygrafill } from './libs/polygrafill/index';\n\n\nimport {ColorModeDiscrete} from \"./color_mode_discrete\";\n\nconst VALUE_INDEX = 0,\n TIME_INDEX = 1;\n\nconst colorSchemes = [\n // Diverging\n { name: 'Spectral', value: 'interpolateSpectral', invert: 'always' },\n { name: 'RdYlGn', value: 'interpolateRdYlGn', invert: 'always' },\n { name: 'GnYlRd', value: 'interpolateGnYlRd', invert: 'always' },\n\n // Sequential (Single Hue)\n { name: 'Blues', value: 'interpolateBlues', invert: 'dark' },\n { name: 'Greens', value: 'interpolateGreens', invert: 'dark' },\n { name: 'Greys', value: 'interpolateGreys', invert: 'dark' },\n { name: 'Oranges', value: 'interpolateOranges', invert: 'dark' },\n { name: 'Purples', value: 'interpolatePurples', invert: 'dark' },\n { name: 'Reds', value: 'interpolateReds', invert: 'dark' },\n\n // Sequential (Multi-Hue)\n { name: 'BuGn', value: 'interpolateBuGn', invert: 'dark' },\n { name: 'BuPu', value: 'interpolateBuPu', invert: 'dark' },\n { name: 'GnBu', value: 'interpolateGnBu', invert: 'dark' },\n { name: 'OrRd', value: 'interpolateOrRd', invert: 'dark' },\n { name: 'PuBuGn', value: 'interpolatePuBuGn', invert: 'dark' },\n { name: 'PuBu', value: 'interpolatePuBu', invert: 'dark' },\n { name: 'PuRd', value: 'interpolatePuRd', invert: 'dark' },\n { name: 'RdPu', value: 'interpolateRdPu', invert: 'dark' },\n { name: 'YlGnBu', value: 'interpolateYlGnBu', invert: 'dark' },\n { name: 'YlGn', value: 'interpolateYlGn', invert: 'dark' },\n { name: 'YlOrBr', value: 'interpolateYlOrBr', invert: 'dark' },\n { name: 'YlOrRd', value: 'interpolateYlOrRd', invert: 'dark' }\n];\n\nlet colorModes = ['opacity', 'spectrum', 'discrete'];\nlet opacityScales = ['linear', 'sqrt'];\n\nloadPluginCss({\n dark: 'plugins/flant-statusmap-panel/css/statusmap.dark.css',\n light: 'plugins/flant-statusmap-panel/css/statusmap.light.css'\n});\n\nexport var renderComplete:any = {name:'statusmap-render-complete'}; // eventFactory('statusmap-render-complete');\n\nclass StatusHeatmapCtrl extends MetricsPanelCtrl {\n static templateUrl = 'module.html';\n\n data: any;\n bucketMatrix: BucketMatrix;\n bucketMatrixPager: BucketMatrixPager;\n\n graph: any;\n discreteHelper: ColorModeDiscrete;\n opacityScales: any = [];\n colorModes: any = [];\n colorSchemes: any = [];\n unitFormats: any;\n\n dataWarnings: {[warningId: string]: {title: string, tip: string}} = {};\n multipleValues: boolean;\n noColorDefined: boolean;\n noDatapoints: boolean;\n\n discreteExtraSeries: ColorModeDiscrete;\n\n annotations: object[] = [];\n annotationsPromise: any;\n\n // TODO remove this transient variable: use ng-model-options=\"{ getterSetter: true }\"\n pageSizeViewer: number = 15;\n\n panelDefaults: any = {\n // datasource name, null = default datasource\n datasource: null,\n // color mode\n color: {\n mode: 'spectrum',\n cardColor: '#b4ff00',\n colorScale: 'sqrt',\n exponent: 0.5,\n colorScheme: 'interpolateGnYlRd',\n // discrete mode settings\n defaultColor: '#757575',\n thresholds: [] // manual colors\n },\n // buckets settings\n cards: {\n cardMinWidth: 5,\n cardVSpacing: 2,\n cardHSpacing: 2,\n cardRound: null\n },\n xAxis: {\n show: true\n },\n yAxis: {\n show: true,\n minWidth: -1,\n maxWidth: -1\n },\n tooltip: {\n show: true,\n freezeOnClick: true,\n showItems: false,\n items: [] // see tooltip_editor.ts\n },\n legend: {\n show: true\n },\n // how null points should be handled\n nullPointMode: 'as empty',\n yAxisSort: 'metrics',\n highlightCards: true,\n useMax: true,\n\n seriesFilterIndex: -1,\n\n // Pagination options\n usingPagination: false,\n pageSize: 15\n };\n\n /** @ngInject */\n constructor($scope: any, $injector: auto.IInjectorService, private annotationsSrv: AnnotationsSrv) {\n super($scope, $injector);\n\n if(!Polygrafill.hasAppEventCompatibleEmitter(this.events)){\n CoreEvents.fallbackToStringEvents();\n PanelEvents.fallbackToStringEvents();\n renderComplete = renderComplete.name;\n }\n\n migratePanelConfig(this.panel);\n _.defaultsDeep(this.panel, this.panelDefaults);\n\n this.bucketMatrix = new BucketMatrix();\n\n // Create pager for bucketMatrix and restore page size.\n this.bucketMatrixPager = new BucketMatrixPager();\n this.bucketMatrixPager.setEnable(this.panel.usingPagination);\n this.bucketMatrixPager.setDefaultPageSize(this.panel.pageSize);\n this.bucketMatrixPager.setPageSize(this.panel.pageSize);\n $scope.pager = this.bucketMatrixPager;\n\n this.opacityScales = opacityScales;\n this.colorModes = colorModes;\n this.colorSchemes = colorSchemes;\n\n // default graph width for discrete card width calculation\n this.graph = {\n \"chartWidth\" : -1\n };\n\n this.multipleValues = false;\n this.noColorDefined = false;\n\n this.discreteExtraSeries = new ColorModeDiscrete($scope);\n\n this.dataWarnings = {\n noColorDefined: {\n title: 'Data has value with undefined color',\n tip: 'Check metric values, color values or define a new color',\n },\n multipleValues: {\n title: 'Data has multiple values for one target',\n tip: 'Change targets definitions or set \"use max value\"',\n },\n noDatapoints: {\n title: 'No data points',\n tip: 'No datapoints returned from data query',\n }\n };\n\n this.annotations = [];\n this.annotationsSrv = annotationsSrv;\n\n this.events.on(PanelEvents.render, this.onRender.bind(this));\n this.events.on(PanelEvents.dataReceived, this.onDataReceived.bind(this));\n this.events.on(PanelEvents.dataError, this.onDataError.bind(this));\n this.events.on(PanelEvents.dataSnapshotLoad, this.onDataReceived.bind(this));\n this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));\n this.events.on(PanelEvents.refresh, this.postRefresh.bind(this));\n // custom event from rendering.js\n this.events.on(renderComplete, this.onRenderComplete.bind(this));\n\n this.onCardColorChange = this.onCardColorChange.bind(this);\n }\n\n onRenderComplete(data: any):void {\n this.graph.chartWidth = data.chartWidth;\n this.renderingCompleted();\n }\n\n changeDefaultPaginationSize(defaultPageSize: number): void {\n this.bucketMatrixPager.setDefaultPageSize(defaultPageSize);\n this.bucketMatrixPager.setPageSize(defaultPageSize);\n this.pageSizeViewer = defaultPageSize;\n\n this.render();\n this.refresh();\n }\n\n onChangePageSize(): void {\n if (this.pageSizeViewer <= 0) {\n this.pageSizeViewer = this.bucketMatrixPager.defaultPageSize;\n }\n this.bucketMatrixPager.setPageSize(this.pageSizeViewer);\n this.bucketMatrixPager.setCurrent(0);\n\n this.render();\n this.refresh();\n }\n\n onPrevPage(): void {\n this.bucketMatrixPager.switchToPrev();\n this.render();\n }\n\n onNextPage(): void {\n this.bucketMatrixPager.switchToNext();\n this.render();\n }\n\n\n // getChartWidth returns an approximation of chart canvas width or\n // a saved value calculated during a render.\n getChartWidth():number {\n if (this.graph.chartWidth > 0) {\n return this.graph.chartWidth;\n }\n\n const wndWidth = $(window).width();\n // gripPos.w is a width in grid's measurements. Grid size in Grafana is 24.\n const panelWidthFactor = this.panel.gridPos.w / 24;\n const panelWidth = Math.ceil(wndWidth * panelWidthFactor);\n // approximate width of the chart draw canvas:\n // - y axis ticks are not rendered yet on first data receive,\n // so choose 200 as a decent value for y legend width\n // - chartWidth can not be lower than the half of the panel width.\n const chartWidth = _.max([\n panelWidth - 200,\n panelWidth/2\n ]);\n\n return chartWidth!;\n }\n\n // Quick workaround for 6.7 and 7.0+. There is no call to\n // calculateInterval in updateTimeRange in those versions.\n // TODO ts type has no argument for this method.\n updateTimeRange(datasource?: any) {\n let ret = super.updateTimeRange(datasource);\n this.calculateInterval();\n return ret;\n }\n\n // calculateInterval is called on 'refresh' to calculate an interval\n // for datasource.\n // It is override of calculateInterval from MetricsPanelCtrl.\n calculateInterval() {\n let chartWidth = this.getChartWidth();\n\n let minCardWidth = this.panel.cards.cardMinWidth;\n let minSpacing = this.panel.cards.cardHSpacing;\n let maxCardsCount = Math.ceil((chartWidth-minCardWidth) / (minCardWidth + minSpacing));\n\n let intervalMs;\n let rangeMs = this.range.to.valueOf() - this.range.from.valueOf();\n\n // this is minimal interval! kbn.round_interval will lower it.\n intervalMs = this.discreteExtraSeries.roundIntervalCeil(rangeMs / maxCardsCount);\n\n // Calculate low limit of interval\n let lowLimitMs = 1; // 1 millisecond default low limit\n \n let intervalOverride = this.panel.interval;\n\n // if no panel interval check datasource\n if (intervalOverride) {\n intervalOverride = this.templateSrv.replace(intervalOverride, this.panel.scopedVars);\n } else if (this.datasource && this.datasource.interval) {\n intervalOverride = this.datasource.interval;\n }\n\n if (intervalOverride) {\n if (intervalOverride[0] === '>') {\n intervalOverride = intervalOverride.slice(1);\n }\n lowLimitMs = kbn.interval_to_ms(intervalOverride);\n }\n\n if (lowLimitMs > intervalMs) {\n intervalMs = lowLimitMs;\n }\n let interval = kbn.secondsToHms(intervalMs / 1000);\n\n this.intervalMs = intervalMs;\n this.interval = interval;\n\n // Get final buckets count after interval is adjusted\n // TODO is it needed?\n //this.xBucketsCount = Math.floor(rangeMs / intervalMs);\n }\n\n issueQueries(datasource: any) {\n this.annotationsPromise = this.annotationsSrv.getAnnotations({\n dashboard: this.dashboard,\n panel: this.panel,\n range: this.range,\n });\n\n /* Wait for annotationSrv requests to get datasources to\n * resolve before issuing queries. This allows the annotations\n * service to fire annotations queries before graph queries\n * (but not wait for completion). This resolves\n * issue 11806.\n */\n // 5.x before 5.4 doesn't have datasourcePromises.\n if (\"undefined\" !== typeof(this.annotationsSrv.datasourcePromises)) {\n return this.annotationsSrv.datasourcePromises.then(r => {\n return this.issueQueriesWithInterval(datasource, this.interval);\n });\n } else {\n return this.issueQueriesWithInterval(datasource, this.interval);\n }\n }\n\n // Grafana 6.2 (and older) is using this.interval for queries,\n // but Grafana 6.3+ is calculating interval again in queryRunner,\n // so we need to save-restore this.panel.interval.\n issueQueriesWithInterval(datasource: any, interval: any) {\n var origInterval = this.panel.interval;\n this.panel.interval = interval;\n var res = super.issueQueries(datasource);\n this.panel.interval = origInterval;\n return res;\n }\n\n onDataReceived(dataList: any) {\n this.data = dataList;\n // Quick workaround for 7.0+. There is no call to\n // calculateInterval when enter Edit mode.\n if (!this.intervalMs) {\n this.calculateInterval();\n }\n\n let newBucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true);\n\n this.bucketMatrix = newBucketMatrix;\n this.bucketMatrixPager.bucketMatrix = newBucketMatrix;\n if (newBucketMatrix.targets.length !== this.bucketMatrix.targets.length) {\n this.bucketMatrixPager.setCurrent(0);\n }\n\n this.noDatapoints = this.bucketMatrix.noDatapoints;\n\n if (this.annotationsPromise) {\n this.annotationsPromise.then(\n (result: { alertState: any; annotations: any }) => {\n this.loading = false;\n //this.alertState = result.alertState;\n if (result.annotations && result.annotations.length > 0) {\n this.annotations = result.annotations;\n } else {\n this.annotations = [];\n }\n this.render();\n },\n () => {\n this.loading = false;\n this.annotations = [];\n this.render();\n }\n );\n } else {\n this.loading = false;\n this.annotations = [];\n this.render();\n }\n }\n\n onInitEditMode() {\n this.addEditorTab('Options', optionsEditorCtrl, 2);\n this.addEditorTab('Tooltip', tooltipEditorCtrl, 3);\n this.unitFormats = kbn.getUnitFormats();\n }\n\n // onRender will be called before StatusmapRenderer.onRender.\n // Decide if warning should be displayed over cards.\n onRender() {\n if (!this.range || !this.data) {\n this.noDatapoints = true;\n return;\n }\n\n this.multipleValues = false;\n if (!this.panel.useMax) {\n if (this.bucketMatrix) {\n this.multipleValues = this.bucketMatrix.multipleValues;\n }\n }\n\n this.noColorDefined = false;\n if (this.panel.color.mode === 'discrete') {\n if (this.panel.seriesFilterIndex == -1) {\n this.discreteExtraSeries.updateCardsValuesHasColorInfo();\n } else {\n this.discreteExtraSeries.updateCardsValuesHasColorInfoSingle();\n }\n if (this.bucketMatrix) {\n this.noColorDefined = this.bucketMatrix.noColorDefined;\n }\n }\n\n this.noDatapoints = false;\n if (this.bucketMatrix) {\n this.noDatapoints = this.bucketMatrix.noDatapoints;\n }\n }\n\n onCardColorChange(newColor) {\n this.panel.color.cardColor = newColor;\n this.render();\n }\n\n onDataError() {\n this.data = [];\n this.annotations = [];\n this.render();\n }\n\n postRefresh() {\n this.noColorDefined = false;\n }\n\n link(scope, elem, attrs, ctrl) {\n rendering(scope, elem, attrs, ctrl);\n }\n\n // Compatible with Grafana 7.0 overrides feature.\n retrieveTimeVar() {\n var time = this.timeSrv.timeRangeForUrl();\n return 'from=' + time.from + '&to=' + time.to;\n }\n\n // convertToBuckets groups values in data into buckets by target and timestamp.\n //\n // data is a result from datasource. It is an array of timeseries and tables:\n /* [\n // timeseries\n {\n target: \"query alias\",\n refId: \"A\",\n datapoints: [\n [0, 1582681239911],\n [3, 158....],\n ...\n ],\n tags?:{key: value,...}\n },\n // table\n {\n name: \"table name\",\n refId: \"B\",\n columns: [\n {text: \"id\"},\n {text: \"info\"},\n ...\n ],\n rows: [\n [1, \"123\"],\n [2, \"44411\"],\n ...\n ]\n },\n...\n ]\n\n to and from — a time range of the panel.\n intervalMs — a calculated interval. It is used to split a time range.\n */\n convertDataToBuckets(data:any, from:number, to:number, intervalMs: number, mostRecentBucket: boolean):BucketMatrix {\n let bucketMatrix = new BucketMatrix();\n bucketMatrix.rangeMs = to - from;\n bucketMatrix.intervalMs = intervalMs;\n\n if (!data || data.length == 0) {\n // Mimic heatmap and graph 'no data' labels.\n bucketMatrix.targets = [\n \"1.0\", \"0.0\", \"-1.0\"\n ];\n bucketMatrix.buckets[\"1.0\"] = [];\n bucketMatrix.buckets[\"0.0\"] = [];\n bucketMatrix.buckets[\"-1.0\"] = [];\n bucketMatrix.xBucketSize = 42;\n bucketMatrix.noDatapoints = true;\n return bucketMatrix;\n }\n\n let targetIndex: {[target: string]: number[]} = {};\n\n // Group indicies of elements in data by target (y label).\n\n // lodash version:\n //_.map(data, (d, i) => {\n // targetIndex[d.target] = _.concat(_.toArray(targetIndex[d.target]), i);\n //});\n\n data.map((queryResult: any, i: number) => {\n let yLabel = queryResult.target;\n if (!targetIndex.hasOwnProperty(yLabel)) {\n targetIndex[yLabel] = [];\n }\n targetIndex[yLabel].push(i);\n });\n\n let targetKeys = _.keys(targetIndex);\n\n //console.log (\"targetIndex: \", targetIndex, \"targetKeys: \", targetKeys);\n\n let targetTimestampRanges: {[target: string]: {[timestamp: number]: number[]}} = {};\n\n // Collect all timestamps for each target.\n // Make map timestamp => [from, to]. from == previous ts, to == ts from datapoint.\n targetKeys.map((target) => {\n let targetTimestamps: any[] = [];\n\n for (let si = 0; si < targetIndex[target].length; si++) {\n let s = data[targetIndex[target][si]];\n _.map(s.datapoints, (datapoint, idx) => {\n targetTimestamps.push(datapoint[TIME_INDEX]-from);\n })\n }\n\n //console.log(\"timestamps['\"+target+\"'] = \", targetTimestamps);\n\n targetTimestamps = _.uniq(targetTimestamps);\n\n //console.log(\"uniq timestamps['\"+target+\"'] = \", targetTimestamps);\n\n targetTimestampRanges[target] = [];\n for (let i = targetTimestamps.length-1 ; i>=0; i-- ) {\n let tsTo = targetTimestamps[i];\n let tsFrom = 0;\n if (tsTo < 0) {\n tsFrom = tsTo - intervalMs;\n } else {\n if (i-1 >= 0) {\n // Set from to previous timestamp + 1ms;\n tsFrom = targetTimestamps[i-1]+1;\n // tfTo - tfFrom should not be more than intervalMs\n let minFrom = tsTo - intervalMs;\n if (tsFrom < minFrom) {\n tsFrom = minFrom;\n }\n }\n }\n targetTimestampRanges[target][tsTo] = [tsFrom, tsTo];\n }\n });\n\n // console.log (\"targetTimestampRanges: \", targetTimestampRanges);\n\n // Create empty buckets using intervalMs to calculate ranges.\n // If mostRecentBucket is set, create a bucket with a range \"to\":\"to\"\n // to store most recent values.\n targetKeys.map((target) => {\n let targetEmptyBuckets: any[] = [];\n\n let lastTs = to-from;\n\n if (mostRecentBucket) {\n let topBucket = new Bucket();\n topBucket.yLabel = target;\n topBucket.relTo = lastTs;\n topBucket.relFrom = lastTs;\n topBucket.values = [];\n topBucket.mostRecent = true;\n if (targetTimestampRanges[target].hasOwnProperty(lastTs)) {\n topBucket.relFrom = targetTimestampRanges[target][lastTs][0];\n lastTs = topBucket.relFrom;\n }\n topBucket.to = topBucket.relTo+from;\n topBucket.from = topBucket.relFrom+from;\n targetEmptyBuckets.push(topBucket);\n }\n\n let idx = 0;\n let bucketFrom: number = 0;\n while (bucketFrom >= 0) {\n let b = new Bucket();\n b.yLabel = target;\n b.relTo = lastTs - idx*intervalMs;\n b.relFrom = lastTs - ((idx+1) * intervalMs);\n b.to = b.relTo+from;\n b.from = b.relFrom+from;\n b.values = [];\n bucketFrom = b.relFrom;\n targetEmptyBuckets.push(b);\n idx++;\n }\n\n targetEmptyBuckets.map((bucket, i) => {\n bucket.xid = i;\n });\n\n bucketMatrix.buckets[target] = targetEmptyBuckets;\n });\n\n //console.log (\"bucketMatrix: \", bucketMatrix);\n\n // Put values into buckets.\n bucketMatrix.minValue = Number.MAX_VALUE;\n bucketMatrix.maxValue = Number.MIN_SAFE_INTEGER;\n targetKeys.map((target) => {\n targetIndex[target].map((dataIndex) => {\n let s = data[dataIndex];\n s.datapoints.map((dp: any) => {\n for (let i = 0; i < bucketMatrix.buckets[target].length; i++) {\n if (bucketMatrix.buckets[target][i].belong(dp[TIME_INDEX])) {\n bucketMatrix.buckets[target][i].put(dp[VALUE_INDEX]);\n }\n }\n });\n });\n bucketMatrix.buckets[target].map((bucket) => {\n bucket.minValue = _.min(bucket.values);\n bucket.maxValue = _.max(bucket.values);\n if (bucket.minValue < bucketMatrix.minValue) {\n bucketMatrix.minValue = bucket.minValue;\n }\n if (bucket.maxValue > bucketMatrix.maxValue) {\n bucketMatrix.maxValue = bucket.maxValue;\n }\n bucket.value = bucket.maxValue;\n if (bucket.values.length > 1) {\n bucketMatrix.multipleValues = true;\n bucket.multipleValues = true;\n\n bucket.value = this.panel.seriesFilterIndex != -1 ? bucket.values[this.panel.seriesFilterIndex] : bucket.maxValue;\n }\n })\n });\n\n bucketMatrix.xBucketSize = Number.MIN_SAFE_INTEGER;\n targetKeys.map((target) => {\n let bucketsLen: number = bucketMatrix.buckets[target].length;\n if (bucketsLen > bucketMatrix.xBucketSize) {\n bucketMatrix.xBucketSize = bucketsLen;\n }\n });\n\n //console.log (\"bucketMatrix with values: \", bucketMatrix);\n\n bucketMatrix.targets = targetKeys;\n return bucketMatrix;\n }\n}\n\nexport {\n StatusHeatmapCtrl, StatusHeatmapCtrl as PanelCtrl\n};\n"],"file":"module.js"} \ No newline at end of file +{"version":3,"sources":["../src/module.ts"],"names":["_","optionsEditorCtrl","tooltipEditorCtrl","migratePanelConfig","kbn","loadPluginCss","MetricsPanelCtrl","CoreEvents","PanelEvents","Bucket","BucketMatrix","BucketMatrixPager","rendering","Polygrafill","ColorModeDiscrete","VALUE_INDEX","TIME_INDEX","colorSchemes","name","value","invert","colorModes","opacityScales","dark","light","renderComplete","StatusHeatmapCtrl","$scope","$injector","annotationsSrv","datasource","color","mode","cardColor","colorScale","exponent","colorScheme","defaultColor","thresholds","cards","cardMinWidth","cardVSpacing","cardHSpacing","cardRound","xAxis","show","yAxis","minWidth","maxWidth","tooltip","freezeOnClick","showItems","items","legend","nullPointMode","yAxisSort","highlightCards","useMax","seriesFilterIndex","usingPagination","pageSize","hasAppEventCompatibleEmitter","events","fallbackToStringEvents","panel","defaultsDeep","panelDefaults","bucketMatrix","bucketMatrixPager","setEnable","setDefaultPageSize","setPageSize","pager","graph","multipleValues","noColorDefined","discreteExtraSeries","dataWarnings","title","tip","noDatapoints","annotations","on","render","onRender","bind","dataReceived","onDataReceived","dataError","onDataError","dataSnapshotLoad","editModeInitialized","onInitEditMode","refresh","postRefresh","onRenderComplete","onCardColorChange","data","chartWidth","renderingCompleted","defaultPageSize","pageSizeViewer","setCurrent","switchToPrev","switchToNext","wndWidth","$","window","width","panelWidthFactor","gridPos","w","panelWidth","Math","ceil","max","ret","calculateInterval","getChartWidth","minCardWidth","minSpacing","maxCardsCount","intervalMs","rangeMs","range","to","valueOf","from","roundIntervalCeil","lowLimitMs","intervalOverride","interval","templateSrv","replace","scopedVars","slice","interval_to_ms","secondsToHms","annotationsPromise","getAnnotations","dashboard","datasourcePromises","then","r","issueQueriesWithInterval","origInterval","res","dataList","newBucketMatrix","convertDataToBuckets","targets","length","result","loading","addEditorTab","unitFormats","getUnitFormats","updateCardsValuesHasColorInfo","updateCardsValuesHasColorInfoSingle","newColor","scope","elem","attrs","ctrl","time","timeSrv","timeRangeForUrl","mostRecentBucket","buckets","xBucketSize","targetIndex","map","queryResult","i","yLabel","target","hasOwnProperty","push","targetKeys","keys","targetTimestampRanges","targetTimestamps","si","s","datapoints","datapoint","idx","uniq","tsTo","tsFrom","minFrom","targetEmptyBuckets","lastTs","topBucket","relTo","relFrom","values","mostRecent","bucketFrom","b","bucket","xid","minValue","Number","MAX_VALUE","maxValue","MIN_SAFE_INTEGER","dataIndex","dp","belong","put","min","bucketsLen"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACOA,MAAAA,C;;AAKEC,MAAAA,iB,mBAAAA,iB;;AACAC,MAAAA,iB,mBAAAA,iB;;AACAC,MAAAA,kB,2BAAAA,kB;;AAGFC,MAAAA,G;;AACCC,MAAAA,a,kBAAAA,a;AAGCC,MAAAA,gB,kBAAAA,gB;;AAEAC,MAAAA,U,2BAAAA,U;AAAYC,MAAAA,W,2BAAAA,W;;AACbC,MAAAA,M,mBAAAA,M;AAAQC,MAAAA,Y,mBAAAA,Y;AAAcC,MAAAA,iB,mBAAAA,iB;;AACvBC,MAAAA,S;;AACEC,MAAAA,W,yBAAAA,W;;AAGDC,MAAAA,iB,wBAAAA,iB;;;AAEFC,MAAAA,W,GAAc,C;AACdC,MAAAA,U,GAAa,C;AAEbC,MAAAA,Y,GAAe,CACnB;AACA;AAAEC,QAAAA,IAAI,EAAE,UAAR;AAAoBC,QAAAA,KAAK,EAAE,qBAA3B;AAAkDC,QAAAA,MAAM,EAAE;AAA1D,OAFmB,EAGnB;AAAEF,QAAAA,IAAI,EAAE,QAAR;AAAkBC,QAAAA,KAAK,EAAE,mBAAzB;AAA8CC,QAAAA,MAAM,EAAE;AAAtD,OAHmB,EAInB;AAAEF,QAAAA,IAAI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AM,CAACJ,MAAP,CAAc,MAAI,CAACpI,KAAL,CAAWN,iBAAzB,CAArC,GAAmF8I,MAAM,CAACK,QAAzG;AACD;AACF,eAhBD;AAiBD,aA5BD;AA8BA1I,YAAAA,YAAY,CAACsG,WAAb,GAA2BkC,MAAM,CAACG,gBAAlC;AACA5B,YAAAA,UAAU,CAACP,GAAX,CAAe,UAACI,MAAD,EAAY;AACzB,kBAAIqC,UAAkB,GAAGjJ,YAAY,CAACqG,OAAb,CAAqBO,MAArB,EAA6BxB,MAAtD;;AACA,kBAAI6D,UAAU,GAAGjJ,YAAY,CAACsG,WAA9B,EAA2C;AACzCtG,gBAAAA,YAAY,CAACsG,WAAb,GAA2B2C,UAA3B;AACD;AACF,aALD,EApKiH,CA2KjH;;AAEAjJ,YAAAA,YAAY,CAACmF,OAAb,GAAuB4B,UAAvB;AACA,mBAAO/G,YAAP;AACD;;;;QApmB6B7D,gB;;sBAA1BoB,iB,iBACiB,a","sourcesContent":["// Libraries\nimport _ from 'lodash';\nimport { auto } from 'angular';\n\n// Components\nimport './color_legend';\nimport { optionsEditorCtrl } from './options_editor';\nimport { tooltipEditorCtrl } from './tooltip_editor';\nimport { migratePanelConfig } from './panel_config_migration';\n\n// Utils\nimport kbn from 'app/core/utils/kbn';\nimport {loadPluginCss} from 'app/plugins/sdk';\n\n// Types\nimport { MetricsPanelCtrl } from 'app/plugins/sdk';\nimport { AnnotationsSrv } from 'app/features/annotations/annotations_srv';\nimport { CoreEvents, PanelEvents } from './libs/grafana/events/index';\nimport {Bucket, BucketMatrix, BucketMatrixPager } from './statusmap_data';\nimport rendering from './rendering';\nimport { Polygrafill } from './libs/polygrafill/index';\n\n\nimport {ColorModeDiscrete} from \"./color_mode_discrete\";\n\nconst VALUE_INDEX = 0,\n TIME_INDEX = 1;\n\nconst colorSchemes = [\n // Diverging\n { name: 'Spectral', value: 'interpolateSpectral', invert: 'always' },\n { name: 'RdYlGn', value: 'interpolateRdYlGn', invert: 'always' },\n { name: 'GnYlRd', value: 'interpolateGnYlRd', invert: 'always' },\n\n // Sequential (Single Hue)\n { name: 'Blues', value: 'interpolateBlues', invert: 'dark' },\n { name: 'Greens', value: 'interpolateGreens', invert: 'dark' },\n { name: 'Greys', value: 'interpolateGreys', invert: 'dark' },\n { name: 'Oranges', value: 'interpolateOranges', invert: 'dark' },\n { name: 'Purples', value: 'interpolatePurples', invert: 'dark' },\n { name: 'Reds', value: 'interpolateReds', invert: 'dark' },\n\n // Sequential (Multi-Hue)\n { name: 'BuGn', value: 'interpolateBuGn', invert: 'dark' },\n { name: 'BuPu', value: 'interpolateBuPu', invert: 'dark' },\n { name: 'GnBu', value: 'interpolateGnBu', invert: 'dark' },\n { name: 'OrRd', value: 'interpolateOrRd', invert: 'dark' },\n { name: 'PuBuGn', value: 'interpolatePuBuGn', invert: 'dark' },\n { name: 'PuBu', value: 'interpolatePuBu', invert: 'dark' },\n { name: 'PuRd', value: 'interpolatePuRd', invert: 'dark' },\n { name: 'RdPu', value: 'interpolateRdPu', invert: 'dark' },\n { name: 'YlGnBu', value: 'interpolateYlGnBu', invert: 'dark' },\n { name: 'YlGn', value: 'interpolateYlGn', invert: 'dark' },\n { name: 'YlOrBr', value: 'interpolateYlOrBr', invert: 'dark' },\n { name: 'YlOrRd', value: 'interpolateYlOrRd', invert: 'dark' }\n];\n\nlet colorModes = ['opacity', 'spectrum', 'discrete'];\nlet opacityScales = ['linear', 'sqrt'];\n\nloadPluginCss({\n dark: 'plugins/flant-statusmap-panel/css/statusmap.dark.css',\n light: 'plugins/flant-statusmap-panel/css/statusmap.light.css'\n});\n\nexport var renderComplete:any = {name:'statusmap-render-complete'};\n\nclass StatusHeatmapCtrl extends MetricsPanelCtrl {\n static templateUrl = 'module.html';\n\n data: any;\n bucketMatrix: BucketMatrix;\n bucketMatrixPager: BucketMatrixPager;\n\n graph: any;\n discreteHelper: ColorModeDiscrete;\n opacityScales: any = [];\n colorModes: any = [];\n colorSchemes: any = [];\n unitFormats: any;\n\n dataWarnings: {[warningId: string]: {title: string, tip: string}} = {};\n multipleValues: boolean;\n noColorDefined: boolean;\n noDatapoints: boolean;\n\n discreteExtraSeries: ColorModeDiscrete;\n\n annotations: object[] = [];\n annotationsPromise: any;\n\n // TODO remove this transient variable: use ng-model-options=\"{ getterSetter: true }\"\n pageSizeViewer: number = 15;\n\n panelDefaults: any = {\n // datasource name, null = default datasource\n datasource: null,\n // color mode\n color: {\n mode: 'spectrum',\n cardColor: '#b4ff00',\n colorScale: 'sqrt',\n exponent: 0.5,\n colorScheme: 'interpolateGnYlRd',\n // discrete mode settings\n defaultColor: '#757575',\n thresholds: [] // manual colors\n },\n // buckets settings\n cards: {\n cardMinWidth: 5,\n cardVSpacing: 2,\n cardHSpacing: 2,\n cardRound: null\n },\n xAxis: {\n show: true\n },\n yAxis: {\n show: true,\n minWidth: -1,\n maxWidth: -1\n },\n tooltip: {\n show: true,\n freezeOnClick: true,\n showItems: false,\n items: [] // see tooltip_editor.ts\n },\n legend: {\n show: true\n },\n // how null points should be handled\n nullPointMode: 'as empty',\n yAxisSort: 'metrics',\n highlightCards: true,\n useMax: true,\n\n seriesFilterIndex: -1,\n\n // Pagination options\n usingPagination: false,\n pageSize: 15\n };\n\n /** @ngInject */\n constructor($scope: any, $injector: auto.IInjectorService, private annotationsSrv: AnnotationsSrv) {\n super($scope, $injector);\n\n if(!Polygrafill.hasAppEventCompatibleEmitter(this.events)){\n CoreEvents.fallbackToStringEvents();\n PanelEvents.fallbackToStringEvents();\n renderComplete = 'statusmap-render-complete';\n }\n\n migratePanelConfig(this.panel);\n _.defaultsDeep(this.panel, this.panelDefaults);\n\n this.bucketMatrix = new BucketMatrix();\n\n // Create pager for bucketMatrix and restore page size.\n this.bucketMatrixPager = new BucketMatrixPager();\n this.bucketMatrixPager.setEnable(this.panel.usingPagination);\n this.bucketMatrixPager.setDefaultPageSize(this.panel.pageSize);\n this.bucketMatrixPager.setPageSize(this.panel.pageSize);\n $scope.pager = this.bucketMatrixPager;\n\n this.opacityScales = opacityScales;\n this.colorModes = colorModes;\n this.colorSchemes = colorSchemes;\n\n // default graph width for discrete card width calculation\n this.graph = {\n \"chartWidth\" : -1\n };\n\n this.multipleValues = false;\n this.noColorDefined = false;\n\n this.discreteExtraSeries = new ColorModeDiscrete($scope);\n\n this.dataWarnings = {\n noColorDefined: {\n title: 'Data has value with undefined color',\n tip: 'Check metric values, color values or define a new color',\n },\n multipleValues: {\n title: 'Data has multiple values for one target',\n tip: 'Change targets definitions or set \"use max value\"',\n },\n noDatapoints: {\n title: 'No data points',\n tip: 'No datapoints returned from data query',\n }\n };\n\n this.annotations = [];\n this.annotationsSrv = annotationsSrv;\n\n this.events.on(PanelEvents.render, this.onRender.bind(this));\n this.events.on(PanelEvents.dataReceived, this.onDataReceived.bind(this));\n this.events.on(PanelEvents.dataError, this.onDataError.bind(this));\n this.events.on(PanelEvents.dataSnapshotLoad, this.onDataReceived.bind(this));\n this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));\n this.events.on(PanelEvents.refresh, this.postRefresh.bind(this));\n // custom event from rendering.js\n this.events.on(renderComplete, this.onRenderComplete.bind(this));\n\n this.onCardColorChange = this.onCardColorChange.bind(this);\n }\n\n onRenderComplete(data: any):void {\n this.graph.chartWidth = data.chartWidth;\n this.renderingCompleted();\n }\n\n changeDefaultPaginationSize(defaultPageSize: number): void {\n this.bucketMatrixPager.setDefaultPageSize(defaultPageSize);\n this.bucketMatrixPager.setPageSize(defaultPageSize);\n this.pageSizeViewer = defaultPageSize;\n\n this.render();\n this.refresh();\n }\n\n onChangePageSize(): void {\n if (this.pageSizeViewer <= 0) {\n this.pageSizeViewer = this.bucketMatrixPager.defaultPageSize;\n }\n this.bucketMatrixPager.setPageSize(this.pageSizeViewer);\n this.bucketMatrixPager.setCurrent(0);\n\n this.render();\n this.refresh();\n }\n\n onPrevPage(): void {\n this.bucketMatrixPager.switchToPrev();\n this.render();\n }\n\n onNextPage(): void {\n this.bucketMatrixPager.switchToNext();\n this.render();\n }\n\n\n // getChartWidth returns an approximation of chart canvas width or\n // a saved value calculated during a render.\n getChartWidth():number {\n if (this.graph.chartWidth > 0) {\n return this.graph.chartWidth;\n }\n\n const wndWidth = $(window).width();\n // gripPos.w is a width in grid's measurements. Grid size in Grafana is 24.\n const panelWidthFactor = this.panel.gridPos.w / 24;\n const panelWidth = Math.ceil(wndWidth * panelWidthFactor);\n // approximate width of the chart draw canvas:\n // - y axis ticks are not rendered yet on first data receive,\n // so choose 200 as a decent value for y legend width\n // - chartWidth can not be lower than the half of the panel width.\n const chartWidth = _.max([\n panelWidth - 200,\n panelWidth/2\n ]);\n\n return chartWidth!;\n }\n\n // Quick workaround for 6.7 and 7.0+. There is no call to\n // calculateInterval in updateTimeRange in those versions.\n // TODO ts type has no argument for this method.\n updateTimeRange(datasource?: any) {\n let ret = super.updateTimeRange(datasource);\n this.calculateInterval();\n return ret;\n }\n\n // calculateInterval is called on 'refresh' to calculate an interval\n // for datasource.\n // It is override of calculateInterval from MetricsPanelCtrl.\n calculateInterval() {\n let chartWidth = this.getChartWidth();\n\n let minCardWidth = this.panel.cards.cardMinWidth;\n let minSpacing = this.panel.cards.cardHSpacing;\n let maxCardsCount = Math.ceil((chartWidth-minCardWidth) / (minCardWidth + minSpacing));\n\n let intervalMs;\n let rangeMs = this.range.to.valueOf() - this.range.from.valueOf();\n\n // this is minimal interval! kbn.round_interval will lower it.\n intervalMs = this.discreteExtraSeries.roundIntervalCeil(rangeMs / maxCardsCount);\n\n // Calculate low limit of interval\n let lowLimitMs = 1; // 1 millisecond default low limit\n \n let intervalOverride = this.panel.interval;\n\n // if no panel interval check datasource\n if (intervalOverride) {\n intervalOverride = this.templateSrv.replace(intervalOverride, this.panel.scopedVars);\n } else if (this.datasource && this.datasource.interval) {\n intervalOverride = this.datasource.interval;\n }\n\n if (intervalOverride) {\n if (intervalOverride[0] === '>') {\n intervalOverride = intervalOverride.slice(1);\n }\n lowLimitMs = kbn.interval_to_ms(intervalOverride);\n }\n\n if (lowLimitMs > intervalMs) {\n intervalMs = lowLimitMs;\n }\n let interval = kbn.secondsToHms(intervalMs / 1000);\n\n this.intervalMs = intervalMs;\n this.interval = interval;\n\n // Get final buckets count after interval is adjusted\n // TODO is it needed?\n //this.xBucketsCount = Math.floor(rangeMs / intervalMs);\n }\n\n issueQueries(datasource: any) {\n this.annotationsPromise = this.annotationsSrv.getAnnotations({\n dashboard: this.dashboard,\n panel: this.panel,\n range: this.range,\n });\n\n /* Wait for annotationSrv requests to get datasources to\n * resolve before issuing queries. This allows the annotations\n * service to fire annotations queries before graph queries\n * (but not wait for completion). This resolves\n * issue 11806.\n */\n // 5.x before 5.4 doesn't have datasourcePromises.\n if (\"undefined\" !== typeof(this.annotationsSrv.datasourcePromises)) {\n return this.annotationsSrv.datasourcePromises.then(r => {\n return this.issueQueriesWithInterval(datasource, this.interval);\n });\n } else {\n return this.issueQueriesWithInterval(datasource, this.interval);\n }\n }\n\n // Grafana 6.2 (and older) is using this.interval for queries,\n // but Grafana 6.3+ is calculating interval again in queryRunner,\n // so we need to save-restore this.panel.interval.\n issueQueriesWithInterval(datasource: any, interval: any) {\n var origInterval = this.panel.interval;\n this.panel.interval = interval;\n var res = super.issueQueries(datasource);\n this.panel.interval = origInterval;\n return res;\n }\n\n onDataReceived(dataList: any) {\n this.data = dataList;\n // Quick workaround for 7.0+. There is no call to\n // calculateInterval when enter Edit mode.\n if (!this.intervalMs) {\n this.calculateInterval();\n }\n\n let newBucketMatrix = this.convertDataToBuckets(dataList, this.range.from.valueOf(), this.range.to.valueOf(), this.intervalMs, true);\n\n this.bucketMatrix = newBucketMatrix;\n this.bucketMatrixPager.bucketMatrix = newBucketMatrix;\n if (newBucketMatrix.targets.length !== this.bucketMatrix.targets.length) {\n this.bucketMatrixPager.setCurrent(0);\n }\n\n this.noDatapoints = this.bucketMatrix.noDatapoints;\n\n if (this.annotationsPromise) {\n this.annotationsPromise.then(\n (result: { alertState: any; annotations: any }) => {\n this.loading = false;\n //this.alertState = result.alertState;\n if (result.annotations && result.annotations.length > 0) {\n this.annotations = result.annotations;\n } else {\n this.annotations = [];\n }\n this.render();\n },\n () => {\n this.loading = false;\n this.annotations = [];\n this.render();\n }\n );\n } else {\n this.loading = false;\n this.annotations = [];\n this.render();\n }\n }\n\n onInitEditMode() {\n this.addEditorTab('Options', optionsEditorCtrl, 2);\n this.addEditorTab('Tooltip', tooltipEditorCtrl, 3);\n this.unitFormats = kbn.getUnitFormats();\n }\n\n // onRender will be called before StatusmapRenderer.onRender.\n // Decide if warning should be displayed over cards.\n onRender() {\n if (!this.range || !this.data) {\n this.noDatapoints = true;\n return;\n }\n\n this.multipleValues = false;\n if (!this.panel.useMax) {\n if (this.bucketMatrix) {\n this.multipleValues = this.bucketMatrix.multipleValues;\n }\n }\n\n this.noColorDefined = false;\n if (this.panel.color.mode === 'discrete') {\n if (this.panel.seriesFilterIndex == -1) {\n this.discreteExtraSeries.updateCardsValuesHasColorInfo();\n } else {\n this.discreteExtraSeries.updateCardsValuesHasColorInfoSingle();\n }\n if (this.bucketMatrix) {\n this.noColorDefined = this.bucketMatrix.noColorDefined;\n }\n }\n\n this.noDatapoints = false;\n if (this.bucketMatrix) {\n this.noDatapoints = this.bucketMatrix.noDatapoints;\n }\n }\n\n onCardColorChange(newColor) {\n this.panel.color.cardColor = newColor;\n this.render();\n }\n\n onDataError() {\n this.data = [];\n this.annotations = [];\n this.render();\n }\n\n postRefresh() {\n this.noColorDefined = false;\n }\n\n link(scope, elem, attrs, ctrl) {\n rendering(scope, elem, attrs, ctrl);\n }\n\n // Compatible with Grafana 7.0 overrides feature.\n retrieveTimeVar() {\n var time = this.timeSrv.timeRangeForUrl();\n return 'from=' + time.from + '&to=' + time.to;\n }\n\n // convertToBuckets groups values in data into buckets by target and timestamp.\n //\n // data is a result from datasource. It is an array of timeseries and tables:\n /* [\n // timeseries\n {\n target: \"query alias\",\n refId: \"A\",\n datapoints: [\n [0, 1582681239911],\n [3, 158....],\n ...\n ],\n tags?:{key: value,...}\n },\n // table\n {\n name: \"table name\",\n refId: \"B\",\n columns: [\n {text: \"id\"},\n {text: \"info\"},\n ...\n ],\n rows: [\n [1, \"123\"],\n [2, \"44411\"],\n ...\n ]\n },\n...\n ]\n\n to and from — a time range of the panel.\n intervalMs — a calculated interval. It is used to split a time range.\n */\n convertDataToBuckets(data:any, from:number, to:number, intervalMs: number, mostRecentBucket: boolean):BucketMatrix {\n let bucketMatrix = new BucketMatrix();\n bucketMatrix.rangeMs = to - from;\n bucketMatrix.intervalMs = intervalMs;\n\n if (!data || data.length == 0) {\n // Mimic heatmap and graph 'no data' labels.\n bucketMatrix.targets = [\n \"1.0\", \"0.0\", \"-1.0\"\n ];\n bucketMatrix.buckets[\"1.0\"] = [];\n bucketMatrix.buckets[\"0.0\"] = [];\n bucketMatrix.buckets[\"-1.0\"] = [];\n bucketMatrix.xBucketSize = 42;\n bucketMatrix.noDatapoints = true;\n return bucketMatrix;\n }\n\n let targetIndex: {[target: string]: number[]} = {};\n\n // Group indicies of elements in data by target (y label).\n\n // lodash version:\n //_.map(data, (d, i) => {\n // targetIndex[d.target] = _.concat(_.toArray(targetIndex[d.target]), i);\n //});\n\n data.map((queryResult: any, i: number) => {\n let yLabel = queryResult.target;\n if (!targetIndex.hasOwnProperty(yLabel)) {\n targetIndex[yLabel] = [];\n }\n targetIndex[yLabel].push(i);\n });\n\n let targetKeys = _.keys(targetIndex);\n\n //console.log (\"targetIndex: \", targetIndex, \"targetKeys: \", targetKeys);\n\n let targetTimestampRanges: {[target: string]: {[timestamp: number]: number[]}} = {};\n\n // Collect all timestamps for each target.\n // Make map timestamp => [from, to]. from == previous ts, to == ts from datapoint.\n targetKeys.map((target) => {\n let targetTimestamps: any[] = [];\n\n for (let si = 0; si < targetIndex[target].length; si++) {\n let s = data[targetIndex[target][si]];\n _.map(s.datapoints, (datapoint, idx) => {\n targetTimestamps.push(datapoint[TIME_INDEX]-from);\n })\n }\n\n //console.log(\"timestamps['\"+target+\"'] = \", targetTimestamps);\n\n targetTimestamps = _.uniq(targetTimestamps);\n\n //console.log(\"uniq timestamps['\"+target+\"'] = \", targetTimestamps);\n\n targetTimestampRanges[target] = [];\n for (let i = targetTimestamps.length-1 ; i>=0; i-- ) {\n let tsTo = targetTimestamps[i];\n let tsFrom = 0;\n if (tsTo < 0) {\n tsFrom = tsTo - intervalMs;\n } else {\n if (i-1 >= 0) {\n // Set from to previous timestamp + 1ms;\n tsFrom = targetTimestamps[i-1]+1;\n // tfTo - tfFrom should not be more than intervalMs\n let minFrom = tsTo - intervalMs;\n if (tsFrom < minFrom) {\n tsFrom = minFrom;\n }\n }\n }\n targetTimestampRanges[target][tsTo] = [tsFrom, tsTo];\n }\n });\n\n // console.log (\"targetTimestampRanges: \", targetTimestampRanges);\n\n // Create empty buckets using intervalMs to calculate ranges.\n // If mostRecentBucket is set, create a bucket with a range \"to\":\"to\"\n // to store most recent values.\n targetKeys.map((target) => {\n let targetEmptyBuckets: any[] = [];\n\n let lastTs = to-from;\n\n if (mostRecentBucket) {\n let topBucket = new Bucket();\n topBucket.yLabel = target;\n topBucket.relTo = lastTs;\n topBucket.relFrom = lastTs;\n topBucket.values = [];\n topBucket.mostRecent = true;\n if (targetTimestampRanges[target].hasOwnProperty(lastTs)) {\n topBucket.relFrom = targetTimestampRanges[target][lastTs][0];\n lastTs = topBucket.relFrom;\n }\n topBucket.to = topBucket.relTo+from;\n topBucket.from = topBucket.relFrom+from;\n targetEmptyBuckets.push(topBucket);\n }\n\n let idx = 0;\n let bucketFrom: number = 0;\n while (bucketFrom >= 0) {\n let b = new Bucket();\n b.yLabel = target;\n b.relTo = lastTs - idx*intervalMs;\n b.relFrom = lastTs - ((idx+1) * intervalMs);\n b.to = b.relTo+from;\n b.from = b.relFrom+from;\n b.values = [];\n bucketFrom = b.relFrom;\n targetEmptyBuckets.push(b);\n idx++;\n }\n\n targetEmptyBuckets.map((bucket, i) => {\n bucket.xid = i;\n });\n\n bucketMatrix.buckets[target] = targetEmptyBuckets;\n });\n\n //console.log (\"bucketMatrix: \", bucketMatrix);\n\n // Put values into buckets.\n bucketMatrix.minValue = Number.MAX_VALUE;\n bucketMatrix.maxValue = Number.MIN_SAFE_INTEGER;\n targetKeys.map((target) => {\n targetIndex[target].map((dataIndex) => {\n let s = data[dataIndex];\n s.datapoints.map((dp: any) => {\n for (let i = 0; i < bucketMatrix.buckets[target].length; i++) {\n if (bucketMatrix.buckets[target][i].belong(dp[TIME_INDEX])) {\n bucketMatrix.buckets[target][i].put(dp[VALUE_INDEX]);\n }\n }\n });\n });\n bucketMatrix.buckets[target].map((bucket) => {\n bucket.minValue = _.min(bucket.values);\n bucket.maxValue = _.max(bucket.values);\n if (bucket.minValue < bucketMatrix.minValue) {\n bucketMatrix.minValue = bucket.minValue;\n }\n if (bucket.maxValue > bucketMatrix.maxValue) {\n bucketMatrix.maxValue = bucket.maxValue;\n }\n bucket.value = bucket.maxValue;\n if (bucket.values.length > 1) {\n bucketMatrix.multipleValues = true;\n bucket.multipleValues = true;\n\n bucket.value = this.panel.seriesFilterIndex != -1 ? bucket.values[this.panel.seriesFilterIndex] : bucket.maxValue;\n }\n })\n });\n\n bucketMatrix.xBucketSize = Number.MIN_SAFE_INTEGER;\n targetKeys.map((target) => {\n let bucketsLen: number = bucketMatrix.buckets[target].length;\n if (bucketsLen > bucketMatrix.xBucketSize) {\n bucketMatrix.xBucketSize = bucketsLen;\n }\n });\n\n //console.log (\"bucketMatrix with values: \", bucketMatrix);\n\n bucketMatrix.targets = targetKeys;\n return bucketMatrix;\n }\n}\n\nexport {\n StatusHeatmapCtrl, StatusHeatmapCtrl as PanelCtrl\n};\n"],"file":"module.js"} \ No newline at end of file diff --git a/src/module.ts b/src/module.ts index 6b15cfe..cd0d0ea 100644 --- a/src/module.ts +++ b/src/module.ts @@ -63,7 +63,7 @@ loadPluginCss({ light: 'plugins/flant-statusmap-panel/css/statusmap.light.css' }); -export var renderComplete:any = {name:'statusmap-render-complete'}; // eventFactory('statusmap-render-complete'); +export var renderComplete:any = {name:'statusmap-render-complete'}; class StatusHeatmapCtrl extends MetricsPanelCtrl { static templateUrl = 'module.html'; @@ -150,7 +150,7 @@ class StatusHeatmapCtrl extends MetricsPanelCtrl { if(!Polygrafill.hasAppEventCompatibleEmitter(this.events)){ CoreEvents.fallbackToStringEvents(); PanelEvents.fallbackToStringEvents(); - renderComplete = renderComplete.name; + renderComplete = 'statusmap-render-complete'; } migratePanelConfig(this.panel);