Add styles to empty state dropdown

Add dropdown to Dashboards empty state
Add dropdown to tasks empty state
Add missing import property
Fix e2e tests
pull/12661/head
Deniz Kusefoglu 2019-03-15 16:34:18 -07:00
parent 0e5e2a5703
commit 46da0c8096
13 changed files with 47 additions and 28 deletions

View File

@ -22,6 +22,8 @@ describe('Dashboards', () => {
.contains('Create')
.click()
cy.getByTestID('dropdown--item New Dashboard').click()
cy.visit('/dashboards')
cy.getByTestID('dashboard-card').should('have.length', 1)

View File

@ -18,6 +18,8 @@ describe('Tasks', () => {
cy.contains('Create').click()
})
cy.getByTestID('dropdown--item New Task').click()
cy.getByInputName('name').type(taskName)
cy.getByInputName('interval').type('1d')
cy.getByInputName('offset').type('20m')
@ -98,6 +100,8 @@ describe('Tasks', () => {
cy.contains('Create').click()
})
cy.getByTestID('dropdown--item New Task').click()
cy.getByInputName('name').type('🦄ask')
cy.getByInputName('interval').type('1d')
cy.getByInputName('offset').type('20m')

View File

@ -38,7 +38,13 @@
margin-top: ceil($fontSize * 0.75);
}
.button {
.empty-state--text + .button,
.empty-state--text + .dropdown {
margin-top: $padding;
}
.empty-state--sub-text + .button,
.empty-state--sub-text + .dropdown {
margin-top: $padding;
}

View File

@ -115,6 +115,7 @@ class DashboardIndex extends PureComponent<Props, State> {
searchTerm={searchTerm}
showOwnerColumn={true}
onFilterChange={this.handleFilterDashboards}
onImportDashboard={this.summonImportOverlay}
/>
</div>
</Page.Contents>

View File

@ -25,6 +25,7 @@ interface Props {
searchTerm: string
showOwnerColumn: boolean
filterComponent?: () => JSX.Element
onImportDashboard: () => void
}
@ErrorHandling
@ -40,6 +41,7 @@ export default class DashboardsIndexContents extends Component<Props> {
dashboards,
filterComponent,
onFilterChange,
onImportDashboard,
} = this.props
return (
@ -61,6 +63,7 @@ export default class DashboardsIndexContents extends Component<Props> {
onUpdateDashboard={onUpdateDashboard}
showOwnerColumn={showOwnerColumn}
onFilterChange={onFilterChange}
onImportDashboard={onImportDashboard}
/>
)}
</FilterList>

View File

@ -4,13 +4,9 @@ import {withRouter, WithRouterProps} from 'react-router'
import _ from 'lodash'
// Components
import {
Button,
IconFont,
ComponentSize,
ComponentColor,
} from '@influxdata/clockface'
import {ComponentSize} from '@influxdata/clockface'
import {EmptyState, ResourceList} from 'src/clockface'
import AddResourceDropdown from 'src/shared/components/AddResourceDropdown'
import DashboardCards from 'src/dashboards/components/dashboard_index/DashboardCards'
import SortingHat from 'src/shared/components/sorting_hat/SortingHat'
@ -28,6 +24,7 @@ interface Props {
onFilterChange: (searchTerm: string) => void
showOwnerColumn: boolean
filterComponent?: () => JSX.Element
onImportDashboard: () => void
}
interface DatedDashboard extends Dashboard {
@ -146,7 +143,7 @@ class DashboardsTable extends PureComponent<Props & WithRouterProps, State> {
}
private get emptyState(): JSX.Element {
const {onCreateDashboard, searchTerm} = this.props
const {onCreateDashboard, searchTerm, onImportDashboard} = this.props
if (searchTerm) {
return (
@ -162,12 +159,10 @@ class DashboardsTable extends PureComponent<Props & WithRouterProps, State> {
text="Looks like you dont have any Dashboards , why not create one?"
highlightWords={['Dashboards']}
/>
<Button
text="Create a Dashboard"
icon={IconFont.Plus}
color={ComponentColor.Primary}
onClick={onCreateDashboard}
size={ComponentSize.Medium}
<AddResourceDropdown
onSelectNew={onCreateDashboard}
onSelectImport={onImportDashboard}
resourceName="Dashboard"
/>
</EmptyState>
)

View File

@ -92,6 +92,7 @@ class Dashboards extends PureComponent<Props, State> {
searchTerm={searchTerm}
showOwnerColumn={false}
onFilterChange={this.handleFilterUpdate}
onImportDashboard={this.summonImportOverlay}
/>
</>
)

View File

@ -123,6 +123,7 @@ class OrgTasksPage extends PureComponent<Props, State> {
onUpdate={this.handleUpdateTask}
onRunTask={onRunTask}
onFilterChange={setSearchTerm}
onImportTask={this.handleImportTask}
/>
)}
</FilterList>

View File

@ -2,23 +2,20 @@
import React, {PureComponent} from 'react'
// Components
import {
Button,
ComponentColor,
ComponentSize,
IconFont,
} from '@influxdata/clockface'
import {ComponentSize} from '@influxdata/clockface'
import AddResourceDropdown from 'src/shared/components/AddResourceDropdown'
import {EmptyState} from 'src/clockface'
interface Props {
searchTerm: string
onCreate: () => void
totalCount: number
onImportTask: () => void
}
export default class EmptyTasksLists extends PureComponent<Props> {
public render() {
const {searchTerm, onCreate, totalCount} = this.props
const {searchTerm, onCreate, totalCount, onImportTask} = this.props
if (totalCount && searchTerm === '') {
return (
@ -37,12 +34,10 @@ export default class EmptyTasksLists extends PureComponent<Props> {
text={"Looks like you don't have any Tasks , why not create one?"}
highlightWords={['Tasks']}
/>
<Button
size={ComponentSize.Medium}
color={ComponentColor.Primary}
icon={IconFont.Plus}
text="Create Task"
onClick={onCreate}
<AddResourceDropdown
onSelectNew={onCreate}
onSelectImport={onImportTask}
resourceName="Task"
/>
</EmptyState>
)

View File

@ -19,6 +19,7 @@ const setup = (override?) => {
onDelete: oneTestFunction,
onCreate: secondTestFunction,
onSelect: oneTestFunction,
onImportTask: oneTestFunction,
...override,
}

View File

@ -33,6 +33,7 @@ interface Props {
onRunTask: typeof runTask
onUpdate: (task: Task) => void
filterComponent?: () => JSX.Element
onImportTask: () => void
}
type SortKey = keyof Task | 'organization.name'
@ -56,7 +57,13 @@ export default class TasksList extends PureComponent<Props, State> {
}
public render() {
const {searchTerm, onCreate, totalCount, filterComponent} = this.props
const {
searchTerm,
onCreate,
totalCount,
filterComponent,
onImportTask,
} = this.props
const {sortKey, sortDirection} = this.state
const headerKeys: SortKey[] = [
@ -108,6 +115,7 @@ export default class TasksList extends PureComponent<Props, State> {
searchTerm={searchTerm}
onCreate={onCreate}
totalCount={totalCount}
onImportTask={onImportTask}
/>
}
>

View File

@ -39,6 +39,7 @@ exports[`TasksList rendering renders 1`] = `
emptyState={
<EmptyTasksLists
onCreate={[Function]}
onImportTask={[Function]}
searchTerm=""
/>
}

View File

@ -137,6 +137,7 @@ class TasksPage extends PureComponent<Props, State> {
onFilterChange={setSearchTerm}
filterComponent={() => this.search}
onUpdate={updateTaskName}
onImportTask={this.summonOverlay}
/>
)}
</FilterList>