diff --git a/public/app/core/controllers/json_editor_ctrl.ts b/public/app/core/controllers/json_editor_ctrl.ts index 08491acc682..d369fe8b3c0 100644 --- a/public/app/core/controllers/json_editor_ctrl.ts +++ b/public/app/core/controllers/json_editor_ctrl.ts @@ -6,11 +6,14 @@ export class JsonEditorCtrl { constructor($scope) { $scope.json = angular.toJson($scope.object, true); $scope.canUpdate = $scope.updateHandler !== void 0 && $scope.contextSrv.isEditor; + $scope.canCopy = $scope.enableCopy; $scope.update = function() { var newObject = angular.fromJson($scope.json); $scope.updateHandler(newObject, $scope.object); }; + + $scope.getContentForClipboard = () => $scope.json; } } diff --git a/public/app/core/directives/misc.ts b/public/app/core/directives/misc.ts index 0d913c32349..299de05f112 100644 --- a/public/app/core/directives/misc.ts +++ b/public/app/core/directives/misc.ts @@ -2,6 +2,7 @@ import angular from 'angular'; import Clipboard from 'clipboard'; import coreModule from '../core_module'; import kbn from 'app/core/utils/kbn'; +import { appEvents } from 'app/core/core'; /** @ngInject */ function tip($compile) { @@ -32,6 +33,10 @@ function clipboardButton() { }, }); + scope.clipboard.on('success', () => { + appEvents.emit('alert-success', ['Content copied to clipboard']); + }); + scope.$on('$destroy', function() { if (scope.clipboard) { scope.clipboard.destroy(); diff --git a/public/app/features/dashboard/export/export_modal.ts b/public/app/features/dashboard/export/export_modal.ts index 929071c23a2..2e61ce9f8a8 100644 --- a/public/app/features/dashboard/export/export_modal.ts +++ b/public/app/features/dashboard/export/export_modal.ts @@ -31,6 +31,7 @@ export class DashExportCtrl { var clone = this.dash; let editScope = this.$rootScope.$new(); editScope.object = clone; + editScope.enableCopy = true; this.$rootScope.appEvent('show-modal', { src: 'public/app/partials/edit_json.html', diff --git a/public/app/features/dashboard/settings/settings.html b/public/app/features/dashboard/settings/settings.html index 0411850c543..18dd055ef05 100644 --- a/public/app/features/dashboard/settings/settings.html +++ b/public/app/features/dashboard/settings/settings.html @@ -89,7 +89,7 @@