|
@@ -48,7 +48,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
// rename panel type
|
|
// rename panel type
|
|
|
if (panel.type === 'graphite') {
|
|
if (panel.type === 'graphite') {
|
|
|
panel.type = 'graph';
|
|
panel.type = 'graph';
|
|
@@ -95,7 +95,7 @@ export class DashboardMigrator {
|
|
|
if (oldVersion < 3) {
|
|
if (oldVersion < 3) {
|
|
|
// ensure panel ids
|
|
// ensure panel ids
|
|
|
let maxId = this.dashboard.getNextPanelId();
|
|
let maxId = this.dashboard.getNextPanelId();
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (!panel.id) {
|
|
if (!panel.id) {
|
|
|
panel.id = maxId;
|
|
panel.id = maxId;
|
|
|
maxId += 1;
|
|
maxId += 1;
|
|
@@ -106,7 +106,7 @@ export class DashboardMigrator {
|
|
|
// schema version 4 changes
|
|
// schema version 4 changes
|
|
|
if (oldVersion < 4) {
|
|
if (oldVersion < 4) {
|
|
|
// move aliasYAxis changes
|
|
// move aliasYAxis changes
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.type !== 'graph') {
|
|
if (panel.type !== 'graph') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -151,7 +151,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ensure query refIds
|
|
// ensure query refIds
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
_.each(panel.targets, target => {
|
|
_.each(panel.targets, target => {
|
|
|
if (!target.refId) {
|
|
if (!target.refId) {
|
|
|
target.refId = panel.getNextQueryLetter && panel.getNextQueryLetter();
|
|
target.refId = panel.getNextQueryLetter && panel.getNextQueryLetter();
|
|
@@ -161,7 +161,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (oldVersion < 8) {
|
|
if (oldVersion < 8) {
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
_.each(panel.targets, target => {
|
|
_.each(panel.targets, target => {
|
|
|
// update old influxdb query schema
|
|
// update old influxdb query schema
|
|
|
if (target.fields && target.tags && target.groupBy) {
|
|
if (target.fields && target.tags && target.groupBy) {
|
|
@@ -206,7 +206,7 @@ export class DashboardMigrator {
|
|
|
// schema version 9 changes
|
|
// schema version 9 changes
|
|
|
if (oldVersion < 9) {
|
|
if (oldVersion < 9) {
|
|
|
// move aliasYAxis changes
|
|
// move aliasYAxis changes
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.type !== 'singlestat' && panel.thresholds !== '') {
|
|
if (panel.type !== 'singlestat' && panel.thresholds !== '') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -225,7 +225,7 @@ export class DashboardMigrator {
|
|
|
// schema version 10 changes
|
|
// schema version 10 changes
|
|
|
if (oldVersion < 10) {
|
|
if (oldVersion < 10) {
|
|
|
// move aliasYAxis changes
|
|
// move aliasYAxis changes
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.type !== 'table') {
|
|
if (panel.type !== 'table') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -259,7 +259,7 @@ export class DashboardMigrator {
|
|
|
|
|
|
|
|
if (oldVersion < 12) {
|
|
if (oldVersion < 12) {
|
|
|
// update graph yaxes changes
|
|
// update graph yaxes changes
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.type !== 'graph') {
|
|
if (panel.type !== 'graph') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -308,7 +308,7 @@ export class DashboardMigrator {
|
|
|
|
|
|
|
|
if (oldVersion < 13) {
|
|
if (oldVersion < 13) {
|
|
|
// update graph yaxes changes
|
|
// update graph yaxes changes
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.type !== 'graph') {
|
|
if (panel.type !== 'graph') {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -380,7 +380,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (oldVersion < 17) {
|
|
if (oldVersion < 17) {
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.minSpan) {
|
|
if (panel.minSpan) {
|
|
|
const max = GRID_COLUMN_COUNT / panel.minSpan;
|
|
const max = GRID_COLUMN_COUNT / panel.minSpan;
|
|
|
const factors = getFactors(GRID_COLUMN_COUNT);
|
|
const factors = getFactors(GRID_COLUMN_COUNT);
|
|
@@ -399,7 +399,7 @@ export class DashboardMigrator {
|
|
|
|
|
|
|
|
if (oldVersion < 18) {
|
|
if (oldVersion < 18) {
|
|
|
// migrate change to gauge options
|
|
// migrate change to gauge options
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel['options-gauge']) {
|
|
if (panel['options-gauge']) {
|
|
|
panel.options = panel['options-gauge'];
|
|
panel.options = panel['options-gauge'];
|
|
|
panel.options.valueOptions = {
|
|
panel.options.valueOptions = {
|
|
@@ -429,7 +429,7 @@ export class DashboardMigrator {
|
|
|
|
|
|
|
|
if (oldVersion < 19) {
|
|
if (oldVersion < 19) {
|
|
|
// migrate change to gauge options
|
|
// migrate change to gauge options
|
|
|
- panelUpgrades.push(panel => {
|
|
|
|
|
|
|
+ panelUpgrades.push((panel: any) => {
|
|
|
if (panel.links && _.isArray(panel.links)) {
|
|
if (panel.links && _.isArray(panel.links)) {
|
|
|
panel.links = panel.links.map(upgradePanelLink);
|
|
panel.links = panel.links.map(upgradePanelLink);
|
|
|
}
|
|
}
|
|
@@ -452,7 +452,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- upgradeToGridLayout(old) {
|
|
|
|
|
|
|
+ upgradeToGridLayout(old: any) {
|
|
|
let yPos = 0;
|
|
let yPos = 0;
|
|
|
const widthFactor = GRID_COLUMN_COUNT / 12;
|
|
const widthFactor = GRID_COLUMN_COUNT / 12;
|
|
|
|
|
|
|
@@ -541,7 +541,7 @@ export class DashboardMigrator {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function getGridHeight(height) {
|
|
|
|
|
|
|
+function getGridHeight(height: number | string) {
|
|
|
if (_.isString(height)) {
|
|
if (_.isString(height)) {
|
|
|
height = parseInt(height.replace('px', ''), 10);
|
|
height = parseInt(height.replace('px', ''), 10);
|
|
|
}
|
|
}
|
|
@@ -569,7 +569,7 @@ class RowArea {
|
|
|
yPos: number;
|
|
yPos: number;
|
|
|
height: number;
|
|
height: number;
|
|
|
|
|
|
|
|
- constructor(height, width = GRID_COLUMN_COUNT, rowYPos = 0) {
|
|
|
|
|
|
|
+ constructor(height: number, width = GRID_COLUMN_COUNT, rowYPos = 0) {
|
|
|
this.area = new Array(width).fill(0);
|
|
this.area = new Array(width).fill(0);
|
|
|
this.yPos = rowYPos;
|
|
this.yPos = rowYPos;
|
|
|
this.height = height;
|
|
this.height = height;
|
|
@@ -582,7 +582,7 @@ class RowArea {
|
|
|
/**
|
|
/**
|
|
|
* Update area after adding the panel.
|
|
* Update area after adding the panel.
|
|
|
*/
|
|
*/
|
|
|
- addPanel(gridPos) {
|
|
|
|
|
|
|
+ addPanel(gridPos: any) {
|
|
|
for (let i = gridPos.x; i < gridPos.x + gridPos.w; i++) {
|
|
for (let i = gridPos.x; i < gridPos.x + gridPos.w; i++) {
|
|
|
if (!this.area[i] || gridPos.y + gridPos.h - this.yPos > this.area[i]) {
|
|
if (!this.area[i] || gridPos.y + gridPos.h - this.yPos > this.area[i]) {
|
|
|
this.area[i] = gridPos.y + gridPos.h - this.yPos;
|
|
this.area[i] = gridPos.y + gridPos.h - this.yPos;
|
|
@@ -594,7 +594,7 @@ class RowArea {
|
|
|
/**
|
|
/**
|
|
|
* Calculate position for the new panel in the row.
|
|
* Calculate position for the new panel in the row.
|
|
|
*/
|
|
*/
|
|
|
- getPanelPosition(panelHeight, panelWidth, callOnce = false) {
|
|
|
|
|
|
|
+ getPanelPosition(panelHeight: number, panelWidth: number, callOnce = false): any {
|
|
|
let startPlace, endPlace;
|
|
let startPlace, endPlace;
|
|
|
let place;
|
|
let place;
|
|
|
for (let i = this.area.length - 1; i >= 0; i--) {
|
|
for (let i = this.area.length - 1; i >= 0; i--) {
|