From 7eabc282e905e1c7a554614f13478db49033d76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=A4ggmark?= Date: Mon, 15 Apr 2019 12:11:52 +0200 Subject: [PATCH] Chore: Adds typings to lodash (#16590) --- package.json | 1 + packages/grafana-ui/src/types/data.ts | 3 ++- public/app/app.ts | 1 + .../components/form_dropdown/form_dropdown.ts | 8 +++---- .../manage_dashboards/manage_dashboards.ts | 7 +++---- .../query_part/query_part_editor.ts | 2 +- .../components/sidemenu/BottomSection.tsx | 6 +++--- .../components/sql_part/sql_part_editor.ts | 2 +- public/app/core/directives/array_join.ts | 2 +- public/app/core/directives/metric_segment.ts | 6 +++--- public/app/core/nav_model_srv.ts | 2 +- public/app/core/services/backend_srv.ts | 1 - public/app/core/services/search_srv.ts | 3 +-- public/app/core/specs/rangeutil.test.ts | 2 +- public/app/core/utils/reselect.ts | 2 +- .../app/features/admin/AdminEditUserCtrl.ts | 2 +- public/app/features/alerting/AlertTabCtrl.ts | 8 +++---- .../features/annotations/annotations_srv.ts | 4 ++-- .../app/features/annotations/editor_ctrl.ts | 1 + .../features/annotations/events_processing.ts | 4 ++-- .../AddPanelWidget/AddPanelWidget.tsx | 2 +- .../DashExportModal/DashboardExporter.test.ts | 21 +++++++++---------- .../DashExportModal/DashboardExporter.ts | 1 - .../DashLinks/DashLinksEditorCtrl.ts | 1 + .../DashboardSettings/SettingsCtrl.ts | 4 ++-- .../ShareModal/ShareSnapshotCtrl.ts | 2 +- .../dashboard/panel_editor/QueriesTab.tsx | 1 + .../dashboard/services/ChangeTracker.ts | 4 ++-- .../dashboard/state/DashboardMigrator.ts | 2 +- .../dashboard/state/DashboardModel.test.ts | 1 - .../dashboard/state/DashboardModel.ts | 7 +++---- public/app/features/explore/Explore.tsx | 1 - public/app/features/explore/QueryField.tsx | 1 - public/app/features/explore/QueryRow.tsx | 1 - public/app/features/explore/TimePicker.tsx | 2 +- public/app/features/explore/Typeahead.tsx | 1 - public/app/features/explore/state/actions.ts | 14 +++++++------ public/app/features/explore/state/reducers.ts | 1 - .../app/features/panel/panellinks/module.ts | 2 +- .../app/features/plugins/plugin_edit_ctrl.ts | 2 +- public/app/features/plugins/state/navModel.ts | 2 +- public/app/features/templating/editor_ctrl.ts | 4 ++-- .../app/features/templating/template_srv.ts | 2 +- .../app/features/templating/variable_srv.ts | 12 +++++------ .../datasource/cloudwatch/datasource.ts | 4 ++-- .../datasource/elasticsearch/config_ctrl.ts | 2 +- .../datasource/elasticsearch/datasource.ts | 2 +- .../elasticsearch/elastic_response.ts | 10 ++++----- .../datasource/elasticsearch/metric_agg.ts | 2 +- .../datasource/elasticsearch/query_ctrl.ts | 6 +++--- .../datasource/elasticsearch/query_def.ts | 8 +++---- .../app_insights/response_parser.ts | 2 +- .../azure_log_analytics/response_parser.ts | 2 +- .../azure_monitor/response_parser.ts | 2 +- .../editor/query_field.tsx | 2 +- .../datasource/graphite/add_graphite_func.ts | 2 +- .../datasource/graphite/func_editor.ts | 8 +++---- .../datasource/graphite/graphite_query.ts | 5 +++-- .../plugins/datasource/graphite/query_ctrl.ts | 2 +- .../datasource/influxdb/influx_series.ts | 2 +- .../datasource/influxdb/response_parser.ts | 2 ++ .../datasource/loki/language_provider.ts | 1 - .../plugins/datasource/mixed/datasource.ts | 2 +- .../plugins/datasource/mssql/query_ctrl.ts | 2 +- .../plugins/datasource/mysql/mysql_query.ts | 6 +++--- .../plugins/datasource/mysql/query_ctrl.ts | 2 +- .../plugins/datasource/opentsdb/datasource.ts | 6 +++--- .../datasource/postgres/postgres_query.ts | 8 +++---- .../plugins/datasource/postgres/query_ctrl.ts | 2 +- .../prometheus/components/PromQueryField.tsx | 1 - .../prometheus/language_provider.ts | 1 - .../prometheus/specs/datasource.test.ts | 2 +- .../stackdriver/StackdriverMetricFindQuery.ts | 2 +- .../components/VariableQueryEditor.tsx | 2 +- .../datasource/testdata/QueryEditor.tsx | 2 +- .../app/plugins/datasource/testdata/types.ts | 2 ++ .../app/plugins/panel/graph/Legend/Legend.tsx | 4 ++-- .../app/plugins/panel/graph/data_processor.ts | 2 +- public/app/plugins/panel/graph/graph.ts | 1 + public/app/plugins/panel/graph/module.ts | 2 +- .../app/plugins/panel/heatmap/color_legend.ts | 4 ++-- .../panel/heatmap/heatmap_data_converter.ts | 2 +- .../plugins/panel/heatmap/heatmap_tooltip.ts | 4 ++-- public/app/plugins/panel/heatmap/rendering.ts | 2 +- public/app/plugins/panel/table/editor.ts | 2 +- public/app/plugins/panel/table/renderer.ts | 2 +- .../app/plugins/panel/table/transformers.ts | 2 +- yarn.lock | 5 +++++ 88 files changed, 149 insertions(+), 145 deletions(-) diff --git a/package.json b/package.json index 8e58fc7e4c8..b3988b0d294 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@types/inquirer": "^0.0.43", "@types/jest": "^24.0.11", "@types/jquery": "^1.10.35", + "@types/lodash": "4.14.123", "@types/node": "^8.0.31", "@types/papaparse": "^4.5.9", "@types/react": "^16.8.8", diff --git a/packages/grafana-ui/src/types/data.ts b/packages/grafana-ui/src/types/data.ts index a251398b981..2485fb0b652 100644 --- a/packages/grafana-ui/src/types/data.ts +++ b/packages/grafana-ui/src/types/data.ts @@ -72,6 +72,7 @@ export enum NullValueMode { } export interface AnnotationEvent { + id?: string; annotation?: any; dashboardId?: number; panelId?: number; @@ -82,5 +83,5 @@ export interface AnnotationEvent { title?: string; text?: string; type?: string; - tags?: string; + tags?: string[]; } diff --git a/public/app/app.ts b/public/app/app.ts index 7e898e52339..c72d17bbf5a 100644 --- a/public/app/app.ts +++ b/public/app/app.ts @@ -24,6 +24,7 @@ import { addClassIfNoOverlayScrollbar } from 'app/core/utils/scrollbar'; import { importPluginModule } from 'app/features/plugins/plugin_loader'; // add move to lodash for backward compatabiltiy +// @ts-ignore _.move = (array: [], fromIndex: number, toIndex: number) => { array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]); return array; diff --git a/public/app/core/components/form_dropdown/form_dropdown.ts b/public/app/core/components/form_dropdown/form_dropdown.ts index b0c3e48b835..0e03e6fa560 100644 --- a/public/app/core/components/form_dropdown/form_dropdown.ts +++ b/public/app/core/components/form_dropdown/form_dropdown.ts @@ -120,12 +120,12 @@ export class FormDropdownCtrl { modelChanged() { if (_.isObject(this.model)) { - this.updateDisplay(this.model.text); + this.updateDisplay((this.model as any).text); } else { // if we have text use it if (this.lookupText) { this.getOptionsInternal('').then((options: any) => { - const item = _.find(options, { value: this.model }); + const item: any = _.find(options, { value: this.model }); this.updateDisplay(item ? item.text : this.model); }); } else { @@ -193,7 +193,7 @@ export class FormDropdownCtrl { } this.$scope.$apply(() => { - const option = _.find(this.optionCache, { text: text }); + const option: any = _.find(this.optionCache, { text: text }); if (option) { if (_.isObject(this.model)) { @@ -204,7 +204,7 @@ export class FormDropdownCtrl { this.text = option.text; } else if (this.allowCustom) { if (_.isObject(this.model)) { - this.model.text = this.model.value = text; + (this.model as any).text = (this.model as any).value = text; } else { this.model = text; } diff --git a/public/app/core/components/manage_dashboards/manage_dashboards.ts b/public/app/core/components/manage_dashboards/manage_dashboards.ts index 5b5e299b1af..c57554ec484 100644 --- a/public/app/core/components/manage_dashboards/manage_dashboards.ts +++ b/public/app/core/components/manage_dashboards/manage_dashboards.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import coreModule from 'app/core/core_module'; import appEvents from 'app/core/app_events'; @@ -149,7 +148,7 @@ export class ManageDashboardsCtrl { let selectedDashboards = 0; for (const section of this.sections) { - selectedDashboards += _.filter(section.items, { checked: true }).length; + selectedDashboards += _.filter(section.items, { checked: true } as any).length; } const selectedFolders = _.filter(this.sections, { checked: true }).length; @@ -167,7 +166,7 @@ export class ManageDashboardsCtrl { if (section.checked && section.id !== 0) { selectedDashboards.folderUids.push(section.uid); } else { - const selected = _.filter(section.items, { checked: true }); + const selected = _.filter(section.items, { checked: true } as any); selectedDashboards.dashboardUids.push(..._.map(selected, 'uid')); } } @@ -223,7 +222,7 @@ export class ManageDashboardsCtrl { const selectedDashboards = []; for (const section of this.sections) { - const selected = _.filter(section.items, { checked: true }); + const selected = _.filter(section.items, { checked: true } as any); selectedDashboards.push(..._.map(selected, 'uid')); } diff --git a/public/app/core/components/query_part/query_part_editor.ts b/public/app/core/components/query_part/query_part_editor.ts index 2cab966ed46..4e6b82e151b 100644 --- a/public/app/core/components/query_part/query_part_editor.ts +++ b/public/app/core/components/query_part/query_part_editor.ts @@ -148,7 +148,7 @@ export function queryPartEditorDirective($compile, templateSrv) { }; function addElementsAndCompile() { - _.each(partDef.params, (param, index) => { + _.each(partDef.params, (param: any, index: number) => { if (param.optional && part.params.length <= index) { return; } diff --git a/public/app/core/components/sidemenu/BottomSection.tsx b/public/app/core/components/sidemenu/BottomSection.tsx index ee5175ca763..85754a910fa 100644 --- a/public/app/core/components/sidemenu/BottomSection.tsx +++ b/public/app/core/components/sidemenu/BottomSection.tsx @@ -6,13 +6,13 @@ import { contextSrv } from 'app/core/services/context_srv'; import config from '../../config'; export default function BottomSection() { - const navTree = _.cloneDeep(config.bootData.navTree); - const bottomNav = _.filter(navTree, item => item.hideFromMenu); + const navTree: any = _.cloneDeep(config.bootData.navTree); + const bottomNav: any = _.filter(navTree, item => item.hideFromMenu); const isSignedIn = contextSrv.isSignedIn; const user = contextSrv.user; if (user && user.orgCount > 1) { - const profileNode = _.find(bottomNav, { id: 'profile' }); + const profileNode: any = _.find(bottomNav, { id: 'profile' }); if (profileNode) { profileNode.showOrgSwitcher = true; } diff --git a/public/app/core/components/sql_part/sql_part_editor.ts b/public/app/core/components/sql_part/sql_part_editor.ts index 1d29c577560..b095f5fefed 100644 --- a/public/app/core/components/sql_part/sql_part_editor.ts +++ b/public/app/core/components/sql_part/sql_part_editor.ts @@ -162,7 +162,7 @@ export function sqlPartEditorDirective($compile, templateSrv) { }; function addElementsAndCompile() { - _.each(partDef.params, (param, index) => { + _.each(partDef.params, (param: any, index: number) => { if (param.optional && part.params.length <= index) { return; } diff --git a/public/app/core/directives/array_join.ts b/public/app/core/directives/array_join.ts index c906319e985..137689ab7d2 100644 --- a/public/app/core/directives/array_join.ts +++ b/public/app/core/directives/array_join.ts @@ -14,7 +14,7 @@ export function arrayJoin() { function join_array(text) { if (_.isArray(text)) { - return (text || '').join(','); + return ((text || '') as any).join(','); } else { return text; } diff --git a/public/app/core/directives/metric_segment.ts b/public/app/core/directives/metric_segment.ts index 85576dcffee..03bb8209b54 100644 --- a/public/app/core/directives/metric_segment.ts +++ b/public/app/core/directives/metric_segment.ts @@ -42,7 +42,7 @@ export function metricSegment($compile, $sce, templateSrv) { } $scope.$apply(() => { - const selected = _.find($scope.altSegments, { value: value }); + const selected: any = _.find($scope.altSegments, { value: value }); if (selected) { segment.value = selected.value; segment.html = selected.html || $sce.trustAsHtml(templateSrv.highlightVariablesAsHtml(selected.value)); @@ -202,7 +202,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) { let cachedOptions; $scope.valueToSegment = value => { - const option = _.find($scope.options, { value: value }); + const option: any = _.find($scope.options, { value: value }); const segment = { cssClass: attrs.cssClass, custom: attrs.custom, @@ -236,7 +236,7 @@ export function metricSegmentModel(uiSegmentSrv, $q) { $scope.onSegmentChange = () => { if (cachedOptions) { - const option = _.find(cachedOptions, { text: $scope.segment.value }); + const option: any = _.find(cachedOptions, { text: $scope.segment.value }); if (option && option.value !== $scope.property) { $scope.property = option.value; } else if (attrs.custom !== 'false') { diff --git a/public/app/core/nav_model_srv.ts b/public/app/core/nav_model_srv.ts index 300a7f0e208..661cdbe77a3 100644 --- a/public/app/core/nav_model_srv.ts +++ b/public/app/core/nav_model_srv.ts @@ -48,7 +48,7 @@ export class NavModelSrv { break; } - const node = _.find(children, { id: id }); + const node: any = _.find(children, { id: id }); nav.breadcrumbs.push(node); nav.node = node; nav.main = node; diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index 31db2a4bdee..96e7a2cc258 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import angular from 'angular'; import coreModule from 'app/core/core_module'; diff --git a/public/app/core/services/search_srv.ts b/public/app/core/services/search_srv.ts index 068fe3ffbc3..f5648ef5003 100644 --- a/public/app/core/services/search_srv.ts +++ b/public/app/core/services/search_srv.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; // @ts-ignore import { IQService } from 'angular'; @@ -41,7 +40,7 @@ export class SearchSrv { }); } - private queryForRecentDashboards(): Promise { + private queryForRecentDashboards(): Promise { const dashIds: number[] = _.take(impressionSrv.getDashboardOpened(), 30); if (dashIds.length === 0) { return Promise.resolve([]); diff --git a/public/app/core/specs/rangeutil.test.ts b/public/app/core/specs/rangeutil.test.ts index 4c0d3dc90c8..7c5a74b3ef0 100644 --- a/public/app/core/specs/rangeutil.test.ts +++ b/public/app/core/specs/rangeutil.test.ts @@ -5,7 +5,7 @@ import moment from 'moment'; describe('rangeUtil', () => { describe('Can get range grouped list of ranges', () => { it('when custom settings should return default range list', () => { - const groups = rangeUtil.getRelativeTimesList({ time_options: [] }, 'Last 5 minutes'); + const groups: any = rangeUtil.getRelativeTimesList({ time_options: [] }, 'Last 5 minutes'); expect(_.keys(groups).length).toBe(4); expect(groups[3][0].active).toBe(true); }); diff --git a/public/app/core/utils/reselect.ts b/public/app/core/utils/reselect.ts index 7c8fc7727b0..8c8e3e6f34a 100644 --- a/public/app/core/utils/reselect.ts +++ b/public/app/core/utils/reselect.ts @@ -2,4 +2,4 @@ import { memoize } from 'lodash'; import { createSelectorCreator } from 'reselect'; const hashFn = (...args) => args.reduce((acc, val) => acc + '-' + JSON.stringify(val), ''); -export const createLodashMemoizedSelector = createSelectorCreator(memoize, hashFn); +export const createLodashMemoizedSelector = createSelectorCreator(memoize as any, hashFn); diff --git a/public/app/features/admin/AdminEditUserCtrl.ts b/public/app/features/admin/AdminEditUserCtrl.ts index a5dcae52d50..4b7dc9d21e5 100644 --- a/public/app/features/admin/AdminEditUserCtrl.ts +++ b/public/app/features/admin/AdminEditUserCtrl.ts @@ -98,7 +98,7 @@ export default class AdminEditUserCtrl { return; } - const orgInfo = _.find($scope.orgsSearchCache, { + const orgInfo: any = _.find($scope.orgsSearchCache, { name: $scope.newOrg.name, }); if (!orgInfo) { diff --git a/public/app/features/alerting/AlertTabCtrl.ts b/public/app/features/alerting/AlertTabCtrl.ts index e46303f10a4..7820d938433 100644 --- a/public/app/features/alerting/AlertTabCtrl.ts +++ b/public/app/features/alerting/AlertTabCtrl.ts @@ -129,7 +129,7 @@ export class AlertTabCtrl { } notificationAdded() { - const model = _.find(this.notifications, { + const model: any = _.find(this.notifications, { name: this.addNotificationSegment.value, }); if (!model) { @@ -157,8 +157,8 @@ export class AlertTabCtrl { removeNotification(an) { // remove notifiers refeered to by id and uid to support notifiers added // before and after we added support for uid - _.remove(this.alert.notifications, n => n.uid === an.uid || n.id === an.id); - _.remove(this.alertNotifications, n => n.uid === an.uid || n.id === an.id); + _.remove(this.alert.notifications, (n: any) => n.uid === an.uid || n.id === an.id); + _.remove(this.alertNotifications, (n: any) => n.uid === an.uid || n.id === an.id); } initModel() { @@ -195,7 +195,7 @@ export class AlertTabCtrl { for (const addedNotification of alert.notifications) { // lookup notifier type by uid - let model = _.find(this.notifications, { uid: addedNotification.uid }); + let model: any = _.find(this.notifications, { uid: addedNotification.uid }); // fallback to using id if uid is missing if (!model) { diff --git a/public/app/features/annotations/annotations_srv.ts b/public/app/features/annotations/annotations_srv.ts index d728adfca2e..a5ed686e02c 100644 --- a/public/app/features/annotations/annotations_srv.ts +++ b/public/app/features/annotations/annotations_srv.ts @@ -38,7 +38,7 @@ export class AnnotationsSrv { .all([this.getGlobalAnnotations(options), this.getAlertStates(options)]) .then(results => { // combine the annotations and flatten results - let annotations = _.flattenDeep(results[0]); + let annotations: any[] = _.flattenDeep(results[0]); // filter out annotations that do not belong to requesting panel annotations = _.filter(annotations, item => { @@ -53,7 +53,7 @@ export class AnnotationsSrv { annotations = makeRegions(annotations, options); // look for alert state for this panel - const alertState = _.find(results[1], { panelId: options.panel.id }); + const alertState: any = _.find(results[1], { panelId: options.panel.id }); return { annotations: annotations, diff --git a/public/app/features/annotations/editor_ctrl.ts b/public/app/features/annotations/editor_ctrl.ts index c12e442f6d3..33b613081f4 100644 --- a/public/app/features/annotations/editor_ctrl.ts +++ b/public/app/features/annotations/editor_ctrl.ts @@ -74,6 +74,7 @@ export class AnnotationsEditorCtrl { } move(index, dir) { + // @ts-ignore _.move(this.annotations, index, index + dir); } diff --git a/public/app/features/annotations/events_processing.ts b/public/app/features/annotations/events_processing.ts index 1180b2a0989..3bf69d1fca4 100644 --- a/public/app/features/annotations/events_processing.ts +++ b/public/app/features/annotations/events_processing.ts @@ -17,10 +17,10 @@ function getRegions(events, range) { const regionEvents = _.filter(events, event => { return event.regionId; }); - let regions = _.groupBy(regionEvents, 'regionId'); + let regions: any = _.groupBy(regionEvents, 'regionId'); regions = _.compact( _.map(regions, regionEvents => { - const regionObj = _.head(regionEvents); + const regionObj: any = _.head(regionEvents); if (regionEvents && regionEvents.length > 1) { regionObj.timeEnd = regionEvents[1].time; regionObj.isRegion = true; diff --git a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx index bdcc3c9d165..dcb71cadbe0 100644 --- a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx +++ b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx @@ -45,7 +45,7 @@ export class AddPanelWidget extends React.Component { const copiedPanelJson = store.get(LS_PANEL_COPY_KEY); if (copiedPanelJson) { const copiedPanel = JSON.parse(copiedPanelJson); - const pluginInfo = _.find(panels, { id: copiedPanel.type }); + const pluginInfo: any = _.find(panels, { id: copiedPanel.type }); if (pluginInfo) { const pluginCopy = _.cloneDeep(pluginInfo); pluginCopy.name = copiedPanel.title; diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts index 1562953fd1b..61e0ca93c38 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts @@ -4,7 +4,6 @@ jest.mock('app/core/store', () => { }; }); -// @ts-ignore import _ from 'lodash'; import config from 'app/core/config'; import { DashboardExporter } from './DashboardExporter'; @@ -148,7 +147,7 @@ describe('given dashboard with repeated panels', () => { }); it('should add datasource to required', () => { - const require = _.find(exported.__requires, { name: 'TestDB' }); + const require: any = _.find(exported.__requires, { name: 'TestDB' }); expect(require.name).toBe('TestDB'); expect(require.id).toBe('testdb'); expect(require.type).toBe('datasource'); @@ -156,52 +155,52 @@ describe('given dashboard with repeated panels', () => { }); it('should not add built in datasources to required', () => { - const require = _.find(exported.__requires, { name: 'Mixed' }); + const require: any = _.find(exported.__requires, { name: 'Mixed' }); expect(require).toBe(undefined); }); it('should add datasources used in mixed mode', () => { - const require = _.find(exported.__requires, { name: 'OtherDB' }); + const require: any = _.find(exported.__requires, { name: 'OtherDB' }); expect(require).not.toBe(undefined); }); it('should add graph panel to required', () => { - const require = _.find(exported.__requires, { name: 'Graph' }); + const require: any = _.find(exported.__requires, { name: 'Graph' }); expect(require.name).toBe('Graph'); expect(require.id).toBe('graph'); expect(require.version).toBe('1.1.0'); }); it('should add table panel to required', () => { - const require = _.find(exported.__requires, { name: 'Table' }); + const require: any = _.find(exported.__requires, { name: 'Table' }); expect(require.name).toBe('Table'); expect(require.id).toBe('table'); expect(require.version).toBe('1.1.1'); }); it('should add heatmap panel to required', () => { - const require = _.find(exported.__requires, { name: 'Heatmap' }); + const require: any = _.find(exported.__requires, { name: 'Heatmap' }); expect(require.name).toBe('Heatmap'); expect(require.id).toBe('heatmap'); expect(require.version).toBe('1.1.2'); }); it('should add grafana version', () => { - const require = _.find(exported.__requires, { name: 'Grafana' }); + const require: any = _.find(exported.__requires, { name: 'Grafana' }); expect(require.type).toBe('grafana'); expect(require.id).toBe('grafana'); expect(require.version).toBe('3.0.2'); }); it('should add constant template variables as inputs', () => { - const input = _.find(exported.__inputs, { name: 'VAR_PREFIX' }); + const input: any = _.find(exported.__inputs, { name: 'VAR_PREFIX' }); expect(input.type).toBe('constant'); expect(input.label).toBe('prefix'); expect(input.value).toBe('collectd'); }); it('should templatize constant variables', () => { - const variable = _.find(exported.templating.list, { name: 'prefix' }); + const variable: any = _.find(exported.templating.list, { name: 'prefix' }); expect(variable.query).toBe('${VAR_PREFIX}'); expect(variable.current.text).toBe('${VAR_PREFIX}'); expect(variable.current.value).toBe('${VAR_PREFIX}'); @@ -210,7 +209,7 @@ describe('given dashboard with repeated panels', () => { }); it('should add datasources only use via datasource variable to requires', () => { - const require = _.find(exported.__requires, { name: 'OtherDB_2' }); + const require: any = _.find(exported.__requires, { name: 'OtherDB_2' }); expect(require.id).toBe('other2'); }); }); diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts index 4150cb9a848..6be4dd2e280 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import config from 'app/core/config'; diff --git a/public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts b/public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts index 339c8e7de4c..629b590cd09 100644 --- a/public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts +++ b/public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts @@ -55,6 +55,7 @@ export class DashLinksEditorCtrl { } moveLink(index, dir) { + // @ts-ignore _.move(this.dashboard.links, index, index + dir); } diff --git a/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts b/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts index 014921a30bc..c0332e61950 100755 --- a/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts +++ b/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts @@ -126,7 +126,7 @@ export class SettingsCtrl { this.viewId = 'make_editable'; } - const currentSection = _.find(this.sections, { id: this.viewId }); + const currentSection: any = _.find(this.sections, { id: this.viewId } as any); if (!currentSection) { this.sections.unshift({ title: 'Not found', @@ -174,7 +174,7 @@ export class SettingsCtrl { this.viewId = 'settings'; this.buildSectionList(); - const currentSection = _.find(this.sections, { id: this.viewId }); + const currentSection: any = _.find(this.sections, { id: this.viewId } as any); this.$location.url(currentSection.url); } diff --git a/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts b/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts index 7dcf0469e77..c459504d296 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts +++ b/public/app/features/dashboard/components/ShareModal/ShareSnapshotCtrl.ts @@ -99,7 +99,7 @@ export class ShareSnapshotCtrl { .filter(annotation => { return annotation.enable; }) - .map(annotation => { + .map((annotation: any) => { return { name: annotation.name, enable: annotation.enable, diff --git a/public/app/features/dashboard/panel_editor/QueriesTab.tsx b/public/app/features/dashboard/panel_editor/QueriesTab.tsx index 003cf73f300..dacfcc6b84d 100644 --- a/public/app/features/dashboard/panel_editor/QueriesTab.tsx +++ b/public/app/features/dashboard/panel_editor/QueriesTab.tsx @@ -122,6 +122,7 @@ export class QueriesTab extends PureComponent { const { panel } = this.props; const index = _.indexOf(panel.targets, query); + // @ts-ignore _.move(panel.targets, index, index + direction); this.forceUpdate(); diff --git a/public/app/features/dashboard/services/ChangeTracker.ts b/public/app/features/dashboard/services/ChangeTracker.ts index 77434525085..7fe365cd8e0 100644 --- a/public/app/features/dashboard/services/ChangeTracker.ts +++ b/public/app/features/dashboard/services/ChangeTracker.ts @@ -141,8 +141,8 @@ export class ChangeTracker { const current = this.cleanDashboardFromIgnoredChanges(this.current.getSaveModelClone()); const original = this.cleanDashboardFromIgnoredChanges(this.original); - const currentTimepicker = _.find(current.nav, { type: 'timepicker' }); - const originalTimepicker = _.find(original.nav, { type: 'timepicker' }); + const currentTimepicker: any = _.find(current.nav, { type: 'timepicker' }); + const originalTimepicker: any = _.find(original.nav, { type: 'timepicker' }); if (currentTimepicker && originalTimepicker) { currentTimepicker.now = originalTimepicker.now; diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts index d7c63f834b1..d6264fbf8fe 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -109,7 +109,7 @@ export class DashboardMigrator { if (oldVersion < 6) { // move pulldowns to new schema - const annotations = _.find(old.pulldowns, { type: 'annotations' }); + const annotations: any = _.find(old.pulldowns, { type: 'annotations' }); if (annotations) { this.dashboard.annotations = { diff --git a/public/app/features/dashboard/state/DashboardModel.test.ts b/public/app/features/dashboard/state/DashboardModel.test.ts index 7cd9b976795..fe6ae90631e 100644 --- a/public/app/features/dashboard/state/DashboardModel.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.test.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import { DashboardModel } from '../state/DashboardModel'; import { PanelModel } from '../state/PanelModel'; diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 44b920771da..cfe4f536337 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -1,6 +1,5 @@ // Libaries import moment, { MomentInput } from 'moment'; -// @ts-ignore import _ from 'lodash'; // Constants @@ -179,7 +178,7 @@ export class DashboardModel { if (!defaults.saveVariables) { for (let i = 0; i < copy.templating.list.length; i++) { const current = copy.templating.list[i]; - const original = _.find(this.originalTemplating, { name: current.name, type: current.type }); + const original: any = _.find(this.originalTemplating, { name: current.name, type: current.type }); if (!original) { continue; @@ -449,7 +448,7 @@ export class DashboardModel { } repeatPanel(panel: PanelModel, panelIndex: number) { - const variable = _.find(this.templating.list, { name: panel.repeat }); + const variable: any = _.find(this.templating.list, { name: panel.repeat } as any); if (!variable) { return; } @@ -719,7 +718,7 @@ export class DashboardModel { if (row.collapsed) { row.collapsed = false; - const hasRepeat = _.some(row.panels, (p: PanelModel) => p.repeat); + const hasRepeat = _.some(row.panels as PanelModel[], (p: PanelModel) => p.repeat); if (row.panels.length > 0) { // Use first panel to figure out if it was moved or pushed diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 24d186cbbba..8e577dac1e1 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -3,7 +3,6 @@ import React, { ComponentClass } from 'react'; import { hot } from 'react-hot-loader'; // @ts-ignore import { connect } from 'react-redux'; -// @ts-ignore import _ from 'lodash'; import { AutoSizer } from 'react-virtualized'; diff --git a/public/app/features/explore/QueryField.tsx b/public/app/features/explore/QueryField.tsx index dd453faf7dd..97ff0958d56 100644 --- a/public/app/features/explore/QueryField.tsx +++ b/public/app/features/explore/QueryField.tsx @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import React, { Context } from 'react'; import ReactDOM from 'react-dom'; diff --git a/public/app/features/explore/QueryRow.tsx b/public/app/features/explore/QueryRow.tsx index 64920cc1fb7..ef5dda9b1da 100644 --- a/public/app/features/explore/QueryRow.tsx +++ b/public/app/features/explore/QueryRow.tsx @@ -1,6 +1,5 @@ // Libraries import React, { PureComponent } from 'react'; -// @ts-ignore import _ from 'lodash'; import { hot } from 'react-hot-loader'; // @ts-ignore diff --git a/public/app/features/explore/TimePicker.tsx b/public/app/features/explore/TimePicker.tsx index 7735c63d58c..27e1afe4364 100644 --- a/public/app/features/explore/TimePicker.tsx +++ b/public/app/features/explore/TimePicker.tsx @@ -241,7 +241,7 @@ export default class TimePicker extends PureComponent - {group.map(option => ( + {group.map((option: any) => (
  • this.handleClickRelativeOption(option)}>{option.display}
  • diff --git a/public/app/features/explore/Typeahead.tsx b/public/app/features/explore/Typeahead.tsx index 76647720c4d..b28ab4a610d 100644 --- a/public/app/features/explore/Typeahead.tsx +++ b/public/app/features/explore/Typeahead.tsx @@ -1,5 +1,4 @@ import React, { createRef } from 'react'; -// @ts-ignore import _ from 'lodash'; import { FixedSizeList } from 'react-window'; diff --git a/public/app/features/explore/state/actions.ts b/public/app/features/explore/state/actions.ts index 9c724ed1fb1..a247d90e2f2 100644 --- a/public/app/features/explore/state/actions.ts +++ b/public/app/features/explore/state/actions.ts @@ -1,5 +1,4 @@ // Libraries -// @ts-ignore import _ from 'lodash'; // Services & Utils @@ -196,11 +195,14 @@ export function loadExploreDatasourcesAndSetDatasource( return dispatch => { const exploreDatasources: DataSourceSelectItem[] = getDatasourceSrv() .getExternal() - .map((ds: any) => ({ - value: ds.name, - name: ds.name, - meta: ds.meta, - })); + .map( + (ds: any) => + ({ + value: ds.name, + name: ds.name, + meta: ds.meta, + } as DataSourceSelectItem) + ); dispatch(loadExploreDatasources({ exploreId, exploreDatasources })); diff --git a/public/app/features/explore/state/reducers.ts b/public/app/features/explore/state/reducers.ts index e71b5903b1f..04793f3aa1c 100644 --- a/public/app/features/explore/state/reducers.ts +++ b/public/app/features/explore/state/reducers.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import { calculateResultsFromQueryTransactions, diff --git a/public/app/features/panel/panellinks/module.ts b/public/app/features/panel/panellinks/module.ts index 99a6975811e..5fdb30748e5 100644 --- a/public/app/features/panel/panellinks/module.ts +++ b/public/app/features/panel/panellinks/module.ts @@ -37,7 +37,7 @@ export class PanelLinksEditorCtrl { $scope.dashboardChanged = link => { backendSrv.search({ query: link.dashboard }).then(hits => { - const dashboard = _.find(hits, { title: link.dashboard }); + const dashboard: any = _.find(hits, { title: link.dashboard }); if (dashboard) { if (dashboard.url) { link.url = dashboard.url; diff --git a/public/app/features/plugins/plugin_edit_ctrl.ts b/public/app/features/plugins/plugin_edit_ctrl.ts index 44d3d31f996..177986cb331 100644 --- a/public/app/features/plugins/plugin_edit_ctrl.ts +++ b/public/app/features/plugins/plugin_edit_ctrl.ts @@ -53,7 +53,7 @@ export class PluginEditCtrl { url: `plugins/${this.model.id}/edit?tab=config`, }); - const hasDashboards = _.find(model.includes, { type: 'dashboard' }); + const hasDashboards: any = _.find(model.includes, { type: 'dashboard' }); if (hasDashboards) { this.navModel.main.children.push({ diff --git a/public/app/features/plugins/state/navModel.ts b/public/app/features/plugins/state/navModel.ts index 1e7ed0cdf27..19ce6dd905d 100644 --- a/public/app/features/plugins/state/navModel.ts +++ b/public/app/features/plugins/state/navModel.ts @@ -34,7 +34,7 @@ export function buildNavModel(ds: DataSourceSettings, plugin: PluginMeta, curren ], }; - const hasDashboards = _.find(plugin.includes, { type: 'dashboard' }) !== undefined; + const hasDashboards: any = _.find(plugin.includes, { type: 'dashboard' }) !== undefined; if (hasDashboards && ds.id) { main.children.push({ active: currentPage === 'datasource-dashboards', diff --git a/public/app/features/templating/editor_ctrl.ts b/public/app/features/templating/editor_ctrl.ts index c47c42a4aad..6d70be63771 100644 --- a/public/app/features/templating/editor_ctrl.ts +++ b/public/app/features/templating/editor_ctrl.ts @@ -64,7 +64,7 @@ export class VariableEditorCtrl { return false; } - const sameName = _.find($scope.variables, { name: $scope.current.name }); + const sameName: any = _.find($scope.variables, { name: $scope.current.name }); if (sameName && sameName !== $scope.current) { appEvents.emit('alert-warning', ['Validation', 'Variable with the same name already exists']); return false; @@ -151,7 +151,7 @@ export class VariableEditorCtrl { $scope.datasourceTypes = _($scope.datasources) .uniqBy('meta.id') - .map(ds => { + .map((ds: any) => { return { text: ds.meta.name, value: ds.meta.id }; }) .value(); diff --git a/public/app/features/templating/template_srv.ts b/public/app/features/templating/template_srv.ts index e0d35295556..e7f21eb4ce7 100644 --- a/public/app/features/templating/template_srv.ts +++ b/public/app/features/templating/template_srv.ts @@ -309,7 +309,7 @@ export class TemplateSrv { } distributeVariable(value, variable) { - value = _.map(value, (val, index) => { + value = _.map(value, (val: any, index: number) => { if (index !== 0) { return variable + '=' + val; } else { diff --git a/public/app/features/templating/variable_srv.ts b/public/app/features/templating/variable_srv.ts index f4d95721846..b69ad3c3075 100644 --- a/public/app/features/templating/variable_srv.ts +++ b/public/app/features/templating/variable_srv.ts @@ -200,7 +200,7 @@ export class VariableSrv { return variable.setValue(selected); } else { - const currentOption = _.find(variable.options, { + const currentOption: any = _.find(variable.options, { text: variable.current.text, }); if (currentOption) { @@ -222,7 +222,7 @@ export class VariableSrv { } return promise.then(() => { - let option = _.find(variable.options, op => { + let option: any = _.find(variable.options, op => { return op.text === urlValue || op.value === urlValue; }); @@ -233,7 +233,7 @@ export class VariableSrv { defaultText = []; for (let n = 0; n < urlValue.length; n++) { - const t = _.find(variable.options, op => { + const t: any = _.find(variable.options, op => { return op.value === urlValue[n]; }); @@ -279,10 +279,10 @@ export class VariableSrv { } setAdhocFilter(options) { - let variable = _.find(this.variables, { + let variable: any = _.find(this.variables, { type: 'adhoc', datasource: options.datasource, - }); + } as any); if (!variable) { variable = this.createVariableFromModel({ name: 'Filters', @@ -293,7 +293,7 @@ export class VariableSrv { } const filters = variable.filters; - let filter = _.find(filters, { key: options.key, value: options.value }); + let filter: any = _.find(filters, { key: options.key, value: options.value }); if (!filter) { filter = { key: options.key, value: options.value }; diff --git a/public/app/plugins/datasource/cloudwatch/datasource.ts b/public/app/plugins/datasource/cloudwatch/datasource.ts index 9362c3b239e..510d54ec35d 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.ts +++ b/public/app/plugins/datasource/cloudwatch/datasource.ts @@ -410,7 +410,7 @@ export default class CloudWatchDatasource implements DataSourceApi { if (allSelected) { return v.text !== 'All'; @@ -427,7 +427,7 @@ export default class CloudWatchDatasource implements DataSourceApi { + selectedVariables.some((s: any) => { return s.value === currentVariables[0].value; }) || currentVariables[0].value === '$__all'; return (useSelectedVariables ? selectedVariables : currentVariables).map(v => { diff --git a/public/app/plugins/datasource/elasticsearch/config_ctrl.ts b/public/app/plugins/datasource/elasticsearch/config_ctrl.ts index 8a90d2dc3bd..cae0bb2c41e 100644 --- a/public/app/plugins/datasource/elasticsearch/config_ctrl.ts +++ b/public/app/plugins/datasource/elasticsearch/config_ctrl.ts @@ -33,7 +33,7 @@ export class ElasticConfigCtrl { this.current.database.length === 0 || this.current.database.startsWith('[logstash-]') ) { - const def = _.find(this.indexPatternTypes, { + const def: any = _.find(this.indexPatternTypes, { value: this.current.jsonData.interval, }); this.current.database = def.example || 'es-index-name'; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index 0e510470db9..e1fcd9715da 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -204,7 +204,7 @@ export class ElasticDatasource { // validate that the index exist and has date field return this.getFields({ type: 'date' }).then( dateFields => { - const timeField = _.find(dateFields, { text: this.timeField }); + const timeField: any = _.find(dateFields, { text: this.timeField }); if (!timeField) { return { status: 'error', diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.ts b/public/app/plugins/datasource/elasticsearch/elastic_response.ts index 52fecd79e8b..7e3e247b18d 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.ts +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.ts @@ -222,7 +222,7 @@ export class ElasticResponse { } private getMetricName(metric) { - let metricDef = _.find(queryDef.metricAggTypes, { value: metric }); + let metricDef: any = _.find(queryDef.metricAggTypes, { value: metric }); if (!metricDef) { metricDef = _.find(queryDef.extendedStats, { value: metric }); } @@ -258,12 +258,12 @@ export class ElasticResponse { if (series.field && queryDef.isPipelineAgg(series.metric)) { if (series.metric && queryDef.isPipelineAggWithMultipleBucketPaths(series.metric)) { - const agg = _.find(target.metrics, { id: series.metricId }); + const agg: any = _.find(target.metrics, { id: series.metricId }); if (agg && agg.settings.script) { metricName = agg.settings.script; for (const pv of agg.pipelineVariables) { - const appliedAgg = _.find(target.metrics, { id: pv.pipelineAgg }); + const appliedAgg: any = _.find(target.metrics, { id: pv.pipelineAgg }); if (appliedAgg) { metricName = metricName.replace('params.' + pv.name, queryDef.describeMetric(appliedAgg)); } @@ -272,7 +272,7 @@ export class ElasticResponse { metricName = 'Unset'; } } else { - const appliedAgg = _.find(target.metrics, { id: series.field }); + const appliedAgg: any = _.find(target.metrics, { id: series.field }); if (appliedAgg) { metricName += ' ' + queryDef.describeMetric(appliedAgg); } else { @@ -343,7 +343,7 @@ export class ElasticResponse { } trimDatapoints(aggregations, target) { - const histogram = _.find(target.bucketAggs, { type: 'date_histogram' }); + const histogram: any = _.find(target.bucketAggs, { type: 'date_histogram' }); const shouldDropFirstAndLast = histogram && histogram.settings && histogram.settings.trimEdges; if (shouldDropFirstAndLast) { diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.ts b/public/app/plugins/datasource/elasticsearch/metric_agg.ts index 735b4b4f7f9..15a38082829 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.ts +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.ts @@ -81,7 +81,7 @@ export class ElasticMetricAggCtrl { $scope.agg.meta, (memo, val, key) => { if (val) { - const def = _.find($scope.extendedStats, { value: key }); + const def: any = _.find($scope.extendedStats, { value: key }); memo.push(def.text); } return memo; diff --git a/public/app/plugins/datasource/elasticsearch/query_ctrl.ts b/public/app/plugins/datasource/elasticsearch/query_ctrl.ts index 40420d7c6a3..73a262427f4 100644 --- a/public/app/plugins/datasource/elasticsearch/query_ctrl.ts +++ b/public/app/plugins/datasource/elasticsearch/query_ctrl.ts @@ -66,7 +66,7 @@ export class ElasticQueryCtrl extends QueryCtrl { text += 'Metrics: '; _.each(metricAggs, (metric, index) => { - const aggDef = _.find(metricAggTypes, { value: metric.type }); + const aggDef: any = _.find(metricAggTypes, { value: metric.type }); text += aggDef.text + '('; if (aggDef.requiresField) { text += metric.field; @@ -77,12 +77,12 @@ export class ElasticQueryCtrl extends QueryCtrl { text += '), '; }); - _.each(bucketAggs, (bucketAgg, index) => { + _.each(bucketAggs, (bucketAgg: any, index: number) => { if (index === 0) { text += ' Group by: '; } - const aggDef = _.find(bucketAggTypes, { value: bucketAgg.type }); + const aggDef: any = _.find(bucketAggTypes, { value: bucketAgg.type }); text += aggDef.text + '('; if (aggDef.requiresField) { text += bucketAgg.field; diff --git a/public/app/plugins/datasource/elasticsearch/query_def.ts b/public/app/plugins/datasource/elasticsearch/query_def.ts index 13797853a77..e429183e4ac 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.ts +++ b/public/app/plugins/datasource/elasticsearch/query_def.ts @@ -224,12 +224,12 @@ export function getOrderByOptions(target) { } export function describeOrder(order) { - const def = _.find(orderOptions, { value: order }); + const def: any = _.find(orderOptions, { value: order }); return def.text; } export function describeMetric(metric) { - const def = _.find(metricAggTypes, { value: metric.type }); + const def: any = _.find(metricAggTypes, { value: metric.type }); if (!def.requiresField && !isPipelineAgg(metric.type)) { return def.text; } @@ -237,11 +237,11 @@ export function describeMetric(metric) { } export function describeOrderBy(orderBy, target) { - const def = _.find(orderByOptions, { value: orderBy }); + const def: any = _.find(orderByOptions, { value: orderBy }); if (def) { return def.text; } - const metric = _.find(target.metrics, { id: orderBy }); + const metric: any = _.find(target.metrics, { id: orderBy }); if (metric) { return describeMetric(metric); } else { diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts index 6b5f006ca30..a4a98edb031 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/response_parser.ts @@ -144,7 +144,7 @@ export default class ResponseParser { } static findOrCreateBucket(data, target) { - let dataTarget = _.find(data, ['target', target]); + let dataTarget: any = _.find(data, ['target', target]); if (!dataTarget) { dataTarget = { target: target, datapoints: [] }; data.push(dataTarget); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts index e747c2e4d70..610dfc61b84 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/response_parser.ts @@ -254,7 +254,7 @@ export default class ResponseParser { } static findOrCreateBucket(data, target): DataTarget { - let dataTarget = _.find(data, ['target', target]); + let dataTarget: any = _.find(data, ['target', target]); if (!dataTarget) { dataTarget = { target: target, datapoints: [], refId: '', query: '' }; data.push(dataTarget); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts index ef882efbf99..5ae25609996 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/response_parser.ts @@ -136,7 +136,7 @@ export default class ResponseParser { } static parseMetadata(result: any, metricName: string) { - const metricData = _.find(result.data.value, o => { + const metricData: any = _.find(result.data.value, o => { return _.get(o, 'name.value') === metricName; }); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx index 9162a56e3ea..3427bb5662d 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx @@ -245,7 +245,7 @@ class QueryField extends React.Component { // Get the currently selected suggestion const flattenedSuggestions = flattenSuggestions(suggestions); - const suggestion = _.find( + const suggestion: any = _.find( flattenedSuggestions, suggestion => suggestion.display === item || suggestion.text === item ); diff --git a/public/app/plugins/datasource/graphite/add_graphite_func.ts b/public/app/plugins/datasource/graphite/add_graphite_func.ts index ea3dfe8ff5e..8a7b49b01c6 100644 --- a/public/app/plugins/datasource/graphite/add_graphite_func.ts +++ b/public/app/plugins/datasource/graphite/add_graphite_func.ts @@ -35,7 +35,7 @@ export function graphiteAddFunc($compile) { minLength: 1, items: 10, updater: value => { - let funcDef = ctrl.datasource.getFuncDef(value); + let funcDef: any = ctrl.datasource.getFuncDef(value); if (!funcDef) { // try find close match value = value.toLowerCase(); diff --git a/public/app/plugins/datasource/graphite/func_editor.ts b/public/app/plugins/datasource/graphite/func_editor.ts index 25c007fcb19..6f2b23a7389 100644 --- a/public/app/plugins/datasource/graphite/func_editor.ts +++ b/public/app/plugins/datasource/graphite/func_editor.ts @@ -77,7 +77,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) { if (index < func.def.params.length) { return func.def.params[index]; } - if (_.last(func.def.params).multiple) { + if ((_.last(func.def.params) as any).multiple) { return _.assign({}, _.last(func.def.params), { optional: true }); } return {}; @@ -170,14 +170,14 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) { function addElementsAndCompile() { $funcLink.appendTo(elem); - const defParams = _.clone(func.def.params); - const lastParam = _.last(func.def.params); + const defParams: any = _.clone(func.def.params); + const lastParam: any = _.last(func.def.params); while (func.params.length >= defParams.length && lastParam && lastParam.multiple) { defParams.push(_.assign({}, lastParam, { optional: true })); } - _.each(defParams, (param, index) => { + _.each(defParams, (param: any, index: number) => { if (param.optional && func.params.length < index) { return false; } diff --git a/public/app/plugins/datasource/graphite/graphite_query.ts b/public/app/plugins/datasource/graphite/graphite_query.ts index fb3cb69f6ce..57157dc0701 100644 --- a/public/app/plugins/datasource/graphite/graphite_query.ts +++ b/public/app/plugins/datasource/graphite/graphite_query.ts @@ -61,7 +61,7 @@ export default class GraphiteQuery { } checkForSeriesByTag() { - const seriesByTagFunc = _.find(this.functions, func => func.def.name === 'seriesByTag'); + const seriesByTagFunc: any = _.find(this.functions, func => func.def.name === 'seriesByTag'); if (seriesByTagFunc) { this.seriesByTagUsed = true; seriesByTagFunc.hidden = true; @@ -135,7 +135,7 @@ export default class GraphiteQuery { } moveAliasFuncLast() { - const aliasFunc = _.find(this.functions, func => { + const aliasFunc: any = _.find(this.functions, func => { return func.def.name.startsWith('alias'); }); @@ -158,6 +158,7 @@ export default class GraphiteQuery { moveFunction(func, offset) { const index = this.functions.indexOf(func); + // @ts-ignore _.move(this.functions, index, index + offset); } diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index 80ddc0f5e07..90c2c248297 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/public/app/plugins/datasource/graphite/query_ctrl.ts @@ -182,7 +182,7 @@ export class GraphiteQueryCtrl extends QueryCtrl { }); } - removeTaggedEntry(altSegments) { + removeTaggedEntry(altSegments: any[]) { altSegments = _.remove(altSegments, s => s.value === '_tagged'); } diff --git a/public/app/plugins/datasource/influxdb/influx_series.ts b/public/app/plugins/datasource/influxdb/influx_series.ts index 106f8957875..15b2a89c6f7 100644 --- a/public/app/plugins/datasource/influxdb/influx_series.ts +++ b/public/app/plugins/datasource/influxdb/influx_series.ts @@ -151,7 +151,7 @@ export default class InfluxSeries { return table; } - _.each(this.series, (series, seriesIndex) => { + _.each(this.series, (series: any, seriesIndex: number) => { if (seriesIndex === 0) { j = 0; // Check that the first column is indeed 'time' diff --git a/public/app/plugins/datasource/influxdb/response_parser.ts b/public/app/plugins/datasource/influxdb/response_parser.ts index 6ed9919f680..5c4fb1fc20e 100644 --- a/public/app/plugins/datasource/influxdb/response_parser.ts +++ b/public/app/plugins/datasource/influxdb/response_parser.ts @@ -44,7 +44,9 @@ export default class ResponseParser { }); }); + // @ts-ignore problems with typings for this _.map only accepts [] but this needs to be object return _.map(res, value => { + // @ts-ignore return { text: value.toString() }; }); } diff --git a/public/app/plugins/datasource/loki/language_provider.ts b/public/app/plugins/datasource/loki/language_provider.ts index e914b1d8dd0..c137deace1c 100644 --- a/public/app/plugins/datasource/loki/language_provider.ts +++ b/public/app/plugins/datasource/loki/language_provider.ts @@ -1,5 +1,4 @@ // Libraries -// @ts-ignore import _ from 'lodash'; import moment from 'moment'; diff --git a/public/app/plugins/datasource/mixed/datasource.ts b/public/app/plugins/datasource/mixed/datasource.ts index d8c6aab24b8..482cd27ab7b 100644 --- a/public/app/plugins/datasource/mixed/datasource.ts +++ b/public/app/plugins/datasource/mixed/datasource.ts @@ -9,7 +9,7 @@ class MixedDatasource implements DataSourceApi { query(options: DataQueryOptions) { const sets = _.groupBy(options.targets, 'datasource'); - const promises = _.map(sets, (targets: DataQuery[]) => { + const promises: any = _.map(sets, (targets: DataQuery[]) => { const dsName = targets[0].datasource; if (dsName === '-- Mixed --') { return Promise.resolve([]); diff --git a/public/app/plugins/datasource/mssql/query_ctrl.ts b/public/app/plugins/datasource/mssql/query_ctrl.ts index 7598ca292fe..c3eab93d426 100644 --- a/public/app/plugins/datasource/mssql/query_ctrl.ts +++ b/public/app/plugins/datasource/mssql/query_ctrl.ts @@ -59,7 +59,7 @@ export class MssqlQueryCtrl extends QueryCtrl { this.lastQueryMeta = null; this.lastQueryError = null; - const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId }); + const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId }); if (anySeriesFromQuery) { this.lastQueryMeta = anySeriesFromQuery.meta; } diff --git a/public/app/plugins/datasource/mysql/mysql_query.ts b/public/app/plugins/datasource/mysql/mysql_query.ts index 9494d867fad..88cef929aaa 100644 --- a/public/app/plugins/datasource/mysql/mysql_query.ts +++ b/public/app/plugins/datasource/mysql/mysql_query.ts @@ -149,17 +149,17 @@ export default class MysqlQuery { buildValueColumn(column) { let query = ''; - const columnName = _.find(column, (g: any) => g.type === 'column'); + const columnName: any = _.find(column, (g: any) => g.type === 'column'); query = columnName.params[0]; - const aggregate = _.find(column, (g: any) => g.type === 'aggregate'); + const aggregate: any = _.find(column, (g: any) => g.type === 'aggregate'); if (aggregate) { const func = aggregate.params[0]; query = func + '(' + query + ')'; } - const alias = _.find(column, (g: any) => g.type === 'alias'); + const alias: any = _.find(column, (g: any) => g.type === 'alias'); if (alias) { query += ' AS ' + this.quoteIdentifier(alias.params[0]); } diff --git a/public/app/plugins/datasource/mysql/query_ctrl.ts b/public/app/plugins/datasource/mysql/query_ctrl.ts index 8161404a126..06419c791c7 100644 --- a/public/app/plugins/datasource/mysql/query_ctrl.ts +++ b/public/app/plugins/datasource/mysql/query_ctrl.ts @@ -253,7 +253,7 @@ export class MysqlQueryCtrl extends QueryCtrl { this.lastQueryMeta = null; this.lastQueryError = null; - const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId }); + const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId }); if (anySeriesFromQuery) { this.lastQueryMeta = anySeriesFromQuery.meta; } diff --git a/public/app/plugins/datasource/opentsdb/datasource.ts b/public/app/plugins/datasource/opentsdb/datasource.ts index bab86a04765..e6e81c1ebe9 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.ts +++ b/public/app/plugins/datasource/opentsdb/datasource.ts @@ -72,7 +72,7 @@ export default class OpenTsDatasource { return this.performTimeSeriesQuery(queries, start, end).then(response => { const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion); - const result = _.map(response.data, (metricData, index) => { + const result = _.map(response.data, (metricData: any, index: number) => { index = metricToTargetMapping[index]; if (index === -1) { index = 0; @@ -347,7 +347,7 @@ export default class OpenTsDatasource { // TSDB returns datapoints has a hash of ts => value. // Can't use _.pairs(invert()) because it stringifies keys/values - _.each(md.dps, (v, k) => { + _.each(md.dps, (v: any, k: number) => { if (tsdbResolution === 2) { dps.push([v, k * 1]); } else { @@ -466,7 +466,7 @@ export default class OpenTsDatasource { if (tsdbVersion === 3) { return metricData.query.index; } else { - return _.findIndex(options.targets, target => { + return _.findIndex(options.targets as any[], target => { if (target.filters && target.filters.length > 0) { return target.metric === metricData.metric; } else { diff --git a/public/app/plugins/datasource/postgres/postgres_query.ts b/public/app/plugins/datasource/postgres/postgres_query.ts index e315f1fecd2..200a3ebd0bb 100644 --- a/public/app/plugins/datasource/postgres/postgres_query.ts +++ b/public/app/plugins/datasource/postgres/postgres_query.ts @@ -149,11 +149,11 @@ export default class PostgresQuery { buildValueColumn(column) { let query = ''; - const columnName = _.find(column, (g: any) => g.type === 'column'); + const columnName: any = _.find(column, (g: any) => g.type === 'column'); query = columnName.params[0]; - const aggregate = _.find(column, (g: any) => g.type === 'aggregate' || g.type === 'percentile'); - const windows = _.find(column, (g: any) => g.type === 'window' || g.type === 'moving_window'); + const aggregate: any = _.find(column, (g: any) => g.type === 'aggregate' || g.type === 'percentile'); + const windows: any = _.find(column, (g: any) => g.type === 'window' || g.type === 'moving_window'); if (aggregate) { const func = aggregate.params[0]; @@ -218,7 +218,7 @@ export default class PostgresQuery { } } - const alias = _.find(column, (g: any) => g.type === 'alias'); + const alias: any = _.find(column, (g: any) => g.type === 'alias'); if (alias) { query += ' AS ' + this.quoteIdentifier(alias.params[0]); } diff --git a/public/app/plugins/datasource/postgres/query_ctrl.ts b/public/app/plugins/datasource/postgres/query_ctrl.ts index aa66a1594cb..89050ce0ada 100644 --- a/public/app/plugins/datasource/postgres/query_ctrl.ts +++ b/public/app/plugins/datasource/postgres/query_ctrl.ts @@ -284,7 +284,7 @@ export class PostgresQueryCtrl extends QueryCtrl { this.lastQueryMeta = null; this.lastQueryError = null; - const anySeriesFromQuery = _.find(dataList, { refId: this.target.refId }); + const anySeriesFromQuery: any = _.find(dataList, { refId: this.target.refId }); if (anySeriesFromQuery) { this.lastQueryMeta = anySeriesFromQuery.meta; } diff --git a/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx b/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx index 9a9a3b90223..f34e8a54ecd 100644 --- a/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx +++ b/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import React from 'react'; // @ts-ignore diff --git a/public/app/plugins/datasource/prometheus/language_provider.ts b/public/app/plugins/datasource/prometheus/language_provider.ts index c071617fb6d..71ff5bf5f72 100644 --- a/public/app/plugins/datasource/prometheus/language_provider.ts +++ b/public/app/plugins/datasource/prometheus/language_provider.ts @@ -1,4 +1,3 @@ -// @ts-ignore import _ from 'lodash'; import moment from 'moment'; diff --git a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts index 4f90bd381da..5c747eae74f 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts @@ -23,7 +23,7 @@ describe('PrometheusDatasource', () => { directUrl: 'direct', user: 'test', password: 'mupp', - jsonData: {}, + jsonData: {} as any, }; ctx.backendSrvMock = {}; diff --git a/public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts b/public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts index f8fc2e796ce..106940c2777 100644 --- a/public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts +++ b/public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts @@ -42,7 +42,7 @@ export default class StackdriverMetricFindQuery { async handleServiceQuery() { const metricDescriptors = await this.datasource.getMetricTypes(this.datasource.projectName); - const services = extractServicesFromMetricDescriptors(metricDescriptors); + const services: any[] = extractServicesFromMetricDescriptors(metricDescriptors); return services.map(s => ({ text: s.serviceShortName, value: s.service, diff --git a/public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx b/public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx index 5c8eaf5b5b8..cd8a2185df9 100644 --- a/public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx +++ b/public/app/plugins/datasource/stackdriver/components/VariableQueryEditor.tsx @@ -34,7 +34,7 @@ export class StackdriverVariableQueryEditor extends PureComponent ({ + const services = extractServicesFromMetricDescriptors(metricDescriptors).map((m: any) => ({ value: m.service, name: m.serviceShortName, })); diff --git a/public/app/plugins/datasource/testdata/QueryEditor.tsx b/public/app/plugins/datasource/testdata/QueryEditor.tsx index 811d6f217ff..7f7afd67f77 100644 --- a/public/app/plugins/datasource/testdata/QueryEditor.tsx +++ b/public/app/plugins/datasource/testdata/QueryEditor.tsx @@ -35,7 +35,7 @@ export class QueryEditor extends PureComponent { // const scenarioList = await this.backendSrv.get('/api/tsdb/testdata/scenarios'); const scenarioList = await datasource.getScenarios(); - const current = _.find(scenarioList, { id: query.scenarioId }); + const current: any = _.find(scenarioList, { id: query.scenarioId }); this.setState({ scenarioList: scenarioList, current: current }); } diff --git a/public/app/plugins/datasource/testdata/types.ts b/public/app/plugins/datasource/testdata/types.ts index 02347249655..1a05b3eac27 100644 --- a/public/app/plugins/datasource/testdata/types.ts +++ b/public/app/plugins/datasource/testdata/types.ts @@ -3,6 +3,8 @@ import { DataQuery } from '@grafana/ui/src/types'; export interface TestDataQuery extends DataQuery { alias?: string; scenarioId: string; + stringInput: string; + points: any; } export interface Scenario { diff --git a/public/app/plugins/panel/graph/Legend/Legend.tsx b/public/app/plugins/panel/graph/Legend/Legend.tsx index 161975eda9f..8702bdac859 100644 --- a/public/app/plugins/panel/graph/Legend/Legend.tsx +++ b/public/app/plugins/panel/graph/Legend/Legend.tsx @@ -88,7 +88,7 @@ export class GraphLegend extends PureComponent { } sortLegend() { - let seriesList = [...this.props.seriesList] || []; + let seriesList: TimeSeries[] = [...this.props.seriesList] || []; if (this.props.sort) { seriesList = _.sortBy(seriesList, series => { let sort = series.stats[this.props.sort]; @@ -96,7 +96,7 @@ export class GraphLegend extends PureComponent { sort = -Infinity; } return sort; - }); + }) as TimeSeries[]; if (this.props.sortDesc) { seriesList = seriesList.reverse(); } diff --git a/public/app/plugins/panel/graph/data_processor.ts b/public/app/plugins/panel/graph/data_processor.ts index f148cc9e0b3..4b57934824c 100644 --- a/public/app/plugins/panel/graph/data_processor.ts +++ b/public/app/plugins/panel/graph/data_processor.ts @@ -156,7 +156,7 @@ export class DataProcessor { } const validOptions = this.getXAxisValueOptions({}); - const found = _.find(validOptions, { value: this.panel.xaxis.values[0] }); + const found: any = _.find(validOptions, { value: this.panel.xaxis.values[0] }); if (!found) { this.panel.xaxis.values = ['total']; } diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index e3eed6fc382..abed226f9d6 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -574,6 +574,7 @@ class GraphElement { return [tickIndex + 1, point[1]]; }); }); + // @ts-ignore, potential bug? is this _.flattenDeep? ticks = _.flatten(ticks, true); options.xaxis = { diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index 5a8789ed5d2..2412224eca6 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -262,7 +262,7 @@ class GraphCtrl extends MetricsPanelCtrl { }; onToggleAxis = info => { - let override = _.find(this.panel.seriesOverrides, { alias: info.alias }); + let override: any = _.find(this.panel.seriesOverrides, { alias: info.alias }); if (!override) { override = { alias: info.alias }; this.panel.seriesOverrides.push(override); diff --git a/public/app/plugins/panel/heatmap/color_legend.ts b/public/app/plugins/panel/heatmap/color_legend.ts index a1c80629c7e..3629bce1b5e 100644 --- a/public/app/plugins/panel/heatmap/color_legend.ts +++ b/public/app/plugins/panel/heatmap/color_legend.ts @@ -36,7 +36,7 @@ coreModule.directive('colorLegend', () => { const legendWidth = Math.floor(legendElem.outerWidth()); if (panel.color.mode === 'spectrum') { - const colorScheme = _.find(ctrl.colorSchemes, { + const colorScheme: any = _.find(ctrl.colorSchemes, { value: panel.color.colorScheme, }); const colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, legendWidth); @@ -76,7 +76,7 @@ coreModule.directive('heatmapLegend', () => { const minValue = cardStats.min; if (panel.color.mode === 'spectrum') { - const colorScheme = _.find(ctrl.colorSchemes, { + const colorScheme: any = _.find(ctrl.colorSchemes, { value: panel.color.colorScheme, }); drawColorLegend(elem, colorScheme, rangeFrom, rangeTo, maxValue, minValue); diff --git a/public/app/plugins/panel/heatmap/heatmap_data_converter.ts b/public/app/plugins/panel/heatmap/heatmap_data_converter.ts index 07960f68ae3..baa8305e233 100644 --- a/public/app/plugins/panel/heatmap/heatmap_data_converter.ts +++ b/public/app/plugins/panel/heatmap/heatmap_data_converter.ts @@ -253,7 +253,7 @@ function convertToHeatMap(seriesList, yBucketSize, xBucketSize, logBase = 1) { // |* | --/ |1|, // |____| |0| // - _.forEach(heatmap, xBucket => { + _.forEach(heatmap, (xBucket: any) => { if (logBase !== 1) { xBucket.buckets = convertToLogScaleValueBuckets(xBucket, yBucketSize, logBase); } else { diff --git a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts index 90cbecd6657..62f1514aac4 100644 --- a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts +++ b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts @@ -81,7 +81,7 @@ export class HeatmapTooltip { let boundBottom, boundTop, valuesNumber; const xData = data.buckets[xBucketIndex]; // Search in special 'zero' bucket also - const yData = _.find(xData.buckets, (bucket, bucketIndex) => { + const yData: any = _.find(xData.buckets, (bucket, bucketIndex) => { return bucket.bounds.bottom === yBucketIndex || bucketIndex === yBucketIndex.toString(); }); @@ -161,7 +161,7 @@ export class HeatmapTooltip { getXBucketIndex(x, data) { // First try to find X bucket by checking x pos is in the // [bucket.x, bucket.x + xBucketSize] interval - const xBucket = _.find(data.buckets, bucket => { + const xBucket: any = _.find(data.buckets, bucket => { return x > bucket.x && x - bucket.x <= data.xBucketSize; }); return xBucket ? xBucket.x : getValueBucketBound(x, data.xBucketSize, 1); diff --git a/public/app/plugins/panel/heatmap/rendering.ts b/public/app/plugins/panel/heatmap/rendering.ts index 41ba7d98e1f..91bf5ae85bb 100644 --- a/public/app/plugins/panel/heatmap/rendering.ts +++ b/public/app/plugins/panel/heatmap/rendering.ts @@ -529,7 +529,7 @@ export class HeatmapRenderer { const minValueAuto = Math.min(cardStats.min, 0); const maxValue = _.isNil(this.panel.color.max) ? maxValueAuto : this.panel.color.max; const minValue = _.isNil(this.panel.color.min) ? minValueAuto : this.panel.color.min; - const colorScheme = _.find(this.ctrl.colorSchemes, { + const colorScheme: any = _.find(this.ctrl.colorSchemes, { value: this.panel.color.colorScheme, }); this.colorScale = getColorScale(colorScheme, contextSrv.user.lightTheme, maxValue, minValue); diff --git a/public/app/plugins/panel/table/editor.ts b/public/app/plugins/panel/table/editor.ts index 30938a03b85..2b6741acb13 100644 --- a/public/app/plugins/panel/table/editor.ts +++ b/public/app/plugins/panel/table/editor.ts @@ -52,7 +52,7 @@ export class TablePanelEditorCtrl { addColumn() { const columns = transformers[this.panel.transform].getColumns(this.panelCtrl.dataRaw); - const column = _.find(columns, { text: this.addColumnSegment.value }); + const column: any = _.find(columns, { text: this.addColumnSegment.value }); if (column) { this.panel.columns.push(column); diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index 59cb0941b4c..c14e0312737 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -101,7 +101,7 @@ export class TableRenderer { } // if is an epoch (numeric string and len > 12) - if (_.isString(v) && !isNaN(v) && v.length > 12) { + if (_.isString(v) && !isNaN(v as any) && v.length > 12) { v = parseInt(v, 10); } diff --git a/public/app/plugins/panel/table/transformers.ts b/public/app/plugins/panel/table/transformers.ts index c56d385505b..dac63a935a0 100644 --- a/public/app/plugins/panel/table/transformers.ts +++ b/public/app/plugins/panel/table/transformers.ts @@ -154,7 +154,7 @@ transformers['table'] = { return columns; }, - transform: (data, panel, model) => { + transform: (data: any[], panel, model) => { if (!data || data.length === 0) { return; } diff --git a/yarn.lock b/yarn.lock index 301b9009602..9142454b2cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2333,6 +2333,11 @@ resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.35.tgz#4e5c2b1e5b3bf0b863efb8c5e70081f52e6c9518" integrity sha512-SVtqEcudm7yjkTwoRA1gC6CNMhGDdMx4Pg8BPdiqI7bXXdCn1BPmtxgeWYQOgDxrq53/5YTlhq5ULxBEAlWIBg== +"@types/lodash@4.14.123": + version "4.14.123" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.123.tgz#39be5d211478c8dd3bdae98ee75bb7efe4abfe4d" + integrity sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q== + "@types/lodash@^4.14.119": version "4.14.119" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.119.tgz#be847e5f4bc3e35e46d041c394ead8b603ad8b39"