-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Zs sortbyseconds #14923 #15728
Zs sortbyseconds #14923 #15728
Changes from 6 commits
0c41231
f30240a
af8943e
fd09f26
f37ea3b
c11fc49
d643f07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import {SortTypes} from 'src/shared/utils/sort' | |
// Utils | ||
import {prettyBuckets} from 'src/shared/utils/prettyBucket' | ||
|
||
type SortKey = keyof PrettyBucket | ||
type SortKey = keyof PrettyBucket | 'retentionRules[0].everySeconds' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is kind of setting off a spidey sense - seems like we're coupling the state and shape of our redux store to a value type - the end result is that the sorting code relies on the precise shape and existence of the store having a first item in here's the thing though, i know you didn't make this pattern, and i don't know of a better way to do this without changing a lot of code, so i can't really do more than say keep en eye out on this sorting code cause it might break unexpectedly. (said without judgement of the quality of the code or the circumstances it was written under :)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hopefully is things go south the tests will catch it, but yeah it is slightly concerning, but i dont think right now is the time to refactor all the logic. Well keep an eye to see if any related issues rear their head |
||
|
||
interface OwnProps { | ||
buckets: PrettyBucket[] | ||
|
@@ -37,7 +37,9 @@ interface OwnProps { | |
sortKey: string | ||
sortDirection: Sort | ||
sortType: SortTypes | ||
onClickColumn: (mextSort: Sort, sortKey: SortKey) => void | ||
onClickColumn: ( | ||
sortType: SortTypes | ||
) => (nextSort: Sort, sortKey: SortKey) => void | ||
} | ||
|
||
interface DispatchProps { | ||
|
@@ -73,7 +75,6 @@ class BucketList extends PureComponent<Props & WithRouterProps, State> { | |
|
||
public render() { | ||
const {emptyState, sortKey, sortDirection, onClickColumn} = this.props | ||
|
||
return ( | ||
<> | ||
<ResourceList> | ||
|
@@ -82,13 +83,15 @@ class BucketList extends PureComponent<Props & WithRouterProps, State> { | |
name="Name" | ||
sortKey={this.headerKeys[0]} | ||
sort={sortKey === this.headerKeys[0] ? sortDirection : Sort.None} | ||
onClick={onClickColumn} | ||
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} | ||
onClick={onClickColumn(SortTypes.Float)} | ||
testID="retention-sorter" | ||
/> | ||
</ResourceList.Header> | ||
<ResourceList.Body emptyState={emptyState}> | ||
|
@@ -100,7 +103,7 @@ class BucketList extends PureComponent<Props & WithRouterProps, State> { | |
} | ||
|
||
private get headerKeys(): SortKey[] { | ||
return ['name', 'ruleString'] | ||
return ['name', 'retentionRules[0].everySeconds'] | ||
} | ||
|
||
private get listBuckets(): JSX.Element[] { | ||
|
@@ -119,18 +122,20 @@ class BucketList extends PureComponent<Props & WithRouterProps, State> { | |
sortType | ||
) | ||
|
||
return sortedBuckets.map(bucket => ( | ||
<BucketCard | ||
key={bucket.id} | ||
bucket={bucket} | ||
onEditBucket={this.handleStartEdit} | ||
onDeleteBucket={onDeleteBucket} | ||
onDeleteData={this.handleStartDeleteData} | ||
onAddData={this.handleStartAddData} | ||
onUpdateBucket={this.handleUpdateBucket} | ||
onFilterChange={onFilterChange} | ||
/> | ||
)) | ||
return sortedBuckets.map(bucket => { | ||
return ( | ||
<BucketCard | ||
key={bucket.id} | ||
bucket={bucket} | ||
onEditBucket={this.handleStartEdit} | ||
onDeleteBucket={onDeleteBucket} | ||
onDeleteData={this.handleStartDeleteData} | ||
onAddData={this.handleStartAddData} | ||
onUpdateBucket={this.handleUpdateBucket} | ||
onFilterChange={onFilterChange} | ||
/> | ||
) | ||
}) | ||
} | ||
|
||
private handleStartEdit = (bucket: PrettyBucket) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a quick comment here explaining why we're skipping this please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding in comment! im going to make a new issue to address this failing test and another