Commit 22886091 by Torkel Ödegaard Committed by GitHub

Dashboard: Refactor container css to use flex for height instead of calc (#24009)

* Dashboard: Ability to hide dashboard toolbar

* Updated snapshot
parent fefbbc65
......@@ -3,7 +3,7 @@ import $ from 'jquery';
import React, { MouseEvent, PureComponent } from 'react';
import { hot } from 'react-hot-loader';
import { connect } from 'react-redux';
import classNames from 'classnames';
// Services & Utils
import { createErrorNotification } from 'app/core/copy/appNotification';
import { getMessageFromError } from 'app/core/utils/errors';
......@@ -282,19 +282,15 @@ export class DashboardPage extends PureComponent<Props, State> {
return null;
}
const gridWrapperClasses = classNames({
'dashboard-container': true,
'dashboard-container--has-submenu': dashboard.meta.submenuEnabled,
});
// Only trigger render when the scroll has moved by 25
const approximateScrollTop = Math.round(scrollTop / 25) * 25;
const inspectPanel = this.getInspectPanel();
return (
<div>
<div className="dashboard-container">
<DashNav dashboard={dashboard} isFullscreen={!!viewPanel} $injector={$injector} onAddPanel={this.onAddPanel} />
<div className="scroll-canvas scroll-canvas--dashboard">
<div className="dashboard-scroll">
<CustomScrollbar
autoHeightMin="100%"
setScrollTop={this.setScrollTop}
......@@ -302,10 +298,10 @@ export class DashboardPage extends PureComponent<Props, State> {
updateAfterMountMs={500}
className="custom-scrollbar--page"
>
<div className="dashboard-content">
{initError && this.renderInitFailedState()}
<div className={gridWrapperClasses}>
{!editPanel && <SubMenu dashboard={dashboard} />}
<DashboardGrid
dashboard={dashboard}
viewPanel={viewPanel}
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DashboardPage Dashboard init completed Should render dashboard grid 1`] = `
<div>
<div
className="dashboard-container"
>
<Connect(DashNav)
$injector={Object {}}
dashboard={
......@@ -100,7 +102,7 @@ exports[`DashboardPage Dashboard init completed Should render dashboard grid 1`
onAddPanel={[Function]}
/>
<div
className="scroll-canvas scroll-canvas--dashboard"
className="dashboard-scroll"
>
<CustomScrollbar
autoHeightMax="100%"
......@@ -114,7 +116,7 @@ exports[`DashboardPage Dashboard init completed Should render dashboard grid 1`
updateAfterMountMs={500}
>
<div
className="dashboard-container"
className="dashboard-content"
>
<SubMenu
dashboard={
......@@ -357,7 +359,9 @@ exports[`DashboardPage Dashboard is fetching slowly Should render slow init stat
exports[`DashboardPage Given initial state Should render nothing 1`] = `""`;
exports[`DashboardPage When dashboard has editview url state should render settings view 1`] = `
<div>
<div
className="dashboard-container"
>
<Connect(DashNav)
$injector={Object {}}
dashboard={
......@@ -456,7 +460,7 @@ exports[`DashboardPage When dashboard has editview url state should render setti
onAddPanel={[Function]}
/>
<div
className="scroll-canvas scroll-canvas--dashboard"
className="dashboard-scroll"
>
<CustomScrollbar
autoHeightMax="100%"
......@@ -470,7 +474,7 @@ exports[`DashboardPage When dashboard has editview url state should render setti
updateAfterMountMs={500}
>
<div
className="dashboard-container"
className="dashboard-content"
>
<SubMenu
dashboard={
......
......@@ -16,13 +16,7 @@
.panel-in-fullscreen {
.react-grid-layout {
height: 100% !important;
}
.dashboard-container--has-submenu {
.react-grid-layout {
height: calc(100% - 50px) !important;
}
height: 90% !important;
}
.react-grid-item {
......
......@@ -5,8 +5,6 @@
&--view {
flex: 1 1 0;
height: 90%;
margin: 0 $dashboard-padding;
padding-top: $dashboard-padding;
}
}
......@@ -28,14 +26,6 @@
display: none;
}
.dashboard-container {
padding: 0;
}
.submenu-controls {
padding: 0 $dashboard-padding $space-sm $dashboard-padding;
}
.search-container {
left: 0 !important;
}
......
.dashboard-container {
padding: $dashboard-padding $dashboard-padding 0 $dashboard-padding;
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
display: flex;
flex: 1 1 0;
flex-direction: column;
}
.dashboard-scroll {
width: 100%;
flex-grow: 1;
min-height: 0;
}
.dashboard-content {
padding: $dashboard-padding $dashboard-padding 0 $dashboard-padding;
height: 100%;
}
div.flot-text {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment