Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb029a3e2a | ||
|
|
2dd287bbc1 | ||
|
|
3c00317aeb |
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
"@ant-design/pro-components": "3.1.0-0",
|
"@ant-design/pro-components": "3.1.0-0",
|
||||||
"@antv/g6": "^5.0.51",
|
"@antv/g6": "^5.0.51",
|
||||||
"@braintree/sanitize-url": "^7.1.1",
|
"@braintree/sanitize-url": "^7.1.1",
|
||||||
"@gpustack/core-ui": "^1.0.36",
|
"@gpustack/core-ui": "^1.0.37",
|
||||||
"@huggingface/gguf": "^0.1.7",
|
"@huggingface/gguf": "^0.1.7",
|
||||||
"@huggingface/hub": "^0.15.1",
|
"@huggingface/hub": "^0.15.1",
|
||||||
"@huggingface/tasks": "^0.11.6",
|
"@huggingface/tasks": "^0.11.6",
|
||||||
|
|||||||
Generated
+5
-5
@@ -24,8 +24,8 @@ importers:
|
|||||||
specifier: ^7.1.1
|
specifier: ^7.1.1
|
||||||
version: 7.1.2
|
version: 7.1.2
|
||||||
'@gpustack/core-ui':
|
'@gpustack/core-ui':
|
||||||
specifier: ^1.0.36
|
specifier: ^1.0.37
|
||||||
version: 1.0.36(czdvzceysqw7iv6pct2ucnb23e)
|
version: 1.0.37(czdvzceysqw7iv6pct2ucnb23e)
|
||||||
'@huggingface/gguf':
|
'@huggingface/gguf':
|
||||||
specifier: ^0.1.7
|
specifier: ^0.1.7
|
||||||
version: 0.1.18
|
version: 0.1.18
|
||||||
@@ -1481,8 +1481,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==, tarball: https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz}
|
resolution: {integrity: sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==, tarball: https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz}
|
||||||
deprecated: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
|
deprecated: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
|
||||||
|
|
||||||
'@gpustack/core-ui@1.0.36':
|
'@gpustack/core-ui@1.0.37':
|
||||||
resolution: {integrity: sha512-gF8ShMZ2SKYo3+skfsI3zo+aBSsXqKGMX+jWaKv81e38bDwJw71C33TR64d+6MyV9iUoFOoSK+ht1GefyvR17g==, tarball: https://registry.npmjs.org/@gpustack/core-ui/-/core-ui-1.0.36.tgz}
|
resolution: {integrity: sha512-eP9uD4Eg04i2S+AQMwVh/siX8EjfAsZTiuaybe73hNahuJXV6/gqd+67zzBq27lmZRpa4Ao5CSX8JSjz06AONA==, tarball: https://registry.npmjs.org/@gpustack/core-ui/-/core-ui-1.0.37.tgz}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@ant-design/icons': ^6.1.0
|
'@ant-design/icons': ^6.1.0
|
||||||
'@ant-design/pro-components': 3.1.0-0
|
'@ant-design/pro-components': 3.1.0-0
|
||||||
@@ -10802,7 +10802,7 @@ snapshots:
|
|||||||
|
|
||||||
'@formatjs/intl-utils@2.3.0': {}
|
'@formatjs/intl-utils@2.3.0': {}
|
||||||
|
|
||||||
'@gpustack/core-ui@1.0.36(czdvzceysqw7iv6pct2ucnb23e)':
|
'@gpustack/core-ui@1.0.37(czdvzceysqw7iv6pct2ucnb23e)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ant-design/icons': 6.2.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
'@ant-design/icons': 6.2.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@ant-design/pro-components': 3.1.0-0(antd@6.3.7(date-fns@2.30.0)(moment@2.30.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
'@ant-design/pro-components': 3.1.0-0(antd@6.3.7(date-fns@2.30.0)(moment@2.30.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes tableEmptyFadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.scroll-table {
|
.scroll-table {
|
||||||
.ant-table {
|
.ant-table {
|
||||||
.ant-table-container {
|
.ant-table-container {
|
||||||
@@ -18,5 +27,27 @@
|
|||||||
scrollbar-color: var(--color-scrollbar-thumb) transparent;
|
scrollbar-color: var(--color-scrollbar-thumb) transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reserve a stable block for the empty/loading state so the first-load
|
||||||
|
// spinner and the empty result occupy the same height as eventual data —
|
||||||
|
// this removes the layout jump when entering the page. Scoped to
|
||||||
|
// `.ant-table-content` so it only targets x-scroll tables (whose empty
|
||||||
|
// row lives here) and leaves fixed-height `scroll.y` tables untouched.
|
||||||
|
// Height must match the `minHeight` passed to <NoResult> in
|
||||||
|
// use-no-resource-result.
|
||||||
|
.ant-table-content {
|
||||||
|
.ant-table-placeholder {
|
||||||
|
> .ant-table-cell {
|
||||||
|
height: calc(100vh - 300px);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NoResult renders nothing while loading and mounts an <Empty> only
|
||||||
|
// once the request settles, so this fires exactly when the empty
|
||||||
|
// state appears — a seamless fade-in instead of a hard pop.
|
||||||
|
.ant-empty {
|
||||||
|
animation: tableEmptyFadeIn 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { nsLocalJSONStorage } from '@gpustack/core-ui/utils';
|
|
||||||
import { getDefaultStore } from 'jotai';
|
import { getDefaultStore } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ export interface PaginationState {
|
|||||||
export const paginationAtom = atomWithStorage<Record<string, any>>(
|
export const paginationAtom = atomWithStorage<Record<string, any>>(
|
||||||
'paginationStatus',
|
'paginationStatus',
|
||||||
{},
|
{},
|
||||||
nsLocalJSONStorage,
|
undefined,
|
||||||
{ getOnInit: true }
|
{ getOnInit: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { COLOR_PRIMARY } from '@/config/theme';
|
import { COLOR_PRIMARY } from '@/config/theme';
|
||||||
import { nsLocal, nsLocalJSONStorage } from '@gpustack/core-ui/utils';
|
|
||||||
import { atom } from 'jotai';
|
import { atom } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
@@ -24,7 +23,9 @@ export const defaultSettings: UserSettings = {
|
|||||||
export const getStorageUserSettings = () => {
|
export const getStorageUserSettings = () => {
|
||||||
if (typeof window === 'undefined') return defaultSettings;
|
if (typeof window === 'undefined') return defaultSettings;
|
||||||
try {
|
try {
|
||||||
const savedSettings = JSON.parse(nsLocal.get('userSettings') || '{}');
|
const savedSettings = JSON.parse(
|
||||||
|
localStorage.getItem('userSettings') || '{}'
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
...defaultSettings,
|
...defaultSettings,
|
||||||
...savedSettings
|
...savedSettings
|
||||||
@@ -34,13 +35,9 @@ export const getStorageUserSettings = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const userSettingsAtom = atomWithStorage<UserSettings>(
|
export const userSettingsAtom = atomWithStorage<UserSettings>('userSettings', {
|
||||||
'userSettings',
|
|
||||||
{
|
|
||||||
...getStorageUserSettings()
|
...getStorageUserSettings()
|
||||||
},
|
});
|
||||||
nsLocalJSONStorage
|
|
||||||
);
|
|
||||||
|
|
||||||
export const userSettingsHelperAtom = atom(
|
export const userSettingsHelperAtom = atom(
|
||||||
(get) => get(userSettingsAtom),
|
(get) => get(userSettingsAtom),
|
||||||
@@ -62,6 +59,6 @@ export const hideModalTemporarilyAtom = atom<boolean>(false);
|
|||||||
export const collapsedMenuGroupsAtom = atomWithStorage<string[]>(
|
export const collapsedMenuGroupsAtom = atomWithStorage<string[]>(
|
||||||
'collapsedMenuGroups',
|
'collapsedMenuGroups',
|
||||||
[],
|
[],
|
||||||
nsLocalJSONStorage,
|
undefined,
|
||||||
{ getOnInit: true }
|
{ getOnInit: true }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { nsLocalJSONStorage } from '@gpustack/core-ui/utils';
|
|
||||||
import { getDefaultStore } from 'jotai';
|
import { getDefaultStore } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
export const tabActiveAtom = atomWithStorage<Map<string, any>>(
|
export const tabActiveAtom = atomWithStorage<Map<string, any>>(
|
||||||
'tabActiveStatus',
|
'tabActiveStatus',
|
||||||
new Map(),
|
new Map()
|
||||||
nsLocalJSONStorage
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export const setActiveStatus = (key: string, value: any) => {
|
export const setActiveStatus = (key: string, value: any) => {
|
||||||
|
|||||||
+4
-10
@@ -1,12 +1,7 @@
|
|||||||
import { nsLocal, nsLocalJSONStorage } from '@gpustack/core-ui/utils';
|
|
||||||
import { atom } from 'jotai';
|
import { atom } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
export const userAtom = atomWithStorage<any>(
|
export const userAtom = atomWithStorage<any>('userInfo', null);
|
||||||
'userInfo',
|
|
||||||
null,
|
|
||||||
nsLocalJSONStorage
|
|
||||||
);
|
|
||||||
|
|
||||||
// Backs the `currentOrganizationId` localStorage key. Stays null in
|
// Backs the `currentOrganizationId` localStorage key. Stays null in
|
||||||
// builds with no Org context (single-tenant), and is shared with any
|
// 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.
|
// without one side having to import from the other.
|
||||||
export const currentOrganizationIdAtom = atomWithStorage<number | null>(
|
export const currentOrganizationIdAtom = atomWithStorage<number | null>(
|
||||||
'currentOrganizationId',
|
'currentOrganizationId',
|
||||||
null,
|
null
|
||||||
nsLocalJSONStorage
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export const GPUStackVersionAtom = atom<{
|
export const GPUStackVersionAtom = atom<{
|
||||||
@@ -76,7 +70,7 @@ export const getCurrentOrgNamespace = (
|
|||||||
|
|
||||||
const getStoredCurrentOrgId = (): number | null => {
|
const getStoredCurrentOrgId = (): number | null => {
|
||||||
try {
|
try {
|
||||||
const raw = nsLocal.get('currentOrganizationId');
|
const raw = localStorage.getItem('currentOrganizationId');
|
||||||
if (!raw) return null;
|
if (!raw) return null;
|
||||||
const value = JSON.parse(raw);
|
const value = JSON.parse(raw);
|
||||||
return typeof value === 'number' ? value : null;
|
return typeof value === 'number' ? value : null;
|
||||||
@@ -114,7 +108,7 @@ export const getOrgById = (
|
|||||||
const target = String(id);
|
const target = String(id);
|
||||||
for (const key of ORG_CACHE_KEYS) {
|
for (const key of ORG_CACHE_KEYS) {
|
||||||
try {
|
try {
|
||||||
const raw = nsLocal.get(key);
|
const raw = localStorage.getItem(key);
|
||||||
if (!raw) continue;
|
if (!raw) continue;
|
||||||
const list = JSON.parse(raw) as CachedOrg[];
|
const list = JSON.parse(raw) as CachedOrg[];
|
||||||
if (!Array.isArray(list)) continue;
|
if (!Array.isArray(list)) continue;
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import { defaultSettings } from '@/atoms/settings';
|
import { defaultSettings } from '@/atoms/settings';
|
||||||
import { nsLocal } from '@gpustack/core-ui/utils';
|
|
||||||
import { getDefaultStore } from 'jotai';
|
import { getDefaultStore } from 'jotai';
|
||||||
|
|
||||||
export const clearStorageUserSettings = () => {
|
export const clearStorageUserSettings = () => {
|
||||||
try {
|
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
|
// colorPrimary is an enterprise-wide branding setting (set by admins
|
||||||
// and applied by `onAppInit` from /enterprise/settings), not a per-user
|
// and applied by `onAppInit` from /enterprise/settings), not a per-user
|
||||||
// preference. Preserve it across login — otherwise the next layout
|
// preference. Preserve it across login — otherwise the next layout
|
||||||
// mount triggers `atomWithStorage.onMount`, re-reads localStorage,
|
// mount triggers `atomWithStorage.onMount`, re-reads localStorage,
|
||||||
// and falls back to the default color until a full page refresh
|
// and falls back to the default color until a full page refresh
|
||||||
// re-runs `applyEnterpriseSettings`.
|
// re-runs `applyEnterpriseSettings`.
|
||||||
nsLocal.set(
|
localStorage.setItem(
|
||||||
'userSettings',
|
'userSettings',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
...savedSettings,
|
...savedSettings,
|
||||||
@@ -25,7 +26,7 @@ export const clearStorageUserSettings = () => {
|
|||||||
|
|
||||||
export const resetStorageUserSettings = () => {
|
export const resetStorageUserSettings = () => {
|
||||||
try {
|
try {
|
||||||
nsLocal.set(
|
localStorage.setItem(
|
||||||
'userSettings',
|
'userSettings',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
...defaultSettings,
|
...defaultSettings,
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ export default function useWatchList<T = Record<string, any>>(API: string) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cancelWatch = useMemoizedFn(() => {
|
||||||
|
chunkRequestRef.current?.current?.cancel?.();
|
||||||
|
listRequestTokenRef.current?.cancel?.();
|
||||||
|
});
|
||||||
|
|
||||||
const queryAllDataList = async (
|
const queryAllDataList = async (
|
||||||
params: Global.SearchParams,
|
params: Global.SearchParams,
|
||||||
options?: any
|
options?: any
|
||||||
@@ -78,14 +83,15 @@ export default function useWatchList<T = Record<string, any>>(API: string) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
createWatchChunkRequest();
|
createWatchChunkRequest();
|
||||||
return () => {
|
return () => {
|
||||||
chunkRequestRef.current?.cancel?.();
|
cancelWatch();
|
||||||
listRequestTokenRef.current?.cancel?.();
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
watchDataList,
|
watchDataList,
|
||||||
setWatchDataList,
|
setWatchDataList,
|
||||||
|
startWatch: createWatchChunkRequest,
|
||||||
|
cancelWatch,
|
||||||
deleteItemFromCache: handleDeleteItemFromCache
|
deleteItemFromCache: handleDeleteItemFromCache
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import externalLinks from '@/constants/external-links';
|
import externalLinks from '@/constants/external-links';
|
||||||
import { GithubFilled } from '@ant-design/icons';
|
import { GithubFilled } from '@ant-design/icons';
|
||||||
import { nsLocal } from '@gpustack/core-ui/utils';
|
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Tooltip } from 'antd';
|
import { Tooltip } from 'antd';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@@ -67,7 +66,7 @@ type CacheEntry = { value: number; time: number };
|
|||||||
|
|
||||||
const readCache = (): CacheEntry | null => {
|
const readCache = (): CacheEntry | null => {
|
||||||
try {
|
try {
|
||||||
const raw = nsLocal.get(CACHE_KEY);
|
const raw = localStorage.getItem(CACHE_KEY);
|
||||||
if (!raw) return null;
|
if (!raw) return null;
|
||||||
const parsed = JSON.parse(raw);
|
const parsed = JSON.parse(raw);
|
||||||
if (typeof parsed?.value !== 'number' || typeof parsed?.time !== 'number') {
|
if (typeof parsed?.value !== 'number' || typeof parsed?.time !== 'number') {
|
||||||
@@ -81,7 +80,10 @@ const readCache = (): CacheEntry | null => {
|
|||||||
|
|
||||||
const writeCache = (value: number) => {
|
const writeCache = (value: number) => {
|
||||||
try {
|
try {
|
||||||
nsLocal.set(CACHE_KEY, JSON.stringify({ value, time: Date.now() }));
|
localStorage.setItem(
|
||||||
|
CACHE_KEY,
|
||||||
|
JSON.stringify({ value, time: Date.now() })
|
||||||
|
);
|
||||||
} catch {
|
} catch {
|
||||||
// ignore quota errors
|
// ignore quota errors
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ const APIKeys: React.FC = () => {
|
|||||||
></FilterBar>
|
></FilterBar>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -395,6 +395,7 @@ const Clusters: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<SealTable
|
<SealTable
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
emptyMinHeight="calc(100vh - 300px)"
|
||||||
loadChildren={getWorkerPoolList}
|
loadChildren={getWorkerPoolList}
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
expandedRowKeys={expandedRowKeys}
|
expandedRowKeys={expandedRowKeys}
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ const Credentials: React.FC = () => {
|
|||||||
|
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
tableLayout="fixed"
|
tableLayout="fixed"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
|
|||||||
@@ -362,6 +362,7 @@ const GPUService: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ const GPUServicePublicKeys: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ const GPUServiceStorageTypes: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ const GPUServiceStorage: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import { PageActionType } from '@/config/types';
|
|||||||
import useBodyScroll from '@/hooks/use-body-scroll';
|
import useBodyScroll from '@/hooks/use-body-scroll';
|
||||||
import useExpandedRowKeys from '@/hooks/use-expanded-row-keys';
|
import useExpandedRowKeys from '@/hooks/use-expanded-row-keys';
|
||||||
import useTableRowSelection from '@/hooks/use-table-row-selection';
|
import useTableRowSelection from '@/hooks/use-table-row-selection';
|
||||||
import useWatchList from '@/hooks/use-watch-list';
|
|
||||||
import useNoResourceResult from '@/pages/llmodels/hooks/use-no-resource-result';
|
import useNoResourceResult from '@/pages/llmodels/hooks/use-no-resource-result';
|
||||||
import { MODEL_ROUTE_TARGETS } from '@/pages/model-routes/apis';
|
|
||||||
import { TargetStatusValueMap } from '@/pages/model-routes/config';
|
import { TargetStatusValueMap } from '@/pages/model-routes/config';
|
||||||
import useOpenPlayground from '@/pages/model-routes/hooks/use-open-playground';
|
import useOpenPlayground from '@/pages/model-routes/hooks/use-open-playground';
|
||||||
import useGranfanaLink from '@/pages/resources/hooks/use-grafana-link';
|
import useGranfanaLink from '@/pages/resources/hooks/use-grafana-link';
|
||||||
@@ -92,6 +90,7 @@ interface ModelsProps {
|
|||||||
loadend: boolean;
|
loadend: boolean;
|
||||||
total: number;
|
total: number;
|
||||||
filterValues?: Record<string, any>;
|
filterValues?: Record<string, any>;
|
||||||
|
targetList?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFormattedData = (record: any, extraData = {}) => ({
|
const getFormattedData = (record: any, extraData = {}) => ({
|
||||||
@@ -129,7 +128,8 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
queryParams,
|
queryParams,
|
||||||
loading,
|
loading,
|
||||||
loadend,
|
loadend,
|
||||||
total
|
total,
|
||||||
|
targetList = []
|
||||||
}) => {
|
}) => {
|
||||||
const { generateFormValues, clusterList, workerList } =
|
const { generateFormValues, clusterList, workerList } =
|
||||||
useDeploymentsContext();
|
useDeploymentsContext();
|
||||||
@@ -155,7 +155,6 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
expandedRowKeys
|
expandedRowKeys
|
||||||
} = useExpandedRowKeys(expandAtom);
|
} = useExpandedRowKeys(expandAtom);
|
||||||
const { handleOpenPlayGround } = useOpenPlayground();
|
const { handleOpenPlayGround } = useOpenPlayground();
|
||||||
const { watchDataList: targetList } = useWatchList(MODEL_ROUTE_TARGETS);
|
|
||||||
const { openViewLogsModal, openViewLogsModalStatus, closeViewLogsModal } =
|
const { openViewLogsModal, openViewLogsModalStatus, closeViewLogsModal } =
|
||||||
useViewInstanceLogs();
|
useViewInstanceLogs();
|
||||||
|
|
||||||
@@ -614,6 +613,7 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
></PageTools>
|
></PageTools>
|
||||||
<SealTable
|
<SealTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
emptyMinHeight="calc(100vh - 300px)"
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
dataSource={dataSource}
|
dataSource={dataSource}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import useSetChunkRequest from '@/hooks/use-chunk-request';
|
|||||||
import { usePaginationStatus } from '@/hooks/use-pagination-status';
|
import { usePaginationStatus } from '@/hooks/use-pagination-status';
|
||||||
import { useTableMultiSort } from '@/hooks/use-table-sort';
|
import { useTableMultiSort } from '@/hooks/use-table-sort';
|
||||||
import useUpdateChunkedList from '@/hooks/use-update-chunk-list';
|
import useUpdateChunkedList from '@/hooks/use-update-chunk-list';
|
||||||
|
import useWatchList from '@/hooks/use-watch-list';
|
||||||
|
import { MODEL_ROUTE_TARGETS } from '@/pages/model-routes/apis';
|
||||||
import { TableOrder, TableProvider } from '@gpustack/core-ui';
|
import { TableOrder, TableProvider } from '@gpustack/core-ui';
|
||||||
import { useMemoizedFn } from 'ahooks';
|
import { useMemoizedFn } from 'ahooks';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -31,6 +33,11 @@ const Models = forwardRef((props, ref) => {
|
|||||||
const { setChunkRequest, createAxiosToken } = useSetChunkRequest();
|
const { setChunkRequest, createAxiosToken } = useSetChunkRequest();
|
||||||
const { setChunkRequest: setModelInstanceChunkRequest } =
|
const { setChunkRequest: setModelInstanceChunkRequest } =
|
||||||
useSetChunkRequest();
|
useSetChunkRequest();
|
||||||
|
const {
|
||||||
|
watchDataList: targetList,
|
||||||
|
startWatch: startTargetsWatch,
|
||||||
|
cancelWatch: cancelTargetsWatch
|
||||||
|
} = useWatchList(MODEL_ROUTE_TARGETS);
|
||||||
const [modelInstances, setModelInstances] = useState<any[]>([]);
|
const [modelInstances, setModelInstances] = useState<any[]>([]);
|
||||||
const [dataSource, setDataSource] = useState<{
|
const [dataSource, setDataSource] = useState<{
|
||||||
dataList: ListItem[];
|
dataList: ListItem[];
|
||||||
@@ -255,6 +262,7 @@ const Models = forwardRef((props, ref) => {
|
|||||||
cacheInsDataListRef.current = [];
|
cacheInsDataListRef.current = [];
|
||||||
chunkInstanceRequedtRef.current?.current?.cancel?.();
|
chunkInstanceRequedtRef.current?.current?.cancel?.();
|
||||||
instancesToken.current?.cancel?.();
|
instancesToken.current?.cancel?.();
|
||||||
|
cancelTargetsWatch();
|
||||||
});
|
});
|
||||||
|
|
||||||
const resumeRequestsOnPageActive = useMemoizedFn(async () => {
|
const resumeRequestsOnPageActive = useMemoizedFn(async () => {
|
||||||
@@ -265,6 +273,7 @@ const Models = forwardRef((props, ref) => {
|
|||||||
await getAllModelInstances();
|
await getAllModelInstances();
|
||||||
await createModelsInstanceChunkRequest();
|
await createModelsInstanceChunkRequest();
|
||||||
await createModelsChunkRequest();
|
await createModelsChunkRequest();
|
||||||
|
await startTargetsWatch();
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleOnCancelViewLogs = useMemoizedFn(async () => {
|
const handleOnCancelViewLogs = useMemoizedFn(async () => {
|
||||||
@@ -483,6 +492,7 @@ const Models = forwardRef((props, ref) => {
|
|||||||
total={dataSource.total}
|
total={dataSource.total}
|
||||||
deleteIds={dataSource.deletedIds}
|
deleteIds={dataSource.deletedIds}
|
||||||
filterValues={filterValues}
|
filterValues={filterValues}
|
||||||
|
targetList={targetList}
|
||||||
></TableList>
|
></TableList>
|
||||||
</TableProvider>
|
</TableProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ const MaasProvider: React.FC = () => {
|
|||||||
></FilterBar>
|
></FilterBar>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
tableLayout="fixed"
|
tableLayout="fixed"
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
|
|||||||
@@ -364,6 +364,7 @@ const ModelRoutes: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<SealTable
|
<SealTable
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
emptyMinHeight="calc(100vh - 300px)"
|
||||||
loadChildren={loadChildrenData}
|
loadChildren={loadChildrenData}
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
expandedRowKeys={expandedRowKeys}
|
expandedRowKeys={expandedRowKeys}
|
||||||
|
|||||||
@@ -123,14 +123,14 @@ const GPUList: React.FC<GPUListProps> = ({ clusterId, source }) => {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
showSorterTooltip={false}
|
showSorterTooltip={false}
|
||||||
tableLayout={'auto'}
|
scroll={{ x: 'max-content' }}
|
||||||
|
className={'scroll-table'}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
loading={{
|
loading={{
|
||||||
spinning: dataSource.loading,
|
spinning: dataSource.loading,
|
||||||
size: 'middle'
|
size: 'middle'
|
||||||
}}
|
}}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
scroll={{ x: 900 }}
|
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
pagination={{
|
pagination={{
|
||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ const ModelFiles = () => {
|
|||||||
></FilterBar>
|
></FilterBar>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
tableLayout="fixed"
|
tableLayout="fixed"
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ const Workers: React.FC<WorkersProps> = ({ clusterId, source }) => {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
sortDirections={TABLE_SORT_DIRECTIONS}
|
sortDirections={TABLE_SORT_DIRECTIONS}
|
||||||
showSorterTooltip={false}
|
showSorterTooltip={false}
|
||||||
tableLayout={'auto'}
|
scroll={{ x: 'max-content' }}
|
||||||
className={'scroll-table'}
|
className={'scroll-table'}
|
||||||
dataSource={dataSource.dataList}
|
dataSource={dataSource.dataList}
|
||||||
loading={{
|
loading={{
|
||||||
@@ -311,7 +311,6 @@ const Workers: React.FC<WorkersProps> = ({ clusterId, source }) => {
|
|||||||
size: 'middle'
|
size: 'middle'
|
||||||
}}
|
}}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
scroll={{ x: 900 }}
|
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
rowSelection={source === 'clusterDetail' ? undefined : rowSelection}
|
rowSelection={source === 'clusterDetail' ? undefined : rowSelection}
|
||||||
pagination={{
|
pagination={{
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ const Users: React.FC = () => {
|
|||||||
></FilterBar>
|
></FilterBar>
|
||||||
<ConfigProvider renderEmpty={renderEmpty}>
|
<ConfigProvider renderEmpty={renderEmpty}>
|
||||||
<Table
|
<Table
|
||||||
|
className={'scroll-table'}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={dataList}
|
dataSource={dataList}
|
||||||
rowSelection={rowSelection}
|
rowSelection={rowSelection}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
import { queryClusterList } from '@/pages/cluster-management/apis';
|
import { queryClusterList } from '@/pages/cluster-management/apis';
|
||||||
import { ProviderValueMap } from '@/pages/cluster-management/config';
|
import { ProviderValueMap } from '@/pages/cluster-management/config';
|
||||||
import { queryResourceEvents } from '@/pages/usage/apis/resource';
|
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
|
// Probes the caller's cluster list once so access predicates can gate
|
||||||
// GPU Service (Kubernetes-only). Cheap (one list request) and never
|
// GPU Service (Kubernetes-only). Cheap (one list request) and never
|
||||||
@@ -34,13 +33,20 @@ export const probeHasKubernetesCluster = async (): Promise<
|
|||||||
const value = (res?.items ?? []).some(
|
const value = (res?.items ?? []).some(
|
||||||
(c) => c?.provider === ProviderValueMap.Kubernetes
|
(c) => c?.provider === ProviderValueMap.Kubernetes
|
||||||
);
|
);
|
||||||
// nsSession swallows write errors (Safari private mode); the access
|
try {
|
||||||
// predicate already handles a missing value as "unknown".
|
window.sessionStorage.setItem(HAS_K8S_CLUSTER_KEY, JSON.stringify(value));
|
||||||
nsSession.set(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;
|
return value;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('probeHasKubernetesCluster error', error);
|
console.error('probeHasKubernetesCluster error', error);
|
||||||
nsSession.remove(HAS_K8S_CLUSTER_KEY);
|
try {
|
||||||
|
window.sessionStorage.removeItem(HAS_K8S_CLUSTER_KEY);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -63,12 +69,22 @@ export const probeHasResourceEvents = async (): Promise<
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
const value = (res?.pagination?.total ?? 0) > 0;
|
const value = (res?.pagination?.total ?? 0) > 0;
|
||||||
// nsSession swallows write errors; predicate treats missing as unknown.
|
try {
|
||||||
nsSession.set(HAS_RESOURCE_EVENTS_KEY, JSON.stringify(value));
|
window.sessionStorage.setItem(
|
||||||
|
HAS_RESOURCE_EVENTS_KEY,
|
||||||
|
JSON.stringify(value)
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
// sessionStorage may be unavailable; predicate treats missing as unknown.
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('probeHasResourceEvents error', error);
|
console.error('probeHasResourceEvents error', error);
|
||||||
nsSession.remove(HAS_RESOURCE_EVENTS_KEY);
|
try {
|
||||||
|
window.sessionStorage.removeItem(HAS_RESOURCE_EVENTS_KEY);
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { NS_STORE_NAME } from '@gpustack/core-ui/utils';
|
|
||||||
import localStore from './store';
|
import localStore from './store';
|
||||||
|
|
||||||
const IS_FIRST_LOGIN = 'is_first_login';
|
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 REMEMBER_ME_KEY = 'r_m';
|
||||||
const CRYPT_TEXT = 'seal';
|
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.
|
// Kept to remove credentials saved by the old "remember me" feature.
|
||||||
const removeRememberMe = (key: string) => {
|
const removeRememberMe = (key: string) => {
|
||||||
@@ -38,9 +37,9 @@ const writeColumnSettings = (key: string, data: any) => {
|
|||||||
export {
|
export {
|
||||||
CRYPT_TEXT,
|
CRYPT_TEXT,
|
||||||
IS_FIRST_LOGIN,
|
IS_FIRST_LOGIN,
|
||||||
|
REMEMBER_ME_KEY,
|
||||||
readColumnSettings,
|
readColumnSettings,
|
||||||
readState,
|
readState,
|
||||||
REMEMBER_ME_KEY,
|
|
||||||
removeRememberMe,
|
removeRememberMe,
|
||||||
writeColumnSettings,
|
writeColumnSettings,
|
||||||
writeState
|
writeState
|
||||||
|
|||||||
Reference in New Issue
Block a user