mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
wip: panel-header: Add "Edit JSON" functionality + make sure everyone using the json editor pass in the model property instead of the scope property when triggering the json modal
This commit is contained in:
@@ -4,13 +4,13 @@ import coreModule from '../core_module';
|
||||
export class JsonEditorCtrl {
|
||||
/** @ngInject */
|
||||
constructor($scope) {
|
||||
$scope.json = angular.toJson($scope.object, true);
|
||||
$scope.canUpdate = $scope.updateHandler !== void 0 && $scope.contextSrv.isEditor;
|
||||
$scope.canCopy = $scope.enableCopy;
|
||||
$scope.json = angular.toJson($scope.model.object, true);
|
||||
$scope.canUpdate = $scope.model.updateHandler !== void 0 && $scope.contextSrv.isEditor;
|
||||
$scope.canCopy = $scope.model.enableCopy;
|
||||
|
||||
$scope.update = () => {
|
||||
const newObject = angular.fromJson($scope.json);
|
||||
$scope.updateHandler(newObject, $scope.object);
|
||||
$scope.model.updateHandler(newObject, $scope.model.object);
|
||||
};
|
||||
|
||||
$scope.getContentForClipboard = () => $scope.json;
|
||||
|
||||
Reference in New Issue
Block a user