mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tslint: more const fixes (#13035)
This commit is contained in:
parent
314b645857
commit
35c00891e7
@ -31,7 +31,7 @@ export class Settings {
|
||||
loginError: any;
|
||||
|
||||
constructor(options) {
|
||||
var defaults = {
|
||||
const defaults = {
|
||||
datasources: {},
|
||||
window_title_prefix: 'Grafana - ',
|
||||
panels: {},
|
||||
@ -51,8 +51,8 @@ export class Settings {
|
||||
}
|
||||
}
|
||||
|
||||
var bootData = (<any>window).grafanaBootData || { settings: {} };
|
||||
var options = bootData.settings;
|
||||
const bootData = (<any>window).grafanaBootData || { settings: {} };
|
||||
const options = bootData.settings;
|
||||
options.bootData = bootData;
|
||||
|
||||
const config = new Settings(options);
|
||||
|
@ -29,14 +29,14 @@ export class AdminEditUserCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
var payload = { password: $scope.password };
|
||||
const payload = { password: $scope.password };
|
||||
backendSrv.put('/api/admin/users/' + $scope.user_id + '/password', payload).then(function() {
|
||||
$location.path('/admin/users');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updatePermissions = function() {
|
||||
var payload = $scope.permissions;
|
||||
const payload = $scope.permissions;
|
||||
|
||||
backendSrv.put('/api/admin/users/' + $scope.user_id + '/permissions', payload).then(function() {
|
||||
$location.path('/admin/users');
|
||||
@ -99,7 +99,7 @@ export class AdminEditUserCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
var orgInfo = _.find($scope.orgsSearchCache, {
|
||||
const orgInfo = _.find($scope.orgsSearchCache, {
|
||||
name: $scope.newOrg.name,
|
||||
});
|
||||
if (!orgInfo) {
|
||||
|
@ -99,7 +99,7 @@ export class AlertNotificationEditCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
var payload = {
|
||||
const payload = {
|
||||
name: this.model.name,
|
||||
type: this.model.type,
|
||||
settings: this.model.settings,
|
||||
|
@ -6,12 +6,8 @@ describe('AnnotationsSrv', function() {
|
||||
const $rootScope = {
|
||||
onAppEvent: jest.fn(),
|
||||
};
|
||||
let $q;
|
||||
let datasourceSrv;
|
||||
let backendSrv;
|
||||
let timeSrv;
|
||||
|
||||
const annotationsSrv = new AnnotationsSrv($rootScope, $q, datasourceSrv, backendSrv, timeSrv);
|
||||
const annotationsSrv = new AnnotationsSrv($rootScope, null, null, null, null);
|
||||
|
||||
describe('When translating the query result', () => {
|
||||
const annotationSource = {
|
||||
|
@ -55,8 +55,8 @@ export class AdHocFiltersCtrl {
|
||||
}
|
||||
|
||||
return this.datasourceSrv.get(this.variable.datasource).then(ds => {
|
||||
var options: any = {};
|
||||
var promise = null;
|
||||
const options: any = {};
|
||||
let promise = null;
|
||||
|
||||
if (segment.type !== 'value') {
|
||||
promise = ds.getTagKeys();
|
||||
@ -113,9 +113,9 @@ export class AdHocFiltersCtrl {
|
||||
}
|
||||
|
||||
updateVariableModel() {
|
||||
var filters = [];
|
||||
var filterIndex = -1;
|
||||
var hasFakes = false;
|
||||
const filters = [];
|
||||
let filterIndex = -1;
|
||||
let hasFakes = false;
|
||||
|
||||
this.segments.forEach(segment => {
|
||||
if (segment.type === 'value' && segment.fake) {
|
||||
@ -153,7 +153,7 @@ export class AdHocFiltersCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
var template = `
|
||||
const template = `
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form" ng-repeat="segment in ctrl.segments">
|
||||
<metric-segment segment="segment" get-options="ctrl.getOptions(segment, $index)"
|
||||
|
@ -87,7 +87,7 @@ export class ChangeTracker {
|
||||
return true;
|
||||
}
|
||||
|
||||
var meta = this.current.meta;
|
||||
const meta = this.current.meta;
|
||||
return !meta.canSave || meta.fromScript || meta.fromFile;
|
||||
}
|
||||
|
||||
@ -141,15 +141,15 @@ export class ChangeTracker {
|
||||
const current = this.cleanDashboardFromIgnoredChanges(this.current.getSaveModelClone());
|
||||
const original = this.cleanDashboardFromIgnoredChanges(this.original);
|
||||
|
||||
var currentTimepicker = _.find(current.nav, { type: 'timepicker' });
|
||||
var originalTimepicker = _.find(original.nav, { type: 'timepicker' });
|
||||
const currentTimepicker = _.find(current.nav, { type: 'timepicker' });
|
||||
const originalTimepicker = _.find(original.nav, { type: 'timepicker' });
|
||||
|
||||
if (currentTimepicker && originalTimepicker) {
|
||||
currentTimepicker.now = originalTimepicker.now;
|
||||
}
|
||||
|
||||
var currentJson = angular.toJson(current, true);
|
||||
var originalJson = angular.toJson(original, true);
|
||||
const currentJson = angular.toJson(current, true);
|
||||
const originalJson = angular.toJson(original, true);
|
||||
|
||||
return currentJson !== originalJson;
|
||||
}
|
||||
@ -167,8 +167,8 @@ export class ChangeTracker {
|
||||
}
|
||||
|
||||
saveChanges() {
|
||||
var self = this;
|
||||
var cancel = this.$rootScope.$on('dashboard-saved', () => {
|
||||
const self = this;
|
||||
const cancel = this.$rootScope.$on('dashboard-saved', () => {
|
||||
cancel();
|
||||
this.$timeout(() => {
|
||||
self.gotoNext();
|
||||
@ -179,8 +179,8 @@ export class ChangeTracker {
|
||||
}
|
||||
|
||||
gotoNext() {
|
||||
var baseLen = this.$location.absUrl().length - this.$location.url().length;
|
||||
var nextUrl = this.next.substring(baseLen);
|
||||
const baseLen = this.$location.absUrl().length - this.$location.url().length;
|
||||
const nextUrl = this.next.substring(baseLen);
|
||||
this.$location.url(nextUrl);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ export class DashboardImportCtrl {
|
||||
|
||||
if (this.dash.__inputs) {
|
||||
for (const input of this.dash.__inputs) {
|
||||
var inputModel = {
|
||||
const inputModel = {
|
||||
name: input.name,
|
||||
label: input.label,
|
||||
info: input.description,
|
||||
@ -78,7 +78,7 @@ export class DashboardImportCtrl {
|
||||
}
|
||||
|
||||
setDatasourceOptions(input, inputModel) {
|
||||
var sources = _.filter(config.datasources, val => {
|
||||
const sources = _.filter(config.datasources, val => {
|
||||
return val.type === input.pluginId;
|
||||
});
|
||||
|
||||
@ -162,7 +162,7 @@ export class DashboardImportCtrl {
|
||||
}
|
||||
|
||||
saveDashboard() {
|
||||
var inputs = this.inputs.map(input => {
|
||||
const inputs = this.inputs.map(input => {
|
||||
return {
|
||||
name: input.name,
|
||||
type: input.type,
|
||||
@ -186,7 +186,7 @@ export class DashboardImportCtrl {
|
||||
loadJsonText() {
|
||||
try {
|
||||
this.parseError = '';
|
||||
var dash = JSON.parse(this.jsonText);
|
||||
const dash = JSON.parse(this.jsonText);
|
||||
this.onUpload(dash);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
@ -198,8 +198,8 @@ export class DashboardImportCtrl {
|
||||
checkGnetDashboard() {
|
||||
this.gnetError = '';
|
||||
|
||||
var match = /(^\d+$)|dashboards\/(\d+)/.exec(this.gnetUrl);
|
||||
var dashboardId;
|
||||
const match = /(^\d+$)|dashboards\/(\d+)/.exec(this.gnetUrl);
|
||||
let dashboardId;
|
||||
|
||||
if (match && match[1]) {
|
||||
dashboardId = match[1];
|
||||
|
@ -97,7 +97,7 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
|
||||
const dashboard = panelContainer.getDashboard();
|
||||
const { gridPos } = this.props.panel;
|
||||
|
||||
var newPanel: any = {
|
||||
const newPanel: any = {
|
||||
type: panelPluginInfo.id,
|
||||
title: 'Panel Title',
|
||||
gridPos: { x: gridPos.x, y: gridPos.y, w: gridPos.w, h: gridPos.h },
|
||||
|
@ -21,14 +21,14 @@ export class DashExportCtrl {
|
||||
}
|
||||
|
||||
save() {
|
||||
var blob = new Blob([angular.toJson(this.dash, true)], {
|
||||
const blob = new Blob([angular.toJson(this.dash, true)], {
|
||||
type: 'application/json;charset=utf-8',
|
||||
});
|
||||
saveAs(blob, this.dash.title + '-' + new Date().getTime() + '.json');
|
||||
}
|
||||
|
||||
saveJson() {
|
||||
var clone = this.dash;
|
||||
const clone = this.dash;
|
||||
const editScope = this.$rootScope.$new();
|
||||
editScope.object = clone;
|
||||
editScope.enableCopy = true;
|
||||
|
@ -12,23 +12,23 @@ export class DashboardExporter {
|
||||
// this is pretty hacky and needs to be changed
|
||||
dashboard.cleanUpRepeats();
|
||||
|
||||
var saveModel = dashboard.getSaveModelClone();
|
||||
const saveModel = dashboard.getSaveModelClone();
|
||||
saveModel.id = null;
|
||||
|
||||
// undo repeat cleanup
|
||||
dashboard.processRepeats();
|
||||
|
||||
var inputs = [];
|
||||
var requires = {};
|
||||
var datasources = {};
|
||||
var promises = [];
|
||||
var variableLookup: any = {};
|
||||
const inputs = [];
|
||||
const requires = {};
|
||||
const datasources = {};
|
||||
const promises = [];
|
||||
const variableLookup: any = {};
|
||||
|
||||
for (const variable of saveModel.templating.list) {
|
||||
variableLookup[variable.name] = variable;
|
||||
}
|
||||
|
||||
var templateizeDatasourceUsage = obj => {
|
||||
const templateizeDatasourceUsage = obj => {
|
||||
// ignore data source properties that contain a variable
|
||||
if (obj.datasource && obj.datasource.indexOf('$') === 0) {
|
||||
if (variableLookup[obj.datasource.substring(1)]) {
|
||||
@ -42,7 +42,7 @@ export class DashboardExporter {
|
||||
return;
|
||||
}
|
||||
|
||||
var refName = 'DS_' + ds.name.replace(' ', '_').toUpperCase();
|
||||
const refName = 'DS_' + ds.name.replace(' ', '_').toUpperCase();
|
||||
datasources[refName] = {
|
||||
name: refName,
|
||||
label: ds.name,
|
||||
@ -76,7 +76,7 @@ export class DashboardExporter {
|
||||
}
|
||||
}
|
||||
|
||||
var panelDef = config.panels[panel.type];
|
||||
const panelDef = config.panels[panel.type];
|
||||
if (panelDef) {
|
||||
requires['panel' + panelDef.id] = {
|
||||
type: 'panel',
|
||||
@ -131,7 +131,7 @@ export class DashboardExporter {
|
||||
// templatize constants
|
||||
for (const variable of saveModel.templating.list) {
|
||||
if (variable.type === 'constant') {
|
||||
var refName = 'VAR_' + variable.name.replace(' ', '_').toUpperCase();
|
||||
const refName = 'VAR_' + variable.name.replace(' ', '_').toUpperCase();
|
||||
inputs.push({
|
||||
name: refName,
|
||||
type: 'constant',
|
||||
@ -149,7 +149,7 @@ export class DashboardExporter {
|
||||
}
|
||||
|
||||
// make inputs and requires a top thing
|
||||
var newObj = {};
|
||||
const newObj = {};
|
||||
newObj['__inputs'] = inputs;
|
||||
newObj['__requires'] = _.sortBy(requires, ['id']);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { coreModule } from 'app/core/core';
|
||||
|
||||
var template = `
|
||||
const template = `
|
||||
<div class="gf-form-select-wrapper max-width-18">
|
||||
<select class="gf-form-input" ng-model="panel.repeat" ng-options="f.value as f.text for f in variables" ng-change="optionChanged()">
|
||||
<option value=""></option>
|
||||
|
@ -156,7 +156,7 @@ export class SettingsCtrl {
|
||||
}
|
||||
|
||||
hideSettings() {
|
||||
var urlParams = this.$location.search();
|
||||
const urlParams = this.$location.search();
|
||||
delete urlParams.editview;
|
||||
setTimeout(() => {
|
||||
this.$rootScope.$apply(() => {
|
||||
|
@ -12,7 +12,7 @@ jest.mock('app/core/services/context_srv', () => ({
|
||||
describe('ChangeTracker', () => {
|
||||
let rootScope;
|
||||
let location;
|
||||
let timeout;
|
||||
const timeout = () => {};
|
||||
let tracker: ChangeTracker;
|
||||
let dash;
|
||||
let scope;
|
||||
|
@ -2,7 +2,7 @@ import { DashboardImportCtrl } from '../dashboard_import_ctrl';
|
||||
import config from '../../../core/config';
|
||||
|
||||
describe('DashboardImportCtrl', function() {
|
||||
var ctx: any = {};
|
||||
const ctx: any = {};
|
||||
|
||||
let navModelSrv;
|
||||
let backendSrv;
|
||||
|
@ -8,10 +8,10 @@ jest.mock('app/core/services/context_srv', () => ({}));
|
||||
|
||||
describe('DashboardModel', function() {
|
||||
describe('when creating dashboard with old schema', function() {
|
||||
var model;
|
||||
var graph;
|
||||
var singlestat;
|
||||
var table;
|
||||
let model;
|
||||
let graph;
|
||||
let singlestat;
|
||||
let table;
|
||||
|
||||
beforeEach(function() {
|
||||
model = new DashboardModel({
|
||||
@ -384,7 +384,8 @@ describe('DashboardModel', function() {
|
||||
|
||||
function createRow(options, panelDescriptions: any[]) {
|
||||
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
|
||||
let { collapse, height, showTitle, title, repeat, repeatIteration } = options;
|
||||
const { collapse, showTitle, title, repeat, repeatIteration } = options;
|
||||
let { height } = options;
|
||||
height = height * PANEL_HEIGHT_STEP;
|
||||
const panels = [];
|
||||
_.each(panelDescriptions, panelDesc => {
|
||||
|
@ -70,7 +70,7 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
if (!isNaN(value)) {
|
||||
var epoch = parseInt(value);
|
||||
const epoch = parseInt(value);
|
||||
return moment.utc(epoch);
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
private initTimeFromUrl() {
|
||||
var params = this.$location.search();
|
||||
const params = this.$location.search();
|
||||
if (params.from) {
|
||||
this.time.from = this.parseUrlParam(params.from) || this.time.from;
|
||||
}
|
||||
@ -91,8 +91,8 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
private routeUpdated() {
|
||||
var params = this.$location.search();
|
||||
var urlRange = this.timeRangeForUrl();
|
||||
const params = this.$location.search();
|
||||
const urlRange = this.timeRangeForUrl();
|
||||
// check if url has time range
|
||||
if (params.from && params.to) {
|
||||
// is it different from what our current time range?
|
||||
@ -114,7 +114,7 @@ export class TimeSrv {
|
||||
this.dashboard.refresh = interval;
|
||||
this.cancelNextRefresh();
|
||||
if (interval) {
|
||||
var intervalMs = kbn.interval_to_ms(interval);
|
||||
const intervalMs = kbn.interval_to_ms(interval);
|
||||
|
||||
this.refreshTimer = this.timer.register(
|
||||
this.$timeout(() => {
|
||||
@ -125,7 +125,7 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
// update url
|
||||
var params = this.$location.search();
|
||||
const params = this.$location.search();
|
||||
if (interval) {
|
||||
params.refresh = interval;
|
||||
this.$location.search(params);
|
||||
@ -171,8 +171,8 @@ export class TimeSrv {
|
||||
|
||||
// update url
|
||||
if (fromRouteUpdate !== true) {
|
||||
var urlRange = this.timeRangeForUrl();
|
||||
var urlParams = this.$location.search();
|
||||
const urlRange = this.timeRangeForUrl();
|
||||
const urlParams = this.$location.search();
|
||||
urlParams.from = urlRange.from;
|
||||
urlParams.to = urlRange.to;
|
||||
this.$location.search(urlParams);
|
||||
@ -183,7 +183,7 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
timeRangeForUrl() {
|
||||
var range = this.timeRange().raw;
|
||||
const range = this.timeRange().raw;
|
||||
|
||||
if (moment.isMoment(range.from)) {
|
||||
range.from = range.from.valueOf().toString();
|
||||
@ -197,12 +197,12 @@ export class TimeSrv {
|
||||
|
||||
timeRange() {
|
||||
// make copies if they are moment (do not want to return out internal moment, because they are mutable!)
|
||||
var raw = {
|
||||
const raw = {
|
||||
from: moment.isMoment(this.time.from) ? moment(this.time.from) : this.time.from,
|
||||
to: moment.isMoment(this.time.to) ? moment(this.time.to) : this.time.to,
|
||||
};
|
||||
|
||||
var timezone = this.dashboard && this.dashboard.getTimezone();
|
||||
const timezone = this.dashboard && this.dashboard.getTimezone();
|
||||
|
||||
return {
|
||||
from: dateMath.parse(raw.from, false, timezone),
|
||||
@ -212,16 +212,16 @@ export class TimeSrv {
|
||||
}
|
||||
|
||||
zoomOut(e, factor) {
|
||||
var range = this.timeRange();
|
||||
const range = this.timeRange();
|
||||
|
||||
var timespan = range.to.valueOf() - range.from.valueOf();
|
||||
var center = range.to.valueOf() - timespan / 2;
|
||||
const timespan = range.to.valueOf() - range.from.valueOf();
|
||||
const center = range.to.valueOf() - timespan / 2;
|
||||
|
||||
var to = center + timespan * factor / 2;
|
||||
var from = center - timespan * factor / 2;
|
||||
let to = center + timespan * factor / 2;
|
||||
let from = center - timespan * factor / 2;
|
||||
|
||||
if (to > Date.now() && range.to <= Date.now()) {
|
||||
var offset = to - Date.now();
|
||||
const offset = to - Date.now();
|
||||
from = from - offset;
|
||||
to = Date.now();
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ export function inputDateDirective() {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function($scope, $elem, attrs, ngModel) {
|
||||
var format = 'YYYY-MM-DD HH:mm:ss';
|
||||
const format = 'YYYY-MM-DD HH:mm:ss';
|
||||
|
||||
var fromUser = function(text) {
|
||||
const fromUser = function(text) {
|
||||
if (text.indexOf('now') !== -1) {
|
||||
if (!dateMath.isValid(text)) {
|
||||
ngModel.$setValidity('error', false);
|
||||
@ -34,7 +34,7 @@ export function inputDateDirective() {
|
||||
return parsed;
|
||||
};
|
||||
|
||||
var toUser = function(currentValue) {
|
||||
const toUser = function(currentValue) {
|
||||
if (moment.isMoment(currentValue)) {
|
||||
return currentValue.format(format);
|
||||
} else {
|
||||
|
@ -43,8 +43,8 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
onRefresh() {
|
||||
var time = angular.copy(this.timeSrv.timeRange());
|
||||
var timeRaw = angular.copy(time.raw);
|
||||
const time = angular.copy(this.timeSrv.timeRange());
|
||||
const timeRaw = angular.copy(time.raw);
|
||||
|
||||
if (!this.dashboard.isTimezoneUtc()) {
|
||||
time.from.local();
|
||||
@ -72,9 +72,9 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
move(direction) {
|
||||
var range = this.timeSrv.timeRange();
|
||||
const range = this.timeSrv.timeRange();
|
||||
|
||||
var timespan = (range.to.valueOf() - range.from.valueOf()) / 2;
|
||||
const timespan = (range.to.valueOf() - range.from.valueOf()) / 2;
|
||||
var to, from;
|
||||
if (direction === -1) {
|
||||
to = range.to.valueOf() - timespan;
|
||||
@ -142,7 +142,7 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
setRelativeFilter(timespan) {
|
||||
var range = { from: timespan.from, to: timespan.to };
|
||||
const range = { from: timespan.from, to: timespan.to };
|
||||
|
||||
if (this.panel.nowDelay && range.to === 'now') {
|
||||
range.to = 'now-' + this.panel.nowDelay;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
|
||||
var template = `
|
||||
const template = `
|
||||
<input type="file" id="dashupload" name="dashupload" class="hide"/>
|
||||
<label class="btn btn-success" for="dashupload">
|
||||
<i class="fa fa-upload"></i>
|
||||
@ -18,8 +18,8 @@ function uploadDashboardDirective(timer, alertSrv, $location) {
|
||||
},
|
||||
link: function(scope) {
|
||||
function file_selected(evt) {
|
||||
var files = evt.target.files; // FileList object
|
||||
var readerOnload = function() {
|
||||
const files = evt.target.files; // FileList object
|
||||
const readerOnload = function() {
|
||||
return function(e) {
|
||||
var dash;
|
||||
try {
|
||||
@ -37,13 +37,13 @@ function uploadDashboardDirective(timer, alertSrv, $location) {
|
||||
};
|
||||
|
||||
for (var i = 0, f; (f = files[i]); i++) {
|
||||
var reader = new FileReader();
|
||||
const reader = new FileReader();
|
||||
reader.onload = readerOnload();
|
||||
reader.readAsText(f);
|
||||
}
|
||||
}
|
||||
|
||||
var wnd: any = window;
|
||||
const wnd: any = window;
|
||||
// Check for the various File API support.
|
||||
if (wnd.File && wnd.FileReader && wnd.FileList && wnd.Blob) {
|
||||
// Something
|
||||
|
@ -24,7 +24,7 @@ export class OrgApiKeysCtrl {
|
||||
|
||||
$scope.addToken = function() {
|
||||
backendSrv.post('/api/auth/keys', $scope.token).then(function(result) {
|
||||
var modalScope = $scope.$new(true);
|
||||
const modalScope = $scope.$new(true);
|
||||
modalScope.key = result.key;
|
||||
modalScope.rootPath = window.location.origin + $scope.$root.appSubUrl;
|
||||
|
||||
|
@ -20,7 +20,7 @@ export class OrgDetailsCtrl {
|
||||
if (!$scope.orgForm.$valid) {
|
||||
return;
|
||||
}
|
||||
var data = { name: $scope.org.name };
|
||||
const data = { name: $scope.org.name };
|
||||
backendSrv.put('/api/org', data).then($scope.getOrgInfo);
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ export class PrefsControlCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = {
|
||||
const cmd = {
|
||||
theme: this.prefs.theme,
|
||||
timezone: this.prefs.timezone,
|
||||
homeDashboardId: this.prefs.homeDashboardId,
|
||||
@ -41,7 +41,7 @@ export class PrefsControlCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
var template = `
|
||||
const template = `
|
||||
<form name="ctrl.prefsForm" class="section gf-form-group">
|
||||
<h3 class="page-heading">Preferences</h3>
|
||||
|
||||
|
@ -3,9 +3,9 @@ import $ from 'jquery';
|
||||
import Drop from 'tether-drop';
|
||||
import baron from 'baron';
|
||||
|
||||
var module = angular.module('grafana.directives');
|
||||
const module = angular.module('grafana.directives');
|
||||
|
||||
var panelTemplate = `
|
||||
const panelTemplate = `
|
||||
<div class="panel-container">
|
||||
<div class="panel-header" ng-class="{'grid-drag-handle': !ctrl.fullscreen}">
|
||||
<span class="panel-info-corner">
|
||||
@ -61,19 +61,19 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
transclude: true,
|
||||
scope: { ctrl: '=' },
|
||||
link: function(scope, elem) {
|
||||
var panelContainer = elem.find('.panel-container');
|
||||
var panelContent = elem.find('.panel-content');
|
||||
var cornerInfoElem = elem.find('.panel-info-corner');
|
||||
var ctrl = scope.ctrl;
|
||||
var infoDrop;
|
||||
var panelScrollbar;
|
||||
const panelContainer = elem.find('.panel-container');
|
||||
const panelContent = elem.find('.panel-content');
|
||||
const cornerInfoElem = elem.find('.panel-info-corner');
|
||||
const ctrl = scope.ctrl;
|
||||
let infoDrop;
|
||||
let panelScrollbar;
|
||||
|
||||
// the reason for handling these classes this way is for performance
|
||||
// limit the watchers on panels etc
|
||||
var transparentLastState = false;
|
||||
var lastHasAlertRule = false;
|
||||
var lastAlertState;
|
||||
var hasAlertRule;
|
||||
let transparentLastState = false;
|
||||
let lastHasAlertRule = false;
|
||||
let lastAlertState;
|
||||
let hasAlertRule;
|
||||
|
||||
function mouseEnter() {
|
||||
panelContainer.toggleClass('panel-hover-highlight', true);
|
||||
@ -174,7 +174,7 @@ module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
|
||||
});
|
||||
|
||||
function updatePanelCornerInfo() {
|
||||
var cornerMode = ctrl.getInfoMode();
|
||||
const cornerMode = ctrl.getInfoMode();
|
||||
cornerInfoElem[0].className = 'panel-info-corner panel-info-corner--' + cornerMode;
|
||||
|
||||
if (cornerMode) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import angular from 'angular';
|
||||
|
||||
var directiveModule = angular.module('grafana.directives');
|
||||
const directiveModule = angular.module('grafana.directives');
|
||||
|
||||
/** @ngInject */
|
||||
function panelEditorTab(dynamicDirectiveSrv) {
|
||||
@ -11,13 +11,13 @@ function panelEditorTab(dynamicDirectiveSrv) {
|
||||
index: '=',
|
||||
},
|
||||
directive: scope => {
|
||||
var pluginId = scope.ctrl.pluginId;
|
||||
var tabIndex = scope.index;
|
||||
const pluginId = scope.ctrl.pluginId;
|
||||
const tabIndex = scope.index;
|
||||
// create a wrapper for directiveFn
|
||||
// required for metrics tab directive
|
||||
// that is the same for many panels but
|
||||
// given different names in this function
|
||||
var fn = () => scope.editorTab.directiveFn();
|
||||
const fn = () => scope.editorTab.directiveFn();
|
||||
|
||||
return Promise.resolve({
|
||||
name: `panel-editor-tab-${pluginId}${tabIndex}`,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { coreModule } from 'app/core/core';
|
||||
|
||||
var template = `
|
||||
const template = `
|
||||
<span class="panel-title">
|
||||
<span class="icon-gf panel-alert-icon"></span>
|
||||
<span class="panel-title-text">{{ctrl.panel.title | interpolateTemplateVars:this}}</span>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import angular from 'angular';
|
||||
|
||||
var module = angular.module('grafana.directives');
|
||||
const module = angular.module('grafana.directives');
|
||||
|
||||
export class QueryRowCtrl {
|
||||
collapsedText: string;
|
||||
@ -56,7 +56,7 @@ export class QueryRowCtrl {
|
||||
try {
|
||||
this.collapsedText = this.queryCtrl.getCollapsedText();
|
||||
} catch (e) {
|
||||
var err = e.message || e.toString();
|
||||
const err = e.message || e.toString();
|
||||
this.collapsedText = 'Error: ' + err;
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ export class QueryRowCtrl {
|
||||
}
|
||||
|
||||
duplicateQuery() {
|
||||
var clone = angular.copy(this.target);
|
||||
const clone = angular.copy(this.target);
|
||||
this.panelCtrl.addQuery(clone);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ export function queryTroubleshooter() {
|
||||
},
|
||||
link: function(scope, elem, attrs, ctrl) {
|
||||
ctrl.renderJsonExplorer = function(data) {
|
||||
var jsonElem = elem.find('.query-troubleshooter-json');
|
||||
const jsonElem = elem.find('.query-troubleshooter-json');
|
||||
|
||||
ctrl.jsonExplorer = new JsonExplorer(data, 3, {
|
||||
animateOpen: true,
|
||||
|
@ -5,13 +5,13 @@ import appEvents from 'app/core/app_events';
|
||||
export class SoloPanelCtrl {
|
||||
/** @ngInject */
|
||||
constructor($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv, backendSrv) {
|
||||
var panelId;
|
||||
let panelId;
|
||||
|
||||
$scope.init = function() {
|
||||
contextSrv.sidemenu = false;
|
||||
appEvents.emit('toggle-sidemenu-hidden');
|
||||
|
||||
var params = $location.search();
|
||||
const params = $location.search();
|
||||
panelId = parseInt(params.panelId);
|
||||
|
||||
$scope.onAppEvent('dashboard-initialized', $scope.initPanelScope);
|
||||
|
@ -22,7 +22,7 @@ export class PlaylistEditCtrl {
|
||||
this.isNew = $route.current.params.id;
|
||||
|
||||
if ($route.current.params.id) {
|
||||
var playlistId = $route.current.params.id;
|
||||
const playlistId = $route.current.params.id;
|
||||
|
||||
backendSrv.get('/api/playlists/' + playlistId).then(result => {
|
||||
this.playlist = result;
|
||||
@ -69,7 +69,7 @@ export class PlaylistEditCtrl {
|
||||
}
|
||||
|
||||
addTagPlaylistItem(tag) {
|
||||
var playlistItem: any = {
|
||||
const playlistItem: any = {
|
||||
value: tag.term,
|
||||
type: 'dashboard_by_tag',
|
||||
order: this.playlistItems.length + 1,
|
||||
@ -124,8 +124,8 @@ export class PlaylistEditCtrl {
|
||||
}
|
||||
|
||||
movePlaylistItem(playlistItem, offset) {
|
||||
var currentPosition = this.playlistItems.indexOf(playlistItem);
|
||||
var newPosition = currentPosition + offset;
|
||||
const currentPosition = this.playlistItems.indexOf(playlistItem);
|
||||
const newPosition = currentPosition + offset;
|
||||
|
||||
if (newPosition >= 0 && newPosition < this.playlistItems.length) {
|
||||
this.playlistItems.splice(currentPosition, 1);
|
||||
|
@ -19,7 +19,7 @@ export class PlaylistSearchCtrl {
|
||||
|
||||
searchDashboards() {
|
||||
this.tagsMode = false;
|
||||
var prom: any = {};
|
||||
const prom: any = {};
|
||||
|
||||
prom.promise = this.backendSrv.search(this.query).then(result => {
|
||||
return {
|
||||
@ -50,7 +50,7 @@ export class PlaylistSearchCtrl {
|
||||
}
|
||||
|
||||
getTags() {
|
||||
var prom: any = {};
|
||||
const prom: any = {};
|
||||
prom.promise = this.backendSrv.get('/api/dashboards/tags').then(result => {
|
||||
return {
|
||||
dashboardResult: [],
|
||||
|
@ -16,14 +16,14 @@ class PlaylistSrv {
|
||||
next() {
|
||||
this.$timeout.cancel(this.cancelPromise);
|
||||
|
||||
var playedAllDashboards = this.index > this.dashboards.length - 1;
|
||||
const playedAllDashboards = this.index > this.dashboards.length - 1;
|
||||
|
||||
if (playedAllDashboards) {
|
||||
window.location.href = this.getUrlWithKioskMode();
|
||||
return;
|
||||
}
|
||||
|
||||
var dash = this.dashboards[this.index];
|
||||
const dash = this.dashboards[this.index];
|
||||
this.$location.url('dashboard/' + dash.uri);
|
||||
|
||||
this.index++;
|
||||
|
@ -17,7 +17,7 @@ class StyleGuideCtrl {
|
||||
switchTheme() {
|
||||
this.$routeParams.theme = this.theme === 'dark' ? 'light' : 'dark';
|
||||
|
||||
var cmd = {
|
||||
const cmd = {
|
||||
theme: this.$routeParams.theme,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user