Skip to content

Commit

Permalink
feat(edge/stacks): default refresh rate to 10s [EE-7155] (#11890)
Browse files Browse the repository at this point in the history
  • Loading branch information
chiptus authored Jun 9, 2024
1 parent 4fd4aa8 commit c4235c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions app/react/components/datatables/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ export interface SettableColumnsTableSettings {
}

export function hiddenColumnsSettings<T extends SettableColumnsTableSettings>(
set: ZustandSetFunc<T>
set: ZustandSetFunc<T>,
initialHiddenColumns: string[] = []
): SettableColumnsTableSettings {
return {
hiddenColumns: [],
hiddenColumns: initialHiddenColumns,
setHiddenColumns: (hiddenColumns: string[]) =>
set((s) => ({ ...s, hiddenColumns })),
};
Expand All @@ -67,10 +68,11 @@ export interface RefreshableTableSettings {
}

export function refreshableSettings<T extends RefreshableTableSettings>(
set: ZustandSetFunc<T>
set: ZustandSetFunc<T>,
autoRefreshRate = 0
): RefreshableTableSettings {
return {
autoRefreshRate: 0,
autoRefreshRate,
setAutoRefreshRate: (autoRefreshRate: number) =>
set((s) => ({ ...s, autoRefreshRate })),
};
Expand All @@ -96,6 +98,7 @@ export function createPersistedStore<T extends BasicTableSettings>(
}) as T,
{
name: keyBuilder(`datatable_settings_${storageKey}`),
version: 1,
}
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export interface TableSettings
SettableColumnsTableSettings,
RefreshableTableSettings {}

export function createStore(storageKey: string) {
export function createStore(
storageKey: string,
initialHiddenColumns: string[] = []
) {
return createPersistedStore<TableSettings>(storageKey, 'name', (set) => ({
...hiddenColumnsSettings(set),
...refreshableSettings(set),
...hiddenColumnsSettings(set, initialHiddenColumns),
...refreshableSettings(set, 10),
}));
}

0 comments on commit c4235c8

Please sign in to comment.