chore: providers ux

This commit is contained in:
jialin
2026-02-03 18:21:08 +08:00
parent b2a8d27178
commit e8e982559d
32 changed files with 469 additions and 128 deletions
@@ -19,11 +19,11 @@ const useCreateProvider = (options: { refresh: () => void }) => {
provider: null
});
const openModal = (action: PageActionType, row?: ListItem) => {
const openModal = (action: PageActionType, title: string, row?: ListItem) => {
setOpenModalStatus({
...openModalStatus,
open: true,
title: action === PageAction.CREATE ? 'Create Provider' : 'Edit Provider',
title: title,
action,
currentData: row,
provider: row ? row.provider : null
@@ -31,8 +31,13 @@ const useCreateProvider = (options: { refresh: () => void }) => {
};
const closeModal = () => {
setOpenModalStatus({ ...openModalStatus, open: false });
options.refresh();
setOpenModalStatus({
open: false,
action: PageAction.CREATE,
currentData: undefined,
title: '',
provider: null
});
};
return {
@@ -13,7 +13,6 @@ import {
maasProviderLabelMap,
providerIconsMap,
ProviderStatus,
ProviderStatusLabelMap,
rowActionList
} from '../config';
import { MaasProviderItem } from '../config/types';
@@ -69,15 +68,21 @@ const useProviderColumns = (
render: (value: number) => <span>{value}</span>
},
{
title: intl.formatMessage({ id: 'common.table.status' }),
dataIndex: 'state',
span: 4,
title: intl.formatMessage({ id: 'providers.table.proxy' }),
dataIndex: 'proxy_config',
span: 3,
render: (value: number) => <span>{value ? 'Configured' : 'None'}</span>
},
{
title: 'Token Settings',
dataIndex: 'tokens',
span: 3,
render: (value: string, record: MaasProviderItem) => (
<StatusTag
statusValue={{
status: ProviderStatus[value],
text: ProviderStatusLabelMap[value],
message: record.state_message || undefined
status: ProviderStatus['ready'],
text: 'Configured',
message: ''
}}
/>
)
@@ -86,7 +91,7 @@ const useProviderColumns = (
title: intl.formatMessage({ id: 'common.table.createTime' }),
dataIndex: 'created_at',
sorter: tableSorter(6),
span: 4,
span: 3,
render: (value: string) => (
<AutoTooltip ghost minWidth={20}>
{dayjs(value).format('YYYY-MM-DD HH:mm:ss')}