2022-12-13 05:48:54 -08:00
|
|
|
import { css } from '@emotion/css';
|
2024-06-25 12:43:47 +01:00
|
|
|
import { memo, ReactNode } from 'react';
|
2021-07-23 10:33:26 +01:00
|
|
|
import { connect, ConnectedProps } from 'react-redux';
|
2024-08-23 09:54:13 +03:00
|
|
|
import { useLocation } from 'react-router-dom-v5-compat';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2023-04-14 09:43:11 +01:00
|
|
|
import { textUtil } from '@grafana/data';
|
2022-08-01 11:20:49 -03:00
|
|
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src';
|
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-10 18:03:36 +01:00
|
|
|
import { locationService } from '@grafana/runtime';
|
2022-08-24 11:19:36 +01:00
|
|
|
import {
|
|
|
|
|
ButtonGroup,
|
|
|
|
|
ModalsController,
|
|
|
|
|
ToolbarButton,
|
|
|
|
|
useForceUpdate,
|
|
|
|
|
ToolbarButtonRow,
|
2022-12-13 05:48:54 -08:00
|
|
|
ConfirmModal,
|
2024-01-08 10:42:24 -03:00
|
|
|
Badge,
|
2022-08-24 11:19:36 +01:00
|
|
|
} from '@grafana/ui';
|
2024-04-23 11:04:53 +01:00
|
|
|
import { updateNavIndex } from 'app/core/actions';
|
2022-07-06 17:00:56 +02:00
|
|
|
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
|
2023-04-14 09:43:11 +01:00
|
|
|
import { NavToolbarSeparator } from 'app/core/components/AppChrome/NavToolbar/NavToolbarSeparator';
|
2022-04-22 14:33:13 +01:00
|
|
|
import config from 'app/core/config';
|
2022-12-13 05:48:54 -08:00
|
|
|
import { useAppNotification } from 'app/core/copy/appNotification';
|
|
|
|
|
import { appEvents } from 'app/core/core';
|
2022-09-20 10:42:57 -06:00
|
|
|
import { useBusEvent } from 'app/core/hooks/useBusEvent';
|
2022-10-06 16:34:04 +01:00
|
|
|
import { t, Trans } from 'app/core/internationalization';
|
2024-04-23 11:04:53 +01:00
|
|
|
import { ID_PREFIX, setStarred } from 'app/core/reducers/navBarTree';
|
|
|
|
|
import { removeNavIndex } from 'app/core/reducers/navModel';
|
2023-06-08 13:16:08 +03:00
|
|
|
import AddPanelButton from 'app/features/dashboard/components/AddPanelButton/AddPanelButton';
|
2022-05-02 09:29:22 -07:00
|
|
|
import { SaveDashboardDrawer } from 'app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer';
|
2023-03-30 13:50:35 +03:00
|
|
|
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
|
|
|
|
import { DashboardModel } from 'app/features/dashboard/state';
|
2023-12-06 16:24:15 +01:00
|
|
|
import { DashboardInteractions } from 'app/features/dashboard-scene/utils/interactions';
|
2022-04-22 14:33:13 +01:00
|
|
|
import { playlistSrv } from 'app/features/playlist/PlaylistSrv';
|
|
|
|
|
import { updateTimeZoneForSession } from 'app/features/profile/state/reducers';
|
2024-04-23 11:04:53 +01:00
|
|
|
import { KioskMode, StoreState } from 'app/types';
|
2022-12-13 05:48:54 -08:00
|
|
|
import { DashboardMetaChangedEvent, ShowModalReactEvent } from 'app/types/events';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2023-12-11 09:26:32 +01:00
|
|
|
import {
|
|
|
|
|
DynamicDashNavButtonModel,
|
|
|
|
|
dynamicDashNavActions,
|
|
|
|
|
registerDynamicDashNavAction,
|
|
|
|
|
} from '../../../dashboard-scene/utils/registerDynamicDashNavAction';
|
|
|
|
|
|
2022-04-22 14:33:13 +01:00
|
|
|
import { DashNavButton } from './DashNavButton';
|
|
|
|
|
import { DashNavTimeControls } from './DashNavTimeControls';
|
2023-05-08 16:51:42 -03:00
|
|
|
import { ShareButton } from './ShareButton';
|
2019-02-03 10:55:58 +01:00
|
|
|
|
2021-07-23 10:33:26 +01:00
|
|
|
const mapDispatchToProps = {
|
2024-04-23 11:04:53 +01:00
|
|
|
removeNavIndex,
|
2022-05-23 16:45:46 +01:00
|
|
|
setStarred,
|
2021-07-23 10:33:26 +01:00
|
|
|
updateTimeZoneForSession,
|
2024-04-23 11:04:53 +01:00
|
|
|
updateNavIndex,
|
2021-07-23 10:33:26 +01:00
|
|
|
};
|
|
|
|
|
|
2024-04-23 11:04:53 +01:00
|
|
|
const mapStateToProps = (state: StoreState) => ({
|
|
|
|
|
navIndex: state.navIndex,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
2021-07-23 10:33:26 +01:00
|
|
|
|
2022-08-01 11:20:49 -03:00
|
|
|
const selectors = e2eSelectors.pages.Dashboard.DashNav;
|
|
|
|
|
|
2019-04-16 09:15:23 +02:00
|
|
|
export interface OwnProps {
|
2019-02-03 15:29:14 +01:00
|
|
|
dashboard: DashboardModel;
|
2019-02-03 12:29:47 +01:00
|
|
|
isFullscreen: boolean;
|
2022-09-15 14:04:58 +02:00
|
|
|
kioskMode?: KioskMode | null;
|
2021-03-17 18:03:05 +01:00
|
|
|
hideTimePicker: boolean;
|
2021-05-27 10:07:51 +02:00
|
|
|
folderTitle?: string;
|
|
|
|
|
title: string;
|
2019-02-03 10:55:58 +01:00
|
|
|
}
|
|
|
|
|
|
2023-12-11 09:26:32 +01:00
|
|
|
export function addCustomLeftAction(content: DynamicDashNavButtonModel) {
|
|
|
|
|
registerDynamicDashNavAction('left', content);
|
2020-04-27 13:30:55 +02:00
|
|
|
}
|
2020-04-08 21:13:12 +02:00
|
|
|
|
2023-12-11 09:26:32 +01:00
|
|
|
export function addCustomRightAction(content: DynamicDashNavButtonModel) {
|
|
|
|
|
registerDynamicDashNavAction('right', content);
|
2020-04-08 21:13:12 +02:00
|
|
|
}
|
|
|
|
|
|
2021-07-23 10:33:26 +01:00
|
|
|
type Props = OwnProps & ConnectedProps<typeof connector>;
|
2019-04-16 09:15:23 +02:00
|
|
|
|
2024-06-25 12:43:47 +01:00
|
|
|
export const DashNav = memo<Props>((props) => {
|
2023-04-14 09:43:11 +01:00
|
|
|
// this ensures the component rerenders when the location changes
|
|
|
|
|
useLocation();
|
2022-03-24 16:01:43 +00:00
|
|
|
const forceUpdate = useForceUpdate();
|
2019-02-03 21:06:07 +01:00
|
|
|
|
2022-09-20 10:42:57 -06:00
|
|
|
// We don't really care about the event payload here only that it triggeres a re-render of this component
|
|
|
|
|
useBusEvent(props.dashboard.events, DashboardMetaChangedEvent);
|
|
|
|
|
|
2022-12-13 05:48:54 -08:00
|
|
|
const originalUrl = props.dashboard.snapshot?.originalUrl ?? '';
|
|
|
|
|
const gotoSnapshotOrigin = () => {
|
|
|
|
|
window.location.href = textUtil.sanitizeUrl(props.dashboard.snapshot.originalUrl);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const notifyApp = useAppNotification();
|
|
|
|
|
const onOpenSnapshotOriginal = () => {
|
|
|
|
|
try {
|
|
|
|
|
const sanitizedUrl = new URL(textUtil.sanitizeUrl(originalUrl), config.appUrl);
|
|
|
|
|
const appUrl = new URL(config.appUrl);
|
|
|
|
|
if (sanitizedUrl.host !== appUrl.host) {
|
|
|
|
|
appEvents.publish(
|
|
|
|
|
new ShowModalReactEvent({
|
|
|
|
|
component: ConfirmModal,
|
|
|
|
|
props: {
|
|
|
|
|
title: 'Proceed to external site?',
|
|
|
|
|
modalClass: modalStyles,
|
|
|
|
|
body: (
|
|
|
|
|
<>
|
|
|
|
|
<p>
|
|
|
|
|
{`This link connects to an external website at`} <code>{originalUrl}</code>
|
|
|
|
|
</p>
|
|
|
|
|
<p>{"Are you sure you'd like to proceed?"}</p>
|
|
|
|
|
</>
|
|
|
|
|
),
|
|
|
|
|
confirmVariant: 'primary',
|
|
|
|
|
confirmText: 'Proceed',
|
|
|
|
|
onConfirm: gotoSnapshotOrigin,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
gotoSnapshotOrigin();
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
notifyApp.error('Invalid URL', err instanceof Error ? err.message : undefined);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const onStarDashboard = () => {
|
2023-12-06 16:24:15 +01:00
|
|
|
DashboardInteractions.toolbarFavoritesClick();
|
2022-03-24 16:01:43 +00:00
|
|
|
const dashboardSrv = getDashboardSrv();
|
2024-04-23 11:04:53 +01:00
|
|
|
const { dashboard, navIndex, removeNavIndex, setStarred, updateNavIndex } = props;
|
2022-03-24 16:01:43 +00:00
|
|
|
|
2023-02-09 10:24:46 +00:00
|
|
|
dashboardSrv.starDashboard(dashboard.uid, Boolean(dashboard.meta.isStarred)).then((newState) => {
|
2022-05-23 16:45:46 +01:00
|
|
|
setStarred({ id: dashboard.uid, title: dashboard.title, url: dashboard.meta.url ?? '', isStarred: newState });
|
2024-04-23 11:04:53 +01:00
|
|
|
const starredNavItem = navIndex['starred'];
|
|
|
|
|
if (newState) {
|
|
|
|
|
starredNavItem.children?.push({
|
|
|
|
|
id: ID_PREFIX + dashboard.uid,
|
|
|
|
|
text: dashboard.title,
|
|
|
|
|
url: dashboard.meta.url ?? '',
|
|
|
|
|
parentItem: starredNavItem,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
removeNavIndex(ID_PREFIX + dashboard.uid);
|
|
|
|
|
const indexToRemove = starredNavItem.children?.findIndex((element) => element.id === ID_PREFIX + dashboard.uid);
|
|
|
|
|
if (indexToRemove) {
|
|
|
|
|
starredNavItem.children?.splice(indexToRemove, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
updateNavIndex(starredNavItem);
|
2022-03-24 16:01:43 +00:00
|
|
|
dashboard.meta.isStarred = newState;
|
|
|
|
|
forceUpdate();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onOpenSettings = () => {
|
2023-12-06 16:24:15 +01:00
|
|
|
DashboardInteractions.toolbarSettingsClick();
|
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-10 18:03:36 +01:00
|
|
|
locationService.partial({ editview: 'settings' });
|
2019-02-03 14:53:42 +01:00
|
|
|
};
|
|
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const onPlaylistPrev = () => {
|
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-10 18:03:36 +01:00
|
|
|
playlistSrv.prev();
|
2019-02-04 21:08:30 +01:00
|
|
|
};
|
|
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const onPlaylistNext = () => {
|
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-10 18:03:36 +01:00
|
|
|
playlistSrv.next();
|
2019-02-04 21:08:30 +01:00
|
|
|
};
|
|
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const onPlaylistStop = () => {
|
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-10 18:03:36 +01:00
|
|
|
playlistSrv.stop();
|
2022-03-24 16:01:43 +00:00
|
|
|
forceUpdate();
|
2019-02-04 21:08:30 +01:00
|
|
|
};
|
|
|
|
|
|
2023-12-11 09:26:32 +01:00
|
|
|
const addCustomContent = (actions: DynamicDashNavButtonModel[], buttons: ReactNode[]) => {
|
2020-04-27 13:30:55 +02:00
|
|
|
actions.map((action, index) => {
|
|
|
|
|
const Component = action.component;
|
2022-03-24 16:01:43 +00:00
|
|
|
const element = <Component {...props} key={`button-custom-${index}`} />;
|
2020-04-27 13:30:55 +02:00
|
|
|
typeof action.index === 'number' ? buttons.splice(action.index, 0, element) : buttons.push(element);
|
|
|
|
|
});
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2020-04-27 13:30:55 +02:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const isPlaylistRunning = () => {
|
2024-03-11 13:33:32 +01:00
|
|
|
return playlistSrv.state.isPlaying;
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2021-01-27 15:02:04 +01:00
|
|
|
|
2022-07-14 20:34:00 +02:00
|
|
|
const renderLeftActions = () => {
|
2024-06-27 09:03:46 +02:00
|
|
|
const isDevEnv = config.buildInfo.env === 'development';
|
|
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const { dashboard, kioskMode } = props;
|
2024-01-08 10:42:24 -03:00
|
|
|
const { canStar, isStarred } = dashboard.meta;
|
2020-04-27 13:30:55 +02:00
|
|
|
const buttons: ReactNode[] = [];
|
2021-01-27 15:02:04 +01:00
|
|
|
|
2022-12-22 12:31:54 -03:00
|
|
|
if (kioskMode || isPlaylistRunning()) {
|
2021-01-27 15:02:04 +01:00
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-27 13:30:55 +02:00
|
|
|
if (canStar) {
|
2022-07-20 17:28:32 +01:00
|
|
|
let desc = isStarred
|
2022-10-06 16:34:04 +01:00
|
|
|
? t('dashboard.toolbar.unmark-favorite', 'Unmark as favorite')
|
|
|
|
|
: t('dashboard.toolbar.mark-favorite', 'Mark as favorite');
|
2020-04-27 13:30:55 +02:00
|
|
|
buttons.push(
|
|
|
|
|
<DashNavButton
|
2021-07-16 21:48:47 +02:00
|
|
|
tooltip={desc}
|
2020-04-27 13:30:55 +02:00
|
|
|
icon={isStarred ? 'favorite' : 'star'}
|
|
|
|
|
iconType={isStarred ? 'mono' : 'default'}
|
|
|
|
|
iconSize="lg"
|
2022-03-24 16:01:43 +00:00
|
|
|
onClick={onStarDashboard}
|
2020-04-27 13:30:55 +02:00
|
|
|
key="button-star"
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-19 17:44:41 -06:00
|
|
|
if (dashboard.meta.publicDashboardEnabled) {
|
2024-01-08 10:42:24 -03:00
|
|
|
// TODO: This will be replaced with the new badge component. Color is required but gets override by css
|
2022-09-19 17:01:14 +02:00
|
|
|
buttons.push(
|
2024-01-31 12:51:15 +01:00
|
|
|
<Badge
|
|
|
|
|
color="blue"
|
|
|
|
|
text="Public"
|
|
|
|
|
key="public-dashboard-button-badge"
|
|
|
|
|
className={publicBadgeStyle}
|
|
|
|
|
data-testid={selectors.publicDashboardTag}
|
|
|
|
|
/>
|
2022-09-19 17:01:14 +02:00
|
|
|
);
|
2022-07-19 17:44:41 -06:00
|
|
|
}
|
|
|
|
|
|
2024-06-27 09:03:46 +02:00
|
|
|
if (isDevEnv && config.featureToggles.dashboardScene) {
|
2023-07-06 11:21:03 +02:00
|
|
|
buttons.push(
|
|
|
|
|
<DashNavButton
|
|
|
|
|
key="button-scenes"
|
|
|
|
|
tooltip={'View as Scene'}
|
|
|
|
|
icon="apps"
|
2023-09-22 13:04:17 +02:00
|
|
|
onClick={() => {
|
2024-01-04 15:44:41 +01:00
|
|
|
locationService.partial({ scenes: true });
|
2023-09-22 13:04:17 +02:00
|
|
|
}}
|
2023-07-06 11:21:03 +02:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-11 09:26:32 +01:00
|
|
|
addCustomContent(dynamicDashNavActions.left, buttons);
|
2020-04-27 13:30:55 +02:00
|
|
|
return buttons;
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2020-04-27 13:30:55 +02:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const renderPlaylistControls = () => {
|
2019-02-03 10:55:58 +01:00
|
|
|
return (
|
2021-01-27 15:02:04 +01:00
|
|
|
<ButtonGroup key="playlist-buttons">
|
2022-07-20 17:28:32 +01:00
|
|
|
<ToolbarButton
|
2022-10-06 16:34:04 +01:00
|
|
|
tooltip={t('dashboard.toolbar.playlist-previous', 'Go to previous dashboard')}
|
2022-07-20 17:28:32 +01:00
|
|
|
icon="backward"
|
|
|
|
|
onClick={onPlaylistPrev}
|
|
|
|
|
narrow
|
|
|
|
|
/>
|
|
|
|
|
<ToolbarButton onClick={onPlaylistStop}>
|
2022-10-06 16:34:04 +01:00
|
|
|
<Trans i18nKey="dashboard.toolbar.playlist-stop">Stop playlist</Trans>
|
2022-07-20 17:28:32 +01:00
|
|
|
</ToolbarButton>
|
|
|
|
|
<ToolbarButton
|
2022-10-06 16:34:04 +01:00
|
|
|
tooltip={t('dashboard.toolbar.playlist-next', 'Go to next dashboard')}
|
2022-07-20 17:28:32 +01:00
|
|
|
icon="forward"
|
|
|
|
|
onClick={onPlaylistNext}
|
|
|
|
|
narrow
|
|
|
|
|
/>
|
2021-01-27 15:02:04 +01:00
|
|
|
</ButtonGroup>
|
2019-02-07 16:14:11 +01:00
|
|
|
);
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2019-02-07 16:14:11 +01:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
const renderTimeControls = () => {
|
|
|
|
|
const { dashboard, updateTimeZoneForSession, hideTimePicker } = props;
|
2021-03-17 18:03:05 +01:00
|
|
|
|
|
|
|
|
if (hideTimePicker) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return (
|
2024-08-02 13:30:47 +02:00
|
|
|
<DashNavTimeControls dashboard={dashboard} onChangeTimeZone={updateTimeZoneForSession} key="time-controls" />
|
2021-03-17 18:03:05 +01:00
|
|
|
);
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2021-03-17 18:03:05 +01:00
|
|
|
|
2022-07-14 20:34:00 +02:00
|
|
|
const renderRightActions = () => {
|
2024-01-25 14:04:29 +00:00
|
|
|
const { dashboard, isFullscreen, kioskMode, hideTimePicker } = props;
|
2024-01-08 10:42:24 -03:00
|
|
|
const { canSave, canEdit, showSettings, canShare } = dashboard.meta;
|
2019-02-07 16:14:11 +01:00
|
|
|
const { snapshot } = dashboard;
|
|
|
|
|
const snapshotUrl = snapshot && snapshot.originalUrl;
|
2020-04-27 13:30:55 +02:00
|
|
|
const buttons: ReactNode[] = [];
|
2021-01-27 15:02:04 +01:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
if (isPlaylistRunning()) {
|
|
|
|
|
return [renderPlaylistControls(), renderTimeControls()];
|
2021-01-27 15:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-17 18:03:05 +01:00
|
|
|
if (kioskMode === KioskMode.TV) {
|
2023-04-14 09:43:11 +01:00
|
|
|
return [renderTimeControls()];
|
2021-01-27 15:02:04 +01:00
|
|
|
}
|
|
|
|
|
|
2024-01-08 10:42:24 -03:00
|
|
|
if (snapshotUrl) {
|
|
|
|
|
buttons.push(
|
|
|
|
|
<ToolbarButton
|
|
|
|
|
tooltip={t('dashboard.toolbar.open-original', 'Open original dashboard')}
|
|
|
|
|
onClick={onOpenSnapshotOriginal}
|
|
|
|
|
icon="link"
|
|
|
|
|
key="button-snapshot"
|
|
|
|
|
/>
|
|
|
|
|
);
|
2022-03-03 15:18:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (canSave && !isFullscreen) {
|
2020-04-27 13:30:55 +02:00
|
|
|
buttons.push(
|
|
|
|
|
<ModalsController key="button-save">
|
|
|
|
|
{({ showModal, hideModal }) => (
|
2021-01-27 15:02:04 +01:00
|
|
|
<ToolbarButton
|
2022-10-06 16:34:04 +01:00
|
|
|
tooltip={t('dashboard.toolbar.save', 'Save dashboard')}
|
2020-04-27 13:30:55 +02:00
|
|
|
icon="save"
|
|
|
|
|
onClick={() => {
|
2022-05-02 09:29:22 -07:00
|
|
|
showModal(SaveDashboardDrawer, {
|
2020-04-27 13:30:55 +02:00
|
|
|
dashboard,
|
|
|
|
|
onDismiss: hideModal,
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</ModalsController>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-08 10:42:24 -03:00
|
|
|
addCustomContent(dynamicDashNavActions.right, buttons);
|
2020-04-27 13:30:55 +02:00
|
|
|
|
|
|
|
|
if (showSettings) {
|
|
|
|
|
buttons.push(
|
2022-07-20 17:28:32 +01:00
|
|
|
<ToolbarButton
|
2022-10-06 16:34:04 +01:00
|
|
|
tooltip={t('dashboard.toolbar.settings', 'Dashboard settings')}
|
2022-07-20 17:28:32 +01:00
|
|
|
icon="cog"
|
2024-09-04 15:47:15 +01:00
|
|
|
data-testid={e2eSelectors.pages.Dashboard.DashNav.settingsButton}
|
2022-07-20 17:28:32 +01:00
|
|
|
onClick={onOpenSettings}
|
|
|
|
|
key="button-settings"
|
|
|
|
|
/>
|
2020-04-27 13:30:55 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-08 10:42:24 -03:00
|
|
|
if (canEdit && !isFullscreen) {
|
2024-01-25 14:04:29 +00:00
|
|
|
buttons.push(
|
|
|
|
|
<AddPanelButton
|
|
|
|
|
onToolbarAddMenuOpen={DashboardInteractions.toolbarAddClick}
|
2024-08-02 13:30:47 +02:00
|
|
|
dashboard={dashboard}
|
2024-01-25 14:04:29 +00:00
|
|
|
key="panel-add-dropdown"
|
|
|
|
|
/>
|
|
|
|
|
);
|
2024-01-08 10:42:24 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (canShare) {
|
|
|
|
|
buttons.push(<ShareButton key="button-share" dashboard={dashboard} />);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-09 07:43:31 -03:00
|
|
|
// if the timepicker is hidden, we don't need to add this separator
|
|
|
|
|
if (!hideTimePicker) {
|
|
|
|
|
buttons.push(<NavToolbarSeparator key="toolbar-separator" />);
|
|
|
|
|
}
|
2021-01-27 15:02:04 +01:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
buttons.push(renderTimeControls());
|
2022-11-17 16:15:51 +01:00
|
|
|
|
2020-04-27 13:30:55 +02:00
|
|
|
return buttons;
|
2022-03-24 16:01:43 +00:00
|
|
|
};
|
2020-04-27 13:30:55 +02:00
|
|
|
|
2022-03-24 16:01:43 +00:00
|
|
|
return (
|
2023-04-14 09:43:11 +01:00
|
|
|
<AppChromeUpdate
|
|
|
|
|
actions={
|
2024-03-28 13:26:57 +01:00
|
|
|
<>
|
2023-04-14 09:43:11 +01:00
|
|
|
{renderLeftActions()}
|
|
|
|
|
<NavToolbarSeparator leftActionsSeparator />
|
|
|
|
|
<ToolbarButtonRow alignment="right">{renderRightActions()}</ToolbarButtonRow>
|
2024-03-28 13:26:57 +01:00
|
|
|
</>
|
2023-04-14 09:43:11 +01:00
|
|
|
}
|
|
|
|
|
/>
|
2022-03-24 16:01:43 +00:00
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
DashNav.displayName = 'DashNav';
|
2019-02-03 10:55:58 +01:00
|
|
|
|
2021-07-23 10:33:26 +01:00
|
|
|
export default connector(DashNav);
|
2022-12-13 05:48:54 -08:00
|
|
|
|
|
|
|
|
const modalStyles = css({
|
|
|
|
|
width: 'max-content',
|
|
|
|
|
maxWidth: '80vw',
|
|
|
|
|
});
|
2024-01-08 10:42:24 -03:00
|
|
|
|
|
|
|
|
const publicBadgeStyle = css({
|
|
|
|
|
color: 'grey',
|
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
|
border: '1px solid',
|
|
|
|
|
});
|