Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Show empty dashboards state #15853

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ui/cypress/e2e/dashboardsIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ describe('Dashboards', () => {
})
})

it('empty state should have a header with text and a button to create a dashboard', () => {
cy.getByTestID('page-contents').within(() => {
cy.getByTestID('empty-dashboards-list').within(() => {
cy.getByTestID('empty-state--text').should($t => {
expect($t).to.have.length(1)
expect($t).to.contain(
"Looks like you don't have any Dashboards, why not create one?"
)
})
cy.getByTestID('add-resource-dropdown--button').should($b => {
expect($b).to.have.length(1)
expect($b).to.contain('Create Dashboard')
})
})
})
})

it('can create a dashboard from empty state', () => {
cy.getByTestID('empty-dashboards-list').within(() => {
cy.getByTestID('add-resource-dropdown--button').click()
Expand Down
8 changes: 4 additions & 4 deletions ui/src/dashboards/components/dashboard_index/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class DashboardsTable extends PureComponent<Props, State> {
</ResourceList.Header>
<ResourceList.Body
emptyState={this.emptyState}
className="dashboards-card-grid"
className={dashboards.length ? 'dashboards-card-grid' : ''}
>
{!!dashboards.length && (
{dashboards.length ? (
<DashboardCards
dashboards={dashboards}
sortKey={sortKey}
Expand All @@ -85,7 +85,7 @@ class DashboardsTable extends PureComponent<Props, State> {
onUpdateDashboard={onUpdateDashboard}
onFilterChange={onFilterChange}
/>
)}
) : null}
</ResourceList.Body>
</ResourceList>
)
Expand Down Expand Up @@ -129,7 +129,7 @@ class DashboardsTable extends PureComponent<Props, State> {
return (
<EmptyState size={ComponentSize.Large} testID="empty-dashboards-list">
<EmptyState.Text>
Looks like you dont have any <b>Dashboards</b>, why not create one?
Looks like you don't have any <b>Dashboards</b>, why not create one?
</EmptyState.Text>
<AddResourceDropdown
onSelectNew={onCreateDashboard}
Expand Down