@@ -71,8 +72,8 @@ export class SaveDashboardModalCtrl {
saveTimerange = false;
time: any;
originalTime: any;
- current = [];
- originalCurrent = [];
+ current: any[] = [];
+ originalCurrent: any[] = [];
max: number;
saveForm: any;
isSaving: boolean;
@@ -81,7 +82,7 @@ export class SaveDashboardModalCtrl {
variableValueChange = false;
/** @ngInject */
- constructor(private dashboardSrv) {
+ constructor(private dashboardSrv: DashboardSrv) {
this.message = '';
this.max = 64;
this.isSaving = false;
@@ -94,7 +95,7 @@ export class SaveDashboardModalCtrl {
return;
}
- const options = {
+ const options: any = {
saveVariables: this.saveVariables,
saveTimerange: this.saveTimerange,
message: this.message,
@@ -108,7 +109,7 @@ export class SaveDashboardModalCtrl {
return this.dashboardSrv.save(saveModel, options).then(this.postSave.bind(this, options));
}
- postSave(options) {
+ postSave(options: any) {
if (options.saveVariables) {
this.dashboardSrv.getCurrent().resetOriginalVariables();
}
diff --git a/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.test.ts b/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.test.ts
index 86048e861bd..c815f8d0d22 100644
--- a/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.test.ts
+++ b/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.test.ts
@@ -6,7 +6,7 @@ describe('SaveProvisionedDashboardModalCtrl', () => {
id: 5,
};
- const mockDashboardSrv = {
+ const mockDashboardSrv: any = {
getCurrent: () => {
return {
id: 5,
diff --git a/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.ts b/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.ts
index ca85c962d1a..ec69c0854cf 100644
--- a/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.ts
+++ b/public/app/features/dashboard/components/SaveModals/SaveProvisionedDashboardModalCtrl.ts
@@ -2,6 +2,7 @@ import angular from 'angular';
import { saveAs } from 'file-saver';
import coreModule from 'app/core/core_module';
import { DashboardModel } from '../../state';
+import { DashboardSrv } from '../../services/DashboardSrv';
const template = `
@@ -50,7 +51,7 @@ export class SaveProvisionedDashboardModalCtrl {
dismiss: () => void;
/** @ngInject */
- constructor(dashboardSrv) {
+ constructor(dashboardSrv: DashboardSrv) {
this.dashboardModel = dashboardSrv.getCurrent();
this.dash = this.dashboardModel.getSaveModelClone();
delete this.dash.id;
diff --git a/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.test.ts b/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.test.ts
index 7a5c8ced721..199b7445fd3 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.test.ts
+++ b/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.test.ts
@@ -42,7 +42,7 @@ describe('ShareModalCtrl', () => {
orgId: 1,
},
};
-
+ // @ts-ignore
ctx.ctrl = new ShareModalCtrl(
ctx.scope,
{},
@@ -136,7 +136,7 @@ describe('ShareModalCtrl', () => {
ctx.$location.absUrl = () => 'http://server/#!/test';
ctx.scope.options.includeTemplateVars = true;
- ctx.templateSrv.fillVariableValuesForUrl = params => {
+ ctx.templateSrv.fillVariableValuesForUrl = (params: any) => {
params['var-app'] = 'mupp';
params['var-server'] = 'srv-01';
};
diff --git a/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.ts b/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.ts
index 8eb7b325c58..4d330885e71 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.ts
+++ b/public/app/features/dashboard/components/ShareModal/ShareModalCtrl.ts
@@ -1,10 +1,21 @@
-import angular from 'angular';
+import angular, { ILocationService } from 'angular';
import config from 'app/core/config';
import { dateTime } from '@grafana/data';
import { appendQueryToUrl, toUrlParams } from 'app/core/utils/url';
+import { TimeSrv } from '../../services/TimeSrv';
+import { TemplateSrv } from 'app/features/templating/template_srv';
+import { LinkSrv } from 'app/features/panel/panellinks/link_srv';
/** @ngInject */
-export function ShareModalCtrl($scope, $rootScope, $location, $timeout, timeSrv, templateSrv, linkSrv) {
+export function ShareModalCtrl(
+ $scope: any,
+ $rootScope: any,
+ $location: ILocationService,
+ $timeout: any,
+ timeSrv: TimeSrv,
+ templateSrv: TemplateSrv,
+ linkSrv: LinkSrv
+) {
$scope.options = {
forCurrent: true,
includeTemplateVars: true,
diff --git a/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts b/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts
index c459504d296..9f0e58d3548 100644
--- a/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts
+++ b/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts
@@ -1,9 +1,20 @@
-import angular from 'angular';
+import angular, { ILocationService } from 'angular';
import _ from 'lodash';
+import { BackendSrv } from 'app/core/services/backend_srv';
+import { TimeSrv } from '../../services/TimeSrv';
+import { DashboardModel } from '../../state/DashboardModel';
+import { PanelModel } from '../../state/PanelModel';
export class ShareSnapshotCtrl {
/** @ngInject */
- constructor($scope, $rootScope, $location, backendSrv, $timeout, timeSrv) {
+ constructor(
+ $scope: any,
+ $rootScope: any,
+ $location: ILocationService,
+ backendSrv: BackendSrv,
+ $timeout: any,
+ timeSrv: TimeSrv
+ ) {
$scope.snapshot = {
name: $scope.dashboard.title,
expires: 0,
@@ -26,7 +37,7 @@ export class ShareSnapshotCtrl {
];
$scope.init = () => {
- backendSrv.get('/api/snapshot/shared-options').then(options => {
+ backendSrv.get('/api/snapshot/shared-options').then((options: { [x: string]: any }) => {
$scope.sharingButtonText = options['externalSnapshotName'];
$scope.externalEnabled = options['externalEnabled'];
});
@@ -34,7 +45,7 @@ export class ShareSnapshotCtrl {
$scope.apiUrl = '/api/snapshots';
- $scope.createSnapshot = external => {
+ $scope.createSnapshot = (external: any) => {
$scope.dashboard.snapshot = {
timestamp: new Date(),
};
@@ -52,7 +63,7 @@ export class ShareSnapshotCtrl {
}, $scope.snapshot.timeoutSeconds * 1000);
};
- $scope.saveSnapshot = external => {
+ $scope.saveSnapshot = (external: any) => {
const dash = $scope.dashboard.getSaveModelClone();
$scope.scrubDashboard(dash);
@@ -64,7 +75,7 @@ export class ShareSnapshotCtrl {
};
backendSrv.post($scope.apiUrl, cmdData).then(
- results => {
+ (results: { deleteUrl: any; url: any }) => {
$scope.loading = false;
$scope.deleteUrl = results.deleteUrl;
$scope.snapshotUrl = results.url;
@@ -80,7 +91,7 @@ export class ShareSnapshotCtrl {
return $scope.snapshotUrl;
};
- $scope.scrubDashboard = dash => {
+ $scope.scrubDashboard = (dash: DashboardModel) => {
// change title
dash.title = $scope.snapshot.name;
@@ -131,7 +142,7 @@ export class ShareSnapshotCtrl {
// cleanup snapshotData
delete $scope.dashboard.snapshot;
- $scope.dashboard.forEachPanel(panel => {
+ $scope.dashboard.forEachPanel((panel: PanelModel) => {
delete panel.snapshotData;
});
_.each($scope.dashboard.annotations.list, annotation => {
diff --git a/public/app/features/dashboard/components/SubMenu/SubMenuCtrl.ts b/public/app/features/dashboard/components/SubMenu/SubMenuCtrl.ts
index 502e467ad2b..036d0d0c85d 100644
--- a/public/app/features/dashboard/components/SubMenu/SubMenuCtrl.ts
+++ b/public/app/features/dashboard/components/SubMenu/SubMenuCtrl.ts
@@ -1,5 +1,6 @@
-import angular from 'angular';
+import angular, { ILocationService } from 'angular';
import _ from 'lodash';
+import { VariableSrv } from 'app/features/templating/all';
export class SubMenuCtrl {
annotations: any;
@@ -7,7 +8,7 @@ export class SubMenuCtrl {
dashboard: any;
/** @ngInject */
- constructor(private variableSrv, private $location) {
+ constructor(private variableSrv: VariableSrv, private $location: ILocationService) {
this.annotations = this.dashboard.templating.list;
this.variables = this.variableSrv.variables;
}
@@ -16,11 +17,11 @@ export class SubMenuCtrl {
this.dashboard.startRefresh();
}
- variableUpdated(variable) {
+ variableUpdated(variable: any) {
this.variableSrv.variableUpdated(variable, true);
}
- openEditView(editview) {
+ openEditView(editview: any) {
const search = _.extend(this.$location.search(), { editview: editview });
this.$location.search(search);
}
diff --git a/public/app/features/dashboard/components/UnsavedChangesModal/UnsavedChangesModalCtrl.ts b/public/app/features/dashboard/components/UnsavedChangesModal/UnsavedChangesModalCtrl.ts
index b08a733d877..1acbf66488a 100644
--- a/public/app/features/dashboard/components/UnsavedChangesModal/UnsavedChangesModalCtrl.ts
+++ b/public/app/features/dashboard/components/UnsavedChangesModal/UnsavedChangesModalCtrl.ts
@@ -33,7 +33,7 @@ export class UnsavedChangesModalCtrl {
dismiss: () => void;
/** @ngInject */
- constructor(private unsavedChangesSrv) {}
+ constructor(private unsavedChangesSrv: any) {}
discard() {
this.dismiss();
diff --git a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.test.ts b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.test.ts
index 2b257e148f5..5d0fa874802 100644
--- a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.test.ts
+++ b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.test.ts
@@ -1,6 +1,7 @@
import _ from 'lodash';
import { HistoryListCtrl } from './HistoryListCtrl';
import { versions, compare, restore } from './__mocks__/history';
+// @ts-ignore
import $q from 'q';
describe('HistoryListCtrl', () => {
@@ -10,9 +11,9 @@ describe('HistoryListCtrl', () => {
restore(7, RESTORE_ID);
- let historySrv;
- let $rootScope;
- let historyListCtrl;
+ let historySrv: any;
+ let $rootScope: any;
+ let historyListCtrl: any;
beforeEach(() => {
historySrv = {
calculateDiff: jest.fn(),
@@ -25,13 +26,13 @@ describe('HistoryListCtrl', () => {
});
describe('when the history list component is loaded', () => {
- let deferred;
+ let deferred: any;
beforeEach(() => {
deferred = $q.defer({});
historySrv.getHistoryList = jest.fn(() => deferred.promise);
- historyListCtrl = new HistoryListCtrl({}, $rootScope, {}, $q, historySrv, {});
+ historyListCtrl = new HistoryListCtrl({}, $rootScope, {} as any, $q, historySrv, {});
historyListCtrl.dashboard = {
id: 2,
@@ -89,7 +90,7 @@ describe('HistoryListCtrl', () => {
historySrv.getHistoryList = jest.fn(() => deferred.promise);
- historyListCtrl = new HistoryListCtrl({}, $rootScope, {}, $q, historySrv, {});
+ historyListCtrl = new HistoryListCtrl({}, $rootScope, {} as any, $q, historySrv, {});
deferred.reject(new Error('HistoryListError'));
@@ -130,14 +131,14 @@ describe('HistoryListCtrl', () => {
});
describe('when the user wants to compare two revisions', () => {
- let deferred;
+ let deferred: any;
beforeEach(async () => {
deferred = $q.defer({});
historySrv.getHistoryList = jest.fn(() => $q.when(versionsResponse));
historySrv.calculateDiff = jest.fn(() => deferred.promise);
- historyListCtrl = new HistoryListCtrl({}, $rootScope, {}, $q, historySrv, {});
+ historyListCtrl = new HistoryListCtrl({}, $rootScope, {} as any, $q, historySrv, {});
historyListCtrl.dashboard = {
id: 2,
@@ -272,14 +273,14 @@ describe('HistoryListCtrl', () => {
});
describe('when the user wants to restore a revision', () => {
- let deferred;
+ let deferred: any;
beforeEach(async () => {
deferred = $q.defer();
historySrv.getHistoryList = jest.fn(() => $q.when(versionsResponse));
historySrv.restoreDashboard = jest.fn(() => deferred.promise);
- historyListCtrl = new HistoryListCtrl({}, $rootScope, {}, $q, historySrv, {});
+ historyListCtrl = new HistoryListCtrl({}, $rootScope, {} as any, $q, historySrv, {});
historyListCtrl.dashboard = {
id: 1,
@@ -299,7 +300,7 @@ describe('HistoryListCtrl', () => {
deferred = $q.defer();
historySrv.getHistoryList = jest.fn(() => $q.when(versionsResponse));
historySrv.restoreDashboard = jest.fn(() => deferred.promise);
- historyListCtrl = new HistoryListCtrl({}, $rootScope, {}, $q, historySrv, {});
+ historyListCtrl = new HistoryListCtrl({}, $rootScope, {} as any, $q, historySrv, {});
deferred.reject(new Error('RestoreError'));
historyListCtrl.restoreConfirm(RESTORE_ID);
await historyListCtrl.getLog();
diff --git a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts
index 0d15c4bf1bf..10574a48ddc 100644
--- a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts
+++ b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts
@@ -1,10 +1,10 @@
import _ from 'lodash';
-import angular from 'angular';
+import angular, { ILocationService, IQService } from 'angular';
import locationUtil from 'app/core/utils/location_util';
import { DashboardModel } from '../../state/DashboardModel';
import { HistoryListOpts, RevisionsModel, CalculateDiffOptions, HistorySrv } from './HistorySrv';
-import { dateTime, toUtc } from '@grafana/data';
+import { dateTime, toUtc, DateTimeInput } from '@grafana/data';
export class HistoryListCtrl {
appending: boolean;
@@ -24,12 +24,12 @@ export class HistoryListCtrl {
/** @ngInject */
constructor(
- private $route,
- private $rootScope,
- private $location,
- private $q,
+ private $route: any,
+ private $rootScope: any,
+ private $location: ILocationService,
+ private $q: IQService,
private historySrv: HistorySrv,
- public $scope
+ public $scope: any
) {
this.appending = false;
this.diff = 'basic';
@@ -69,11 +69,11 @@ export class HistoryListCtrl {
this.canCompare = selected === 2;
}
- formatDate(date) {
+ formatDate(date: DateTimeInput) {
return this.dashboard.formatDate(date);
}
- formatBasicDate(date) {
+ formatBasicDate(date: DateTimeInput) {
const now = this.dashboard.timezone === 'browser' ? dateTime() : toUtc();
const then = this.dashboard.timezone === 'browser' ? dateTime(date) : toUtc(date);
return then.from(now);
@@ -84,7 +84,9 @@ export class HistoryListCtrl {
this.mode = 'compare';
// have it already been fetched?
+ // @ts-ignore
if (this.delta[this.diff]) {
+ // @ts-ignore
return this.$q.when(this.delta[this.diff]);
}
@@ -109,7 +111,8 @@ export class HistoryListCtrl {
return this.historySrv
.calculateDiff(options)
- .then(response => {
+ .then((response: any) => {
+ // @ts-ignore
this.delta[this.diff] = response;
})
.catch(() => {
@@ -130,7 +133,7 @@ export class HistoryListCtrl {
return this.historySrv
.getHistoryList(this.dashboard, options)
- .then(revisions => {
+ .then((revisions: any) => {
// set formatted dates & default values
for (const rev of revisions) {
rev.createdDateString = this.formatDate(rev.created);
@@ -140,7 +143,7 @@ export class HistoryListCtrl {
this.revisions = append ? this.revisions.concat(revisions) : revisions;
})
- .catch(err => {
+ .catch((err: any) => {
this.loading = false;
})
.finally(() => {
@@ -183,7 +186,7 @@ export class HistoryListCtrl {
this.loading = true;
return this.historySrv
.restoreDashboard(this.dashboard, version)
- .then(response => {
+ .then((response: any) => {
this.$location.url(locationUtil.stripBaseFromUrl(response.url)).replace();
this.$route.reload();
this.$rootScope.appEvent('alert-success', ['Dashboard restored', 'Restored from version ' + version]);
diff --git a/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts b/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts
index 04f0eff1cb8..c09563e1635 100644
--- a/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts
+++ b/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts
@@ -7,7 +7,7 @@ describe('historySrv', () => {
const versionsResponse = versions();
const restoreResponse = restore;
- const backendSrv = {
+ const backendSrv: any = {
get: jest.fn(() => Promise.resolve({})),
post: jest.fn(() => Promise.resolve({})),
};
@@ -23,19 +23,19 @@ describe('historySrv', () => {
backendSrv.get = jest.fn(() => Promise.resolve(versionsResponse));
historySrv = new HistorySrv(backendSrv);
- return historySrv.getHistoryList(dash, historyListOpts).then(versions => {
+ return historySrv.getHistoryList(dash, historyListOpts).then((versions: any) => {
expect(versions).toEqual(versionsResponse);
});
});
it('should return an empty array when not given an id', () => {
- return historySrv.getHistoryList(emptyDash, historyListOpts).then(versions => {
+ return historySrv.getHistoryList(emptyDash, historyListOpts).then((versions: any) => {
expect(versions).toEqual([]);
});
});
it('should return an empty array when not given a dashboard', () => {
- return historySrv.getHistoryList(null, historyListOpts).then(versions => {
+ return historySrv.getHistoryList(null, historyListOpts).then((versions: any) => {
expect(versions).toEqual([]);
});
});
@@ -46,7 +46,7 @@ describe('historySrv', () => {
const version = 6;
backendSrv.post = jest.fn(() => Promise.resolve(restoreResponse(version)));
historySrv = new HistorySrv(backendSrv);
- return historySrv.restoreDashboard(dash, version).then(response => {
+ return historySrv.restoreDashboard(dash, version).then((response: any) => {
expect(response).toEqual(restoreResponse(version));
});
});
diff --git a/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts b/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts
index a06212f9a7a..f62f73e4347 100644
--- a/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts
+++ b/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts
@@ -1,6 +1,7 @@
import _ from 'lodash';
import coreModule from 'app/core/core_module';
import { DashboardModel } from '../../state/DashboardModel';
+import { BackendSrv } from 'app/core/services/backend_srv';
export interface HistoryListOpts {
limit: number;
@@ -32,7 +33,7 @@ export interface DiffTarget {
export class HistorySrv {
/** @ngInject */
- constructor(private backendSrv) {}
+ constructor(private backendSrv: BackendSrv) {}
getHistoryList(dashboard: DashboardModel, options: HistoryListOpts) {
const id = dashboard && dashboard.id ? dashboard.id : void 0;
diff --git a/public/app/features/dashboard/components/VersionHistory/__mocks__/history.ts b/public/app/features/dashboard/components/VersionHistory/__mocks__/history.ts
index 50f6ceba077..0fcd3b43d1c 100644
--- a/public/app/features/dashboard/components/VersionHistory/__mocks__/history.ts
+++ b/public/app/features/dashboard/components/VersionHistory/__mocks__/history.ts
@@ -44,11 +44,11 @@ export function versions() {
];
}
-export function compare(type) {
+export function compare(type: any) {
return type === 'basic' ? '
' : '
';
}
-export function restore(version, restoredFrom?) {
+export function restore(version: any, restoredFrom?: any): any {
return {
dashboard: {
meta: {
diff --git a/public/app/features/dashboard/containers/DashboardPage.test.tsx b/public/app/features/dashboard/containers/DashboardPage.test.tsx
index 0489f7a59c1..6ee4611ae19 100644
--- a/public/app/features/dashboard/containers/DashboardPage.test.tsx
+++ b/public/app/features/dashboard/containers/DashboardPage.test.tsx
@@ -38,7 +38,7 @@ function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel
return new DashboardModel(data, meta);
}
-function dashboardPageScenario(description, scenarioFn: (ctx: ScenarioContext) => void) {
+function dashboardPageScenario(description: string, scenarioFn: (ctx: ScenarioContext) => void) {
describe(description, () => {
let setupFn: () => void;
diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx
index 28845d4f463..9b8c3940005 100644
--- a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx
+++ b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx
@@ -48,7 +48,7 @@ function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel
return new DashboardModel(data, meta);
}
-function dashboardGridScenario(description, scenarioFn: (ctx: ScenarioContext) => void) {
+function dashboardGridScenario(description: string, scenarioFn: (ctx: ScenarioContext) => void) {
describe(description, () => {
let setupFn: () => void;
diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx
index 639e34a16ae..c1c089f7a63 100644
--- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx
+++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx
@@ -3,6 +3,7 @@ import React, { PureComponent } from 'react';
import { hot } from 'react-hot-loader';
import ReactGridLayout, { ItemCallback } from 'react-grid-layout';
import classNames from 'classnames';
+// @ts-ignore
import sizeMe from 'react-sizeme';
// Types
diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx
index 72977e7ebc1..4d7b2cf8d8d 100644
--- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx
+++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx
@@ -34,7 +34,7 @@ export interface State {
export class DashboardPanel extends PureComponent
{
element: HTMLElement;
- specialPanels = {};
+ specialPanels: { [key: string]: Function } = {};
constructor(props: Props) {
super(props);
diff --git a/public/app/features/dashboard/dashgrid/PanelResizer.tsx b/public/app/features/dashboard/dashgrid/PanelResizer.tsx
index ad36f78ac3d..6c742cc01f5 100644
--- a/public/app/features/dashboard/dashgrid/PanelResizer.tsx
+++ b/public/app/features/dashboard/dashgrid/PanelResizer.tsx
@@ -21,7 +21,7 @@ export class PanelResizer extends PureComponent {
throttledResizeDone: () => void;
noStyles: object = {};
- constructor(props) {
+ constructor(props: Props) {
super(props);
const { panel } = this.props;
diff --git a/public/app/features/dashboard/panel_editor/EditorTabBody.tsx b/public/app/features/dashboard/panel_editor/EditorTabBody.tsx
index 6d2ce838117..c68332442ab 100644
--- a/public/app/features/dashboard/panel_editor/EditorTabBody.tsx
+++ b/public/app/features/dashboard/panel_editor/EditorTabBody.tsx
@@ -32,11 +32,11 @@ interface State {
}
export class EditorTabBody extends PureComponent {
- static defaultProps = {
+ static defaultProps: Partial = {
toolbarItems: [],
};
- constructor(props) {
+ constructor(props: Props) {
super(props);
this.state = {
@@ -61,10 +61,10 @@ export class EditorTabBody extends PureComponent {
this.setState({ isOpen: false });
};
- static getDerivedStateFromProps(props, state) {
+ static getDerivedStateFromProps(props: Props, state: State) {
if (state.openView) {
const activeToolbarItem = props.toolbarItems.find(
- item => item.title === state.openView.title && item.icon === state.openView.icon
+ (item: any) => item.title === state.openView.title && item.icon === state.openView.icon
);
if (activeToolbarItem) {
return {
diff --git a/public/app/features/dashboard/panel_editor/GeneralTab.tsx b/public/app/features/dashboard/panel_editor/GeneralTab.tsx
index 6902e3f1b97..2e91997b65e 100644
--- a/public/app/features/dashboard/panel_editor/GeneralTab.tsx
+++ b/public/app/features/dashboard/panel_editor/GeneralTab.tsx
@@ -20,7 +20,7 @@ export class GeneralTab extends PureComponent {
element: any;
component: AngularComponent;
- constructor(props) {
+ constructor(props: Props) {
super(props);
}
diff --git a/public/app/features/dashboard/panel_editor/QueriesTab.tsx b/public/app/features/dashboard/panel_editor/QueriesTab.tsx
index 711e26a2164..6e32b7ca545 100644
--- a/public/app/features/dashboard/panel_editor/QueriesTab.tsx
+++ b/public/app/features/dashboard/panel_editor/QueriesTab.tsx
@@ -89,7 +89,7 @@ export class QueriesTab extends PureComponent {
return this.datasources.find(datasource => datasource.value === panel.datasource) || this.datasources[0];
}
- onChangeDataSource = datasource => {
+ onChangeDataSource = (datasource: any) => {
const { panel } = this.props;
const { currentDS } = this.state;
@@ -194,7 +194,7 @@ export class QueriesTab extends PureComponent {
);
};
- onAddMixedQuery = datasource => {
+ onAddMixedQuery = (datasource: any) => {
this.onAddQuery({ datasource: datasource.name });
this.setState({ isAddingMixed: false, scrollTop: this.state.scrollTop + 10000 });
};
@@ -203,7 +203,7 @@ export class QueriesTab extends PureComponent {
this.setState({ isAddingMixed: false });
};
- onQueryChange = (query: DataQuery, index) => {
+ onQueryChange = (query: DataQuery, index: number) => {
this.props.panel.changeQuery(query, index);
this.forceUpdate();
};
diff --git a/public/app/features/dashboard/panel_editor/QueryInspector.tsx b/public/app/features/dashboard/panel_editor/QueryInspector.tsx
index a72fbdb7e8f..a2aaa422046 100644
--- a/public/app/features/dashboard/panel_editor/QueryInspector.tsx
+++ b/public/app/features/dashboard/panel_editor/QueryInspector.tsx
@@ -24,7 +24,7 @@ export class QueryInspector extends PureComponent {
formattedJson: any;
clipboard: any;
- constructor(props) {
+ constructor(props: Props) {
super(props);
this.state = {
allNodesExpanded: null,
@@ -56,7 +56,7 @@ export class QueryInspector extends PureComponent {
panel.events.off('refresh', this.onPanelRefresh);
}
- handleMocking(response) {
+ handleMocking(response: any) {
const { mockedResponse } = this.state;
let mockedData;
try {
@@ -126,7 +126,7 @@ export class QueryInspector extends PureComponent {
}));
};
- setFormattedJson = formattedJson => {
+ setFormattedJson = (formattedJson: any) => {
this.formattedJson = formattedJson;
};
@@ -161,7 +161,7 @@ export class QueryInspector extends PureComponent {
return 1;
};
- setMockedResponse = evt => {
+ setMockedResponse = (evt: any) => {
const mockedResponse = evt.target.value;
this.setState(prevState => ({
...prevState,
diff --git a/public/app/features/dashboard/panel_editor/QueryOptions.tsx b/public/app/features/dashboard/panel_editor/QueryOptions.tsx
index a10ec31fae7..96773e141ff 100644
--- a/public/app/features/dashboard/panel_editor/QueryOptions.tsx
+++ b/public/app/features/dashboard/panel_editor/QueryOptions.tsx
@@ -1,5 +1,5 @@
// Libraries
-import React, { PureComponent, ChangeEvent, FocusEvent } from 'react';
+import React, { PureComponent, ChangeEvent, FocusEvent, ReactText } from 'react';
// Utils
import { rangeUtil } from '@grafana/data';
@@ -46,13 +46,13 @@ interface State {
relativeTime: string;
timeShift: string;
cacheTimeout: string;
- maxDataPoints: string;
+ maxDataPoints: string | ReactText;
interval: string;
hideTimeOverride: boolean;
}
export class QueryOptions extends PureComponent {
- allOptions = {
+ allOptions: any = {
cacheTimeout: {
label: 'Cache timeout',
placeholder: '60',
@@ -91,7 +91,7 @@ export class QueryOptions extends PureComponent {
},
};
- constructor(props) {
+ constructor(props: Props) {
super(props);
this.state = {
@@ -147,6 +147,7 @@ export class QueryOptions extends PureComponent {
onDataSourceOptionBlur = (panelKey: string) => () => {
const { panel } = this.props;
+ // @ts-ignore
panel[panelKey] = this.state[panelKey];
panel.refresh();
};
@@ -172,6 +173,7 @@ export class QueryOptions extends PureComponent {
{...options}
onChange={this.onDataSourceOptionChange(panelKey)}
onBlur={this.onDataSourceOptionBlur(panelKey)}
+ // @ts-ignore
value={this.state[panelKey]}
/>
);
diff --git a/public/app/features/dashboard/services/ChangeTracker.test.ts b/public/app/features/dashboard/services/ChangeTracker.test.ts
index 31e5f8f5052..7448411a1b0 100644
--- a/public/app/features/dashboard/services/ChangeTracker.test.ts
+++ b/public/app/features/dashboard/services/ChangeTracker.test.ts
@@ -14,7 +14,7 @@ describe('ChangeTracker', () => {
let location;
const timeout = () => {};
let tracker: ChangeTracker;
- let dash;
+ let dash: any;
let scope;
beforeEach(() => {
@@ -57,7 +57,7 @@ describe('ChangeTracker', () => {
path: jest.fn(),
};
- tracker = new ChangeTracker(dash, scope, undefined, location, window, timeout, contextSrv, rootScope);
+ tracker = new ChangeTracker(dash, scope, undefined, location as any, window, timeout, contextSrv, rootScope);
});
it('No changes should not have changes', () => {
diff --git a/public/app/features/dashboard/services/ChangeTracker.ts b/public/app/features/dashboard/services/ChangeTracker.ts
index 7fe365cd8e0..a0e84665282 100644
--- a/public/app/features/dashboard/services/ChangeTracker.ts
+++ b/public/app/features/dashboard/services/ChangeTracker.ts
@@ -1,6 +1,7 @@
-import angular from 'angular';
+import angular, { ILocationService } from 'angular';
import _ from 'lodash';
import { DashboardModel } from '../state/DashboardModel';
+import { ContextSrv } from 'app/core/services/context_srv';
export class ChangeTracker {
current: any;
@@ -12,14 +13,14 @@ export class ChangeTracker {
/** @ngInject */
constructor(
- dashboard,
- scope,
- originalCopyDelay,
- private $location,
- $window,
- private $timeout,
- private contextSrv,
- private $rootScope
+ dashboard: DashboardModel,
+ scope: any,
+ originalCopyDelay: any,
+ private $location: ILocationService,
+ $window: any,
+ private $timeout: any,
+ private contextSrv: ContextSrv,
+ private $rootScope: any
) {
this.$location = $location;
this.$window = $window;
@@ -44,7 +45,7 @@ export class ChangeTracker {
return undefined;
};
- scope.$on('$locationChangeStart', (event, next) => {
+ scope.$on('$locationChangeStart', (event: any, next: any) => {
// check if we should look for changes
if (this.originalPath === $location.path()) {
return true;
@@ -92,7 +93,7 @@ export class ChangeTracker {
}
// remove stuff that should not count in diff
- cleanDashboardFromIgnoredChanges(dashData) {
+ cleanDashboardFromIgnoredChanges(dashData: any) {
// need to new up the domain model class to get access to expand / collapse row logic
const model = new DashboardModel(dashData);
diff --git a/public/app/features/dashboard/services/DashboardLoaderSrv.ts b/public/app/features/dashboard/services/DashboardLoaderSrv.ts
index 2eb6318c72f..e6a9517bc2a 100644
--- a/public/app/features/dashboard/services/DashboardLoaderSrv.ts
+++ b/public/app/features/dashboard/services/DashboardLoaderSrv.ts
@@ -1,27 +1,31 @@
/* tslint:disable:import-blacklist */
-import angular from 'angular';
+import angular, { IQService } from 'angular';
import moment from 'moment';
import _ from 'lodash';
import $ from 'jquery';
import kbn from 'app/core/utils/kbn';
import { dateMath } from '@grafana/data';
import impressionSrv from 'app/core/services/impression_srv';
+import { BackendSrv } from 'app/core/services/backend_srv';
+import { DashboardSrv } from './DashboardSrv';
+import DatasourceSrv from 'app/features/plugins/datasource_srv';
+import { UrlQueryValue } from '@grafana/runtime';
export class DashboardLoaderSrv {
/** @ngInject */
constructor(
- private backendSrv,
- private dashboardSrv,
- private datasourceSrv,
- private $http,
- private $q,
- private $timeout,
- contextSrv,
- private $routeParams,
- private $rootScope
+ private backendSrv: BackendSrv,
+ private dashboardSrv: DashboardSrv,
+ private datasourceSrv: DatasourceSrv,
+ private $http: any,
+ private $q: IQService,
+ private $timeout: any,
+ contextSrv: any,
+ private $routeParams: any,
+ private $rootScope: any
) {}
- _dashboardLoadFailed(title, snapshot?) {
+ _dashboardLoadFailed(title: string, snapshot?: boolean) {
snapshot = snapshot || false;
return {
meta: {
@@ -32,11 +36,11 @@ export class DashboardLoaderSrv {
canEdit: false,
dashboardNotFound: true,
},
- dashboard: { title: title },
+ dashboard: { title },
};
}
- loadDashboard(type, slug, uid) {
+ loadDashboard(type: UrlQueryValue, slug: any, uid: any) {
let promise;
if (type === 'script') {
@@ -48,7 +52,7 @@ export class DashboardLoaderSrv {
} else {
promise = this.backendSrv
.getDashboardByUid(uid)
- .then(result => {
+ .then((result: any) => {
if (result.meta.isFolder) {
this.$rootScope.appEvent('alert-error', ['Dashboard not found']);
throw new Error('Dashboard not found');
@@ -60,7 +64,7 @@ export class DashboardLoaderSrv {
});
}
- promise.then(result => {
+ promise.then((result: any) => {
if (result.meta.dashboardNotFound !== true) {
impressionSrv.addDashboardImpression(result.dashboard.id);
}
@@ -71,13 +75,13 @@ export class DashboardLoaderSrv {
return promise;
}
- _loadScriptedDashboard(file) {
+ _loadScriptedDashboard(file: string) {
const url = 'public/dashboards/' + file.replace(/\.(?!js)/, '/') + '?' + new Date().getTime();
return this.$http({ url: url, method: 'GET' })
.then(this._executeScript.bind(this))
.then(
- result => {
+ (result: any) => {
return {
meta: {
fromScript: true,
@@ -88,7 +92,7 @@ export class DashboardLoaderSrv {
dashboard: result.data,
};
},
- err => {
+ (err: any) => {
console.log('Script dashboard error ' + err);
this.$rootScope.appEvent('alert-error', [
'Script Error',
@@ -99,7 +103,7 @@ export class DashboardLoaderSrv {
);
}
- _executeScript(result) {
+ _executeScript(result: any) {
const services = {
dashboardSrv: this.dashboardSrv,
datasourceSrv: this.datasourceSrv,
@@ -125,7 +129,7 @@ export class DashboardLoaderSrv {
// Handle async dashboard scripts
if (_.isFunction(scriptResult)) {
const deferred = this.$q.defer();
- scriptResult(dashboard => {
+ scriptResult((dashboard: any) => {
this.$timeout(() => {
deferred.resolve({ data: dashboard });
});
diff --git a/public/app/features/dashboard/services/DashboardSrv.ts b/public/app/features/dashboard/services/DashboardSrv.ts
index 66e6d1d0b70..5be8f169209 100644
--- a/public/app/features/dashboard/services/DashboardSrv.ts
+++ b/public/app/features/dashboard/services/DashboardSrv.ts
@@ -4,12 +4,14 @@ import locationUtil from 'app/core/utils/location_util';
import { DashboardModel } from '../state/DashboardModel';
import { removePanel } from '../utils/panel';
import { DashboardMeta } from 'app/types';
+import { BackendSrv } from 'app/core/services/backend_srv';
+import { ILocationService } from 'angular';
export class DashboardSrv {
dashboard: DashboardModel;
/** @ngInject */
- constructor(private backendSrv, private $rootScope, private $location) {
+ constructor(private backendSrv: BackendSrv, private $rootScope: any, private $location: ILocationService) {
appEvents.on('save-dashboard', this.saveDashboard.bind(this), $rootScope);
appEvents.on('panel-change-view', this.onPanelChangeView);
appEvents.on('remove-panel', this.onRemovePanel);
@@ -35,7 +37,7 @@ export class DashboardSrv {
removePanel(dashboard, dashboard.getPanelById(panelId), true);
};
- onPanelChangeView = options => {
+ onPanelChangeView = (options: any) => {
const urlParams = this.$location.search();
// handle toggle logic
@@ -75,7 +77,11 @@ export class DashboardSrv {
this.$location.search(urlParams);
};
- handleSaveDashboardError(clone, options, err) {
+ handleSaveDashboardError(
+ clone: any,
+ options: { overwrite?: any },
+ err: { data: { status: string; message: any }; isHandled: boolean }
+ ) {
options = options || {};
options.overwrite = true;
@@ -129,7 +135,7 @@ export class DashboardSrv {
}
}
- postSave(clone, data) {
+ postSave(clone: DashboardModel, data: { version: number; url: string }) {
this.dashboard.version = data.version;
// important that these happens before location redirect below
@@ -146,7 +152,7 @@ export class DashboardSrv {
return this.dashboard;
}
- save(clone, options) {
+ save(clone: any, options: { overwrite?: any; folderId?: any }) {
options = options || {};
options.folderId = options.folderId >= 0 ? options.folderId : this.dashboard.meta.folderId || clone.folderId;
@@ -156,7 +162,7 @@ export class DashboardSrv {
.catch(this.handleSaveDashboardError.bind(this, clone, options));
}
- saveDashboard(options?, clone?) {
+ saveDashboard(options?: { overwrite?: any; folderId?: any; makeEditable?: any }, clone?: DashboardModel) {
if (clone) {
this.setCurrent(this.create(clone, this.dashboard.meta));
}
@@ -204,7 +210,7 @@ export class DashboardSrv {
});
}
- starDashboard(dashboardId, isStarred) {
+ starDashboard(dashboardId: string, isStarred: any) {
let promise;
if (isStarred) {
@@ -217,7 +223,7 @@ export class DashboardSrv {
});
}
- return promise.then(res => {
+ return promise.then((res: boolean) => {
if (this.dashboard && this.dashboard.id === dashboardId) {
this.dashboard.meta.isStarred = res;
}
diff --git a/public/app/features/dashboard/services/TimeSrv.test.ts b/public/app/features/dashboard/services/TimeSrv.test.ts
index 11918955de1..910e85506ed 100644
--- a/public/app/features/dashboard/services/TimeSrv.test.ts
+++ b/public/app/features/dashboard/services/TimeSrv.test.ts
@@ -19,7 +19,7 @@ describe('timeSrv', () => {
search: jest.fn(() => ({})),
};
- let timeSrv;
+ let timeSrv: TimeSrv;
const _dashboard: any = {
time: { from: 'now-6h', to: 'now' },
diff --git a/public/app/features/dashboard/services/UnsavedChangesSrv.ts b/public/app/features/dashboard/services/UnsavedChangesSrv.ts
index 2691cc6ebf8..69a11f5be78 100644
--- a/public/app/features/dashboard/services/UnsavedChangesSrv.ts
+++ b/public/app/features/dashboard/services/UnsavedChangesSrv.ts
@@ -1,9 +1,20 @@
-import angular from 'angular';
+import angular, { IQService, ILocationService } from 'angular';
import { ChangeTracker } from './ChangeTracker';
+import { ContextSrv } from 'app/core/services/context_srv';
+import { DashboardSrv } from './DashboardSrv';
/** @ngInject */
-export function unsavedChangesSrv(this: any, $rootScope, $q, $location, $timeout, contextSrv, dashboardSrv, $window) {
- this.init = function(dashboard, scope) {
+export function unsavedChangesSrv(
+ this: any,
+ $rootScope: any,
+ $q: IQService,
+ $location: ILocationService,
+ $timeout: any,
+ contextSrv: ContextSrv,
+ dashboardSrv: DashboardSrv,
+ $window: any
+) {
+ this.init = function(dashboard: any, scope: any) {
this.tracker = new ChangeTracker(dashboard, scope, 1000, $location, $window, $timeout, contextSrv, $rootScope);
return this.tracker;
};
diff --git a/public/app/features/dashboard/state/DashboardMigrator.test.ts b/public/app/features/dashboard/state/DashboardMigrator.test.ts
index f97c26c97d1..7bb0082127a 100644
--- a/public/app/features/dashboard/state/DashboardMigrator.test.ts
+++ b/public/app/features/dashboard/state/DashboardMigrator.test.ts
@@ -9,10 +9,10 @@ jest.mock('app/core/services/context_srv', () => ({}));
describe('DashboardModel', () => {
describe('when creating dashboard with old schema', () => {
- let model;
- let graph;
- let singlestat;
- let table;
+ let model: any;
+ let graph: any;
+ let singlestat: any;
+ let table: any;
beforeEach(() => {
model = new DashboardModel({
@@ -142,7 +142,7 @@ describe('DashboardModel', () => {
});
describe('when migrating to the grid layout', () => {
- let model;
+ let model: any;
beforeEach(() => {
model = {
@@ -385,7 +385,7 @@ describe('DashboardModel', () => {
});
describe('when migrating panel links', () => {
- let model;
+ let model: any;
beforeEach(() => {
model = new DashboardModel({
@@ -439,15 +439,16 @@ describe('DashboardModel', () => {
});
});
-function createRow(options, panelDescriptions: any[]) {
+function createRow(options: any, panelDescriptions: any[]) {
const PANEL_HEIGHT_STEP = GRID_CELL_HEIGHT + GRID_CELL_VMARGIN;
const { collapse, showTitle, title, repeat, repeatIteration } = options;
let { height } = options;
height = height * PANEL_HEIGHT_STEP;
- const panels = [];
+ const panels: any[] = [];
_.each(panelDescriptions, panelDesc => {
const panel = { span: panelDesc[0] };
if (panelDesc.length > 1) {
+ //@ts-ignore
panel['height'] = panelDesc[1] * PANEL_HEIGHT_STEP;
}
panels.push(panel);
diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts
index 62925b3f7c3..e9ec4228d60 100644
--- a/public/app/features/dashboard/state/DashboardMigrator.ts
+++ b/public/app/features/dashboard/state/DashboardMigrator.ts
@@ -48,7 +48,7 @@ export class DashboardMigrator {
}
}
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
// rename panel type
if (panel.type === 'graphite') {
panel.type = 'graph';
@@ -95,7 +95,7 @@ export class DashboardMigrator {
if (oldVersion < 3) {
// ensure panel ids
let maxId = this.dashboard.getNextPanelId();
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (!panel.id) {
panel.id = maxId;
maxId += 1;
@@ -106,7 +106,7 @@ export class DashboardMigrator {
// schema version 4 changes
if (oldVersion < 4) {
// move aliasYAxis changes
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') {
return;
}
@@ -151,7 +151,7 @@ export class DashboardMigrator {
}
// ensure query refIds
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
_.each(panel.targets, target => {
if (!target.refId) {
target.refId = panel.getNextQueryLetter && panel.getNextQueryLetter();
@@ -161,7 +161,7 @@ export class DashboardMigrator {
}
if (oldVersion < 8) {
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
_.each(panel.targets, target => {
// update old influxdb query schema
if (target.fields && target.tags && target.groupBy) {
@@ -206,7 +206,7 @@ export class DashboardMigrator {
// schema version 9 changes
if (oldVersion < 9) {
// move aliasYAxis changes
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.type !== 'singlestat' && panel.thresholds !== '') {
return;
}
@@ -225,7 +225,7 @@ export class DashboardMigrator {
// schema version 10 changes
if (oldVersion < 10) {
// move aliasYAxis changes
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.type !== 'table') {
return;
}
@@ -259,7 +259,7 @@ export class DashboardMigrator {
if (oldVersion < 12) {
// update graph yaxes changes
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') {
return;
}
@@ -308,7 +308,7 @@ export class DashboardMigrator {
if (oldVersion < 13) {
// update graph yaxes changes
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.type !== 'graph') {
return;
}
@@ -380,7 +380,7 @@ export class DashboardMigrator {
}
if (oldVersion < 17) {
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.minSpan) {
const max = GRID_COLUMN_COUNT / panel.minSpan;
const factors = getFactors(GRID_COLUMN_COUNT);
@@ -399,7 +399,7 @@ export class DashboardMigrator {
if (oldVersion < 18) {
// migrate change to gauge options
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel['options-gauge']) {
panel.options = panel['options-gauge'];
panel.options.valueOptions = {
@@ -429,7 +429,7 @@ export class DashboardMigrator {
if (oldVersion < 19) {
// migrate change to gauge options
- panelUpgrades.push(panel => {
+ panelUpgrades.push((panel: any) => {
if (panel.links && _.isArray(panel.links)) {
panel.links = panel.links.map(upgradePanelLink);
}
@@ -452,7 +452,7 @@ export class DashboardMigrator {
}
}
- upgradeToGridLayout(old) {
+ upgradeToGridLayout(old: any) {
let yPos = 0;
const widthFactor = GRID_COLUMN_COUNT / 12;
@@ -541,7 +541,7 @@ export class DashboardMigrator {
}
}
-function getGridHeight(height) {
+function getGridHeight(height: number | string) {
if (_.isString(height)) {
height = parseInt(height.replace('px', ''), 10);
}
@@ -569,7 +569,7 @@ class RowArea {
yPos: 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.yPos = rowYPos;
this.height = height;
@@ -582,7 +582,7 @@ class RowArea {
/**
* Update area after adding the panel.
*/
- addPanel(gridPos) {
+ addPanel(gridPos: any) {
for (let i = gridPos.x; i < gridPos.x + gridPos.w; i++) {
if (!this.area[i] || gridPos.y + gridPos.h - this.yPos > this.area[i]) {
this.area[i] = gridPos.y + gridPos.h - this.yPos;
@@ -594,7 +594,7 @@ class RowArea {
/**
* 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 place;
for (let i = this.area.length - 1; i >= 0; i--) {
diff --git a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts
index 723cf1f9d16..7401b5d024b 100644
--- a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts
+++ b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts
@@ -5,7 +5,7 @@ import { expect } from 'test/lib/common';
jest.mock('app/core/services/context_srv', () => ({}));
describe('given dashboard with panel repeat', () => {
- let dashboard;
+ let dashboard: DashboardModel;
beforeEach(() => {
const dashboardJSON = {
@@ -56,7 +56,7 @@ describe('given dashboard with panel repeat', () => {
});
describe('given dashboard with panel repeat in horizontal direction', () => {
- let dashboard;
+ let dashboard: any;
beforeEach(() => {
dashboard = new DashboardModel({
@@ -188,7 +188,7 @@ describe('given dashboard with panel repeat in horizontal direction', () => {
});
describe('given dashboard with panel repeat in vertical direction', () => {
- let dashboard;
+ let dashboard: any;
beforeEach(() => {
dashboard = new DashboardModel({
@@ -230,7 +230,7 @@ describe('given dashboard with panel repeat in vertical direction', () => {
});
describe('given dashboard with row repeat and panel repeat in horizontal direction', () => {
- let dashboard, dashboardJSON;
+ let dashboard: any, dashboardJSON;
beforeEach(() => {
dashboardJSON = {
@@ -312,7 +312,7 @@ describe('given dashboard with row repeat and panel repeat in horizontal directi
});
describe('given dashboard with row repeat', () => {
- let dashboard, dashboardJSON;
+ let dashboard: any, dashboardJSON: any;
beforeEach(() => {
dashboardJSON = {
@@ -519,7 +519,7 @@ describe('given dashboard with row repeat', () => {
});
describe('given dashboard with row and panel repeat', () => {
- let dashboard, dashboardJSON;
+ let dashboard: any, dashboardJSON: any;
beforeEach(() => {
dashboardJSON = {
diff --git a/public/app/features/dashboard/state/PanelModel.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts
index cad0be87e66..b6e5c7f7586 100644
--- a/public/app/features/dashboard/state/PanelModel.test.ts
+++ b/public/app/features/dashboard/state/PanelModel.test.ts
@@ -5,8 +5,8 @@ class TablePanelCtrl {}
describe('PanelModel', () => {
describe('when creating new panel model', () => {
- let model;
- let modelJson;
+ let model: any;
+ let modelJson: any;
let persistedOptionsMock;
const defaultOptionsMock = {
fieldOptions: {
diff --git a/public/app/features/dashboard/state/PanelQueryState.test.ts b/public/app/features/dashboard/state/PanelQueryState.test.ts
index 230ee40d23a..7896cde9392 100644
--- a/public/app/features/dashboard/state/PanelQueryState.test.ts
+++ b/public/app/features/dashboard/state/PanelQueryState.test.ts
@@ -95,7 +95,7 @@ function makeSeriesStub(refId: string) {
fields: [{ name: 'a' }],
rows: [],
refId,
- };
+ } as any;
}
describe('stream handling', () => {
diff --git a/public/app/features/dashboard/state/PanelQueryState.ts b/public/app/features/dashboard/state/PanelQueryState.ts
index d7d51b09952..cdfa0c83950 100644
--- a/public/app/features/dashboard/state/PanelQueryState.ts
+++ b/public/app/features/dashboard/state/PanelQueryState.ts
@@ -336,7 +336,7 @@ export function toDataQueryError(err: any): DataQueryError {
}
function translateToLegacyData(data: DataQueryResponseData) {
- return data.map(v => {
+ return data.map((v: any) => {
if (isDataFrame(v)) {
return toLegacyResponseData(v);
}
diff --git a/public/app/features/dashboard/state/actions.ts b/public/app/features/dashboard/state/actions.ts
index 7b01975e29d..23828323977 100644
--- a/public/app/features/dashboard/state/actions.ts
+++ b/public/app/features/dashboard/state/actions.ts
@@ -125,7 +125,7 @@ export function addDashboardPermission(dashboardId: number, newItem: NewDashboar
};
}
-export function importDashboard(data, dashboardTitle: string): ThunkResult {
+export function importDashboard(data: any, dashboardTitle: string): ThunkResult {
return async dispatch => {
await getBackendSrv().post('/api/dashboards/import', data);
dispatch(notifyApp(createSuccessNotification('Dashboard Imported', dashboardTitle)));
diff --git a/public/app/features/dashboard/state/initDashboard.test.ts b/public/app/features/dashboard/state/initDashboard.test.ts
index c06d5fb6e65..6497891d926 100644
--- a/public/app/features/dashboard/state/initDashboard.test.ts
+++ b/public/app/features/dashboard/state/initDashboard.test.ts
@@ -87,7 +87,7 @@ function describeInitScenario(description: string, scenarioFn: ScenarioFn) {
setupFn();
const store = mockStore(ctx.storeState);
-
+ // @ts-ignore
await store.dispatch(initDashboard(ctx.args));
ctx.actions = store.getActions();
diff --git a/public/app/features/datasources/DataSourceDashboards.tsx b/public/app/features/datasources/DataSourceDashboards.tsx
index f211deb5a09..cbbb063d589 100644
--- a/public/app/features/datasources/DataSourceDashboards.tsx
+++ b/public/app/features/datasources/DataSourceDashboards.tsx
@@ -42,10 +42,10 @@ export class DataSourceDashboards extends PureComponent {
onImport = (dashboard: PluginDashboard, overwrite: boolean) => {
const { dataSource, importDashboard } = this.props;
- const data = {
+ const data: any = {
pluginId: dashboard.pluginId,
path: dashboard.path,
- overwrite: overwrite,
+ overwrite,
inputs: [],
};
diff --git a/public/app/features/datasources/__mocks__/dataSourcesMocks.ts b/public/app/features/datasources/__mocks__/dataSourcesMocks.ts
index dbeb14045c7..f44521a1a98 100644
--- a/public/app/features/datasources/__mocks__/dataSourcesMocks.ts
+++ b/public/app/features/datasources/__mocks__/dataSourcesMocks.ts
@@ -1,6 +1,6 @@
import { DataSourceSettings } from '@grafana/ui';
-export const getMockDataSources = (amount: number): DataSourceSettings[] => {
+export const getMockDataSources = (amount: number) => {
const dataSources = [];
for (let i = 0; i <= amount; i++) {
@@ -22,7 +22,7 @@ export const getMockDataSources = (amount: number): DataSourceSettings[] => {
});
}
- return dataSources;
+ return dataSources as DataSourceSettings[];
};
export const getMockDataSource = (): DataSourceSettings => {
diff --git a/public/app/features/datasources/state/selectors.ts b/public/app/features/datasources/state/selectors.ts
index dffd242a895..3a117ec7b1a 100644
--- a/public/app/features/datasources/state/selectors.ts
+++ b/public/app/features/datasources/state/selectors.ts
@@ -1,29 +1,31 @@
import { DataSourceSettings, DataSourcePluginMeta } from '@grafana/ui';
+import { DataSourcesState } from '../../../types/datasources';
+import { UrlQueryValue } from '@grafana/runtime';
-export const getDataSources = state => {
+export const getDataSources = (state: DataSourcesState) => {
const regex = new RegExp(state.searchQuery, 'i');
- return state.dataSources.filter(dataSource => {
+ return state.dataSources.filter((dataSource: DataSourceSettings) => {
return regex.test(dataSource.name) || regex.test(dataSource.database);
});
};
-export const getDataSourceTypes = state => {
+export const getDataSourceTypes = (state: DataSourcesState) => {
const regex = new RegExp(state.dataSourceTypeSearchQuery, 'i');
- return state.dataSourceTypes.filter(type => {
+ return state.dataSourceTypes.filter((type: DataSourcePluginMeta) => {
return regex.test(type.name);
});
};
-export const getDataSource = (state, dataSourceId): DataSourceSettings | null => {
- if (state.dataSource.id === parseInt(dataSourceId, 10)) {
+export const getDataSource = (state: DataSourcesState, dataSourceId: UrlQueryValue): DataSourceSettings | null => {
+ if (state.dataSource.id === parseInt(dataSourceId as string, 10)) {
return state.dataSource;
}
return {} as DataSourceSettings;
};
-export const getDataSourceMeta = (state, type): DataSourcePluginMeta => {
+export const getDataSourceMeta = (state: DataSourcesState, type: string): DataSourcePluginMeta => {
if (state.dataSourceMeta.id === type) {
return state.dataSourceMeta;
}
@@ -31,6 +33,6 @@ export const getDataSourceMeta = (state, type): DataSourcePluginMeta => {
return {} as DataSourcePluginMeta;
};
-export const getDataSourcesSearchQuery = state => state.searchQuery;
-export const getDataSourcesLayoutMode = state => state.layoutMode;
-export const getDataSourcesCount = state => state.dataSourcesCount;
+export const getDataSourcesSearchQuery = (state: DataSourcesState) => state.searchQuery;
+export const getDataSourcesLayoutMode = (state: DataSourcesState) => state.layoutMode;
+export const getDataSourcesCount = (state: DataSourcesState) => state.dataSourcesCount;
diff --git a/public/app/features/explore/AdHocFilterField.tsx b/public/app/features/explore/AdHocFilterField.tsx
index df7fe5c8932..a42c21ed91e 100644
--- a/public/app/features/explore/AdHocFilterField.tsx
+++ b/public/app/features/explore/AdHocFilterField.tsx
@@ -36,7 +36,7 @@ export class AdHocFilterField<
componentDidUpdate(prevProps: Props) {
if (_.isEqual(prevProps.extendedOptions, this.props.extendedOptions) === false) {
- const pairs = [];
+ const pairs: any[] = [];
this.setState({ pairs }, () => this.props.onPairsChanged(pairs));
}
diff --git a/public/app/features/explore/ErrorBoundary.tsx b/public/app/features/explore/ErrorBoundary.tsx
index 959d15eea80..f80c9b06b8d 100644
--- a/public/app/features/explore/ErrorBoundary.tsx
+++ b/public/app/features/explore/ErrorBoundary.tsx
@@ -1,16 +1,16 @@
import React, { Component } from 'react';
export default class ErrorBoundary extends Component<{}, any> {
- constructor(props) {
+ constructor(props: {}) {
super(props);
this.state = { error: null, errorInfo: null };
}
- componentDidCatch(error, errorInfo) {
+ componentDidCatch(error: any, errorInfo: any) {
// Catch errors in any components below and re-render with error message
this.setState({
- error: error,
- errorInfo: errorInfo,
+ error,
+ errorInfo,
});
}
diff --git a/public/app/features/explore/ExploreToolbar.tsx b/public/app/features/explore/ExploreToolbar.tsx
index 1e39e29e99a..2669f203d4c 100644
--- a/public/app/features/explore/ExploreToolbar.tsx
+++ b/public/app/features/explore/ExploreToolbar.tsx
@@ -90,7 +90,7 @@ export class UnConnectedExploreToolbar extends PureComponent {
super(props);
}
- onChangeDatasource = async option => {
+ onChangeDatasource = async (option: { value: any }) => {
this.props.changeDatasource(this.props.exploreId, option.value);
};
diff --git a/public/app/features/explore/Graph.tsx b/public/app/features/explore/Graph.tsx
index 9bb10a41033..2d3695fc0ec 100644
--- a/public/app/features/explore/Graph.tsx
+++ b/public/app/features/explore/Graph.tsx
@@ -14,7 +14,7 @@ import TimeSeries from 'app/core/time_series2';
const MAX_NUMBER_OF_TIME_SERIES = 20;
// Copied from graph.ts
-function time_format(ticks, min, max) {
+function time_format(ticks: number, min: number, max: number) {
if (min && max && ticks) {
const range = max - min;
const secPerTick = range / ticks / 1000;
@@ -39,7 +39,7 @@ function time_format(ticks, min, max) {
return '%H:%M';
}
-const FLOT_OPTIONS = {
+const FLOT_OPTIONS: any = {
legend: {
show: false,
},
@@ -94,9 +94,9 @@ interface GraphState {
export class Graph extends PureComponent {
$el: any;
- dynamicOptions = null;
+ dynamicOptions: any = null;
- state = {
+ state: GraphState = {
hiddenSeries: [],
showAllTimeSeries: false,
};
@@ -130,7 +130,7 @@ export class Graph extends PureComponent {
this.$el.unbind('plotselected', this.onPlotSelected);
}
- onPlotSelected = (event: JQueryEventObject, ranges) => {
+ onPlotSelected = (event: JQueryEventObject, ranges: { xaxis: { from: number; to: number } }) => {
const { onChangeTime } = this.props;
if (onChangeTime) {
this.props.onChangeTime({
diff --git a/public/app/features/explore/GraphContainer.tsx b/public/app/features/explore/GraphContainer.tsx
index 773111e9fee..1a08f08734d 100644
--- a/public/app/features/explore/GraphContainer.tsx
+++ b/public/app/features/explore/GraphContainer.tsx
@@ -69,9 +69,10 @@ export class GraphContainer extends PureComponent {
}
}
-function mapStateToProps(state: StoreState, { exploreId }) {
+function mapStateToProps(state: StoreState, { exploreId }: { exploreId: string }) {
const explore = state.explore;
const { split } = explore;
+ // @ts-ignore
const item: ExploreItemState = explore[exploreId];
const { graphResult, loadingState, showingGraph, showingTable, absoluteRange } = item;
const loading = loadingState === LoadingState.Loading || loadingState === LoadingState.Streaming;
diff --git a/public/app/features/explore/JSONViewer.tsx b/public/app/features/explore/JSONViewer.tsx
index d0dbad78169..d185babfa6a 100644
--- a/public/app/features/explore/JSONViewer.tsx
+++ b/public/app/features/explore/JSONViewer.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-export default function({ value }) {
+export default function({ value }: any) {
return (
{JSON.stringify(value, undefined, 2)}
diff --git a/public/app/features/explore/LogLabel.tsx b/public/app/features/explore/LogLabel.tsx
index ac6274b531b..937a7e3f5bc 100644
--- a/public/app/features/explore/LogLabel.tsx
+++ b/public/app/features/explore/LogLabel.tsx
@@ -18,7 +18,7 @@ interface State {
}
export class LogLabel extends PureComponent
{
- state = {
+ state: State = {
stats: null,
showStats: false,
};
diff --git a/public/app/features/explore/LogMessageAnsi.tsx b/public/app/features/explore/LogMessageAnsi.tsx
index 72e15bc38f8..552f6202c8c 100644
--- a/public/app/features/explore/LogMessageAnsi.tsx
+++ b/public/app/features/explore/LogMessageAnsi.tsx
@@ -16,6 +16,7 @@ function convertCSSToStyle(css: string): Style {
if (match && match[1] && match[2]) {
const key = match[1].replace(/-(a-z)/g, (_, character) => character.toUpperCase());
+ // @ts-ignore
accumulated[key] = match[2];
}
@@ -33,7 +34,7 @@ interface State {
}
export class LogMessageAnsi extends PureComponent {
- state = {
+ state: State = {
chunks: [],
prevValue: '',
};
diff --git a/public/app/features/explore/Logs.tsx b/public/app/features/explore/Logs.tsx
index ee79f4796d7..f3637b8b039 100644
--- a/public/app/features/explore/Logs.tsx
+++ b/public/app/features/explore/Logs.tsx
@@ -136,7 +136,7 @@ export default class Logs extends PureComponent {
};
onToggleLogLevel = (rawLevel: string, hiddenRawLevels: string[]) => {
- const hiddenLogLevels: LogLevel[] = hiddenRawLevels.map(level => LogLevel[level]);
+ const hiddenLogLevels: LogLevel[] = hiddenRawLevels.map((level: LogLevel) => LogLevel[level]);
this.props.onToggleLogLevel(hiddenLogLevels);
};
@@ -217,12 +217,13 @@ export default class Logs extends PureComponent {
- {Object.keys(LogsDedupStrategy).map((dedupType, i) => (
+ {Object.keys(LogsDedupStrategy).map((dedupType: string, i) => (
{dedupType}
diff --git a/public/app/features/explore/LogsContainer.tsx b/public/app/features/explore/LogsContainer.tsx
index ece5f6d65a7..3bb2e1373cf 100644
--- a/public/app/features/explore/LogsContainer.tsx
+++ b/public/app/features/explore/LogsContainer.tsx
@@ -77,7 +77,7 @@ export class LogsContainer extends PureComponent {
});
};
- getLogRowContext = async (row: LogRowModel, options?: any) => {
+ getLogRowContext = async (row: LogRowModel, options?: any): Promise => {
const { datasourceInstance } = this.props;
if (datasourceInstance) {
@@ -142,8 +142,9 @@ export class LogsContainer extends PureComponent {
}
}
-function mapStateToProps(state: StoreState, { exploreId }) {
+function mapStateToProps(state: StoreState, { exploreId }: { exploreId: string }) {
const explore = state.explore;
+ // @ts-ignore
const item: ExploreItemState = explore[exploreId];
const {
logsHighlighterExpressions,
diff --git a/public/app/features/explore/QueryRow.tsx b/public/app/features/explore/QueryRow.tsx
index 7dc1b3bcd42..a7cd73c6fa9 100644
--- a/public/app/features/explore/QueryRow.tsx
+++ b/public/app/features/explore/QueryRow.tsx
@@ -140,6 +140,7 @@ export class QueryRow extends PureComponent {
{QueryField ? (
+ //@ts-ignore
void;
}
-function prepareRows(rows, columnNames) {
+function prepareRows(rows: any[], columnNames: string[]) {
return rows.map(cells => _.zipObject(columnNames, cells));
}
export default class Table extends PureComponent {
- getCellProps = (state, rowInfo, column) => {
+ getCellProps = (state: any, rowInfo: RowInfo, column: any) => {
return {
onClick: (e: React.SyntheticEvent) => {
// Only handle click on link, not the cell
@@ -44,7 +44,7 @@ export default class Table extends PureComponent {
accessor: text,
className: VALUE_REGEX.test(text) ? 'text-right' : '',
show: text !== 'Time',
- Cell: row => (
+ Cell: (row: any) => (
{row.value}
diff --git a/public/app/features/explore/TableContainer.tsx b/public/app/features/explore/TableContainer.tsx
index 239a65fa3be..2927e4ea21b 100644
--- a/public/app/features/explore/TableContainer.tsx
+++ b/public/app/features/explore/TableContainer.tsx
@@ -36,8 +36,9 @@ export class TableContainer extends PureComponent {
}
}
-function mapStateToProps(state: StoreState, { exploreId }) {
+function mapStateToProps(state: StoreState, { exploreId }: { exploreId: string }) {
const explore = state.explore;
+ // @ts-ignore
const item: ExploreItemState = explore[exploreId];
const { loadingState, showingTable, tableResult } = item;
const loading =
diff --git a/public/app/features/explore/slate-plugins/braces.test.ts b/public/app/features/explore/slate-plugins/braces.test.ts
index 410334d020f..c9285da9255 100644
--- a/public/app/features/explore/slate-plugins/braces.test.ts
+++ b/public/app/features/explore/slate-plugins/braces.test.ts
@@ -1,3 +1,4 @@
+// @ts-ignore
import Plain from 'slate-plain-serializer';
import BracesPlugin from './braces';
diff --git a/public/app/features/explore/slate-plugins/braces.ts b/public/app/features/explore/slate-plugins/braces.ts
index f3a76263ad6..4fef2212395 100644
--- a/public/app/features/explore/slate-plugins/braces.ts
+++ b/public/app/features/explore/slate-plugins/braces.ts
@@ -1,4 +1,4 @@
-const BRACES = {
+const BRACES: any = {
'[': ']',
'{': '}',
'(': ')',
@@ -8,7 +8,7 @@ const NON_SELECTOR_SPACE_REGEXP = / (?![^}]+})/;
export default function BracesPlugin() {
return {
- onKeyDown(event, change) {
+ onKeyDown(event: any, change: { value?: any; insertText?: any; deleteBackward?: any }) {
const { value } = change;
if (!value.isCollapsed) {
return undefined;
diff --git a/public/app/features/explore/slate-plugins/clear.test.ts b/public/app/features/explore/slate-plugins/clear.test.ts
index 28ba371df14..9322fffd7d2 100644
--- a/public/app/features/explore/slate-plugins/clear.test.ts
+++ b/public/app/features/explore/slate-plugins/clear.test.ts
@@ -1,3 +1,4 @@
+// @ts-ignore
import Plain from 'slate-plain-serializer';
import ClearPlugin from './clear';
diff --git a/public/app/features/explore/slate-plugins/clear.ts b/public/app/features/explore/slate-plugins/clear.ts
index 5e2789bf544..9d649aa6926 100644
--- a/public/app/features/explore/slate-plugins/clear.ts
+++ b/public/app/features/explore/slate-plugins/clear.ts
@@ -1,7 +1,7 @@
// Clears the rest of the line after the caret
export default function ClearPlugin() {
return {
- onKeyDown(event, change) {
+ onKeyDown(event: any, change: { value?: any; deleteForward?: any }) {
const { value } = change;
if (!value.isCollapsed) {
return undefined;
diff --git a/public/app/features/explore/slate-plugins/newline.ts b/public/app/features/explore/slate-plugins/newline.ts
index cae8af3acb0..a0634649271 100644
--- a/public/app/features/explore/slate-plugins/newline.ts
+++ b/public/app/features/explore/slate-plugins/newline.ts
@@ -1,4 +1,4 @@
-function getIndent(text) {
+function getIndent(text: any) {
let offset = text.length - text.trimLeft().length;
if (offset) {
let indent = text[0];
@@ -12,7 +12,7 @@ function getIndent(text) {
export default function NewlinePlugin() {
return {
- onKeyDown(event, change) {
+ onKeyDown(event: any, change: { value?: any; splitBlock?: any }) {
const { value } = change;
if (!value.isCollapsed) {
return undefined;
diff --git a/public/app/features/explore/slate-plugins/prism/index.tsx b/public/app/features/explore/slate-plugins/prism/index.tsx
index 7c1b2f86139..b7904e981f8 100644
--- a/public/app/features/explore/slate-plugins/prism/index.tsx
+++ b/public/app/features/explore/slate-plugins/prism/index.tsx
@@ -3,7 +3,7 @@ import Prism from 'prismjs';
const TOKEN_MARK = 'prism-token';
-export function setPrismTokens(language, field, values, alias = 'variable') {
+export function setPrismTokens(language: string, field: string | number, values: any, alias = 'variable') {
Prism.languages[language][field] = {
alias,
pattern: new RegExp(`(?:^|\\s)(${values.join('|')})(?:$|\\s)`),
@@ -17,7 +17,7 @@ export function setPrismTokens(language, field, values, alias = 'variable') {
* (Adapted to handle nested grammar definitions.)
*/
-export default function PrismPlugin({ definition, language }) {
+export default function PrismPlugin({ definition, language }: { definition: any; language: string }) {
if (definition) {
// Don't override exising modified definitions
Prism.languages[language] = Prism.languages[language] || definition;
@@ -31,7 +31,7 @@ export default function PrismPlugin({ definition, language }) {
* @return {Element}
*/
- renderMark(props) {
+ renderMark(props: any): JSX.Element {
const { children, mark } = props;
// Only apply spans to marks identified by this plugin
if (mark.type !== TOKEN_MARK) {
@@ -48,13 +48,13 @@ export default function PrismPlugin({ definition, language }) {
* @return {Array}
*/
- decorateNode(node) {
+ decorateNode(node: any): any[] {
if (node.type !== 'paragraph') {
return [];
}
const texts = node.getTexts().toArray();
- const tstring = texts.map(t => t.text).join('\n');
+ const tstring = texts.map((t: { text: any }) => t.text).join('\n');
const grammar = Prism.languages[language];
const tokens = Prism.tokenize(tstring, grammar);
const decorations: any[] = [];
@@ -64,7 +64,7 @@ export default function PrismPlugin({ definition, language }) {
let endOffset = 0;
let start = 0;
- function processToken(token, acc?) {
+ function processToken(token: any, acc?: string) {
// Accumulate token types down the tree
const types = `${acc || ''} ${token.type || ''} ${token.alias || ''}`;
diff --git a/public/app/features/explore/slate-plugins/runner.ts b/public/app/features/explore/slate-plugins/runner.ts
index 44b5943c4a2..fc7b8a778ed 100644
--- a/public/app/features/explore/slate-plugins/runner.ts
+++ b/public/app/features/explore/slate-plugins/runner.ts
@@ -1,6 +1,6 @@
-export default function RunnerPlugin({ handler }) {
+export default function RunnerPlugin({ handler }: any) {
return {
- onKeyDown(event) {
+ onKeyDown(event: any) {
// Handle enter
if (handler && event.key === 'Enter' && !event.shiftKey) {
// Submit on Enter
diff --git a/public/app/features/explore/state/epics/processQueryResultsEpic.test.ts b/public/app/features/explore/state/epics/processQueryResultsEpic.test.ts
index f5623817875..86b0bdced4d 100644
--- a/public/app/features/explore/state/epics/processQueryResultsEpic.test.ts
+++ b/public/app/features/explore/state/epics/processQueryResultsEpic.test.ts
@@ -41,9 +41,9 @@ describe('processQueryResultsEpic', () => {
it('then resetQueryErrorAction and querySuccessAction are dispatched and eventBridge emits correct message', () => {
const { datasourceId, exploreId, state, eventBridge } = mockExploreState();
const { latency, series, loadingState } = testContext();
- const graphResult = [];
+ const graphResult: any[] = [];
const tableResult = new TableModel();
- const logsResult = null;
+ const logsResult: any = null;
epicTester(processQueryResultsEpic, state)
.whenActionIsDispatched(
@@ -64,9 +64,9 @@ describe('processQueryResultsEpic', () => {
it('then correct actions are dispatched', () => {
const { datasourceId, exploreId, state } = mockExploreState({ scanning: true });
const { latency, series, loadingState } = testContext();
- const graphResult = [];
+ const graphResult: any[] = [];
const tableResult = new TableModel();
- const logsResult = null;
+ const logsResult: any = null;
epicTester(processQueryResultsEpic, state)
.whenActionIsDispatched(
@@ -84,9 +84,9 @@ describe('processQueryResultsEpic', () => {
it('then correct actions are dispatched', () => {
const { datasourceId, exploreId, state } = mockExploreState({ scanning: true });
const { latency, loadingState } = testContext();
- const graphResult = [];
+ const graphResult: any[] = [];
const tableResult = new TableModel();
- const logsResult = null;
+ const logsResult: any = null;
epicTester(processQueryResultsEpic, state)
.whenActionIsDispatched(
diff --git a/public/app/features/explore/state/epics/runQueriesBatchEpic.test.ts b/public/app/features/explore/state/epics/runQueriesBatchEpic.test.ts
index 65c1aae20f6..d0a71ca84f8 100644
--- a/public/app/features/explore/state/epics/runQueriesBatchEpic.test.ts
+++ b/public/app/features/explore/state/epics/runQueriesBatchEpic.test.ts
@@ -106,12 +106,12 @@ describe('runQueriesBatchEpic', () => {
it('then correct actions are dispatched', () => {
const { exploreId, state, datasourceId } = mockExploreState();
const unsubscribe = jest.fn();
- const serieA = {
+ const serieA: any = {
fields: [],
rows: [],
refId: 'A',
};
- const serieB = {
+ const serieB: any = {
fields: [],
rows: [],
refId: 'B',
@@ -171,12 +171,12 @@ describe('runQueriesBatchEpic', () => {
it('then correct actions are dispatched', () => {
const { exploreId, state, datasourceId, history } = mockExploreState();
const unsubscribe = jest.fn();
- const serieA = {
+ const serieA: any = {
fields: [],
rows: [],
refId: 'A',
};
- const serieB = {
+ const serieB: any = {
fields: [],
rows: [],
refId: 'B',
diff --git a/public/app/features/explore/state/epics/runQueriesEpic.test.ts b/public/app/features/explore/state/epics/runQueriesEpic.test.ts
index 2d0d305150c..1006ac5b9ad 100644
--- a/public/app/features/explore/state/epics/runQueriesEpic.test.ts
+++ b/public/app/features/explore/state/epics/runQueriesEpic.test.ts
@@ -46,7 +46,7 @@ describe('runQueriesEpic', () => {
describe('and we have no queries', () => {
it('then clearQueriesAction and stateSaveAction are dispatched', () => {
- const queries = [];
+ const queries: any[] = [];
const { exploreId, state } = mockExploreState({ queries });
epicTester(runQueriesEpic, state)
diff --git a/public/app/features/explore/state/epics/timeEpic.ts b/public/app/features/explore/state/epics/timeEpic.ts
index 0d066319d7b..013d58e4388 100644
--- a/public/app/features/explore/state/epics/timeEpic.ts
+++ b/public/app/features/explore/state/epics/timeEpic.ts
@@ -37,7 +37,7 @@ export const timeEpic: Epic, ActionOf, StoreState> = (
time: range.raw,
refresh: false,
getTimezone: () => timeZone.raw,
- timeRangeUpdated: () => undefined,
+ timeRangeUpdated: (): any => undefined,
});
return changeRangeAction({ exploreId, range, absoluteRange });
diff --git a/public/app/features/explore/state/reducers.test.ts b/public/app/features/explore/state/reducers.test.ts
index 58125ea0a88..4cd976b53f5 100644
--- a/public/app/features/explore/state/reducers.test.ts
+++ b/public/app/features/explore/state/reducers.test.ts
@@ -146,7 +146,7 @@ describe('Explore item reducer', () => {
queries,
queryKeys,
};
- const expectedState = {
+ const expectedState: any = {
datasourceInstance,
StartPage,
showingStartPage: true,
@@ -175,7 +175,7 @@ describe('Explore item reducer', () => {
showingStartPage: true,
range: null,
};
- const expectedState = {
+ const expectedState: any = {
queryIntervals: {
interval: '1s',
intervalMs: 1000,
diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts
index 09a2a2f4617..4eb0c203151 100644
--- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts
+++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts
@@ -332,7 +332,7 @@ export default class AzureMonitorDatasource {
this.apiPreviewVersion
);
- return this.doRequest(url).then(result => {
+ return this.doRequest(url).then((result: any) => {
return ResponseParser.parseResponseValues(result, 'name', 'properties.metricNamespaceName');
});
}
diff --git a/scripts/ci-frontend-metrics.sh b/scripts/ci-frontend-metrics.sh
index 63370f50bab..6cc0d9bc849 100755
--- a/scripts/ci-frontend-metrics.sh
+++ b/scripts/ci-frontend-metrics.sh
@@ -3,7 +3,7 @@
echo -e "Collecting code stats (typescript errors & more)"
-ERROR_COUNT_LIMIT=1670
+ERROR_COUNT_LIMIT=800
DIRECTIVES_LIMIT=172
CONTROLLERS_LIMIT=139
diff --git a/yarn.lock b/yarn.lock
index 735f2141658..85c780f35ca 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2974,6 +2974,11 @@
"@types/express-serve-static-core" "*"
"@types/serve-static" "*"
+"@types/file-saver@^2.0.1":
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/@types/file-saver/-/file-saver-2.0.1.tgz#e18eb8b069e442f7b956d313f4fadd3ef887354e"
+ integrity sha512-g1QUuhYVVAamfCifK7oB7G3aIl4BbOyzDOqVyUfEr4tfBKrXfeH+M+Tg7HKCXSrbzxYdhyCP7z9WbKo0R2hBCw==
+
"@types/geojson@*":
version "7946.0.7"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.7.tgz#c8fa532b60a0042219cdf173ca21a975ef0666ad"
@@ -3218,9 +3223,10 @@
dependencies:
"@types/react" "*"
-"@types/react-redux@^7.0.8":
+"@types/react-redux@7.0.8":
version "7.0.8"
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.0.8.tgz#c928863058e334d41031c6bedd0f113bc514e234"
+ integrity sha512-vIBC15E84ehN6RzdGwRVa41whp9e4CkfPm+WfD0r6y6vqBf4tQPKZeKEBfLLM8k79uSwQC7rh3rH/MFaN1IESQ==
dependencies:
"@types/hoist-non-react-statics" "^3.3.0"
"@types/react" "*"
@@ -3234,6 +3240,13 @@
"@types/react-dom" "*"
"@types/react-transition-group" "*"
+"@types/react-table@6.8.5":
+ version "6.8.5"
+ resolved "https://registry.yarnpkg.com/@types/react-table/-/react-table-6.8.5.tgz#deb2bf2fcedcfb81e9020edbb7df0d8459ca348b"
+ integrity sha512-ueCsAadG1IwuuAZM+MWf2SoxbccSWweyQa9YG6xGN5cOVK3SayPOJW4MsUHGpY0V/Q+iZWgohpasliiao29O6g==
+ dependencies:
+ "@types/react" "*"
+
"@types/react-test-renderer@16.8.1":
version "16.8.1"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.8.1.tgz#96f3ce45a3a41c94eca532a99103dd3042c9d055"
@@ -3286,6 +3299,13 @@
dependencies:
redux "^3.6.0"
+"@types/redux-mock-store@1.0.1":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@types/redux-mock-store/-/redux-mock-store-1.0.1.tgz#90ca701d640aef7c007f564a9a4f8dc03180b0f7"
+ integrity sha512-1egEnh2/+sRRKImnCo5EMVm0Uxu4fBHeLHk/inhSp/VpE93It8lk3gYeNfehUgXd6OzqP5LLA9kzO9x7o3WfwA==
+ dependencies:
+ redux "^4.0.0"
+
"@types/relateurl@*":
version "0.2.28"
resolved "https://registry.yarnpkg.com/@types/relateurl/-/relateurl-0.2.28.tgz#6bda7db8653fa62643f5ee69e9f69c11a392e3a6"