mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TopNav: Make dashboard toolbar actions work in new top nav (#51950)
* Initial work on new toolbar button * Minor step * Small progress * Minor progress * Minor fix * removed console.log * Removing stuff we don't need yet
This commit is contained in:
@@ -6,6 +6,7 @@ import { locationUtil, textUtil } from '@grafana/data';
|
||||
import { locationService } from '@grafana/runtime';
|
||||
import { ButtonGroup, ModalsController, ToolbarButton, PageToolbar, useForceUpdate } from '@grafana/ui';
|
||||
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
|
||||
import { NavToolbarSeparator } from 'app/core/components/AppChrome/NavToolbarSeparator';
|
||||
import config from 'app/core/config';
|
||||
import { toggleKioskMode } from 'app/core/navigation/kiosk';
|
||||
import { DashboardCommentsModal } from 'app/features/dashboard/components/DashboardComments/DashboardCommentsModal';
|
||||
@@ -109,7 +110,7 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
return playlistSrv.isPlaying;
|
||||
};
|
||||
|
||||
const renderLeftActionsButton = () => {
|
||||
const renderLeftActions = () => {
|
||||
const { dashboard, kioskMode } = props;
|
||||
const { canStar, canShare, isStarred } = dashboard.meta;
|
||||
const buttons: ReactNode[] = [];
|
||||
@@ -199,7 +200,7 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const renderRightActionsButton = () => {
|
||||
const renderRightActions = () => {
|
||||
const { dashboard, onAddPanel, isFullscreen, kioskMode } = props;
|
||||
const { canSave, canEdit, showSettings } = dashboard.meta;
|
||||
const { snapshot } = dashboard;
|
||||
@@ -279,7 +280,13 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
return (
|
||||
<AppChromeUpdate
|
||||
pageNav={{ text: title }}
|
||||
actions={<ToolbarButton onClick={onOpenSettings} icon="cog"></ToolbarButton>}
|
||||
actions={
|
||||
<>
|
||||
{renderLeftActions()}
|
||||
<NavToolbarSeparator leftActionsSeparator />
|
||||
{renderRightActions()}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -292,9 +299,9 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
titleHref={titleHref}
|
||||
parentHref={parentHref}
|
||||
onGoBack={onGoBack}
|
||||
leftItems={renderLeftActionsButton()}
|
||||
leftItems={renderLeftActions()}
|
||||
>
|
||||
{renderRightActionsButton()}
|
||||
{renderRightActions()}
|
||||
</PageToolbar>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user