Angular cleanup: Move directives (#35330)

* angular2react: Remove json_editor_ctrl

* angular2react: Move directives

* Add to angular dir
This commit is contained in:
Tobias Skarhed 2021-06-08 08:28:56 +02:00 committed by GitHub
parent 8a0cef9954
commit 5e7df4cf6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 29 additions and 42 deletions

View File

@ -1,5 +1,5 @@
import { isArray } from 'lodash';
import coreModule from '../core_module';
import coreModule from '../core/core_module';
export function arrayJoin() {
'use strict';

View File

@ -1,4 +1,4 @@
import coreModule from '../core_module';
import coreModule from '../core/core_module';
/** @ngInject */
export function autofillEventFix($compile: any) {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) => {

View File

@ -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 */

View File

@ -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';

View File

@ -1,4 +1,4 @@
import coreModule from '../core_module';
import coreModule from '../core/core_module';
import { rangeUtil } from '@grafana/data';
function ngModelOnBlur() {

View File

@ -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];

View File

@ -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';

View File

@ -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) {

View File

@ -1 +0,0 @@
import './json_editor_ctrl';

View File

@ -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);

View File

@ -1,12 +1,12 @@
import './directives/dropdown_typeahead';
import './directives/autofill_event_fix';
import './directives/metric_segment';
import './directives/misc';
import './directives/ng_model_on_blur';
import './directives/tags';
import './directives/rebuild_on_change';
import './directives/give_focus';
import './directives/diff-view';
import '../angular/dropdown_typeahead';
import '../angular/autofill_event_fix';
import '../angular/metric_segment';
import '../angular/misc';
import '../angular/ng_model_on_blur';
import '../angular/tags';
import '../angular/rebuild_on_change';
import '../angular/give_focus';
import '../angular/diff-view';
import './jquery_extended';
import './partials';
import './components/jsontree/jsontree';
@ -17,13 +17,12 @@ import './services/ng_react';
import { colors, JsonExplorer } from '@grafana/ui/';
import { infoPopover } from './components/info_popover';
import { arrayJoin } from './directives/array_join';
import { arrayJoin } from '../angular/array_join';
import { switchDirective } from './components/switch';
import { dashboardSelector } from './components/dashboard_selector';
import { queryPartEditorDirective } from './components/query_part/query_part_editor';
import { sqlPartEditorDirective } from './components/sql_part/sql_part_editor';
import { formDropdownDirective } from './components/form_dropdown/form_dropdown';
import 'app/core/controllers/all';
import 'app/core/services/all';
import './filters/filters';
import coreModule from './core_module';