export_modal.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import kbn from 'app/core/utils/kbn';
  3. import coreModule from 'app/core/core_module';
  4. import appEvents from 'app/core/app_events';
  5. import config from 'app/core/config';
  6. import _ from 'lodash';
  7. import {DashboardExporter} from './exporter';
  8. export class DashExportCtrl {
  9. dash: any;
  10. exporter: DashboardExporter;
  11. /** @ngInject */
  12. constructor(private backendSrv, dashboardSrv, datasourceSrv, $scope) {
  13. this.exporter = new DashboardExporter(datasourceSrv);
  14. var current = dashboardSrv.getCurrent().getSaveModelClone();
  15. this.exporter.makeExportable(current).then(dash => {
  16. $scope.$apply(() => {
  17. this.dash = dash;
  18. });
  19. });
  20. }
  21. }
  22. export function dashExportDirective() {
  23. return {
  24. restrict: 'E',
  25. templateUrl: 'public/app/features/dashboard/export/export_modal.html',
  26. controller: DashExportCtrl,
  27. bindToController: true,
  28. controllerAs: 'ctrl',
  29. };
  30. }
  31. coreModule.directive('dashExportModal', dashExportDirective);