Skip to content

Commit 97bee45

Browse files
authored
Grafana v10.1.1 fixes (#91)
* Add time range selector to the dashboard * Add filters icon to submenu * Disable panel header menu
1 parent 3e77535 commit 97bee45

File tree

7 files changed

+69
-14
lines changed

7 files changed

+69
-14
lines changed

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@
280280
"@locker/near-membrane-dom": "^0.12.15",
281281
"@locker/near-membrane-shared": "^0.12.15",
282282
"@locker/near-membrane-shared-dom": "^0.12.15",
283+
"@mui/icons-material": "^5.14.13",
283284
"@mui/material": "^5.14.13",
284285
"@opentelemetry/api": "1.4.0",
285286
"@opentelemetry/exporter-collector": "0.25.0",

Diff for: packages/grafana-ui/src/components/ToolbarButton/ToolbarButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const getStyles = (theme: GrafanaTheme2) => {
188188
}),
189189
default: css({
190190
color: theme.colors.text.secondary,
191-
background: 'transparent',
191+
background: theme.colors.background.primary,
192192
border: `1px solid transparent`,
193193

194194
'&:hover': {

Diff for: public/app/features/dashboard/components/SubMenu/SubMenu.tsx

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { css } from '@emotion/css';
2-
import React, { PureComponent } from 'react';
2+
import FilterListIcon from '@mui/icons-material/FilterList';
3+
import { Box, styled } from '@mui/material';
4+
import React, { FC, PureComponent } from 'react';
35
import { connect, MapStateToProps } from 'react-redux';
46

57
import { AnnotationQuery, DataQuery, GrafanaTheme2 } from '@grafana/data';
@@ -61,6 +63,7 @@ class SubMenuUnConnected extends PureComponent<Props> {
6163
return (
6264
<div className={styles.submenu}>
6365
<form aria-label="Template variables" className={styles.formStyles} onSubmit={this.disableSubmitOnEnter}>
66+
<FilterWithIcon />
6467
<SubMenuItems variables={variables} readOnly={readOnlyVariables} />
6568
</form>
6669
<Annotations
@@ -78,6 +81,7 @@ class SubMenuUnConnected extends PureComponent<Props> {
7881
const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (state, ownProps) => {
7982
const { uid } = ownProps.dashboard;
8083
const templatingState = getVariablesState(uid, state);
84+
8185
return {
8286
variables: getSubMenuVariables(uid, templatingState.variables),
8387
};
@@ -108,3 +112,20 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => {
108112
export const SubMenu = withTheme2(connect(mapStateToProps)(SubMenuUnConnected));
109113

110114
SubMenu.displayName = 'SubMenu';
115+
116+
const FilterWithIcon: FC = () => (
117+
<FilterWithIconStyled>
118+
<FilterListIcon sx={{ color: '#3A785E' }} />
119+
FILTERS
120+
</FilterWithIconStyled>
121+
);
122+
123+
const FilterWithIconStyled = styled(Box)({
124+
display: 'flex',
125+
gap: 1,
126+
alignItems: 'center',
127+
color: '#3A785E',
128+
fontWeight: 600,
129+
lineHeight: '160%',
130+
fontSize: 12,
131+
});

Diff for: public/app/features/dashboard/containers/DashboardPage.tsx

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { cx } from '@emotion/css';
2+
import { Box } from '@mui/material';
23
import React, { PureComponent } from 'react';
34
import { connect, ConnectedProps, MapDispatchToProps, MapStateToProps } from 'react-redux';
45

56
import { NavModel, NavModelItem, TimeRange, PageLayoutType, locationUtil } from '@grafana/data';
67
import { selectors } from '@grafana/e2e-selectors';
78
import { config, locationService } from '@grafana/runtime';
8-
import { Themeable2, withTheme2 } from '@grafana/ui';
9+
import { Themeable2, withTheme2, ToolbarButtonRow } from '@grafana/ui';
910
import { notifyApp } from 'app/core/actions';
1011
import { Page } from 'app/core/components/Page/Page';
1112
import { EntityNotFound } from 'app/core/components/PageNotFound/EntityNotFound';
@@ -17,6 +18,7 @@ import { FnGlobalState } from 'app/core/reducers/fn-slice';
1718
import { getNavModel } from 'app/core/selectors/navModel';
1819
import { PanelModel } from 'app/features/dashboard/state';
1920
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher';
21+
import { updateTimeZoneForSession } from 'app/features/profile/state/reducers';
2022
import { getPageNavFromSlug, getRootContentNavModel } from 'app/features/storage/StorageFolderPage';
2123
import { FNDashboardProps } from 'app/fn-app/types';
2224
import { DashboardRoutes, DashboardState, KioskMode, StoreState } from 'app/types';
@@ -25,7 +27,7 @@ import { PanelEditEnteredEvent, PanelEditExitedEvent } from 'app/types/events';
2527
import { cancelVariables, templateVarsChangedInUrl } from '../../variables/state/actions';
2628
import { findTemplateVarChanges } from '../../variables/utils';
2729
import { AddWidgetModal } from '../components/AddWidgetModal/AddWidgetModal';
28-
import { DashNav } from '../components/DashNav';
30+
import { DashNavTimeControls } from '../components/DashNav/DashNavTimeControls';
2931
import { DashboardFailed } from '../components/DashboardLoading/DashboardFailed';
3032
import { DashboardLoading } from '../components/DashboardLoading/DashboardLoading';
3133
import { FnLoader } from '../components/DashboardLoading/FnLoader';
@@ -411,20 +413,29 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
411413
>
412414
{showToolbar && (
413415
<header data-testid={selectors.pages.Dashboard.DashNav.navV2}>
414-
<DashNav
416+
<Box mb={4}>
417+
<ToolbarButtonRow alignment="right">
418+
<DashNavTimeControls
419+
dashboard={dashboard}
420+
onChangeTimeZone={updateTimeZoneForSession}
421+
key="time-controls"
422+
/>
423+
</ToolbarButtonRow>
424+
</Box>
425+
{/* <DashNav
415426
dashboard={dashboard}
416427
title={dashboard.title}
417428
folderTitle={dashboard.meta.folderTitle}
418429
isFullscreen={!!viewPanel}
419430
onAddPanel={this.onAddPanel}
420431
kioskMode={kioskMode}
421432
hideTimePicker={dashboard.timepicker.hidden}
422-
/>
433+
/> */}
423434
</header>
424435
)}
425436
{!FNDashboard && <DashboardPrompt dashboard={dashboard} />}
426437
{initError && <DashboardFailed />}
427-
{showSubMenu && !FNDashboard && (
438+
{showSubMenu && (
428439
<section aria-label={selectors.pages.Dashboard.SubMenu.submenu}>
429440
<SubMenu dashboard={dashboard} annotations={dashboard.annotations.list} links={dashboard.links} />
430441
</section>

Diff for: public/app/features/dashboard/dashgrid/PanelHeader/PanelHeader.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { css, cx } from '@emotion/css';
2+
import { Box } from '@mui/material';
23
import React from 'react';
34

45
import { DataLink, GrafanaTheme2, PanelData } from '@grafana/data';
@@ -12,7 +13,6 @@ import { getPanelLinksSupplier } from 'app/features/panel/panellinks/linkSupplie
1213
import PanelHeaderCorner from './PanelHeaderCorner';
1314
import { PanelHeaderLoadingIndicator } from './PanelHeaderLoadingIndicator';
1415
import { PanelHeaderMenuTrigger } from './PanelHeaderMenuTrigger';
15-
import { PanelHeaderMenuWrapper } from './PanelHeaderMenuWrapper';
1616
import { PanelHeaderNotices } from './PanelHeaderNotices';
1717

1818
export interface Props {
@@ -49,7 +49,7 @@ export function PanelHeader({ panel, error, isViewing, isEditing, data, alertSta
4949
links={getPanelLinksSupplier(panel)}
5050
error={error}
5151
/>
52-
<div className={className}>
52+
<Box className={className} sx={{ '&:hover': { backgroundColor: 'transparent !important' } }}>
5353
<PanelHeaderMenuTrigger data-testid={selectors.components.Panels.Panel.title(title)} onOpenMenu={onOpenMenu}>
5454
{({ closeMenu, panelMenuOpen }) => {
5555
return (
@@ -67,8 +67,8 @@ export function PanelHeader({ panel, error, isViewing, isEditing, data, alertSta
6767
<h2 className={styles.titleText}>{title}</h2>
6868
{!dashboard.meta.publicDashboardAccessToken && (
6969
<div data-testid="panel-dropdown">
70-
<Icon name="angle-down" className="panel-menu-toggle" />
71-
{panelMenuOpen ? <PanelHeaderMenuWrapper panel={panel} dashboard={dashboard} /> : null}
70+
{/* <Icon name="angle-down" className="panel-menu-toggle" />
71+
{panelMenuOpen ? <PanelHeaderMenuWrapper panel={panel} dashboard={dashboard} /> : null} */}
7272
</div>
7373
)}
7474
{data.request && data.request.timeInfo && (
@@ -81,7 +81,7 @@ export function PanelHeader({ panel, error, isViewing, isEditing, data, alertSta
8181
);
8282
}}
8383
</PanelHeaderMenuTrigger>
84-
</div>
84+
</Box>
8585
</>
8686
);
8787
}
@@ -93,7 +93,6 @@ const panelStyles = (theme: GrafanaTheme2) => {
9393
overflow: hidden;
9494
white-space: nowrap;
9595
max-width: calc(100% - 38px);
96-
cursor: pointer;
9796
font-weight: ${theme.typography.fontWeightMedium};
9897
font-size: ${theme.typography.body.fontSize};
9998
margin: 0;

Diff for: public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderMenuTrigger.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ export function PanelHeaderMenuTrigger({ children, onOpenMenu, ...divProps }: Pr
3737
return (
3838
// TODO: fix keyboard a11y
3939
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
40-
<header {...divProps} className="panel-title-container" onClick={onMenuToggle} onMouseDown={onMouseDown}>
40+
<header
41+
{...divProps}
42+
className="panel-title-container"
43+
onClick={onMenuToggle}
44+
onMouseDown={onMouseDown}
45+
style={{ cursor: 'unset' }}
46+
>
4147
{children({ panelMenuOpen, closeMenu: () => setPanelMenuOpen(false) })}
4248
</header>
4349
);

Diff for: yarn.lock

+17
Original file line numberDiff line numberDiff line change
@@ -5578,6 +5578,22 @@ __metadata:
55785578
languageName: node
55795579
linkType: hard
55805580

5581+
"@mui/icons-material@npm:^5.14.13":
5582+
version: 5.14.13
5583+
resolution: "@mui/icons-material@npm:5.14.13"
5584+
dependencies:
5585+
"@babel/runtime": ^7.23.1
5586+
peerDependencies:
5587+
"@mui/material": ^5.0.0
5588+
"@types/react": ^17.0.0 || ^18.0.0
5589+
react: ^17.0.0 || ^18.0.0
5590+
peerDependenciesMeta:
5591+
"@types/react":
5592+
optional: true
5593+
checksum: a25db309d02654d1f2d51887986e11b26fc7aea864a398fdc55ca2f4ffd80bbc7402e7686f6a0aeab04a440993e0733aa52f752db50e083dae03e04c558f7bfd
5594+
languageName: node
5595+
linkType: hard
5596+
55815597
"@mui/material@npm:^5.14.13":
55825598
version: 5.14.13
55835599
resolution: "@mui/material@npm:5.14.13"
@@ -19750,6 +19766,7 @@ __metadata:
1975019766
"@locker/near-membrane-dom": ^0.12.15
1975119767
"@locker/near-membrane-shared": ^0.12.15
1975219768
"@locker/near-membrane-shared-dom": ^0.12.15
19769+
"@mui/icons-material": ^5.14.13
1975319770
"@mui/material": ^5.14.13
1975419771
"@opentelemetry/api": 1.4.0
1975519772
"@opentelemetry/exporter-collector": 0.25.0

0 commit comments

Comments
 (0)