mirror of https://github.com/grafana/grafana
Angular cleanup: Move directives (#35330)
* angular2react: Remove json_editor_ctrl * angular2react: Move directives * Add to angular dirpull/35421/head
parent
8a0cef9954
commit
5e7df4cf6a
@ -1,5 +1,5 @@ |
||||
import { isArray } from 'lodash'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
|
||||
export function arrayJoin() { |
||||
'use strict'; |
||||
@ -1,5 +1,5 @@ |
||||
import angular from 'angular'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl'; |
||||
|
||||
export class DeltaCtrl { |
||||
@ -1,6 +1,6 @@ |
||||
import { each, reduce } from 'lodash'; |
||||
import $ from 'jquery'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
|
||||
/** @ngInject */ |
||||
export function dropdownTypeahead($compile: any) { |
||||
@ -1,4 +1,4 @@ |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
|
||||
coreModule.directive('giveFocus', () => { |
||||
return (scope: any, element: any, attrs: any) => { |
||||
@ -1,6 +1,6 @@ |
||||
import { debounce, find, indexOf, map, escape, unescape } from 'lodash'; |
||||
import $ from 'jquery'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
import { TemplateSrv } from 'app/features/templating/template_srv'; |
||||
|
||||
/** @ngInject */ |
||||
@ -1,6 +1,6 @@ |
||||
import angular from 'angular'; |
||||
import Clipboard from 'clipboard'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
import kbn from 'app/core/utils/kbn'; |
||||
import { appEvents } from 'app/core/core'; |
||||
import { AppEvents } from '@grafana/data'; |
||||
@ -1,4 +1,4 @@ |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
import { rangeUtil } from '@grafana/data'; |
||||
|
||||
function ngModelOnBlur() { |
||||
@ -1,5 +1,5 @@ |
||||
import $ from 'jquery'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
|
||||
function getBlockNodes(nodes: any[]) { |
||||
let node = nodes[0]; |
||||
@ -0,0 +1,9 @@ |
||||
import './alert_srv'; |
||||
import './util_srv'; |
||||
import './context_srv'; |
||||
import './timer'; |
||||
import './analytics'; |
||||
import './popover_srv'; |
||||
import './segment_srv'; |
||||
import './backend_srv'; |
||||
import './dynamic_directive_srv'; |
||||
@ -1,7 +1,7 @@ |
||||
import angular from 'angular'; |
||||
import { getTagColorsFromName } from '@grafana/ui'; |
||||
import $ from 'jquery'; |
||||
import coreModule from '../core_module'; |
||||
import coreModule from '../core/core_module'; |
||||
import 'vendor/tagsinput/bootstrap-tagsinput.js'; |
||||
|
||||
function setColor(name: string, element: JQuery) { |
||||
@ -1 +0,0 @@ |
||||
import './json_editor_ctrl'; |
||||
@ -1,20 +0,0 @@ |
||||
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); |
||||
Loading…
Reference in new issue