mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech: removing unused variables from typescript files, and making tslint rules more strict
This commit is contained in:
@@ -3,10 +3,8 @@
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import alertDef from '../../../features/alerting/alert_def';
|
||||
import config from 'app/core/config';
|
||||
import {PanelCtrl} from 'app/plugins/sdk';
|
||||
|
||||
import * as rangeUtil from 'app/core/utils/rangeutil';
|
||||
import * as dateMath from 'app/core/utils/datemath';
|
||||
|
||||
class AlertListPanel extends PanelCtrl {
|
||||
@@ -37,7 +35,7 @@ class AlertListPanel extends PanelCtrl {
|
||||
};
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, $injector, private $location, private backendSrv, private timeSrv, private templateSrv) {
|
||||
constructor($scope, $injector, private backendSrv) {
|
||||
super($scope, $injector);
|
||||
_.defaults(this.panel, this.panelDefaults);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
import {PanelCtrl} from 'app/plugins/sdk';
|
||||
import {impressions} from 'app/features/dashboard/impression_store';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class GettingStartedPanelCtrl extends PanelCtrl {
|
||||
steps: any;
|
||||
|
||||
/** @ngInject **/
|
||||
constructor($scope, $injector, private backendSrv, private datasourceSrv, private $q) {
|
||||
constructor($scope, $injector, private backendSrv, datasourceSrv, private $q) {
|
||||
super($scope, $injector);
|
||||
|
||||
this.stepIndex = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@ export class AxesEditorCtrl {
|
||||
constructor(private $scope, private $q) {
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
$scope.ctrl = this;
|
||||
this.$scope.ctrl = this;
|
||||
|
||||
this.unitFormats = kbn.getUnitFormats();
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import {colors} from 'app/core/core';
|
||||
|
||||
|
||||
@@ -146,16 +146,12 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
|
||||
|
||||
// add left axis labels
|
||||
if (panel.yaxes[0].label && panel.yaxes[0].show) {
|
||||
var yaxisLabel = $("<div class='axisLabel left-yaxis-label flot-temp-elem'></div>")
|
||||
.text(panel.yaxes[0].label)
|
||||
.appendTo(elem);
|
||||
$("<div class='axisLabel left-yaxis-label flot-temp-elem'></div>").text(panel.yaxes[0].label).appendTo(elem);
|
||||
}
|
||||
|
||||
// add right axis labels
|
||||
if (panel.yaxes[1].label && panel.yaxes[1].show) {
|
||||
var rightLabel = $("<div class='axisLabel right-yaxis-label flot-temp-elem'></div>")
|
||||
.text(panel.yaxes[1].label)
|
||||
.appendTo(elem);
|
||||
$("<div class='axisLabel right-yaxis-label flot-temp-elem'></div>").text(panel.yaxes[1].label).appendTo(elem);
|
||||
}
|
||||
|
||||
thresholdManager.draw(plot);
|
||||
@@ -619,12 +615,6 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv, popoverSrv) {
|
||||
return ticks;
|
||||
}
|
||||
|
||||
function decimalPlaces(num) {
|
||||
if (!num) { return 0; }
|
||||
|
||||
return (num.toString().split('.')[1] || []).length;
|
||||
}
|
||||
|
||||
function configureAxisMode(axis, format) {
|
||||
axis.tickFormatter = function(val, axis) {
|
||||
return kbn.valueFormats[format](val, axis.tickDecimals, axis.scaledDecimals);
|
||||
|
||||
@@ -6,10 +6,7 @@ import './series_overrides_ctrl';
|
||||
import './thresholds_form';
|
||||
|
||||
import template from './template';
|
||||
import angular from 'angular';
|
||||
import moment from 'moment';
|
||||
import _ from 'lodash';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import config from 'app/core/config';
|
||||
import {MetricsPanelCtrl, alertTab} from 'app/plugins/sdk';
|
||||
import {DataProcessor} from './data_processor';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
import {describe, beforeEach, it, expect} from '../../../../../test/lib/common';
|
||||
|
||||
import {DataProcessor} from '../data_processor';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
import {describe, beforeEach, it, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
|
||||
import angular from 'angular';
|
||||
import moment from 'moment';
|
||||
import {GraphCtrl} from '../module';
|
||||
import helpers from '../../../../../test/specs/helpers';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
import {describe, it, expect} from '../../../../../test/lib/common';
|
||||
|
||||
import {ThresholdManager} from '../threshold_manager';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
import {describe, beforeEach, it, sinon, expect} from '../../../../../test/lib/common';
|
||||
|
||||
import $ from 'jquery';
|
||||
import GraphTooltip from '../graph_tooltip';
|
||||
|
||||
@@ -61,8 +61,6 @@ export class ThresholdManager {
|
||||
graphValue = parseInt(graphValue.toFixed(0));
|
||||
model.value = graphValue;
|
||||
|
||||
var valueCanvasPos = plot.p2c({x: 0, y: graphValue});
|
||||
|
||||
handleElem.off("mousemove", dragging);
|
||||
handleElem.off("mouseup", dragging);
|
||||
handleElem.off("mouseleave", dragging);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
|
||||
import _ from 'lodash';
|
||||
import coreModule from 'app/core/core_module';
|
||||
|
||||
export class ThresholdFormCtrl {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
@@ -143,7 +144,6 @@ function drawLegendValues(elem, colorScale, rangeFrom, rangeTo, maxValue, minVal
|
||||
return;
|
||||
}
|
||||
|
||||
let legendValueDomain = _.sortBy(colorScale.domain());
|
||||
let legendValueScale = d3.scaleLinear()
|
||||
.domain([0, rangeTo])
|
||||
.range([0, legendWidth]);
|
||||
@@ -156,6 +156,7 @@ function drawLegendValues(elem, colorScale, rangeFrom, rangeTo, maxValue, minVal
|
||||
let colorRect = legendElem.find(":first-child");
|
||||
let posY = colorRect.height() + 2;
|
||||
let posX = getSvgElemX(colorRect);
|
||||
|
||||
d3.select(legendElem.get(0)).append("g")
|
||||
.attr("class", "axis")
|
||||
.attr("transform", "translate(" + posX + "," + posY + ")")
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import d3 from 'd3';
|
||||
import {contextSrv} from 'app/core/core';
|
||||
|
||||
const COLOR_LEGEND_SELECTOR = '.heatmap-color-legend';
|
||||
|
||||
export class HeatmapDisplayEditorCtrl {
|
||||
panel: any;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
|
||||
let VALUE_INDEX = 0;
|
||||
let TIME_INDEX = 1;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
import {describe, beforeEach, it, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
|
||||
import angular from 'angular';
|
||||
import moment from 'moment';
|
||||
import {HeatmapCtrl} from '../heatmap_ctrl';
|
||||
import helpers from '../../../../../test/specs/helpers';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///<reference path="../../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import { describe, beforeEach, it, sinon, expect, angularMocks } from '../../../../../test/lib/common';
|
||||
import { describe, beforeEach, it, expect } from '../../../../../test/lib/common';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import {convertToHeatMap, convertToCards, elasticHistogramToHeatmap,
|
||||
calculateBucketSize, isHeatmapDataEqual} from '../heatmap_data_converter';
|
||||
@@ -272,17 +272,14 @@ describe('convertToCards', () => {
|
||||
{x: 1422774000000, y: 2, count: 1, values: [2], yBounds: {}},
|
||||
{x: 1422774060000, y: 2, count: 2, values: [2, 3], yBounds: {}}
|
||||
];
|
||||
let {cards, cardStats} = convertToCards(buckets);
|
||||
expect(cards).to.eql(expectedCards);
|
||||
let res = convertToCards(buckets);
|
||||
expect(res.cards).to.eql(expectedCards);
|
||||
});
|
||||
|
||||
it('should build proper cards stats', () => {
|
||||
let expectedStats = {
|
||||
min: 1,
|
||||
max: 2
|
||||
};
|
||||
let {cards, cardStats} = convertToCards(buckets);
|
||||
expect(cardStats).to.eql(expectedStats);
|
||||
let expectedStats = {min: 1, max: 2};
|
||||
let res = convertToCards(buckets);
|
||||
expect(res.cardStats).to.eql(expectedStats);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { describe, beforeEach, it, sinon, expect, angularMocks } from '../../../
|
||||
import '../module';
|
||||
import angular from 'angular';
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import helpers from 'test/specs/helpers';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import moment from 'moment';
|
||||
@@ -131,7 +130,7 @@ describe('grafanaHeatmap', function () {
|
||||
|
||||
ctrl.data = ctx.data;
|
||||
ctx.element = element;
|
||||
let render = rendering(scope, $(element), [], ctrl);
|
||||
rendering(scope, $(element), [], ctrl);
|
||||
ctrl.events.emit('render');
|
||||
}));
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
import {PanelCtrl} from '../../../features/panel/panel_ctrl';
|
||||
|
||||
class PluginListCtrl extends PanelCtrl {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import 'jquery.flot';
|
||||
import 'jquery.flot.gauge';
|
||||
import moment from 'moment';
|
||||
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
import config from 'app/core/config';
|
||||
@@ -182,8 +180,6 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
let highestValue = 0;
|
||||
let lowestValue = Number.MAX_VALUE;
|
||||
const datapoint = tableData[0][0];
|
||||
data.value = datapoint[this.panel.tableColumn];
|
||||
|
||||
@@ -638,8 +634,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
if ($(evt).parents('.panel-header').length > 0) { return; }
|
||||
|
||||
if (linkInfo.target === '_blank') {
|
||||
var redirectWindow = window.open(linkInfo.href, '_blank');
|
||||
redirectWindow.location;
|
||||
window.open(linkInfo.href, '_blank');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
|
||||
import {getColorForValue} from '../module';
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import {describe, beforeEach, afterEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
|
||||
import angular from 'angular';
|
||||
import helpers from '../../../../../test/specs/helpers';
|
||||
import {SingleStatCtrl} from '../module';
|
||||
import moment from 'moment';
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import moment from 'moment';
|
||||
import angular from 'angular';
|
||||
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
|
||||
export class ColumnOptionsCtrl {
|
||||
@@ -22,8 +18,9 @@ export class ColumnOptionsCtrl {
|
||||
activeStyleIndex: number;
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, private $q, private uiSegmentSrv) {
|
||||
constructor($scope) {
|
||||
$scope.editor = this;
|
||||
|
||||
this.activeStyleIndex = 0;
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
|
||||
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import moment from 'moment';
|
||||
import angular from 'angular';
|
||||
|
||||
import {transformers} from './transformers';
|
||||
import kbn from 'app/core/utils/kbn';
|
||||
|
||||
export class TablePanelEditorCtrl {
|
||||
panel: any;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import moment from 'moment';
|
||||
import * as FileExport from 'app/core/utils/file_export';
|
||||
import {MetricsPanelCtrl} from 'app/plugins/sdk';
|
||||
import {transformDataToTable} from './transformers';
|
||||
import {tablePanelEditor} from './editor';
|
||||
import {columnOptionsTab} from './column_options';
|
||||
import {TableRenderer} from './renderer';
|
||||
import Drop from 'tether-drop';
|
||||
|
||||
class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
static templateUrl = 'module.html';
|
||||
@@ -160,11 +156,10 @@ class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
link(scope, elem, attrs, ctrl) {
|
||||
link(scope, elem, attrs, ctrl: TablePanelCtrl) {
|
||||
var data;
|
||||
var panel = ctrl.panel;
|
||||
var pageCount = 0;
|
||||
var formaters = [];
|
||||
|
||||
function getTableHeight() {
|
||||
var panelHeight = ctrl.height;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
|
||||
import _ from 'lodash';
|
||||
import TableModel from 'app/core/table_model';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
|
||||
import {describe, beforeEach, it, expect} from 'test/lib/common';
|
||||
|
||||
import {transformers, transformDataToTable} from '../transformers';
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import flatten from '../../../core/utils/flatten';
|
||||
import TimeSeries from '../../../core/time_series2';
|
||||
import TableModel from '../../../core/table_model';
|
||||
import angular from "angular";
|
||||
|
||||
var transformers = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user