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

feat(ui): resource sorting dropdowns #17321

Merged
merged 33 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8eb1353
feat(ui): replace sortable dashboard table headers with sort dropdown
alexpaxton Mar 17, 2020
f168c78
refactor(ui): remove unecessary components
alexpaxton Mar 17, 2020
93f3f67
refactor(ui): add testIDs to dropdown
alexpaxton Mar 17, 2020
a295112
refactor(ui): move tasks filter to page control bar
alexpaxton Mar 17, 2020
69f29aa
fix(ui): remove unused import
alexpaxton Mar 17, 2020
e406dd7
feat(ui): replace tasks sortable headers with sort dropdown
alexpaxton Mar 17, 2020
5896587
fix(ui): make search widget more responsive
alexpaxton Mar 17, 2020
ca0b414
fix(ui): make dashboard sort dropdown maintain size
alexpaxton Mar 17, 2020
eb6c4f4
chore(ui): Merge branch 'master' into feat/sorting-dropdowns
alexpaxton Mar 18, 2020
5ae582f
Merge branch 'master' into feat/sorting-dropdowns
alexpaxton Apr 7, 2020
9532e62
refactor(ui): consolidate resource sorting into a single component
alexpaxton Apr 7, 2020
544a59f
refactor(ui): standardize tabbed page headers
alexpaxton Apr 8, 2020
eab158e
fix: use correct import paths
alexpaxton Apr 8, 2020
7c3d814
refactor(ui): implement resource sorting dropdown for variables
alexpaxton Apr 8, 2020
89e3b51
refactor(ui): implement sorting dropdown on labels list
alexpaxton Apr 8, 2020
26e246b
chore: delete unused stylesheet
alexpaxton Apr 8, 2020
1eea1ca
refactor: implement sort dropdown for templates list
alexpaxton Apr 8, 2020
bdaa3b1
refactor: implement sort dropdown on buckets list
alexpaxton Apr 8, 2020
0c4e544
refactor: update design of "what is a bucket?" card
alexpaxton Apr 8, 2020
00b6fe3
refactor: implement sort dropdowns in telegrafs list
alexpaxton Apr 8, 2020
53bdfb2
fix: appease linter
alexpaxton Apr 8, 2020
d94e89b
refactor: implement sort dropdown on scrapers list
alexpaxton Apr 8, 2020
7e8914c
chore: add testIDs to resource sorter
alexpaxton Apr 8, 2020
5ca4bde
fix: remove unused code
alexpaxton Apr 8, 2020
994a489
fix: update buckets and telegraf e2e tests
alexpaxton Apr 8, 2020
b4bc34c
fix: update labels e2e test
alexpaxton Apr 8, 2020
1dcb771
fix: update variables e2e test
alexpaxton Apr 8, 2020
0bc27d8
refactor: move dashboards list empty state into own component
alexpaxton Apr 8, 2020
7b643d4
fix: oops derp ayyyy
alexpaxton Apr 8, 2020
f6d1d62
chore: changelog
alexpaxton Apr 8, 2020
61b7b54
refactor: use more resource specific types for sort keys
alexpaxton Apr 8, 2020
729488e
Merge branch 'master' into feat/sorting-dropdowns
alexpaxton Apr 13, 2020
bf62d3f
Merge branch 'master' into feat/sorting-dropdowns
alexpaxton Apr 13, 2020
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## v2.0.0-beta.9
## v2.0.0-beta.9 [unreleased]

### Features

Expand All @@ -7,6 +7,7 @@
### UI Improvements

1. [17714](https://github.com/influxdata/influxdb/pull/17714): Cloud environments no longer render markdown images, for security reasons.
1. [17321](https://github.com/influxdata/influxdb/pull/17321): Improve UI for sorting resources

## v2.0.0-beta.8 [2020-04-10]

Expand Down
12 changes: 10 additions & 2 deletions ui/cypress/e2e/buckets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,25 @@ describe('Buckets', () => {
describe('Searching and Sorting', () => {
it('can sort by name and retention', () => {
const buckets = ['defbuck', '_tasks', '_monitoring']
cy.getByTestID('name-sorter')
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--name-desc').click()
})
.then(() => {
cy.get('[data-testid*="bucket-card"]').each((val, index) => {
const testID = val.attr('data-testid')
expect(testID).to.include(buckets[index])
})
})

cy.getByTestID('name-sorter')
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID(
'resource-sorter--retentionRules[0].everySeconds-desc'
).click()
})
.then(() => {
const asc_buckets = buckets.slice().sort()
cy.get('[data-testid*="bucket-card"]').each((val, index) => {
Expand Down
5 changes: 4 additions & 1 deletion ui/cypress/e2e/collectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ describe('Collectors', () => {
})
})

cy.getByTestID('name-sorter')
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--name-desc').click()
})
.then(() => {
// NOTE: this then is just here to let me scope this variable (alex)
const teletubbies = telegrafs
Expand Down
39 changes: 26 additions & 13 deletions ui/cypress/e2e/labels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ describe('labels', () => {
}
})

cy.getByTestID('sorter--name').click()
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--name-desc').click()
})

// check sort desc
cy.getByTestIDSubStr('label--pill').then(labels => {
Expand All @@ -296,7 +300,11 @@ describe('labels', () => {
})

// reset to asc
cy.getByTestID('sorter--name').click()
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--name-asc').click()
})

cy.getByTestIDSubStr('label--pill').then(labels => {
for (let i = 0; i < labels.length; i++) {
Expand Down Expand Up @@ -332,27 +340,32 @@ describe('labels', () => {
a.description < b.description ? -1 : a.description > b.description ? 1 : 0
)
// check sort asc
cy.getByTestID('sorter--desc').click()
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--properties.description-asc').click()
})

cy.getByTestIDSubStr('resource-card').then(labels => {
cy.getByTestID('label-card').then(labels => {
for (let i = 0; i < labels.length; i++) {
cy.getByTestIDSubStr('resource-card')
cy.getByTestID('label-card--description')
.eq(i)
.should('have.text', 'Description: ' + names[i].description)
.should('have.text', names[i].description)
}
})

// check sort desc
cy.getByTestID('sorter--desc').click()
cy.getByTestID('resource-sorter--button')
.click()
.then(() => {
cy.getByTestID('resource-sorter--properties.description-desc').click()
})

cy.getByTestIDSubStr('resource-card').then(labels => {
cy.getByTestID('label-card').then(labels => {
for (let i = 0; i < labels.length; i++) {
cy.getByTestIDSubStr('resource-card')
cy.getByTestID('label-card--description')
.eq(i)
.should(
'have.text',
'Description: ' + names[labels.length - (i + 1)].description
)
.should('have.text', names[labels.length - (i + 1)].description)
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion ui/cypress/e2e/variables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Variables', () => {
})

it('keeps user input in text area when attempting to import invalid JSON', () => {
cy.get('.tabbed-page-section--header').within(() => {
cy.getByTestID('tabbed-page--header').within(() => {
cy.contains('Create').click()
})

Expand Down
32 changes: 20 additions & 12 deletions ui/src/authorizations/components/TokensTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,28 @@ class TokensTab extends PureComponent<Props, State> {
const {searchTerm, sortKey, sortDirection, sortType} = this.state
const {tokens} = this.props

const leftHeaderItems = (
<SearchWidget
searchTerm={searchTerm}
placeholderText="Filter Tokens..."
onSearch={this.handleChangeSearchTerm}
testID="input-field--filter"
/>
)

const rightHeaderItems = (
<GenerateTokenDropdown
onSelectAllAccess={this.handleGenerateAllAccess}
onSelectReadWrite={this.handleGenerateReadWrite}
/>
)

return (
<>
<TabbedPageHeader>
<SearchWidget
searchTerm={searchTerm}
placeholderText="Filter Tokens..."
onSearch={this.handleChangeSearchTerm}
testID="input-field--filter"
/>
<GenerateTokenDropdown
onSelectAllAccess={this.handleGenerateAllAccess}
onSelectReadWrite={this.handleGenerateReadWrite}
/>
</TabbedPageHeader>
<TabbedPageHeader
childrenLeft={leftHeaderItems}
childrenRight={rightHeaderItems}
/>
<FilterAuthorizations
list={tokens}
searchTerm={searchTerm}
Expand Down
9 changes: 0 additions & 9 deletions ui/src/buckets/components/BucketAddDataButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,3 @@
.system-bucket {
color: mix($c-honeydew, $g13-mist);
}

.buckets-buttons-wrap {
display: flex;
box-sizing: border-box;
text-align: right;
@media screen and (max-width: 680px) {
margin: 8px auto 0;
}
}
4 changes: 2 additions & 2 deletions ui/src/buckets/components/BucketExplainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import React, {FunctionComponent} from 'react'

// Components
import {Panel, InfluxColors} from '@influxdata/clockface'
import {Panel, Gradients} from '@influxdata/clockface'

const BucketExplainer: FunctionComponent = () => (
<Panel backgroundColor={InfluxColors.Smoke} style={{marginTop: '32px'}}>
<Panel gradient={Gradients.PolarExpress} border={true}>
<Panel.Header>
<h5>What is a Bucket?</h5>
</Panel.Header>
Expand Down
38 changes: 5 additions & 33 deletions ui/src/buckets/components/BucketList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {Sort} from '@influxdata/clockface'
// Utils
import {SortTypes} from 'src/shared/utils/sort'

type SortKey = keyof Bucket | 'retentionRules[0].everySeconds'

interface Props {
buckets: Bucket[]
emptyState: JSX.Element
Expand All @@ -29,9 +27,6 @@ interface Props {
sortKey: string
sortDirection: Sort
sortType: SortTypes
onClickColumn: (
sortType: SortTypes
) => (nextSort: Sort, sortKey: SortKey) => void
}

class BucketList extends PureComponent<Props & WithRouterProps> {
Expand All @@ -40,38 +35,15 @@ class BucketList extends PureComponent<Props & WithRouterProps> {
)

public render() {
const {sortKey, sortDirection, onClickColumn} = this.props
return (
<>
<ResourceList>
<ResourceList.Header>
<ResourceList.Sorter
name="Name"
sortKey={this.headerKeys[0]}
sort={sortKey === this.headerKeys[0] ? sortDirection : Sort.None}
onClick={onClickColumn(SortTypes.String)}
testID="name-sorter"
/>
<ResourceList.Sorter
name="Retention"
sortKey={this.headerKeys[1]}
sort={sortKey === this.headerKeys[1] ? sortDirection : Sort.None}
onClick={onClickColumn(SortTypes.Float)}
testID="retention-sorter"
/>
</ResourceList.Header>
<ResourceList.Body emptyState={this.props.emptyState}>
{this.listBuckets}
</ResourceList.Body>
</ResourceList>
</>
<ResourceList>
<ResourceList.Body emptyState={this.props.emptyState}>
{this.listBuckets}
</ResourceList.Body>
</ResourceList>
)
}

private get headerKeys(): SortKey[] {
return ['name', 'retentionRules[0].everySeconds']
}

private get listBuckets(): JSX.Element[] {
const {
buckets,
Expand Down
Loading