diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index 854169ad4b0..38d7f2b76cb 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -1,7 +1,7 @@ import _ from 'lodash'; import coreModule from 'app/core/core_module'; 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 { private inFlightRequests = {}; diff --git a/public/app/features/alerting/AlertTab.tsx b/public/app/features/alerting/AlertTab.tsx index 549d84c2808..6343b4ca2c9 100644 --- a/public/app/features/alerting/AlertTab.tsx +++ b/public/app/features/alerting/AlertTab.tsx @@ -12,8 +12,8 @@ import StateHistory from './StateHistory'; import 'app/features/alerting/AlertTabCtrl'; // Types -import { DashboardModel } from '../dashboard/dashboard_model'; -import { PanelModel } from '../dashboard/panel_model'; +import { DashboardModel } from '../dashboard/state/DashboardModel'; +import { PanelModel } from '../dashboard/state/PanelModel'; import { TestRuleResult } from './TestRuleResult'; interface Props { diff --git a/public/app/features/alerting/StateHistory.tsx b/public/app/features/alerting/StateHistory.tsx index eb5541f6094..be34552e50d 100644 --- a/public/app/features/alerting/StateHistory.tsx +++ b/public/app/features/alerting/StateHistory.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import alertDef from './state/alertDef'; 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'; interface Props { diff --git a/public/app/features/alerting/TestRuleResult.test.tsx b/public/app/features/alerting/TestRuleResult.test.tsx index 9beb5ade632..ff8422ccf4b 100644 --- a/public/app/features/alerting/TestRuleResult.test.tsx +++ b/public/app/features/alerting/TestRuleResult.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { DashboardModel } from '../dashboard/dashboard_model'; +import { DashboardModel } from '../dashboard/state/DashboardModel'; import { Props, TestRuleResult } from './TestRuleResult'; jest.mock('app/core/services/backend_srv', () => ({ diff --git a/public/app/features/alerting/TestRuleResult.tsx b/public/app/features/alerting/TestRuleResult.tsx index 4014e529597..e8f0551d707 100644 --- a/public/app/features/alerting/TestRuleResult.tsx +++ b/public/app/features/alerting/TestRuleResult.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { JSONFormatter } from 'app/core/components/JSONFormatter/JSONFormatter'; 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'; export interface Props { diff --git a/public/app/features/annotations/annotations_srv.ts b/public/app/features/annotations/annotations_srv.ts index 1f580319188..d728adfca2e 100644 --- a/public/app/features/annotations/annotations_srv.ts +++ b/public/app/features/annotations/annotations_srv.ts @@ -10,7 +10,7 @@ import coreModule from 'app/core/core_module'; import { makeRegions, dedupAnnotations } from './events_processing'; // Types -import { DashboardModel } from '../dashboard/dashboard_model'; +import { DashboardModel } from '../dashboard/state/DashboardModel'; export class AnnotationsSrv { globalAnnotationsPromise: any; diff --git a/public/app/features/annotations/specs/annotations_srv.test.ts b/public/app/features/annotations/specs/annotations_srv.test.ts index a00fc9b841d..f304c722b74 100644 --- a/public/app/features/annotations/specs/annotations_srv.test.ts +++ b/public/app/features/annotations/specs/annotations_srv.test.ts @@ -1,5 +1,3 @@ -import '../annotations_srv'; -import 'app/features/dashboard/time_srv'; import { AnnotationsSrv } from '../annotations_srv'; describe('AnnotationsSrv', () => { diff --git a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx index 4d46d88a1d2..8c1ab93cec1 100644 --- a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx +++ b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx @@ -1,8 +1,8 @@ import React from 'react'; import _ from 'lodash'; import config from 'app/core/config'; -import { PanelModel } from '../../panel_model'; -import { DashboardModel } from '../../dashboard_model'; +import { PanelModel } from '../../state/PanelModel'; +import { DashboardModel } from '../../state/DashboardModel'; import store from 'app/core/store'; import { LS_PANEL_COPY_KEY } from 'app/core/constants'; import { updateLocation } from 'app/core/actions'; diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts index 20ab21541a5..ac1b5f08632 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts @@ -7,7 +7,7 @@ jest.mock('app/core/store', () => { import _ from 'lodash'; import config from 'app/core/config'; import { DashboardExporter } from './DashboardExporter'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; describe('given dashboard with repeated panels', () => { let dash, exported; diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts index 22b93b767d6..6cf14f81c86 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts @@ -1,6 +1,6 @@ import config from 'app/core/config'; import _ from 'lodash'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; export class DashboardExporter { constructor(private datasourceSrv) {} diff --git a/public/app/features/dashboard/components/DashNav/DashNavCtrl.ts b/public/app/features/dashboard/components/DashNav/DashNavCtrl.ts index d7305b948dc..e75c1468a1f 100644 --- a/public/app/features/dashboard/components/DashNav/DashNavCtrl.ts +++ b/public/app/features/dashboard/components/DashNav/DashNavCtrl.ts @@ -1,7 +1,7 @@ import moment from 'moment'; import angular from 'angular'; import { appEvents, NavModel } from 'app/core/core'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; export class DashNavCtrl { dashboard: DashboardModel; diff --git a/public/app/features/dashboard/specs/DashboardRow.test.tsx b/public/app/features/dashboard/components/DashboardRow/DashboardRow.test.tsx similarity index 93% rename from public/app/features/dashboard/specs/DashboardRow.test.tsx rename to public/app/features/dashboard/components/DashboardRow/DashboardRow.test.tsx index 77c6cb39d9d..9ac6a6b74e1 100644 --- a/public/app/features/dashboard/specs/DashboardRow.test.tsx +++ b/public/app/features/dashboard/components/DashboardRow/DashboardRow.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { DashboardRow } from '../dashgrid/DashboardRow'; -import { PanelModel } from '../panel_model'; +import { DashboardRow } from './DashboardRow'; +import { PanelModel } from '../../state/PanelModel'; describe('DashboardRow', () => { let wrapper, panel, dashboardMock; diff --git a/public/app/features/dashboard/dashgrid/DashboardRow.tsx b/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx similarity index 96% rename from public/app/features/dashboard/dashgrid/DashboardRow.tsx rename to public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx index 5b8ced9b2b1..f9a56718c5e 100644 --- a/public/app/features/dashboard/dashgrid/DashboardRow.tsx +++ b/public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx @@ -1,7 +1,7 @@ import React from 'react'; import classNames from 'classnames'; -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel } from '../../state/PanelModel'; +import { DashboardModel } from '../../state/DashboardModel'; import templateSrv from 'app/features/templating/template_srv'; import appEvents from 'app/core/app_events'; diff --git a/public/app/features/dashboard/components/DashboardRow/index.ts b/public/app/features/dashboard/components/DashboardRow/index.ts new file mode 100644 index 00000000000..3f71e03c80c --- /dev/null +++ b/public/app/features/dashboard/components/DashboardRow/index.ts @@ -0,0 +1 @@ +export { DashboardRow } from './DashboardRow'; diff --git a/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts b/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts index a0eb5c8c6b3..e5cfac97d5f 100755 --- a/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts +++ b/public/app/features/dashboard/components/DashboardSettings/SettingsCtrl.ts @@ -1,5 +1,5 @@ import { coreModule, appEvents, contextSrv } from 'app/core/core'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; import $ from 'jquery'; import _ from 'lodash'; import angular from 'angular'; diff --git a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts index b8632e2eeae..19795ffc564 100644 --- a/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts +++ b/public/app/features/dashboard/components/VersionHistory/HistoryListCtrl.ts @@ -3,7 +3,7 @@ import angular from 'angular'; import moment from 'moment'; 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'; export class HistoryListCtrl { diff --git a/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts b/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts index 75766060e7f..04f0eff1cb8 100644 --- a/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts +++ b/public/app/features/dashboard/components/VersionHistory/HistorySrv.test.ts @@ -1,6 +1,6 @@ import { versions, restore } from './__mocks__/history'; import { HistorySrv } from './HistorySrv'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; jest.mock('app/core/store'); describe('historySrv', () => { diff --git a/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts b/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts index d52f3ab879c..a06212f9a7a 100644 --- a/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts +++ b/public/app/features/dashboard/components/VersionHistory/HistorySrv.ts @@ -1,6 +1,6 @@ import _ from 'lodash'; import coreModule from 'app/core/core_module'; -import { DashboardModel } from '../../dashboard_model'; +import { DashboardModel } from '../../state/DashboardModel'; export interface HistoryListOpts { limit: number; diff --git a/public/app/features/dashboard/dashboard_ctrl.ts b/public/app/features/dashboard/containers/DashboardCtrl.ts similarity index 97% rename from public/app/features/dashboard/dashboard_ctrl.ts rename to public/app/features/dashboard/containers/DashboardCtrl.ts index 5c4480dbad5..74795315504 100644 --- a/public/app/features/dashboard/dashboard_ctrl.ts +++ b/public/app/features/dashboard/containers/DashboardCtrl.ts @@ -5,10 +5,10 @@ import coreModule from 'app/core/core_module'; import { removePanel } from 'app/features/dashboard/utils/panel'; // Services -import { AnnotationsSrv } from '../annotations/annotations_srv'; +import { AnnotationsSrv } from '../../annotations/annotations_srv'; // Types -import { DashboardModel } from './dashboard_model'; +import { DashboardModel } from '../state/DashboardModel'; export class DashboardCtrl { dashboard: DashboardModel; diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index c9c1dd0d7b0..658bfad3816 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -3,8 +3,7 @@ import { hot } from 'react-hot-loader'; import ReactGridLayout, { ItemCallback } from 'react-grid-layout'; import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core/constants'; import { DashboardPanel } from './DashboardPanel'; -import { DashboardModel } from '../dashboard_model'; -import { PanelModel } from '../panel_model'; +import { DashboardModel, PanelModel } from '../state'; import classNames from 'classnames'; import sizeMe from 'react-sizeme'; diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index cfff64cb042..2d794bec4d4 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -7,12 +7,11 @@ import { importPluginModule } from 'app/features/plugins/plugin_loader'; import { AddPanelWidget } from '../components/AddPanelWidget'; import { getPanelPluginNotFound } from './PanelPluginNotFound'; -import { DashboardRow } from './DashboardRow'; +import { DashboardRow } from '../components/DashboardRow'; import { PanelChrome } from './PanelChrome'; import { PanelEditor } from '../panel_editor/PanelEditor'; -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel, DashboardModel } from '../state'; import { PanelPlugin } from 'app/types'; import { PanelResizer } from './PanelResizer'; diff --git a/public/app/features/dashboard/dashgrid/PanelChrome.tsx b/public/app/features/dashboard/dashgrid/PanelChrome.tsx index 359965bc9ad..bdb6aca870a 100644 --- a/public/app/features/dashboard/dashgrid/PanelChrome.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChrome.tsx @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react'; import { AutoSizer } from 'react-virtualized'; // Services -import { getTimeSrv, TimeSrv } from '../time_srv'; +import { getTimeSrv, TimeSrv } from '../services/TimeSrv'; // Components 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'; // Types -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel } from '../state/PanelModel'; +import { DashboardModel } from '../state/DashboardModel'; import { PanelPlugin } from 'app/types'; import { TimeRange } from '@grafana/ui'; diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx index 6dd4af2dc03..ebc89673387 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx @@ -6,8 +6,8 @@ import PanelHeaderCorner from './PanelHeaderCorner'; import { PanelHeaderMenu } from './PanelHeaderMenu'; import templateSrv from 'app/features/templating/template_srv'; -import { DashboardModel } from 'app/features/dashboard/dashboard_model'; -import { PanelModel } from 'app/features/dashboard/panel_model'; +import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; +import { PanelModel } from 'app/features/dashboard/state/PanelModel'; import { ClickOutsideWrapper } from 'app/core/components/ClickOutsideWrapper/ClickOutsideWrapper'; export interface Props { diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx index 4f5a74f820b..159c9d92914 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx @@ -1,10 +1,10 @@ import React, { Component } from 'react'; import Remarkable from 'remarkable'; 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 { 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 { Error = 'Error', diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx index 1d17ec6cefc..5a0b6bbecb6 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenu.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; -import { DashboardModel } from 'app/features/dashboard/dashboard_model'; -import { PanelModel } from 'app/features/dashboard/panel_model'; +import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; +import { PanelModel } from 'app/features/dashboard/state/PanelModel'; import { PanelHeaderMenuItem } from './PanelHeaderMenuItem'; import { getPanelMenu } from 'app/features/dashboard/utils/getPanelMenu'; import { PanelMenuItem } from '@grafana/ui'; diff --git a/public/app/features/dashboard/dashgrid/PanelResizer.tsx b/public/app/features/dashboard/dashgrid/PanelResizer.tsx index 1ee5b3884a0..4571b5bcbf5 100644 --- a/public/app/features/dashboard/dashgrid/PanelResizer.tsx +++ b/public/app/features/dashboard/dashgrid/PanelResizer.tsx @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import { throttle } from 'lodash'; import Draggable, { DraggableEventHandler } from 'react-draggable'; -import { PanelModel } from '../panel_model'; +import { PanelModel } from '../state/PanelModel'; interface Props { isEditing: boolean; diff --git a/public/app/features/dashboard/index.ts b/public/app/features/dashboard/index.ts index efa54f0ee07..9f2935660ef 100644 --- a/public/app/features/dashboard/index.ts +++ b/public/app/features/dashboard/index.ts @@ -1,5 +1,4 @@ -import './dashboard_ctrl'; -import './time_srv'; +import './containers/DashboardCtrl'; import './dashgrid/DashboardGridDirective'; // Services diff --git a/public/app/features/dashboard/panel_editor/GeneralTab.tsx b/public/app/features/dashboard/panel_editor/GeneralTab.tsx index 91e236c8b31..d91737195f1 100644 --- a/public/app/features/dashboard/panel_editor/GeneralTab.tsx +++ b/public/app/features/dashboard/panel_editor/GeneralTab.tsx @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react'; import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader'; import { EditorTabBody } from './EditorTabBody'; -import { PanelModel } from '../panel_model'; +import { PanelModel } from '../state/PanelModel'; import './../../panel/GeneralTabCtrl'; interface Props { diff --git a/public/app/features/dashboard/panel_editor/PanelEditor.tsx b/public/app/features/dashboard/panel_editor/PanelEditor.tsx index 123204aa239..7b8097b9f65 100644 --- a/public/app/features/dashboard/panel_editor/PanelEditor.tsx +++ b/public/app/features/dashboard/panel_editor/PanelEditor.tsx @@ -11,8 +11,8 @@ import { store } from 'app/store/store'; import { updateLocation } from 'app/core/actions'; import { AngularComponent } from 'app/core/services/AngularLoader'; -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel } from '../state/PanelModel'; +import { DashboardModel } from '../state/DashboardModel'; import { PanelPlugin } from 'app/types/plugins'; import { Tooltip } from '@grafana/ui'; diff --git a/public/app/features/dashboard/panel_editor/QueriesTab.tsx b/public/app/features/dashboard/panel_editor/QueriesTab.tsx index 28d822e3ad5..140bb4b0fd7 100644 --- a/public/app/features/dashboard/panel_editor/QueriesTab.tsx +++ b/public/app/features/dashboard/panel_editor/QueriesTab.tsx @@ -16,8 +16,8 @@ import { BackendSrv, getBackendSrv } from 'app/core/services/backend_srv'; import config from 'app/core/config'; // Types -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel } from '../state/PanelModel'; +import { DashboardModel } from '../state/DashboardModel'; import { DataQuery, DataSourceSelectItem } from '@grafana/ui/src/types'; import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp'; diff --git a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx index 2651ab0608c..b07b4be6f56 100644 --- a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx +++ b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx @@ -9,7 +9,7 @@ import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoa import { Emitter } from 'app/core/utils/emitter'; // Types -import { PanelModel } from '../panel_model'; +import { PanelModel } from '../state/PanelModel'; import { DataQuery, DataSourceApi } from '@grafana/ui'; interface Props { diff --git a/public/app/features/dashboard/panel_editor/QueryOptions.tsx b/public/app/features/dashboard/panel_editor/QueryOptions.tsx index 2ffa4ef59d3..d203f3bc25f 100644 --- a/public/app/features/dashboard/panel_editor/QueryOptions.tsx +++ b/public/app/features/dashboard/panel_editor/QueryOptions.tsx @@ -13,7 +13,7 @@ import DataSourceOption from './DataSourceOption'; import { FormLabel } from '@grafana/ui'; // Types -import { PanelModel } from '../panel_model'; +import { PanelModel } from '../state/PanelModel'; import { DataSourceSelectItem } from '@grafana/ui/src/types'; import { ValidationEvents } from 'app/types'; diff --git a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx index 64bf3165ddc..35b9b71112a 100644 --- a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx +++ b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx @@ -11,8 +11,8 @@ import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp'; import { FadeIn } from 'app/core/components/Animations/FadeIn'; // Types -import { PanelModel } from '../panel_model'; -import { DashboardModel } from '../dashboard_model'; +import { PanelModel } from '../state/PanelModel'; +import { DashboardModel } from '../state/DashboardModel'; import { PanelPlugin } from 'app/types/plugins'; interface Props { diff --git a/public/app/features/dashboard/services/ChangeTracker.test.ts b/public/app/features/dashboard/services/ChangeTracker.test.ts index dfc9b3fa03f..31e5f8f5052 100644 --- a/public/app/features/dashboard/services/ChangeTracker.test.ts +++ b/public/app/features/dashboard/services/ChangeTracker.test.ts @@ -1,7 +1,7 @@ import { ChangeTracker } from './ChangeTracker'; import { contextSrv } from 'app/core/services/context_srv'; -import { DashboardModel } from '../dashboard_model'; -import { PanelModel } from '../panel_model'; +import { DashboardModel } from '../state/DashboardModel'; +import { PanelModel } from '../state/PanelModel'; jest.mock('app/core/services/context_srv', () => ({ contextSrv: { diff --git a/public/app/features/dashboard/services/ChangeTracker.ts b/public/app/features/dashboard/services/ChangeTracker.ts index ef3d456db48..77434525085 100644 --- a/public/app/features/dashboard/services/ChangeTracker.ts +++ b/public/app/features/dashboard/services/ChangeTracker.ts @@ -1,6 +1,6 @@ import angular from 'angular'; import _ from 'lodash'; -import { DashboardModel } from '../dashboard_model'; +import { DashboardModel } from '../state/DashboardModel'; export class ChangeTracker { current: any; diff --git a/public/app/features/dashboard/services/DashboardSrv.ts b/public/app/features/dashboard/services/DashboardSrv.ts index 67a4938c6aa..03aeb34ed36 100644 --- a/public/app/features/dashboard/services/DashboardSrv.ts +++ b/public/app/features/dashboard/services/DashboardSrv.ts @@ -1,5 +1,5 @@ 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'; export class DashboardSrv { diff --git a/public/app/features/dashboard/services/DashboardViewStateSrv.test.ts b/public/app/features/dashboard/services/DashboardViewStateSrv.test.ts index 20215017e1d..12bb11b7a08 100644 --- a/public/app/features/dashboard/services/DashboardViewStateSrv.test.ts +++ b/public/app/features/dashboard/services/DashboardViewStateSrv.test.ts @@ -1,6 +1,6 @@ import config from 'app/core/config'; import { DashboardViewStateSrv } from './DashboardViewStateSrv'; -import { DashboardModel } from '../dashboard_model'; +import { DashboardModel } from '../state/DashboardModel'; describe('when updating view state', () => { const location = { diff --git a/public/app/features/dashboard/services/DashboardViewStateSrv.ts b/public/app/features/dashboard/services/DashboardViewStateSrv.ts index 816b6d8bd2d..fc38c3b241f 100644 --- a/public/app/features/dashboard/services/DashboardViewStateSrv.ts +++ b/public/app/features/dashboard/services/DashboardViewStateSrv.ts @@ -2,7 +2,7 @@ import angular from 'angular'; import _ from 'lodash'; import config from 'app/core/config'; import appEvents from 'app/core/app_events'; -import { DashboardModel } from '../dashboard_model'; +import { DashboardModel } from '../state/DashboardModel'; // represents the transient view state // like fullscreen panel & edit diff --git a/public/app/features/dashboard/specs/time_srv.test.ts b/public/app/features/dashboard/services/TimeSrv.test.ts similarity index 98% rename from public/app/features/dashboard/specs/time_srv.test.ts rename to public/app/features/dashboard/services/TimeSrv.test.ts index db0d11f2ebe..e5b4c240785 100644 --- a/public/app/features/dashboard/specs/time_srv.test.ts +++ b/public/app/features/dashboard/services/TimeSrv.test.ts @@ -1,5 +1,4 @@ -import { TimeSrv } from '../time_srv'; -import '../time_srv'; +import { TimeSrv } from './TimeSrv'; import moment from 'moment'; describe('timeSrv', () => { diff --git a/public/app/features/dashboard/time_srv.ts b/public/app/features/dashboard/services/TimeSrv.ts similarity index 100% rename from public/app/features/dashboard/time_srv.ts rename to public/app/features/dashboard/services/TimeSrv.ts diff --git a/public/app/features/dashboard/specs/dashboard_migration.test.ts b/public/app/features/dashboard/state/DashboardMigrator.test.ts similarity index 99% rename from public/app/features/dashboard/specs/dashboard_migration.test.ts rename to public/app/features/dashboard/state/DashboardMigrator.test.ts index e15bd65d5a5..fdb309b5db5 100644 --- a/public/app/features/dashboard/specs/dashboard_migration.test.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.test.ts @@ -1,6 +1,6 @@ import _ from 'lodash'; -import { DashboardModel } from '../dashboard_model'; -import { PanelModel } from '../panel_model'; +import { DashboardModel } from '../state/DashboardModel'; +import { PanelModel } from '../state/PanelModel'; import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN } from 'app/core/constants'; import { expect } from 'test/lib/common'; diff --git a/public/app/features/dashboard/dashboard_migration.ts b/public/app/features/dashboard/state/DashboardMigrator.ts similarity index 99% rename from public/app/features/dashboard/dashboard_migration.ts rename to public/app/features/dashboard/state/DashboardMigrator.ts index 2dbeb6c6e80..ba631102b81 100644 --- a/public/app/features/dashboard/dashboard_migration.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -7,8 +7,8 @@ import { MIN_PANEL_HEIGHT, DEFAULT_PANEL_SPAN, } from 'app/core/constants'; -import { PanelModel } from './panel_model'; -import { DashboardModel } from './dashboard_model'; +import { PanelModel } from './PanelModel'; +import { DashboardModel } from './DashboardModel'; import getFactors from 'app/core/utils/factors'; export class DashboardMigrator { diff --git a/public/app/features/dashboard/specs/repeat.test.ts b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts similarity index 99% rename from public/app/features/dashboard/specs/repeat.test.ts rename to public/app/features/dashboard/state/DashboardModel.repeat.test.ts index 49fb4ea9ee7..723cf1f9d16 100644 --- a/public/app/features/dashboard/specs/repeat.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { DashboardModel } from '../dashboard_model'; +import { DashboardModel } from '../state/DashboardModel'; import { expect } from 'test/lib/common'; jest.mock('app/core/services/context_srv', () => ({})); diff --git a/public/app/features/dashboard/specs/dashboard_model.test.ts b/public/app/features/dashboard/state/DashboardModel.test.ts similarity index 99% rename from public/app/features/dashboard/specs/dashboard_model.test.ts rename to public/app/features/dashboard/state/DashboardModel.test.ts index e59d52f2410..cd30fc2ecdc 100644 --- a/public/app/features/dashboard/specs/dashboard_model.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.test.ts @@ -1,6 +1,6 @@ import _ from 'lodash'; -import { DashboardModel } from '../dashboard_model'; -import { PanelModel } from '../panel_model'; +import { DashboardModel } from '../state/DashboardModel'; +import { PanelModel } from '../state/PanelModel'; jest.mock('app/core/services/context_srv', () => ({})); diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/state/DashboardModel.ts similarity index 99% rename from public/app/features/dashboard/dashboard_model.ts rename to public/app/features/dashboard/state/DashboardModel.ts index f7cc49223df..06dc9450425 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -7,8 +7,8 @@ import { Emitter } from 'app/core/utils/emitter'; import { contextSrv } from 'app/core/services/context_srv'; import sortByKeys from 'app/core/utils/sort_by_keys'; -import { PanelModel } from './panel_model'; -import { DashboardMigrator } from './dashboard_migration'; +import { PanelModel } from './PanelModel'; +import { DashboardMigrator } from './DashboardMigrator'; import { TimeRange } from '@grafana/ui/src'; export class DashboardModel { diff --git a/public/app/features/dashboard/specs/panel_model.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts similarity index 96% rename from public/app/features/dashboard/specs/panel_model.test.ts rename to public/app/features/dashboard/state/PanelModel.test.ts index 89976fa275a..b751caaa8f1 100644 --- a/public/app/features/dashboard/specs/panel_model.test.ts +++ b/public/app/features/dashboard/state/PanelModel.test.ts @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { PanelModel } from '../panel_model'; +import { PanelModel } from '../state/PanelModel'; describe('PanelModel', () => { describe('when creating new panel model', () => { diff --git a/public/app/features/dashboard/panel_model.ts b/public/app/features/dashboard/state/PanelModel.ts similarity index 100% rename from public/app/features/dashboard/panel_model.ts rename to public/app/features/dashboard/state/PanelModel.ts diff --git a/public/app/features/dashboard/state/index.ts b/public/app/features/dashboard/state/index.ts new file mode 100644 index 00000000000..253d4aa7ac3 --- /dev/null +++ b/public/app/features/dashboard/state/index.ts @@ -0,0 +1,2 @@ +export { DashboardModel } from './DashboardModel'; +export { PanelModel } from './PanelModel'; diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index 190451671ad..568e9ba4f7f 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -2,8 +2,8 @@ import { updateLocation } from 'app/core/actions'; import { store } from 'app/store/store'; import { removePanel, duplicatePanel, copyPanel, editPanelJson, sharePanel } from 'app/features/dashboard/utils/panel'; -import { PanelModel } from 'app/features/dashboard/panel_model'; -import { DashboardModel } from 'app/features/dashboard/dashboard_model'; +import { PanelModel } from 'app/features/dashboard/state/PanelModel'; +import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; import { PanelMenuItem } from '@grafana/ui'; export const getPanelMenu = (dashboard: DashboardModel, panel: PanelModel) => { diff --git a/public/app/features/dashboard/utils/panel.ts b/public/app/features/dashboard/utils/panel.ts index cfbe094125f..c0d753477a7 100644 --- a/public/app/features/dashboard/utils/panel.ts +++ b/public/app/features/dashboard/utils/panel.ts @@ -2,8 +2,8 @@ import store from 'app/core/store'; // Models -import { DashboardModel } from 'app/features/dashboard/dashboard_model'; -import { PanelModel } from 'app/features/dashboard/panel_model'; +import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; +import { PanelModel } from 'app/features/dashboard/state/PanelModel'; import { TimeRange } from '@grafana/ui'; // Utils diff --git a/public/app/features/explore/QueryEditor.tsx b/public/app/features/explore/QueryEditor.tsx index 266e6fb42df..083cd8a2e17 100644 --- a/public/app/features/explore/QueryEditor.tsx +++ b/public/app/features/explore/QueryEditor.tsx @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react'; // Services 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 import { Emitter } from 'app/core/utils/emitter'; diff --git a/public/app/features/panel/specs/metrics_panel_ctrl.test.ts b/public/app/features/panel/specs/metrics_panel_ctrl.test.ts index 8b9607d39ad..d647af616a9 100644 --- a/public/app/features/panel/specs/metrics_panel_ctrl.test.ts +++ b/public/app/features/panel/specs/metrics_panel_ctrl.test.ts @@ -11,7 +11,7 @@ jest.mock('app/core/config', () => { }); 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'; describe('MetricsPanelCtrl', () => { diff --git a/public/app/features/templating/specs/variable_srv.test.ts b/public/app/features/templating/specs/variable_srv.test.ts index 7e5d0ff98c7..db42df7f516 100644 --- a/public/app/features/templating/specs/variable_srv.test.ts +++ b/public/app/features/templating/specs/variable_srv.test.ts @@ -1,6 +1,6 @@ import '../all'; import { VariableSrv } from '../variable_srv'; -import { DashboardModel } from '../../dashboard/dashboard_model'; +import { DashboardModel } from '../../dashboard/state/DashboardModel'; import moment from 'moment'; import $q from 'q'; diff --git a/public/app/features/templating/specs/variable_srv_init.test.ts b/public/app/features/templating/specs/variable_srv_init.test.ts index 4e5e025522f..b8cabf711ac 100644 --- a/public/app/features/templating/specs/variable_srv_init.test.ts +++ b/public/app/features/templating/specs/variable_srv_init.test.ts @@ -2,7 +2,7 @@ import '../all'; import _ from 'lodash'; import { VariableSrv } from '../variable_srv'; -import { DashboardModel } from '../../dashboard/dashboard_model'; +import { DashboardModel } from '../../dashboard/state/DashboardModel'; import $q from 'q'; describe('VariableSrv init', function(this: any) { diff --git a/public/app/features/templating/variable_srv.ts b/public/app/features/templating/variable_srv.ts index dff798ace29..b2f8b43fb08 100644 --- a/public/app/features/templating/variable_srv.ts +++ b/public/app/features/templating/variable_srv.ts @@ -7,8 +7,8 @@ import coreModule from 'app/core/core_module'; import { variableTypes } from './variable'; import { Graph } from 'app/core/utils/dag'; import { TemplateSrv } from 'app/features/templating/template_srv'; -import { TimeSrv } from 'app/features/dashboard/time_srv'; -import { DashboardModel } from 'app/features/dashboard/dashboard_model'; +import { TimeSrv } from 'app/features/dashboard/services/TimeSrv'; +import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; // Types import { TimeRange } from '@grafana/ui/src'; diff --git a/public/app/routes/GrafanaCtrl.ts b/public/app/routes/GrafanaCtrl.ts index 4e4dd8121cf..70bdf49e5e4 100644 --- a/public/app/routes/GrafanaCtrl.ts +++ b/public/app/routes/GrafanaCtrl.ts @@ -8,7 +8,7 @@ import coreModule from 'app/core/core_module'; import { profiler } from 'app/core/profiler'; import appEvents from 'app/core/app_events'; 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 { AngularLoader, setAngularLoader } from 'app/core/services/AngularLoader'; import { configureStore } from 'app/store/configureStore'; diff --git a/public/app/routes/ReactContainer.tsx b/public/app/routes/ReactContainer.tsx index 807608e6960..19cdff03b69 100644 --- a/public/app/routes/ReactContainer.tsx +++ b/public/app/routes/ReactContainer.tsx @@ -4,8 +4,6 @@ import { Provider } from 'react-redux'; import coreModule from 'app/core/core_module'; 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'; function WrapInProvider(store, Component, props) { @@ -20,8 +18,6 @@ function WrapInProvider(store, Component, props) { export function reactContainer( $route, $location, - backendSrv: BackendSrv, - datasourceSrv: DatasourceSrv, contextSrv: ContextSrv ) { return { @@ -42,11 +38,7 @@ export function reactContainer( component = component.default; } - const props = { - backendSrv: backendSrv, - datasourceSrv: datasourceSrv, - routeParams: $route.current.params, - }; + const props = { }; ReactDOM.render(WrapInProvider(store, component, props), elem[0]); diff --git a/public/sass/components/_view_states.scss b/public/sass/components/_view_states.scss index b92bd596193..518d5d0f446 100644 --- a/public/sass/components/_view_states.scss +++ b/public/sass/components/_view_states.scss @@ -50,3 +50,4 @@ display: none; } } + diff --git a/public/test/specs/helpers.ts b/public/test/specs/helpers.ts index 536b277eec3..1570c7dd9b7 100644 --- a/public/test/specs/helpers.ts +++ b/public/test/specs/helpers.ts @@ -2,7 +2,7 @@ import _ from 'lodash'; import config from 'app/core/config'; import * as dateMath from 'app/core/utils/datemath'; 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) { const self = this;