mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* fix(pagetoolbar): pad elements top and bottom to keep vertical align and wrapper padding
* fix(sidemenu): prevent mobile sidemenu squashing dashboard, vertically align mobile sidemenu icon
* fix(dashboardsettings): prevent subheader overlap
* fix(pagetoolbar): center align all toolbar elements vertically
* refactor(pagetoolbar): combine vertical paddings to bring back original padding values
* refactor: update padding values for components that use PageToolbar
* fix(playlists): update Empty cta link route to prevent 404
* test(dashboard): update snapshot
(cherry picked from commit ad3b0b2272
)
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
parent
02dd5a6f0e
commit
b23bd2c105
@ -54,45 +54,42 @@ export const PageToolbar: FC<Props> = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={mainStyle}>
|
<div className={mainStyle}>
|
||||||
<div className={styles.toolbarLeft}>
|
{pageIcon && !onGoBack && (
|
||||||
{pageIcon && !onGoBack && (
|
<div className={styles.pageIcon}>
|
||||||
<div className={styles.pageIcon}>
|
<Icon name={pageIcon} size="lg" />
|
||||||
<Icon name={pageIcon} size="lg" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{onGoBack && (
|
|
||||||
<div className={styles.goBackButton}>
|
|
||||||
<IconButton
|
|
||||||
name="arrow-left"
|
|
||||||
tooltip="Go back (Esc)"
|
|
||||||
tooltipPlacement="bottom"
|
|
||||||
size="xxl"
|
|
||||||
surface="dashboard"
|
|
||||||
aria-label={selectors.components.BackButton.backArrow}
|
|
||||||
onClick={onGoBack}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className={styles.titleWrapper}>
|
|
||||||
{parent && onClickParent && (
|
|
||||||
<button onClick={onClickParent} className={cx(styles.titleLink, styles.parentLink)}>
|
|
||||||
{parent} <span className={styles.parentIcon}>/</span>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
{onClickTitle && (
|
|
||||||
<button onClick={onClickTitle} className={styles.titleLink}>
|
|
||||||
{title}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
{!onClickTitle && <div className={styles.titleText}>{title}</div>}
|
|
||||||
</div>
|
</div>
|
||||||
{leftItems?.map((child, index) => (
|
)}
|
||||||
<div className={styles.leftActionItem} key={index}>
|
{onGoBack && (
|
||||||
{child}
|
<div className={styles.pageIcon}>
|
||||||
</div>
|
<IconButton
|
||||||
))}
|
name="arrow-left"
|
||||||
</div>
|
tooltip="Go back (Esc)"
|
||||||
<div className={styles.spacer}></div>
|
tooltipPlacement="bottom"
|
||||||
|
size="xxl"
|
||||||
|
surface="dashboard"
|
||||||
|
aria-label={selectors.components.BackButton.backArrow}
|
||||||
|
onClick={onGoBack}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{parent && onClickParent && (
|
||||||
|
<button onClick={onClickParent} className={cx(styles.titleText, styles.parentLink)}>
|
||||||
|
{parent} <span className={styles.parentIcon}>/</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{onClickTitle && (
|
||||||
|
<button onClick={onClickTitle} className={styles.titleText}>
|
||||||
|
{title}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{!onClickTitle && <div className={styles.titleText}>{title}</div>}
|
||||||
|
{leftItems?.map((child, index) => (
|
||||||
|
<div className={styles.leftActionItem} key={index}>
|
||||||
|
{child}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<div className={styles.spacer} />
|
||||||
{React.Children.toArray(children)
|
{React.Children.toArray(children)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map((child, index) => {
|
.map((child, index) => {
|
||||||
@ -114,7 +111,7 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
|
|
||||||
const titleStyles = `
|
const titleStyles = `
|
||||||
font-size: ${typography.size.lg};
|
font-size: ${typography.size.lg};
|
||||||
padding-left: ${spacing(1)};
|
padding: ${spacing(0.5, 1, 0.5, 1)};
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -131,71 +128,51 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
toolbar: css`
|
toolbar: css`
|
||||||
display: flex;
|
align-items: center;
|
||||||
background: ${theme.colors.background.canvas};
|
background: ${theme.colors.background.canvas};
|
||||||
justify-content: flex-end;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding: ${theme.spacing(1, 2, 0, 2)};
|
|
||||||
`,
|
|
||||||
toolbarLeft: css`
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-wrap: wrap;
|
||||||
min-width: 0;
|
justify-content: flex-end;
|
||||||
|
padding: ${theme.spacing(1.5, 2)};
|
||||||
`,
|
`,
|
||||||
spacer: css`
|
spacer: css`
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
`,
|
`,
|
||||||
pageIcon: css`
|
pageIcon: css`
|
||||||
padding-top: ${spacing(1)};
|
|
||||||
align-items: center;
|
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
titleWrapper: css`
|
titleWrapper: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-top: ${spacing(1)};
|
|
||||||
padding-right: ${spacing(1)};
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`,
|
`,
|
||||||
goBackButton: css`
|
|
||||||
position: relative;
|
|
||||||
top: 8px;
|
|
||||||
`,
|
|
||||||
parentIcon: css`
|
parentIcon: css`
|
||||||
margin-left: 4px;
|
margin-left: ${theme.spacing(0.5)};
|
||||||
`,
|
`,
|
||||||
titleText: css`
|
titleText: css`
|
||||||
${titleStyles};
|
${titleStyles};
|
||||||
`,
|
`,
|
||||||
titleLink: css`
|
|
||||||
${titleStyles};
|
|
||||||
`,
|
|
||||||
parentLink: css`
|
parentLink: css`
|
||||||
display: none;
|
display: none;
|
||||||
|
padding-right: 0;
|
||||||
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
||||||
display: inline-block;
|
display: unset;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
actionWrapper: css`
|
actionWrapper: css`
|
||||||
padding-left: ${spacing(1)};
|
padding: ${spacing(0.5, 0, 0.5, 1)};
|
||||||
padding-top: ${spacing(1)};
|
|
||||||
`,
|
`,
|
||||||
leftActionItem: css`
|
leftActionItem: css`
|
||||||
display: none;
|
display: none;
|
||||||
height: 40px;
|
|
||||||
position: relative;
|
|
||||||
top: 5px;
|
|
||||||
align-items: center;
|
|
||||||
padding-left: ${spacing(0.5)};
|
|
||||||
|
|
||||||
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
@media ${styleMixins.mediaUp(theme.v1.breakpoints.md)} {
|
||||||
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
padding-left: ${spacing(0.5)};
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
};
|
};
|
||||||
|
@ -151,7 +151,7 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
background: ${theme.colors.background.primary};
|
background: ${theme.colors.background.primary};
|
||||||
border: 1px solid ${theme.colors.border.weak};
|
border: 1px solid ${theme.colors.border.weak};
|
||||||
border-radius: ${theme.shape.borderRadius()};
|
border-radius: ${theme.shape.borderRadius()};
|
||||||
margin: ${theme.spacing(2)};
|
margin: ${theme.spacing(0, 2, 2)};
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
`,
|
`,
|
||||||
|
@ -185,7 +185,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => ({
|
|||||||
display: flex;
|
display: flex;
|
||||||
`,
|
`,
|
||||||
settingsWrapper: css`
|
settingsWrapper: css`
|
||||||
margin: ${theme.spacing(2)};
|
margin: ${theme.spacing(0, 2, 2)};
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
`,
|
`,
|
||||||
|
@ -67,7 +67,7 @@ const getStyles = (theme: GrafanaTheme) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: ${theme.spacing.md} 0 0 0;
|
padding: 0;
|
||||||
`,
|
`,
|
||||||
optionsWrapper: css`
|
optionsWrapper: css`
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -526,7 +526,7 @@ export const getStyles = stylesFactory((theme: GrafanaTheme, props: Props) => {
|
|||||||
`,
|
`,
|
||||||
panelToolbar: css`
|
panelToolbar: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: ${paneSpacing} 0 ${paneSpacing} ${paneSpacing};
|
padding: 0 0 ${paneSpacing} ${paneSpacing};
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
`,
|
`,
|
||||||
|
@ -290,7 +290,8 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
const { dashboard, isInitSlow, initError, isPanelEditorOpen, queryParams, theme } = this.props;
|
const { dashboard, isInitSlow, initError, isPanelEditorOpen, queryParams, theme } = this.props;
|
||||||
const { editPanel, viewPanel, scrollTop, updateScrollTop } = this.state;
|
const { editPanel, viewPanel, scrollTop, updateScrollTop } = this.state;
|
||||||
const styles = getStyles(theme);
|
const kioskMode = getKioskMode(queryParams.kiosk);
|
||||||
|
const styles = getStyles(theme, kioskMode);
|
||||||
|
|
||||||
if (!dashboard) {
|
if (!dashboard) {
|
||||||
if (isInitSlow) {
|
if (isInitSlow) {
|
||||||
@ -303,7 +304,6 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
|
|||||||
// Only trigger render when the scroll has moved by 25
|
// Only trigger render when the scroll has moved by 25
|
||||||
const approximateScrollTop = Math.round(scrollTop / 25) * 25;
|
const approximateScrollTop = Math.round(scrollTop / 25) * 25;
|
||||||
const inspectPanel = this.getInspectPanel();
|
const inspectPanel = this.getInspectPanel();
|
||||||
const kioskMode = getKioskMode(queryParams.kiosk);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.dashboardContainer}>
|
<div className={styles.dashboardContainer}>
|
||||||
@ -373,7 +373,8 @@ const mapDispatchToProps = {
|
|||||||
/*
|
/*
|
||||||
* Styles
|
* Styles
|
||||||
*/
|
*/
|
||||||
export const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
export const getStyles = stylesFactory((theme: GrafanaTheme2, kioskMode) => {
|
||||||
|
const contentPadding = kioskMode !== KioskMode.Full ? theme.spacing(0, 2, 2) : theme.spacing(2);
|
||||||
return {
|
return {
|
||||||
dashboardContainer: css`
|
dashboardContainer: css`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -392,7 +393,7 @@ export const getStyles = stylesFactory((theme: GrafanaTheme2) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
`,
|
`,
|
||||||
dashboardContent: css`
|
dashboardContent: css`
|
||||||
padding: ${theme.spacing(2)};
|
padding: ${contentPadding};
|
||||||
flex-basis: 100%;
|
flex-basis: 100%;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
`,
|
`,
|
||||||
|
@ -128,7 +128,7 @@ exports[`DashboardPage Dashboard init completed Should render dashboard grid 1`
|
|||||||
updateAfterMountMs={500}
|
updateAfterMountMs={500}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="css-50qyg5"
|
className="css-1xodasp"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="Dashboard submenu"
|
aria-label="Dashboard submenu"
|
||||||
@ -507,7 +507,7 @@ exports[`DashboardPage When dashboard has editview url state should render setti
|
|||||||
updateAfterMountMs={500}
|
updateAfterMountMs={500}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="css-50qyg5"
|
className="css-1xodasp"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
aria-label="Dashboard submenu"
|
aria-label="Dashboard submenu"
|
||||||
|
@ -32,7 +32,7 @@ export const PlaylistPage: FC<Props> = ({ navModel }) => {
|
|||||||
<EmptyListCTA
|
<EmptyListCTA
|
||||||
title="There are no playlists created yet"
|
title="There are no playlists created yet"
|
||||||
buttonIcon="plus"
|
buttonIcon="plus"
|
||||||
buttonLink="playlists/create"
|
buttonLink="playlists/new"
|
||||||
buttonTitle="Create Playlist"
|
buttonTitle="Create Playlist"
|
||||||
proTip="You can use playlists to cycle dashboards on TVs without user control"
|
proTip="You can use playlists to cycle dashboards on TVs without user control"
|
||||||
proTipLink="http://docs.grafana.org/reference/playlist/"
|
proTipLink="http://docs.grafana.org/reference/playlist/"
|
||||||
|
@ -49,8 +49,6 @@
|
|||||||
.dashboard-settings__subheader {
|
.dashboard-settings__subheader {
|
||||||
color: $text-muted;
|
color: $text-muted;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
position: relative;
|
|
||||||
top: -$space-lg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-settings__nav-item {
|
.dashboard-settings__nav-item {
|
||||||
|
@ -207,7 +207,7 @@ li.sidemenu-org-switcher {
|
|||||||
background: $side-menu-bg-mobile;
|
background: $side-menu-bg-mobile;
|
||||||
height: auto;
|
height: auto;
|
||||||
box-shadow: $side-menu-shadow;
|
box-shadow: $side-menu-shadow;
|
||||||
position: relative;
|
position: absolute;
|
||||||
z-index: $zindex-sidemenu;
|
z-index: $zindex-sidemenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ li.sidemenu-org-switcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidemenu__logo_small_breakpoint {
|
.sidemenu__logo_small_breakpoint {
|
||||||
padding: 13px;
|
padding: 16px 13px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
Loading…
Reference in New Issue
Block a user