Commit b8d9722b by Torkel Ödegaard

tech: removing unused variables from typescript files, and making tslint rules more strict

parent adda84d1
import * as React from 'react';
import * as ReactDOM from 'react-dom';
// import from 'react-dom';
import coreModule from '../core_module';
export interface IProps {
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `
......@@ -37,7 +34,7 @@ export class ColorPickerCtrl {
showAxisControls: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope) {
constructor(private $scope, $rootScope) {
this.colors = $rootScope.colors;
this.autoClose = $scope.autoClose;
this.series = $scope.series;
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `
......
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import store from 'app/core/store';
import _ from 'lodash';
import angular from 'angular';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
......
......@@ -8,7 +8,7 @@ export class HelpCtrl {
shortcuts: any;
/** @ngInject */
constructor(private $scope, $sce) {
constructor() {
this.tabIndex = 0;
this.shortcuts = {
'Global': [
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';
......
......@@ -6,7 +6,6 @@ import {
getObjectName,
getType,
getValuePreview,
getPreview,
cssClass,
createElement
} from './helpers';
......
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import store from 'app/core/store';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
var template = `
......
<div class="navbar-inner">
<a class="navbar-brand-btn pointer" ng-click="ctrl.contextSrv.toggleSideMenu()">
<a class="navbar-brand-btn pointer" ng-click="ctrl.toggleSideMenu()">
<span class="navbar-brand-btn-background">
<img src="public/img/grafana_icon.svg"></img>
</span>
......
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
import {NavModel, NavModelItem} from '../../nav_model_srv';
......@@ -12,7 +9,7 @@ export class NavbarCtrl {
hasMenu: boolean;
/** @ngInject */
constructor(private $scope, private $rootScope, private contextSrv) {
constructor(private $rootScope, private contextSrv) {
this.section = this.model.section;
this.hasMenu = this.model.menu.length > 0;
}
......@@ -21,6 +18,10 @@ export class NavbarCtrl {
this.$rootScope.appEvent('show-dash-search');
}
toggleSideMenu() {
this.contextSrv.toggleSideMenu();
}
navItemClicked(navItem, evt) {
if (navItem.clickHandler) {
navItem.clickHandler();
......
///<reference path="../../../headers/common.d.ts" />
import angular from 'angular';
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
import appEvents from 'app/core/app_events';
export class SearchCtrl {
isOpen: boolean;
......@@ -22,7 +19,7 @@ export class SearchCtrl {
openCompleted: boolean;
/** @ngInject */
constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv, private $rootScope) {
constructor($scope, private $location, private $timeout, private backendSrv, public contextSrv, $rootScope) {
$rootScope.onAppEvent('show-dash-search', this.openSearch.bind(this), $scope);
$rootScope.onAppEvent('hide-dash-search', this.closeSearch.bind(this), $scope);
}
......
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core_module';
......@@ -19,7 +18,7 @@ export class SideMenuCtrl {
maxShownOrgs: number;
/** @ngInject */
constructor(private $scope, private $location, private contextSrv, private backendSrv, private $element) {
constructor(private $scope, private $location, private contextSrv, private backendSrv) {
this.isSignedIn = contextSrv.isSignedIn;
this.user = contextSrv.user;
this.appSubUrl = config.appSubUrl;
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';
var template = `
<label for="check-{{ctrl.id}}" class="gf-form-label {{ctrl.labelClass}} pointer" ng-show="ctrl.label">
......
......@@ -8,9 +8,9 @@ export class SignUpCtrl {
/** @ngInject */
constructor(
private $scope: any,
private $location: any,
private contextSrv: any,
private backendSrv: any) {
private backendSrv: any,
$location: any,
contextSrv: any) {
contextSrv.sidemenu = false;
$scope.ctrl = this;
......
......@@ -7,7 +7,7 @@ export class DeltaCtrl {
observer: any;
/** @ngInject */
constructor(private $rootScope) {
constructor($rootScope) {
const waitForCompile = function(mutations) {
if (mutations.length === 1) {
this.$rootScope.appEvent('json-diff-ready');
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../core_module';
......
......@@ -2,7 +2,6 @@
import _ from 'lodash';
import config from 'app/core/config';
import coreModule from 'app/core/core_module';
import {Observable} from 'vendor/npm/rxjs/Observable';
......
///<reference path="../headers/common.d.ts" />
import $ from 'jquery';
import _ from 'lodash';
import angular from 'angular';
export class Profiler {
......
......@@ -2,7 +2,6 @@
import './dashboard_loaders';
import angular from 'angular';
import coreModule from 'app/core/core_module';
import {BundleLoader} from './bundle_loader';
......
......@@ -2,7 +2,6 @@
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
......@@ -10,7 +9,7 @@ export class AlertSrv {
list: any[];
/** @ngInject */
constructor(private $timeout, private $sce, private $rootScope, private $modal) {
constructor(private $timeout, private $rootScope, private $modal) {
this.list = [];
}
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import config from 'app/core/config';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
......@@ -12,7 +10,7 @@ export class BackendSrv {
private noBackendCache: boolean;
/** @ngInject */
constructor(private $http, private alertSrv, private $rootScope, private $q, private $timeout, private contextSrv) {
constructor(private $http, private alertSrv, private $q, private $timeout, private contextSrv) {
}
get(url, params?) {
......
......@@ -6,7 +6,7 @@ import coreModule from '../core_module';
class DynamicDirectiveSrv {
/** @ngInject */
constructor(private $compile, private $parse, private $rootScope) {}
constructor(private $compile, private $rootScope) {}
addDirective(element, name, scope) {
var child = angular.element(document.createElement(name));
......
......@@ -14,10 +14,7 @@ export class KeybindingSrv {
/** @ngInject */
constructor(
private $rootScope,
private $modal,
private $location,
private contextSrv,
private $timeout) {
private $location) {
// clear out all shortcuts on route change
$rootScope.$on('$routeChangeSuccess', () => {
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import Drop from 'tether-drop';
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
......
......@@ -2,12 +2,6 @@
import EventEmitter from 'eventemitter3';
var hasOwnProp = {}.hasOwnProperty;
function createName(name) {
return '$' + name;
}
export class Emitter {
emitter: any;
......
......@@ -11,7 +11,7 @@ export default class AdminListUsersCtrl {
navModel: any;
/** @ngInject */
constructor(private $scope, private backendSrv, private navModelSrv) {
constructor(private $scope, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getAdminNav();
this.query = '';
this.getUsers();
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import moment from 'moment';
......@@ -22,7 +21,7 @@ export class AlertListCtrl {
navModel: any;
/** @ngInject */
constructor(private backendSrv, private $location, private $scope, navModelSrv) {
constructor(private backendSrv, private $location, navModelSrv) {
this.navModel = navModelSrv.getAlertingNav(0);
var params = $location.search();
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import {QueryPart} from 'app/core/components/query_part/query_part';
import alertDef from './alert_def';
export class AlertModel {
constructor() {
}
}
......@@ -5,7 +5,6 @@ import {ThresholdMapper} from './threshold_mapper';
import {QueryPart} from 'app/core/components/query_part/query_part';
import alertDef from './alert_def';
import config from 'app/core/config';
import moment from 'moment';
import appEvents from 'app/core/app_events';
export class AlertTabCtrl {
......@@ -30,13 +29,11 @@ export class AlertTabCtrl {
/** @ngInject */
constructor(private $scope,
private $timeout,
private backendSrv,
private dashboardSrv,
private uiSegmentSrv,
private $q,
private datasourceSrv,
private templateSrv) {
private datasourceSrv) {
this.panelCtrl = $scope.ctrl;
this.panel = this.panelCtrl.panel;
this.$scope.ctrl = this;
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import config from 'app/core/config';
import {appEvents, coreModule} from 'app/core/core';
export class AlertNotificationEditCtrl {
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import config from 'app/core/config';
import {coreModule} from 'app/core/core';
export class AlertNotificationsListCtrl {
notifications: any;
navModel: any;
/** @ngInject */
constructor(private backendSrv, private $scope, navModelSrv) {
constructor(private backendSrv, navModelSrv) {
this.loadNotifications();
this.navModel = navModelSrv.getAlertingNav(1);
}
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, it, expect} from 'test/lib/common';
import {AlertTabCtrl} from '../alert_tab_ctrl';
import helpers from '../../../../test/specs/helpers';
describe('AlertTabCtrl', () => {
var $scope = {
......@@ -10,7 +9,7 @@ describe('AlertTabCtrl', () => {
describe('with null parameters', () => {
it('can be created', () => {
var alertTab = new AlertTabCtrl($scope, null, null, null, null, null, null, null);
var alertTab = new AlertTabCtrl($scope, null, null, null, null, null);
expect(alertTab).to.not.be(null);
});
......
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
import {describe, it, expect} from 'test/lib/common';
import {ThresholdMapper} from '../threshold_mapper';
......
......@@ -2,8 +2,6 @@
export class ThresholdMapper {
static alertToGraphThresholds(panel) {
var alert = panel.alert;
if (panel.type !== 'graph') {
return false;
}
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
......
......@@ -4,7 +4,6 @@ import './editor_ctrl';
import angular from 'angular';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
export class AnnotationsSrv {
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import moment from 'moment';
import {coreModule} from 'app/core/core';
import {MetricsPanelCtrl} from 'app/plugins/sdk';
import {AnnotationEvent} from './event';
......
......@@ -10,7 +10,7 @@ export class AdHocFiltersCtrl {
removeTagFilterSegment: any;
/** @ngInject */
constructor(private uiSegmentSrv, private datasourceSrv, private $q, private variableSrv, private $scope, private $rootScope) {
constructor(private uiSegmentSrv, private datasourceSrv, private $q, private variableSrv, $scope, private $rootScope) {
this.removeTagFilterSegment = uiSegmentSrv.newSegment({fake: true, value: '-- remove filter --'});
this.buildSegmentModel();
this.$rootScope.onAppEvent('template-variable-value-updated', this.buildSegmentModel.bind(this), $scope);
......@@ -107,7 +107,6 @@ export class AdHocFiltersCtrl {
updateVariableModel() {
var filters = [];
var filterIndex = -1;
var operator = "";
var hasFakes = false;
this.segments.forEach(segment => {
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import angular from 'angular';
import moment from 'moment';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
export class AlertingSrv {
......
......@@ -2,8 +2,6 @@
import config from 'app/core/config';
import angular from 'angular';
import moment from 'moment';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
......@@ -12,7 +10,7 @@ export class DashboardCtrl {
/** @ngInject */
constructor(
private $scope,
private $rootScope,
$rootScope,
keybindingSrv,
timeSrv,
variableSrv,
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import coreModule from 'app/core/core_module';
import {DashboardModel} from './model';
......
......@@ -5,7 +5,6 @@ import moment from 'moment';
import angular from 'angular';
import {appEvents, NavModel} from 'app/core/core';
import {DashboardModel} from '../model';
import {DashboardExporter} from '../export/exporter';
export class DashNavCtrl {
dashboard: DashboardModel;
......@@ -18,12 +17,9 @@ export class DashNavCtrl {
private $rootScope,
private dashboardSrv,
private $location,
private playlistSrv,
private backendSrv,
private $timeout,
private datasourceSrv,
private navModelSrv,
private contextSrv) {
private contextSrv,
navModelSrv) {
this.navModel = navModelSrv.getDashboardNav(this.dashboard, this);
appEvents.on('save-dashboard', this.saveDashboard.bind(this), $scope);
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import angular from 'angular';
import _ from 'lodash';
......
......@@ -22,7 +22,7 @@
<button type="button" class="btn gf-form-btn width-10 btn-secondary" ng-click="ctrl.saveJson()">
<i class="fa fa-file-text-o"></i> View JSON
</button>
<a class="btn btn-link" ng-click="dismiss()">Cancel</a>
<a class="btn btn-link" ng-click="ctrl.dismiss()">Cancel</a>
</div>
</div>
......
///<reference path="../../../headers/common.d.ts" />
import kbn from 'app/core/utils/kbn';
import angular from 'angular';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
import config from 'app/core/config';
import _ from 'lodash';
import {DashboardExporter} from './exporter';
......@@ -15,7 +11,7 @@ export class DashExportCtrl {
dismiss: () => void;
/** @ngInject */
constructor(private backendSrv, private dashboardSrv, datasourceSrv, private $scope) {
constructor(private dashboardSrv, datasourceSrv, private $scope) {
this.exporter = new DashboardExporter(datasourceSrv);
this.exporter.makeExportable(this.dashboardSrv.getCurrent()).then(dash => {
......
///<reference path="../../../headers/common.d.ts" />
import config from 'app/core/config';
import angular from 'angular';
import _ from 'lodash';
import {DynamicDashboardSrv} from '../dynamic_dashboard_srv';
export class DashboardExporter {
......
......@@ -10,8 +10,6 @@ export class ExportDataModalCtrl {
asRows: Boolean = true;
dateTimeFormat: String = 'YYYY-MM-DDTHH:mm:ssZ';
excel: false;
/** @ngInject */
constructor(private $scope) { }
export() {
if (this.panel === 'table') {
......
......@@ -26,14 +26,12 @@ export class HistoryListCtrl {
isNewLatest: boolean;
/** @ngInject */
constructor(private $scope,
private $route,
constructor(private $route,
private $rootScope,
private $location,
private $window,
private $timeout,
private $q,
private historySrv: HistorySrv) {
private historySrv: HistorySrv,
public $scope) {
this.appending = false;
this.diff = 'basic';
......
///<reference path="../../../headers/common.d.ts" />
import kbn from 'app/core/utils/kbn';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
import config from 'app/core/config';
import _ from 'lodash';
......@@ -19,7 +17,7 @@ export class DashImportCtrl {
gnetInfo: any;
/** @ngInject */
constructor(private backendSrv, private $location, private $scope, private $routeParams) {
constructor(private backendSrv, private $location, private $scope, $routeParams) {
this.step = 1;
this.nameExists = false;
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import angular from 'angular';
import moment from 'moment';
import _ from 'lodash';
......
......@@ -3,7 +3,7 @@
import _ from 'lodash';
import config from 'app/core/config';
import {coreModule, appEvents} from 'app/core/core';
import {coreModule} from 'app/core/core';
export class AddPanelCtrl {
row: any;
......@@ -15,7 +15,7 @@ export class AddPanelCtrl {
panelSearch: any;
/** @ngInject */
constructor(private $scope, private $timeout, private $rootScope) {
constructor(private $timeout, private $rootScope) {
this.row = this.rowCtrl.row;
this.dashboard = this.rowCtrl.dashboard;
this.activeIndex = 0;
......
///<reference path="../../../headers/common.d.ts" />
import _ from 'lodash';
import config from 'app/core/config';
import {coreModule} from 'app/core/core';
// import VirtualScroll from 'virtual-scroll';
// console.log(VirtualScroll);
......@@ -14,7 +11,7 @@ export class RowOptionsCtrl {
fontSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
/** @ngInject */
constructor(private $scope, private $timeout, private $rootScope) {
constructor() {
this.row = this.rowCtrl.row;
this.dashboard = this.rowCtrl.dashboard;
this.row.titleSize = this.row.titleSize || 'h6';
......
......@@ -3,7 +3,7 @@
import _ from 'lodash';
import config from 'app/core/config';
import {coreModule, appEvents} from 'app/core/core';
import {coreModule} from 'app/core/core';
import './options';
import './add_panel';
......@@ -186,7 +186,6 @@ coreModule.directive('panelWidth', function($rootScope) {
coreModule.directive('panelDropZone', function($timeout) {
return function(scope, element) {
var row = scope.ctrl.row;
var dashboard = scope.ctrl.dashboard;
var indrag = false;
var textEl = element.find('.panel-drop-zone-text');
......
///<reference path="../../../headers/common.d.ts" />
import _ from 'lodash';
import {Emitter, contextSrv, appEvents, assignModelProperties} from 'app/core/core';
import {Emitter, appEvents, assignModelProperties} from 'app/core/core';
export class DashboardRow {
panels: any;
......
......@@ -36,7 +36,7 @@ export class SaveDashboardAsModalCtrl {
dismiss: () => void;
/** @ngInject */
constructor(private $scope, private dashboardSrv) {
constructor(private dashboardSrv) {
var dashboard = this.dashboardSrv.getCurrent();
this.clone = dashboard.getSaveModelClone();
this.clone.id = null;
......
......@@ -55,7 +55,7 @@ export class SaveDashboardModalCtrl {
dismiss: () => void;
/** @ngInject */
constructor(private $scope, private dashboardSrv) {
constructor(private dashboardSrv) {
this.message = '';
this.max = 64;
}
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, expect} from 'test/lib/common';
import _ from 'lodash';
import {DashboardModel} from '../model';
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach} from 'test/lib/common';
import {DashboardSrv} from '../dashboard_srv';
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
import {DashboardSrv} from '../dashboard_srv';
import '../dashboard_srv';
import {DynamicDashboardSrv} from '../dynamic_dashboard_srv';
function dynamicDashScenario(desc, func) {
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, sinon, expect} from 'test/lib/common';
import _ from 'lodash';
import config from 'app/core/config';
......
......@@ -3,14 +3,14 @@ import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/co
import _ from 'lodash';
import {HistoryListCtrl} from 'app/features/dashboard/history/history';
import { versions, compare, restore } from 'test/mocks/history-mocks';
import config from 'app/core/config';
describe('HistoryListCtrl', function() {
var RESTORE_ID = 4;
var ctx: any = {};
var versionsResponse: any = versions();
var restoreResponse: any = restore(7, RESTORE_ID);
restore(7, RESTORE_ID);
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));
......@@ -65,7 +65,7 @@ describe('HistoryListCtrl', function() {
expect(ctx.ctrl.mode).to.be('list');
expect(ctx.ctrl.delta).to.eql({ basic: '', json: '' });
expect(ctx.ctrl.canCompare).to.be(false);
expect(_.find(ctx.ctrl.revisions, rev => rev.checked)).to.be.undefined;
expect(_.find(ctx.ctrl.revisions, rev => rev.checked)).to.be(undefined);
});
it('should indicate loading has finished', function() {
......@@ -103,7 +103,7 @@ describe('HistoryListCtrl', function() {
it('should reset the controller\'s state', function() {
expect(ctx.ctrl.mode).to.be('list');
expect(ctx.ctrl.delta).to.eql({ basic: '', json: '' });
expect(_.find(ctx.ctrl.revisions, rev => rev.checked)).to.be.undefined;
expect(_.find(ctx.ctrl.revisions, rev => rev.checked)).to.be(undefined);
});
it('should indicate loading has finished', function() {
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
import helpers from 'test/specs/helpers';
import HistorySrv from '../history/history_srv';
import { versions, compare, restore } from 'test/mocks/history-mocks';
import '../history/history_srv';
import {versions, restore} from 'test/mocks/history-mocks';
describe('historySrv', function() {
var ctx = new helpers.ServiceTestContext();
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import _ from 'lodash';
import {DashboardRow} from '../row/row_model';
describe('DashboardRow', function() {
});
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
import helpers from 'test/specs/helpers';
import _ from 'lodash';
import TimeSrv from '../time_srv';
import '../time_srv';
import moment from 'moment';
describe('timeSrv', function() {
......
......@@ -11,7 +11,6 @@ export class SubmenuCtrl {
/** @ngInject */
constructor(private $rootScope,
private variableSrv,
private templateSrv,
private $location) {
this.annotations = this.dashboard.templating.list;
this.variables = this.variableSrv.variables;
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import angular from 'angular';
import moment from 'moment';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
......
......@@ -35,7 +35,7 @@ export class UnsavedChangesModalCtrl {
dismiss: () => void;
/** @ngInject */
constructor(private $rootScope, private unsavedChangesSrv) {
constructor(private unsavedChangesSrv) {
}
discard() {
......
///<reference path="../../headers/common.d.ts" />
import kbn from 'app/core/utils/kbn';
import coreModule from 'app/core/core_module';
var template = `
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
import Remarkable from 'remarkable';
......@@ -18,7 +17,7 @@ export class OrgUsersCtrl {
addUsersBtnName: string;
/** @ngInject */
constructor(private $scope, private $http, private backendSrv, navModelSrv, $sce) {
constructor(private $scope, private backendSrv, navModelSrv, $sce) {
this.user = {
loginOrEmail: '',
role: 'Viewer',
......
///<reference path="../../headers/common.d.ts" />
import config from 'app/core/config';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
export class PrefsControlCtrl {
......
......@@ -2,7 +2,6 @@
import config from 'app/core/config';
import {coreModule} from 'app/core/core';
import _ from 'lodash';
export class ProfileCtrl {
user: any;
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import config from 'app/core/config';
import $ from 'jquery';
import _ from 'lodash';
......@@ -10,7 +9,6 @@ import {PanelCtrl} from './panel_ctrl';
import * as rangeUtil from 'app/core/utils/rangeutil';
import * as dateMath from 'app/core/utils/datemath';
import {Subject} from 'vendor/npm/rxjs/Subject';
import {metricsTabDirective} from './metrics_tab';
class MetricsPanelCtrl extends PanelCtrl {
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import {DashboardModel} from '../dashboard/model';
import Remarkable from 'remarkable';
......@@ -22,7 +21,7 @@ export class MetricsTabCtrl {
queryOptions: any;
/** @ngInject */
constructor($scope, private $sce, private datasourceSrv, private backendSrv, private $timeout) {
constructor($scope, private $sce, datasourceSrv, private backendSrv) {
this.panelCtrl = $scope.ctrl;
$scope.ctrl = this;
......@@ -74,7 +73,6 @@ export class MetricsTabCtrl {
return;
}
var target: any = {isNew: true};
this.panelCtrl.addQuery({isNew: true, datasource: option.datasource.name});
this.addQueryDropdown = {text: 'Add Query', value: null, fake: true};
}
......
......@@ -2,7 +2,6 @@
import config from 'app/core/config';
import _ from 'lodash';
import angular from 'angular';
import $ from 'jquery';
import {profiler} from 'app/core/profiler';
import Remarkable from 'remarkable';
......@@ -213,7 +212,6 @@ export class PanelCtrl {
}
replacePanel(newPanel, oldPanel) {
var row = this.row;
var index = _.indexOf(this.row.panels, oldPanel);
this.row.panels.splice(index, 1);
......
......@@ -2,9 +2,7 @@
import angular from 'angular';
import $ from 'jquery';
import _ from 'lodash';
import Drop from 'tether-drop';
import {appEvents} from 'app/core/core';
var module = angular.module('grafana.directives');
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import config from 'app/core/config';
var directiveModule = angular.module('grafana.directives');
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
export class QueryCtrl {
......@@ -12,7 +11,7 @@ export class QueryCtrl {
error: string;
isLastQuery: boolean;
constructor(public $scope, private $injector) {
constructor(public $scope, public $injector) {
this.panel = this.panelCtrl.panel;
this.isLastQuery = _.indexOf(this.panel.targets, this.target) === (this.panel.targets.length - 1);
}
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
var module = angular.module('grafana.directives');
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import coreModule from '../../core/core_module';
import config from 'app/core/config';
export class PlaylistEditCtrl {
filteredDashboards: any = [];
......@@ -21,11 +19,10 @@ export class PlaylistEditCtrl {
/** @ngInject */
constructor(
private $scope,
private playlistSrv,
private backendSrv,
private $location,
private $route,
private navModelSrv
$route,
navModelSrv
) {
this.navModel = navModelSrv.getPlaylistsNav(0);
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import config from 'app/core/config';
import _ from 'lodash';
import $ from 'jquery';
import coreModule from '../../core/core_module';
export class PlaylistSearchCtrl {
......@@ -13,7 +9,7 @@ export class PlaylistSearchCtrl {
searchStarted: any;
/** @ngInject */
constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv) {
constructor($timeout, private backendSrv) {
this.query = {query: '', tag: [], starred: false, limit: 30};
$timeout(() => {
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import coreModule from '../../core/core_module';
import kbn from 'app/core/utils/kbn';
import appEvents from 'app/core/app_events';
......@@ -16,7 +15,6 @@ class PlaylistSrv {
/** @ngInject */
constructor(
private $rootScope: any,
private $location: any,
private $timeout: any,
private backendSrv: any,
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import coreModule from '../../core/core_module';
......@@ -9,7 +8,7 @@ export class PlaylistsCtrl {
navModel: any;
/** @ngInject */
constructor(private $scope, private $location, private backendSrv, private navModelSrv) {
constructor(private $scope, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getPlaylistsNav(0);
backendSrv.get('/api/playlists').then(result => {
......
......@@ -9,7 +9,7 @@ describe('PlaylistEditCtrl', () => {
getPlaylistsNav: page => {},
};
ctx = new PlaylistEditCtrl(null, null, null, null, { current: { params: {} } }, navModelSrv);
ctx = new PlaylistEditCtrl(null, null, null, { current: { params: {} } }, navModelSrv);
ctx.dashboardresult = [
{ id: 2, title: 'dashboard: 2' },
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import config from 'app/core/config';
......@@ -34,7 +33,6 @@ export class DataSourceEditCtrl {
/** @ngInject */
constructor(
private $scope,
private $q,
private backendSrv,
private $routeParams,
......@@ -43,7 +41,7 @@ export class DataSourceEditCtrl {
private navModelSrv,
) {
this.navModel = navModelSrv.getDatasourceNav(0);
this.navModel = this.navModelSrv.getDatasourceNav(0);
this.isNew = true;
this.datasources = [];
this.tabIndex = 0;
......
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import coreModule from '../../core/core_module';
export class DataSourcesCtrl {
......@@ -11,8 +9,6 @@ export class DataSourcesCtrl {
/** @ngInject */
constructor(
private $scope,
private $location,
private $http,
private backendSrv,
private datasourceSrv,
private navModelSrv
......
///<reference path="../../../headers/common.d.ts" />
import angular from 'angular';
import _ from 'lodash';
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
......@@ -11,7 +10,7 @@ export class DashImportListCtrl {
datasource: any;
/** @ngInject */
constructor($scope, private $http, private backendSrv, private $rootScope) {
constructor($scope, private backendSrv, private $rootScope) {
this.dashboards = [];
backendSrv.get(`/api/plugins/${this.plugin.id}/dashboards`).then(dashboards => {
......
......@@ -2,7 +2,6 @@
import angular from 'angular';
import _ from 'lodash';
import appEvents from 'app/core/app_events';
import Remarkable from 'remarkable';
export class PluginEditCtrl {
......@@ -24,10 +23,9 @@ export class PluginEditCtrl {
private $scope,
private $rootScope,
private backendSrv,
private $routeParams,
private $sce,
private $http,
private navModelSrv,
$routeParams,
navModelSrv,
) {
this.navModel = navModelSrv.getPluginsNav();
this.model = {};
......
......@@ -15,7 +15,7 @@ class StyleGuideCtrl {
navModel: any;
/** @ngInject **/
constructor(private $http, private $routeParams, private $location, private backendSrv, navModelSrv) {
constructor(private $http, private $routeParams, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getAdminNav();
this.theme = config.bootData.user.lightTheme ? 'light': 'dark';
this.page = {};
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {Variable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
export class AdhocVariable implements Variable {
filters: any[];
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import {Variable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
export class ConstantVariable implements Variable {
query: string;
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {Variable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
export class CustomVariable implements Variable {
query: string;
......@@ -26,7 +24,7 @@ export class CustomVariable implements Variable {
};
/** @ngInject **/
constructor(private model, private timeSrv, private templateSrv, private variableSrv) {
constructor(private model, private variableSrv) {
assignModelProperties(this, model, this.defaults);
}
......
///<reference path="../../headers/common.d.ts" />
import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {Variable, containsVariable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
export class DatasourceVariable implements Variable {
regex: any;
......
......@@ -7,7 +7,7 @@ import {variableTypes} from './variable';
export class VariableEditorCtrl {
/** @ngInject **/
constructor(private $scope, private datasourceSrv, private variableSrv, templateSrv) {
constructor($scope, datasourceSrv, variableSrv, templateSrv) {
$scope.variableTypes = variableTypes;
$scope.ctrl = {};
$scope.namePattern = /^(?!__).*$/;
......
......@@ -3,7 +3,6 @@
import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {Variable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
export class IntervalVariable implements Variable {
auto_count: number;
......
......@@ -3,7 +3,6 @@
import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {Variable, containsVariable, assignModelProperties, variableTypes} from './variable';
import {VariableSrv} from './variable_srv';
function getNoneOption() {
return { text: 'None', value: '', isNone: true };
......@@ -48,7 +47,7 @@ export class QueryVariable implements Variable {
};
/** @ngInject **/
constructor(private model, private datasourceSrv, private templateSrv, private variableSrv, private $q, private timeSrv) {
constructor(private model, private datasourceSrv, private templateSrv, private variableSrv, private timeSrv) {
// copy model properties to this instance
assignModelProperties(this, model, this.defaults);
}
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, it, expect} from 'test/lib/common';
import {AdhocVariable} from '../adhoc_variable';
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, it, expect} from 'test/lib/common';
import {QueryVariable} from '../query_variable';
......@@ -7,7 +7,7 @@ describe('QueryVariable', () => {
describe('when creating from model', () => {
it('should set defaults', () => {
var variable = new QueryVariable({}, null, null, null, null, null);
var variable = new QueryVariable({}, null, null, null, null);
expect(variable.datasource).to.be(null);
expect(variable.refresh).to.be(0);
expect(variable.sort).to.be(0);
......@@ -19,7 +19,7 @@ describe('QueryVariable', () => {
});
it('get model should copy changes back to model', () => {
var variable = new QueryVariable({}, null, null, null, null, null);
var variable = new QueryVariable({}, null, null, null, null);
variable.options = [{text: 'test'}];
variable.datasource = 'google';
variable.regex = 'asd';
......@@ -34,7 +34,7 @@ describe('QueryVariable', () => {
});
it('if refresh != 0 then remove options in presisted mode', () => {
var variable = new QueryVariable({}, null, null, null, null, null);
var variable = new QueryVariable({}, null, null, null, null);
variable.options = [{text: 'test'}];
variable.refresh = 1;
......@@ -44,7 +44,7 @@ describe('QueryVariable', () => {
});
describe('can convert and sort metric names',() => {
var variable = new QueryVariable({}, null, null, null, null, null);
var variable = new QueryVariable({}, null, null, null, null);
variable.sort = 3; // Numerical (asc)
describe('can sort a mixed array of metric variables', () => {
......@@ -79,4 +79,3 @@ describe('QueryVariable', () => {
});
});
});
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
import '../all';
import {Emitter} from 'app/core/core';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment