-
Notifications
You must be signed in to change notification settings - Fork 7
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(Storage): sort on backend #510
Conversation
@@ -91,6 +94,7 @@ const storage: Reducer<StorageState, StorageAction> = (state = initialState, act | |||
return { | |||
...state, | |||
visible: action.data, | |||
usageFilter: [], |
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.
Reset usage filter on selector change. This fixes the bug when you select some values in storage filter and then change selector to some value (e.g. "Out of space"), and receive empty table with no opportunity to update the selector
groupsSortValue?: StorageSortValue; | ||
groupsSortOrder?: OrderType; | ||
nodesSortValue?: NodesSortValue; | ||
nodesSortOrder?: OrderType; |
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.
I split groups and nodes sort params to ensure more strict typing and reduce number of conditions connected with currently selected entity type
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.
Moreover I'd better split this into two different reducers in the end.
let defaultSortValue: StorageSortValue = STORAGE_SORT_VALUES.PoolName; | ||
let defaultSortOrder: OrderType = ASCENDING; | ||
|
||
if (visibleEntities === VISIBLE_ENTITIES.missing) { | ||
defaultSortValue = STORAGE_SORT_VALUES.Degraded; | ||
defaultSortOrder = DESCENDING; | ||
} | ||
|
||
if (visibleEntities === VISIBLE_ENTITIES.space) { | ||
defaultSortValue = STORAGE_SORT_VALUES.Usage; | ||
defaultSortOrder = DESCENDING; | ||
} |
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.
These default values previously was set in StorageGroups
.
Changed UsedSpaceFlag
to Usage
since UsedSpaceFlag
cannot be sorted via request params
const defaultSortValue: NodesSortValue = NODES_SORT_VALUES.NodeId; | ||
const defaultSortOrder: OrderType = ASCENDING; | ||
|
||
return { | ||
sortValue: state.storage.nodesSortValue || defaultSortValue, | ||
sortOrder: state.storage.nodesSortOrder || defaultSortOrder, | ||
}; |
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.
These default values previously was set in StorageNodes
.
Removed sorting by Degraded
disks since this values cannot be sorted via request params
if (visibleEntities !== VISIBLE_ENTITIES.missing) { | ||
columns = columns.filter((col) => col.name !== TableColumnsIds.Missing); |
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.
Do not display Missing
column both for All
and Out of space
radio values
const TableColumnsIds = { | ||
NodeId: 'NodeId', | ||
Host: 'Host', | ||
DC: 'DC', | ||
Rack: 'Rack', | ||
Uptime: 'Uptime', | ||
PDisks: 'PDisks', | ||
Missing: 'Missing', | ||
} as const; |
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.
Updated names, so they correspond to NODES_SORT_VALUES
const TableColumnsIds = { | ||
PoolName: 'PoolName', | ||
Kind: 'Kind', | ||
Erasure: 'Erasure', | ||
GroupId: 'GroupId', | ||
Used: 'Used', | ||
Limit: 'Limit', | ||
Usage: 'Usage', | ||
UsedSpaceFlag: 'UsedSpaceFlag', | ||
Read: 'Read', | ||
Write: 'Write', | ||
VDisks: 'VDisks', | ||
Degraded: 'Degraded', | ||
} as const; |
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.
Updated names, so they correspond to STORAGE_SORT_VALUES
@@ -50,11 +58,6 @@ import './Storage.scss'; | |||
|
|||
const b = cn('global-storage'); | |||
|
|||
const tableSettings: Settings = { | |||
...DEFAULT_TABLE_SETTINGS, | |||
defaultOrder: DataTable.DESCENDING, |
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.
Default order values are set in sort params selectors
@@ -155,19 +174,23 @@ export const Storage = ({additionalNodesInfo, tenant, nodeId}: StorageProps) => | |||
<StorageGroups |
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.
Lets make an issue to refactor Storage component - now its a little mess with different storage types, as for me it should be splitted.
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.
groupsSortValue?: StorageSortValue; | ||
groupsSortOrder?: OrderType; | ||
nodesSortValue?: NodesSortValue; | ||
nodesSortOrder?: OrderType; |
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.
Moreover I'd better split this into two different reducers in the end.
No description provided.