AngularPanels: Move angular panel infra & components to angular/app folder (#40373)

* AngularPanels: Move to app/angular folder

* Fixing issues
This commit is contained in:
Torkel Ödegaard 2021-10-13 16:59:47 +02:00 committed by GitHub
parent 1505b8c0b0
commit c4ce7a40af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 38 additions and 34 deletions

View File

@ -13,6 +13,7 @@ import { monkeyPatchInjectorWithPreAssignedBindings } from 'app/core/injectorMon
import { extend } from 'lodash';
import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { getTemplateSrv } from '@grafana/runtime';
import './panel/all';
export class AngularApp {
ngModuleDependencies: any[];

View File

@ -1,5 +1,5 @@
import { isArray } from 'lodash';
import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { PanelCtrl } from 'app/angular/panel/panel_ctrl';
import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel';
import { ContextSrv } from 'app/core/services/context_srv';
import {
@ -16,7 +16,7 @@ import {
} from '@grafana/data';
import { Unsubscribable } from 'rxjs';
import { PanelModel } from 'app/features/dashboard/state';
import { PanelQueryRunner } from '../query/state/PanelQueryRunner';
import { PanelQueryRunner } from '../../features/query/state/PanelQueryRunner';
class MetricsPanelCtrl extends PanelCtrl {
declare datasource: DataSourceApi;

View File

@ -10,7 +10,7 @@ import {
EventBusExtended,
EventBusSrv,
} from '@grafana/data';
import { DashboardModel } from '../dashboard/state';
import { DashboardModel } from '../../features/dashboard/state';
import { AngularLocationWrapper } from 'app/angular/AngularLocationWrapper';
export class PanelCtrl {

View File

@ -1,7 +1,7 @@
// @ts-ignore
import baron from 'baron';
import { PanelEvents } from '@grafana/data';
import { PanelModel } from '../dashboard/state';
import { PanelModel } from '../../features/dashboard/state';
import { PanelCtrl } from './panel_ctrl';
import { Subscription } from 'rxjs';
import { PanelDirectiveReadyEvent, RefreshEvent, RenderEvent } from 'app/types/events';

View File

@ -1,7 +1,7 @@
import { getFieldLinksSupplier } from './linkSuppliers';
import { applyFieldOverrides, createTheme, DataFrameView, dateTime, FieldDisplay, toDataFrame } from '@grafana/data';
import { getLinkSrv, LinkService, LinkSrv, setLinkSrv } from './link_srv';
import { TemplateSrv } from '../../templating/template_srv';
import { TemplateSrv } from '../../../features/templating/template_srv';
// We do not need more here and TimeSrv is hard to setup fully.
jest.mock('app/features/dashboard/services/TimeSrv', () => ({

View File

@ -23,7 +23,7 @@ import {
VariableSuggestion,
VariableSuggestionsScope,
} from '@grafana/data';
import { getVariablesUrlParams } from '../../variables/getAllVariableValuesForUrl';
import { getVariablesUrlParams } from '../../../features/variables/getAllVariableValuesForUrl';
const timeRangeVars = [
{

View File

@ -31,7 +31,7 @@ function queryEditorRowDirective() {
controller: QueryRowCtrl,
bindToController: true,
controllerAs: 'ctrl',
templateUrl: 'public/app/features/panel/partials/query_editor_row.html',
templateUrl: 'public/app/angular/panel/partials/query_editor_row.html',
transclude: true,
scope: {
queryCtrl: '=',

View File

@ -1,6 +1,6 @@
import React, { useCallback, useMemo, useState } from 'react';
import { GrafanaTheme2, PanelPluginMeta, SelectableValue } from '@grafana/data';
import { getAllPanelPluginMeta } from '../../../features/dashboard/components/VizTypePicker/VizTypePicker';
import { getAllPanelPluginMeta } from '../../../features/panel/components/VizTypePicker/VizTypePicker';
import { Icon, resetSelectStyles, MultiSelect, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';

View File

@ -1,7 +1,6 @@
import './annotations/all';
import './plugins/all';
import './dashboard';
import './panel/all';
import './manage-dashboards';
import './profile/all';
import './datasources/settings/HttpSettingsCtrl';

View File

@ -1,7 +1,7 @@
import { cloneDeep, isNumber } from 'lodash';
import { coreModule } from 'app/core/core';
import { AnnotationEvent, dateTime } from '@grafana/data';
import { MetricsPanelCtrl } from '../panel/metrics_panel_ctrl';
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
import { deleteAnnotation, saveAnnotation, updateAnnotation } from './api';
import { getDashboardQueryRunner } from '../query/state/DashboardQueryRunner/DashboardQueryRunner';

View File

@ -8,7 +8,7 @@ import {
PENDING_COLOR,
REGION_FILL_ALPHA,
} from '@grafana/ui';
import { MetricsPanelCtrl } from '../panel/metrics_panel_ctrl';
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
import { AnnotationEvent } from '@grafana/data';

View File

@ -11,7 +11,7 @@ import { PanelPlugin, PanelPluginMeta } from '@grafana/data';
import { changePanelPlugin } from 'app/features/panel/state/actions';
import { StoreState } from 'app/types';
import { getSectionOpenState, saveSectionOpenState } from './state/utils';
import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { PanelCtrl } from 'app/angular/panel/panel_ctrl';
import { getPanelStateForModel } from 'app/features/panel/state/selectors';
interface OwnProps {

View File

@ -5,7 +5,11 @@ import { Button, CustomScrollbar, Icon, Input, RadioButtonGroup, useStyles } fro
import { changePanelPlugin } from '../../../panel/state/actions';
import { PanelModel } from '../../state/PanelModel';
import { useDispatch, useSelector } from 'react-redux';
import { filterPluginList, getAllPanelPluginMeta, VizTypePicker } from '../VizTypePicker/VizTypePicker';
import {
filterPluginList,
getAllPanelPluginMeta,
VizTypePicker,
} from '../../../panel/components/VizTypePicker/VizTypePicker';
import { Field } from '@grafana/ui/src/components/Forms/Field';
import { PanelLibraryOptionsGroup } from 'app/features/library-panels/components/PanelLibraryOptionsGroup/PanelLibraryOptionsGroup';
import { toggleVizPicker } from './state/reducers';

View File

@ -14,7 +14,7 @@ import { OptionPaneRenderProps } from './types';
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';
import { OptionsPaneCategoryDescriptor } from './OptionsPaneCategoryDescriptor';
import { DynamicConfigValueEditor } from './DynamicConfigValueEditor';
import { getDataLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
import { getDataLinksVariableSuggestions } from 'app/angular/panel/panellinks/link_srv';
import { OverrideCategoryTitle } from './OverrideCategoryTitle';
import { css } from '@emotion/css';

View File

@ -1,5 +1,5 @@
import { DataLinksInlineEditor, Input, RadioButtonGroup, Select, Switch, TextArea } from '@grafana/ui';
import { getPanelLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
import { getPanelLinksVariableSuggestions } from 'app/angular/panel/panellinks/link_srv';
import React from 'react';
import { RepeatRowSelect } from '../RepeatRowSelect/RepeatRowSelect';
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';

View File

@ -1,7 +1,7 @@
import React from 'react';
import { StandardEditorContext, VariableSuggestionsScope } from '@grafana/data';
import { get as lodashGet } from 'lodash';
import { getDataLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
import { getDataLinksVariableSuggestions } from 'app/angular/panel/panellinks/link_srv';
import { OptionPaneRenderProps } from './types';
import { updateDefaultFieldConfigValue, setOptionImmutably } from './utils';
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';

View File

@ -2,7 +2,7 @@ import React, { FC } from 'react';
import { Icon, IconName, Tooltip, useForceUpdate } from '@grafana/ui';
import { sanitizeUrl } from '@grafana/data/src/text/sanitize';
import { DashboardLinksDashboard } from './DashboardLinksDashboard';
import { getLinkSrv } from '../../../panel/panellinks/link_srv';
import { getLinkSrv } from '../../../../angular/panel/panellinks/link_srv';
import { DashboardModel } from '../../state';
import { DashboardLink } from '../../state/DashboardModel';

View File

@ -2,7 +2,7 @@ import React, { useRef, useState, useLayoutEffect } from 'react';
import { Icon, ToolbarButton, Tooltip, useStyles2 } from '@grafana/ui';
import { sanitize, sanitizeUrl } from '@grafana/data/src/text/sanitize';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { getLinkSrv } from '../../../panel/panellinks/link_srv';
import { getLinkSrv } from '../../../../angular/panel/panellinks/link_srv';
import { DashboardLink } from '../../state/DashboardModel';
import { DashboardSearchHit } from 'app/features/search/types';
import { selectors } from '@grafana/e2e-selectors';

View File

@ -7,7 +7,7 @@ import { selectors } from '@grafana/e2e-selectors';
import PanelHeaderCorner from './PanelHeaderCorner';
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
import { getPanelLinksSupplier } from 'app/features/panel/panellinks/linkSuppliers';
import { getPanelLinksSupplier } from 'app/angular/panel/panellinks/linkSuppliers';
import { PanelHeaderNotices } from './PanelHeaderNotices';
import { PanelHeaderMenuTrigger } from './PanelHeaderMenuTrigger';
import { PanelHeaderLoadingIndicator } from './PanelHeaderLoadingIndicator';

View File

@ -16,7 +16,7 @@ import { contextSrv } from '../../../core/services/context_srv';
import { navigateToExplore } from '../../explore/state/main';
import { getExploreUrl } from '../../../core/utils/explore';
import { getTimeSrv } from '../services/TimeSrv';
import { PanelCtrl } from '../../panel/panel_ctrl';
import { PanelCtrl } from 'app/angular/panel/panel_ctrl';
import config from 'app/core/config';
export function getPanelMenu(

View File

@ -9,7 +9,7 @@ import {
LinkModel,
TimeRange,
} from '@grafana/data';
import { setLinkSrv } from '../../panel/panellinks/link_srv';
import { setLinkSrv } from '../../../angular/panel/panellinks/link_srv';
import { setContextSrv } from '../../../core/services/context_srv';
describe('getFieldLinksForExplore', () => {

View File

@ -11,7 +11,7 @@ import {
SplitOpen,
} from '@grafana/data';
import { getTemplateSrv } from '@grafana/runtime';
import { getLinkSrv } from '../../panel/panellinks/link_srv';
import { getLinkSrv } from '../../../angular/panel/panellinks/link_srv';
import { contextSrv } from 'app/core/services/context_srv';
/**

View File

@ -3,7 +3,7 @@ import { css } from '@emotion/css';
import { GrafanaTheme2 } from '@grafana/data';
import { Icon, Link, useStyles2 } from '@grafana/ui';
import { LibraryElementDTO } from '../../types';
import { PanelTypeCard } from 'app/features/dashboard/components/VizTypePicker/PanelTypeCard';
import { PanelTypeCard } from 'app/features/panel/components/VizTypePicker/PanelTypeCard';
import { DeleteLibraryPanelModal } from '../DeleteLibraryPanelModal/DeleteLibraryPanelModal';
import { config } from '@grafana/runtime';
import { getPanelPluginNotFound } from 'app/features/panel/components/PanelPluginError';

View File

@ -8,7 +8,7 @@ import { LibraryPanelsSearch, LibraryPanelsSearchProps } from './LibraryPanelsSe
import * as api from '../../state/api';
import { LibraryElementKind, LibraryElementsSearchResult } from '../../types';
import { backendSrv } from '../../../../core/services/backend_srv';
import * as viztypepicker from '../../../dashboard/components/VizTypePicker/VizTypePicker';
import * as viztypepicker from '../../../panel/components/VizTypePicker/VizTypePicker';
jest.mock('@grafana/runtime', () => ({
...((jest.requireActual('@grafana/runtime') as unknown) as object),

View File

@ -1,7 +1,7 @@
import React from 'react';
import { DebugSection } from './DebugSection';
import { mount } from 'enzyme';
import { getLinkSrv, LinkService, LinkSrv, setLinkSrv } from '../../../../features/panel/panellinks/link_srv';
import { getLinkSrv, LinkService, LinkSrv, setLinkSrv } from '../../../../angular/panel/panellinks/link_srv';
import { dateTime } from '@grafana/data';
// We do not need more here and TimeSrv is hard to setup fully.

View File

@ -46,7 +46,7 @@ import {
import { GraphContextMenuCtrl } from './GraphContextMenuCtrl';
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { ContextSrv } from 'app/core/services/context_srv';
import { getFieldLinksSupplier } from 'app/features/panel/panellinks/linkSuppliers';
import { getFieldLinksSupplier } from 'app/angular/panel/panellinks/linkSuppliers';
import { DashboardModel } from '../../../features/dashboard/state';
const LegendWithThemeProvider = provideTheme(Legend);

View File

@ -24,7 +24,7 @@ import { dispatch } from 'app/store/store';
import { ThresholdMapper } from 'app/features/alerting/state/ThresholdMapper';
import { appEvents } from '../../../core/core';
import { ZoomOutEvent } from '../../../types/events';
import { MetricsPanelCtrl } from 'app/features/panel/metrics_panel_ctrl';
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
import { loadSnapshotData } from '../../../features/dashboard/utils/loadSnapshotData';
import { annotationsFromDataFrames } from '../../../features/query/state/DashboardQueryRunner/utils';

View File

@ -1,6 +1,6 @@
import { GraphCtrl } from '../module';
import { MetricsPanelCtrl } from 'app/features/panel/metrics_panel_ctrl';
import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { MetricsPanelCtrl } from 'app/angular/panel/metrics_panel_ctrl';
import { PanelCtrl } from 'app/angular/panel/panel_ctrl';
import config from 'app/core/config';
import TimeSeries from 'app/core/time_series2';

View File

@ -3,7 +3,7 @@ import $ from 'jquery';
import { isNumber } from 'lodash';
import { getColorForTheme } from '@grafana/data';
import { CoreEvents } from 'app/types';
import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { PanelCtrl } from 'app/angular/panel/panel_ctrl';
import { config } from 'app/core/config';
export class ThresholdManager {

View File

@ -1,8 +1,8 @@
import { makeClassES5Compatible } from '@grafana/data';
import { loadPluginCss } from '@grafana/runtime';
import { PanelCtrl as PanelCtrlES6 } from 'app/features/panel/panel_ctrl';
import { MetricsPanelCtrl as MetricsPanelCtrlES6 } from 'app/features/panel/metrics_panel_ctrl';
import { QueryCtrl as QueryCtrlES6 } from 'app/features/panel/query_ctrl';
import { PanelCtrl as PanelCtrlES6 } from 'app/angular/panel/panel_ctrl';
import { MetricsPanelCtrl as MetricsPanelCtrlES6 } from 'app/angular/panel/metrics_panel_ctrl';
import { QueryCtrl as QueryCtrlES6 } from 'app/angular/panel/query_ctrl';
const PanelCtrl = makeClassES5Compatible(PanelCtrlES6);
const MetricsPanelCtrl = makeClassES5Compatible(MetricsPanelCtrlES6);

View File

@ -21,7 +21,7 @@ import { AngularLoader, setAngularLoader } from 'app/core/services/AngularLoader
// Types
import { CoreEvents, AppEventEmitter, AppEventConsumer } from 'app/types';
import { setLinkSrv, LinkSrv } from 'app/features/panel/panellinks/link_srv';
import { setLinkSrv, LinkSrv } from 'app/angular/panel/panellinks/link_srv';
import { UtilSrv } from 'app/core/services/util_srv';
import { ContextSrv } from 'app/core/services/context_srv';
import { DashboardSrv, setDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';