mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
prettier: ran on all files again, sorry. now settings are defined in package.json
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from "lodash";
|
||||
import { transformers } from "./transformers";
|
||||
import _ from 'lodash';
|
||||
import { transformers } from './transformers';
|
||||
|
||||
export class TablePanelEditorCtrl {
|
||||
panel: any;
|
||||
@@ -19,40 +19,26 @@ export class TablePanelEditorCtrl {
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
this.transformers = transformers;
|
||||
this.fontSizes = [
|
||||
"80%",
|
||||
"90%",
|
||||
"100%",
|
||||
"110%",
|
||||
"120%",
|
||||
"130%",
|
||||
"150%",
|
||||
"160%",
|
||||
"180%",
|
||||
"200%",
|
||||
"220%",
|
||||
"250%"
|
||||
];
|
||||
this.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%'];
|
||||
this.addColumnSegment = uiSegmentSrv.newPlusButton();
|
||||
this.updateTransformHints();
|
||||
}
|
||||
|
||||
updateTransformHints() {
|
||||
this.canSetColumns = false;
|
||||
this.columnsHelpMessage = "";
|
||||
this.columnsHelpMessage = '';
|
||||
|
||||
switch (this.panel.transform) {
|
||||
case "timeseries_aggregations": {
|
||||
case 'timeseries_aggregations': {
|
||||
this.canSetColumns = true;
|
||||
break;
|
||||
}
|
||||
case "json": {
|
||||
case 'json': {
|
||||
this.canSetColumns = true;
|
||||
break;
|
||||
}
|
||||
case "table": {
|
||||
this.columnsHelpMessage =
|
||||
"Columns and their order are determined by the data query";
|
||||
case 'table': {
|
||||
this.columnsHelpMessage = 'Columns and their order are determined by the data query';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,19 +47,13 @@ export class TablePanelEditorCtrl {
|
||||
if (!this.panelCtrl.dataRaw) {
|
||||
return this.$q.when([]);
|
||||
}
|
||||
var columns = this.transformers[this.panel.transform].getColumns(
|
||||
this.panelCtrl.dataRaw
|
||||
);
|
||||
var segments = _.map(columns, (c: any) =>
|
||||
this.uiSegmentSrv.newSegment({ value: c.text })
|
||||
);
|
||||
var columns = this.transformers[this.panel.transform].getColumns(this.panelCtrl.dataRaw);
|
||||
var segments = _.map(columns, (c: any) => this.uiSegmentSrv.newSegment({ value: c.text }));
|
||||
return this.$q.when(segments);
|
||||
}
|
||||
|
||||
addColumn() {
|
||||
var columns = transformers[this.panel.transform].getColumns(
|
||||
this.panelCtrl.dataRaw
|
||||
);
|
||||
var columns = transformers[this.panel.transform].getColumns(this.panelCtrl.dataRaw);
|
||||
var column = _.find(columns, { text: this.addColumnSegment.value });
|
||||
|
||||
if (column) {
|
||||
@@ -88,8 +68,8 @@ export class TablePanelEditorCtrl {
|
||||
|
||||
transformChanged() {
|
||||
this.panel.columns = [];
|
||||
if (this.panel.transform === "timeseries_aggregations") {
|
||||
this.panel.columns.push({ text: "Avg", value: "avg" });
|
||||
if (this.panel.transform === 'timeseries_aggregations') {
|
||||
this.panel.columns.push({ text: 'Avg', value: 'avg' });
|
||||
}
|
||||
|
||||
this.updateTransformHints();
|
||||
@@ -108,11 +88,11 @@ export class TablePanelEditorCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
export function tablePanelEditor($q, uiSegmentSrv) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return {
|
||||
restrict: "E",
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
templateUrl: "public/app/plugins/panel/table/editor.html",
|
||||
controller: TablePanelEditorCtrl
|
||||
templateUrl: 'public/app/plugins/panel/table/editor.html',
|
||||
controller: TablePanelEditorCtrl,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user