mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
refactor(docker/images): convert table to react [EE-4668] (#8910)
This commit is contained in:
parent
0e9902fee9
commit
ecd54ab929
26 changed files with 496 additions and 441 deletions
|
@ -2,22 +2,11 @@ import { useMemo, useState } from 'react';
|
|||
import { useStore } from 'zustand';
|
||||
|
||||
import { useSearchBarState } from './SearchBar';
|
||||
import { BasicTableSettings, createPersistedStore } from './types';
|
||||
|
||||
/** this class is just a dummy class to get return type of createPersistedStore
|
||||
* can be fixed after upgrade to ts 4.7+
|
||||
* https://stackoverflow.com/a/64919133
|
||||
*/
|
||||
class Wrapper<T extends BasicTableSettings> {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
wrapped() {
|
||||
return createPersistedStore<T>('', '');
|
||||
}
|
||||
}
|
||||
import { BasicTableSettings, CreatePersistedStoreReturn } from './types';
|
||||
|
||||
export function useTableState<
|
||||
TSettings extends BasicTableSettings = BasicTableSettings
|
||||
>(store: ReturnType<Wrapper<TSettings>['wrapped']>, storageKey: string) {
|
||||
>(store: CreatePersistedStoreReturn<TSettings>, storageKey: string) {
|
||||
const settings = useStore(store);
|
||||
|
||||
const [search, setSearch] = useSearchBarState(storageKey);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue