Commit 26385dea by Torkel Ödegaard

Began work on improving structure and organization of components under features/dashboard, #14062

parent 2264c275
...@@ -2,7 +2,6 @@ import './dashboard_ctrl'; ...@@ -2,7 +2,6 @@ import './dashboard_ctrl';
import './alerting_srv'; import './alerting_srv';
import './history/history'; import './history/history';
import './dashboard_loader_srv'; import './dashboard_loader_srv';
import './dashnav/dashnav';
import './submenu/submenu'; import './submenu/submenu';
import './save_as_modal'; import './save_as_modal';
import './save_modal'; import './save_modal';
...@@ -17,17 +16,17 @@ import './unsaved_changes_srv'; ...@@ -17,17 +16,17 @@ import './unsaved_changes_srv';
import './unsaved_changes_modal'; import './unsaved_changes_modal';
import './timepicker/timepicker'; import './timepicker/timepicker';
import './upload'; import './upload';
import './export/export_modal';
import './export_data/export_data_modal';
import './ad_hoc_filters'; import './ad_hoc_filters';
import './repeat_option/repeat_option'; import './repeat_option/repeat_option';
import './dashgrid/DashboardGridDirective'; import './dashgrid/DashboardGridDirective';
import './dashgrid/RowOptions'; import './dashgrid/RowOptions';
import './folder_picker/folder_picker';
import './move_to_folder_modal/move_to_folder';
import './settings/settings'; import './settings/settings';
import './panellinks/module'; import './panellinks/module';
import './dashlinks/module'; import './components/DashLinks';
import './components/DashExportModal';
import './components/DashNav';
import './components/ExportDataModal';
import './components/FolderPicker';
// angular wrappers // angular wrappers
import { react2AngularDirective } from 'app/core/utils/react2angular'; import { react2AngularDirective } from 'app/core/utils/react2angular';
...@@ -35,11 +34,3 @@ import DashboardPermissions from './permissions/DashboardPermissions'; ...@@ -35,11 +34,3 @@ import DashboardPermissions from './permissions/DashboardPermissions';
react2AngularDirective('dashboardPermissions', DashboardPermissions, ['dashboardId', 'folder']); react2AngularDirective('dashboardPermissions', DashboardPermissions, ['dashboardId', 'folder']);
import coreModule from 'app/core/core_module';
import { FolderDashboardsCtrl } from './folder_dashboards_ctrl';
import { DashboardImportCtrl } from './dashboard_import_ctrl';
import { CreateFolderCtrl } from './create_folder_ctrl';
coreModule.controller('FolderDashboardsCtrl', FolderDashboardsCtrl);
coreModule.controller('DashboardImportCtrl', DashboardImportCtrl);
coreModule.controller('CreateFolderCtrl', CreateFolderCtrl);
...@@ -2,7 +2,7 @@ import angular from 'angular'; ...@@ -2,7 +2,7 @@ import angular from 'angular';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import coreModule from 'app/core/core_module'; import coreModule from 'app/core/core_module';
import { DashboardExporter } from './exporter'; import { DashboardExporter } from './DashboardExporter';
export class DashExportCtrl { export class DashExportCtrl {
dash: any; dash: any;
...@@ -66,7 +66,7 @@ export class DashExportCtrl { ...@@ -66,7 +66,7 @@ export class DashExportCtrl {
export function dashExportDirective() { export function dashExportDirective() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/export/export_modal.html', templateUrl: 'public/app/features/dashboard/components/DashExportModal/template.html',
controller: DashExportCtrl, controller: DashExportCtrl,
bindToController: true, bindToController: true,
controllerAs: 'ctrl', controllerAs: 'ctrl',
......
...@@ -6,8 +6,8 @@ jest.mock('app/core/store', () => { ...@@ -6,8 +6,8 @@ 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 '../export/exporter'; import { DashboardExporter } from './DashboardExporter';
import { DashboardModel } from '../dashboard_model'; import { DashboardModel } from '../../dashboard_model';
describe('given dashboard with repeated panels', () => { describe('given dashboard with repeated panels', () => {
let dash, exported; let dash, exported;
......
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 '../../dashboard_model';
export class DashboardExporter { export class DashboardExporter {
constructor(private datasourceSrv) {} constructor(private datasourceSrv) {}
......
export { DashboardExporter } from './DashboardExporter';
export { DashExportCtrl } from './DashExportCtrl';
import angular from 'angular'; import angular from 'angular';
import _ from 'lodash'; import _ from 'lodash';
import { iconMap } from './editor'; import { iconMap } from './DashLinksEditorCtrl';
function dashLinksContainer() { function dashLinksContainer() {
return { return {
......
...@@ -11,7 +11,7 @@ export let iconMap = { ...@@ -11,7 +11,7 @@ export let iconMap = {
cloud: 'fa-cloud', cloud: 'fa-cloud',
}; };
export class DashLinkEditorCtrl { export class DashLinksEditorCtrl {
dashboard: any; dashboard: any;
iconMap: any; iconMap: any;
mode: any; mode: any;
...@@ -65,8 +65,8 @@ export class DashLinkEditorCtrl { ...@@ -65,8 +65,8 @@ export class DashLinkEditorCtrl {
function dashLinksEditor() { function dashLinksEditor() {
return { return {
restrict: 'E', restrict: 'E',
controller: DashLinkEditorCtrl, controller: DashLinksEditorCtrl,
templateUrl: 'public/app/features/dashboard/dashlinks/editor.html', templateUrl: 'public/app/features/dashboard/components/DashLinks/editor.html',
bindToController: true, bindToController: true,
controllerAs: 'ctrl', controllerAs: 'ctrl',
scope: { scope: {
......
export { DashLinksContainerCtrl } from './DashLinksContainerCtrl';
export { DashLinksEditorCtrl } from './DashLinksEditorCtrl';
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 '../../dashboard_model';
export class DashNavCtrl { export class DashNavCtrl {
dashboard: DashboardModel; dashboard: DashboardModel;
...@@ -107,7 +107,7 @@ export class DashNavCtrl { ...@@ -107,7 +107,7 @@ export class DashNavCtrl {
export function dashNavDirective() { export function dashNavDirective() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/dashnav/dashnav.html', templateUrl: 'public/app/features/dashboard/components/DashNav/template.html',
controller: DashNavCtrl, controller: DashNavCtrl,
bindToController: true, bindToController: true,
controllerAs: 'ctrl', controllerAs: 'ctrl',
......
export { DashNavCtrl } from './DashNavCtrl';
...@@ -31,7 +31,7 @@ export class ExportDataModalCtrl { ...@@ -31,7 +31,7 @@ export class ExportDataModalCtrl {
export function exportDataModal() { export function exportDataModal() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/export_data/export_data_modal.html', templateUrl: 'public/app/features/dashboard/components/ExportDataModal/template.html',
controller: ExportDataModalCtrl, controller: ExportDataModalCtrl,
controllerAs: 'ctrl', controllerAs: 'ctrl',
scope: { scope: {
......
export { ExportDataModalCtrl } from './ExportDataModalCtrl';
...@@ -168,7 +168,7 @@ export class FolderPickerCtrl { ...@@ -168,7 +168,7 @@ export class FolderPickerCtrl {
export function folderPicker() { export function folderPicker() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/folder_picker/folder_picker.html', templateUrl: 'public/app/features/dashboard/components/FolderPicker/template.html',
controller: FolderPickerCtrl, controller: FolderPickerCtrl,
bindToController: true, bindToController: true,
controllerAs: 'ctrl', controllerAs: 'ctrl',
......
export { FolderPickerCtrl } from './FolderPickerCtrl';
import { FolderPageLoader } from './folder_page_loader';
export class FolderPermissionsCtrl {
navModel: any;
folderId: number;
uid: string;
dashboard: any;
meta: any;
/** @ngInject */
constructor(private backendSrv, navModelSrv, private $routeParams, $location) {
if (this.$routeParams.uid) {
this.uid = $routeParams.uid;
new FolderPageLoader(this.backendSrv).load(this, this.uid, 'manage-folder-permissions').then(folder => {
if ($location.path() !== folder.meta.url) {
$location.path(`${folder.meta.url}/permissions`).replace();
}
this.dashboard = folder.dashboard;
this.meta = folder.meta;
});
}
}
}
import { DashboardImportCtrl } from '../dashboard_import_ctrl'; import { DashboardImportCtrl } from './DashboardImportCtrl';
import config from '../../../core/config'; import config from 'app/core/config';
describe('DashboardImportCtrl', () => { describe('DashboardImportCtrl', () => {
const ctx: any = {}; const ctx: any = {};
......
import { FolderPageLoader } from './folder_page_loader'; import { FolderPageLoader } from './services/FolderPageLoader';
import locationUtil from 'app/core/utils/location_util'; import locationUtil from 'app/core/utils/location_util';
export class FolderDashboardsCtrl { export class FolderDashboardsCtrl {
......
...@@ -46,7 +46,7 @@ export class MoveToFolderCtrl { ...@@ -46,7 +46,7 @@ export class MoveToFolderCtrl {
export function moveToFolderModal() { export function moveToFolderModal() {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'public/app/features/dashboard/move_to_folder_modal/move_to_folder.html', templateUrl: 'public/app/features/manage-dashboards/components/MoveToFolderModal/template.html',
controller: MoveToFolderCtrl, controller: MoveToFolderCtrl,
bindToController: true, bindToController: true,
controllerAs: 'ctrl', controllerAs: 'ctrl',
......
export { MoveToFolderCtrl } from './MoveToFolderCtrl';
import coreModule from 'app/core/core_module'; export * from './components/MoveToFolderModal';
import { DashboardListCtrl } from './DashboardListCtrl'; import { DashboardListCtrl } from './DashboardListCtrl';
import { SnapshotListCtrl } from './SnapshotListCtrl'; import { SnapshotListCtrl } from './SnapshotListCtrl';
import { FolderDashboardsCtrl } from './FolderDashboardsCtrl';
import { DashboardImportCtrl } from './DashboardImportCtrl';
import { CreateFolderCtrl } from './CreateFolderCtrl';
import coreModule from 'app/core/core_module';
coreModule.controller('DashboardListCtrl', DashboardListCtrl); coreModule.controller('DashboardListCtrl', DashboardListCtrl);
coreModule.controller('SnapshotListCtrl', SnapshotListCtrl); coreModule.controller('SnapshotListCtrl', SnapshotListCtrl);
coreModule.controller('FolderDashboardsCtrl', FolderDashboardsCtrl);
coreModule.controller('DashboardImportCtrl', DashboardImportCtrl);
coreModule.controller('CreateFolderCtrl', CreateFolderCtrl);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment