mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed share json (#23607)
This commit is contained in:
@@ -2,3 +2,4 @@ import './invited_ctrl';
|
|||||||
import './signup_ctrl';
|
import './signup_ctrl';
|
||||||
import './reset_password_ctrl';
|
import './reset_password_ctrl';
|
||||||
import './error_ctrl';
|
import './error_ctrl';
|
||||||
|
import './json_editor_ctrl';
|
||||||
|
|||||||
20
public/app/core/controllers/json_editor_ctrl.ts
Normal file
20
public/app/core/controllers/json_editor_ctrl.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import angular from 'angular';
|
||||||
|
import coreModule from '../core_module';
|
||||||
|
|
||||||
|
export class JsonEditorCtrl {
|
||||||
|
/** @ngInject */
|
||||||
|
constructor($scope: any) {
|
||||||
|
$scope.json = angular.toJson($scope.model.object, true);
|
||||||
|
$scope.canUpdate = $scope.model.updateHandler !== void 0 && $scope.model.canUpdate;
|
||||||
|
$scope.canCopy = $scope.model.enableCopy;
|
||||||
|
|
||||||
|
$scope.update = () => {
|
||||||
|
const newObject = angular.fromJson($scope.json);
|
||||||
|
$scope.model.updateHandler(newObject, $scope.model.object);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.getContentForClipboard = () => $scope.json;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
coreModule.controller('JsonEditorCtrl', JsonEditorCtrl);
|
||||||
Reference in New Issue
Block a user