diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index dc44658ef6c..406a741b119 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -14,10 +14,9 @@ export interface BuildInfo { interface FeatureToggles { transformations: boolean; - inspect: boolean; expressions: boolean; newEdit: boolean; - meta: boolean; + meta: boolean; // enterprise newVariables: boolean; tracingIntegration: boolean; } @@ -67,7 +66,6 @@ export class GrafanaBootConfig { pluginsToPreload: string[] = []; featureToggles: FeatureToggles = { transformations: false, - inspect: false, expressions: false, newEdit: false, meta: false, diff --git a/public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts b/public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts deleted file mode 100644 index 8e6515be239..00000000000 --- a/public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts +++ /dev/null @@ -1,56 +0,0 @@ -import angular from 'angular'; -import * as fileExport from 'app/core/utils/file_export'; -import appEvents from 'app/core/app_events'; -import { DashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; -import { CoreEvents } from 'app/types'; - -export class ExportDataModalCtrl { - private data: any; - private panel: string; - asRows = true; - dateTimeFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - excel = false; - - /** @ngInject */ - constructor(private dashboardSrv: DashboardSrv) {} - - export() { - const timezone = this.dashboardSrv.getCurrent().timezone; - const options = { - excel: this.excel, - dateTimeFormat: this.dateTimeFormat, - timezone, - }; - if (this.panel === 'table') { - fileExport.exportTableDataToCsv(this.data, this.excel); - } else { - if (this.asRows) { - fileExport.exportSeriesListToCsv(this.data, options); - } else { - fileExport.exportSeriesListToCsvColumns(this.data, options); - } - } - - this.dismiss(); - } - - dismiss() { - appEvents.emit(CoreEvents.hideModal); - } -} - -export function exportDataModal() { - return { - restrict: 'E', - templateUrl: 'public/app/features/dashboard/components/ExportDataModal/template.html', - controller: ExportDataModalCtrl, - controllerAs: 'ctrl', - scope: { - panel: '<', - data: '<', // The difference to '=' is that the bound properties are not watched - }, - bindToController: true, - }; -} - -angular.module('grafana.directives').directive('exportDataModal', exportDataModal); diff --git a/public/app/features/dashboard/components/ExportDataModal/index.ts b/public/app/features/dashboard/components/ExportDataModal/index.ts deleted file mode 100644 index 6df4fd00434..00000000000 --- a/public/app/features/dashboard/components/ExportDataModal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ExportDataModalCtrl } from './ExportDataModalCtrl'; diff --git a/public/app/features/dashboard/components/ExportDataModal/template.html b/public/app/features/dashboard/components/ExportDataModal/template.html deleted file mode 100644 index f59bd629e03..00000000000 --- a/public/app/features/dashboard/components/ExportDataModal/template.html +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/public/app/features/dashboard/index.ts b/public/app/features/dashboard/index.ts index 5a2c9042304..7d043e70b0e 100644 --- a/public/app/features/dashboard/index.ts +++ b/public/app/features/dashboard/index.ts @@ -7,7 +7,6 @@ import './services/DashboardSrv'; import './components/DashLinks'; import './components/DashExportModal'; import './components/DashNav'; -import './components/ExportDataModal'; import './components/VersionHistory'; import './components/DashboardSettings'; import './components/SubMenu'; diff --git a/public/app/features/dashboard/utils/getPanelMenu.test.ts b/public/app/features/dashboard/utils/getPanelMenu.test.ts index d2658d4b074..1b24bdf2305 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.test.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.test.ts @@ -27,6 +27,12 @@ describe('getPanelMenu', () => { "shortcut": "p s", "text": "Share", }, + Object { + "iconClassName": "fa fa-fw fa-info-circle", + "onClick": [Function], + "shortcut": "p i", + "text": "Inspect", + }, Object { "iconClassName": "fa fa-fw fa-cube", "onClick": [Function], diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index abac2f624ac..44a9360a301 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -136,14 +136,12 @@ export function getPanelMenu( }); } - if (config.featureToggles.inspect) { - menu.push({ - text: 'Inspect', - iconClassName: 'fa fa-fw fa-info-circle', - onClick: onInspectPanel, - shortcut: 'p i', - }); - } + menu.push({ + text: 'Inspect', + iconClassName: 'fa fa-fw fa-info-circle', + onClick: onInspectPanel, + shortcut: 'p i', + }); if (config.featureToggles.newEdit) { menu.push({ diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index d82c09d49ba..4229ef53cba 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -178,7 +178,6 @@ class GraphCtrl extends MetricsPanelCtrl { } onInitPanelActions(actions: any[]) { - actions.push({ text: 'Export CSV', click: 'ctrl.exportCsv()' }); actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()', shortcut: 'p l' }); } @@ -339,18 +338,6 @@ class GraphCtrl extends MetricsPanelCtrl { this.render(); } - exportCsv() { - const scope = this.$scope.$new(true); - scope.seriesList = this.seriesList - .filter(series => !this.panel.legend.hideEmpty || !series.allIsNull) - .filter(series => !this.panel.legend.hideZero || !series.allIsZero); - this.publishAppEvent(CoreEvents.showModal, { - templateHtml: '', - scope, - modalClass: 'modal--narrow', - }); - } - onContextMenuClose = () => { this.contextMenuCtrl.toggleMenu(); }; 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 ed4bcfbdd69..df6e7f9a939 100644 --- a/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts +++ b/public/app/plugins/panel/graph/specs/graph_ctrl.test.ts @@ -143,49 +143,5 @@ describe('GraphCtrl', () => { // allIsNull / allIsZero are set by getFlotPairs ctx.ctrl.seriesList.forEach((series: TimeSeries) => series.getFlotPairs('')); }); - - const thenExportYieldedNSeries = (n: number) => { - expect(appEventMock.mock.calls.length).toBe(1); - const eventPayload = appEventMock.mock.calls[0][1]; - expect(eventPayload.scope.seriesList).toHaveLength(n); - }; - - const thenExportDidNotYieldSeriesName = (unexpectedName: string) => { - expect(appEventMock.mock.calls.length).toBe(1); - const eventPayload = appEventMock.mock.calls[0][1]; - expect( - eventPayload.scope.seriesList.filter((series: TimeSeries) => series.label === unexpectedName) - ).toHaveLength(0); - }; - - it('should not ignore anything if not asked to', () => { - ctx.ctrl.exportCsv(); - thenExportYieldedNSeries(3); - }); - - it('should ignore all-null series when asked to', () => { - ctx.ctrl.panel.legend.hideEmpty = true; - ctx.ctrl.exportCsv(); - thenExportYieldedNSeries(2); - thenExportDidNotYieldSeriesName('test.nulls'); - }); - - it('should ignore all-zero series when asked to', () => { - ctx.ctrl.panel.legend.hideZero = true; - ctx.ctrl.exportCsv(); - // impl treats all-null series as all-zero as well - thenExportYieldedNSeries(1); - thenExportDidNotYieldSeriesName('test.zeros'); - thenExportDidNotYieldSeriesName('test.empty'); - }); - - it('should ignore both when asked to', () => { - ctx.ctrl.panel.legend.hideZero = true; - ctx.ctrl.panel.legend.hideEmpty = true; - ctx.ctrl.exportCsv(); - thenExportYieldedNSeries(1); - thenExportDidNotYieldSeriesName('test.zeros'); - thenExportDidNotYieldSeriesName('test.empty'); - }); }); }); diff --git a/public/app/plugins/panel/table/module.ts b/public/app/plugins/panel/table/module.ts index e3748b24afa..067ee57ad6b 100644 --- a/public/app/plugins/panel/table/module.ts +++ b/public/app/plugins/panel/table/module.ts @@ -8,7 +8,6 @@ import { columnOptionsTab } from './column_options'; import { TableRenderer } from './renderer'; import { isTableData, PanelEvents, PanelPlugin } from '@grafana/data'; import { TemplateSrv } from 'app/features/templating/template_srv'; -import { CoreEvents } from 'app/types'; import { dispatch } from 'app/store/store'; import { applyFilterFromTable } from 'app/features/variables/adhoc/actions'; @@ -76,7 +75,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl { this.events.on(PanelEvents.dataReceived, this.onDataReceived.bind(this)); this.events.on(PanelEvents.dataSnapshotLoad, this.onDataReceived.bind(this)); this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); - this.events.on(PanelEvents.initPanelActions, this.onInitPanelActions.bind(this)); } onInitEditMode() { @@ -84,10 +82,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl { this.addEditorTab('Column Styles', columnOptionsTab, 3); } - onInitPanelActions(actions: any[]) { - actions.push({ text: 'Export CSV', click: 'ctrl.exportCsv()' }); - } - issueQueries(datasource: any) { this.pageIndex = 0; @@ -167,17 +161,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl { this.render(); } - exportCsv() { - const scope = this.$scope.$new(true); - scope.tableData = this.renderer.render_values(); - scope.panel = 'table'; - this.publishAppEvent(CoreEvents.showModal, { - templateHtml: '', - scope, - modalClass: 'modal--narrow', - }); - } - link(scope: any, elem: JQuery, attrs: any, ctrl: TablePanelCtrl) { let data: any; const panel = ctrl.panel;