fix: get models in cloning
This commit is contained in:
+8
-8
@@ -1,12 +1,12 @@
|
|||||||
import { StatusType } from './types';
|
import { PageActionType, StatusType } from './types';
|
||||||
|
|
||||||
export enum PageAction {
|
export const PageAction: Record<string, PageActionType> = {
|
||||||
CREATE = 'create',
|
CREATE: 'create',
|
||||||
UPDATE = 'update',
|
UPDATE: 'update',
|
||||||
VIEW = 'view',
|
VIEW: 'view',
|
||||||
EDIT = 'edit',
|
EDIT: 'edit',
|
||||||
COPY = 'copy'
|
COPY: 'copy'
|
||||||
}
|
};
|
||||||
|
|
||||||
export const StatusColorMap: Record<
|
export const StatusColorMap: Record<
|
||||||
StatusType,
|
StatusType,
|
||||||
|
|||||||
@@ -38,5 +38,5 @@ export default {
|
|||||||
'users.status.deactivate': '停用账户',
|
'users.status.deactivate': '停用账户',
|
||||||
'users.status.inactiveAccount': '停用账户',
|
'users.status.inactiveAccount': '停用账户',
|
||||||
'users.login.getInitialPassword':
|
'users.login.getInitialPassword':
|
||||||
'在服务器端运行以下命令以获取初始管理员密码。'
|
'在 GPUStack Server 节点运行以下命令以获取初始管理员密码。'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ const BackendDetail: React.FC<{
|
|||||||
</span>
|
</span>
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
<Content>
|
<Content>
|
||||||
<Typography.Paragraph>
|
<Typography.Paragraph style={{ whiteSpace: 'pre-line' }}>
|
||||||
{currentData?.description}
|
{currentData?.description}
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { maasProviderType } from '.';
|
|||||||
|
|
||||||
interface FormContextProps {
|
interface FormContextProps {
|
||||||
providerType?: maasProviderType;
|
providerType?: maasProviderType;
|
||||||
action?: PageActionType;
|
action: PageActionType;
|
||||||
currentData?: any;
|
currentData?: any;
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FormContext = createContext<FormContextProps>({});
|
const FormContext = createContext<FormContextProps>({} as FormContextProps);
|
||||||
|
|
||||||
export const useFormContext = () => {
|
export const useFormContext = () => {
|
||||||
const context = useContext(FormContext);
|
const context = useContext(FormContext);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const ModelItem: React.FC<ModelItemProps> = ({
|
|||||||
|
|
||||||
const generateCurrentAPIKey = (currentAPIKey: string) => {
|
const generateCurrentAPIKey = (currentAPIKey: string) => {
|
||||||
if (
|
if (
|
||||||
action === PageAction.EDIT &&
|
[PageAction.EDIT, PageAction.COPY].includes(action) &&
|
||||||
currentAPIKey === currentData?.api_tokens?.[0]?.hash
|
currentAPIKey === currentData?.api_tokens?.[0]?.hash
|
||||||
) {
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const SupportedModels = () => {
|
|||||||
|
|
||||||
const generateCurrentAPIKey = (currentAPIKey: string) => {
|
const generateCurrentAPIKey = (currentAPIKey: string) => {
|
||||||
if (
|
if (
|
||||||
action === PageAction.EDIT &&
|
[PageAction.EDIT, PageAction.COPY].includes(action) &&
|
||||||
currentAPIKey === currentData?.api_tokens?.[0]?.hash
|
currentAPIKey === currentData?.api_tokens?.[0]?.hash
|
||||||
) {
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user