mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Save sorting order when changing view (#2353)
Signed-off-by: vshakirova <vshakirova@mirantis.com>
This commit is contained in:
1 parent
48ea877cd5
commit
33c405bdcf
8 files changed
+44
-11
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { createStorage } from "../../utils";
|
||||
import { TableSortParams } from "./table";
|
||||
|
||||
export interface TableStorageModel {
|
||||
sortParams: {
|
||||
[tableId: string]: Partial<TableSortParams>;
|
||||
}
|
||||
}
|
||||
|
||||
export const tableStorage = createStorage<TableStorageModel>("table_settings", {
|
||||
sortParams: {}
|
||||
});
|
||||
|
||||
export function getSortParams(tableId: string): Partial<TableSortParams> {
|
||||
return tableStorage.get().sortParams[tableId];
|
||||
}
|
||||
|
||||
export function setSortParams(tableId: string, sortParams: Partial<TableSortParams>) {
|
||||
tableStorage.merge(draft => {
|
||||
draft.sortParams[tableId] = sortParams;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user