From ca3dff99e81cecbfa1332112c6c16309788d17dd Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Tue, 19 Nov 2019 13:59:39 +0000 Subject: [PATCH] Chore: Bumps prettier version for new typescript syntax support (#20463) * Chore: Bumps prettier version for new typescript syntax support * Ran new version of prettier against the codebase --- package.json | 2 +- .../src/dataframe/processDataFrame.test.ts | 42 +- .../src/transformations/fieldReducer.test.ts | 6 +- .../grafana-data/src/utils/flotPairs.test.ts | 13 +- packages/grafana-data/src/utils/flotPairs.ts | 5 +- packages/grafana-data/src/utils/labels.ts | 49 +- .../grafana-data/src/utils/valueMappings.ts | 19 +- .../src/cli/tasks/core.start.ts | 9 +- .../src/components/BarGauge/BarGauge.test.tsx | 6 +- .../components/BigValue/BigValue.story.tsx | 9 +- .../components/Cascader/Cascader.story.tsx | 9 +- .../src/components/Forms/Button.tsx | 9 +- .../src/components/Graph/Graph.story.tsx | 12 +- .../src/components/Graph/Graph.test.tsx | 12 +- .../grafana-ui/src/components/Graph/Graph.tsx | 10 +- .../src/components/Graph/GraphLegend.tsx | 5 +- .../GraphTooltip/MultiModeGraphTooltip.tsx | 10 +- .../Graph/GraphWithLegend.story.tsx | 12 +- .../src/components/List/AbstractList.test.tsx | 12 +- .../src/components/Logs/LogDetails.tsx | 111 ++--- .../src/components/Table/examples.ts | 6 +- .../ThresholdsEditor.story.tsx | 5 +- .../FilterByRefIdTransformerEditor.tsx | 4 +- .../ValueMappingsEditor.tsx | 7 +- packages/grafana-ui/src/utils/validate.ts | 15 +- .../app/core/components/Login/LoginCtrl.tsx | 7 +- .../SharedPreferences/SharedPreferences.tsx | 6 +- public/app/core/specs/file_export.test.ts | 7 +- public/app/core/specs/search.test.ts | 20 +- public/app/core/specs/search_srv.test.ts | 17 +- public/app/core/specs/table_model.test.ts | 28 +- public/app/core/specs/time_series.test.ts | 109 +++- public/app/core/table_model.ts | 101 ++-- .../app/features/admin/ServerStats.test.tsx | 5 +- public/app/features/admin/ldap/LdapPage.tsx | 7 +- .../app/features/admin/ldap/LdapUserPage.tsx | 7 +- .../app/features/alerting/AlertRuleList.tsx | 7 +- public/app/features/alerting/AlertTab.tsx | 7 +- .../app/features/alerting/state/alertDef.ts | 10 +- .../annotations/annotation_tooltip.ts | 4 +- .../app/features/annotations/editor_ctrl.ts | 5 +- .../specs/annotations_srv_specs.test.ts | 12 +- public/app/features/api-keys/ApiKeysPage.tsx | 7 +- .../dashboard/components/DashNav/DashNav.tsx | 5 +- .../dashboard/containers/DashboardPage.tsx | 7 +- .../dashboard/containers/SoloPanelPage.tsx | 7 +- .../dashboard/panel_editor/PanelEditor.tsx | 7 +- .../dashboard/state/DashboardMigrator.test.ts | 5 +- .../state/DashboardModel.repeat.test.ts | 5 +- .../features/dashboard/state/PanelModel.ts | 13 +- .../dashboard/state/PanelQueryRunner.test.ts | 10 +- .../features/dashboard/state/runRequest.ts | 8 +- .../datasources/DataSourceDashboards.tsx | 7 +- .../datasources/DataSourcesListPage.tsx | 7 +- .../datasources/NewDataSourcePage.tsx | 24 +- .../settings/DataSourceSettingsPage.tsx | 7 +- public/app/features/explore/Explore.tsx | 5 +- .../features/explore/ExploreGraphPanel.tsx | 7 +- .../app/features/explore/ExploreToolbar.tsx | 7 +- public/app/features/explore/LogsContainer.tsx | 7 +- public/app/features/explore/QueryRow.tsx | 7 +- .../app/features/explore/TableContainer.tsx | 7 +- public/app/features/explore/Wrapper.tsx | 7 +- .../features/explore/__mocks__/mockData.ts | 162 +++++- .../explore/utils/ResultProcessor.test.ts | 18 +- .../features/folders/FolderPermissions.tsx | 7 +- .../features/folders/FolderSettingsPage.tsx | 7 +- .../manage-dashboards/DashboardImportCtrl.ts | 4 +- public/app/features/org/OrgDetailsPage.tsx | 7 +- .../playlist/specs/playlist_edit_ctrl.test.ts | 10 +- .../playlist/specs/playlist_srv.test.ts | 20 +- .../app/features/plugins/PluginListPage.tsx | 9 +- .../app/features/plugins/built_in_plugins.ts | 4 +- .../features/profile/ChangePasswordPage.tsx | 7 +- public/app/features/teams/TeamGroupSync.tsx | 5 +- public/app/features/teams/TeamMemberRow.tsx | 5 +- public/app/features/teams/TeamMembers.tsx | 5 +- public/app/features/teams/TeamPages.tsx | 7 +- public/app/features/teams/TeamSettings.tsx | 5 +- public/app/features/templating/editor_ctrl.ts | 6 +- public/app/features/users/InviteeRow.tsx | 9 +- public/app/features/users/UsersActionBar.tsx | 5 +- public/app/features/users/UsersListPage.tsx | 7 +- .../cloudwatch/specs/datasource.test.ts | 12 +- .../datasource/elasticsearch/query_def.ts | 15 +- .../specs/elastic_response.test.ts | 66 ++- .../elasticsearch/specs/query_builder.test.ts | 15 +- .../elasticsearch/specs/query_def.test.ts | 10 +- .../app_insights_datasource.test.ts | 15 +- .../azure_log_analytics_datasource.test.ts | 5 +- .../azure_monitor_datasource.test.ts | 5 +- .../azure_monitor/azure_monitor_datasource.ts | 8 +- .../components/AnalyticsConfig.tsx | 3 +- .../query_ctrl.test.ts | 25 +- .../query_ctrl.ts | 5 +- .../app/plugins/datasource/grafana/module.ts | 5 +- .../app/plugins/datasource/graphite/gfunc.ts | 21 +- .../plugins/datasource/graphite/query_ctrl.ts | 8 +- .../graphite/specs/datasource.test.ts | 10 +- .../graphite/specs/graphite_query.test.ts | 5 +- .../influxdb/components/ConfigEditor.tsx | 5 +- .../components/InfluxLogsQueryField.tsx | 12 +- .../plugins/datasource/influxdb/datasource.ts | 80 ++- .../datasource/influxdb/influx_query_model.ts | 12 +- .../plugins/datasource/influxdb/query_ctrl.ts | 5 +- .../influxdb/specs/influx_query_model.test.ts | 20 +- .../influxdb/specs/influx_series.test.ts | 35 +- .../influxdb/specs/query_builder.test.ts | 10 +- .../influxdb/specs/response_parser.test.ts | 16 +- .../plugins/datasource/mssql/query_ctrl.ts | 5 +- .../datasource/mssql/specs/datasource.test.ts | 18 +- .../plugins/datasource/mysql/query_ctrl.ts | 5 +- .../datasource/mysql/specs/datasource.test.ts | 30 +- .../datasource/opentsdb/config_ctrl.ts | 11 +- .../opentsdb/specs/datasource.test.ts | 10 +- .../plugins/datasource/postgres/query_ctrl.ts | 5 +- .../postgres/specs/datasource.test.ts | 30 +- .../postgres/specs/postgres_query.test.ts | 15 +- .../prometheus/configuration/PromSettings.tsx | 5 +- .../prometheus/specs/datasource.test.ts | 56 ++- .../prometheus/specs/query_hints.test.ts | 62 ++- .../specs/result_transformer.test.ts | 116 ++++- public/app/plugins/panel/alertlist/module.ts | 5 +- .../panel/graph/specs/align_yaxes.test.ts | 230 +++++++-- .../panel/graph/specs/data_processor.test.ts | 6 +- .../plugins/panel/graph/specs/graph.test.ts | 469 +++++++++++++++--- .../panel/graph/specs/graph_ctrl.test.ts | 15 +- .../panel/graph/specs/graph_tooltip.test.ts | 99 +++- .../panel/graph/specs/histogram.test.ts | 25 +- .../graph/specs/threshold_manager.test.ts | 10 +- .../plugins/panel/graph2/GraphPanelEditor.tsx | 5 +- .../plugins/panel/heatmap/heatmap_tooltip.ts | 6 +- .../panel/heatmap/specs/heatmap_ctrl.test.ts | 15 +- .../specs/heatmap_data_converter.test.ts | 33 +- .../panel/piechart/PieChartOptionsBox.tsx | 5 +- public/app/plugins/panel/singlestat/module.ts | 5 +- .../panel/singlestat/specs/singlestat.test.ts | 110 +++- .../app/plugins/panel/table/column_options.ts | 5 +- .../panel/table/specs/transformers.test.ts | 55 +- public/app/routes/routes.ts | 4 +- yarn.lock | 13 +- 141 files changed, 2277 insertions(+), 867 deletions(-) diff --git a/package.json b/package.json index d1c0a619d0b..b916709164b 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "postcss-browser-reporter": "0.5.0", "postcss-loader": "3.0.0", "postcss-reporter": "6.0.1", - "prettier": "1.16.4", + "prettier": "1.19.1", "puppeteer-core": "1.15.0", "react-hooks-testing-library": "0.3.7", "react-hot-loader": "4.8.0", diff --git a/packages/grafana-data/src/dataframe/processDataFrame.test.ts b/packages/grafana-data/src/dataframe/processDataFrame.test.ts index 040851b97f4..04a72ad43b5 100644 --- a/packages/grafana-data/src/dataframe/processDataFrame.test.ts +++ b/packages/grafana-data/src/dataframe/processDataFrame.test.ts @@ -15,7 +15,10 @@ describe('toDataFrame', () => { it('converts timeseries to series', () => { const input1 = { target: 'Field Name', - datapoints: [[100, 1], [200, 2]], + datapoints: [ + [100, 1], + [200, 2], + ], }; let series = toDataFrame(input1); expect(series.fields[0].name).toBe(input1.target); @@ -33,7 +36,10 @@ describe('toDataFrame', () => { const input2 = { // without target target: '', - datapoints: [[100, 1], [200, 2]], + datapoints: [ + [100, 1], + [200, 2], + ], }; series = toDataFrame(input2); expect(series.fields[0].name).toEqual('Value'); @@ -42,7 +48,10 @@ describe('toDataFrame', () => { it('assumes TimeSeries values are numbers', () => { const input1 = { target: 'time', - datapoints: [[100, 1], [200, 2]], + datapoints: [ + [100, 1], + [200, 2], + ], }; const data = toDataFrame(input1); expect(data.fields[0].type).toBe(FieldType.number); @@ -50,7 +59,10 @@ describe('toDataFrame', () => { it('keeps dataFrame unchanged', () => { const input = toDataFrame({ - datapoints: [[100, 1], [200, 2]], + datapoints: [ + [100, 1], + [200, 2], + ], }); expect(input.length).toEqual(2); @@ -71,7 +83,11 @@ describe('toDataFrame', () => { it('migrate from 6.3 style rows', () => { const oldDataFrame = { fields: [{ name: 'A' }, { name: 'B' }, { name: 'C' }], - rows: [[100, 'A', 1], [200, 'B', 2], [300, 'C', 3]], + rows: [ + [100, 'A', 1], + [200, 'B', 2], + [300, 'C', 3], + ], }; const data = toDataFrame(oldDataFrame); expect(data.length).toBe(oldDataFrame.rows.length); @@ -149,7 +165,10 @@ describe('SerisData backwards compatibility', () => { it('can convert TimeSeries to series and back again', () => { const timeseries = { target: 'Field Name', - datapoints: [[100, 1], [200, 2]], + datapoints: [ + [100, 1], + [200, 2], + ], }; const series = toDataFrame(timeseries); expect(isDataFrame(timeseries)).toBeFalsy(); @@ -175,8 +194,15 @@ describe('SerisData backwards compatibility', () => { it('converts TableData to series and back again', () => { const table = { - columns: [{ text: 'a', unit: 'ms' }, { text: 'b', unit: 'zz' }, { text: 'c', unit: 'yy' }], - rows: [[100, 1, 'a'], [200, 2, 'a']], + columns: [ + { text: 'a', unit: 'ms' }, + { text: 'b', unit: 'zz' }, + { text: 'c', unit: 'yy' }, + ], + rows: [ + [100, 1, 'a'], + [200, 2, 'a'], + ], }; const series = toDataFrame(table); expect(isTableData(table)).toBeTruthy(); diff --git a/packages/grafana-data/src/transformations/fieldReducer.test.ts b/packages/grafana-data/src/transformations/fieldReducer.test.ts index d98e9edcbb8..0f921f47757 100644 --- a/packages/grafana-data/src/transformations/fieldReducer.test.ts +++ b/packages/grafana-data/src/transformations/fieldReducer.test.ts @@ -26,7 +26,11 @@ function createField(name: string, values?: T[], type?: FieldType): Field describe('Stats Calculators', () => { const basicTable = new MutableDataFrame({ - fields: [{ name: 'a', values: [10, 20] }, { name: 'b', values: [20, 30] }, { name: 'c', values: [30, 40] }], + fields: [ + { name: 'a', values: [10, 20] }, + { name: 'b', values: [20, 30] }, + { name: 'c', values: [30, 40] }, + ], }); it('should load all standard stats', () => { diff --git a/packages/grafana-data/src/utils/flotPairs.test.ts b/packages/grafana-data/src/utils/flotPairs.test.ts index 74a13b2d6e5..69dc3e137a3 100644 --- a/packages/grafana-data/src/utils/flotPairs.test.ts +++ b/packages/grafana-data/src/utils/flotPairs.test.ts @@ -56,7 +56,16 @@ describe('getFlotPairsConstant', () => { it('should return an constant series for range', () => { const range: TimeRange = makeRange(0, 1); - const pairs = getFlotPairsConstant([[2, 123], [4, 456]], range); - expect(pairs).toMatchObject([[0, 123], [1, 123]]); + const pairs = getFlotPairsConstant( + [ + [2, 123], + [4, 456], + ], + range + ); + expect(pairs).toMatchObject([ + [0, 123], + [1, 123], + ]); }); }); diff --git a/packages/grafana-data/src/utils/flotPairs.ts b/packages/grafana-data/src/utils/flotPairs.ts index cca20b57abb..0a4f6a8a41d 100644 --- a/packages/grafana-data/src/utils/flotPairs.ts +++ b/packages/grafana-data/src/utils/flotPairs.ts @@ -61,5 +61,8 @@ export function getFlotPairsConstant(seriesData: GraphSeriesValue[][], range: Ti const from = range.from.valueOf(); const to = range.to.valueOf(); const value = seriesData[0][1]; - return [[from, value], [to, value]]; + return [ + [from, value], + [to, value], + ]; } diff --git a/packages/grafana-data/src/utils/labels.ts b/packages/grafana-data/src/utils/labels.ts index c2a94a1aaa4..4724480282f 100644 --- a/packages/grafana-data/src/utils/labels.ts +++ b/packages/grafana-data/src/utils/labels.ts @@ -23,32 +23,29 @@ export function parseLabels(labels: string): Labels { * Returns a map labels that are common to the given label sets. */ export function findCommonLabels(labelsSets: Labels[]): Labels { - return labelsSets.reduce( - (acc, labels) => { - if (!labels) { - throw new Error('Need parsed labels to find common labels.'); - } - if (!acc) { - // Initial set - acc = { ...labels }; - } else { - // Remove incoming labels that are missing or not matching in value - Object.keys(labels).forEach(key => { - if (acc[key] === undefined || acc[key] !== labels[key]) { - delete acc[key]; - } - }); - // Remove common labels that are missing from incoming label set - Object.keys(acc).forEach(key => { - if (labels[key] === undefined) { - delete acc[key]; - } - }); - } - return acc; - }, - (undefined as unknown) as Labels - ); + return labelsSets.reduce((acc, labels) => { + if (!labels) { + throw new Error('Need parsed labels to find common labels.'); + } + if (!acc) { + // Initial set + acc = { ...labels }; + } else { + // Remove incoming labels that are missing or not matching in value + Object.keys(labels).forEach(key => { + if (acc[key] === undefined || acc[key] !== labels[key]) { + delete acc[key]; + } + }); + // Remove common labels that are missing from incoming label set + Object.keys(acc).forEach(key => { + if (labels[key] === undefined) { + delete acc[key]; + } + }); + } + return acc; + }, (undefined as unknown) as Labels); } /** diff --git a/packages/grafana-data/src/utils/valueMappings.ts b/packages/grafana-data/src/utils/valueMappings.ts index 836abc7ae80..d9409d8086f 100644 --- a/packages/grafana-data/src/utils/valueMappings.ts +++ b/packages/grafana-data/src/utils/valueMappings.ts @@ -64,18 +64,15 @@ const addRangeToTextMappingText = ( }; const getAllFormattedValueMappings = (valueMappings: ValueMapping[], value: TimeSeriesValue) => { - const allFormattedValueMappings = valueMappings.reduce( - (allValueMappings, valueMapping) => { - if (valueMapping.type === MappingType.ValueToText) { - allValueMappings = addValueToTextMappingText(allValueMappings, valueMapping as ValueMap, value); - } else if (valueMapping.type === MappingType.RangeToText) { - allValueMappings = addRangeToTextMappingText(allValueMappings, valueMapping as RangeMap, value); - } + const allFormattedValueMappings = valueMappings.reduce((allValueMappings, valueMapping) => { + if (valueMapping.type === MappingType.ValueToText) { + allValueMappings = addValueToTextMappingText(allValueMappings, valueMapping as ValueMap, value); + } else if (valueMapping.type === MappingType.RangeToText) { + allValueMappings = addRangeToTextMappingText(allValueMappings, valueMapping as RangeMap, value); + } - return allValueMappings; - }, - [] as ValueMapping[] - ); + return allValueMappings; + }, [] as ValueMapping[]); allFormattedValueMappings.sort((t1, t2) => { return t1.id - t2.id; diff --git a/packages/grafana-toolkit/src/cli/tasks/core.start.ts b/packages/grafana-toolkit/src/cli/tasks/core.start.ts index bae4364f2d4..0e8f05f4cc7 100644 --- a/packages/grafana-toolkit/src/cli/tasks/core.start.ts +++ b/packages/grafana-toolkit/src/cli/tasks/core.start.ts @@ -27,9 +27,12 @@ const startTaskRunner: TaskRunner = async ({ watchThemes, noTs ]; try { - await concurrently(jobs.filter(job => !!job), { - killOthers: ['failure', 'failure'], - }); + await concurrently( + jobs.filter(job => !!job), + { + killOthers: ['failure', 'failure'], + } + ); } catch (e) { console.error(e); process.exit(1); diff --git a/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx b/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx index f7872d50273..447e93886cc 100644 --- a/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx +++ b/packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx @@ -26,7 +26,11 @@ function getProps(propOverrides?: Partial): Props { maxValue: 100, minValue: 0, displayMode: 'basic', - thresholds: [{ value: -Infinity, color: 'green' }, { value: 70, color: 'orange' }, { value: 90, color: 'red' }], + thresholds: [ + { value: -Infinity, color: 'green' }, + { value: 70, color: 'orange' }, + { value: 90, color: 'red' }, + ], height: 300, width: 300, value: { diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx index 6fba62e6017..25ad8f218b7 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.story.tsx @@ -39,7 +39,14 @@ function addStoryForMode(options: StoryOptions) { sparkline: { minX: 0, maxX: 5, - data: [[0, 10], [1, 20], [2, 15], [3, 25], [4, 5], [5, 10]], + data: [ + [0, 10], + [1, 20], + [2, 15], + [3, 25], + [4, 5], + [5, 10], + ], }, }); }); diff --git a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx index 3133afce19b..4b171d7dd2b 100644 --- a/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx +++ b/packages/grafana-ui/src/components/Cascader/Cascader.story.tsx @@ -9,7 +9,14 @@ const getKnobs = () => { disabled: boolean('Disabled', false), text: text('Button Text', 'Click me!'), options: object('Options', [ - { label: 'A', value: 'A', children: [{ label: 'B', value: 'B' }, { label: 'C', value: 'C' }] }, + { + label: 'A', + value: 'A', + children: [ + { label: 'B', value: 'B' }, + { label: 'C', value: 'C' }, + ], + }, { label: 'D', value: 'D' }, ]), }; diff --git a/packages/grafana-ui/src/components/Forms/Button.tsx b/packages/grafana-ui/src/components/Forms/Button.tsx index 9bdb2af08a3..c9bc7df0fec 100644 --- a/packages/grafana-ui/src/components/Forms/Button.tsx +++ b/packages/grafana-ui/src/components/Forms/Button.tsx @@ -71,10 +71,11 @@ const getPropertiesForVariant = (theme: GrafanaTheme, variant: ButtonVariant) => return { borderColor: selectThemeVariant({ light: theme.colors.gray70, dark: theme.colors.gray33 }, theme.type), - background: buttonVariantStyles(from, to, selectThemeVariant( - { light: theme.colors.gray25, dark: theme.colors.gray4 }, - theme.type - ) as string), + background: buttonVariantStyles( + from, + to, + selectThemeVariant({ light: theme.colors.gray25, dark: theme.colors.gray4 }, theme.type) as string + ), }; case 'destructive': diff --git a/packages/grafana-ui/src/components/Graph/Graph.story.tsx b/packages/grafana-ui/src/components/Graph/Graph.story.tsx index 5c3ef82062a..64d623f6338 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.story.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.story.tsx @@ -28,7 +28,11 @@ const getKnobs = () => { const series: GraphSeriesXY[] = [ { - data: [[1546372800000, 10], [1546376400000, 20], [1546380000000, 10]], + data: [ + [1546372800000, 10], + [1546376400000, 20], + [1546380000000, 10], + ], color: 'red', isVisible: true, label: 'A-series', @@ -51,7 +55,11 @@ const series: GraphSeriesXY[] = [ }, }, { - data: [[1546372800000, 20], [1546376400000, 30], [1546380000000, 40]], + data: [ + [1546372800000, 20], + [1546376400000, 30], + [1546380000000, 40], + ], color: 'blue', isVisible: true, label: diff --git a/packages/grafana-ui/src/components/Graph/Graph.test.tsx b/packages/grafana-ui/src/components/Graph/Graph.test.tsx index ac6e40883e7..8098ffdedf1 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.test.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.test.tsx @@ -6,7 +6,11 @@ import { GraphSeriesXY, FieldType, ArrayVector, dateTime } from '@grafana/data'; const series: GraphSeriesXY[] = [ { - data: [[1546372800000, 10], [1546376400000, 20], [1546380000000, 10]], + data: [ + [1546372800000, 10], + [1546376400000, 20], + [1546380000000, 10], + ], color: 'red', isVisible: true, label: 'A-series', @@ -29,7 +33,11 @@ const series: GraphSeriesXY[] = [ }, }, { - data: [[1546372800000, 20], [1546376400000, 30], [1546380000000, 40]], + data: [ + [1546372800000, 20], + [1546376400000, 30], + [1546380000000, 40], + ], color: 'blue', isVisible: true, label: 'B-series', diff --git a/packages/grafana-ui/src/components/Graph/Graph.tsx b/packages/grafana-ui/src/components/Graph/Graph.tsx index d3aac9497be..1416c21114f 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.tsx @@ -157,8 +157,14 @@ export class Graph extends PureComponent { const tooltipContentProps: TooltipContentProps = { dimensions: { // time/value dimension columns are index-aligned - see getGraphSeriesModel - xAxis: createDimension('xAxis', series.map(s => s.timeField)), - yAxis: createDimension('yAxis', series.map(s => s.valueField)), + xAxis: createDimension( + 'xAxis', + series.map(s => s.timeField) + ), + yAxis: createDimension( + 'yAxis', + series.map(s => s.valueField) + ), }, activeDimensions, pos, diff --git a/packages/grafana-ui/src/components/Graph/GraphLegend.tsx b/packages/grafana-ui/src/components/Graph/GraphLegend.tsx index 5b7a0251e05..2e44ba4e304 100644 --- a/packages/grafana-ui/src/components/Graph/GraphLegend.tsx +++ b/packages/grafana-ui/src/components/Graph/GraphLegend.tsx @@ -43,7 +43,10 @@ export const GraphLegend: React.FunctionComponent = ({ }) .reduce( (acc, current) => { - return union(acc, current.filter(item => !!item)); + return union( + acc, + current.filter(item => !!item) + ); }, [''] ) as string[]; diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx b/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx index b77db2f40a2..deed5b94f70 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx +++ b/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx @@ -5,12 +5,10 @@ import { getMultiSeriesGraphHoverInfo } from '../utils'; import { FlotPosition } from '../types'; import { getValueFromDimension } from '@grafana/data'; -export const MultiModeGraphTooltip: React.FC< - GraphTooltipContentProps & { - // We expect position to figure out correct values when not hovering over a datapoint - pos: FlotPosition; - } -> = ({ dimensions, activeDimensions, pos }) => { +export const MultiModeGraphTooltip: React.FC = ({ dimensions, activeDimensions, pos }) => { let activeSeriesIndex: number | null = null; // when no x-axis provided, skip rendering if (activeDimensions.xAxis === null) { diff --git a/packages/grafana-ui/src/components/Graph/GraphWithLegend.story.tsx b/packages/grafana-ui/src/components/Graph/GraphWithLegend.story.tsx index 044c0e6a4e8..767ca5c8c9e 100644 --- a/packages/grafana-ui/src/components/Graph/GraphWithLegend.story.tsx +++ b/packages/grafana-ui/src/components/Graph/GraphWithLegend.story.tsx @@ -12,7 +12,11 @@ GraphWithLegendStories.addDecorator(withHorizontallyCenteredStory); const series: GraphSeriesXY[] = [ { - data: [[1546372800000, 10], [1546376400000, 20], [1546380000000, 10]], + data: [ + [1546372800000, 10], + [1546376400000, 20], + [1546380000000, 10], + ], color: 'red', isVisible: true, label: 'A-series', @@ -35,7 +39,11 @@ const series: GraphSeriesXY[] = [ }, }, { - data: [[1546372800000, 20], [1546376400000, 30], [1546380000000, 40]], + data: [ + [1546372800000, 20], + [1546376400000, 30], + [1546380000000, 40], + ], color: 'blue', isVisible: true, label: 'B-series', diff --git a/packages/grafana-ui/src/components/List/AbstractList.test.tsx b/packages/grafana-ui/src/components/List/AbstractList.test.tsx index f38b7cd2988..8a2b6db3634 100644 --- a/packages/grafana-ui/src/components/List/AbstractList.test.tsx +++ b/packages/grafana-ui/src/components/List/AbstractList.test.tsx @@ -4,7 +4,11 @@ import { AbstractList } from './AbstractList'; describe('AbstractList', () => { it('renders items using renderItem prop function', () => { - const items = [{ name: 'Item 1', id: 'item1' }, { name: 'Item 2', id: 'item2' }, { name: 'Item 3', id: 'item3' }]; + const items = [ + { name: 'Item 1', id: 'item1' }, + { name: 'Item 2', id: 'item2' }, + { name: 'Item 3', id: 'item3' }, + ]; const list = shallow( { }); it('allows custom item key', () => { - const items = [{ name: 'Item 1', id: 'item1' }, { name: 'Item 2', id: 'item2' }, { name: 'Item 3', id: 'item3' }]; + const items = [ + { name: 'Item 1', id: 'item1' }, + { name: 'Item 2', id: 'item2' }, + { name: 'Item 3', id: 'item3' }, + ]; const list = shallow( { getParser = memoizeOne(getParser); - parseMessage = memoizeOne( - (rowEntry): FieldDef[] => { - const parser = this.getParser(rowEntry); - if (!parser) { - return []; - } - // Use parser to highlight detected fields - const parsedFields = parser.getFields(rowEntry); - const fields = parsedFields.map(field => { - const key = parser.getLabelFromField(field); - const value = parser.getValueFromField(field); - return { key, value }; - }); - - return fields; + parseMessage = memoizeOne((rowEntry): FieldDef[] => { + const parser = this.getParser(rowEntry); + if (!parser) { + return []; } - ); + // Use parser to highlight detected fields + const parsedFields = parser.getFields(rowEntry); + const fields = parsedFields.map(field => { + const key = parser.getLabelFromField(field); + const value = parser.getValueFromField(field); + return { key, value }; + }); - getDerivedFields = memoizeOne( - (row: LogRowModel): FieldDef[] => { - return ( - row.dataFrame.fields - .map((field, index) => ({ ...field, index })) - // Remove Id which we use for react key and entry field which we are showing as the log message. - .filter((field, index) => 'id' !== field.name && row.entryFieldIndex !== index) - // Filter out fields without values. For example in elastic the fields are parsed from the document which can - // have different structure per row and so the dataframe is pretty sparse. - .filter(field => { - const value = field.values.get(row.rowIndex); - // Not sure exactly what will be the empty value here. And we want to keep 0 as some values can be non - // string. - return value !== null && value !== undefined; - }) - .map(field => { - const { getFieldLinks } = this.props; - const links = getFieldLinks ? getFieldLinks(field, row.rowIndex) : []; - return { - key: field.name, - value: field.values.get(row.rowIndex).toString(), - links: links.map(link => link.href), - fieldIndex: field.index, - }; - }) - ); - } - ); + return fields; + }); + + getDerivedFields = memoizeOne((row: LogRowModel): FieldDef[] => { + return ( + row.dataFrame.fields + .map((field, index) => ({ ...field, index })) + // Remove Id which we use for react key and entry field which we are showing as the log message. + .filter((field, index) => 'id' !== field.name && row.entryFieldIndex !== index) + // Filter out fields without values. For example in elastic the fields are parsed from the document which can + // have different structure per row and so the dataframe is pretty sparse. + .filter(field => { + const value = field.values.get(row.rowIndex); + // Not sure exactly what will be the empty value here. And we want to keep 0 as some values can be non + // string. + return value !== null && value !== undefined; + }) + .map(field => { + const { getFieldLinks } = this.props; + const links = getFieldLinks ? getFieldLinks(field, row.rowIndex) : []; + return { + key: field.name, + value: field.values.get(row.rowIndex).toString(), + links: links.map(link => link.href), + fieldIndex: field.index, + }; + }) + ); + }); getAllFields = memoizeOne((row: LogRowModel) => { const fields = this.parseMessage(row.entry); const derivedFields = this.getDerivedFields(row); - const fieldsMap = [...derivedFields, ...fields].reduce( - (acc, field) => { - // Strip enclosing quotes for hashing. When values are parsed from log line the quotes are kept, but if same - // value is in the dataFrame it will be without the quotes. We treat them here as the same value. - const value = field.value.replace(/(^")|("$)/g, ''); - const fieldHash = `${field.key}=${value}`; - if (acc[fieldHash]) { - acc[fieldHash].links = [...(acc[fieldHash].links || []), ...(field.links || [])]; - } else { - acc[fieldHash] = field; - } - return acc; - }, - {} as { [key: string]: FieldDef } - ); + const fieldsMap = [...derivedFields, ...fields].reduce((acc, field) => { + // Strip enclosing quotes for hashing. When values are parsed from log line the quotes are kept, but if same + // value is in the dataFrame it will be without the quotes. We treat them here as the same value. + const value = field.value.replace(/(^")|("$)/g, ''); + const fieldHash = `${field.key}=${value}`; + if (acc[fieldHash]) { + acc[fieldHash].links = [...(acc[fieldHash].links || []), ...(field.links || [])]; + } else { + acc[fieldHash] = field; + } + return acc; + }, {} as { [key: string]: FieldDef }); return Object.values(fieldsMap); }); diff --git a/packages/grafana-ui/src/components/Table/examples.ts b/packages/grafana-ui/src/components/Table/examples.ts index 7250490edea..df8ad7ddc6b 100644 --- a/packages/grafana-ui/src/components/Table/examples.ts +++ b/packages/grafana-ui/src/components/Table/examples.ts @@ -161,5 +161,9 @@ export const migratedTestStyles: ColumnStyle[] = [ export const simpleTable = { type: 'table', fields: [{ name: 'First' }, { name: 'Second' }, { name: 'Third' }], - rows: [[701, 205, 305], [702, 206, 301], [703, 207, 304]], + rows: [ + [701, 205, 305], + [702, 206, 301], + [703, 207, 304], + ], }; diff --git a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.story.tsx b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.story.tsx index 8d6112130e7..4f42f1b89eb 100644 --- a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.story.tsx +++ b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.story.tsx @@ -5,7 +5,10 @@ import { action } from '@storybook/addon-actions'; import { ThresholdsEditor } from './ThresholdsEditor'; const ThresholdsEditorStories = storiesOf('UI/ThresholdsEditor', module); -const thresholds = [{ index: 0, value: -Infinity, color: 'green' }, { index: 1, value: 50, color: 'red' }]; +const thresholds = [ + { index: 0, value: -Infinity, color: 'green' }, + { index: 1, value: 50, color: 'red' }, +]; ThresholdsEditorStories.add('default', () => { return ; diff --git a/packages/grafana-ui/src/components/TransformersUI/FilterByRefIdTransformerEditor.tsx b/packages/grafana-ui/src/components/TransformersUI/FilterByRefIdTransformerEditor.tsx index 04450ff149b..7f3e039f9ec 100644 --- a/packages/grafana-ui/src/components/TransformersUI/FilterByRefIdTransformerEditor.tsx +++ b/packages/grafana-ui/src/components/TransformersUI/FilterByRefIdTransformerEditor.tsx @@ -159,9 +159,7 @@ const FilterPill: React.FC = ({ label, selected, onClick }) => ); }; -export const filterFramesByRefIdTransformRegistryItem: TransformerUIRegistyItem< - FilterFramesByRefIdTransformerOptions -> = { +export const filterFramesByRefIdTransformRegistryItem: TransformerUIRegistyItem = { id: DataTransformerID.filterByRefId, component: FilterByRefIdTransformerEditor, transformer: transformersRegistry.get(DataTransformerID.filterByRefId), diff --git a/packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx b/packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx index b6c57b28a62..3f65525254f 100644 --- a/packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx +++ b/packages/grafana-ui/src/components/ValueMappingsEditor/ValueMappingsEditor.tsx @@ -28,7 +28,12 @@ export class ValueMappingsEditor extends PureComponent { } getMaxIdFromValueMappings(mappings: ValueMapping[]) { - return Math.max.apply(null, mappings.map(mapping => mapping.id).map(m => m)) + 1; + return ( + Math.max.apply( + null, + mappings.map(mapping => mapping.id).map(m => m) + ) + 1 + ); } onAddMapping = () => diff --git a/packages/grafana-ui/src/utils/validate.ts b/packages/grafana-ui/src/utils/validate.ts index a3ca13e23ab..a40b2ec7df0 100644 --- a/packages/grafana-ui/src/utils/validate.ts +++ b/packages/grafana-ui/src/utils/validate.ts @@ -7,15 +7,12 @@ export enum EventsWithValidation { } export const validate = (value: string, validationRules: ValidationRule[]) => { - const errors = validationRules.reduce( - (acc, currRule) => { - if (!currRule.rule(value)) { - return acc.concat(currRule.errorMessage); - } - return acc; - }, - [] as string[] - ); + const errors = validationRules.reduce((acc, currRule) => { + if (!currRule.rule(value)) { + return acc.concat(currRule.errorMessage); + } + return acc; + }, [] as string[]); return errors.length > 0 ? errors : null; }; diff --git a/public/app/core/components/Login/LoginCtrl.tsx b/public/app/core/components/Login/LoginCtrl.tsx index 598d43fc3a6..cf5c385dca0 100644 --- a/public/app/core/components/Login/LoginCtrl.tsx +++ b/public/app/core/components/Login/LoginCtrl.tsx @@ -145,9 +145,4 @@ export const mapStateToProps = (state: StoreState) => ({ const mapDispatchToProps = { updateLocation }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(LoginCtrl) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(LoginCtrl)); diff --git a/public/app/core/components/SharedPreferences/SharedPreferences.tsx b/public/app/core/components/SharedPreferences/SharedPreferences.tsx index adaa75a640b..8d5ff6cb34b 100644 --- a/public/app/core/components/SharedPreferences/SharedPreferences.tsx +++ b/public/app/core/components/SharedPreferences/SharedPreferences.tsx @@ -16,7 +16,11 @@ export interface State { dashboards: DashboardSearchHit[]; } -const themes = [{ value: '', label: 'Default' }, { value: 'dark', label: 'Dark' }, { value: 'light', label: 'Light' }]; +const themes = [ + { value: '', label: 'Default' }, + { value: 'dark', label: 'Dark' }, + { value: 'light', label: 'Light' }, +]; const timezones = [ { value: '', label: 'Default' }, diff --git a/public/app/core/specs/file_export.test.ts b/public/app/core/specs/file_export.test.ts index fb2774618fb..2153b2bd01a 100644 --- a/public/app/core/specs/file_export.test.ts +++ b/public/app/core/specs/file_export.test.ts @@ -20,7 +20,12 @@ describe('file_export', () => { }, { alias: 'series_2', - datapoints: [[11, 1500026100000], [12, 1500026200000], [13, 1500026300000], [15, 1500026500000]], + datapoints: [ + [11, 1500026100000], + [12, 1500026200000], + [13, 1500026300000], + [15, 1500026500000], + ], }, ]; diff --git a/public/app/core/specs/search.test.ts b/public/app/core/specs/search.test.ts index 7dd99c1f415..76ad1a5bc54 100644 --- a/public/app/core/specs/search.test.ts +++ b/public/app/core/specs/search.test.ts @@ -56,7 +56,10 @@ describe('SearchCtrl', () => { { id: 0, title: 'General', - items: [{ id: 3, selected: false }, { id: 5, selected: false }], + items: [ + { id: 3, selected: false }, + { id: 5, selected: false }, + ], selected: false, expanded: true, toggle: (i: any) => (i.expanded = !i.expanded), @@ -145,7 +148,10 @@ describe('SearchCtrl', () => { { id: 1, title: 'folder', - items: [{ id: 2, selected: false }, { id: 4, selected: false }], + items: [ + { id: 2, selected: false }, + { id: 4, selected: false }, + ], selected: true, expanded: false, toggle: (i: any) => (i.expanded = !i.expanded), @@ -153,7 +159,10 @@ describe('SearchCtrl', () => { { id: 0, title: 'General', - items: [{ id: 3, selected: false }, { id: 5, selected: false }], + items: [ + { id: 3, selected: false }, + { id: 5, selected: false }, + ], selected: false, expanded: true, toggle: (i: any) => (i.expanded = !i.expanded), @@ -249,7 +258,10 @@ describe('SearchCtrl', () => { ctrl.results = [ { hideHeader: true, - items: [{ id: 3, selected: true }, { id: 5, selected: false }], + items: [ + { id: 3, selected: true }, + { id: 5, selected: false }, + ], selected: false, expanded: true, toggle: (i: any) => (i.expanded = !i.expanded), diff --git a/public/app/core/specs/search_srv.test.ts b/public/app/core/specs/search_srv.test.ts index 6566224c613..8d208a79d73 100644 --- a/public/app/core/specs/search_srv.test.ts +++ b/public/app/core/specs/search_srv.test.ts @@ -39,7 +39,10 @@ describe('SearchSrv', () => { backendSrvMock.search = jest .fn() .mockReturnValueOnce( - Promise.resolve([{ id: 2, title: 'second but first' }, { id: 1, title: 'first but second' }]) + Promise.resolve([ + { id: 2, title: 'second but first' }, + { id: 1, title: 'first but second' }, + ]) ) .mockReturnValue(Promise.resolve([])); @@ -65,7 +68,12 @@ describe('SearchSrv', () => { beforeEach(() => { backendSrvMock.search = jest .fn() - .mockReturnValueOnce(Promise.resolve([{ id: 2, title: 'two' }, { id: 1, title: 'one' }])) + .mockReturnValueOnce( + Promise.resolve([ + { id: 2, title: 'two' }, + { id: 1, title: 'one' }, + ]) + ) .mockReturnValue(Promise.resolve([])); impressionSrv.getDashboardOpened = jest.fn().mockReturnValue([4, 5, 1, 2, 3]); @@ -107,7 +115,10 @@ describe('SearchSrv', () => { backendSrvMock.search = jest .fn() .mockReturnValueOnce( - Promise.resolve([{ id: 1, title: 'starred and recent', isStarred: true }, { id: 2, title: 'recent' }]) + Promise.resolve([ + { id: 1, title: 'starred and recent', isStarred: true }, + { id: 2, title: 'recent' }, + ]) ) .mockReturnValue(Promise.resolve([{ id: 1, title: 'starred and recent' }])); diff --git a/public/app/core/specs/table_model.test.ts b/public/app/core/specs/table_model.test.ts index 6584d72762f..cee0f660483 100644 --- a/public/app/core/specs/table_model.test.ts +++ b/public/app/core/specs/table_model.test.ts @@ -10,7 +10,11 @@ describe('when sorting table desc', () => { table = new TableModel(); // @ts-ignore table.columns = [{}, {}]; - table.rows = [[100, 12], [105, 10], [103, 11]]; + table.rows = [ + [100, 12], + [105, 10], + [103, 11], + ]; table.sort(panel.sort); }); @@ -36,7 +40,11 @@ describe('when sorting table asc', () => { table = new TableModel(); // @ts-ignore table.columns = [{}, {}]; - table.rows = [[100, 11], [105, 15], [103, 10]]; + table.rows = [ + [100, 11], + [105, 15], + [103, 10], + ]; table.sort(panel.sort); }); @@ -55,7 +63,16 @@ describe('when sorting with nulls', () => { table = new TableModel(); // @ts-ignore table.columns = [{}, {}]; - table.rows = [[42, ''], [19, 'a'], [null, 'b'], [0, 'd'], [null, null], [2, 'c'], [0, null], [-8, '']]; + table.rows = [ + [42, ''], + [19, 'a'], + [null, 'b'], + [0, 'd'], + [null, null], + [2, 'c'], + [0, null], + [-8, ''], + ]; }); it('numbers with nulls at end with asc sort', () => { @@ -141,7 +158,10 @@ describe('mergeTables', () => { }), ({ target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], } as any) as TableModel, ]; diff --git a/public/app/core/specs/time_series.test.ts b/public/app/core/specs/time_series.test.ts index e2f91f27c44..5c163f0b0eb 100644 --- a/public/app/core/specs/time_series.test.ts +++ b/public/app/core/specs/time_series.test.ts @@ -9,7 +9,12 @@ describe('TimeSeries', () => { beforeEach(() => { testData = { alias: 'test', - datapoints: [[1, 2], [null, 3], [10, 4], [8, 5]], + datapoints: [ + [1, 2], + [null, 3], + [10, 4], + [8, 5], + ], }; }); @@ -29,7 +34,10 @@ describe('TimeSeries', () => { it('if last is null current should pick next to last', () => { series = new TimeSeries({ - datapoints: [[10, 1], [null, 2]], + datapoints: [ + [10, 1], + [null, 2], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.current).toBe(10); @@ -37,7 +45,10 @@ describe('TimeSeries', () => { it('max value should work for negative values', () => { series = new TimeSeries({ - datapoints: [[-10, 1], [-4, 2]], + datapoints: [ + [-10, 1], + [-4, 2], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.max).toBe(-4); @@ -51,7 +62,13 @@ describe('TimeSeries', () => { it('the delta value should account for nulls', () => { series = new TimeSeries({ - datapoints: [[1, 2], [3, 3], [null, 4], [10, 5], [15, 6]], + datapoints: [ + [1, 2], + [3, 3], + [null, 4], + [10, 5], + [15, 6], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.delta).toBe(14); @@ -59,7 +76,12 @@ describe('TimeSeries', () => { it('the delta value should account for nulls on first', () => { series = new TimeSeries({ - datapoints: [[null, 2], [1, 3], [10, 4], [15, 5]], + datapoints: [ + [null, 2], + [1, 3], + [10, 4], + [15, 5], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.delta).toBe(14); @@ -67,7 +89,12 @@ describe('TimeSeries', () => { it('the delta value should account for nulls on last', () => { series = new TimeSeries({ - datapoints: [[1, 2], [5, 3], [10, 4], [null, 5]], + datapoints: [ + [1, 2], + [5, 3], + [10, 4], + [null, 5], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.delta).toBe(9); @@ -75,7 +102,13 @@ describe('TimeSeries', () => { it('the delta value should account for resets', () => { series = new TimeSeries({ - datapoints: [[1, 2], [5, 3], [10, 4], [0, 5], [10, 6]], + datapoints: [ + [1, 2], + [5, 3], + [10, 4], + [0, 5], + [10, 6], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.delta).toBe(19); @@ -83,7 +116,12 @@ describe('TimeSeries', () => { it('the delta value should account for resets on last', () => { series = new TimeSeries({ - datapoints: [[1, 2], [2, 3], [10, 4], [8, 5]], + datapoints: [ + [1, 2], + [2, 3], + [10, 4], + [8, 5], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.delta).toBe(17); @@ -100,7 +138,12 @@ describe('TimeSeries', () => { series.getFlotPairs('null', yAxisFormats); expect(series.stats.first).toBe(1); series = new TimeSeries({ - datapoints: [[null, 2], [1, 3], [10, 4], [8, 5]], + datapoints: [ + [null, 2], + [1, 3], + [10, 4], + [8, 5], + ], }); series.getFlotPairs('null', yAxisFormats); expect(series.stats.first).toBe(1); @@ -114,7 +157,12 @@ describe('TimeSeries', () => { it('average value should be null if all values is null', () => { series = new TimeSeries({ - datapoints: [[null, 2], [null, 3], [null, 4], [null, 5]], + datapoints: [ + [null, 2], + [null, 3], + [null, 4], + [null, 5], + ], }); series.getFlotPairs('null'); expect(series.stats.avg).toBe(null); @@ -122,13 +170,21 @@ describe('TimeSeries', () => { it('calculates timeStep', () => { series = new TimeSeries({ - datapoints: [[null, 1], [null, 2], [null, 3]], + datapoints: [ + [null, 1], + [null, 2], + [null, 3], + ], }); series.getFlotPairs('null'); expect(series.stats.timeStep).toBe(1); series = new TimeSeries({ - datapoints: [[0, 1530529290], [0, 1530529305], [0, 1530529320]], + datapoints: [ + [0, 1530529290], + [0, 1530529305], + [0, 1530529320], + ], }); series.getFlotPairs('null'); expect(series.stats.timeStep).toBe(15); @@ -139,7 +195,10 @@ describe('TimeSeries', () => { describe('msResolution with second resolution timestamps', () => { beforeEach(() => { series = new TimeSeries({ - datapoints: [[45, 1234567890], [60, 1234567899]], + datapoints: [ + [45, 1234567890], + [60, 1234567899], + ], }); }); @@ -151,7 +210,10 @@ describe('TimeSeries', () => { describe('msResolution with millisecond resolution timestamps', () => { beforeEach(() => { series = new TimeSeries({ - datapoints: [[55, 1236547890001], [90, 1234456709000]], + datapoints: [ + [55, 1236547890001], + [90, 1234456709000], + ], }); }); @@ -163,7 +225,10 @@ describe('TimeSeries', () => { describe('msResolution with millisecond resolution timestamps but with trailing zeroes', () => { beforeEach(() => { series = new TimeSeries({ - datapoints: [[45, 1234567890000], [60, 1234567899000]], + datapoints: [ + [45, 1234567890000], + [60, 1234567899000], + ], }); }); @@ -333,7 +398,12 @@ describe('TimeSeries', () => { beforeEach(() => { testData = { alias: 'test', - datapoints: [[1, 2], [0, 3], [10, 4], [8, 5]], + datapoints: [ + [1, 2], + [0, 3], + [10, 4], + [8, 5], + ], }; series = new TimeSeries(testData); series.getFlotPairs(); @@ -355,7 +425,12 @@ describe('TimeSeries', () => { }); it('should set decimals based on Y axis to 0 if calculated decimals = 0)', () => { - testData.datapoints = [[10, 2], [0, 3], [100, 4], [80, 5]]; + testData.datapoints = [ + [10, 2], + [0, 3], + [100, 4], + [80, 5], + ]; series = new TimeSeries(testData); series.getFlotPairs(); const data = [series]; diff --git a/public/app/core/table_model.ts b/public/app/core/table_model.ts index dde0f456d40..3ffdeeb8ad8 100644 --- a/public/app/core/table_model.ts +++ b/public/app/core/table_model.ts @@ -107,19 +107,16 @@ export function mergeTablesIntoModel(dst?: TableModel, ...tables: TableModel[]): const columnNames: { [key: string]: any } = {}; // Union of all non-value columns - const columnsUnion = tableDataTables.slice().reduce( - (acc, series) => { - series.columns.forEach(col => { - const { text } = col; - if (columnNames[text] === undefined) { - columnNames[text] = acc.length; - acc.push(col); - } - }); - return acc; - }, - [] as MutableColumn[] - ); + const columnsUnion = tableDataTables.slice().reduce((acc, series) => { + series.columns.forEach(col => { + const { text } = col; + if (columnNames[text] === undefined) { + columnNames[text] = acc.length; + acc.push(col); + } + }); + return acc; + }, [] as MutableColumn[]); // Map old column index to union index per series, e.g., // given columnNames {A: 0, B: 1} and @@ -127,57 +124,51 @@ export function mergeTablesIntoModel(dst?: TableModel, ...tables: TableModel[]): const columnIndexMapper = tableDataTables.map(series => series.columns.map(col => columnNames[col.text])); // Flatten rows of all series and adjust new column indexes - const flattenedRows = tableDataTables.reduce( - (acc, series, seriesIndex) => { - const mapper = columnIndexMapper[seriesIndex]; - series.rows.forEach(row => { - const alteredRow: MutableColumn[] = []; - // Shifting entries according to index mapper - mapper.forEach((to, from) => { - alteredRow[to] = row[from]; - }); - acc.push(alteredRow); + const flattenedRows = tableDataTables.reduce((acc, series, seriesIndex) => { + const mapper = columnIndexMapper[seriesIndex]; + series.rows.forEach(row => { + const alteredRow: MutableColumn[] = []; + // Shifting entries according to index mapper + mapper.forEach((to, from) => { + alteredRow[to] = row[from]; }); - return acc; - }, - [] as MutableColumn[][] - ); + acc.push(alteredRow); + }); + return acc; + }, [] as MutableColumn[][]); // Merge rows that have same values for columns const mergedRows: { [key: string]: any } = {}; - const compactedRows = flattenedRows.reduce( - (acc, row, rowIndex) => { - if (!mergedRows[rowIndex]) { - // Look from current row onwards - let offset = rowIndex + 1; - // More than one row can be merged into current row - while (offset < flattenedRows.length) { - // Find next row that could be merged - const match = _.findIndex(flattenedRows, otherRow => areRowsMatching(columnsUnion, row, otherRow), offset); - if (match > -1) { - const matchedRow = flattenedRows[match]; - // Merge values from match into current row if there is a gap in the current row - for (let columnIndex = 0; columnIndex < columnsUnion.length; columnIndex++) { - if (row[columnIndex] === undefined && matchedRow[columnIndex] !== undefined) { - row[columnIndex] = matchedRow[columnIndex]; - } + const compactedRows = flattenedRows.reduce((acc, row, rowIndex) => { + if (!mergedRows[rowIndex]) { + // Look from current row onwards + let offset = rowIndex + 1; + // More than one row can be merged into current row + while (offset < flattenedRows.length) { + // Find next row that could be merged + const match = _.findIndex(flattenedRows, otherRow => areRowsMatching(columnsUnion, row, otherRow), offset); + if (match > -1) { + const matchedRow = flattenedRows[match]; + // Merge values from match into current row if there is a gap in the current row + for (let columnIndex = 0; columnIndex < columnsUnion.length; columnIndex++) { + if (row[columnIndex] === undefined && matchedRow[columnIndex] !== undefined) { + row[columnIndex] = matchedRow[columnIndex]; } - // Don't visit this row again - mergedRows[match] = matchedRow; - // Keep looking for more rows to merge - offset = match + 1; - } else { - // No match found, stop looking - break; } + // Don't visit this row again + mergedRows[match] = matchedRow; + // Keep looking for more rows to merge + offset = match + 1; + } else { + // No match found, stop looking + break; } - acc.push(row); } - return acc; - }, - [] as MutableColumn[][] - ); + acc.push(row); + } + return acc; + }, [] as MutableColumn[][]); model.columns = columnsUnion; model.rows = compactedRows; diff --git a/public/app/features/admin/ServerStats.test.tsx b/public/app/features/admin/ServerStats.test.tsx index c33a5f4fbb2..a363418a60b 100644 --- a/public/app/features/admin/ServerStats.test.tsx +++ b/public/app/features/admin/ServerStats.test.tsx @@ -8,7 +8,10 @@ import { ServerStat } from './state/apis'; describe('ServerStats', () => { it('Should render table with stats', done => { const navModel = createNavModel('Admin', 'stats'); - const stats: ServerStat[] = [{ name: 'Total dashboards', value: 10 }, { name: 'Total Users', value: 1 }]; + const stats: ServerStat[] = [ + { name: 'Total dashboards', value: 10 }, + { name: 'Total Users', value: 1 }, + ]; const getServerStats = () => { return Promise.resolve(stats); diff --git a/public/app/features/admin/ldap/LdapPage.tsx b/public/app/features/admin/ldap/LdapPage.tsx index 9ef29f6957b..5c7b6792539 100644 --- a/public/app/features/admin/ldap/LdapPage.tsx +++ b/public/app/features/admin/ldap/LdapPage.tsx @@ -132,9 +132,4 @@ const mapDispatchToProps = { clearUserMappingInfo, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(LdapPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(LdapPage)); diff --git a/public/app/features/admin/ldap/LdapUserPage.tsx b/public/app/features/admin/ldap/LdapUserPage.tsx index c0fcff5f45b..8b88ba7d13d 100644 --- a/public/app/features/admin/ldap/LdapUserPage.tsx +++ b/public/app/features/admin/ldap/LdapUserPage.tsx @@ -158,9 +158,4 @@ const mapDispatchToProps = { clearUserError, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(LdapUserPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(LdapUserPage)); diff --git a/public/app/features/alerting/AlertRuleList.tsx b/public/app/features/alerting/AlertRuleList.tsx index 96cb1887683..d99f81f36f9 100644 --- a/public/app/features/alerting/AlertRuleList.tsx +++ b/public/app/features/alerting/AlertRuleList.tsx @@ -150,9 +150,4 @@ const mapDispatchToProps = { togglePauseAlertRule, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(AlertRuleList) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(AlertRuleList)); diff --git a/public/app/features/alerting/AlertTab.tsx b/public/app/features/alerting/AlertTab.tsx index 21f18feaa49..2eef9b09e7a 100644 --- a/public/app/features/alerting/AlertTab.tsx +++ b/public/app/features/alerting/AlertTab.tsx @@ -217,9 +217,4 @@ export const mapStateToProps = (state: StoreState) => ({}); const mapDispatchToProps = { changePanelEditorTab }; -export const AlertTab = hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(UnConnectedAlertTab) -); +export const AlertTab = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedAlertTab)); diff --git a/public/app/features/alerting/state/alertDef.ts b/public/app/features/alerting/state/alertDef.ts index 882e83b21be..f0188c0dd1f 100644 --- a/public/app/features/alerting/state/alertDef.ts +++ b/public/app/features/alerting/state/alertDef.ts @@ -33,7 +33,10 @@ const evalFunctions = [ { text: 'HAS NO VALUE', value: 'no_value' }, ]; -const evalOperators = [{ text: 'OR', value: 'or' }, { text: 'AND', value: 'and' }]; +const evalOperators = [ + { text: 'OR', value: 'or' }, + { text: 'AND', value: 'and' }, +]; const reducerTypes = [ { text: 'avg()', value: 'avg' }, @@ -55,7 +58,10 @@ const noDataModes = [ { text: 'Ok', value: 'ok' }, ]; -const executionErrorModes = [{ text: 'Alerting', value: 'alerting' }, { text: 'Keep Last State', value: 'keep_state' }]; +const executionErrorModes = [ + { text: 'Alerting', value: 'alerting' }, + { text: 'Keep Last State', value: 'keep_state' }, +]; function createReducerPart(model: any) { const def = new QueryPartDef({ type: model.type, defaultParams: [] }); diff --git a/public/app/features/annotations/annotation_tooltip.ts b/public/app/features/annotations/annotation_tooltip.ts index cf36f164f9a..7c7f17c4f9e 100644 --- a/public/app/features/annotations/annotation_tooltip.ts +++ b/public/app/features/annotations/annotation_tooltip.ts @@ -51,9 +51,7 @@ export function annotationTooltipDirective( let header = `
`; if (event.login) { - header += `
`; + header += `
`; } header += ` ${sanitizeString(title)} diff --git a/public/app/features/annotations/editor_ctrl.ts b/public/app/features/annotations/editor_ctrl.ts index a38e2321792..da2b59c0dab 100644 --- a/public/app/features/annotations/editor_ctrl.ts +++ b/public/app/features/annotations/editor_ctrl.ts @@ -44,7 +44,10 @@ export class AnnotationsEditorCtrl { infoBoxTitle: 'What are annotations?', }; - showOptions: any = [{ text: 'All Panels', value: 0 }, { text: 'Specific Panels', value: 1 }]; + showOptions: any = [ + { text: 'All Panels', value: 0 }, + { text: 'Specific Panels', value: 1 }, + ]; /** @ngInject */ constructor(private $scope: any, private datasourceSrv: DatasourceSrv) { diff --git a/public/app/features/annotations/specs/annotations_srv_specs.test.ts b/public/app/features/annotations/specs/annotations_srv_specs.test.ts index f4bfa6dc072..825b992938f 100644 --- a/public/app/features/annotations/specs/annotations_srv_specs.test.ts +++ b/public/app/features/annotations/specs/annotations_srv_specs.test.ts @@ -9,7 +9,11 @@ describe('Annotations deduplication', () => { { id: 5, time: 5 }, { id: 5, time: 5 }, ]; - const expectedAnnotations = [{ id: 1, time: 1 }, { id: 2, time: 2 }, { id: 5, time: 5 }]; + const expectedAnnotations = [ + { id: 1, time: 1 }, + { id: 2, time: 2 }, + { id: 5, time: 5 }, + ]; const deduplicated = dedupAnnotations(testAnnotations); expect(deduplicated).toEqual(expectedAnnotations); @@ -23,7 +27,11 @@ describe('Annotations deduplication', () => { { id: 5, time: 5 }, { id: 5, time: 5 }, ]; - const expectedAnnotations = [{ id: 1, time: 1 }, { id: 2, time: 2 }, { id: 5, time: 5 }]; + const expectedAnnotations = [ + { id: 1, time: 1 }, + { id: 2, time: 2 }, + { id: 5, time: 5 }, + ]; const deduplicated = dedupAnnotations(testAnnotations); expect(deduplicated).toEqual(expectedAnnotations); diff --git a/public/app/features/api-keys/ApiKeysPage.tsx b/public/app/features/api-keys/ApiKeysPage.tsx index 1c9d8278e94..0f68995f0f5 100644 --- a/public/app/features/api-keys/ApiKeysPage.tsx +++ b/public/app/features/api-keys/ApiKeysPage.tsx @@ -316,9 +316,4 @@ const mapDispatchToProps = { addApiKey, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(ApiKeysPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(ApiKeysPage)); diff --git a/public/app/features/dashboard/components/DashNav/DashNav.tsx b/public/app/features/dashboard/components/DashNav/DashNav.tsx index 4fab96b0ff3..771b0207693 100644 --- a/public/app/features/dashboard/components/DashNav/DashNav.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNav.tsx @@ -284,7 +284,4 @@ const mapDispatchToProps = { updateLocation, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(DashNav); +export default connect(mapStateToProps, mapDispatchToProps)(DashNav); diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index e8df2ab25de..9c1a6c0039c 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -341,9 +341,4 @@ const mapDispatchToProps = { updateLocation, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(DashboardPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DashboardPage)); diff --git a/public/app/features/dashboard/containers/SoloPanelPage.tsx b/public/app/features/dashboard/containers/SoloPanelPage.tsx index 59f364b28f0..3ca41e9b214 100644 --- a/public/app/features/dashboard/containers/SoloPanelPage.tsx +++ b/public/app/features/dashboard/containers/SoloPanelPage.tsx @@ -107,9 +107,4 @@ const mapDispatchToProps = { initDashboard, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(SoloPanelPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(SoloPanelPage)); diff --git a/public/app/features/dashboard/panel_editor/PanelEditor.tsx b/public/app/features/dashboard/panel_editor/PanelEditor.tsx index dc8ed92f2a5..99b921fb4c5 100644 --- a/public/app/features/dashboard/panel_editor/PanelEditor.tsx +++ b/public/app/features/dashboard/panel_editor/PanelEditor.tsx @@ -114,12 +114,7 @@ export const mapStateToProps = (state: StoreState) => getActiveTabAndTabs(state. const mapDispatchToProps = { refreshPanelEditor, panelEditorCleanUp, changePanelEditorTab }; -export const PanelEditor = hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(UnConnectedPanelEditor) -); +export const PanelEditor = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedPanelEditor)); interface TabItemParams { tab: PanelEditorTab; diff --git a/public/app/features/dashboard/state/DashboardMigrator.test.ts b/public/app/features/dashboard/state/DashboardMigrator.test.ts index ecae1062404..73ac0b909ed 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.test.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.test.ts @@ -175,7 +175,10 @@ describe('DashboardModel', () => { model.rows = [createRow({ collapse: false, height: 8 }, [[6], [6]])]; const dashboard = new DashboardModel(model); const panelGridPos = getGridPositions(dashboard); - const expectedGrid = [{ x: 0, y: 0, w: 12, h: 8 }, { x: 12, y: 0, w: 12, h: 8 }]; + const expectedGrid = [ + { x: 0, y: 0, w: 12, h: 8 }, + { x: 12, y: 0, w: 12, h: 8 }, + ]; expect(panelGridPos).toEqual(expectedGrid); }); diff --git a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts index 7401b5d024b..58fadea18c2 100644 --- a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts @@ -246,7 +246,10 @@ describe('given dashboard with row repeat and panel repeat in horizontal directi text: 'reg1, reg2', value: ['reg1', 'reg2'], }, - options: [{ text: 'reg1', value: 'reg1', selected: true }, { text: 'reg2', value: 'reg2', selected: true }], + options: [ + { text: 'reg1', value: 'reg1', selected: true }, + { text: 'reg2', value: 'reg2', selected: true }, + ], }, { name: 'app', diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index a57294e80b0..c0bbaf74089 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -255,16 +255,11 @@ export class PanelModel { if (plugin.angularConfigCtrl) { return; } - this.options = _.mergeWith( - {}, - plugin.defaults, - this.options || {}, - (objValue: any, srcValue: any): any => { - if (_.isArray(srcValue)) { - return srcValue; - } + this.options = _.mergeWith({}, plugin.defaults, this.options || {}, (objValue: any, srcValue: any): any => { + if (_.isArray(srcValue)) { + return srcValue; } - ); + }); } pluginLoaded(plugin: PanelPlugin) { diff --git a/public/app/features/dashboard/state/PanelQueryRunner.test.ts b/public/app/features/dashboard/state/PanelQueryRunner.test.ts index 33cf9153f4a..daaa6ac8313 100644 --- a/public/app/features/dashboard/state/PanelQueryRunner.test.ts +++ b/public/app/features/dashboard/state/PanelQueryRunner.test.ts @@ -56,7 +56,15 @@ function describeQueryRunnerScenario(description: string, scenarioFn: ScenarioFn }; const response: any = { - data: [{ target: 'hello', datapoints: [[1, 1000], [2, 2000]] }], + data: [ + { + target: 'hello', + datapoints: [ + [1, 1000], + [2, 2000], + ], + }, + ], }; beforeEach(async () => { diff --git a/public/app/features/dashboard/state/runRequest.ts b/public/app/features/dashboard/state/runRequest.ts index 296a7f2c06d..e6ae8a85bfb 100644 --- a/public/app/features/dashboard/state/runRequest.ts +++ b/public/app/features/dashboard/state/runRequest.ts @@ -129,13 +129,7 @@ export function runRequest(datasource: DataSourceApi, request: DataQueryRequest) // If 50ms without a response emit a loading state // mapTo will translate the timer event into state.panelData (which has state set to loading) // takeUntil will cancel the timer emit when first response packet is received on the dataObservable - return merge( - timer(200).pipe( - mapTo(state.panelData), - takeUntil(dataObservable) - ), - dataObservable - ); + return merge(timer(200).pipe(mapTo(state.panelData), takeUntil(dataObservable)), dataObservable); } function cancelNetworkRequestsOnUnsubscribe(req: DataQueryRequest) { diff --git a/public/app/features/datasources/DataSourceDashboards.tsx b/public/app/features/datasources/DataSourceDashboards.tsx index a9dc3aa19d8..901c9fdd3cb 100644 --- a/public/app/features/datasources/DataSourceDashboards.tsx +++ b/public/app/features/datasources/DataSourceDashboards.tsx @@ -99,9 +99,4 @@ const mapDispatchToProps = { removeDashboard, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(DataSourceDashboards) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceDashboards)); diff --git a/public/app/features/datasources/DataSourcesListPage.tsx b/public/app/features/datasources/DataSourcesListPage.tsx index babb35c7e4a..f13f5b91335 100644 --- a/public/app/features/datasources/DataSourcesListPage.tsx +++ b/public/app/features/datasources/DataSourcesListPage.tsx @@ -116,9 +116,4 @@ const mapDispatchToProps = { setDataSourcesLayoutMode, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(DataSourcesListPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourcesListPage)); diff --git a/public/app/features/datasources/NewDataSourcePage.tsx b/public/app/features/datasources/NewDataSourcePage.tsx index ac8c0773d7f..c7620d002a5 100644 --- a/public/app/features/datasources/NewDataSourcePage.tsx +++ b/public/app/features/datasources/NewDataSourcePage.tsx @@ -105,16 +105,13 @@ class NewDataSourcePage extends PureComponent { return null; } - const categories = dataSourceTypes.reduce( - (accumulator, item) => { - const category = item.category || 'other'; - const list = accumulator[category] || []; - list.push(item); - accumulator[category] = list; - return accumulator; - }, - {} as DataSourceCategories - ); + const categories = dataSourceTypes.reduce((accumulator, item) => { + const category = item.category || 'other'; + const list = accumulator[category] || []; + list.push(item); + accumulator[category] = list; + return accumulator; + }, {} as DataSourceCategories); categories['cloud'].push(getGrafanaCloudPhantomPlugin()); @@ -265,9 +262,4 @@ const mapDispatchToProps = { setDataSourceTypeSearchQuery, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(NewDataSourcePage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(NewDataSourcePage)); diff --git a/public/app/features/datasources/settings/DataSourceSettingsPage.tsx b/public/app/features/datasources/settings/DataSourceSettingsPage.tsx index 41bee55fbc7..f8487086159 100644 --- a/public/app/features/datasources/settings/DataSourceSettingsPage.tsx +++ b/public/app/features/datasources/settings/DataSourceSettingsPage.tsx @@ -344,9 +344,4 @@ const mapDispatchToProps = { dataSourceLoaded, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(DataSourceSettingsPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourceSettingsPage)); diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index ab3f0c2cac6..ea2f3dc23d1 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -436,8 +436,5 @@ const mapDispatchToProps: Partial = { export default hot(module)( // @ts-ignore - connect( - mapStateToProps, - mapDispatchToProps - )(Explore) + connect(mapStateToProps, mapDispatchToProps)(Explore) ) as React.ComponentType<{ exploreId: ExploreId }>; diff --git a/public/app/features/explore/ExploreGraphPanel.tsx b/public/app/features/explore/ExploreGraphPanel.tsx index 3d9bd3392f9..0318158795d 100644 --- a/public/app/features/explore/ExploreGraphPanel.tsx +++ b/public/app/features/explore/ExploreGraphPanel.tsx @@ -158,9 +158,10 @@ class UnThemedExploreGraphPanel extends PureComponent {
{`Showing only ${MAX_NUMBER_OF_TIME_SERIES} time series. `} - {`Show all ${ - series.length - }`} + {`Show all ${series.length}`}
)} diff --git a/public/app/features/explore/ExploreToolbar.tsx b/public/app/features/explore/ExploreToolbar.tsx index 7bace520203..23f1a436181 100644 --- a/public/app/features/explore/ExploreToolbar.tsx +++ b/public/app/features/explore/ExploreToolbar.tsx @@ -386,9 +386,4 @@ const mapDispatchToProps: DispatchProps = { clearOrigin, }; -export const ExploreToolbar = hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(UnConnectedExploreToolbar) -); +export const ExploreToolbar = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedExploreToolbar)); diff --git a/public/app/features/explore/LogsContainer.tsx b/public/app/features/explore/LogsContainer.tsx index 085e35ffe04..398895ad50d 100644 --- a/public/app/features/explore/LogsContainer.tsx +++ b/public/app/features/explore/LogsContainer.tsx @@ -201,9 +201,4 @@ const mapDispatchToProps = { updateTimeRange, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(LogsContainer) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(LogsContainer)); diff --git a/public/app/features/explore/QueryRow.tsx b/public/app/features/explore/QueryRow.tsx index f8877a1280d..a72033065e0 100644 --- a/public/app/features/explore/QueryRow.tsx +++ b/public/app/features/explore/QueryRow.tsx @@ -213,7 +213,6 @@ const mapDispatchToProps = { runQueries, }; -export default hot(module)(connect( - mapStateToProps, - mapDispatchToProps -)(QueryRow) as React.ComponentType); +export default hot(module)( + connect(mapStateToProps, mapDispatchToProps)(QueryRow) as React.ComponentType +); diff --git a/public/app/features/explore/TableContainer.tsx b/public/app/features/explore/TableContainer.tsx index f87128796ed..c0934532fc0 100644 --- a/public/app/features/explore/TableContainer.tsx +++ b/public/app/features/explore/TableContainer.tsx @@ -48,9 +48,4 @@ const mapDispatchToProps = { toggleTable, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(TableContainer) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(TableContainer)); diff --git a/public/app/features/explore/Wrapper.tsx b/public/app/features/explore/Wrapper.tsx index e0b1c608e23..244b14fc1d8 100644 --- a/public/app/features/explore/Wrapper.tsx +++ b/public/app/features/explore/Wrapper.tsx @@ -50,9 +50,4 @@ const mapDispatchToProps = { resetExploreAction, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(Wrapper) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(Wrapper)); diff --git a/public/app/features/explore/__mocks__/mockData.ts b/public/app/features/explore/__mocks__/mockData.ts index 2e89ded29cf..911aaaf4fd7 100644 --- a/public/app/features/explore/__mocks__/mockData.ts +++ b/public/app/features/explore/__mocks__/mockData.ts @@ -8,7 +8,11 @@ export const mockData = () => { job: 'prometheus', le: '+Inf', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -18,7 +22,11 @@ export const mockData = () => { job: 'prometheus', le: '0.1', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -28,7 +36,11 @@ export const mockData = () => { job: 'prometheus', le: '0.2', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -38,7 +50,11 @@ export const mockData = () => { job: 'prometheus', le: '0.4', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -48,7 +64,11 @@ export const mockData = () => { job: 'prometheus', le: '1', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -58,7 +78,11 @@ export const mockData = () => { job: 'prometheus', le: '120', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -68,7 +92,11 @@ export const mockData = () => { job: 'prometheus', le: '20', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -78,7 +106,11 @@ export const mockData = () => { job: 'prometheus', le: '3', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -88,7 +120,11 @@ export const mockData = () => { job: 'prometheus', le: '60', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -98,7 +134,11 @@ export const mockData = () => { job: 'prometheus', le: '8', }, - values: [[1537858100, '16'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '16'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -108,7 +148,11 @@ export const mockData = () => { job: 'prometheus', le: '+Inf', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -118,7 +162,11 @@ export const mockData = () => { job: 'prometheus', le: '0.1', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -128,7 +176,11 @@ export const mockData = () => { job: 'prometheus', le: '0.4', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -138,7 +190,11 @@ export const mockData = () => { job: 'prometheus', le: '1', }, - values: [[1537847900, '953'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537847900, '953'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -148,7 +204,11 @@ export const mockData = () => { job: 'prometheus', le: '120', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -158,7 +218,11 @@ export const mockData = () => { job: 'prometheus', le: '20', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -168,7 +232,11 @@ export const mockData = () => { job: 'prometheus', le: '3', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -178,7 +246,11 @@ export const mockData = () => { job: 'prometheus', le: '60', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -188,7 +260,11 @@ export const mockData = () => { job: 'prometheus', le: '8', }, - values: [[1537858060, '1195'], [1537858080, '1195'], [1537858100, '1195']], + values: [ + [1537858060, '1195'], + [1537858080, '1195'], + [1537858100, '1195'], + ], }, { metric: { @@ -198,7 +274,11 @@ export const mockData = () => { job: 'prometheus', le: '+Inf', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -208,7 +288,11 @@ export const mockData = () => { job: 'prometheus', le: '0.1', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -218,7 +302,11 @@ export const mockData = () => { job: 'prometheus', le: '0.2', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -228,7 +316,11 @@ export const mockData = () => { job: 'prometheus', le: '0.4', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -238,7 +330,11 @@ export const mockData = () => { job: 'prometheus', le: '1', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -248,7 +344,11 @@ export const mockData = () => { job: 'prometheus', le: '120', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -258,7 +358,11 @@ export const mockData = () => { job: 'prometheus', le: '20', }, - values: [[1537858100, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537858100, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, { metric: { @@ -268,7 +372,11 @@ export const mockData = () => { job: 'prometheus', le: '3', }, - values: [[1537857260, '55'], [1537861960, '1'], [1537861980, '1']], + values: [ + [1537857260, '55'], + [1537861960, '1'], + [1537861980, '1'], + ], }, ]; }; diff --git a/public/app/features/explore/utils/ResultProcessor.test.ts b/public/app/features/explore/utils/ResultProcessor.test.ts index 94093be9ec7..266024df0c1 100644 --- a/public/app/features/explore/utils/ResultProcessor.test.ts +++ b/public/app/features/explore/utils/ResultProcessor.test.ts @@ -108,7 +108,11 @@ describe('ResultProcessor', () => { { label: 'A-series', color: '#7EB26D', - data: [[100, 4], [200, 5], [300, 6]], + data: [ + [100, 4], + [200, 5], + [300, 6], + ], info: undefined, isVisible: true, yAxis: { @@ -135,7 +139,11 @@ describe('ResultProcessor', () => { { text: 'time', type: 'time', filterable: undefined }, { text: 'message', type: 'string', filterable: undefined }, ], - rows: [[4, 100, 'this is a message'], [5, 200, 'second message'], [6, 300, 'third']], + rows: [ + [4, 100, 'this is a message'], + [5, 200, 'second message'], + [6, 300, 'third'], + ], type: 'table', }); }); @@ -212,7 +220,11 @@ describe('ResultProcessor', () => { { label: 'A-series', color: '#7EB26D', - data: [[100, 4], [200, 5], [300, 6]], + data: [ + [100, 4], + [200, 5], + [300, 6], + ], info: undefined, isVisible: true, yAxis: { diff --git a/public/app/features/folders/FolderPermissions.tsx b/public/app/features/folders/FolderPermissions.tsx index 2261000ebed..aaaa061302f 100644 --- a/public/app/features/folders/FolderPermissions.tsx +++ b/public/app/features/folders/FolderPermissions.tsx @@ -133,9 +133,4 @@ const mapDispatchToProps = { addFolderPermission, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(FolderPermissions) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(FolderPermissions)); diff --git a/public/app/features/folders/FolderSettingsPage.tsx b/public/app/features/folders/FolderSettingsPage.tsx index 37feaf84c7c..be4bba7b642 100644 --- a/public/app/features/folders/FolderSettingsPage.tsx +++ b/public/app/features/folders/FolderSettingsPage.tsx @@ -115,9 +115,4 @@ const mapDispatchToProps = { deleteFolder, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(FolderSettingsPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(FolderSettingsPage)); diff --git a/public/app/features/manage-dashboards/DashboardImportCtrl.ts b/public/app/features/manage-dashboards/DashboardImportCtrl.ts index ff361507f2e..55cc428535d 100644 --- a/public/app/features/manage-dashboards/DashboardImportCtrl.ts +++ b/public/app/features/manage-dashboards/DashboardImportCtrl.ts @@ -151,9 +151,7 @@ export class DashboardImportCtrl { .then((res: any) => { this.uidExists = true; this.hasUidValidationError = true; - this.uidValidationError = `Dashboard named '${res.dashboard.title}' in folder '${ - res.meta.folderTitle - }' has the same uid`; + this.uidValidationError = `Dashboard named '${res.dashboard.title}' in folder '${res.meta.folderTitle}' has the same uid`; }) .catch((err: any) => { err.isHandled = true; diff --git a/public/app/features/org/OrgDetailsPage.tsx b/public/app/features/org/OrgDetailsPage.tsx index ae51e683719..95061535fc9 100644 --- a/public/app/features/org/OrgDetailsPage.tsx +++ b/public/app/features/org/OrgDetailsPage.tsx @@ -66,9 +66,4 @@ const mapDispatchToProps = { updateOrganization, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(OrgDetailsPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(OrgDetailsPage)); diff --git a/public/app/features/playlist/specs/playlist_edit_ctrl.test.ts b/public/app/features/playlist/specs/playlist_edit_ctrl.test.ts index 08c942cd9e4..11554fa5bd2 100644 --- a/public/app/features/playlist/specs/playlist_edit_ctrl.test.ts +++ b/public/app/features/playlist/specs/playlist_edit_ctrl.test.ts @@ -12,9 +12,15 @@ describe('PlaylistEditCtrl', () => { ctx = new PlaylistEditCtrl(null, null, null, { current: { params: {} } }, navModelSrv); - ctx.dashboardresult = [{ id: 2, title: 'dashboard: 2' }, { id: 3, title: 'dashboard: 3' }]; + ctx.dashboardresult = [ + { id: 2, title: 'dashboard: 2' }, + { id: 3, title: 'dashboard: 3' }, + ]; - ctx.tagresult = [{ term: 'graphite', count: 1 }, { term: 'nyc', count: 2 }]; + ctx.tagresult = [ + { term: 'graphite', count: 1 }, + { term: 'nyc', count: 2 }, + ]; }); describe('searchresult returns 2 dashboards, ', () => { diff --git a/public/app/features/playlist/specs/playlist_srv.test.ts b/public/app/features/playlist/specs/playlist_srv.test.ts index 62ec634f3eb..a62a921e0f0 100644 --- a/public/app/features/playlist/specs/playlist_srv.test.ts +++ b/public/app/features/playlist/specs/playlist_srv.test.ts @@ -5,9 +5,11 @@ import { setStore } from 'app/store/store'; const mockStore = configureMockStore(); -setStore(mockStore({ - location: {}, -}) as any); +setStore( + mockStore({ + location: {}, + }) as any +); const dashboards = [{ url: 'dash1' }, { url: 'dash2' }]; @@ -120,11 +122,13 @@ describe('PlaylistSrv', () => { srv.next(); - setStore(mockStore({ - location: { - path: 'dash2', - }, - }) as any); + setStore( + mockStore({ + location: { + path: 'dash2', + }, + }) as any + ); expect((srv as any).validPlaylistUrl).toBe('dash2'); diff --git a/public/app/features/plugins/PluginListPage.tsx b/public/app/features/plugins/PluginListPage.tsx index 7690d24ce16..f55bbdb421f 100644 --- a/public/app/features/plugins/PluginListPage.tsx +++ b/public/app/features/plugins/PluginListPage.tsx @@ -59,7 +59,7 @@ export class PluginListPage extends PureComponent { setSearchQuery={query => setPluginsSearchQuery(query)} linkButton={linkButton} /> - {hasFetched && plugins && (plugins && )} + {hasFetched && plugins && plugins && } @@ -83,9 +83,4 @@ const mapDispatchToProps = { setPluginsSearchQuery, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(PluginListPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(PluginListPage)); diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index f975b831259..66648880a5d 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -30,7 +30,9 @@ const inputDatasourcePlugin = async () => const stackdriverPlugin = async () => await import(/* webpackChunkName: "stackdriverPlugin" */ 'app/plugins/datasource/stackdriver/module'); const azureMonitorPlugin = async () => - await import(/* webpackChunkName: "azureMonitorPlugin" */ 'app/plugins/datasource/grafana-azure-monitor-datasource/module'); + await import( + /* webpackChunkName: "azureMonitorPlugin" */ 'app/plugins/datasource/grafana-azure-monitor-datasource/module' + ); import * as textPanel from 'app/plugins/panel/text/module'; import * as text2Panel from 'app/plugins/panel/text2/module'; diff --git a/public/app/features/profile/ChangePasswordPage.tsx b/public/app/features/profile/ChangePasswordPage.tsx index 85872c8dfba..0802b609008 100644 --- a/public/app/features/profile/ChangePasswordPage.tsx +++ b/public/app/features/profile/ChangePasswordPage.tsx @@ -38,9 +38,4 @@ function mapStateToProps(state: StoreState) { const mapDispatchToProps = {}; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(ChangePasswordPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(ChangePasswordPage)); diff --git a/public/app/features/teams/TeamGroupSync.tsx b/public/app/features/teams/TeamGroupSync.tsx index 5ed30588143..0c41e3e5065 100644 --- a/public/app/features/teams/TeamGroupSync.tsx +++ b/public/app/features/teams/TeamGroupSync.tsx @@ -162,7 +162,4 @@ const mapDispatchToProps = { removeTeamGroup, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(TeamGroupSync); +export default connect(mapStateToProps, mapDispatchToProps)(TeamGroupSync); diff --git a/public/app/features/teams/TeamMemberRow.tsx b/public/app/features/teams/TeamMemberRow.tsx index 87a0c814824..f6e1a7ecdeb 100644 --- a/public/app/features/teams/TeamMemberRow.tsx +++ b/public/app/features/teams/TeamMemberRow.tsx @@ -101,7 +101,4 @@ const mapDispatchToProps = { updateTeamMember, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(TeamMemberRow); +export default connect(mapStateToProps, mapDispatchToProps)(TeamMemberRow); diff --git a/public/app/features/teams/TeamMembers.tsx b/public/app/features/teams/TeamMembers.tsx index b5cd93c8ae7..05e5c6a6375 100644 --- a/public/app/features/teams/TeamMembers.tsx +++ b/public/app/features/teams/TeamMembers.tsx @@ -156,7 +156,4 @@ const mapDispatchToProps = { setSearchMemberQuery, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(TeamMembers); +export default connect(mapStateToProps, mapDispatchToProps)(TeamMembers); diff --git a/public/app/features/teams/TeamPages.tsx b/public/app/features/teams/TeamPages.tsx index 0b060a7f8bd..ed3f3130a85 100644 --- a/public/app/features/teams/TeamPages.tsx +++ b/public/app/features/teams/TeamPages.tsx @@ -148,9 +148,4 @@ const mapDispatchToProps = { loadTeamMembers, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(TeamPages) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(TeamPages)); diff --git a/public/app/features/teams/TeamSettings.tsx b/public/app/features/teams/TeamSettings.tsx index 8c2d5d9b380..5d9109b4d16 100644 --- a/public/app/features/teams/TeamSettings.tsx +++ b/public/app/features/teams/TeamSettings.tsx @@ -98,7 +98,4 @@ const mapDispatchToProps = { updateTeam, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(TeamSettings); +export default connect(mapStateToProps, mapDispatchToProps)(TeamSettings); diff --git a/public/app/features/templating/editor_ctrl.ts b/public/app/features/templating/editor_ctrl.ts index 3b1ba6e1dab..bc3aeeb79bd 100644 --- a/public/app/features/templating/editor_ctrl.ts +++ b/public/app/features/templating/editor_ctrl.ts @@ -50,7 +50,11 @@ export class VariableEditorCtrl { { value: 6, text: 'Alphabetical (case-insensitive, desc)' }, ]; - $scope.hideOptions = [{ value: 0, text: '' }, { value: 1, text: 'Label' }, { value: 2, text: 'Variable' }]; + $scope.hideOptions = [ + { value: 0, text: '' }, + { value: 1, text: 'Label' }, + { value: 2, text: 'Variable' }, + ]; $scope.init = () => { $scope.mode = 'list'; diff --git a/public/app/features/users/InviteeRow.tsx b/public/app/features/users/InviteeRow.tsx index 9035e8f0a3f..e75138cb700 100644 --- a/public/app/features/users/InviteeRow.tsx +++ b/public/app/features/users/InviteeRow.tsx @@ -52,9 +52,6 @@ const mapDispatchToProps = { revokeInvite, }; -export default connect( - () => { - return {}; - }, - mapDispatchToProps -)(InviteeRow); +export default connect(() => { + return {}; +}, mapDispatchToProps)(InviteeRow); diff --git a/public/app/features/users/UsersActionBar.tsx b/public/app/features/users/UsersActionBar.tsx index ce0d470379b..9063960eff0 100644 --- a/public/app/features/users/UsersActionBar.tsx +++ b/public/app/features/users/UsersActionBar.tsx @@ -92,7 +92,4 @@ const mapDispatchToProps = { setUsersSearchQuery, }; -export default connect( - mapStateToProps, - mapDispatchToProps -)(UsersActionBar); +export default connect(mapStateToProps, mapDispatchToProps)(UsersActionBar); diff --git a/public/app/features/users/UsersListPage.tsx b/public/app/features/users/UsersListPage.tsx index f6dc772ae58..ab32f289528 100644 --- a/public/app/features/users/UsersListPage.tsx +++ b/public/app/features/users/UsersListPage.tsx @@ -138,9 +138,4 @@ const mapDispatchToProps = { removeUser, }; -export default hot(module)( - connect( - mapStateToProps, - mapDispatchToProps - )(UsersListPage) -); +export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(UsersListPage)); diff --git a/public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts b/public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts index 275ad2836c6..88f174039af 100644 --- a/public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts +++ b/public/app/plugins/datasource/cloudwatch/specs/datasource.test.ts @@ -71,7 +71,11 @@ describe('CloudWatchDatasource', () => { series: [ { name: 'CPUUtilization_Average', - points: [[1, 1483228800000], [2, 1483229100000], [5, 1483229700000]], + points: [ + [1, 1483228800000], + [2, 1483229100000], + [5, 1483229700000], + ], tags: { InstanceId: 'i-12345678', }, @@ -382,7 +386,11 @@ describe('CloudWatchDatasource', () => { series: [ { name: 'TargetResponseTime_p90.00', - points: [[1, 1483228800000], [2, 1483229100000], [5, 1483229700000]], + points: [ + [1, 1483228800000], + [2, 1483229100000], + [5, 1483229700000], + ], tags: { LoadBalancer: 'lb', TargetGroup: 'tg', diff --git a/public/app/plugins/datasource/elasticsearch/query_def.ts b/public/app/plugins/datasource/elasticsearch/query_def.ts index 9771000e9e1..fbc3370d416 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.ts +++ b/public/app/plugins/datasource/elasticsearch/query_def.ts @@ -84,9 +84,15 @@ export const bucketAggTypes = [ { text: 'Histogram', value: 'histogram', requiresField: true }, ]; -export const orderByOptions = [{ text: 'Doc Count', value: '_count' }, { text: 'Term value', value: '_term' }]; +export const orderByOptions = [ + { text: 'Doc Count', value: '_count' }, + { text: 'Term value', value: '_term' }, +]; -export const orderOptions = [{ text: 'Top', value: 'desc' }, { text: 'Bottom', value: 'asc' }]; +export const orderOptions = [ + { text: 'Top', value: 'desc' }, + { text: 'Bottom', value: 'asc' }, +]; export const sizeOptions = [ { text: 'No limit', value: '0' }, @@ -144,7 +150,10 @@ export const movingAvgModelSettings: any = { simple: [], linear: [], ewma: [{ text: 'Alpha', value: 'alpha', default: undefined }], - holt: [{ text: 'Alpha', value: 'alpha', default: undefined }, { text: 'Beta', value: 'beta', default: undefined }], + holt: [ + { text: 'Alpha', value: 'alpha', default: undefined }, + { text: 'Beta', value: 'beta', default: undefined }, + ], holt_winters: [ { text: 'Alpha', value: 'alpha', default: undefined }, { text: 'Beta', value: 'beta', default: undefined }, diff --git a/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts b/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts index 5c78f26cbdf..fffcedfbba8 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts @@ -55,7 +55,10 @@ describe('ElasticResponse', () => { targets = [ { refId: 'A', - metrics: [{ type: 'count', id: '1' }, { type: 'avg', field: 'value', id: '2' }], + metrics: [ + { type: 'count', id: '1' }, + { type: 'avg', field: 'value', id: '2' }, + ], bucketAggs: [{ type: 'date_histogram', field: '@timestamp', id: '3' }], }, ]; @@ -119,14 +122,20 @@ describe('ElasticResponse', () => { buckets: [ { '3': { - buckets: [{ doc_count: 1, key: 1000 }, { doc_count: 3, key: 2000 }], + buckets: [ + { doc_count: 1, key: 1000 }, + { doc_count: 3, key: 2000 }, + ], }, doc_count: 4, key: 'server1', }, { '3': { - buckets: [{ doc_count: 2, key: 1000 }, { doc_count: 8, key: 2000 }], + buckets: [ + { doc_count: 2, key: 1000 }, + { doc_count: 8, key: 2000 }, + ], }, doc_count: 10, key: 'server2', @@ -156,7 +165,10 @@ describe('ElasticResponse', () => { targets = [ { refId: 'A', - metrics: [{ type: 'count', id: '1' }, { type: 'avg', field: '@value', id: '4' }], + metrics: [ + { type: 'count', id: '1' }, + { type: 'avg', field: '@value', id: '4' }, + ], bucketAggs: [ { type: 'terms', field: 'host', id: '2' }, { type: 'date_histogram', field: '@timestamp', id: '3' }, @@ -271,7 +283,10 @@ describe('ElasticResponse', () => { id: '1', }, ], - bucketAggs: [{ type: 'terms', field: 'host', id: '3' }, { type: 'date_histogram', id: '4' }], + bucketAggs: [ + { type: 'terms', field: 'host', id: '3' }, + { type: 'date_histogram', id: '4' }, + ], }, ]; response = { @@ -356,21 +371,30 @@ describe('ElasticResponse', () => { buckets: [ { '3': { - buckets: [{ doc_count: 1, key: 1000 }, { doc_count: 3, key: 2000 }], + buckets: [ + { doc_count: 1, key: 1000 }, + { doc_count: 3, key: 2000 }, + ], }, doc_count: 4, key: 'server1', }, { '3': { - buckets: [{ doc_count: 2, key: 1000 }, { doc_count: 8, key: 2000 }], + buckets: [ + { doc_count: 2, key: 1000 }, + { doc_count: 8, key: 2000 }, + ], }, doc_count: 10, key: 'server2', }, { '3': { - buckets: [{ doc_count: 2, key: 1000 }, { doc_count: 8, key: 2000 }], + buckets: [ + { doc_count: 2, key: 1000 }, + { doc_count: 8, key: 2000 }, + ], }, doc_count: 10, key: 0, @@ -410,7 +434,11 @@ describe('ElasticResponse', () => { { aggregations: { '3': { - buckets: [{ doc_count: 1, key: 1000 }, { doc_count: 3, key: 2000 }, { doc_count: 2, key: 1000 }], + buckets: [ + { doc_count: 1, key: 1000 }, + { doc_count: 3, key: 2000 }, + { doc_count: 2, key: 1000 }, + ], }, }, }, @@ -454,12 +482,18 @@ describe('ElasticResponse', () => { buckets: { '@metric:cpu': { '3': { - buckets: [{ doc_count: 1, key: 1000 }, { doc_count: 3, key: 2000 }], + buckets: [ + { doc_count: 1, key: 1000 }, + { doc_count: 3, key: 2000 }, + ], }, }, '@metric:logins.count': { '3': { - buckets: [{ doc_count: 2, key: 1000 }, { doc_count: 8, key: 2000 }], + buckets: [ + { doc_count: 2, key: 1000 }, + { doc_count: 8, key: 2000 }, + ], }, }, }, @@ -641,7 +675,10 @@ describe('ElasticResponse', () => { targets = [ { refId: 'A', - metrics: [{ type: 'avg', id: '1', field: 'test' }, { type: 'avg', id: '2', field: 'test2' }], + metrics: [ + { type: 'avg', id: '1', field: 'test' }, + { type: 'avg', id: '2', field: 'test2' }, + ], bucketAggs: [{ id: '2', type: 'terms', field: 'host' }], }, ]; @@ -733,7 +770,10 @@ describe('ElasticResponse', () => { { id: '4', field: 'select field', - pipelineVariables: [{ name: 'var1', pipelineAgg: '1' }, { name: 'var2', pipelineAgg: '3' }], + pipelineVariables: [ + { name: 'var1', pipelineAgg: '1' }, + { name: 'var2', pipelineAgg: '3' }, + ], settings: { script: 'params.var1 * params.var2' }, type: 'bucket_script', }, diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_builder.test.ts b/public/app/plugins/datasource/elasticsearch/specs/query_builder.test.ts index ed5ae0736c8..645fde00acf 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_builder.test.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_builder.test.ts @@ -65,7 +65,10 @@ describe('ElasticQueryBuilder', () => { it('with term agg and order by term', () => { const query = builder.build( { - metrics: [{ type: 'count', id: '1' }, { type: 'avg', field: '@value', id: '5' }], + metrics: [ + { type: 'count', id: '1' }, + { type: 'avg', field: '@value', id: '5' }, + ], bucketAggs: [ { type: 'terms', @@ -91,7 +94,10 @@ describe('ElasticQueryBuilder', () => { }); const query = builder6x.build( { - metrics: [{ type: 'count', id: '1' }, { type: 'avg', field: '@value', id: '5' }], + metrics: [ + { type: 'count', id: '1' }, + { type: 'avg', field: '@value', id: '5' }, + ], bucketAggs: [ { type: 'terms', @@ -114,7 +120,10 @@ describe('ElasticQueryBuilder', () => { it('with term agg and order by metric agg', () => { const query = builder.build( { - metrics: [{ type: 'count', id: '1' }, { type: 'avg', field: '@value', id: '5' }], + metrics: [ + { type: 'count', id: '1' }, + { type: 'avg', field: '@value', id: '5' }, + ], bucketAggs: [ { type: 'terms', diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_def.test.ts b/public/app/plugins/datasource/elasticsearch/specs/query_def.test.ts index d581ad0fc0d..bebe2a8e83b 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_def.test.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_def.test.ts @@ -12,7 +12,10 @@ describe('ElasticQueryDef', () => { describe('with count and sum targets', () => { const targets = { - metrics: [{ type: 'count', field: '@value' }, { type: 'sum', field: '@value' }], + metrics: [ + { type: 'count', field: '@value' }, + { type: 'sum', field: '@value' }, + ], }; const response = queryDef.getPipelineAggOptions(targets); @@ -24,7 +27,10 @@ describe('ElasticQueryDef', () => { describe('with count and moving average targets', () => { const targets = { - metrics: [{ type: 'count', field: '@value' }, { type: 'moving_avg', field: '@value' }], + metrics: [ + { type: 'count', field: '@value' }, + { type: 'moving_avg', field: '@value' }, + ], }; const response = queryDef.getPipelineAggOptions(targets); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.test.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.test.ts index b3d42e65178..ef9b26be868 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.test.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/app_insights/app_insights_datasource.test.ts @@ -290,7 +290,10 @@ describe('AppInsightsDatasource', () => { series: [ { name: 'exceptions/server', - points: [[3, 1504108800000], [6, 1504112400000]], + points: [ + [3, 1504108800000], + [6, 1504112400000], + ], }, ], tables: null, @@ -333,11 +336,17 @@ describe('AppInsightsDatasource', () => { series: [ { name: 'exceptions/server{client/city="Miami"}', - points: [[10, 1504108800000], [20, 1504112400000]], + points: [ + [10, 1504108800000], + [20, 1504112400000], + ], }, { name: 'exceptions/server{client/city="San Antonio"}', - points: [[1, 1504108800000], [2, 1504112400000]], + points: [ + [1, 1504108800000], + [2, 1504112400000], + ], }, ], tables: null, diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.test.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.test.ts index 12272be2052..409b6019370 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.test.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_log_analytics/azure_log_analytics_datasource.test.ts @@ -343,7 +343,10 @@ describe('AzureLogAnalyticsDatasource', () => { type: 'string', }, ], - rows: [['2018-06-02T20:20:00Z', 'Computer1', 'tag1,tag2'], ['2018-06-02T20:28:00Z', 'Computer2', 'tag2']], + rows: [ + ['2018-06-02T20:20:00Z', 'Computer1', 'tag1,tag2'], + ['2018-06-02T20:28:00Z', 'Computer2', 'tag2'], + ], }, ], }; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts index 4e262044f65..3e6aea94c31 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts @@ -114,7 +114,10 @@ describe('AzureMonitorDatasource', () => { series: [ { name: 'Percentage CPU', - points: [[2.2075, 1558278660000], [2.29, 1558278720000]], + points: [ + [2.2075, 1558278660000], + [2.29, 1558278720000], + ], }, ], tables: null, 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 2d4ed4f1395..6b2b9be34a7 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 @@ -253,9 +253,7 @@ export default class AzureMonitorDatasource { } getMetricDefinitions(subscriptionId: string, resourceGroup: string) { - const url = `${this.baseUrl}/${subscriptionId}/resourceGroups/${resourceGroup}/resources?api-version=${ - this.apiVersion - }`; + const url = `${this.baseUrl}/${subscriptionId}/resourceGroups/${resourceGroup}/resources?api-version=${this.apiVersion}`; return this.doRequest(url) .then((result: AzureMonitorMetricDefinitionsResponse) => { return ResponseParser.parseResponseValues(result, 'type', 'type'); @@ -304,9 +302,7 @@ export default class AzureMonitorDatasource { } getResourceNames(subscriptionId: string, resourceGroup: string, metricDefinition: string) { - const url = `${this.baseUrl}/${subscriptionId}/resourceGroups/${resourceGroup}/resources?api-version=${ - this.apiVersion - }`; + const url = `${this.baseUrl}/${subscriptionId}/resourceGroups/${resourceGroup}/resources?api-version=${this.apiVersion}`; return this.doRequest(url).then((result: any) => { if (!_.startsWith(metricDefinition, 'Microsoft.Storage/storageAccounts/')) { diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AnalyticsConfig.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AnalyticsConfig.tsx index 468452cf6c7..61cdcb877bf 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AnalyticsConfig.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/AnalyticsConfig.tsx @@ -125,7 +125,8 @@ export class AnalyticsConfig extends PureComponent { return ( jsonData.logAnalyticsTenantId && jsonData.logAnalyticsTenantId.length && - (jsonData.logAnalyticsClientId && jsonData.logAnalyticsClientId.length) && + jsonData.logAnalyticsClientId && + jsonData.logAnalyticsClientId.length && jsonData.logAnalyticsSubscriptionId && (secureJsonFields.logAnalyticsClientSecret || secureJsonData.logAnalyticsClientSecret) ); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.test.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.test.ts index d6335ad5c40..5442ceffa51 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.test.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.test.ts @@ -47,7 +47,10 @@ describe('AzureMonitorQueryCtrl', () => { describe('when the query type is Azure Monitor', () => { describe('and getOptions for the Resource Group dropdown is called', () => { - const response = [{ text: 'nodeapp', value: 'nodeapp' }, { text: 'otherapp', value: 'otherapp' }]; + const response = [ + { text: 'nodeapp', value: 'nodeapp' }, + { text: 'otherapp', value: 'otherapp' }, + ]; beforeEach(() => { queryCtrl.datasource.getResourceGroups = () => { @@ -105,7 +108,10 @@ describe('AzureMonitorQueryCtrl', () => { describe('when getOptions for the ResourceNames dropdown is called', () => { describe('and resourceGroup and metricDefinition have values', () => { - const response = [{ text: 'test1', value: 'test1' }, { text: 'test2', value: 'test2' }]; + const response = [ + { text: 'test1', value: 'test1' }, + { text: 'test2', value: 'test2' }, + ]; beforeEach(() => { queryCtrl.target.subscription = 'sub1'; @@ -145,7 +151,10 @@ describe('AzureMonitorQueryCtrl', () => { describe('when getOptions for the Metric Names dropdown is called', () => { describe('and resourceGroup, metricDefinition, resourceName and metricNamespace have values', () => { - const response = [{ text: 'metric1', value: 'metric1' }, { text: 'metric2', value: 'metric2' }]; + const response = [ + { text: 'metric1', value: 'metric1' }, + { text: 'metric2', value: 'metric2' }, + ]; beforeEach(() => { queryCtrl.target.subscription = 'sub1'; @@ -195,7 +204,10 @@ describe('AzureMonitorQueryCtrl', () => { const response: any = { primaryAggType: 'Average', supportedAggTypes: ['Average', 'Total'], - supportedTimeGrains: [{ text: 'PT1M', value: 'PT1M' }, { text: 'P1D', value: 'P1D' }], + supportedTimeGrains: [ + { text: 'PT1M', value: 'PT1M' }, + { text: 'P1D', value: 'P1D' }, + ], dimensions: [], }; @@ -269,7 +281,10 @@ describe('AzureMonitorQueryCtrl', () => { }); describe('when getOptions for the Metric Names dropdown is called', () => { - const response = [{ text: 'metric1', value: 'metric1' }, { text: 'metric2', value: 'metric2' }]; + const response = [ + { text: 'metric1', value: 'metric1' }, + { text: 'metric2', value: 'metric2' }, + ]; beforeEach(() => { queryCtrl.datasource.appInsightsDatasource.isConfigured = () => true; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts index 02b2f1788c6..1c6926440b0 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts @@ -139,7 +139,10 @@ export class AzureMonitorQueryCtrl extends QueryCtrl { this.panelCtrl.events.on(PanelEvents.dataReceived, this.onDataReceived.bind(this), $scope); this.panelCtrl.events.on(PanelEvents.dataError, this.onDataError.bind(this), $scope); - this.resultFormats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }]; + this.resultFormats = [ + { text: 'Time series', value: 'time_series' }, + { text: 'Table', value: 'table' }, + ]; this.getSubscriptions(); if (this.target.queryType === 'Azure Log Analytics') { this.getWorkspaces(); diff --git a/public/app/plugins/datasource/grafana/module.ts b/public/app/plugins/datasource/grafana/module.ts index e4867c49bd7..5939cd8e36e 100644 --- a/public/app/plugins/datasource/grafana/module.ts +++ b/public/app/plugins/datasource/grafana/module.ts @@ -8,7 +8,10 @@ class GrafanaQueryCtrl extends QueryCtrl { class GrafanaAnnotationsQueryCtrl { annotation: any; - types = [{ text: 'Dashboard', value: 'dashboard' }, { text: 'Tags', value: 'tags' }]; + types = [ + { text: 'Dashboard', value: 'dashboard' }, + { text: 'Tags', value: 'tags' }, + ]; constructor() { this.annotation.type = this.annotation.type || 'tags'; diff --git a/public/app/plugins/datasource/graphite/gfunc.ts b/public/app/plugins/datasource/graphite/gfunc.ts index ac854009033..a1ef4d73c1e 100644 --- a/public/app/plugins/datasource/graphite/gfunc.ts +++ b/public/app/plugins/datasource/graphite/gfunc.ts @@ -133,7 +133,10 @@ addFuncDef({ addFuncDef({ name: 'percentileOfSeries', category: 'Combine', - params: [{ name: 'n', type: 'int' }, { name: 'interpolate', type: 'boolean', options: ['true', 'false'] }], + params: [ + { name: 'n', type: 'int' }, + { name: 'interpolate', type: 'boolean', options: ['true', 'false'] }, + ], defaultParams: [95, 'false'], }); @@ -173,7 +176,10 @@ addFuncDef({ addFuncDef({ name: 'aliasSub', category: 'Alias', - params: [{ name: 'search', type: 'string' }, { name: 'replace', type: 'string' }], + params: [ + { name: 'search', type: 'string' }, + { name: 'replace', type: 'string' }, + ], defaultParams: ['', '\\1'], }); @@ -566,7 +572,10 @@ addFuncDef({ addFuncDef({ name: 'stdev', category: 'Calculate', - params: [{ name: 'n', type: 'int' }, { name: 'tolerance', type: 'int' }], + params: [ + { name: 'n', type: 'int' }, + { name: 'tolerance', type: 'int' }, + ], defaultParams: [5, 0.1], }); @@ -615,7 +624,11 @@ addFuncDef({ addFuncDef({ name: 'useSeriesAbove', category: 'Filter Series', - params: [{ name: 'value', type: 'int' }, { name: 'search', type: 'string' }, { name: 'replace', type: 'string' }], + params: [ + { name: 'value', type: 'int' }, + { name: 'search', type: 'string' }, + { name: 'replace', type: 'string' }, + ], defaultParams: [0, 'search', 'replace'], }); diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index 24a203df8ec..da03cee1e3a 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/public/app/plugins/datasource/graphite/query_ctrl.ts @@ -176,11 +176,9 @@ export class GraphiteQueryCtrl extends QueryCtrl { return altSegments; } }) - .catch( - (err: any): any[] => { - return []; - } - ); + .catch((err: any): any[] => { + return []; + }); } addAltTagSegments(prefix: string, altSegments: any[]) { diff --git a/public/app/plugins/datasource/graphite/specs/datasource.test.ts b/public/app/plugins/datasource/graphite/specs/datasource.test.ts index 5cf3b9598ea..d532f1a3434 100644 --- a/public/app/plugins/datasource/graphite/specs/datasource.test.ts +++ b/public/app/plugins/datasource/graphite/specs/datasource.test.ts @@ -36,7 +36,15 @@ describe('graphiteDatasource', () => { ctx.backendSrv.datasourceRequest = (options: any) => { requestOptions = options; return ctx.$q.when({ - data: [{ target: 'prod1.count', datapoints: [[10, 1], [12, 1]] }], + data: [ + { + target: 'prod1.count', + datapoints: [ + [10, 1], + [12, 1], + ], + }, + ], }); }; diff --git a/public/app/plugins/datasource/graphite/specs/graphite_query.test.ts b/public/app/plugins/datasource/graphite/specs/graphite_query.test.ts index 5a6beb22d3e..62e5c08505e 100644 --- a/public/app/plugins/datasource/graphite/specs/graphite_query.test.ts +++ b/public/app/plugins/datasource/graphite/specs/graphite_query.test.ts @@ -40,7 +40,10 @@ describe('Graphite query model', () => { it('should not hang on circular references', () => { ctx.target.target = 'asPercent(#A, #B)'; - ctx.targets = [{ refId: 'A', target: 'asPercent(#B, #C)' }, { refId: 'B', target: 'asPercent(#A, #C)' }]; + ctx.targets = [ + { refId: 'A', target: 'asPercent(#B, #C)' }, + { refId: 'B', target: 'asPercent(#A, #C)' }, + ]; ctx.queryModel.updateRenderedTarget(ctx.target, ctx.targets); // Just ensure updateRenderedTarget() is completed and doesn't hang expect(ctx.queryModel.target.targetFull).toBeDefined(); diff --git a/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx b/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx index f5769e68d11..5164ed44910 100644 --- a/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx +++ b/public/app/plugins/datasource/influxdb/components/ConfigEditor.tsx @@ -3,7 +3,10 @@ import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/da import { DataSourceHttpSettings, FormLabel, Input, SecretFormField, Select } from '@grafana/ui'; import { InfluxOptions, InfluxSecureJsonData } from '../types'; -const httpModes = [{ label: 'GET', value: 'GET' }, { label: 'POST', value: 'POST' }] as SelectableValue[]; +const httpModes = [ + { label: 'GET', value: 'GET' }, + { label: 'POST', value: 'POST' }, +] as SelectableValue[]; export type Props = DataSourcePluginOptionsEditorProps; diff --git a/public/app/plugins/datasource/influxdb/components/InfluxLogsQueryField.tsx b/public/app/plugins/datasource/influxdb/components/InfluxLogsQueryField.tsx index a7ca8831075..b242ab1c4b7 100644 --- a/public/app/plugins/datasource/influxdb/components/InfluxLogsQueryField.tsx +++ b/public/app/plugins/datasource/influxdb/components/InfluxLogsQueryField.tsx @@ -67,13 +67,11 @@ export class InfluxLogsQueryField extends React.PureComponent { ); const fieldsQuery = queryBuilder.buildExploreQuery('FIELDS'); const influxFields = await datasource.metricFindQuery(fieldsQuery); - const fields: any[] = influxFields.map( - (field: any): any => ({ - label: field.text, - value: field.text, - children: [], - }) - ); + const fields: any[] = influxFields.map((field: any): any => ({ + label: field.text, + value: field.text, + children: [], + })); measurements.push({ label: measurementObj.text, value: measurementObj.text, diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index 8444831836b..b1c44f964da 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -91,48 +91,46 @@ export default class InfluxDatasource extends DataSourceApi { - if (!data || !data.results) { - return []; - } - - const seriesList = []; - for (i = 0; i < data.results.length; i++) { - const result = data.results[i]; - if (!result || !result.series) { - continue; - } - - const target = queryTargets[i]; - let alias = target.alias; - if (alias) { - alias = this.templateSrv.replace(target.alias, options.scopedVars); - } - - const influxSeries = new InfluxSeries({ - series: data.results[i].series, - alias: alias, - }); - - switch (target.resultFormat) { - case 'table': { - seriesList.push(influxSeries.getTable()); - break; - } - default: { - const timeSeries = influxSeries.getTimeSeries(); - for (y = 0; y < timeSeries.length; y++) { - seriesList.push(timeSeries[y]); - } - break; - } - } - } - - return { data: seriesList }; + return this._seriesQuery(allQueries, options).then((data: any): any => { + if (!data || !data.results) { + return []; } - ); + + const seriesList = []; + for (i = 0; i < data.results.length; i++) { + const result = data.results[i]; + if (!result || !result.series) { + continue; + } + + const target = queryTargets[i]; + let alias = target.alias; + if (alias) { + alias = this.templateSrv.replace(target.alias, options.scopedVars); + } + + const influxSeries = new InfluxSeries({ + series: data.results[i].series, + alias: alias, + }); + + switch (target.resultFormat) { + case 'table': { + seriesList.push(influxSeries.getTable()); + break; + } + default: { + const timeSeries = influxSeries.getTimeSeries(); + for (y = 0; y < timeSeries.length; y++) { + seriesList.push(timeSeries[y]); + } + break; + } + } + } + + return { data: seriesList }; + }); } annotationQuery(options: any) { diff --git a/public/app/plugins/datasource/influxdb/influx_query_model.ts b/public/app/plugins/datasource/influxdb/influx_query_model.ts index 3b573299a58..cdd50a397b8 100644 --- a/public/app/plugins/datasource/influxdb/influx_query_model.ts +++ b/public/app/plugins/datasource/influxdb/influx_query_model.ts @@ -24,8 +24,16 @@ export default class InfluxQueryModel { target.resultFormat = target.resultFormat || 'time_series'; target.orderByTime = target.orderByTime || 'ASC'; target.tags = target.tags || []; - target.groupBy = target.groupBy || [{ type: 'time', params: ['$__interval'] }, { type: 'fill', params: ['null'] }]; - target.select = target.select || [[{ type: 'field', params: ['value'] }, { type: 'mean', params: [] }]]; + target.groupBy = target.groupBy || [ + { type: 'time', params: ['$__interval'] }, + { type: 'fill', params: ['null'] }, + ]; + target.select = target.select || [ + [ + { type: 'field', params: ['value'] }, + { type: 'mean', params: [] }, + ], + ]; this.updateProjection(); } diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.ts b/public/app/plugins/datasource/influxdb/query_ctrl.ts index 3502ecc5027..1ddeccb6da1 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.ts +++ b/public/app/plugins/datasource/influxdb/query_ctrl.ts @@ -33,7 +33,10 @@ export class InfluxQueryCtrl extends QueryCtrl { this.queryModel = new InfluxQueryModel(this.target, templateSrv, this.panel.scopedVars); this.queryBuilder = new InfluxQueryBuilder(this.target, this.datasource.database); this.groupBySegment = this.uiSegmentSrv.newPlusButton(); - this.resultFormats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }]; + this.resultFormats = [ + { text: 'Time series', value: 'time_series' }, + { text: 'Table', value: 'table' }, + ]; this.policySegment = uiSegmentSrv.newSegment(this.target.policy); if (!this.target.measurement) { diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_model.test.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_model.test.ts index 1c4503bea75..14e059a7838 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_model.test.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_model.test.ts @@ -111,7 +111,10 @@ describe('InfluxQuery', () => { refId: 'A', measurement: 'cpu', groupBy: [{ type: 'time', params: ['auto'] }], - tags: [{ key: 'hostname', value: 'server1' }, { key: 'app', value: 'email', condition: 'AND' }], + tags: [ + { key: 'hostname', value: 'server1' }, + { key: 'app', value: 'email', condition: 'AND' }, + ], }, templateSrv, {} @@ -132,7 +135,10 @@ describe('InfluxQuery', () => { refId: 'A', measurement: 'cpu', groupBy: [{ type: 'time', params: ['auto'] }], - tags: [{ key: 'hostname', value: 'server1' }, { key: 'hostname', value: 'server2', condition: 'OR' }], + tags: [ + { key: 'hostname', value: 'server1' }, + { key: 'hostname', value: 'server2', condition: 'OR' }, + ], }, templateSrv, {} @@ -153,7 +159,10 @@ describe('InfluxQuery', () => { refId: 'A', measurement: 'cpu', groupBy: [{ type: 'time', params: ['auto'] }], - tags: [{ key: 'name', value: "Let's encrypt." }, { key: 'hostname', value: 'server2', condition: 'OR' }], + tags: [ + { key: 'name', value: "Let's encrypt." }, + { key: 'hostname', value: 'server2', condition: 'OR' }, + ], }, templateSrv, {} @@ -192,7 +201,10 @@ describe('InfluxQuery', () => { refId: 'A', measurement: 'cpu', tags: [], - groupBy: [{ type: 'time', interval: 'auto' }, { type: 'tag', params: ['host'] }], + groupBy: [ + { type: 'time', interval: 'auto' }, + { type: 'tag', params: ['host'] }, + ], }, templateSrv, {} diff --git a/public/app/plugins/datasource/influxdb/specs/influx_series.test.ts b/public/app/plugins/datasource/influxdb/specs/influx_series.test.ts index 44232173e27..bf7b803130a 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_series.test.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_series.test.ts @@ -9,7 +9,10 @@ describe('when generating timeseries from influxdb response', () => { name: 'cpu', tags: { app: 'test', server: 'server1' }, columns: ['time', 'mean', 'max', 'min'], - values: [[1431946625000, 10, 11, 9], [1431946626000, 20, 21, 19]], + values: [ + [1431946625000, 10, 11, 9], + [1431946626000, 20, 21, 19], + ], }, ], }; @@ -71,13 +74,19 @@ describe('when generating timeseries from influxdb response', () => { name: 'cpu', tags: { app: 'test', server: 'server1' }, columns: ['time', 'value'], - values: [['2015-05-18T10:57:05Z', 10], ['2015-05-18T10:57:06Z', 12]], + values: [ + ['2015-05-18T10:57:05Z', 10], + ['2015-05-18T10:57:06Z', 12], + ], }, { name: 'cpu', tags: { app: 'test2', server: 'server2' }, columns: ['time', 'value'], - values: [['2015-05-18T10:57:05Z', 15], ['2015-05-18T10:57:06Z', 16]], + values: [ + ['2015-05-18T10:57:05Z', 15], + ['2015-05-18T10:57:06Z', 16], + ], }, ], }; @@ -101,13 +110,19 @@ describe('when generating timeseries from influxdb response', () => { name: 'cpu', tags: { app: 'test', server: 'server1' }, columns: ['time', 'mean'], - values: [[1431946625000, 10], [1431946626000, 12]], + values: [ + [1431946625000, 10], + [1431946626000, 12], + ], }, { name: 'cpu', tags: { app: 'test2', server: 'server2' }, columns: ['time', 'mean'], - values: [[1431946625000, 15], [1431946626000, 16]], + values: [ + [1431946625000, 15], + [1431946626000, 16], + ], }, ], }; @@ -162,7 +177,10 @@ describe('when generating timeseries from influxdb response', () => { name: 'app.prod.server1.count', tags: {}, columns: ['time', 'mean'], - values: [[1431946625000, 10], [1431946626000, 12]], + values: [ + [1431946625000, 10], + [1431946626000, 12], + ], }, ], }; @@ -184,7 +202,10 @@ describe('when generating timeseries from influxdb response', () => { name: 'app.prod.server1.count', tags: { datacenter: 'Africa', server: 'server2' }, columns: ['time', 'value2', 'value'], - values: [[1431946625000, 23, 10], [1431946626000, 25, 12]], + values: [ + [1431946625000, 23, 10], + [1431946626000, 25, 12], + ], }, ], }; diff --git a/public/app/plugins/datasource/influxdb/specs/query_builder.test.ts b/public/app/plugins/datasource/influxdb/specs/query_builder.test.ts index ee617e7e774..d8917946eb5 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_builder.test.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_builder.test.ts @@ -86,7 +86,10 @@ describe('InfluxQueryBuilder', () => { it('should have measurement tag condition and tag name IN filter in tag values query', () => { const builder = new InfluxQueryBuilder({ measurement: 'cpu', - tags: [{ key: 'app', value: 'email' }, { key: 'host', value: 'server1' }], + tags: [ + { key: 'app', value: 'email' }, + { key: 'host', value: 'server1' }, + ], }); const query = builder.buildExploreQuery('TAG_VALUES', 'app'); expect(query).toBe('SHOW TAG VALUES FROM "cpu" WITH KEY = "app" WHERE "host" = \'server1\''); @@ -96,7 +99,10 @@ describe('InfluxQueryBuilder', () => { const builder = new InfluxQueryBuilder({ measurement: 'cpu', policy: 'one_week', - tags: [{ key: 'app', value: 'email' }, { key: 'host', value: 'server1' }], + tags: [ + { key: 'app', value: 'email' }, + { key: 'host', value: 'server1' }, + ], }); const query = builder.buildExploreQuery('TAG_VALUES', 'app'); expect(query).toBe('SHOW TAG VALUES FROM "one_week"."cpu" WITH KEY = "app" WHERE "host" = \'server1\''); diff --git a/public/app/plugins/datasource/influxdb/specs/response_parser.test.ts b/public/app/plugins/datasource/influxdb/specs/response_parser.test.ts index cca78974fe3..e2c55951d83 100644 --- a/public/app/plugins/datasource/influxdb/specs/response_parser.test.ts +++ b/public/app/plugins/datasource/influxdb/specs/response_parser.test.ts @@ -62,12 +62,18 @@ describe('influxdb response parser', () => { { name: 'cpu', columns: ['key', 'value'], - values: [['source', 'site'], ['source', 'api']], + values: [ + ['source', 'site'], + ['source', 'api'], + ], }, { name: 'logins', columns: ['key', 'value'], - values: [['source', 'site'], ['source', 'webapi']], + values: [ + ['source', 'site'], + ['source', 'webapi'], + ], }, ], }, @@ -94,7 +100,11 @@ describe('influxdb response parser', () => { { name: 'cpu', columns: ['time', 'usage_iowait'], - values: [[1488465190006040638, 0.0], [1488465190006040638, 15.0], [1488465190006040638, 20.2]], + values: [ + [1488465190006040638, 0.0], + [1488465190006040638, 15.0], + [1488465190006040638, 20.2], + ], }, ], }, diff --git a/public/app/plugins/datasource/mssql/query_ctrl.ts b/public/app/plugins/datasource/mssql/query_ctrl.ts index f52950a3fd9..669aa5548e1 100644 --- a/public/app/plugins/datasource/mssql/query_ctrl.ts +++ b/public/app/plugins/datasource/mssql/query_ctrl.ts @@ -41,7 +41,10 @@ export class MssqlQueryCtrl extends QueryCtrl { this.target.format = this.target.format || 'time_series'; this.target.alias = ''; - this.formats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }]; + this.formats = [ + { text: 'Time series', value: 'time_series' }, + { text: 'Table', value: 'table' }, + ]; if (!this.target.rawSql) { // special handling when in table panel diff --git a/public/app/plugins/datasource/mssql/specs/datasource.test.ts b/public/app/plugins/datasource/mssql/specs/datasource.test.ts index eb7d2e18583..40ae2930662 100644 --- a/public/app/plugins/datasource/mssql/specs/datasource.test.ts +++ b/public/app/plugins/datasource/mssql/specs/datasource.test.ts @@ -92,7 +92,11 @@ describe('MSSQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -129,7 +133,11 @@ describe('MSSQLDatasource', () => { tables: [ { columns: [{ text: '__value' }, { text: '__text' }], - rows: [['value1', 'aTitle'], ['value2', 'aTitle2'], ['value3', 'aTitle3']], + rows: [ + ['value1', 'aTitle'], + ['value2', 'aTitle2'], + ['value3', 'aTitle3'], + ], }, ], }, @@ -168,7 +176,11 @@ describe('MSSQLDatasource', () => { tables: [ { columns: [{ text: '__text' }, { text: '__value' }], - rows: [['aTitle', 'same'], ['aTitle', 'same'], ['aTitle', 'diff']], + rows: [ + ['aTitle', 'same'], + ['aTitle', 'same'], + ['aTitle', 'diff'], + ], }, ], }, diff --git a/public/app/plugins/datasource/mysql/query_ctrl.ts b/public/app/plugins/datasource/mysql/query_ctrl.ts index 6b87d8febb3..269a7b6533b 100644 --- a/public/app/plugins/datasource/mysql/query_ctrl.ts +++ b/public/app/plugins/datasource/mysql/query_ctrl.ts @@ -59,7 +59,10 @@ export class MysqlQueryCtrl extends QueryCtrl { this.metaBuilder = new MysqlMetaQuery(this.target, this.queryModel); this.updateProjection(); - this.formats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }]; + this.formats = [ + { text: 'Time series', value: 'time_series' }, + { text: 'Table', value: 'table' }, + ]; if (!this.target.rawSql) { // special handling when in table panel diff --git a/public/app/plugins/datasource/mysql/specs/datasource.test.ts b/public/app/plugins/datasource/mysql/specs/datasource.test.ts index 7f5e9e39942..ac7b5b3dc13 100644 --- a/public/app/plugins/datasource/mysql/specs/datasource.test.ts +++ b/public/app/plugins/datasource/mysql/specs/datasource.test.ts @@ -98,7 +98,11 @@ describe('MySQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -135,7 +139,11 @@ describe('MySQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -173,7 +181,11 @@ describe('MySQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -210,7 +222,11 @@ describe('MySQLDatasource', () => { tables: [ { columns: [{ text: '__value' }, { text: '__text' }], - rows: [['value1', 'aTitle'], ['value2', 'aTitle2'], ['value3', 'aTitle3']], + rows: [ + ['value1', 'aTitle'], + ['value2', 'aTitle2'], + ['value3', 'aTitle3'], + ], }, ], }, @@ -248,7 +264,11 @@ describe('MySQLDatasource', () => { tables: [ { columns: [{ text: '__text' }, { text: '__value' }], - rows: [['aTitle', 'same'], ['aTitle', 'same'], ['aTitle', 'diff']], + rows: [ + ['aTitle', 'same'], + ['aTitle', 'same'], + ['aTitle', 'diff'], + ], }, ], }, diff --git a/public/app/plugins/datasource/opentsdb/config_ctrl.ts b/public/app/plugins/datasource/opentsdb/config_ctrl.ts index c2dd72ce3d6..2e301d09baf 100644 --- a/public/app/plugins/datasource/opentsdb/config_ctrl.ts +++ b/public/app/plugins/datasource/opentsdb/config_ctrl.ts @@ -9,7 +9,14 @@ export class OpenTsConfigCtrl { this.current.jsonData.tsdbResolution = this.current.jsonData.tsdbResolution || 1; } - tsdbVersions = [{ name: '<=2.1', value: 1 }, { name: '==2.2', value: 2 }, { name: '==2.3', value: 3 }]; + tsdbVersions = [ + { name: '<=2.1', value: 1 }, + { name: '==2.2', value: 2 }, + { name: '==2.3', value: 3 }, + ]; - tsdbResolutions = [{ name: 'second', value: 1 }, { name: 'millisecond', value: 2 }]; + tsdbResolutions = [ + { name: 'second', value: 1 }, + { name: 'millisecond', value: 2 }, + ]; } diff --git a/public/app/plugins/datasource/opentsdb/specs/datasource.test.ts b/public/app/plugins/datasource/opentsdb/specs/datasource.test.ts index 5fda183d4ea..df280f7f08d 100644 --- a/public/app/plugins/datasource/opentsdb/specs/datasource.test.ts +++ b/public/app/plugins/datasource/opentsdb/specs/datasource.test.ts @@ -24,7 +24,15 @@ describe('opentsdb', () => { ctx.backendSrv.datasourceRequest = await ((options: any) => { requestOptions = options; return Promise.resolve({ - data: [{ target: 'prod1.count', datapoints: [[10, 1], [12, 1]] }], + data: [ + { + target: 'prod1.count', + datapoints: [ + [10, 1], + [12, 1], + ], + }, + ], }); }); }); diff --git a/public/app/plugins/datasource/postgres/query_ctrl.ts b/public/app/plugins/datasource/postgres/query_ctrl.ts index 2e2c119bf10..3717ebf896a 100644 --- a/public/app/plugins/datasource/postgres/query_ctrl.ts +++ b/public/app/plugins/datasource/postgres/query_ctrl.ts @@ -57,7 +57,10 @@ export class PostgresQueryCtrl extends QueryCtrl { this.metaBuilder = new PostgresMetaQuery(this.target, this.queryModel); this.updateProjection(); - this.formats = [{ text: 'Time series', value: 'time_series' }, { text: 'Table', value: 'table' }]; + this.formats = [ + { text: 'Time series', value: 'time_series' }, + { text: 'Table', value: 'table' }, + ]; if (!this.target.rawSql) { // special handling when in table panel diff --git a/public/app/plugins/datasource/postgres/specs/datasource.test.ts b/public/app/plugins/datasource/postgres/specs/datasource.test.ts index 7a35a4cf530..9559b6c2cb7 100644 --- a/public/app/plugins/datasource/postgres/specs/datasource.test.ts +++ b/public/app/plugins/datasource/postgres/specs/datasource.test.ts @@ -105,7 +105,11 @@ describe('PostgreSQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -142,7 +146,11 @@ describe('PostgreSQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -180,7 +188,11 @@ describe('PostgreSQLDatasource', () => { tables: [ { columns: [{ text: 'title' }, { text: 'text' }], - rows: [['aTitle', 'some text'], ['aTitle2', 'some text2'], ['aTitle3', 'some text3']], + rows: [ + ['aTitle', 'some text'], + ['aTitle2', 'some text2'], + ['aTitle3', 'some text3'], + ], }, ], }, @@ -217,7 +229,11 @@ describe('PostgreSQLDatasource', () => { tables: [ { columns: [{ text: '__value' }, { text: '__text' }], - rows: [['value1', 'aTitle'], ['value2', 'aTitle2'], ['value3', 'aTitle3']], + rows: [ + ['value1', 'aTitle'], + ['value2', 'aTitle2'], + ['value3', 'aTitle3'], + ], }, ], }, @@ -255,7 +271,11 @@ describe('PostgreSQLDatasource', () => { tables: [ { columns: [{ text: '__text' }, { text: '__value' }], - rows: [['aTitle', 'same'], ['aTitle', 'same'], ['aTitle', 'diff']], + rows: [ + ['aTitle', 'same'], + ['aTitle', 'same'], + ['aTitle', 'diff'], + ], }, ], }, diff --git a/public/app/plugins/datasource/postgres/specs/postgres_query.test.ts b/public/app/plugins/datasource/postgres/specs/postgres_query.test.ts index 38019c9038e..2ad6718c7ab 100644 --- a/public/app/plugins/datasource/postgres/specs/postgres_query.test.ts +++ b/public/app/plugins/datasource/postgres/specs/postgres_query.test.ts @@ -60,7 +60,10 @@ describe('PostgresQuery', () => { let column = [{ type: 'column', params: ['value'] }]; expect(query.buildValueColumn(column)).toBe('value'); - column = [{ type: 'column', params: ['value'] }, { type: 'alias', params: ['alias'] }]; + column = [ + { type: 'column', params: ['value'] }, + { type: 'alias', params: ['alias'] }, + ]; expect(query.buildValueColumn(column)).toBe('value AS "alias"'); column = [ { type: 'column', params: ['v'] }, @@ -86,7 +89,10 @@ describe('PostgresQuery', () => { let column = [{ type: 'column', params: ['value'] }]; expect(query.buildValueColumn(column)).toBe('value'); - column = [{ type: 'column', params: ['value'] }, { type: 'alias', params: ['alias'] }]; + column = [ + { type: 'column', params: ['value'] }, + { type: 'alias', params: ['alias'] }, + ]; expect(query.buildValueColumn(column)).toBe('value AS "alias"'); column = [ { type: 'column', params: ['v'] }, @@ -129,7 +135,10 @@ describe('PostgresQuery', () => { query.target.where = [{ type: 'expression', params: ['v', '=', '1'] }]; expect(query.buildWhereClause()).toBe('\nWHERE\n v = 1'); - query.target.where = [{ type: 'macro', name: '$__timeFilter' }, { type: 'expression', params: ['v', '=', '1'] }]; + query.target.where = [ + { type: 'macro', name: '$__timeFilter' }, + { type: 'expression', params: ['v', '=', '1'] }, + ]; expect(query.buildWhereClause()).toBe('\nWHERE\n $__timeFilter(t) AND\n v = 1'); }); diff --git a/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx b/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx index 54546e534f0..7c1b364d9d1 100644 --- a/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx +++ b/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx @@ -3,7 +3,10 @@ import { EventsWithValidation, FormField, FormLabel, Input, regexValidation, Sel import { DataSourceSettings } from '@grafana/data'; import { PromOptions } from '../types'; -const httpOptions = [{ value: 'GET', label: 'GET' }, { value: 'POST', label: 'POST' }]; +const httpOptions = [ + { value: 'GET', label: 'GET' }, + { value: 'POST', label: 'POST' }, +]; type Props = { value: DataSourceSettings; diff --git a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts index 5192598b602..af144dc00df 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource.test.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource.test.ts @@ -150,15 +150,24 @@ describe('PrometheusDatasource', () => { const resultMock = [ { metric: { __name__: 'metric', job: 'testjob', le: '10' }, - values: [[1443454528.0, '10'], [1443454528.0, '10']], + values: [ + [1443454528.0, '10'], + [1443454528.0, '10'], + ], }, { metric: { __name__: 'metric', job: 'testjob', le: '20' }, - values: [[1443454528.0, '20'], [1443454528.0, '10']], + values: [ + [1443454528.0, '20'], + [1443454528.0, '10'], + ], }, { metric: { __name__: 'metric', job: 'testjob', le: '30' }, - values: [[1443454528.0, '25'], [1443454528.0, '10']], + values: [ + [1443454528.0, '25'], + [1443454528.0, '10'], + ], }, ]; const responseMock = { data: { data: { result: resultMock } } }; @@ -166,15 +175,24 @@ describe('PrometheusDatasource', () => { const expected = [ { target: '10', - datapoints: [[10, 1443454528000], [10, 1443454528000]], + datapoints: [ + [10, 1443454528000], + [10, 1443454528000], + ], }, { target: '20', - datapoints: [[10, 1443454528000], [0, 1443454528000]], + datapoints: [ + [10, 1443454528000], + [0, 1443454528000], + ], }, { target: '30', - datapoints: [[5, 1443454528000], [0, 1443454528000]], + datapoints: [ + [5, 1443454528000], + [0, 1443454528000], + ], }, ]; @@ -189,19 +207,31 @@ describe('PrometheusDatasource', () => { const resultMock = [ { metric: { __name__: 'metric', job: 'testjob', le: '2' }, - values: [[1443454528.0, '10'], [1443454528.0, '10']], + values: [ + [1443454528.0, '10'], + [1443454528.0, '10'], + ], }, { metric: { __name__: 'metric', job: 'testjob', le: '4' }, - values: [[1443454528.0, '20'], [1443454528.0, '10']], + values: [ + [1443454528.0, '20'], + [1443454528.0, '10'], + ], }, { metric: { __name__: 'metric', job: 'testjob', le: '+Inf' }, - values: [[1443454528.0, '25'], [1443454528.0, '10']], + values: [ + [1443454528.0, '25'], + [1443454528.0, '10'], + ], }, { metric: { __name__: 'metric', job: 'testjob', le: '1' }, - values: [[1443454528.0, '25'], [1443454528.0, '10']], + values: [ + [1443454528.0, '25'], + [1443454528.0, '10'], + ], }, ]; const responseMock = { data: { data: { result: resultMock } } }; @@ -534,7 +564,11 @@ describe('PrometheusDatasource', () => { result: [ { metric: { __name__: 'test', job: 'testjob', series: 'series 1' }, - values: [[start + step * 1, '3846'], [start + step * 3, '3847'], [end - step * 1, '3848']], + values: [ + [start + step * 1, '3846'], + [start + step * 3, '3847'], + [end - step * 1, '3848'], + ], }, { metric: { __name__: 'test', job: 'testjob', series: 'series 2' }, diff --git a/public/app/plugins/datasource/prometheus/specs/query_hints.test.ts b/public/app/plugins/datasource/prometheus/specs/query_hints.test.ts index 3056ced5ed7..ff1bbe070c6 100644 --- a/public/app/plugins/datasource/prometheus/specs/query_hints.test.ts +++ b/public/app/plugins/datasource/prometheus/specs/query_hints.test.ts @@ -10,19 +10,42 @@ describe('getQueryHints()', () => { }); it('returns no hint for a monotonically decreasing series', () => { - const series = [{ datapoints: [[23, 1000], [22, 1001]] }]; + const series = [ + { + datapoints: [ + [23, 1000], + [22, 1001], + ], + }, + ]; const hints = getQueryHints('metric', series); expect(hints).toEqual(null); }); it('returns no hint for a flat series', () => { - const series = [{ datapoints: [[null, 1000], [23, 1001], [null, 1002], [23, 1003]] }]; + const series = [ + { + datapoints: [ + [null, 1000], + [23, 1001], + [null, 1002], + [23, 1003], + ], + }, + ]; const hints = getQueryHints('metric', series); expect(hints).toEqual(null); }); it('returns a rate hint for a monotonically increasing series', () => { - const series = [{ datapoints: [[23, 1000], [24, 1001]] }]; + const series = [ + { + datapoints: [ + [23, 1000], + [24, 1001], + ], + }, + ]; const hints = getQueryHints('metric', series); expect(hints!.length).toBe(1); @@ -38,13 +61,27 @@ describe('getQueryHints()', () => { }); it('returns no rate hint for a monotonically increasing series that already has a rate', () => { - const series = [{ datapoints: [[23, 1000], [24, 1001]] }]; + const series = [ + { + datapoints: [ + [23, 1000], + [24, 1001], + ], + }, + ]; const hints = getQueryHints('rate(metric[1m])', series); expect(hints).toEqual(null); }); it('returns a rate hint w/o action for a complex monotonically increasing series', () => { - const series = [{ datapoints: [[23, 1000], [24, 1001]] }]; + const series = [ + { + datapoints: [ + [23, 1000], + [24, 1001], + ], + }, + ]; const hints = getQueryHints('sum(metric)', series); expect(hints!.length).toBe(1); expect(hints![0].label).toContain('rate()'); @@ -52,7 +89,15 @@ describe('getQueryHints()', () => { }); it('returns a rate hint for a monotonically increasing series with missing data', () => { - const series = [{ datapoints: [[23, 1000], [null, 1001], [24, 1002]] }]; + const series = [ + { + datapoints: [ + [23, 1000], + [null, 1001], + [24, 1002], + ], + }, + ]; const hints = getQueryHints('metric', series); expect(hints!.length).toBe(1); expect(hints![0]).toMatchObject({ @@ -84,7 +129,10 @@ describe('getQueryHints()', () => { it('returns a sum hint when many time series results are returned for a simple metric', () => { const seriesCount = SUM_HINT_THRESHOLD_COUNT; const series = Array.from({ length: seriesCount }, _ => ({ - datapoints: [[0, 0], [0, 0]], + datapoints: [ + [0, 0], + [0, 0], + ], })); const hints = getQueryHints('metric', series); expect(hints!.length).toBe(1); diff --git a/public/app/plugins/datasource/prometheus/specs/result_transformer.test.ts b/public/app/plugins/datasource/prometheus/specs/result_transformer.test.ts index 64a0fbccfc5..f92375ecfbe 100644 --- a/public/app/plugins/datasource/prometheus/specs/result_transformer.test.ts +++ b/public/app/plugins/datasource/prometheus/specs/result_transformer.test.ts @@ -124,15 +124,27 @@ describe('Prometheus Result Transformer', () => { result: [ { metric: { __name__: 'test', job: 'testjob', le: '1' }, - values: [[1445000010, '10'], [1445000020, '10'], [1445000030, '0']], + values: [ + [1445000010, '10'], + [1445000020, '10'], + [1445000030, '0'], + ], }, { metric: { __name__: 'test', job: 'testjob', le: '2' }, - values: [[1445000010, '20'], [1445000020, '10'], [1445000030, '30']], + values: [ + [1445000010, '20'], + [1445000020, '10'], + [1445000030, '30'], + ], }, { metric: { __name__: 'test', job: 'testjob', le: '3' }, - values: [[1445000010, '30'], [1445000020, '10'], [1445000030, '40']], + values: [ + [1445000010, '30'], + [1445000020, '10'], + [1445000030, '40'], + ], }, ], }, @@ -151,19 +163,31 @@ describe('Prometheus Result Transformer', () => { { target: '1', query: undefined, - datapoints: [[10, 1445000010000], [10, 1445000020000], [0, 1445000030000]], + datapoints: [ + [10, 1445000010000], + [10, 1445000020000], + [0, 1445000030000], + ], tags: { __name__: 'test', job: 'testjob', le: '1' }, }, { target: '2', query: undefined, - datapoints: [[10, 1445000010000], [0, 1445000020000], [30, 1445000030000]], + datapoints: [ + [10, 1445000010000], + [0, 1445000020000], + [30, 1445000030000], + ], tags: { __name__: 'test', job: 'testjob', le: '2' }, }, { target: '3', query: undefined, - datapoints: [[10, 1445000010000], [0, 1445000020000], [10, 1445000030000]], + datapoints: [ + [10, 1445000010000], + [0, 1445000020000], + [10, 1445000030000], + ], tags: { __name__: 'test', job: 'testjob', le: '3' }, }, ]); @@ -171,14 +195,46 @@ describe('Prometheus Result Transformer', () => { it('should handle missing datapoints', () => { const seriesList = [ - { datapoints: [[1, 1000], [2, 2000]] }, - { datapoints: [[2, 1000], [5, 2000], [1, 3000]] }, - { datapoints: [[3, 1000], [7, 2000]] }, + { + datapoints: [ + [1, 1000], + [2, 2000], + ], + }, + { + datapoints: [ + [2, 1000], + [5, 2000], + [1, 3000], + ], + }, + { + datapoints: [ + [3, 1000], + [7, 2000], + ], + }, ]; const expected = [ - { datapoints: [[1, 1000], [2, 2000]] }, - { datapoints: [[1, 1000], [3, 2000], [1, 3000]] }, - { datapoints: [[1, 1000], [2, 2000]] }, + { + datapoints: [ + [1, 1000], + [2, 2000], + ], + }, + { + datapoints: [ + [1, 1000], + [3, 2000], + [1, 3000], + ], + }, + { + datapoints: [ + [1, 1000], + [2, 2000], + ], + }, ]; const result = ctx.resultTransformer.transformToHistogramOverTime(seriesList); expect(result).toEqual(expected); @@ -209,7 +265,11 @@ describe('Prometheus Result Transformer', () => { result: [ { metric: { __name__: 'test', job: 'testjob' }, - values: [[0, '10'], [1, '10'], [2, '0']], + values: [ + [0, '10'], + [1, '10'], + [2, '0'], + ], }, ], }, @@ -226,7 +286,11 @@ describe('Prometheus Result Transformer', () => { { target: 'test{job="testjob"}', query: undefined, - datapoints: [[10, 0], [10, 1000], [0, 2000]], + datapoints: [ + [10, 0], + [10, 1000], + [0, 2000], + ], tags: { job: 'testjob' }, refId: 'B', }, @@ -241,7 +305,10 @@ describe('Prometheus Result Transformer', () => { result: [ { metric: { __name__: 'test', job: 'testjob' }, - values: [[1, '10'], [2, '0']], + values: [ + [1, '10'], + [2, '0'], + ], }, ], }, @@ -258,7 +325,11 @@ describe('Prometheus Result Transformer', () => { { target: 'test{job="testjob"}', query: undefined, - datapoints: [[null, 0], [10, 1000], [0, 2000]], + datapoints: [ + [null, 0], + [10, 1000], + [0, 2000], + ], tags: { job: 'testjob' }, }, ]); @@ -272,7 +343,10 @@ describe('Prometheus Result Transformer', () => { result: [ { metric: { __name__: 'test', job: 'testjob' }, - values: [[4, '10'], [8, '10']], + values: [ + [4, '10'], + [8, '10'], + ], }, ], }, @@ -289,7 +363,13 @@ describe('Prometheus Result Transformer', () => { { target: 'test{job="testjob"}', query: undefined, - datapoints: [[null, 0], [null, 2000], [10, 4000], [null, 6000], [10, 8000]], + datapoints: [ + [null, 0], + [null, 2000], + [10, 4000], + [null, 6000], + [10, 8000], + ], tags: { job: 'testjob' }, }, ]); diff --git a/public/app/plugins/panel/alertlist/module.ts b/public/app/plugins/panel/alertlist/module.ts index 713f06cc54d..b8972b56f84 100644 --- a/public/app/plugins/panel/alertlist/module.ts +++ b/public/app/plugins/panel/alertlist/module.ts @@ -11,7 +11,10 @@ class AlertListPanel extends PanelCtrl { static templateUrl = 'module.html'; static scrollable = true; - showOptions = [{ text: 'Current state', value: 'current' }, { text: 'Recent state changes', value: 'changes' }]; + showOptions = [ + { text: 'Current state', value: 'current' }, + { text: 'Recent state changes', value: 'changes' }, + ]; sortOrderOptions = [ { text: 'Alphabetical (asc)', value: 1 }, diff --git a/public/app/plugins/panel/graph/specs/align_yaxes.test.ts b/public/app/plugins/panel/graph/specs/align_yaxes.test.ts index d87de91fdd5..da34307f569 100644 --- a/public/app/plugins/panel/graph/specs/align_yaxes.test.ts +++ b/public/app/plugins/panel/graph/specs/align_yaxes.test.ts @@ -6,32 +6,56 @@ describe('Graph Y axes aligner', () => { describe('on the one hand with respect to zero', () => { it('Should shrink Y axis', () => { - yaxes = [{ min: 5, max: 10 }, { min: 2, max: 3 }]; - expected = [{ min: 5, max: 10 }, { min: 1.5, max: 3 }]; + yaxes = [ + { min: 5, max: 10 }, + { min: 2, max: 3 }, + ]; + expected = [ + { min: 5, max: 10 }, + { min: 1.5, max: 3 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axis', () => { - yaxes = [{ min: 2, max: 3 }, { min: 5, max: 10 }]; - expected = [{ min: 1.5, max: 3 }, { min: 5, max: 10 }]; + yaxes = [ + { min: 2, max: 3 }, + { min: 5, max: 10 }, + ]; + expected = [ + { min: 1.5, max: 3 }, + { min: 5, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axis', () => { - yaxes = [{ min: -10, max: -5 }, { min: -3, max: -2 }]; - expected = [{ min: -10, max: -5 }, { min: -3, max: -1.5 }]; + yaxes = [ + { min: -10, max: -5 }, + { min: -3, max: -2 }, + ]; + expected = [ + { min: -10, max: -5 }, + { min: -3, max: -1.5 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axis', () => { - yaxes = [{ min: -3, max: -2 }, { min: -10, max: -5 }]; - expected = [{ min: -3, max: -1.5 }, { min: -10, max: -5 }]; + yaxes = [ + { min: -3, max: -2 }, + { min: -10, max: -5 }, + ]; + expected = [ + { min: -3, max: -1.5 }, + { min: -10, max: -5 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -40,16 +64,28 @@ describe('Graph Y axes aligner', () => { describe('on the opposite sides with respect to zero', () => { it('Should shrink Y axes', () => { - yaxes = [{ min: -3, max: -1 }, { min: 5, max: 10 }]; - expected = [{ min: -3, max: 3 }, { min: -10, max: 10 }]; + yaxes = [ + { min: -3, max: -1 }, + { min: 5, max: 10 }, + ]; + expected = [ + { min: -3, max: 3 }, + { min: -10, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: 1, max: 3 }, { min: -10, max: -5 }]; - expected = [{ min: -3, max: 3 }, { min: -10, max: 10 }]; + yaxes = [ + { min: 1, max: 3 }, + { min: -10, max: -5 }, + ]; + expected = [ + { min: -3, max: 3 }, + { min: -10, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -58,16 +94,28 @@ describe('Graph Y axes aligner', () => { describe('both across zero', () => { it('Should shrink Y axes', () => { - yaxes = [{ min: -10, max: 5 }, { min: -2, max: 3 }]; - expected = [{ min: -10, max: 15 }, { min: -2, max: 3 }]; + yaxes = [ + { min: -10, max: 5 }, + { min: -2, max: 3 }, + ]; + expected = [ + { min: -10, max: 15 }, + { min: -2, max: 3 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -5, max: 10 }, { min: -3, max: 2 }]; - expected = [{ min: -15, max: 10 }, { min: -3, max: 2 }]; + yaxes = [ + { min: -5, max: 10 }, + { min: -3, max: 2 }, + ]; + expected = [ + { min: -15, max: 10 }, + { min: -3, max: 2 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -76,32 +124,56 @@ describe('Graph Y axes aligner', () => { describe('one of graphs on zero', () => { it('Should shrink Y axes', () => { - yaxes = [{ min: 0, max: 3 }, { min: 5, max: 10 }]; - expected = [{ min: 0, max: 3 }, { min: 0, max: 10 }]; + yaxes = [ + { min: 0, max: 3 }, + { min: 5, max: 10 }, + ]; + expected = [ + { min: 0, max: 3 }, + { min: 0, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: 5, max: 10 }, { min: 0, max: 3 }]; - expected = [{ min: 0, max: 10 }, { min: 0, max: 3 }]; + yaxes = [ + { min: 5, max: 10 }, + { min: 0, max: 3 }, + ]; + expected = [ + { min: 0, max: 10 }, + { min: 0, max: 3 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -3, max: 0 }, { min: -10, max: -5 }]; - expected = [{ min: -3, max: 0 }, { min: -10, max: 0 }]; + yaxes = [ + { min: -3, max: 0 }, + { min: -10, max: -5 }, + ]; + expected = [ + { min: -3, max: 0 }, + { min: -10, max: 0 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -10, max: -5 }, { min: -3, max: 0 }]; - expected = [{ min: -10, max: 0 }, { min: -3, max: 0 }]; + yaxes = [ + { min: -10, max: -5 }, + { min: -3, max: 0 }, + ]; + expected = [ + { min: -10, max: 0 }, + { min: -3, max: 0 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -110,16 +182,28 @@ describe('Graph Y axes aligner', () => { describe('both graphs on zero', () => { it('Should shrink Y axes', () => { - yaxes = [{ min: 0, max: 3 }, { min: -10, max: 0 }]; - expected = [{ min: -3, max: 3 }, { min: -10, max: 10 }]; + yaxes = [ + { min: 0, max: 3 }, + { min: -10, max: 0 }, + ]; + expected = [ + { min: -3, max: 3 }, + { min: -10, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -3, max: 0 }, { min: 0, max: 10 }]; - expected = [{ min: -3, max: 3 }, { min: -10, max: 10 }]; + yaxes = [ + { min: -3, max: 0 }, + { min: 0, max: 10 }, + ]; + expected = [ + { min: -3, max: 3 }, + { min: -10, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -128,32 +212,56 @@ describe('Graph Y axes aligner', () => { describe('mixed placement of graphs relative to zero', () => { it('Should shrink Y axes', () => { - yaxes = [{ min: -10, max: 5 }, { min: 1, max: 3 }]; - expected = [{ min: -10, max: 5 }, { min: -6, max: 3 }]; + yaxes = [ + { min: -10, max: 5 }, + { min: 1, max: 3 }, + ]; + expected = [ + { min: -10, max: 5 }, + { min: -6, max: 3 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: 1, max: 3 }, { min: -10, max: 5 }]; - expected = [{ min: -6, max: 3 }, { min: -10, max: 5 }]; + yaxes = [ + { min: 1, max: 3 }, + { min: -10, max: 5 }, + ]; + expected = [ + { min: -6, max: 3 }, + { min: -10, max: 5 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -10, max: 5 }, { min: -3, max: -1 }]; - expected = [{ min: -10, max: 5 }, { min: -3, max: 1.5 }]; + yaxes = [ + { min: -10, max: 5 }, + { min: -3, max: -1 }, + ]; + expected = [ + { min: -10, max: 5 }, + { min: -3, max: 1.5 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); }); it('Should shrink Y axes', () => { - yaxes = [{ min: -3, max: -1 }, { min: -10, max: 5 }]; - expected = [{ min: -3, max: 1.5 }, { min: -10, max: 5 }]; + yaxes = [ + { min: -3, max: -1 }, + { min: -10, max: 5 }, + ]; + expected = [ + { min: -3, max: 1.5 }, + { min: -10, max: 5 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -163,8 +271,14 @@ describe('Graph Y axes aligner', () => { describe('on level not zero', () => { it('Should shrink Y axis', () => { alignY = 1; - yaxes = [{ min: 5, max: 10 }, { min: 2, max: 4 }]; - expected = [{ min: 4, max: 10 }, { min: 2, max: 4 }]; + yaxes = [ + { min: 5, max: 10 }, + { min: 2, max: 4 }, + ]; + expected = [ + { min: 4, max: 10 }, + { min: 2, max: 4 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -172,8 +286,14 @@ describe('Graph Y axes aligner', () => { it('Should shrink Y axes', () => { alignY = 2; - yaxes = [{ min: -3, max: 1 }, { min: 5, max: 10 }]; - expected = [{ min: -3, max: 7 }, { min: -6, max: 10 }]; + yaxes = [ + { min: -3, max: 1 }, + { min: 5, max: 10 }, + ]; + expected = [ + { min: -3, max: 7 }, + { min: -6, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -181,8 +301,14 @@ describe('Graph Y axes aligner', () => { it('Should shrink Y axes', () => { alignY = -1; - yaxes = [{ min: -5, max: 5 }, { min: -2, max: 3 }]; - expected = [{ min: -5, max: 15 }, { min: -2, max: 3 }]; + yaxes = [ + { min: -5, max: 5 }, + { min: -2, max: 3 }, + ]; + expected = [ + { min: -5, max: 15 }, + { min: -2, max: 3 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -190,8 +316,14 @@ describe('Graph Y axes aligner', () => { it('Should shrink Y axes', () => { alignY = -2; - yaxes = [{ min: -2, max: 3 }, { min: 5, max: 10 }]; - expected = [{ min: -2, max: 3 }, { min: -2, max: 10 }]; + yaxes = [ + { min: -2, max: 3 }, + { min: 5, max: 10 }, + ]; + expected = [ + { min: -2, max: 3 }, + { min: -2, max: 10 }, + ]; alignYLevel(yaxes, alignY); expect(yaxes).toMatchObject(expected); @@ -200,8 +332,14 @@ describe('Graph Y axes aligner', () => { describe('on level not number value', () => { it('Should ignore without errors', () => { - yaxes = [{ min: 5, max: 10 }, { min: 2, max: 4 }]; - expected = [{ min: 5, max: 10 }, { min: 2, max: 4 }]; + yaxes = [ + { min: 5, max: 10 }, + { min: 2, max: 4 }, + ]; + expected = [ + { min: 5, max: 10 }, + { min: 2, max: 4 }, + ]; alignYLevel(yaxes, 'q'); expect(yaxes).toMatchObject(expected); diff --git a/public/app/plugins/panel/graph/specs/data_processor.test.ts b/public/app/plugins/panel/graph/specs/data_processor.test.ts index 8b76536b39c..5eee488b673 100644 --- a/public/app/plugins/panel/graph/specs/data_processor.test.ts +++ b/public/app/plugins/panel/graph/specs/data_processor.test.ts @@ -14,7 +14,11 @@ describe('Graph DataProcessor', () => { const dataList = getProcessedDataFrames([ { alias: 'First (time_series)', - datapoints: [[1, 1001], [2, 1002], [3, 1003]], + datapoints: [ + [1, 1001], + [2, 1002], + [3, 1003], + ], unit: 'watt', }, { diff --git a/public/app/plugins/panel/graph/specs/graph.test.ts b/public/app/plugins/panel/graph/specs/graph.test.ts index 563d564df50..c622f4167fa 100644 --- a/public/app/plugins/panel/graph/specs/graph.test.ts +++ b/public/app/plugins/panel/graph/specs/graph.test.ts @@ -96,13 +96,19 @@ describe('grafanaGraph', () => { ctx.data = []; ctx.data.push( new TimeSeries({ - datapoints: [[1, 1], [2, 2]], + datapoints: [ + [1, 1], + [2, 2], + ], alias: 'series1', }) ); ctx.data.push( new TimeSeries({ - datapoints: [[10, 1], [20, 2]], + datapoints: [ + [10, 1], + [20, 2], + ], alias: 'series2', }) ); @@ -256,12 +262,22 @@ describe('grafanaGraph', () => { beforeEach(() => { setupCtx(() => { ctx.data[0] = new TimeSeries({ - datapoints: [[2000, 1], [0.002, 2], [0, 3], [-1, 4]], + datapoints: [ + [2000, 1], + [0.002, 2], + [0, 3], + [-1, 4], + ], alias: 'seriesAutoscale', }); ctx.data[0].yaxis = 1; ctx.data[1] = new TimeSeries({ - datapoints: [[2000, 1], [0.002, 2], [0, 3], [-1, 4]], + datapoints: [ + [2000, 1], + [0.002, 2], + [0, 3], + [-1, 4], + ], alias: 'seriesFixedscale', }); ctx.data[1].yaxis = 2; @@ -301,7 +317,12 @@ describe('grafanaGraph', () => { setupCtx(() => { ctrl.panel.yaxes[0].logBase = 10; ctx.data[0] = new TimeSeries({ - datapoints: [[0, 1], [0, 2], [0, 3], [0, 4]], + datapoints: [ + [0, 1], + [0, 2], + [0, 3], + [0, 4], + ], alias: 'seriesAutoscale', }); ctx.data[0].yaxis = 1; @@ -328,7 +349,12 @@ describe('grafanaGraph', () => { ctrl.panel.yaxes[0].logBase = 10; ctrl.panel.yaxes[0].min = '0'; ctx.data[0] = new TimeSeries({ - datapoints: [[2000, 1], [4, 2], [500, 3], [3000, 4]], + datapoints: [ + [2000, 1], + [4, 2], + [500, 3], + [3000, 4], + ], alias: 'seriesAutoscale', }); ctx.data[0].yaxis = 1; @@ -354,7 +380,14 @@ describe('grafanaGraph', () => { ctrl.panel.yaxes[0].logBase = 2; ctrl.panel.yaxes[0].min = '0'; ctx.data[0] = new TimeSeries({ - datapoints: [[2000, 1], [4, 2], [500, 3], [3000, 4], [10000, 5], [100000, 6]], + datapoints: [ + [2000, 1], + [4, 2], + [500, 3], + [3000, 4], + [10000, 5], + [100000, 6], + ], alias: 'seriesAutoscale', }); ctx.data[0].yaxis = 1; @@ -396,7 +429,10 @@ describe('grafanaGraph', () => { setupCtx(() => { ctrl.panel.bars = true; ctx.data[0] = new TimeSeries({ - datapoints: [[1, 10], [2, 20]], + datapoints: [ + [1, 10], + [2, 20], + ], alias: 'series1', }); }); @@ -506,11 +542,21 @@ describe('grafanaGraph', () => { ctrl.panel.stack = true; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); ctx.data[1] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series2', }); }); @@ -531,11 +577,21 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = { series2: true }; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); ctx.data[1] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series2', }); }); @@ -555,7 +611,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -563,8 +624,18 @@ describe('grafanaGraph', () => { it('should not contain values lower than min', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(200); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(200); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -576,7 +647,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -584,8 +660,18 @@ describe('grafanaGraph', () => { it('should not contain values lower than zero', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -597,7 +683,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -605,8 +696,18 @@ describe('grafanaGraph', () => { it('xaxis min should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -618,7 +719,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -626,8 +732,18 @@ describe('grafanaGraph', () => { it('xaxis min should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -639,7 +755,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -647,8 +768,18 @@ describe('grafanaGraph', () => { it('should not contain values greater than max', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(200); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(200); }); }); @@ -660,7 +791,13 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -668,8 +805,18 @@ describe('grafanaGraph', () => { it('should not contain values greater than zero', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); }); }); @@ -681,7 +828,13 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -689,8 +842,18 @@ describe('grafanaGraph', () => { it('xaxis max should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -702,7 +865,13 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -710,8 +879,18 @@ describe('grafanaGraph', () => { it('xaxis max should not should node affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(-100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(-100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -724,7 +903,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -732,8 +916,18 @@ describe('grafanaGraph', () => { it('should not contain values lower than min and greater than max', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(200); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(200); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(200); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(200); }); }); @@ -746,7 +940,13 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[-100, 1], [100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [-100, 1], + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -754,8 +954,18 @@ describe('grafanaGraph', () => { it('xaxis max should be ignored otherwise the bucketSize is zero', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -768,7 +978,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -776,8 +991,18 @@ describe('grafanaGraph', () => { it('xaxis min and max should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -790,7 +1015,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -798,8 +1028,18 @@ describe('grafanaGraph', () => { it('xaxis min and max should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -812,7 +1052,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -820,8 +1065,18 @@ describe('grafanaGraph', () => { it('xaxis max should be ignored otherwise the bucketSize is negative', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(200); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(200); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -834,7 +1089,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -842,8 +1102,18 @@ describe('grafanaGraph', () => { it('xaxis min should be ignored otherwise the bucketSize is negative', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -855,7 +1125,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -863,8 +1138,18 @@ describe('grafanaGraph', () => { it('xaxis min should be ignored otherwise the bucketSize is zero', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -876,7 +1161,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -884,8 +1174,18 @@ describe('grafanaGraph', () => { it('xaxis min should not affect the histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); @@ -897,7 +1197,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -905,8 +1210,18 @@ describe('grafanaGraph', () => { it('should calculate correct histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); }); }); @@ -918,7 +1233,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -938,7 +1258,12 @@ describe('grafanaGraph', () => { ctrl.panel.stack = false; ctrl.hiddenSeries = {}; ctx.data[0] = new TimeSeries({ - datapoints: [[100, 1], [100, 2], [200, 3], [300, 4]], + datapoints: [ + [100, 1], + [100, 2], + [200, 3], + [300, 4], + ], alias: 'series1', }); }); @@ -946,8 +1271,18 @@ describe('grafanaGraph', () => { it('should calculate correct histogram', () => { const nonZero = ctx.plotData[0].data.filter((t: number[]) => t[1] > 0); - expect(Math.min.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(100); - expect(Math.max.apply(Math, nonZero.map((t: number[]) => t[0]))).toBe(300); + expect( + Math.min.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(100); + expect( + Math.max.apply( + Math, + nonZero.map((t: number[]) => t[0]) + ) + ).toBe(300); }); }); }); diff --git a/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts b/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts index c470d53ac5d..94bfabffbfb 100644 --- a/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts +++ b/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts @@ -49,7 +49,10 @@ describe('GraphCtrl', () => { const data = [ { target: 'test.cpu1', - datapoints: [[45, 1234567890], [60, 1234567899]], + datapoints: [ + [45, 1234567890], + [60, 1234567899], + ], }, ]; @@ -74,7 +77,10 @@ describe('GraphCtrl', () => { const data = [ { target: 'test.cpu1', - datapoints: [[45, range.from + 1000], [60, range.from + 10000]], + datapoints: [ + [45, range.from + 1000], + [60, range.from + 10000], + ], }, ]; @@ -89,7 +95,10 @@ describe('GraphCtrl', () => { describe('datapointsCount given 2 series', () => { beforeEach(() => { - const data: any = [{ target: 'test.cpu1', datapoints: [] }, { target: 'test.cpu2', datapoints: [] }]; + const data: any = [ + { target: 'test.cpu1', datapoints: [] }, + { target: 'test.cpu2', datapoints: [] }, + ]; ctx.ctrl.onDataSnapshotLoad(data); }); diff --git a/public/app/plugins/panel/graph/specs/graph_tooltip.test.ts b/public/app/plugins/panel/graph/specs/graph_tooltip.test.ts index efd27b5e085..cba2a692e04 100644 --- a/public/app/plugins/panel/graph/specs/graph_tooltip.test.ts +++ b/public/app/plugins/panel/graph/specs/graph_tooltip.test.ts @@ -44,7 +44,16 @@ describe('findHoverIndexFromData', () => { // @ts-ignore const tooltip = new GraphTooltip(elem, dashboard, scope, getSeriesFn); const series = { - data: [[100, 0], [101, 0], [102, 0], [103, 0], [104, 0], [105, 0], [106, 0], [107, 0]], + data: [ + [100, 0], + [101, 0], + [102, 0], + [103, 0], + [104, 0], + [105, 0], + [106, 0], + [107, 0], + ], }; it('should return 0 if posX out of lower bounds', () => { @@ -71,8 +80,22 @@ describe('findHoverIndexFromData', () => { describeSharedTooltip('steppedLine false, stack false', (ctx: any) => { ctx.setup(() => { ctx.data = [ - { data: [[10, 15], [12, 20]], lines: {}, hideTooltip: false }, - { data: [[10, 2], [12, 3]], lines: {}, hideTooltip: false }, + { + data: [ + [10, 15], + [12, 20], + ], + lines: {}, + hideTooltip: false, + }, + { + data: [ + [10, 2], + [12, 3], + ], + lines: {}, + hideTooltip: false, + }, ]; ctx.pos = { x: 11 }; }); @@ -94,7 +117,15 @@ describeSharedTooltip('steppedLine false, stack false', (ctx: any) => { describeSharedTooltip('one series is hidden', (ctx: any) => { ctx.setup(() => { - ctx.data = [{ data: [[10, 15], [12, 20]] }, { data: [] }]; + ctx.data = [ + { + data: [ + [10, 15], + [12, 20], + ], + }, + { data: [] }, + ]; ctx.pos = { x: 11 }; }); }); @@ -103,21 +134,33 @@ describeSharedTooltip('steppedLine false, stack true, individual false', (ctx: a ctx.setup(() => { ctx.data = [ { - data: [[10, 15], [12, 20]], + data: [ + [10, 15], + [12, 20], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 15], [12, 20]], + points: [ + [10, 15], + [12, 20], + ], }, stack: true, hideTooltip: false, }, { - data: [[10, 2], [12, 3]], + data: [ + [10, 2], + [12, 3], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 2], [12, 3]], + points: [ + [10, 2], + [12, 3], + ], }, stack: true, hideTooltip: false, @@ -136,21 +179,33 @@ describeSharedTooltip('steppedLine false, stack true, individual false, series s ctx.setup(() => { ctx.data = [ { - data: [[10, 15], [12, 20]], + data: [ + [10, 15], + [12, 20], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 15], [12, 20]], + points: [ + [10, 15], + [12, 20], + ], }, stack: true, hideTooltip: false, }, { - data: [[10, 2], [12, 3]], + data: [ + [10, 2], + [12, 3], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 2], [12, 3]], + points: [ + [10, 2], + [12, 3], + ], }, stack: false, hideTooltip: false, @@ -169,21 +224,33 @@ describeSharedTooltip('steppedLine false, stack true, individual true', (ctx: an ctx.setup(() => { ctx.data = [ { - data: [[10, 15], [12, 20]], + data: [ + [10, 15], + [12, 20], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 15], [12, 20]], + points: [ + [10, 15], + [12, 20], + ], }, stack: true, hideTooltip: false, }, { - data: [[10, 2], [12, 3]], + data: [ + [10, 2], + [12, 3], + ], lines: {}, datapoints: { pointsize: 2, - points: [[10, 2], [12, 3]], + points: [ + [10, 2], + [12, 3], + ], }, stack: false, hideTooltip: false, diff --git a/public/app/plugins/panel/graph/specs/histogram.test.ts b/public/app/plugins/panel/graph/specs/histogram.test.ts index 7cb4e3e7483..52d31ad10b6 100644 --- a/public/app/plugins/panel/graph/specs/histogram.test.ts +++ b/public/app/plugins/panel/graph/specs/histogram.test.ts @@ -11,7 +11,11 @@ describe('Graph Histogam Converter', () => { it('Should convert to series-like array', () => { bucketSize = 10; - const expected = [[0, 2], [10, 3], [20, 2]]; + const expected = [ + [0, 2], + [10, 3], + [20, 2], + ]; const histogram = convertValuesToHistogram(values, bucketSize, 1, 29); expect(histogram).toMatchObject(expected); @@ -19,7 +23,14 @@ describe('Graph Histogam Converter', () => { it('Should not add empty buckets', () => { bucketSize = 5; - const expected = [[0, 2], [5, 0], [10, 2], [15, 1], [20, 1], [25, 1]]; + const expected = [ + [0, 2], + [5, 0], + [10, 2], + [15, 1], + [20, 1], + [25, 1], + ]; const histogram = convertValuesToHistogram(values, bucketSize, 1, 29); expect(histogram).toMatchObject(expected); @@ -32,7 +43,15 @@ describe('Graph Histogam Converter', () => { beforeEach(() => { data = [ { - datapoints: [[1, 0], [2, 0], [10, 0], [11, 0], [17, 0], [20, 0], [29, 0]], + datapoints: [ + [1, 0], + [2, 0], + [10, 0], + [11, 0], + [17, 0], + [20, 0], + [29, 0], + ], }, ]; }); diff --git a/public/app/plugins/panel/graph/specs/threshold_manager.test.ts b/public/app/plugins/panel/graph/specs/threshold_manager.test.ts index c96471502d5..9f3d77a6ee3 100644 --- a/public/app/plugins/panel/graph/specs/threshold_manager.test.ts +++ b/public/app/plugins/panel/graph/specs/threshold_manager.test.ts @@ -109,12 +109,18 @@ describe('ThresholdManager', () => { plotOptionsScenario('for threshold on two Y axes', (ctx: any) => { const data = new Array(2); data[0] = new TimeSeries({ - datapoints: [[0, 1], [300, 2]], + datapoints: [ + [0, 1], + [300, 2], + ], alias: 'left', }); data[0].yaxis = 1; data[1] = new TimeSeries({ - datapoints: [[0, 1], [300, 2]], + datapoints: [ + [0, 1], + [300, 2], + ], alias: 'right', }); data[1].yaxis = 2; diff --git a/public/app/plugins/panel/graph2/GraphPanelEditor.tsx b/public/app/plugins/panel/graph2/GraphPanelEditor.tsx index 7f55619f207..24897b1736f 100644 --- a/public/app/plugins/panel/graph2/GraphPanelEditor.tsx +++ b/public/app/plugins/panel/graph2/GraphPanelEditor.tsx @@ -85,7 +85,10 @@ export class GraphPanelEditor extends PureComponent> { onChange={value => { this.onTooltipOptionsChange({ mode: value.value as any }); }} - options={[{ label: 'All series', value: 'multi' }, { label: 'Single', value: 'single' }]} + options={[ + { label: 'All series', value: 'multi' }, + { label: 'Single', value: 'single' }, + ]} /> diff --git a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts index 6509eb0b53d..c235b1e10b1 100644 --- a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts +++ b/public/app/plugins/panel/heatmap/heatmap_tooltip.ts @@ -216,7 +216,11 @@ export class HeatmapTooltip { barWidth = Math.max(barWidth, 1); // Normalize histogram Y axis - const histogramDomain = _.reduce(_.map(histogramData, d => d[1]), (sum, val) => sum + val, 0); + const histogramDomain = _.reduce( + _.map(histogramData, d => d[1]), + (sum, val) => sum + val, + 0 + ); const histYScale = d3 .scaleLinear() .domain([0, histogramDomain]) diff --git a/public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts b/public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts index 11a4922f68d..db1cef44d94 100644 --- a/public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts +++ b/public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts @@ -30,7 +30,10 @@ describe('HeatmapCtrl', () => { const data: any = [ { target: 'test.cpu1', - datapoints: [[45, 1234567890], [60, 1234567899]], + datapoints: [ + [45, 1234567890], + [60, 1234567899], + ], }, ]; @@ -55,7 +58,10 @@ describe('HeatmapCtrl', () => { const data: any = [ { target: 'test.cpu1', - datapoints: [[45, range.from + 1000], [60, range.from + 10000]], + datapoints: [ + [45, range.from + 1000], + [60, range.from + 10000], + ], }, ]; @@ -70,7 +76,10 @@ describe('HeatmapCtrl', () => { describe('datapointsCount given 2 series', () => { beforeEach(() => { - const data: any = [{ target: 'test.cpu1', datapoints: [] }, { target: 'test.cpu2', datapoints: [] }]; + const data: any = [ + { target: 'test.cpu1', datapoints: [] }, + { target: 'test.cpu2', datapoints: [] }, + ]; ctx.ctrl.onSnapshotLoad(data); }); diff --git a/public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts b/public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts index 82b8357a8da..17e78d72783 100644 --- a/public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts +++ b/public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts @@ -123,19 +123,31 @@ describe('HeatmapDataConverter', () => { ctx.series = []; ctx.series.push( new TimeSeries({ - datapoints: [[1, 1422774000000], [1, 1422774000010], [2, 1422774060000]], + datapoints: [ + [1, 1422774000000], + [1, 1422774000010], + [2, 1422774060000], + ], alias: 'series1', }) ); ctx.series.push( new TimeSeries({ - datapoints: [[2, 1422774000000], [2, 1422774000010], [3, 1422774060000]], + datapoints: [ + [2, 1422774000000], + [2, 1422774000010], + [3, 1422774060000], + ], alias: 'series2', }) ); ctx.series.push( new TimeSeries({ - datapoints: [[5, 1422774000000], [3, 1422774000010], [4, 1422774060000]], + datapoints: [ + [5, 1422774000000], + [3, 1422774000010], + [4, 1422774060000], + ], alias: 'series3', }) ); @@ -224,21 +236,30 @@ describe('Histogram converter', () => { ctx.series = []; ctx.series.push( new TimeSeries({ - datapoints: [[1, 1422774000000], [0, 1422774060000]], + datapoints: [ + [1, 1422774000000], + [0, 1422774060000], + ], alias: '1', label: '1', }) ); ctx.series.push( new TimeSeries({ - datapoints: [[5, 1422774000000], [3, 1422774060000]], + datapoints: [ + [5, 1422774000000], + [3, 1422774060000], + ], alias: '2', label: '2', }) ); ctx.series.push( new TimeSeries({ - datapoints: [[0, 1422774000000], [1, 1422774060000]], + datapoints: [ + [0, 1422774000000], + [1, 1422774060000], + ], alias: '3', label: '3', }) diff --git a/public/app/plugins/panel/piechart/PieChartOptionsBox.tsx b/public/app/plugins/panel/piechart/PieChartOptionsBox.tsx index 2a06163d75e..86b2360ff5c 100644 --- a/public/app/plugins/panel/piechart/PieChartOptionsBox.tsx +++ b/public/app/plugins/panel/piechart/PieChartOptionsBox.tsx @@ -11,7 +11,10 @@ import { PieChartOptions } from './types'; const labelWidth = 8; -const pieChartOptions = [{ value: PieChartType.PIE, label: 'Pie' }, { value: PieChartType.DONUT, label: 'Donut' }]; +const pieChartOptions = [ + { value: PieChartType.PIE, label: 'Pie' }, + { value: PieChartType.DONUT, label: 'Donut' }, +]; export class PieChartOptionsBox extends PureComponent> { onPieTypeChange = (pieType: any) => this.props.onOptionsChange({ ...this.props.options, pieType: pieType.value }); diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index 4c34b5d38c7..58646601077 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -85,7 +85,10 @@ class SingleStatCtrl extends MetricsPanelCtrl { postfix: '', nullText: null, valueMaps: [{ value: 'null', op: '=', text: 'N/A' }], - mappingTypes: [{ name: 'value to text', value: 1 }, { name: 'range to text', value: 2 }], + mappingTypes: [ + { name: 'value to text', value: 1 }, + { name: 'range to text', value: 2 }, + ], rangeMaps: [{ from: 'null', to: 'null', text: 'N/A' }], mappingType: 1, nullPointMode: 'connected', diff --git a/public/app/plugins/panel/singlestat/specs/singlestat.test.ts b/public/app/plugins/panel/singlestat/specs/singlestat.test.ts index 9dbcb8faaaa..4aba951be9f 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat.test.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat.test.ts @@ -56,7 +56,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('with defaults', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 1], [20, 2]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 1], + [20, 2], + ], + }, + ]; }); it('Should use series avg as default main value', () => { @@ -70,7 +78,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing serie name instead of value', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 1], [20, 2]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 1], + [20, 2], + ], + }, + ]; ctx.ctrl.panel.valueName = 'name'; }); @@ -85,7 +101,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last iso time instead of value', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 1505634997920], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeAsIso'; ctx.ctrl.dashboard.isTimezoneUtc = () => false; @@ -102,7 +126,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last iso time instead of value (in UTC)', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 5000]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 5000], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeAsIso'; ctx.ctrl.dashboard.isTimezoneUtc = () => true; @@ -115,7 +147,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last us time instead of value', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 1505634997920], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeAsUS'; ctx.ctrl.dashboard.isTimezoneUtc = () => false; @@ -132,7 +172,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last us time instead of value (in UTC)', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 5000]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 5000], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeAsUS'; ctx.ctrl.dashboard.isTimezoneUtc = () => true; @@ -145,7 +193,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last time from now instead of value', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 1505634997920], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeFromNow'; }); @@ -161,7 +217,15 @@ describe('SingleStatCtrl', () => { singleStatScenario('showing last time from now instead of value (in UTC)', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[10, 12], [20, 1505634997920]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [10, 12], + [20, 1505634997920], + ], + }, + ]; ctx.ctrl.panel.valueName = 'last_time'; ctx.ctrl.panel.format = 'dateTimeFromNow'; }); @@ -175,7 +239,15 @@ describe('SingleStatCtrl', () => { 'MainValue should use same number for decimals as displayed when checking thresholds', (ctx: TestContext) => { ctx.setup(() => { - ctx.input = [{ target: 'test.cpu1', datapoints: [[99.999, 1], [99.99999, 2]] }]; + ctx.input = [ + { + target: 'test.cpu1', + datapoints: [ + [99.999, 1], + [99.99999, 2], + ], + }, + ]; ctx.ctrl.panel.valueName = 'avg'; ctx.ctrl.panel.format = 'none'; }); @@ -224,7 +296,10 @@ describe('SingleStatCtrl', () => { ctx.setup(() => { ctx.input = [{ target: 'test.cpu1', datapoints: [[41, 50]] }]; ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{ from: '10', to: '50', text: 'OK' }, { from: '51', to: '100', text: 'NOT OK' }]; + ctx.ctrl.panel.rangeMaps = [ + { from: '10', to: '50', text: 'OK' }, + { from: '51', to: '100', text: 'NOT OK' }, + ]; }); it('Should replace value with text OK', () => { @@ -236,7 +311,10 @@ describe('SingleStatCtrl', () => { ctx.setup(() => { ctx.input = [{ target: 'test.cpu1', datapoints: [[65, 75]] }]; ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{ from: '10', to: '50', text: 'OK' }, { from: '51', to: '100', text: 'NOT OK' }]; + ctx.ctrl.panel.rangeMaps = [ + { from: '10', to: '50', text: 'OK' }, + { from: '51', to: '100', text: 'NOT OK' }, + ]; }); it('Should replace value with text NOT OK', () => { @@ -327,7 +405,10 @@ describe('SingleStatCtrl', () => { ctx.input[0].rows[0] = [1492759673649, 'ignore1', 41, 'ignore2']; ctx.ctrl.panel.tableColumn = 'mean'; ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{ from: '10', to: '50', text: 'OK' }, { from: '51', to: '100', text: 'NOT OK' }]; + ctx.ctrl.panel.rangeMaps = [ + { from: '10', to: '50', text: 'OK' }, + { from: '51', to: '100', text: 'NOT OK' }, + ]; }); it('Should replace value with text OK', () => { @@ -341,7 +422,10 @@ describe('SingleStatCtrl', () => { ctx.input[0].rows[0] = [1492759673649, 'ignore1', 65, 'ignore2']; ctx.ctrl.panel.tableColumn = 'mean'; ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{ from: '10', to: '50', text: 'OK' }, { from: '51', to: '100', text: 'NOT OK' }]; + ctx.ctrl.panel.rangeMaps = [ + { from: '10', to: '50', text: 'OK' }, + { from: '51', to: '100', text: 'NOT OK' }, + ]; }); it('Should replace value with text NOT OK', () => { diff --git a/public/app/plugins/panel/table/column_options.ts b/public/app/plugins/panel/table/column_options.ts index 3af546fc84c..4f65fcee21f 100644 --- a/public/app/plugins/panel/table/column_options.ts +++ b/public/app/plugins/panel/table/column_options.ts @@ -43,7 +43,10 @@ export class ColumnOptionsCtrl { { text: 'MMMM D, YYYY LT', value: 'MMMM D, YYYY LT' }, { text: 'YYYY-MM-DD', value: 'YYYY-MM-DD' }, ]; - this.mappingTypes = [{ text: 'Value to text', value: 1 }, { text: 'Range to text', value: 2 }]; + this.mappingTypes = [ + { text: 'Value to text', value: 1 }, + { text: 'Range to text', value: 2 }, + ]; this.getColumnNames = () => { if (!this.panelCtrl.table) { diff --git a/public/app/plugins/panel/table/specs/transformers.test.ts b/public/app/plugins/panel/table/specs/transformers.test.ts index a1acf20440c..f35f12c0d00 100644 --- a/public/app/plugins/panel/table/specs/transformers.test.ts +++ b/public/app/plugins/panel/table/specs/transformers.test.ts @@ -8,7 +8,10 @@ describe('when transforming time series table', () => { const timeSeries = [ { target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], }, { target: 'series2', @@ -73,7 +76,10 @@ describe('when transforming time series table', () => { const panel = { transform: 'timeseries_aggregations', sort: { col: 0, desc: true }, - columns: [{ text: 'Max', value: 'max' }, { text: 'Min', value: 'min' }], + columns: [ + { text: 'Max', value: 'max' }, + { text: 'Min', value: 'min' }, + ], }; beforeEach(() => { @@ -306,7 +312,10 @@ describe('when transforming time series table', () => { const data = [ { target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], }, { columns: [ @@ -319,7 +328,10 @@ describe('when transforming time series table', () => { }, ], type: 'table', - rows: [[time, 13.13], [time + 1, 26.26]], + rows: [ + [time, 13.13], + [time + 1, 26.26], + ], }, ]; @@ -377,7 +389,10 @@ describe('when transforming time series table', () => { const panel = { transform: 'timeseries_aggregations', sort: { col: 0, desc: true }, - columns: [{ text: 'Max', value: 'max' }, { text: 'Min', value: 'min' }], + columns: [ + { text: 'Max', value: 'max' }, + { text: 'Min', value: 'min' }, + ], }; beforeEach(() => { @@ -428,7 +443,10 @@ describe('timeSeriesFormatFilterer', () => { const data: any[] = [ { target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], }, { columns: [ @@ -441,7 +459,10 @@ describe('timeSeriesFormatFilterer', () => { }, ], type: 'table', - rows: [[time, 13.13], [time + 1, 26.26]], + rows: [ + [time, 13.13], + [time + 1, 26.26], + ], }, ]; @@ -450,7 +471,10 @@ describe('timeSeriesFormatFilterer', () => { expect(result).toEqual([ { target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], }, ]); }); @@ -484,7 +508,10 @@ describe('tableDataFormatFilterer', () => { const data: any[] = [ { target: 'series1', - datapoints: [[12.12, time], [14.44, time + 1]], + datapoints: [ + [12.12, time], + [14.44, time + 1], + ], }, { columns: [ @@ -497,7 +524,10 @@ describe('tableDataFormatFilterer', () => { }, ], type: 'table', - rows: [[time, 13.13], [time + 1, 26.26]], + rows: [ + [time, 13.13], + [time + 1, 26.26], + ], }, ]; @@ -515,7 +545,10 @@ describe('tableDataFormatFilterer', () => { }, ], type: 'table', - rows: [[time, 13.13], [time + 1, 26.26]], + rows: [ + [time, 13.13], + [time + 1, 26.26], + ], }, ]); }); diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index 5c52bfbdb9b..2d1985be4dd 100644 --- a/public/app/routes/routes.ts +++ b/public/app/routes/routes.ts @@ -126,7 +126,9 @@ export function setupAngularRoutes($routeProvider: route.IRouteProvider, $locati resolve: { component: () => SafeDynamicImport( - import(/* webpackChunkName: "DataSourceSettingsPage"*/ '../features/datasources/settings/DataSourceSettingsPage') + import( + /* webpackChunkName: "DataSourceSettingsPage"*/ '../features/datasources/settings/DataSourceSettingsPage' + ) ), }, }) diff --git a/yarn.lock b/yarn.lock index 1b00847ac68..4a1ac95c38a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5862,6 +5862,11 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" +caniuse-db@1.0.30000772: + version "1.0.30000772" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000772.tgz#51aae891768286eade4a3d8319ea76d6a01b512b" + integrity sha1-UarokXaChureSj2DGep21qAbUSs= + caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000939, caniuse-lite@^1.0.30000947, caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000999: version "1.0.30000999" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43" @@ -16369,10 +16374,10 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= -prettier@1.16.4: - version "1.16.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" - integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== +prettier@1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== prettier@^1.16.4, prettier@^1.18.2: version "1.18.2"