mirror of https://github.com/grafana/grafana
parent
f484b4c347
commit
ee0d0155a5
@ -1,32 +0,0 @@ |
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
import config from 'app/core/config'; |
||||
import angular from 'angular'; |
||||
import _ from 'lodash'; |
||||
import * as fileExport from 'app/core/utils/file_export'; |
||||
|
||||
const module = angular.module('grafana.controllers'); |
||||
|
||||
export class ExportCsvModalCtrl { |
||||
scope: any; |
||||
seriesList: any = []; |
||||
/** @ngInject */ |
||||
constructor(private $scope) { |
||||
this.seriesList = $scope.seriesList; |
||||
this.$scope = $scope; |
||||
$scope.asRows = true; |
||||
$scope.dateTimeFormat = 'YYYY-MM-DDTHH:mm:ssZ'; |
||||
$scope.export = this.export.bind(this); |
||||
} |
||||
|
||||
export() { |
||||
if (this.$scope.asRows) { |
||||
fileExport.exportSeriesListToCsv(this.seriesList, this.$scope.dateTimeFormat); |
||||
} else { |
||||
fileExport.exportSeriesListToCsvColumns(this.seriesList, this.$scope.dateTimeFormat); |
||||
} |
||||
this.$scope.dismiss(); |
||||
} |
||||
} |
||||
|
||||
module.controller('ExportCsvModalCtrl', ExportCsvModalCtrl); |
||||
@ -0,0 +1,41 @@ |
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular'; |
||||
import * as fileExport from 'app/core/utils/file_export'; |
||||
import appEvents from 'app/core/app_events'; |
||||
|
||||
export class ExportDataModalCtrl { |
||||
private data: any[]; |
||||
asRows: Boolean = true; |
||||
dateTimeFormat: String = 'YYYY-MM-DDTHH:mm:ssZ'; |
||||
/** @ngInject */ |
||||
constructor(private $scope) { } |
||||
|
||||
export() { |
||||
if (this.asRows) { |
||||
fileExport.exportSeriesListToCsv(this.data, this.dateTimeFormat); |
||||
} else { |
||||
fileExport.exportSeriesListToCsvColumns(this.data, this.dateTimeFormat); |
||||
} |
||||
this.dismiss(); |
||||
} |
||||
|
||||
dismiss() { |
||||
appEvents.emit('hide-modal'); |
||||
} |
||||
} |
||||
|
||||
export function exportDataModal() { |
||||
return { |
||||
restrict: 'E', |
||||
templateUrl: 'public/app/features/dashboard/export_data/export_data_modal.html', |
||||
controller: ExportDataModalCtrl, |
||||
controllerAs: 'ctrl', |
||||
scope: { |
||||
data: '<' // The difference to '=' is that the bound properties are not watched
|
||||
}, |
||||
bindToController: true |
||||
}; |
||||
} |
||||
|
||||
angular.module('grafana.directives').directive('exportDataModal', exportDataModal); |
||||
Loading…
Reference in new issue