fix: env params incorrect after switching between vendors
This commit is contained in:
@@ -50,7 +50,6 @@ const CopyButton: React.FC<CopyButtonProps> = ({
|
|||||||
return (
|
return (
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
style={{ ...btnStyle }}
|
style={{ ...btnStyle }}
|
||||||
disabled={!!disabled}
|
|
||||||
copyable={{
|
copyable={{
|
||||||
text: text,
|
text: text,
|
||||||
tooltips: tooltips,
|
tooltips: tooltips,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import type { InputProps } from 'antd';
|
import type { InputProps } from 'antd';
|
||||||
import { Form, Input } from 'antd';
|
import { Form, Input } from 'antd';
|
||||||
|
import { PasswordProps } from 'antd/lib/input/Password';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { SealFormItemProps } from './types';
|
import { SealFormItemProps } from './types';
|
||||||
import Wrapper from './wrapper';
|
import Wrapper from './wrapper';
|
||||||
import InputWrapper from './wrapper/input';
|
import InputWrapper from './wrapper/input';
|
||||||
|
|
||||||
const SealPassword: React.FC<InputProps & SealFormItemProps> = (props) => {
|
const SealPassword: React.FC<InputProps & SealFormItemProps & PasswordProps> = (
|
||||||
|
props
|
||||||
|
) => {
|
||||||
const {
|
const {
|
||||||
label,
|
label,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const SelectWrapper = styled.div`
|
|||||||
border-color: var(--ant-input-active-border-color) !important;
|
border-color: var(--ant-input-active-border-color) !important;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
background-color: var(--ant-input-active-bg);
|
background-color: var(--ant-input-active-bg);
|
||||||
border-bottom: none !important;
|
border-bottom-color: transparent !important;
|
||||||
border-radius: ${BORDERRADIUS}px ${BORDERRADIUS}px 0 0;
|
border-radius: ${BORDERRADIUS}px ${BORDERRADIUS}px 0 0;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@@ -24,7 +24,7 @@ const SelectWrapper = styled.div`
|
|||||||
height: 1px;
|
height: 1px;
|
||||||
margin-inline: 1px;
|
margin-inline: 1px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0px;
|
||||||
right: 0;
|
right: 0;
|
||||||
background-color: var(--ant-color-split);
|
background-color: var(--ant-color-split);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -647,7 +647,7 @@ body {
|
|||||||
.cascader-popup-wrapper {
|
.cascader-popup-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1px solid var(--ant-color-border);
|
border: 1px solid var(--ant-color-border);
|
||||||
inset: 54px auto auto 0 !important;
|
inset: 53px auto auto 0 !important;
|
||||||
border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
|
border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
|
||||||
border-top: none;
|
border-top: none;
|
||||||
max-height: 240px;
|
max-height: 240px;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const Environment: React.FC = () => {
|
|||||||
const { snapshot } = detailData;
|
const { snapshot } = detailData;
|
||||||
|
|
||||||
// instance info
|
// instance info
|
||||||
const instanceEntry = Object.entries(snapshot.instances ?? {})[0];
|
const instanceEntry = Object.entries(snapshot.instances || {})[0];
|
||||||
const instanceData = instanceEntry?.[1];
|
const instanceData = instanceEntry?.[1];
|
||||||
|
|
||||||
const { handleExpandChange, handleExpandAll, expandedRowKeys } =
|
const { handleExpandChange, handleExpandAll, expandedRowKeys } =
|
||||||
@@ -38,7 +38,7 @@ const Environment: React.FC = () => {
|
|||||||
|
|
||||||
const workerMap = useMemo(() => {
|
const workerMap = useMemo(() => {
|
||||||
return new Map(
|
return new Map(
|
||||||
Object.entries(snapshot.workers ?? {}).map(([workerName, workerInfo]) => [
|
Object.entries(snapshot.workers || {}).map(([workerName, workerInfo]) => [
|
||||||
workerInfo.id,
|
workerInfo.id,
|
||||||
workerInfo
|
workerInfo
|
||||||
])
|
])
|
||||||
@@ -46,7 +46,7 @@ const Environment: React.FC = () => {
|
|||||||
}, [snapshot.workers]);
|
}, [snapshot.workers]);
|
||||||
|
|
||||||
const gpuList = useMemo(() => {
|
const gpuList = useMemo(() => {
|
||||||
return Object.values(snapshot.gpus ?? {}) || [];
|
return Object.values(snapshot.gpus || {}) || [];
|
||||||
}, [snapshot.gpus]);
|
}, [snapshot.gpus]);
|
||||||
|
|
||||||
const findWorkerById = (workerID: number): WorkerData | undefined => {
|
const findWorkerById = (workerID: number): WorkerData | undefined => {
|
||||||
@@ -97,7 +97,7 @@ const Environment: React.FC = () => {
|
|||||||
children: gpuData
|
children: gpuData
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}, [snapshot]);
|
}, [snapshot.gpus, snapshot.workers, instanceData]);
|
||||||
|
|
||||||
const dataList = useMemo(() => {
|
const dataList = useMemo(() => {
|
||||||
return [mainWorker, ...subWorkerList].filter(Boolean) as WorkerData[];
|
return [mainWorker, ...subWorkerList].filter(Boolean) as WorkerData[];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const SelectVendor: React.FC<AddWorkerStepProps> = ({ disabled }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleSelectProvider = (value: string, item: any) => {
|
const handleSelectProvider = (value: string, item: any) => {
|
||||||
console.log('selected gpu driver:', value, item);
|
if (value === currentGPU) return;
|
||||||
setCurrentGPU(value);
|
setCurrentGPU(value);
|
||||||
|
|
||||||
updateField('currentGPU', value);
|
updateField('currentGPU', value);
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
|
import Password from '@/components/seal-form/password';
|
||||||
import SealInput from '@/components/seal-form/seal-input';
|
import SealInput from '@/components/seal-form/seal-input';
|
||||||
import SealSelect from '@/components/seal-form/seal-select';
|
import SealSelect from '@/components/seal-form/seal-select';
|
||||||
|
import { PageAction } from '@/config';
|
||||||
import useAppUtils from '@/hooks/use-app-utils';
|
import useAppUtils from '@/hooks/use-app-utils';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import ProviderLogo from '../components/provider-logo';
|
import ProviderLogo from '../components/provider-logo';
|
||||||
|
import { useFormContext } from '../config/form-context';
|
||||||
import { maasProviderOptions, ProviderEnum } from '../config/providers';
|
import { maasProviderOptions, ProviderEnum } from '../config/providers';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
|
|
||||||
@@ -12,6 +15,7 @@ const Basic: React.FC<{
|
|||||||
}> = ({ onAPIKeyBlur }) => {
|
}> = ({ onAPIKeyBlur }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const form = Form.useFormInstance<FormData>();
|
const form = Form.useFormInstance<FormData>();
|
||||||
|
const { action } = useFormContext();
|
||||||
const providerType = Form.useWatch(['config', 'type'], form);
|
const providerType = Form.useWatch(['config', 'type'], form);
|
||||||
const { getRuleMessage } = useAppUtils();
|
const { getRuleMessage } = useAppUtils();
|
||||||
|
|
||||||
@@ -92,8 +96,9 @@ const Basic: React.FC<{
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<SealInput.Password
|
<Password
|
||||||
required
|
required
|
||||||
|
visibilityToggle={action !== PageAction.EDIT}
|
||||||
onBlur={onAPIKeyBlur}
|
onBlur={onAPIKeyBlur}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'providers.form.tokens.title'
|
id: 'providers.form.tokens.title'
|
||||||
|
|||||||
@@ -157,10 +157,12 @@ interface AddWorkerCommandParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const generateEnvArgs = (params: any) => {
|
const generateEnvArgs = (params: any) => {
|
||||||
const registrationInfo = params.registrationInfo || {};
|
const registrationInfo = {
|
||||||
registrationInfo.env = {
|
...params.registrationInfo,
|
||||||
...registrationInfo.env,
|
env: {
|
||||||
...params.extraEnv
|
...(params.registrationInfo?.env || {}),
|
||||||
|
...params.extraEnv
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// generate environment variables args from registrationInfo.env
|
// generate environment variables args from registrationInfo.env
|
||||||
let envArgs = '';
|
let envArgs = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user