2022-04-22 21:33:13 +08:00
|
|
|
import { css } from '@emotion/css';
|
2020-11-25 18:24:06 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-12-15 19:18:40 +08:00
|
|
|
import { connect, ConnectedProps } from 'react-redux';
|
2020-10-27 18:18:37 +08:00
|
|
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
2020-11-26 22:14:57 +08:00
|
|
|
import { Subscription } from 'rxjs';
|
2020-10-27 18:18:37 +08:00
|
|
|
|
2022-09-12 21:45:14 +08:00
|
|
|
import { FieldConfigSource, GrafanaTheme2, NavModel, NavModelItem, PageLayoutType } from '@grafana/data';
|
2020-10-27 18:18:37 +08:00
|
|
|
import { selectors } from '@grafana/e2e-selectors';
|
2023-04-14 16:43:11 +08:00
|
|
|
import { locationService } from '@grafana/runtime';
|
2021-02-25 18:26:28 +08:00
|
|
|
import {
|
2022-09-12 21:45:14 +08:00
|
|
|
Button,
|
2021-02-25 18:26:28 +08:00
|
|
|
HorizontalGroup,
|
2021-05-07 23:09:06 +08:00
|
|
|
InlineSwitch,
|
2021-02-25 18:26:28 +08:00
|
|
|
ModalsController,
|
|
|
|
RadioButtonGroup,
|
|
|
|
stylesFactory,
|
2022-05-04 23:55:49 +08:00
|
|
|
Themeable2,
|
2021-02-25 18:26:28 +08:00
|
|
|
ToolbarButton,
|
2022-09-12 21:45:14 +08:00
|
|
|
ToolbarButtonRow,
|
2022-05-04 23:55:49 +08:00
|
|
|
withTheme2,
|
2023-11-07 00:15:52 +08:00
|
|
|
Stack,
|
2021-02-25 18:26:28 +08:00
|
|
|
} from '@grafana/ui';
|
2022-09-12 21:45:14 +08:00
|
|
|
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
|
|
|
|
import { Page } from 'app/core/components/Page/Page';
|
2022-04-22 21:33:13 +08:00
|
|
|
import { SplitPaneWrapper } from 'app/core/components/SplitPaneWrapper/SplitPaneWrapper';
|
2020-10-27 18:18:37 +08:00
|
|
|
import { appEvents } from 'app/core/core';
|
2020-04-02 19:56:20 +08:00
|
|
|
import { SubMenuItems } from 'app/features/dashboard/components/SubMenu/SubMenuItems';
|
2022-04-22 21:33:13 +08:00
|
|
|
import { SaveLibraryPanelModal } from 'app/features/library-panels/components/SaveLibraryPanelModal/SaveLibraryPanelModal';
|
|
|
|
import { PanelModelWithLibraryPanel } from 'app/features/library-panels/types';
|
|
|
|
import { getPanelStateForModel } from 'app/features/panel/state/selectors';
|
2020-10-27 18:18:37 +08:00
|
|
|
import { updateTimeZoneForSession } from 'app/features/profile/state/reducers';
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
import { StoreState } from 'app/types';
|
|
|
|
import { PanelOptionsChangedEvent, ShowModalReactEvent } from 'app/types/events';
|
2022-04-22 21:33:13 +08:00
|
|
|
|
|
|
|
import { notifyApp } from '../../../../core/actions';
|
2021-02-25 18:26:28 +08:00
|
|
|
import { UnlinkModal } from '../../../library-panels/components/UnlinkModal/UnlinkModal';
|
2021-03-02 23:37:36 +08:00
|
|
|
import { isPanelModelLibraryPanel } from '../../../library-panels/guard';
|
2022-02-18 13:06:04 +08:00
|
|
|
import { getVariablesByKey } from '../../../variables/state/selectors';
|
2022-04-22 21:33:13 +08:00
|
|
|
import { DashboardPanel } from '../../dashgrid/DashboardPanel';
|
|
|
|
import { DashboardModel, PanelModel } from '../../state';
|
|
|
|
import { DashNavTimeControls } from '../DashNav/DashNavTimeControls';
|
2022-05-03 00:29:22 +08:00
|
|
|
import { SaveDashboardDrawer } from '../SaveDashboard/SaveDashboardDrawer';
|
2022-04-22 21:33:13 +08:00
|
|
|
|
|
|
|
import { OptionsPane } from './OptionsPane';
|
|
|
|
import { PanelEditorTableView } from './PanelEditorTableView';
|
|
|
|
import { PanelEditorTabs } from './PanelEditorTabs';
|
|
|
|
import { VisualizationButton } from './VisualizationButton';
|
|
|
|
import { discardPanelChanges, initPanelEditor, updatePanelEditorUIState } from './state/actions';
|
2022-11-15 23:10:05 +08:00
|
|
|
import { PanelEditorUIState, toggleTableView } from './state/reducers';
|
2022-04-22 21:33:13 +08:00
|
|
|
import { getPanelEditorTabs } from './state/selectors';
|
|
|
|
import { DisplayMode, displayModes, PanelEditorTab } from './types';
|
|
|
|
import { calculatePanelSize } from './utils';
|
2019-12-16 16:18:48 +08:00
|
|
|
|
2020-02-11 21:57:16 +08:00
|
|
|
interface OwnProps {
|
2019-12-16 16:18:48 +08:00
|
|
|
dashboard: DashboardModel;
|
2020-02-09 01:29:09 +08:00
|
|
|
sourcePanel: PanelModel;
|
2022-09-12 21:45:14 +08:00
|
|
|
sectionNav: NavModel;
|
|
|
|
pageNav: NavModelItem;
|
|
|
|
className?: string;
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
tab?: string;
|
2019-12-16 16:18:48 +08:00
|
|
|
}
|
|
|
|
|
2022-02-18 13:06:04 +08:00
|
|
|
const mapStateToProps = (state: StoreState, ownProps: OwnProps) => {
|
2020-12-15 19:18:40 +08:00
|
|
|
const panel = state.panelEditor.getPanel();
|
2021-10-13 14:53:36 +08:00
|
|
|
const panelState = getPanelStateForModel(state, panel);
|
2019-12-16 16:18:48 +08:00
|
|
|
|
2020-12-15 19:18:40 +08:00
|
|
|
return {
|
|
|
|
panel,
|
2021-10-13 14:53:36 +08:00
|
|
|
plugin: panelState?.plugin,
|
|
|
|
instanceState: panelState?.instanceState,
|
2020-12-15 19:18:40 +08:00
|
|
|
initDone: state.panelEditor.initDone,
|
|
|
|
uiState: state.panelEditor.ui,
|
2021-05-07 23:09:06 +08:00
|
|
|
tableViewEnabled: state.panelEditor.tableViewEnabled,
|
2022-02-18 13:06:04 +08:00
|
|
|
variables: getVariablesByKey(ownProps.dashboard.uid, state),
|
2020-12-15 19:18:40 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
initPanelEditor,
|
2021-03-25 21:11:09 +08:00
|
|
|
discardPanelChanges,
|
2020-12-15 19:18:40 +08:00
|
|
|
updatePanelEditorUIState,
|
|
|
|
updateTimeZoneForSession,
|
2021-05-07 23:09:06 +08:00
|
|
|
toggleTableView,
|
2021-03-02 23:37:36 +08:00
|
|
|
notifyApp,
|
2020-12-15 19:18:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
2020-02-09 01:29:09 +08:00
|
|
|
|
2022-05-04 23:55:49 +08:00
|
|
|
type Props = OwnProps & ConnectedProps<typeof connector> & Themeable2;
|
2020-02-10 01:48:14 +08:00
|
|
|
|
2021-06-02 18:24:19 +08:00
|
|
|
interface State {
|
|
|
|
showSaveLibraryPanelModal?: boolean;
|
|
|
|
}
|
|
|
|
|
2020-02-11 21:57:16 +08:00
|
|
|
export class PanelEditorUnconnected extends PureComponent<Props> {
|
2020-11-26 22:14:57 +08:00
|
|
|
private eventSubs?: Subscription;
|
2020-02-10 01:48:14 +08:00
|
|
|
|
2021-06-02 18:24:19 +08:00
|
|
|
state: State = {
|
|
|
|
showSaveLibraryPanelModal: false,
|
|
|
|
};
|
|
|
|
|
2020-02-11 21:57:16 +08:00
|
|
|
componentDidMount() {
|
|
|
|
this.props.initPanelEditor(this.props.sourcePanel, this.props.dashboard);
|
2020-02-08 20:23:16 +08:00
|
|
|
}
|
2020-11-26 22:14:57 +08:00
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
const { panel, initDone } = this.props;
|
|
|
|
|
|
|
|
if (initDone && !this.eventSubs) {
|
|
|
|
this.eventSubs = new Subscription();
|
|
|
|
this.eventSubs.add(panel.events.subscribe(PanelOptionsChangedEvent, this.triggerForceUpdate));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-08 20:23:16 +08:00
|
|
|
componentWillUnmount() {
|
2021-07-08 00:39:45 +08:00
|
|
|
// redux action exitPanelEditor is called on location change from DashboardPrompt
|
2020-11-26 22:14:57 +08:00
|
|
|
this.eventSubs?.unsubscribe();
|
2020-02-07 21:59:04 +08:00
|
|
|
}
|
2019-12-16 16:18:48 +08:00
|
|
|
|
2020-11-26 22:14:57 +08:00
|
|
|
triggerForceUpdate = () => {
|
|
|
|
this.forceUpdate();
|
|
|
|
};
|
|
|
|
|
2021-03-25 21:11:09 +08:00
|
|
|
onBack = () => {
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
locationService.partial({
|
|
|
|
editPanel: null,
|
|
|
|
tab: null,
|
2021-11-02 15:33:36 +08:00
|
|
|
showCategory: null,
|
2020-02-07 21:59:04 +08:00
|
|
|
});
|
|
|
|
};
|
2019-12-16 16:18:48 +08:00
|
|
|
|
2021-03-25 21:11:09 +08:00
|
|
|
onDiscard = () => {
|
|
|
|
this.props.discardPanelChanges();
|
|
|
|
this.onBack();
|
|
|
|
};
|
|
|
|
|
2020-04-19 00:00:54 +08:00
|
|
|
onSaveDashboard = () => {
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
appEvents.publish(
|
|
|
|
new ShowModalReactEvent({
|
2022-05-03 00:29:22 +08:00
|
|
|
component: SaveDashboardDrawer,
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
props: { dashboard: this.props.dashboard },
|
|
|
|
})
|
|
|
|
);
|
2020-04-19 00:00:54 +08:00
|
|
|
};
|
|
|
|
|
2021-03-02 23:37:36 +08:00
|
|
|
onSaveLibraryPanel = async () => {
|
|
|
|
if (!isPanelModelLibraryPanel(this.props.panel)) {
|
2021-02-25 18:26:28 +08:00
|
|
|
// New library panel, no need to display modal
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-02 18:24:19 +08:00
|
|
|
this.setState({ showSaveLibraryPanelModal: true });
|
2021-02-25 18:26:28 +08:00
|
|
|
};
|
|
|
|
|
2020-02-12 17:42:57 +08:00
|
|
|
onChangeTab = (tab: PanelEditorTab) => {
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
locationService.partial({
|
|
|
|
tab: tab.id,
|
|
|
|
});
|
2020-02-12 17:42:57 +08:00
|
|
|
};
|
|
|
|
|
2020-03-19 18:50:31 +08:00
|
|
|
onFieldConfigChange = (config: FieldConfigSource) => {
|
2020-12-17 20:30:55 +08:00
|
|
|
// we do not need to trigger force update here as the function call below
|
|
|
|
// fires PanelOptionsChangedEvent which we subscribe to above
|
|
|
|
this.props.panel.updateFieldConfig({
|
2020-03-19 18:50:31 +08:00
|
|
|
...config,
|
2020-02-09 01:29:09 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2023-03-14 17:51:44 +08:00
|
|
|
onPanelOptionsChanged = (options: PanelModel['options']) => {
|
2020-11-26 22:14:57 +08:00
|
|
|
// we do not need to trigger force update here as the function call below
|
|
|
|
// fires PanelOptionsChangedEvent which we subscribe to above
|
2020-02-11 21:57:16 +08:00
|
|
|
this.props.panel.updateOptions(options);
|
2020-02-09 01:29:09 +08:00
|
|
|
};
|
|
|
|
|
2023-03-14 17:51:44 +08:00
|
|
|
onPanelConfigChanged = (configKey: keyof PanelModel, value: unknown) => {
|
2021-03-03 22:16:54 +08:00
|
|
|
this.props.panel.setProperty(configKey, value);
|
2020-03-20 22:15:04 +08:00
|
|
|
this.props.panel.render();
|
|
|
|
this.forceUpdate();
|
|
|
|
};
|
2020-02-09 01:29:09 +08:00
|
|
|
|
2021-02-25 18:26:28 +08:00
|
|
|
onDisplayModeChange = (mode?: DisplayMode) => {
|
2020-02-16 03:31:11 +08:00
|
|
|
const { updatePanelEditorUIState } = this.props;
|
2021-05-10 13:19:52 +08:00
|
|
|
if (this.props.tableViewEnabled) {
|
|
|
|
this.props.toggleTableView();
|
|
|
|
}
|
2020-02-16 03:31:11 +08:00
|
|
|
updatePanelEditorUIState({
|
2020-04-04 20:25:06 +08:00
|
|
|
mode: mode,
|
2020-02-16 03:31:11 +08:00
|
|
|
});
|
2020-02-09 22:39:46 +08:00
|
|
|
};
|
|
|
|
|
2021-05-07 23:09:06 +08:00
|
|
|
onToggleTableView = () => {
|
|
|
|
this.props.toggleTableView();
|
|
|
|
};
|
|
|
|
|
2021-10-25 19:55:06 +08:00
|
|
|
renderPanel(styles: EditorStyles, isOnlyPanel: boolean) {
|
2022-05-04 23:55:49 +08:00
|
|
|
const { dashboard, panel, uiState, tableViewEnabled, theme } = this.props;
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
|
2020-04-24 02:36:42 +08:00
|
|
|
return (
|
2021-07-07 00:01:13 +08:00
|
|
|
<div className={styles.mainPaneWrapper} key="panel">
|
2020-04-24 02:36:42 +08:00
|
|
|
{this.renderPanelToolbar(styles)}
|
|
|
|
<div className={styles.panelWrapper}>
|
|
|
|
<AutoSizer>
|
|
|
|
{({ width, height }) => {
|
|
|
|
if (width < 3 || height < 3) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-05-07 23:09:06 +08:00
|
|
|
|
2021-07-07 00:01:13 +08:00
|
|
|
// If no tabs limit height so panel does not extend to edge
|
2021-10-25 19:55:06 +08:00
|
|
|
if (isOnlyPanel) {
|
2022-05-04 23:55:49 +08:00
|
|
|
height -= theme.spacing.gridSize * 2;
|
2021-07-07 00:01:13 +08:00
|
|
|
}
|
|
|
|
|
2021-05-07 23:09:06 +08:00
|
|
|
if (tableViewEnabled) {
|
2021-06-01 19:52:08 +08:00
|
|
|
return <PanelEditorTableView width={width} height={height} panel={panel} dashboard={dashboard} />;
|
2021-05-07 23:09:06 +08:00
|
|
|
}
|
|
|
|
|
2021-08-16 23:01:54 +08:00
|
|
|
const panelSize = calculatePanelSize(uiState.mode, width, height, panel);
|
|
|
|
|
2020-04-24 02:36:42 +08:00
|
|
|
return (
|
|
|
|
<div className={styles.centeringContainer} style={{ width, height }}>
|
2021-10-13 14:53:36 +08:00
|
|
|
<div style={panelSize} data-panelid={panel.id}>
|
2020-04-24 02:36:42 +08:00
|
|
|
<DashboardPanel
|
2021-10-13 14:53:36 +08:00
|
|
|
key={panel.key}
|
|
|
|
stateKey={panel.key}
|
2020-04-24 02:36:42 +08:00
|
|
|
dashboard={dashboard}
|
|
|
|
panel={panel}
|
|
|
|
isEditing={true}
|
|
|
|
isViewing={false}
|
2021-12-13 20:42:33 +08:00
|
|
|
lazy={false}
|
2021-08-16 23:01:54 +08:00
|
|
|
width={panelSize.width}
|
|
|
|
height={panelSize.height}
|
2020-04-24 02:36:42 +08:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</AutoSizer>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2021-07-07 00:01:13 +08:00
|
|
|
}
|
2020-09-28 15:06:46 +08:00
|
|
|
|
2022-12-07 01:21:03 +08:00
|
|
|
renderPanelAndEditor(uiState: PanelEditorUIState, styles: EditorStyles) {
|
Routing NG: Replace Angular routing with react-router (#31463)
* Add router packages
* Get react app root work instead of Angular one
* Logger util
* Patch Angular routing ($routeProvider, $routeParamsProvider)
* Use react-router-dom history instead of separate dependency
* Add test routes
* Sidemenu - use Link instead of anchors
* Patch Angular $location service (stub)
* WIP: geting rid of $location provider from TimeSrv
* Intercept anchor clicks to use history under the hood
* Sync Redux location slice with history state
* Make login/logout work
* Debug routes for testing
* Make force login work
* Make sure query param change does not recreate page components
* Hide side menu in specified locations
* Make the dashboar route query parameters work, make panel edit menu work
* Enable more routes
* Fix side menu
* Handle view modes
* Disable playlist routes
* Make SafeDynamicImport work again
* Bring back router-debug
* Separate redux location sync from route rendering
* Refactor updateLocation to thunk and move force refresh(login) to it
* Fixing init dashboard issue
* Support switching between dashboards without an unmount of DashboardPage
* More fixes for init dashboard and panel edit
* More type fixes
* Moving angular location wrapper out of main LocationService, and fixing typescript issues
* Fixed last typescript errors
* LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523)
* Moving location service implementation to runtime and removing get function and making it a package const singleton
* Added test that used locationService directly
* removed unused import
* AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525)
* Fixes angular panels by calling the monkey patch
* Moving angular stuff to to it's own files
* udpated
* Fixing clicking on divs and spans inside anchor
* Moving app notifications out of angular app and removing angular directive wrapper
* Moving search from angular to react and removing angular search wrapper
* Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back
* Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back)
* Open and close search now works
* Hide sidemenu when in kiosk mode
* Restoring some keybindings like ESC key
* Removed kiosk events and simplified it, just handled through updating URL
* Fixing typescript errors
* Simplified GrafanaRouteComponentProps and renamed to ContainerProps
* renamed back
* Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it
* Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change
* SafeDynamicImport causing unmount un every search update, not sure how to fix yet
* Fix signature for SafeDynamicImport so we do not create new route components on every route render
* Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc
* Updating DashboardPage and SoloPanelPage to use match params and history location
* Fixed DashboardPage tests
* Fixing solo route tests
* LocationService: Rename getCurrentLocation to just getLocation
* do not intercept link clicks with target blank or self
* Experimental useUrlParams hook
* Update DataSourceSettingsPage to use router match params
* fix links with urls that have no starting / to work like before
* Fix forceLogin
* Add queryParams to GrafanaRouteComponentProps
* PanelEditor get rid of updateLocation and location state
* Improve grafana route query params typing
* Add getSearchObject to LocationService
* Use DashboardPAge queryParams instead of location.search parsing
* Fix DashboardPage typing
* Fix some tests weirdness
* Bring back KeyboardSrv
* Fixes typescript issues
* Team pages now use router match params
* Get rid of from GrafanaRouteComponent props
* Removed unnessary calls to getSearchObject when calling locationService.partial
* Updated DashboardPage tests after queryParams was added
* Fixing dashboard settings back
* GrafanaRoute: Adding tests and remove use of global locationService
* Fixing tests and typescript errors
* Bring back kiosk modes and add tests
* Fix TimeSrv tests
* Fix typecheck errors
* Fixing tests
* Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory
* Get rid of routeChange event from TimeSrv from
* Fixed TopSectionItem test
* Trying to make basename work but failing
* Update TopSectionItem snapshot
* Fix TopSectionItem snapshot test
* Fix API keys creation
* Remove Angular dependencies from KeybindingSrv (#31617)
* Remove Angular dependency from KeybindingsSrv
* Fix tests and typecheck issues
* basename is starting to work
* Make dashboard save work
* KeybindingSrv: Remove as angular service and no usage angular scope
* So long bridge_srv, we won't miss you
* Update snapshots
* Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653)
* Dashboard: Refactoring ChangeTracker to use History api and no angular
* Updated
* Removed logging
* fixed unit tests
* updated snapshots
* Mechanism for force reloading routes (#31683)
* e2e: Fixes various things in e2e scenarios after router migration (#31685)
* Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688)
* RoutingNG: Initial explore redux location to router location migration
* Updated explore Wrapper tests
* Fixing more tests
* remove loggin
* rename back to make naming consistent
* Fixing return to dashboard button
* fixing navigation to explore from dashboard
* updated routeProps
* Updated tests
* Make DashboardListPage work
* Fixing navigation after add new data source, and fixes explore e2e
* Fixing solo panel page
* PluginsPage now works
* RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725)
* RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays
* Fixed test
* Make snapshots list work
* fixed alert notification channel edit page
* Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that
* fixed UserAdminPage
* fixed edit orgs page
* Fixing LdapPage
* fixing dashboard import
* Fixed new folder page
* Fixed data source dashboards page
* fixing Folder permissions and folder settings page
* fixing snapshot list page nav model
* remove unused file
* Added placeholder page for playlist
* Moved browser compatability to index-template
* Restored 404/default page
* Fixed reset password page
* Fixed SignUpInvited page
* Fixing CreateTeam, Create user page, add panel widget
* Restore browwser file to make tests happy
* Fixed unit tests
* Removed unused import
* Replacing usage of updateLocation
* Fixed test
* Updating search filters to use history / location service for filters
* remove unused file
* AppRootPage fixed
* Fixing test and search issue
* Changes to support enterprise extensions
* remove console.log
* Removing more use of redux location
* Fixed signup page
* removed unused old angular controllers
* Fixing bugs
* one final bugfix
* Removed location from redux state
* Fixing ts issues and tests
* Fixing test issue
* fixing tests
* Fixing tests
* removed unused stuff
* Fixed search test
* Adding some doc comments
* Routing NG: Angular location provider patch (#31773)
* Patch Angulars $location provider
* Update public/app/angular/bridgeReactAngularRouting.ts
* Remove only test
* Update tests, disable loggers in test env
* Routing NG: remove $location provider usage (#31816)
* Remove dashboard_loaders
* Remove $location from Analytics service, track page views form GrafanaRoute
* Remove NotificationsEditCtrl
* Remove Angular dependencies from uploadDashboardDirective
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/features/dashboard/containers/DashboardPage.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove unused test helpers (#31831)
* Playlist react (#31829)
* playlist list in react
* Playlist start
* Things started to work
* Updated
* Handle empty list
* Fix ts
* Fixes and kiosk mode stuff
* Removed unused events
* fixing ts issue
* Another ts issue
* Fixing tests
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
* fixed test
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Update public/app/AppWrapper.tsx
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
* Remove Angular dependency from DashboardLoaderSrv (#31863)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-11 01:03:36 +08:00
|
|
|
const { panel, dashboard, plugin, tab } = this.props;
|
|
|
|
const tabs = getPanelEditorTabs(tab, plugin);
|
2021-10-25 19:55:06 +08:00
|
|
|
const isOnlyPanel = tabs.length === 0;
|
|
|
|
const panelPane = this.renderPanel(styles, isOnlyPanel);
|
2020-11-25 18:24:06 +08:00
|
|
|
|
2021-10-25 19:55:06 +08:00
|
|
|
if (tabs.length === 0) {
|
2022-12-07 01:21:03 +08:00
|
|
|
return <div className={styles.onlyPanel}>{panelPane}</div>;
|
2020-11-25 18:24:06 +08:00
|
|
|
}
|
2021-07-07 00:01:13 +08:00
|
|
|
|
2022-12-07 01:21:03 +08:00
|
|
|
return (
|
|
|
|
<SplitPaneWrapper
|
|
|
|
splitOrientation="horizontal"
|
|
|
|
maxSize={-200}
|
|
|
|
paneSize={uiState.topPaneSize}
|
|
|
|
primary="first"
|
|
|
|
secondaryPaneStyle={{ minHeight: 0 }}
|
|
|
|
onDragFinished={(size) => {
|
|
|
|
if (size) {
|
|
|
|
updatePanelEditorUIState({ topPaneSize: size / window.innerHeight });
|
|
|
|
}
|
|
|
|
}}
|
2021-10-25 19:55:06 +08:00
|
|
|
>
|
2022-12-07 01:21:03 +08:00
|
|
|
{panelPane}
|
|
|
|
<div
|
|
|
|
className={styles.tabsWrapper}
|
|
|
|
aria-label={selectors.components.PanelEditor.DataPane.content}
|
|
|
|
key="panel-editor-tabs"
|
|
|
|
>
|
|
|
|
<PanelEditorTabs
|
|
|
|
key={panel.key}
|
|
|
|
panel={panel}
|
|
|
|
dashboard={dashboard}
|
|
|
|
tabs={tabs}
|
|
|
|
onChangeTab={this.onChangeTab}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</SplitPaneWrapper>
|
|
|
|
);
|
2020-02-09 17:50:58 +08:00
|
|
|
}
|
|
|
|
|
2020-04-02 19:56:20 +08:00
|
|
|
renderTemplateVariables(styles: EditorStyles) {
|
|
|
|
const { variables } = this.props;
|
|
|
|
|
|
|
|
if (!variables.length) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.variablesWrapper}>
|
|
|
|
<SubMenuItems variables={variables} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-04 20:25:06 +08:00
|
|
|
renderPanelToolbar(styles: EditorStyles) {
|
2021-05-07 23:09:06 +08:00
|
|
|
const { dashboard, uiState, variables, updateTimeZoneForSession, panel, tableViewEnabled } = this.props;
|
|
|
|
|
2020-02-26 00:58:20 +08:00
|
|
|
return (
|
2020-04-04 20:25:06 +08:00
|
|
|
<div className={styles.panelToolbar}>
|
2020-04-25 13:55:42 +08:00
|
|
|
<HorizontalGroup justify={variables.length > 0 ? 'space-between' : 'flex-end'} align="flex-start">
|
|
|
|
{this.renderTemplateVariables(styles)}
|
2022-09-12 21:45:14 +08:00
|
|
|
<Stack gap={1}>
|
2021-05-07 23:09:06 +08:00
|
|
|
<InlineSwitch
|
|
|
|
label="Table view"
|
|
|
|
showLabel={true}
|
|
|
|
id="table-view"
|
|
|
|
value={tableViewEnabled}
|
|
|
|
onClick={this.onToggleTableView}
|
|
|
|
aria-label={selectors.components.PanelEditor.toggleTableView}
|
|
|
|
/>
|
2020-09-28 15:06:46 +08:00
|
|
|
<RadioButtonGroup value={uiState.mode} options={displayModes} onChange={this.onDisplayModeChange} />
|
2022-09-12 21:45:14 +08:00
|
|
|
<DashNavTimeControls dashboard={dashboard} onChangeTimeZone={updateTimeZoneForSession} isOnCanvas={true} />
|
2021-03-25 15:33:13 +08:00
|
|
|
{!uiState.isPanelOptionsVisible && <VisualizationButton panel={panel} />}
|
2022-09-12 21:45:14 +08:00
|
|
|
</Stack>
|
2020-04-25 13:55:42 +08:00
|
|
|
</HorizontalGroup>
|
2020-04-04 20:25:06 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-12-11 21:49:14 +08:00
|
|
|
renderEditorActions() {
|
2023-04-14 16:43:11 +08:00
|
|
|
const size = 'sm';
|
2021-02-25 18:26:28 +08:00
|
|
|
let editorActions = [
|
2022-09-12 21:45:14 +08:00
|
|
|
<Button
|
|
|
|
onClick={this.onDiscard}
|
|
|
|
title="Undo all changes"
|
|
|
|
key="discard"
|
|
|
|
size={size}
|
|
|
|
variant="destructive"
|
|
|
|
fill="outline"
|
|
|
|
>
|
2020-12-11 21:49:14 +08:00
|
|
|
Discard
|
2022-09-12 21:45:14 +08:00
|
|
|
</Button>,
|
2021-02-25 18:26:28 +08:00
|
|
|
this.props.panel.libraryPanel ? (
|
2022-09-12 21:45:14 +08:00
|
|
|
<Button
|
2021-03-02 23:37:36 +08:00
|
|
|
onClick={this.onSaveLibraryPanel}
|
2021-02-25 18:26:28 +08:00
|
|
|
variant="primary"
|
2022-09-12 21:45:14 +08:00
|
|
|
size={size}
|
|
|
|
title="Apply changes and save library panel"
|
2021-02-25 18:26:28 +08:00
|
|
|
key="save-panel"
|
|
|
|
>
|
|
|
|
Save library panel
|
2022-09-12 21:45:14 +08:00
|
|
|
</Button>
|
2021-02-25 18:26:28 +08:00
|
|
|
) : (
|
2022-09-12 21:45:14 +08:00
|
|
|
<Button
|
|
|
|
onClick={this.onSaveDashboard}
|
|
|
|
title="Apply changes and save dashboard"
|
|
|
|
key="save"
|
|
|
|
size={size}
|
|
|
|
variant="secondary"
|
|
|
|
>
|
2021-02-25 18:26:28 +08:00
|
|
|
Save
|
2022-09-12 21:45:14 +08:00
|
|
|
</Button>
|
2021-02-25 18:26:28 +08:00
|
|
|
),
|
2022-09-12 21:45:14 +08:00
|
|
|
<Button
|
2021-05-05 19:19:14 +08:00
|
|
|
onClick={this.onBack}
|
|
|
|
variant="primary"
|
2022-09-12 21:45:14 +08:00
|
|
|
title="Apply changes and go back to dashboard"
|
|
|
|
data-testid={selectors.components.PanelEditor.applyButton}
|
2021-05-05 19:19:14 +08:00
|
|
|
key="apply"
|
2022-09-12 21:45:14 +08:00
|
|
|
size={size}
|
2021-05-05 19:19:14 +08:00
|
|
|
>
|
2020-12-11 21:49:14 +08:00
|
|
|
Apply
|
2022-09-12 21:45:14 +08:00
|
|
|
</Button>,
|
2020-12-11 21:49:14 +08:00
|
|
|
];
|
2021-02-25 18:26:28 +08:00
|
|
|
|
|
|
|
if (this.props.panel.libraryPanel) {
|
|
|
|
editorActions.splice(
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
<ModalsController key="unlink-controller">
|
|
|
|
{({ showModal, hideModal }) => {
|
|
|
|
return (
|
|
|
|
<ToolbarButton
|
|
|
|
onClick={() => {
|
|
|
|
showModal(UnlinkModal, {
|
|
|
|
onConfirm: () => {
|
2022-11-02 18:38:48 +08:00
|
|
|
this.props.panel.unlinkLibraryPanel();
|
2021-02-25 18:26:28 +08:00
|
|
|
this.forceUpdate();
|
|
|
|
},
|
|
|
|
onDismiss: hideModal,
|
|
|
|
isOpen: true,
|
|
|
|
});
|
|
|
|
}}
|
2021-05-04 16:00:44 +08:00
|
|
|
title="Disconnects this panel from the library panel so that you can edit it regularly."
|
2021-02-25 18:26:28 +08:00
|
|
|
key="unlink"
|
|
|
|
>
|
|
|
|
Unlink
|
|
|
|
</ToolbarButton>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</ModalsController>
|
|
|
|
);
|
|
|
|
|
|
|
|
// Remove "Apply" button
|
|
|
|
editorActions.pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
return editorActions;
|
2020-02-26 00:58:20 +08:00
|
|
|
}
|
|
|
|
|
2020-11-25 18:24:06 +08:00
|
|
|
renderOptionsPane() {
|
2021-10-01 17:08:11 +08:00
|
|
|
const { plugin, dashboard, panel, instanceState } = this.props;
|
2020-03-20 22:15:04 +08:00
|
|
|
|
|
|
|
if (!plugin) {
|
2020-03-29 06:11:50 +08:00
|
|
|
return <div />;
|
2020-03-20 22:15:04 +08:00
|
|
|
}
|
2020-02-28 18:04:40 +08:00
|
|
|
|
2020-02-26 00:58:20 +08:00
|
|
|
return (
|
2021-03-25 15:33:13 +08:00
|
|
|
<OptionsPane
|
2020-03-20 22:15:04 +08:00
|
|
|
plugin={plugin}
|
|
|
|
dashboard={dashboard}
|
|
|
|
panel={panel}
|
2021-10-01 17:08:11 +08:00
|
|
|
instanceState={instanceState}
|
2020-03-20 22:15:04 +08:00
|
|
|
onFieldConfigsChange={this.onFieldConfigChange}
|
|
|
|
onPanelOptionsChanged={this.onPanelOptionsChanged}
|
|
|
|
onPanelConfigChange={this.onPanelConfigChanged}
|
|
|
|
/>
|
2020-02-26 00:58:20 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-02 18:24:19 +08:00
|
|
|
onGoBackToDashboard = () => {
|
2021-11-02 15:33:36 +08:00
|
|
|
locationService.partial({ editPanel: null, tab: null, showCategory: null });
|
2021-06-02 18:24:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
onConfirmAndDismissLibarayPanelModel = () => {
|
|
|
|
this.setState({ showSaveLibraryPanelModal: false });
|
|
|
|
};
|
|
|
|
|
2019-12-16 16:18:48 +08:00
|
|
|
render() {
|
2022-11-15 23:10:05 +08:00
|
|
|
const { initDone, uiState, theme, sectionNav, pageNav, className, updatePanelEditorUIState } = this.props;
|
2022-05-04 23:55:49 +08:00
|
|
|
const styles = getStyles(theme, this.props);
|
2019-12-16 16:18:48 +08:00
|
|
|
|
2020-02-11 21:57:16 +08:00
|
|
|
if (!initDone) {
|
2019-12-16 16:18:48 +08:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-09-12 21:45:14 +08:00
|
|
|
<Page
|
|
|
|
navModel={sectionNav}
|
|
|
|
pageNav={pageNav}
|
|
|
|
aria-label={selectors.components.PanelEditor.General.content}
|
|
|
|
layout={PageLayoutType.Custom}
|
|
|
|
className={className}
|
|
|
|
>
|
2023-05-03 22:07:43 +08:00
|
|
|
<AppChromeUpdate
|
|
|
|
actions={<ToolbarButtonRow alignment="right">{this.renderEditorActions()}</ToolbarButtonRow>}
|
|
|
|
/>
|
2022-09-12 21:45:14 +08:00
|
|
|
<div className={styles.wrapper}>
|
|
|
|
<div className={styles.verticalSplitPanesWrapper}>
|
2022-11-15 23:10:05 +08:00
|
|
|
{!uiState.isPanelOptionsVisible ? (
|
2022-12-07 01:21:03 +08:00
|
|
|
this.renderPanelAndEditor(uiState, styles)
|
2022-11-15 23:10:05 +08:00
|
|
|
) : (
|
|
|
|
<SplitPaneWrapper
|
|
|
|
splitOrientation="vertical"
|
|
|
|
maxSize={-300}
|
|
|
|
paneSize={uiState.rightPaneSize}
|
|
|
|
primary="second"
|
|
|
|
onDragFinished={(size) => {
|
|
|
|
if (size) {
|
|
|
|
updatePanelEditorUIState({ rightPaneSize: size / window.innerWidth });
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
>
|
2022-12-07 01:21:03 +08:00
|
|
|
{this.renderPanelAndEditor(uiState, styles)}
|
2022-11-15 23:10:05 +08:00
|
|
|
{this.renderOptionsPane()}
|
|
|
|
</SplitPaneWrapper>
|
|
|
|
)}
|
2022-09-12 21:45:14 +08:00
|
|
|
</div>
|
|
|
|
{this.state.showSaveLibraryPanelModal && (
|
|
|
|
<SaveLibraryPanelModal
|
|
|
|
panel={this.props.panel as PanelModelWithLibraryPanel}
|
2022-11-17 16:22:57 +08:00
|
|
|
folderUid={this.props.dashboard.meta.folderUid ?? ''}
|
2022-09-12 21:45:14 +08:00
|
|
|
onConfirm={this.onConfirmAndDismissLibarayPanelModel}
|
|
|
|
onDiscard={this.onDiscard}
|
|
|
|
onDismiss={this.onConfirmAndDismissLibarayPanelModel}
|
|
|
|
/>
|
|
|
|
)}
|
2020-02-09 02:31:17 +08:00
|
|
|
</div>
|
2022-09-12 21:45:14 +08:00
|
|
|
</Page>
|
2019-12-16 16:18:48 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-02-07 21:59:04 +08:00
|
|
|
|
2022-05-04 23:55:49 +08:00
|
|
|
export const PanelEditor = withTheme2(connector(PanelEditorUnconnected));
|
2020-02-11 21:57:16 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Styles
|
|
|
|
*/
|
2022-05-04 23:55:49 +08:00
|
|
|
export const getStyles = stylesFactory((theme: GrafanaTheme2, props: Props) => {
|
2020-03-30 20:39:18 +08:00
|
|
|
const { uiState } = props;
|
2022-05-04 23:55:49 +08:00
|
|
|
const paneSpacing = theme.spacing(2);
|
2020-02-11 21:57:16 +08:00
|
|
|
|
|
|
|
return {
|
2022-09-12 21:45:14 +08:00
|
|
|
wrapper: css({
|
|
|
|
width: '100%',
|
|
|
|
flexGrow: 1,
|
|
|
|
minHeight: 0,
|
|
|
|
display: 'flex',
|
2023-04-14 16:43:11 +08:00
|
|
|
paddingTop: theme.spacing(2),
|
2022-09-12 21:45:14 +08:00
|
|
|
}),
|
2020-04-04 20:25:06 +08:00
|
|
|
verticalSplitPanesWrapper: css`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
position: relative;
|
|
|
|
`,
|
2020-03-30 20:39:18 +08:00
|
|
|
mainPaneWrapper: css`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
height: 100%;
|
2020-02-26 00:58:20 +08:00
|
|
|
width: 100%;
|
2020-04-24 02:36:42 +08:00
|
|
|
padding-right: ${uiState.isPanelOptionsVisible ? 0 : paneSpacing};
|
|
|
|
`,
|
2020-04-02 19:56:20 +08:00
|
|
|
variablesWrapper: css`
|
2020-04-25 13:55:42 +08:00
|
|
|
label: variablesWrapper;
|
2020-04-04 20:25:06 +08:00
|
|
|
display: flex;
|
2020-04-25 13:55:42 +08:00
|
|
|
flex-grow: 1;
|
|
|
|
flex-wrap: wrap;
|
2022-05-05 16:42:39 +08:00
|
|
|
gap: ${theme.spacing(1, 2)};
|
2020-04-02 19:56:20 +08:00
|
|
|
`,
|
2020-02-11 21:57:16 +08:00
|
|
|
panelWrapper: css`
|
2020-03-30 20:39:18 +08:00
|
|
|
flex: 1 1 0;
|
|
|
|
min-height: 0;
|
2020-02-11 21:57:16 +08:00
|
|
|
width: 100%;
|
2020-04-24 02:36:42 +08:00
|
|
|
padding-left: ${paneSpacing};
|
2020-02-11 21:57:16 +08:00
|
|
|
`,
|
2020-02-26 00:58:20 +08:00
|
|
|
tabsWrapper: css`
|
2020-02-11 21:57:16 +08:00
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
2020-02-12 17:42:57 +08:00
|
|
|
`,
|
2020-04-04 20:25:06 +08:00
|
|
|
panelToolbar: css`
|
|
|
|
display: flex;
|
2021-05-26 16:49:39 +08:00
|
|
|
padding: 0 0 ${paneSpacing} ${paneSpacing};
|
2020-02-11 21:57:16 +08:00
|
|
|
justify-content: space-between;
|
2020-04-04 20:25:06 +08:00
|
|
|
flex-wrap: wrap;
|
2020-02-11 21:57:16 +08:00
|
|
|
`,
|
2023-05-09 20:51:02 +08:00
|
|
|
angularWarning: css`
|
|
|
|
display: flex;
|
|
|
|
height: theme.spacing(4);
|
|
|
|
align-items: center;
|
|
|
|
`,
|
2020-02-11 21:57:16 +08:00
|
|
|
toolbarLeft: css`
|
2022-05-04 23:55:49 +08:00
|
|
|
padding-left: ${theme.spacing(1)};
|
2020-02-12 17:42:57 +08:00
|
|
|
`,
|
2020-02-11 21:57:16 +08:00
|
|
|
centeringContainer: css`
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2021-07-07 00:01:13 +08:00
|
|
|
position: relative;
|
2021-10-25 19:55:06 +08:00
|
|
|
flex-direction: column;
|
2020-02-11 21:57:16 +08:00
|
|
|
`,
|
2022-12-07 01:21:03 +08:00
|
|
|
onlyPanel: css`
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
|
|
|
`,
|
2020-02-11 21:57:16 +08:00
|
|
|
};
|
|
|
|
});
|
2020-04-02 19:56:20 +08:00
|
|
|
|
|
|
|
type EditorStyles = ReturnType<typeof getStyles>;
|