Browse Source

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

Torkel Ödegaard 7 years ago
parent
commit
26385dea8f
29 changed files with 39 additions and 57 deletions
  1. 5 14
      public/app/features/dashboard/all.ts
  2. 2 2
      public/app/features/dashboard/components/DashExportModal/DashExportCtrl.ts
  3. 2 2
      public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts
  4. 1 1
      public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts
  5. 2 0
      public/app/features/dashboard/components/DashExportModal/index.ts
  6. 0 0
      public/app/features/dashboard/components/DashExportModal/template.html
  7. 1 1
      public/app/features/dashboard/components/DashLinks/DashLinksContainerCtrl.ts
  8. 3 3
      public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts
  9. 0 0
      public/app/features/dashboard/components/DashLinks/editor.html
  10. 2 0
      public/app/features/dashboard/components/DashLinks/index.ts
  11. 2 2
      public/app/features/dashboard/components/DashNav/DashNavCtrl.ts
  12. 1 0
      public/app/features/dashboard/components/DashNav/index.ts
  13. 0 0
      public/app/features/dashboard/components/DashNav/template.html
  14. 1 1
      public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts
  15. 1 0
      public/app/features/dashboard/components/ExportDataModal/index.ts
  16. 0 0
      public/app/features/dashboard/components/ExportDataModal/template.html
  17. 1 1
      public/app/features/dashboard/components/FolderPicker/FolderPickerCtrl.ts
  18. 1 0
      public/app/features/dashboard/components/FolderPicker/index.ts
  19. 0 0
      public/app/features/dashboard/components/FolderPicker/template.html
  20. 0 25
      public/app/features/dashboard/folder_permissions_ctrl.ts
  21. 0 0
      public/app/features/manage-dashboards/CreateFolderCtrl.ts
  22. 2 2
      public/app/features/manage-dashboards/DashboardImportCtrl.test.ts
  23. 0 0
      public/app/features/manage-dashboards/DashboardImportCtrl.ts
  24. 1 1
      public/app/features/manage-dashboards/FolderDashboardsCtrl.ts
  25. 1 1
      public/app/features/manage-dashboards/components/MoveToFolderModal/MoveToFolderCtrl.ts
  26. 1 0
      public/app/features/manage-dashboards/components/MoveToFolderModal/index.ts
  27. 0 0
      public/app/features/manage-dashboards/components/MoveToFolderModal/template.html
  28. 9 1
      public/app/features/manage-dashboards/index.ts
  29. 0 0
      public/app/features/manage-dashboards/services/FolderPageLoader.ts

+ 5 - 14
public/app/features/dashboard/all.ts

@@ -2,7 +2,6 @@ import './dashboard_ctrl';
 import './alerting_srv';
 import './history/history';
 import './dashboard_loader_srv';
-import './dashnav/dashnav';
 import './submenu/submenu';
 import './save_as_modal';
 import './save_modal';
@@ -17,17 +16,17 @@ import './unsaved_changes_srv';
 import './unsaved_changes_modal';
 import './timepicker/timepicker';
 import './upload';
-import './export/export_modal';
-import './export_data/export_data_modal';
 import './ad_hoc_filters';
 import './repeat_option/repeat_option';
 import './dashgrid/DashboardGridDirective';
 import './dashgrid/RowOptions';
-import './folder_picker/folder_picker';
-import './move_to_folder_modal/move_to_folder';
 import './settings/settings';
 import './panellinks/module';
-import './dashlinks/module';
+import './components/DashLinks';
+import './components/DashExportModal';
+import './components/DashNav';
+import './components/ExportDataModal';
+import './components/FolderPicker';
 
 // angular wrappers
 import { react2AngularDirective } from 'app/core/utils/react2angular';
@@ -35,11 +34,3 @@ import DashboardPermissions from './permissions/DashboardPermissions';
 
 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 - 2
public/app/features/dashboard/export/export_modal.ts → public/app/features/dashboard/components/DashExportModal/DashExportCtrl.ts

@@ -2,7 +2,7 @@ import angular from 'angular';
 import { saveAs } from 'file-saver';
 
 import coreModule from 'app/core/core_module';
-import { DashboardExporter } from './exporter';
+import { DashboardExporter } from './DashboardExporter';
 
 export class DashExportCtrl {
   dash: any;
@@ -66,7 +66,7 @@ export class DashExportCtrl {
 export function dashExportDirective() {
   return {
     restrict: 'E',
-    templateUrl: 'public/app/features/dashboard/export/export_modal.html',
+    templateUrl: 'public/app/features/dashboard/components/DashExportModal/template.html',
     controller: DashExportCtrl,
     bindToController: true,
     controllerAs: 'ctrl',

+ 2 - 2
public/app/features/dashboard/specs/exporter.test.ts → public/app/features/dashboard/components/DashExportModal/DashboardExporter.test.ts

@@ -6,8 +6,8 @@ jest.mock('app/core/store', () => {
 
 import _ from 'lodash';
 import config from 'app/core/config';
-import { DashboardExporter } from '../export/exporter';
-import { DashboardModel } from '../dashboard_model';
+import { DashboardExporter } from './DashboardExporter';
+import { DashboardModel } from '../../dashboard_model';
 
 describe('given dashboard with repeated panels', () => {
   let dash, exported;

+ 1 - 1
public/app/features/dashboard/export/exporter.ts → 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 '../../dashboard_model';
 
 export class DashboardExporter {
   constructor(private datasourceSrv) {}

+ 2 - 0
public/app/features/dashboard/components/DashExportModal/index.ts

@@ -0,0 +1,2 @@
+export { DashboardExporter } from './DashboardExporter';
+export { DashExportCtrl } from './DashExportCtrl';

+ 0 - 0
public/app/features/dashboard/export/export_modal.html → public/app/features/dashboard/components/DashExportModal/template.html


+ 1 - 1
public/app/features/dashboard/dashlinks/module.ts → public/app/features/dashboard/components/DashLinks/DashLinksContainerCtrl.ts

@@ -1,6 +1,6 @@
 import angular from 'angular';
 import _ from 'lodash';
-import { iconMap } from './editor';
+import { iconMap } from './DashLinksEditorCtrl';
 
 function dashLinksContainer() {
   return {

+ 3 - 3
public/app/features/dashboard/dashlinks/editor.ts → public/app/features/dashboard/components/DashLinks/DashLinksEditorCtrl.ts

@@ -11,7 +11,7 @@ export let iconMap = {
   cloud: 'fa-cloud',
 };
 
-export class DashLinkEditorCtrl {
+export class DashLinksEditorCtrl {
   dashboard: any;
   iconMap: any;
   mode: any;
@@ -65,8 +65,8 @@ export class DashLinkEditorCtrl {
 function dashLinksEditor() {
   return {
     restrict: 'E',
-    controller: DashLinkEditorCtrl,
-    templateUrl: 'public/app/features/dashboard/dashlinks/editor.html',
+    controller: DashLinksEditorCtrl,
+    templateUrl: 'public/app/features/dashboard/components/DashLinks/editor.html',
     bindToController: true,
     controllerAs: 'ctrl',
     scope: {

+ 0 - 0
public/app/features/dashboard/dashlinks/editor.html → public/app/features/dashboard/components/DashLinks/editor.html


+ 2 - 0
public/app/features/dashboard/components/DashLinks/index.ts

@@ -0,0 +1,2 @@
+export { DashLinksContainerCtrl } from './DashLinksContainerCtrl';
+export { DashLinksEditorCtrl } from './DashLinksEditorCtrl';

+ 2 - 2
public/app/features/dashboard/dashnav/dashnav.ts → 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 '../../dashboard_model';
 
 export class DashNavCtrl {
   dashboard: DashboardModel;
@@ -107,7 +107,7 @@ export class DashNavCtrl {
 export function dashNavDirective() {
   return {
     restrict: 'E',
-    templateUrl: 'public/app/features/dashboard/dashnav/dashnav.html',
+    templateUrl: 'public/app/features/dashboard/components/DashNav/template.html',
     controller: DashNavCtrl,
     bindToController: true,
     controllerAs: 'ctrl',

+ 1 - 0
public/app/features/dashboard/components/DashNav/index.ts

@@ -0,0 +1 @@
+export { DashNavCtrl } from './DashNavCtrl';

+ 0 - 0
public/app/features/dashboard/dashnav/dashnav.html → public/app/features/dashboard/components/DashNav/template.html


+ 1 - 1
public/app/features/dashboard/export_data/export_data_modal.ts → public/app/features/dashboard/components/ExportDataModal/ExportDataModalCtrl.ts

@@ -31,7 +31,7 @@ export class ExportDataModalCtrl {
 export function exportDataModal() {
   return {
     restrict: 'E',
-    templateUrl: 'public/app/features/dashboard/export_data/export_data_modal.html',
+    templateUrl: 'public/app/features/dashboard/components/ExportDataModal/template.html',
     controller: ExportDataModalCtrl,
     controllerAs: 'ctrl',
     scope: {

+ 1 - 0
public/app/features/dashboard/components/ExportDataModal/index.ts

@@ -0,0 +1 @@
+export { ExportDataModalCtrl } from './ExportDataModalCtrl';

+ 0 - 0
public/app/features/dashboard/export_data/export_data_modal.html → public/app/features/dashboard/components/ExportDataModal/template.html


+ 1 - 1
public/app/features/dashboard/folder_picker/folder_picker.ts → public/app/features/dashboard/components/FolderPicker/FolderPickerCtrl.ts

@@ -168,7 +168,7 @@ export class FolderPickerCtrl {
 export function folderPicker() {
   return {
     restrict: 'E',
-    templateUrl: 'public/app/features/dashboard/folder_picker/folder_picker.html',
+    templateUrl: 'public/app/features/dashboard/components/FolderPicker/template.html',
     controller: FolderPickerCtrl,
     bindToController: true,
     controllerAs: 'ctrl',

+ 1 - 0
public/app/features/dashboard/components/FolderPicker/index.ts

@@ -0,0 +1 @@
+export { FolderPickerCtrl } from './FolderPickerCtrl';

+ 0 - 0
public/app/features/dashboard/folder_picker/folder_picker.html → public/app/features/dashboard/components/FolderPicker/template.html


+ 0 - 25
public/app/features/dashboard/folder_permissions_ctrl.ts

@@ -1,25 +0,0 @@
-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;
-      });
-    }
-  }
-}

+ 0 - 0
public/app/features/dashboard/create_folder_ctrl.ts → public/app/features/manage-dashboards/CreateFolderCtrl.ts


+ 2 - 2
public/app/features/dashboard/specs/dashboard_import_ctrl.test.ts → public/app/features/manage-dashboards/DashboardImportCtrl.test.ts

@@ -1,5 +1,5 @@
-import { DashboardImportCtrl } from '../dashboard_import_ctrl';
-import config from '../../../core/config';
+import { DashboardImportCtrl } from './DashboardImportCtrl';
+import config from 'app/core/config';
 
 describe('DashboardImportCtrl', () => {
   const ctx: any = {};

+ 0 - 0
public/app/features/dashboard/dashboard_import_ctrl.ts → public/app/features/manage-dashboards/DashboardImportCtrl.ts


+ 1 - 1
public/app/features/dashboard/folder_dashboards_ctrl.ts → public/app/features/manage-dashboards/FolderDashboardsCtrl.ts

@@ -1,4 +1,4 @@
-import { FolderPageLoader } from './folder_page_loader';
+import { FolderPageLoader } from './services/FolderPageLoader';
 import locationUtil from 'app/core/utils/location_util';
 
 export class FolderDashboardsCtrl {

+ 1 - 1
public/app/features/dashboard/move_to_folder_modal/move_to_folder.ts → public/app/features/manage-dashboards/components/MoveToFolderModal/MoveToFolderCtrl.ts

@@ -46,7 +46,7 @@ export class MoveToFolderCtrl {
 export function moveToFolderModal() {
   return {
     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,
     bindToController: true,
     controllerAs: 'ctrl',

+ 1 - 0
public/app/features/manage-dashboards/components/MoveToFolderModal/index.ts

@@ -0,0 +1 @@
+export { MoveToFolderCtrl } from './MoveToFolderCtrl';

+ 0 - 0
public/app/features/dashboard/move_to_folder_modal/move_to_folder.html → public/app/features/manage-dashboards/components/MoveToFolderModal/template.html


+ 9 - 1
public/app/features/manage-dashboards/index.ts

@@ -1,7 +1,15 @@
-import coreModule from 'app/core/core_module';
+export * from './components/MoveToFolderModal';
 
 import { DashboardListCtrl } from './DashboardListCtrl';
 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('SnapshotListCtrl', SnapshotListCtrl);
+coreModule.controller('FolderDashboardsCtrl', FolderDashboardsCtrl);
+coreModule.controller('DashboardImportCtrl', DashboardImportCtrl);
+coreModule.controller('CreateFolderCtrl', CreateFolderCtrl);

+ 0 - 0
public/app/features/dashboard/folder_page_loader.ts → public/app/features/manage-dashboards/services/FolderPageLoader.ts