Compare commits

..
Author SHA1 Message Date
hibigandgithub-actions[bot] 8e832e0b0e chore: bump @gpustack/core-ui to v1.0.36 2026-07-14 11:44:44 +00:00
26 changed files with 49 additions and 62 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
import { nsLocalJSONStorage } from '@gpustack/core-ui/utils';
import { getDefaultStore } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
@@ -9,7 +8,7 @@ export interface PaginationState {
export const paginationAtom = atomWithStorage<Record<string, any>>(
'paginationStatus',
{},
nsLocalJSONStorage,
undefined,
{ getOnInit: true }
);
+7 -10
View File
@@ -1,5 +1,4 @@
import { COLOR_PRIMARY } from '@/config/theme';
import { nsLocal, nsLocalJSONStorage } from '@gpustack/core-ui/utils';
import { atom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
@@ -24,7 +23,9 @@ export const defaultSettings: UserSettings = {
export const getStorageUserSettings = () => {
if (typeof window === 'undefined') return defaultSettings;
try {
const savedSettings = JSON.parse(nsLocal.get('userSettings') || '{}');
const savedSettings = JSON.parse(
localStorage.getItem('userSettings') || '{}'
);
return {
...defaultSettings,
...savedSettings
@@ -34,13 +35,9 @@ export const getStorageUserSettings = () => {
}
};
export const userSettingsAtom = atomWithStorage<UserSettings>(
'userSettings',
{
...getStorageUserSettings()
},
nsLocalJSONStorage
);
export const userSettingsAtom = atomWithStorage<UserSettings>('userSettings', {
...getStorageUserSettings()
});
export const userSettingsHelperAtom = atom(
(get) => get(userSettingsAtom),
@@ -62,6 +59,6 @@ export const hideModalTemporarilyAtom = atom<boolean>(false);
export const collapsedMenuGroupsAtom = atomWithStorage<string[]>(
'collapsedMenuGroups',
[],
nsLocalJSONStorage,
undefined,
{ getOnInit: true }
);
+1 -3
View File
@@ -1,11 +1,9 @@
import { nsLocalJSONStorage } from '@gpustack/core-ui/utils';
import { getDefaultStore } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export const tabActiveAtom = atomWithStorage<Map<string, any>>(
'tabActiveStatus',
new Map(),
nsLocalJSONStorage
new Map()
);
export const setActiveStatus = (key: string, value: any) => {
+4 -10
View File
@@ -1,12 +1,7 @@
import { nsLocal, nsLocalJSONStorage } from '@gpustack/core-ui/utils';
import { atom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export const userAtom = atomWithStorage<any>(
'userInfo',
null,
nsLocalJSONStorage
);
export const userAtom = atomWithStorage<any>('userInfo', null);
// Backs the `currentOrganizationId` localStorage key. Stays null in
// builds with no Org context (single-tenant), and is shared with any
@@ -14,8 +9,7 @@ export const userAtom = atomWithStorage<any>(
// without one side having to import from the other.
export const currentOrganizationIdAtom = atomWithStorage<number | null>(
'currentOrganizationId',
null,
nsLocalJSONStorage
null
);
export const GPUStackVersionAtom = atom<{
@@ -76,7 +70,7 @@ export const getCurrentOrgNamespace = (
const getStoredCurrentOrgId = (): number | null => {
try {
const raw = nsLocal.get('currentOrganizationId');
const raw = localStorage.getItem('currentOrganizationId');
if (!raw) return null;
const value = JSON.parse(raw);
return typeof value === 'number' ? value : null;
@@ -114,7 +108,7 @@ export const getOrgById = (
const target = String(id);
for (const key of ORG_CACHE_KEYS) {
try {
const raw = nsLocal.get(key);
const raw = localStorage.getItem(key);
if (!raw) continue;
const list = JSON.parse(raw) as CachedOrg[];
if (!Array.isArray(list)) continue;
+5 -4
View File
@@ -1,17 +1,18 @@
import { defaultSettings } from '@/atoms/settings';
import { nsLocal } from '@gpustack/core-ui/utils';
import { getDefaultStore } from 'jotai';
export const clearStorageUserSettings = () => {
try {
const savedSettings = JSON.parse(nsLocal.get('userSettings') || '{}');
const savedSettings = JSON.parse(
localStorage.getItem('userSettings') || '{}'
);
// colorPrimary is an enterprise-wide branding setting (set by admins
// and applied by `onAppInit` from /enterprise/settings), not a per-user
// preference. Preserve it across login — otherwise the next layout
// mount triggers `atomWithStorage.onMount`, re-reads localStorage,
// and falls back to the default color until a full page refresh
// re-runs `applyEnterpriseSettings`.
nsLocal.set(
localStorage.setItem(
'userSettings',
JSON.stringify({
...savedSettings,
@@ -25,7 +26,7 @@ export const clearStorageUserSettings = () => {
export const resetStorageUserSettings = () => {
try {
nsLocal.set(
localStorage.setItem(
'userSettings',
JSON.stringify({
...defaultSettings,
+5 -3
View File
@@ -1,6 +1,5 @@
import externalLinks from '@/constants/external-links';
import { GithubFilled } from '@ant-design/icons';
import { nsLocal } from '@gpustack/core-ui/utils';
import { useIntl } from '@umijs/max';
import { Tooltip } from 'antd';
import { useEffect, useState } from 'react';
@@ -67,7 +66,7 @@ type CacheEntry = { value: number; time: number };
const readCache = (): CacheEntry | null => {
try {
const raw = nsLocal.get(CACHE_KEY);
const raw = localStorage.getItem(CACHE_KEY);
if (!raw) return null;
const parsed = JSON.parse(raw);
if (typeof parsed?.value !== 'number' || typeof parsed?.time !== 'number') {
@@ -81,7 +80,10 @@ const readCache = (): CacheEntry | null => {
const writeCache = (value: number) => {
try {
nsLocal.set(CACHE_KEY, JSON.stringify({ value, time: Date.now() }));
localStorage.setItem(
CACHE_KEY,
JSON.stringify({ value, time: Date.now() })
);
} catch {
// ignore quota errors
}
-1
View File
@@ -183,7 +183,6 @@ const APIKeys: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -164,7 +164,6 @@ const CommunityBackends: React.FC<{
renderItem={renderItem}
></BackendCardList>
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -282,7 +282,6 @@ const BackendList = () => {
onSelect={handleOnSelect}
></BackendCardList>
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -177,7 +177,6 @@ const Benchmark: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={[]}
@@ -157,7 +157,6 @@ const Credentials: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={[]}
@@ -271,7 +271,6 @@ const GPUService: React.FC = () => {
if (!clusterLoading && !hasK8sCluster) {
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading || clusterLoading}
loadend={dataSource.loadend}
dataSource={[]}
@@ -295,7 +294,6 @@ const GPUService: React.FC = () => {
}
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -110,7 +110,6 @@ const GPUServicePublicKeys: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -104,7 +104,6 @@ const GPUServiceStorageTypes: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -109,7 +109,6 @@ const GPUServiceStorage: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -210,7 +210,6 @@ const GPUServiceTemplates: React.FC = () => {
onSelect={handleOnSelect}
/>
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -166,7 +166,6 @@ const Catalog: React.FC = () => {
isFirst={!dataSource.loadend}
></CatalogList>
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -95,7 +95,6 @@ const useNoResourceResult = (props: {
const noResourceResult = (
<NoResult
minHeight="calc(100vh - 300px)"
loading={loading}
loadend={loadend}
dataSource={dataSource}
@@ -109,7 +109,6 @@ const InstanceView = forwardRef((props, ref) => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -121,7 +121,6 @@ const MaasProvider: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -381,7 +381,6 @@ const ModelRoutes: React.FC = () => {
expandable={true}
empty={
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -72,7 +72,6 @@ const GPUList: React.FC<GPUListProps> = ({ clusterId, source }) => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
@@ -233,7 +233,6 @@ const ModelFiles = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
-1
View File
@@ -141,7 +141,6 @@ const Users: React.FC = () => {
if (type !== 'Table') return;
return (
<NoResult
minHeight="calc(100vh - 300px)"
loading={dataSource.loading}
loadend={dataSource.loadend}
dataSource={dataSource.dataList}
+24 -8
View File
@@ -10,7 +10,6 @@
import { queryClusterList } from '@/pages/cluster-management/apis';
import { ProviderValueMap } from '@/pages/cluster-management/config';
import { queryResourceEvents } from '@/pages/usage/apis/resource';
import { nsSession } from '@gpustack/core-ui/utils';
// Probes the caller's cluster list once so access predicates can gate
// GPU Service (Kubernetes-only). Cheap (one list request) and never
@@ -34,13 +33,20 @@ export const probeHasKubernetesCluster = async (): Promise<
const value = (res?.items ?? []).some(
(c) => c?.provider === ProviderValueMap.Kubernetes
);
// nsSession swallows write errors (Safari private mode); the access
// predicate already handles a missing value as "unknown".
nsSession.set(HAS_K8S_CLUSTER_KEY, JSON.stringify(value));
try {
window.sessionStorage.setItem(HAS_K8S_CLUSTER_KEY, JSON.stringify(value));
} catch {
// sessionStorage may be unavailable (Safari private mode); the
// access predicate already handles a missing value as "unknown".
}
return value;
} catch (error) {
console.error('probeHasKubernetesCluster error', error);
nsSession.remove(HAS_K8S_CLUSTER_KEY);
try {
window.sessionStorage.removeItem(HAS_K8S_CLUSTER_KEY);
} catch {
// ignore
}
return undefined;
}
};
@@ -63,12 +69,22 @@ export const probeHasResourceEvents = async (): Promise<
}
);
const value = (res?.pagination?.total ?? 0) > 0;
// nsSession swallows write errors; predicate treats missing as unknown.
nsSession.set(HAS_RESOURCE_EVENTS_KEY, JSON.stringify(value));
try {
window.sessionStorage.setItem(
HAS_RESOURCE_EVENTS_KEY,
JSON.stringify(value)
);
} catch {
// sessionStorage may be unavailable; predicate treats missing as unknown.
}
return value;
} catch (error) {
console.error('probeHasResourceEvents error', error);
nsSession.remove(HAS_RESOURCE_EVENTS_KEY);
try {
window.sessionStorage.removeItem(HAS_RESOURCE_EVENTS_KEY);
} catch {
// ignore
}
return undefined;
}
};
+2 -3
View File
@@ -1,4 +1,3 @@
import { NS_STORE_NAME } from '@gpustack/core-ui/utils';
import localStore from './store';
const IS_FIRST_LOGIN = 'is_first_login';
@@ -6,7 +5,7 @@ const IS_FIRST_LOGIN = 'is_first_login';
const REMEMBER_ME_KEY = 'r_m';
const CRYPT_TEXT = 'seal';
const store = localStore.createInstance({ name: NS_STORE_NAME });
const store = localStore.createInstance({ name: '_xWXJKJ_S1Sna_' });
// Kept to remove credentials saved by the old "remember me" feature.
const removeRememberMe = (key: string) => {
@@ -38,9 +37,9 @@ const writeColumnSettings = (key: string, data: any) => {
export {
CRYPT_TEXT,
IS_FIRST_LOGIN,
REMEMBER_ME_KEY,
readColumnSettings,
readState,
REMEMBER_ME_KEY,
removeRememberMe,
writeColumnSettings,
writeState