Merge pull request #13262 from influxdata/tasks-owner

Remove owner from sortKeys
pull/13269/head
Deniz Kusefoglu 2019-04-09 10:48:36 -07:00 committed by GitHub
commit 875fa5be7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 27 deletions

View File

@ -33,7 +33,7 @@ interface State {
sortType: SortTypes
}
type SortKey = keyof Dashboard | 'modified' | 'owner' | 'default' // owner and modified are currently hardcoded
type SortKey = keyof Dashboard | 'modified'
type Props = OwnProps & WithRouterProps
@ -66,9 +66,9 @@ class DashboardsTable extends PureComponent<Props, State> {
onClick={this.handleClickColumn}
/>
<ResourceList.Sorter
name={this.headerKeys[2]}
sortKey={this.headerKeys[2]}
sort={sortKey === this.headerKeys[2] ? sortDirection : Sort.None}
name={this.headerKeys[1]}
sortKey={this.headerKeys[1]}
sort={sortKey === this.headerKeys[1] ? sortDirection : Sort.None}
onClick={this.handleClickColumn}
/>
</ResourceList.Header>
@ -91,7 +91,7 @@ class DashboardsTable extends PureComponent<Props, State> {
}
private get headerKeys(): SortKey[] {
return ['name', 'owner', 'modified', 'default']
return ['name', 'modified']
}
private handleClickColumn = (nextSort: Sort, sortKey: SortKey) => {

View File

@ -36,7 +36,7 @@ interface Props {
onImportTask: () => void
}
type SortKey = keyof Task | 'organization.name'
type SortKey = keyof Task
interface State {
sortKey: SortKey
@ -66,13 +66,7 @@ export default class TasksList extends PureComponent<Props, State> {
} = this.props
const {sortKey, sortDirection} = this.state
const headerKeys: SortKey[] = [
'name',
'status',
'every',
'organization.name',
'latestCompleted',
]
const headerKeys: SortKey[] = ['name', 'status', 'every', 'latestCompleted']
return (
<>
@ -84,12 +78,6 @@ export default class TasksList extends PureComponent<Props, State> {
sort={sortKey === headerKeys[0] ? sortDirection : Sort.None}
onClick={this.handleClickColumn}
/>
<ResourceList.Sorter
name="Owner"
sortKey={headerKeys[3]}
sort={sortKey === headerKeys[3] ? sortDirection : Sort.None}
onClick={this.handleClickColumn}
/>
<ResourceList.Sorter
name="Active"
sortKey={headerKeys[1]}
@ -104,8 +92,8 @@ export default class TasksList extends PureComponent<Props, State> {
/>
<ResourceList.Sorter
name="Last Completed"
sortKey={headerKeys[4]}
sort={sortKey === headerKeys[4] ? sortDirection : Sort.None}
sortKey={headerKeys[3]}
sort={sortKey === headerKeys[3] ? sortDirection : Sort.None}
onClick={this.handleClickColumn}
/>
</ResourceList.Header>

View File

@ -10,12 +10,6 @@ exports[`TasksList rendering renders 1`] = `
sort="none"
sortKey="name"
/>
<ResourceListSorter
name="Owner"
onClick={[Function]}
sort="none"
sortKey="organization.name"
/>
<ResourceListSorter
name="Active"
onClick={[Function]}