mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #15149 from grafana/dashboard-refactorings
Dashboard organization refactorings (file names / locations)
This commit is contained in:
commit
7e1b6f59fe
@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import coreModule from 'app/core/core_module';
|
import coreModule from 'app/core/core_module';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
|
|
||||||
export class BackendSrv {
|
export class BackendSrv {
|
||||||
private inFlightRequests = {};
|
private inFlightRequests = {};
|
||||||
|
@ -12,8 +12,8 @@ import StateHistory from './StateHistory';
|
|||||||
import 'app/features/alerting/AlertTabCtrl';
|
import 'app/features/alerting/AlertTabCtrl';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/state/DashboardModel';
|
||||||
import { PanelModel } from '../dashboard/panel_model';
|
import { PanelModel } from '../dashboard/state/PanelModel';
|
||||||
import { TestRuleResult } from './TestRuleResult';
|
import { TestRuleResult } from './TestRuleResult';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import alertDef from './state/alertDef';
|
import alertDef from './state/alertDef';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/state/DashboardModel';
|
||||||
import appEvents from '../../core/app_events';
|
import appEvents from '../../core/app_events';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/state/DashboardModel';
|
||||||
import { Props, TestRuleResult } from './TestRuleResult';
|
import { Props, TestRuleResult } from './TestRuleResult';
|
||||||
|
|
||||||
jest.mock('app/core/services/backend_srv', () => ({
|
jest.mock('app/core/services/backend_srv', () => ({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter';
|
||||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/state/DashboardModel';
|
||||||
import { LoadingPlaceholder } from '@grafana/ui/src';
|
import { LoadingPlaceholder } from '@grafana/ui/src';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -10,7 +10,7 @@ import coreModule from 'app/core/core_module';
|
|||||||
import { makeRegions, dedupAnnotations } from './events_processing';
|
import { makeRegions, dedupAnnotations } from './events_processing';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DashboardModel } from '../dashboard/dashboard_model';
|
import { DashboardModel } from '../dashboard/state/DashboardModel';
|
||||||
|
|
||||||
export class AnnotationsSrv {
|
export class AnnotationsSrv {
|
||||||
globalAnnotationsPromise: any;
|
globalAnnotationsPromise: any;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import '../annotations_srv';
|
|
||||||
import 'app/features/dashboard/time_srv';
|
|
||||||
import { AnnotationsSrv } from '../annotations_srv';
|
import { AnnotationsSrv } from '../annotations_srv';
|
||||||
|
|
||||||
describe('AnnotationsSrv', () => {
|
describe('AnnotationsSrv', () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import { PanelModel } from '../../panel_model';
|
import { PanelModel } from '../../state/PanelModel';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import { LS_PANEL_COPY_KEY } from 'app/core/constants';
|
import { LS_PANEL_COPY_KEY } from 'app/core/constants';
|
||||||
import { updateLocation } from 'app/core/actions';
|
import { updateLocation } from 'app/core/actions';
|
||||||
|
@ -7,7 +7,7 @@ jest.mock('app/core/store', () => {
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import { DashboardExporter } from './DashboardExporter';
|
import { DashboardExporter } from './DashboardExporter';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
|
|
||||||
describe('given dashboard with repeated panels', () => {
|
describe('given dashboard with repeated panels', () => {
|
||||||
let dash, exported;
|
let dash, exported;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
|
|
||||||
export class DashboardExporter {
|
export class DashboardExporter {
|
||||||
constructor(private datasourceSrv) {}
|
constructor(private datasourceSrv) {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import angular from 'angular';
|
import angular from 'angular';
|
||||||
import { appEvents, NavModel } from 'app/core/core';
|
import { appEvents, NavModel } from 'app/core/core';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
|
|
||||||
export class DashNavCtrl {
|
export class DashNavCtrl {
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import { DashboardRow } from '../dashgrid/DashboardRow';
|
import { DashboardRow } from './DashboardRow';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../../state/PanelModel';
|
||||||
|
|
||||||
describe('DashboardRow', () => {
|
describe('DashboardRow', () => {
|
||||||
let wrapper, panel, dashboardMock;
|
let wrapper, panel, dashboardMock;
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../../state/PanelModel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
import templateSrv from 'app/features/templating/template_srv';
|
import templateSrv from 'app/features/templating/template_srv';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
export { DashboardRow } from './DashboardRow';
|
@ -1,5 +1,5 @@
|
|||||||
import { coreModule, appEvents, contextSrv } from 'app/core/core';
|
import { coreModule, appEvents, contextSrv } from 'app/core/core';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import angular from 'angular';
|
import angular from 'angular';
|
||||||
|
@ -3,7 +3,7 @@ import angular from 'angular';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
import locationUtil from 'app/core/utils/location_util';
|
import locationUtil from 'app/core/utils/location_util';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
import { HistoryListOpts, RevisionsModel, CalculateDiffOptions, HistorySrv } from './HistorySrv';
|
import { HistoryListOpts, RevisionsModel, CalculateDiffOptions, HistorySrv } from './HistorySrv';
|
||||||
|
|
||||||
export class HistoryListCtrl {
|
export class HistoryListCtrl {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { versions, restore } from './__mocks__/history';
|
import { versions, restore } from './__mocks__/history';
|
||||||
import { HistorySrv } from './HistorySrv';
|
import { HistorySrv } from './HistorySrv';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
jest.mock('app/core/store');
|
jest.mock('app/core/store');
|
||||||
|
|
||||||
describe('historySrv', () => {
|
describe('historySrv', () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import coreModule from 'app/core/core_module';
|
import coreModule from 'app/core/core_module';
|
||||||
import { DashboardModel } from '../../dashboard_model';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
|
|
||||||
export interface HistoryListOpts {
|
export interface HistoryListOpts {
|
||||||
limit: number;
|
limit: number;
|
||||||
|
@ -5,10 +5,10 @@ import coreModule from 'app/core/core_module';
|
|||||||
import { removePanel } from 'app/features/dashboard/utils/panel';
|
import { removePanel } from 'app/features/dashboard/utils/panel';
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { AnnotationsSrv } from '../annotations/annotations_srv';
|
import { AnnotationsSrv } from '../../annotations/annotations_srv';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DashboardModel } from './dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
|
|
||||||
export class DashboardCtrl {
|
export class DashboardCtrl {
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
@ -3,8 +3,7 @@ import { hot } from 'react-hot-loader';
|
|||||||
import ReactGridLayout, { ItemCallback } from 'react-grid-layout';
|
import ReactGridLayout, { ItemCallback } from 'react-grid-layout';
|
||||||
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core/constants';
|
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core/constants';
|
||||||
import { DashboardPanel } from './DashboardPanel';
|
import { DashboardPanel } from './DashboardPanel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel, PanelModel } from '../state';
|
||||||
import { PanelModel } from '../panel_model';
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import sizeMe from 'react-sizeme';
|
import sizeMe from 'react-sizeme';
|
||||||
|
|
||||||
|
@ -7,12 +7,11 @@ import { importPluginModule } from 'app/features/plugins/plugin_loader';
|
|||||||
|
|
||||||
import { AddPanelWidget } from '../components/AddPanelWidget';
|
import { AddPanelWidget } from '../components/AddPanelWidget';
|
||||||
import { getPanelPluginNotFound } from './PanelPluginNotFound';
|
import { getPanelPluginNotFound } from './PanelPluginNotFound';
|
||||||
import { DashboardRow } from './DashboardRow';
|
import { DashboardRow } from '../components/DashboardRow';
|
||||||
import { PanelChrome } from './PanelChrome';
|
import { PanelChrome } from './PanelChrome';
|
||||||
import { PanelEditor } from '../panel_editor/PanelEditor';
|
import { PanelEditor } from '../panel_editor/PanelEditor';
|
||||||
|
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel, DashboardModel } from '../state';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
|
||||||
import { PanelPlugin } from 'app/types';
|
import { PanelPlugin } from 'app/types';
|
||||||
import { PanelResizer } from './PanelResizer';
|
import { PanelResizer } from './PanelResizer';
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import { AutoSizer } from 'react-virtualized';
|
import { AutoSizer } from 'react-virtualized';
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getTimeSrv, TimeSrv } from '../time_srv';
|
import { getTimeSrv, TimeSrv } from '../services/TimeSrv';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { PanelHeader } from './PanelHeader/PanelHeader';
|
import { PanelHeader } from './PanelHeader/PanelHeader';
|
||||||
@ -14,8 +14,8 @@ import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel';
|
|||||||
import { PANEL_HEADER_HEIGHT } from 'app/core/constants';
|
import { PANEL_HEADER_HEIGHT } from 'app/core/constants';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelPlugin } from 'app/types';
|
import { PanelPlugin } from 'app/types';
|
||||||
import { TimeRange } from '@grafana/ui';
|
import { TimeRange } from '@grafana/ui';
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import PanelHeaderCorner from './PanelHeaderCorner';
|
|||||||
import { PanelHeaderMenu } from './PanelHeaderMenu';
|
import { PanelHeaderMenu } from './PanelHeaderMenu';
|
||||||
import templateSrv from 'app/features/templating/template_srv';
|
import templateSrv from 'app/features/templating/template_srv';
|
||||||
|
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { ClickOutsideWrapper } from 'app/core/components/ClickOutsideWrapper/ClickOutsideWrapper';
|
import { ClickOutsideWrapper } from 'app/core/components/ClickOutsideWrapper/ClickOutsideWrapper';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import Remarkable from 'remarkable';
|
import Remarkable from 'remarkable';
|
||||||
import { Tooltip } from '@grafana/ui';
|
import { Tooltip } from '@grafana/ui';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import templateSrv from 'app/features/templating/template_srv';
|
import templateSrv from 'app/features/templating/template_srv';
|
||||||
import { LinkSrv } from 'app/features/panel/panellinks/link_srv';
|
import { LinkSrv } from 'app/features/panel/panellinks/link_srv';
|
||||||
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/time_srv';
|
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
|
|
||||||
enum InfoModes {
|
enum InfoModes {
|
||||||
Error = 'Error',
|
Error = 'Error',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { PanelHeaderMenuItem } from './PanelHeaderMenuItem';
|
import { PanelHeaderMenuItem } from './PanelHeaderMenuItem';
|
||||||
import { getPanelMenu } from 'app/features/dashboard/utils/getPanelMenu';
|
import { getPanelMenu } from 'app/features/dashboard/utils/getPanelMenu';
|
||||||
import { PanelMenuItem } from '@grafana/ui';
|
import { PanelMenuItem } from '@grafana/ui';
|
||||||
|
@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import { throttle } from 'lodash';
|
import { throttle } from 'lodash';
|
||||||
import Draggable, { DraggableEventHandler } from 'react-draggable';
|
import Draggable, { DraggableEventHandler } from 'react-draggable';
|
||||||
|
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
isEditing: boolean;
|
isEditing: boolean;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import './dashboard_ctrl';
|
import './containers/DashboardCtrl';
|
||||||
import './time_srv';
|
|
||||||
import './dashgrid/DashboardGridDirective';
|
import './dashgrid/DashboardGridDirective';
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
||||||
import { EditorTabBody } from './EditorTabBody';
|
import { EditorTabBody } from './EditorTabBody';
|
||||||
|
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import './../../panel/GeneralTabCtrl';
|
import './../../panel/GeneralTabCtrl';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -11,8 +11,8 @@ import { store } from 'app/store/store';
|
|||||||
import { updateLocation } from 'app/core/actions';
|
import { updateLocation } from 'app/core/actions';
|
||||||
import { AngularComponent } from 'app/core/services/AngularLoader';
|
import { AngularComponent } from 'app/core/services/AngularLoader';
|
||||||
|
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelPlugin } from 'app/types/plugins';
|
import { PanelPlugin } from 'app/types/plugins';
|
||||||
|
|
||||||
import { Tooltip } from '@grafana/ui';
|
import { Tooltip } from '@grafana/ui';
|
||||||
|
@ -16,8 +16,8 @@ import { BackendSrv, getBackendSrv } from 'app/core/services/backend_srv';
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
|
import { DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||||
import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoa
|
|||||||
import { Emitter } from 'app/core/utils/emitter';
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DataQuery, DataSourceApi } from '@grafana/ui';
|
import { DataQuery, DataSourceApi } from '@grafana/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -13,7 +13,7 @@ import DataSourceOption from './DataSourceOption';
|
|||||||
import { FormLabel } from '@grafana/ui';
|
import { FormLabel } from '@grafana/ui';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
import { DataSourceSelectItem } from '@grafana/ui/src/types';
|
||||||
import { ValidationEvents } from 'app/types';
|
import { ValidationEvents } from 'app/types';
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
|||||||
import { FadeIn } from 'app/core/components/Animations/FadeIn';
|
import { FadeIn } from 'app/core/components/Animations/FadeIn';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelPlugin } from 'app/types/plugins';
|
import { PanelPlugin } from 'app/types/plugins';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ChangeTracker } from './ChangeTracker';
|
import { ChangeTracker } from './ChangeTracker';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
|
|
||||||
jest.mock('app/core/services/context_srv', () => ({
|
jest.mock('app/core/services/context_srv', () => ({
|
||||||
contextSrv: {
|
contextSrv: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import angular from 'angular';
|
import angular from 'angular';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
|
|
||||||
export class ChangeTracker {
|
export class ChangeTracker {
|
||||||
current: any;
|
current: any;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import coreModule from 'app/core/core_module';
|
import coreModule from 'app/core/core_module';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import locationUtil from 'app/core/utils/location_util';
|
import locationUtil from 'app/core/utils/location_util';
|
||||||
|
|
||||||
export class DashboardSrv {
|
export class DashboardSrv {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import { DashboardViewStateSrv } from './DashboardViewStateSrv';
|
import { DashboardViewStateSrv } from './DashboardViewStateSrv';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
|
|
||||||
describe('when updating view state', () => {
|
describe('when updating view state', () => {
|
||||||
const location = {
|
const location = {
|
||||||
|
@ -2,7 +2,7 @@ import angular from 'angular';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
|
|
||||||
// represents the transient view state
|
// represents the transient view state
|
||||||
// like fullscreen panel & edit
|
// like fullscreen panel & edit
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { TimeSrv } from '../time_srv';
|
import { TimeSrv } from './TimeSrv';
|
||||||
import '../time_srv';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
describe('timeSrv', () => {
|
describe('timeSrv', () => {
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN } from 'app/core/constants';
|
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN } from 'app/core/constants';
|
||||||
import { expect } from 'test/lib/common';
|
import { expect } from 'test/lib/common';
|
||||||
|
|
@ -7,8 +7,8 @@ import {
|
|||||||
MIN_PANEL_HEIGHT,
|
MIN_PANEL_HEIGHT,
|
||||||
DEFAULT_PANEL_SPAN,
|
DEFAULT_PANEL_SPAN,
|
||||||
} from 'app/core/constants';
|
} from 'app/core/constants';
|
||||||
import { PanelModel } from './panel_model';
|
import { PanelModel } from './PanelModel';
|
||||||
import { DashboardModel } from './dashboard_model';
|
import { DashboardModel } from './DashboardModel';
|
||||||
import getFactors from 'app/core/utils/factors';
|
import getFactors from 'app/core/utils/factors';
|
||||||
|
|
||||||
export class DashboardMigrator {
|
export class DashboardMigrator {
|
@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { expect } from 'test/lib/common';
|
import { expect } from 'test/lib/common';
|
||||||
|
|
||||||
jest.mock('app/core/services/context_srv', () => ({}));
|
jest.mock('app/core/services/context_srv', () => ({}));
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../state/DashboardModel';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
|
|
||||||
jest.mock('app/core/services/context_srv', () => ({}));
|
jest.mock('app/core/services/context_srv', () => ({}));
|
||||||
|
|
@ -7,8 +7,8 @@ import { Emitter } from 'app/core/utils/emitter';
|
|||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import sortByKeys from 'app/core/utils/sort_by_keys';
|
import sortByKeys from 'app/core/utils/sort_by_keys';
|
||||||
|
|
||||||
import { PanelModel } from './panel_model';
|
import { PanelModel } from './PanelModel';
|
||||||
import { DashboardMigrator } from './dashboard_migration';
|
import { DashboardMigrator } from './DashboardMigrator';
|
||||||
import { TimeRange } from '@grafana/ui/src';
|
import { TimeRange } from '@grafana/ui/src';
|
||||||
|
|
||||||
export class DashboardModel {
|
export class DashboardModel {
|
@ -1,5 +1,5 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../state/PanelModel';
|
||||||
|
|
||||||
describe('PanelModel', () => {
|
describe('PanelModel', () => {
|
||||||
describe('when creating new panel model', () => {
|
describe('when creating new panel model', () => {
|
2
public/app/features/dashboard/state/index.ts
Normal file
2
public/app/features/dashboard/state/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export { DashboardModel } from './DashboardModel';
|
||||||
|
export { PanelModel } from './PanelModel';
|
@ -2,8 +2,8 @@ import { updateLocation } from 'app/core/actions';
|
|||||||
import { store } from 'app/store/store';
|
import { store } from 'app/store/store';
|
||||||
|
|
||||||
import { removePanel, duplicatePanel, copyPanel, editPanelJson, sharePanel } from 'app/features/dashboard/utils/panel';
|
import { removePanel, duplicatePanel, copyPanel, editPanelJson, sharePanel } from 'app/features/dashboard/utils/panel';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
import { PanelMenuItem } from '@grafana/ui';
|
import { PanelMenuItem } from '@grafana/ui';
|
||||||
|
|
||||||
export const getPanelMenu = (dashboard: DashboardModel, panel: PanelModel) => {
|
export const getPanelMenu = (dashboard: DashboardModel, panel: PanelModel) => {
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { TimeRange } from '@grafana/ui';
|
import { TimeRange } from '@grafana/ui';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
||||||
import { getTimeSrv } from 'app/features/dashboard/time_srv';
|
import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
|
@ -11,7 +11,7 @@ jest.mock('app/core/config', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
import q from 'q';
|
import q from 'q';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { MetricsPanelCtrl } from '../metrics_panel_ctrl';
|
import { MetricsPanelCtrl } from '../metrics_panel_ctrl';
|
||||||
|
|
||||||
describe('MetricsPanelCtrl', () => {
|
describe('MetricsPanelCtrl', () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import '../all';
|
import '../all';
|
||||||
import { VariableSrv } from '../variable_srv';
|
import { VariableSrv } from '../variable_srv';
|
||||||
import { DashboardModel } from '../../dashboard/dashboard_model';
|
import { DashboardModel } from '../../dashboard/state/DashboardModel';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import $q from 'q';
|
import $q from 'q';
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import '../all';
|
|||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { VariableSrv } from '../variable_srv';
|
import { VariableSrv } from '../variable_srv';
|
||||||
import { DashboardModel } from '../../dashboard/dashboard_model';
|
import { DashboardModel } from '../../dashboard/state/DashboardModel';
|
||||||
import $q from 'q';
|
import $q from 'q';
|
||||||
|
|
||||||
describe('VariableSrv init', function(this: any) {
|
describe('VariableSrv init', function(this: any) {
|
||||||
|
@ -7,8 +7,8 @@ import coreModule from 'app/core/core_module';
|
|||||||
import { variableTypes } from './variable';
|
import { variableTypes } from './variable';
|
||||||
import { Graph } from 'app/core/utils/dag';
|
import { Graph } from 'app/core/utils/dag';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { TimeSrv } from 'app/features/dashboard/time_srv';
|
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { TimeRange } from '@grafana/ui/src';
|
import { TimeRange } from '@grafana/ui/src';
|
||||||
|
@ -8,7 +8,7 @@ import coreModule from 'app/core/core_module';
|
|||||||
import { profiler } from 'app/core/profiler';
|
import { profiler } from 'app/core/profiler';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { BackendSrv, setBackendSrv } from 'app/core/services/backend_srv';
|
import { BackendSrv, setBackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { TimeSrv, setTimeSrv } from 'app/features/dashboard/time_srv';
|
import { TimeSrv, setTimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
import { DatasourceSrv, setDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
import { DatasourceSrv, setDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||||
import { AngularLoader, setAngularLoader } from 'app/core/services/AngularLoader';
|
import { AngularLoader, setAngularLoader } from 'app/core/services/AngularLoader';
|
||||||
import { configureStore } from 'app/store/configureStore';
|
import { configureStore } from 'app/store/configureStore';
|
||||||
|
@ -4,8 +4,6 @@ import { Provider } from 'react-redux';
|
|||||||
|
|
||||||
import coreModule from 'app/core/core_module';
|
import coreModule from 'app/core/core_module';
|
||||||
import { store } from 'app/store/store';
|
import { store } from 'app/store/store';
|
||||||
import { BackendSrv } from 'app/core/services/backend_srv';
|
|
||||||
import { DatasourceSrv } from 'app/features/plugins/datasource_srv';
|
|
||||||
import { ContextSrv } from 'app/core/services/context_srv';
|
import { ContextSrv } from 'app/core/services/context_srv';
|
||||||
|
|
||||||
function WrapInProvider(store, Component, props) {
|
function WrapInProvider(store, Component, props) {
|
||||||
@ -20,8 +18,6 @@ function WrapInProvider(store, Component, props) {
|
|||||||
export function reactContainer(
|
export function reactContainer(
|
||||||
$route,
|
$route,
|
||||||
$location,
|
$location,
|
||||||
backendSrv: BackendSrv,
|
|
||||||
datasourceSrv: DatasourceSrv,
|
|
||||||
contextSrv: ContextSrv
|
contextSrv: ContextSrv
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
@ -42,11 +38,7 @@ export function reactContainer(
|
|||||||
component = component.default;
|
component = component.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = {
|
const props = { };
|
||||||
backendSrv: backendSrv,
|
|
||||||
datasourceSrv: datasourceSrv,
|
|
||||||
routeParams: $route.current.params,
|
|
||||||
};
|
|
||||||
|
|
||||||
ReactDOM.render(WrapInProvider(store, component, props), elem[0]);
|
ReactDOM.render(WrapInProvider(store, component, props), elem[0]);
|
||||||
|
|
||||||
|
@ -50,3 +50,4 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import * as dateMath from 'app/core/utils/datemath';
|
import * as dateMath from 'app/core/utils/datemath';
|
||||||
import { angularMocks, sinon } from '../lib/common';
|
import { angularMocks, sinon } from '../lib/common';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
|
|
||||||
export function ControllerTestContext(this: any) {
|
export function ControllerTestContext(this: any) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user