Add default display for an empty dashboard (#1259)
* Inline Dashboard.renderDashboard; add empty state * Update CHANGELOG * Update changelogpull/10616/head
parent
d05e217566
commit
cb171e8a7b
|
@ -3,6 +3,7 @@
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
### Features
|
### Features
|
||||||
### UI Improvements
|
### UI Improvements
|
||||||
|
1. [#1259](https://github.com/influxdata/chronograf/pull/1259): Add default display for empty dashboard
|
||||||
1. [#1258](https://github.com/influxdata/chronograf/pull/1258): Display Kapacitor alert endpoint options as radio button group
|
1. [#1258](https://github.com/influxdata/chronograf/pull/1258): Display Kapacitor alert endpoint options as radio button group
|
||||||
|
|
||||||
## v1.2.0-beta8 [2017-04-07]
|
## v1.2.0-beta8 [2017-04-07]
|
||||||
|
|
|
@ -7,6 +7,7 @@ const Dashboard = ({
|
||||||
dashboard,
|
dashboard,
|
||||||
isEditMode,
|
isEditMode,
|
||||||
inPresentationMode,
|
inPresentationMode,
|
||||||
|
onAddCell,
|
||||||
onPositionChange,
|
onPositionChange,
|
||||||
onEditCell,
|
onEditCell,
|
||||||
onRenameCell,
|
onRenameCell,
|
||||||
|
@ -21,16 +22,6 @@ const Dashboard = ({
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classnames({'page-contents': true, 'presentation-mode': inPresentationMode})}>
|
|
||||||
<div className={classnames('container-fluid full-width dashboard', {'dashboard-edit': isEditMode})}>
|
|
||||||
{Dashboard.renderDashboard(dashboard, autoRefresh, timeRange, source, onPositionChange, onEditCell, onRenameCell, onUpdateCell, onDeleteCell, onSummonOverlayTechnologies)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.renderDashboard = (dashboard, autoRefresh, timeRange, source, onPositionChange, onEditCell, onRenameCell, onUpdateCell, onDeleteCell, onSummonOverlayTechnologies) => {
|
|
||||||
const cells = dashboard.cells.map((cell) => {
|
const cells = dashboard.cells.map((cell) => {
|
||||||
const dashboardCell = {...cell}
|
const dashboardCell = {...cell}
|
||||||
dashboardCell.queries = dashboardCell.queries.map(({label, query, queryConfig, db}) =>
|
dashboardCell.queries = dashboardCell.queries.map(({label, query, queryConfig, db}) =>
|
||||||
|
@ -47,18 +38,33 @@ Dashboard.renderDashboard = (dashboard, autoRefresh, timeRange, source, onPositi
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutRenderer
|
<div className={classnames({'page-contents': true, 'presentation-mode': inPresentationMode})}>
|
||||||
timeRange={timeRange}
|
{cells.length ?
|
||||||
cells={cells}
|
<div className={classnames('container-fluid full-width dashboard', {'dashboard-edit': isEditMode})}>
|
||||||
autoRefresh={autoRefresh}
|
<LayoutRenderer
|
||||||
source={source.links.proxy}
|
timeRange={timeRange}
|
||||||
onPositionChange={onPositionChange}
|
cells={cells}
|
||||||
onEditCell={onEditCell}
|
autoRefresh={autoRefresh}
|
||||||
onRenameCell={onRenameCell}
|
source={source.links.proxy}
|
||||||
onUpdateCell={onUpdateCell}
|
onPositionChange={onPositionChange}
|
||||||
onDeleteCell={onDeleteCell}
|
onEditCell={onEditCell}
|
||||||
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
|
onRenameCell={onRenameCell}
|
||||||
/>
|
onUpdateCell={onUpdateCell}
|
||||||
|
onDeleteCell={onDeleteCell}
|
||||||
|
onSummonOverlayTechnologies={onSummonOverlayTechnologies}
|
||||||
|
/>
|
||||||
|
</div> :
|
||||||
|
<div className="dashboard__empty">
|
||||||
|
<p>This Dashboard has no Graphs</p>
|
||||||
|
<button
|
||||||
|
className="btn btn-primary btn-m"
|
||||||
|
onClick={onAddCell}
|
||||||
|
>
|
||||||
|
Add Graph
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +80,7 @@ Dashboard.propTypes = {
|
||||||
dashboard: shape({}).isRequired,
|
dashboard: shape({}).isRequired,
|
||||||
isEditMode: bool,
|
isEditMode: bool,
|
||||||
inPresentationMode: bool,
|
inPresentationMode: bool,
|
||||||
|
onAddCell: func,
|
||||||
onPositionChange: func,
|
onPositionChange: func,
|
||||||
onEditCell: func,
|
onEditCell: func,
|
||||||
onRenameCell: func,
|
onRenameCell: func,
|
||||||
|
|
|
@ -232,6 +232,7 @@ const DashboardPage = React.createClass({
|
||||||
source={source}
|
source={source}
|
||||||
autoRefresh={autoRefresh}
|
autoRefresh={autoRefresh}
|
||||||
timeRange={timeRange}
|
timeRange={timeRange}
|
||||||
|
onAddCell={this.handleAddCell}
|
||||||
onPositionChange={this.handleUpdatePosition}
|
onPositionChange={this.handleUpdatePosition}
|
||||||
onEditCell={this.handleEditDashboardCell}
|
onEditCell={this.handleEditDashboardCell}
|
||||||
onRenameCell={this.handleRenameDashboardCell}
|
onRenameCell={this.handleRenameDashboardCell}
|
||||||
|
|
|
@ -49,6 +49,20 @@ $dash-graph-options-arrow: 8px;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.dashboard__empty {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: $g13-mist;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.dash-graph {
|
.dash-graph {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
Loading…
Reference in New Issue