mirror of https://github.com/portainer/portainer
feat(edge/stacks): default refresh rate to 10s [EE-7155] (#11891)
parent
eb6d251a73
commit
b0e3afa0b6
|
@ -53,10 +53,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 })),
|
||||
};
|
||||
|
@ -68,10 +69,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 })),
|
||||
};
|
||||
|
@ -113,6 +115,7 @@ export function createPersistedStore<T extends BasicTableSettings>(
|
|||
}) as T,
|
||||
{
|
||||
name: keyBuilder(`datatable_settings_${storageKey}`),
|
||||
version: 1,
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
@ -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),
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue