diff --git a/public/app/core/controllers/all.ts b/public/app/core/controllers/all.ts index 0dbcdf4cb28..f6a4e51bad4 100644 --- a/public/app/core/controllers/all.ts +++ b/public/app/core/controllers/all.ts @@ -1,4 +1,3 @@ -import './inspect_ctrl'; import './json_editor_ctrl'; import './login_ctrl'; import './invited_ctrl'; diff --git a/public/app/core/controllers/inspect_ctrl.ts b/public/app/core/controllers/inspect_ctrl.ts deleted file mode 100644 index d106b42da16..00000000000 --- a/public/app/core/controllers/inspect_ctrl.ts +++ /dev/null @@ -1,71 +0,0 @@ -import angular from 'angular'; -import _ from 'lodash'; -import $ from 'jquery'; -import coreModule from '../core_module'; - -export class InspectCtrl { - /** @ngInject */ - constructor($scope, $sanitize) { - const model = $scope.inspector; - - $scope.init = function() { - $scope.editor = { index: 0 }; - - if (!model.error) { - return; - } - - if (_.isString(model.error.data)) { - $scope.response = $('
' + model.error.data + '
').text(); - } else if (model.error.data) { - if (model.error.data.response) { - $scope.response = $sanitize(model.error.data.response); - } else { - $scope.response = angular.toJson(model.error.data, true); - } - } else if (model.error.message) { - $scope.message = model.error.message; - } - - if (model.error.config && model.error.config.params) { - $scope.request_parameters = _.map(model.error.config.params, (value, key) => { - return { key: key, value: value }; - }); - } - - if (model.error.stack) { - $scope.editor.index = 3; - $scope.stack_trace = model.error.stack; - $scope.message = model.error.message; - } - - if (model.error.config && model.error.config.data) { - $scope.editor.index = 2; - - if (_.isString(model.error.config.data)) { - $scope.request_parameters = this.getParametersFromQueryString(model.error.config.data); - } else { - $scope.request_parameters = _.map(model.error.config.data, (value, key) => { - return { key: key, value: angular.toJson(value, true) }; - }); - } - } - }; - } - getParametersFromQueryString(queryString) { - const result = []; - const parameters = queryString.split('&'); - for (let i = 0; i < parameters.length; i++) { - const keyValue = parameters[i].split('='); - if (keyValue[1].length > 0) { - result.push({ - key: keyValue[0], - value: (window as any).unescape(keyValue[1]), - }); - } - } - return result; - } -} - -coreModule.controller('InspectCtrl', InspectCtrl); diff --git a/public/app/features/dashboard/dashgrid/AddPanelPanel.tsx b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx similarity index 86% rename from public/app/features/dashboard/dashgrid/AddPanelPanel.tsx rename to public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx index 95d03152b14..4d46d88a1d2 100644 --- a/public/app/features/dashboard/dashgrid/AddPanelPanel.tsx +++ b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx @@ -1,23 +1,23 @@ 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 '../../panel_model'; +import { DashboardModel } from '../../dashboard_model'; import store from 'app/core/store'; import { LS_PANEL_COPY_KEY } from 'app/core/constants'; import { updateLocation } from 'app/core/actions'; import { store as reduxStore } from 'app/store/store'; -export interface AddPanelPanelProps { +export interface Props { panel: PanelModel; dashboard: DashboardModel; } -export interface AddPanelPanelState { +export interface State { copiedPanelPlugins: any[]; } -export class AddPanelPanel extends React.Component { +export class AddPanelWidget extends React.Component { constructor(props) { super(props); this.handleCloseAddPanel = this.handleCloseAddPanel.bind(this); @@ -133,15 +133,15 @@ export class AddPanelPanel extends React.Component -
-
+
+
+
-
-
+
diff --git a/public/sass/components/_panel_add_panel.scss b/public/app/features/dashboard/components/AddPanelWidget/_AddPanelWidget.scss similarity index 81% rename from public/sass/components/_panel_add_panel.scss rename to public/app/features/dashboard/components/AddPanelWidget/_AddPanelWidget.scss index 86921fb43f3..5a1cbee4b44 100644 --- a/public/sass/components/_panel_add_panel.scss +++ b/public/app/features/dashboard/components/AddPanelWidget/_AddPanelWidget.scss @@ -1,12 +1,12 @@ -.add-panel-container { +.add-panel-widget-container { height: 100%; } -.add-panel { +.add-panel-widget { height: 100%; } -.add-panel__header { +.add-panel-widget__header { top: 0; position: absolute; padding: 0 15px; @@ -26,7 +26,7 @@ } } -.add-panel__close { +.add-panel-widget__close { margin-left: auto; background-color: transparent; border: 0; @@ -34,7 +34,7 @@ margin-right: -10px; } -.add-panel-btn-container { +.add-panel-widget__btn-container { display: flex; justify-content: center; align-items: center; diff --git a/public/app/features/dashboard/components/AddPanelWidget/index.ts b/public/app/features/dashboard/components/AddPanelWidget/index.ts new file mode 100644 index 00000000000..b96948ab1c0 --- /dev/null +++ b/public/app/features/dashboard/components/AddPanelWidget/index.ts @@ -0,0 +1 @@ +export { AddPanelWidget } from './AddPanelWidget'; diff --git a/public/app/features/dashboard/dashgrid/RowOptions.ts b/public/app/features/dashboard/components/RowOptions/RowOptionsCtrl.ts similarity index 100% rename from public/app/features/dashboard/dashgrid/RowOptions.ts rename to public/app/features/dashboard/components/RowOptions/RowOptionsCtrl.ts diff --git a/public/app/features/dashboard/components/RowOptions/index.ts b/public/app/features/dashboard/components/RowOptions/index.ts new file mode 100644 index 00000000000..626e4cd65b3 --- /dev/null +++ b/public/app/features/dashboard/components/RowOptions/index.ts @@ -0,0 +1 @@ +export { RowOptionsCtrl } from './RowOptionsCtrl'; diff --git a/public/app/features/dashboard/partials/row_options.html b/public/app/features/dashboard/components/RowOptions/template.html similarity index 100% rename from public/app/features/dashboard/partials/row_options.html rename to public/app/features/dashboard/components/RowOptions/template.html diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index f0e97162d43..cfff64cb042 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -5,7 +5,7 @@ import classNames from 'classnames'; import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader'; import { importPluginModule } from 'app/features/plugins/plugin_loader'; -import { AddPanelPanel } from './AddPanelPanel'; +import { AddPanelWidget } from '../components/AddPanelWidget'; import { getPanelPluginNotFound } from './PanelPluginNotFound'; import { DashboardRow } from './DashboardRow'; import { PanelChrome } from './PanelChrome'; @@ -53,7 +53,7 @@ export class DashboardPanel extends PureComponent { } renderAddPanel() { - return ; + return ; } onPluginTypeChanged = (plugin: PanelPlugin) => { diff --git a/public/app/features/dashboard/index.ts b/public/app/features/dashboard/index.ts index 79831cd4015..b9173695362 100644 --- a/public/app/features/dashboard/index.ts +++ b/public/app/features/dashboard/index.ts @@ -2,7 +2,6 @@ import './dashboard_ctrl'; import './time_srv'; import './repeat_option/repeat_option'; import './dashgrid/DashboardGridDirective'; -import './dashgrid/RowOptions'; import './panellinks/module'; // Services @@ -25,6 +24,7 @@ import './components/UnsavedChangesModal'; import './components/SaveModals'; import './components/ShareModal'; import './components/AdHocFilters'; +import './components/RowOptions'; import DashboardPermissions from './components/DashboardPermissions/DashboardPermissions'; diff --git a/public/app/features/dashboard/partials/folder_permissions.html b/public/app/features/dashboard/partials/folder_permissions.html deleted file mode 100644 index be44c1051f2..00000000000 --- a/public/app/features/dashboard/partials/folder_permissions.html +++ /dev/null @@ -1,7 +0,0 @@ - - -
- -
diff --git a/public/app/features/dashboard/partials/folder_settings.html b/public/app/features/dashboard/partials/folder_settings.html deleted file mode 100644 index 8e819be5fe8..00000000000 --- a/public/app/features/dashboard/partials/folder_settings.html +++ /dev/null @@ -1,23 +0,0 @@ - - -
-

Folder Settings

- -
-
-
- - -
-
- - -
-
-
-
diff --git a/public/app/features/dashboard/partials/inspector.html b/public/app/features/dashboard/partials/inspector.html deleted file mode 100644 index b30bce3c5fe..00000000000 --- a/public/app/features/dashboard/partials/inspector.html +++ /dev/null @@ -1,82 +0,0 @@ - - diff --git a/public/app/features/manage-dashboards/CreateFolderCtrl.ts b/public/app/features/folders/CreateFolderCtrl.ts similarity index 96% rename from public/app/features/manage-dashboards/CreateFolderCtrl.ts rename to public/app/features/folders/CreateFolderCtrl.ts index 99b2e8d4853..db70c2a18a2 100644 --- a/public/app/features/manage-dashboards/CreateFolderCtrl.ts +++ b/public/app/features/folders/CreateFolderCtrl.ts @@ -1,7 +1,7 @@ import appEvents from 'app/core/app_events'; import locationUtil from 'app/core/utils/location_util'; -export class CreateFolderCtrl { +export default class CreateFolderCtrl { title = ''; navModel: any; titleTouched = false; @@ -38,3 +38,4 @@ export class CreateFolderCtrl { }); } } + diff --git a/public/app/features/manage-dashboards/FolderDashboardsCtrl.ts b/public/app/features/folders/FolderDashboardsCtrl.ts similarity index 93% rename from public/app/features/manage-dashboards/FolderDashboardsCtrl.ts rename to public/app/features/folders/FolderDashboardsCtrl.ts index 6241472432c..95ff355937b 100644 --- a/public/app/features/manage-dashboards/FolderDashboardsCtrl.ts +++ b/public/app/features/folders/FolderDashboardsCtrl.ts @@ -1,7 +1,7 @@ import { FolderPageLoader } from './services/FolderPageLoader'; import locationUtil from 'app/core/utils/location_util'; -export class FolderDashboardsCtrl { +export default class FolderDashboardsCtrl { navModel: any; folderId: number; uid: string; @@ -23,3 +23,4 @@ export class FolderDashboardsCtrl { } } } + diff --git a/public/app/features/dashboard/partials/create_folder.html b/public/app/features/folders/partials/create_folder.html similarity index 100% rename from public/app/features/dashboard/partials/create_folder.html rename to public/app/features/folders/partials/create_folder.html diff --git a/public/app/features/dashboard/partials/folder_dashboards.html b/public/app/features/folders/partials/folder_dashboards.html similarity index 100% rename from public/app/features/dashboard/partials/folder_dashboards.html rename to public/app/features/folders/partials/folder_dashboards.html diff --git a/public/app/features/manage-dashboards/services/FolderPageLoader.ts b/public/app/features/folders/services/FolderPageLoader.ts similarity index 100% rename from public/app/features/manage-dashboards/services/FolderPageLoader.ts rename to public/app/features/folders/services/FolderPageLoader.ts diff --git a/public/app/features/manage-dashboards/DashboardImportCtrl.ts b/public/app/features/manage-dashboards/DashboardImportCtrl.ts index 455fa682edd..d2c6584d13d 100644 --- a/public/app/features/manage-dashboards/DashboardImportCtrl.ts +++ b/public/app/features/manage-dashboards/DashboardImportCtrl.ts @@ -232,3 +232,5 @@ export class DashboardImportCtrl { this.gnetInfo = ''; } } + +export default DashboardImportCtrl; diff --git a/public/app/features/manage-dashboards/index.ts b/public/app/features/manage-dashboards/index.ts index c3830ee6546..9d7c2bbc811 100644 --- a/public/app/features/manage-dashboards/index.ts +++ b/public/app/features/manage-dashboards/index.ts @@ -8,14 +8,8 @@ export * from './components/UploadDashboard'; // Controllers 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); diff --git a/public/app/features/dashboard/partials/dashboard_import.html b/public/app/features/manage-dashboards/partials/dashboard_import.html similarity index 100% rename from public/app/features/dashboard/partials/dashboard_import.html rename to public/app/features/manage-dashboards/partials/dashboard_import.html diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index f68423315d7..2f1ef72cedd 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -290,17 +290,4 @@ export class PanelCtrl { html += '
'; return sanitize(html); } - - openInspector() { - const modalScope = this.$scope.$new(); - modalScope.panel = this.panel; - modalScope.dashboard = this.dashboard; - modalScope.panelInfoHtml = this.getInfoContent({ mode: 'inspector' }); - - modalScope.inspector = $.extend(true, {}, this.inspector); - this.publishAppEvent('show-modal', { - src: 'public/app/features/dashboard/partials/inspector.html', - scope: modalScope, - }); - } } diff --git a/public/app/features/panel/panel_directive.ts b/public/app/features/panel/panel_directive.ts index f503aa4386d..1fd0b129720 100644 --- a/public/app/features/panel/panel_directive.ts +++ b/public/app/features/panel/panel_directive.ts @@ -192,11 +192,6 @@ module.directive('grafanaPanel', ($rootScope, $document, $timeout) => { scope.$watchGroup(['ctrl.error', 'ctrl.panel.description'], updatePanelCornerInfo); scope.$watchCollection('ctrl.panel.links', updatePanelCornerInfo); - cornerInfoElem.on('click', () => { - infoDrop.close(); - scope.$apply(ctrl.openInspector.bind(ctrl)); - }); - elem.on('mouseenter', mouseEnter); elem.on('mouseleave', mouseLeave); diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index 8552d0510a9..e7381740435 100644 --- a/public/app/routes/routes.ts +++ b/public/app/routes/routes.ts @@ -10,6 +10,9 @@ import ApiKeys from 'app/features/api-keys/ApiKeysPage'; import PluginListPage from 'app/features/plugins/PluginListPage'; import FolderSettingsPage from 'app/features/folders/FolderSettingsPage'; import FolderPermissions from 'app/features/folders/FolderPermissions'; +import CreateFolderCtrl from 'app/features/folders/CreateFolderCtrl'; +import FolderDashboardsCtrl from 'app/features/folders/FolderDashboardsCtrl'; +import DashboardImportCtrl from 'app/features/manage-dashboards/DashboardImportCtrl'; import DataSourcesListPage from 'app/features/datasources/DataSourcesListPage'; import NewDataSourcePage from '../features/datasources/NewDataSourcePage'; import UsersListPage from 'app/features/users/UsersListPage'; @@ -66,8 +69,8 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { pageClass: 'page-dashboard', }) .when('/dashboard/import', { - templateUrl: 'public/app/features/dashboard/partials/dashboard_import.html', - controller: 'DashboardImportCtrl', + templateUrl: 'public/app/features/manage-dashboards/partials/dashboard_import.html', + controller: DashboardImportCtrl, controllerAs: 'ctrl', }) .when('/datasources', { @@ -100,8 +103,8 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { controllerAs: 'ctrl', }) .when('/dashboards/folder/new', { - templateUrl: 'public/app/features/dashboard/partials/create_folder.html', - controller: 'CreateFolderCtrl', + templateUrl: 'public/app/features/folders/partials/create_folder.html', + controller: CreateFolderCtrl, controllerAs: 'ctrl', }) .when('/dashboards/f/:uid/:slug/permissions', { @@ -117,8 +120,8 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { }, }) .when('/dashboards/f/:uid/:slug', { - templateUrl: 'public/app/features/dashboard/partials/folder_dashboards.html', - controller: 'FolderDashboardsCtrl', + templateUrl: 'public/app/features/folders/partials/folder_dashboards.html', + controller: FolderDashboardsCtrl, controllerAs: 'ctrl', }) .when('/dashboards/f/:uid', { diff --git a/public/sass/_grafana.scss b/public/sass/_grafana.scss index 9e74b343b2d..739ccb6c412 100644 --- a/public/sass/_grafana.scss +++ b/public/sass/_grafana.scss @@ -39,6 +39,7 @@ @import 'layout/page'; // COMPONENTS +@import '../app/features/dashboard/components/AddPanelWidget/AddPanelWidget'; @import 'components/scrollbar'; @import 'components/cards'; @import 'components/buttons'; @@ -58,7 +59,6 @@ @import 'components/panel_table'; @import 'components/panel_text'; @import 'components/panel_heatmap'; -@import 'components/panel_add_panel'; @import 'components/panel_logs'; @import 'components/settings_permissions'; @import 'components/tagsinput';