mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
feat(gpu): rework docker GPU for UI performance [EE-4918] (#8518)
This commit is contained in:
parent
769c8372fb
commit
fd916bc8a2
52 changed files with 692 additions and 285 deletions
35
app/react/components/InsightsBox/insights-store.ts
Normal file
35
app/react/components/InsightsBox/insights-store.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { createStore } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
|
||||
import { keyBuilder } from '@/react/hooks/useLocalStorage';
|
||||
|
||||
interface InsightsStore {
|
||||
insightIDsClosed: string[];
|
||||
addInsightIDClosed: (insightIDClosed: string) => void;
|
||||
isClosed: (insightID?: string) => boolean;
|
||||
}
|
||||
|
||||
export const insightStore = createStore<InsightsStore>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
insightIDsClosed: [],
|
||||
addInsightIDClosed: (insightIDClosed: string) => {
|
||||
set((state) => {
|
||||
const currentIDsClosed = state.insightIDsClosed || [];
|
||||
return { insightIDsClosed: [...currentIDsClosed, insightIDClosed] };
|
||||
});
|
||||
},
|
||||
isClosed: (insightID?: string) => {
|
||||
if (!insightID) {
|
||||
return false;
|
||||
}
|
||||
const currentIDsClosed = get().insightIDsClosed || [];
|
||||
return currentIDsClosed.includes(insightID);
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: keyBuilder('insightIDsClosed'),
|
||||
getStorage: () => localStorage,
|
||||
}
|
||||
)
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue