1
0
Fork 0
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:
Ali 2023-03-03 14:47:10 +13:00 committed by GitHub
parent 769c8372fb
commit fd916bc8a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 692 additions and 285 deletions

View 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,
}
)
);