mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Angular: Move coreModule to app/angular and isolate angular usage more (#41433)
* moving coreModule to app/angular and isolating it more * fixed ts issue
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { find, map, reduce, remove } from 'lodash';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { ThresholdMapper } from './state/ThresholdMapper';
|
||||
import { QueryPart } from 'app/angular/components/query_part';
|
||||
import alertDef from './state/alertDef';
|
||||
@@ -12,7 +12,7 @@ import { DataQuery, DataSourceApi, rangeUtil } from '@grafana/data';
|
||||
import { PanelModel } from 'app/features/dashboard/state';
|
||||
import { getDefaultCondition } from './getAlertingValidationMessage';
|
||||
import { CoreEvents } from 'app/types';
|
||||
import { promiseToDigest } from 'app/core/utils/promiseToDigest';
|
||||
import { promiseToDigest } from 'app/angular/promiseToDigest';
|
||||
import { ShowConfirmModalEvent } from '../../types/events';
|
||||
|
||||
export class AlertTabCtrl {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isString, escape } from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import alertDef from '../alerting/state/alertDef';
|
||||
import { DashboardSrv } from '../dashboard/services/DashboardSrv';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
|
||||
@@ -11,8 +11,7 @@ import {
|
||||
ScopedVars,
|
||||
} from '@grafana/data';
|
||||
|
||||
import coreModule from 'app/core/core_module';
|
||||
import { DashboardModel } from '../dashboard/state';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { AnnotationQueryOptions, AnnotationQueryResponse } from './types';
|
||||
import { standardAnnotationSupport } from './standardAnnotationSupport';
|
||||
import { runRequest } from '../query/state/runRequest';
|
||||
@@ -26,13 +25,6 @@ function getNextRequestId() {
|
||||
* @deprecated AnnotationsSrv is deprecated in favor of DashboardQueryRunner
|
||||
*/
|
||||
export class AnnotationsSrv {
|
||||
/**
|
||||
* @deprecated init is deprecated in favor of DashboardQueryRunner.run
|
||||
*/
|
||||
init(dashboard: DashboardModel) {
|
||||
deprecationWarning('annotations_srv.ts', 'init', 'DashboardQueryRunner.run');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated clearPromiseCaches is deprecated
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,6 @@ import { executeAnnotationQuery } from '../annotations_srv';
|
||||
import { PanelModel } from 'app/features/dashboard/state';
|
||||
import { AnnotationQueryResponse } from '../types';
|
||||
import { AnnotationFieldMapper } from './AnnotationResultMapper';
|
||||
import coreModule from 'app/core/core_module';
|
||||
|
||||
interface Props {
|
||||
datasource: DataSourceApi;
|
||||
@@ -187,11 +186,3 @@ export default class StandardAnnotationQueryEditor extends PureComponent<Props,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Careful to use a unique directive name! many plugins already use "annotationEditor" and have conflicts
|
||||
coreModule.directive('standardAnnotationEditor', [
|
||||
'reactDirective',
|
||||
(reactDirective: any) => {
|
||||
return reactDirective(StandardAnnotationQueryEditor, ['annotation', 'datasource', 'change']);
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cloneDeep, isNumber } from 'lodash';
|
||||
import { coreModule } from 'app/core/core';
|
||||
import { coreModule } from 'app/angular/core_module';
|
||||
import { AnnotationEvent, dateTime } from '@grafana/data';
|
||||
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
|
||||
import { deleteAnnotation, saveAnnotation, updateAnnotation } from './api';
|
||||
|
||||
@@ -4,8 +4,7 @@ import { render, screen } from '@testing-library/react';
|
||||
import { within } from '@testing-library/dom';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { setDataSourceSrv } from '@grafana/runtime';
|
||||
import { setAngularLoader } from 'app/core/services/AngularLoader';
|
||||
import { setAngularLoader, setDataSourceSrv } from '@grafana/runtime';
|
||||
import { AnnotationsSettings } from './AnnotationsSettings';
|
||||
|
||||
describe('AnnotationsSettings', () => {
|
||||
@@ -80,7 +79,6 @@ describe('AnnotationsSettings', () => {
|
||||
},
|
||||
} as any);
|
||||
|
||||
// @ts-ignore
|
||||
setAngularLoader({
|
||||
load: () => ({
|
||||
destroy: jest.fn(),
|
||||
|
||||
@@ -2,12 +2,12 @@ import { map, find } from 'lodash';
|
||||
import { IScope } from 'angular';
|
||||
import { AppEvents } from '@grafana/data';
|
||||
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { ValidationSrv } from 'app/features/manage-dashboards';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
import { promiseToDigest } from '../../../../core/utils/promiseToDigest';
|
||||
import { promiseToDigest } from '../../../../angular/promiseToDigest';
|
||||
import { createFolder } from 'app/features/manage-dashboards/state/actions';
|
||||
|
||||
export class FolderPickerCtrl {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { isNumber } from 'lodash';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { DashboardModel } from '../../state/DashboardModel';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { appEvents } from 'app/core/app_events';
|
||||
import { DashboardModel } from '../state/DashboardModel';
|
||||
import { removePanel } from '../utils/panel';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { coreModule } from 'app/core/core';
|
||||
import { coreModule } from 'app/angular/core_module';
|
||||
|
||||
coreModule.directive('datasourceHttpSettings', () => {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { coreModule } from 'app/core/core';
|
||||
import { coreModule } from 'app/angular/core_module';
|
||||
|
||||
coreModule.directive('datasourceTlsAuthSettings', () => {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import angular from 'angular';
|
||||
import { AppEvents } from '@grafana/data';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { backendSrv } from 'app/core/services/backend_srv';
|
||||
|
||||
const hitTypes = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Libraries
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
// Services & Utils
|
||||
import { importDataSourcePlugin } from './plugin_loader';
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@ import angular, { ILocationService } from 'angular';
|
||||
import { each } from 'lodash';
|
||||
|
||||
import config from 'app/core/config';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
|
||||
import { DataSourceApi, PanelEvents } from '@grafana/data';
|
||||
import { importDataSourcePlugin, importAppPlugin } from './plugin_loader';
|
||||
|
||||
@@ -22,11 +22,12 @@ import * as redux from 'redux';
|
||||
import config from 'app/core/config';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import TableModel from 'app/core/table_model';
|
||||
import { coreModule, appEvents, contextSrv } from 'app/core/core';
|
||||
import { coreModule } from 'app/angular/core_module';
|
||||
import { appEvents, contextSrv } from 'app/core/core';
|
||||
import * as flatten from 'app/core/utils/flatten';
|
||||
import * as ticks from 'app/core/utils/ticks';
|
||||
import { BackendSrv, getBackendSrv } from 'app/core/services/backend_srv';
|
||||
import { promiseToDigest } from 'app/core/utils/promiseToDigest';
|
||||
import { promiseToDigest } from 'app/angular/promiseToDigest';
|
||||
import impressionSrv from 'app/core/services/impression_srv';
|
||||
import builtInPlugins from './built_in_plugins';
|
||||
import * as d3 from 'd3';
|
||||
@@ -82,6 +83,7 @@ grafanaRuntime.SystemJS.config({
|
||||
|
||||
function exposeToPlugin(name: string, component: any) {
|
||||
grafanaRuntime.SystemJS.registerDynamic(name, [], true, (require: any, exports: any, module: { exports: any }) => {
|
||||
console.log('registerDynamic callback', name);
|
||||
module.exports = component;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { find } from 'lodash';
|
||||
import { getPluginSettings } from './PluginSettingsCache';
|
||||
import { PluginMeta, AppEvents } from '@grafana/data';
|
||||
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
|
||||
import { promiseToDigest } from '../../core/utils/promiseToDigest';
|
||||
import { promiseToDigest } from '../../angular/promiseToDigest';
|
||||
import { NavModelSrv } from 'app/angular/services/nav_model_srv';
|
||||
|
||||
export class AppPageCtrl {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
import coreModule from 'app/angular/core_module';
|
||||
import { importDataSourcePlugin } from './plugin_loader';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
Reference in New Issue
Block a user