fix: cluster value setting, volumes setting

This commit is contained in:
jialin
2025-09-19 20:00:25 +08:00
parent b640963f65
commit f542ebecb4
27 changed files with 677 additions and 109 deletions
@@ -351,6 +351,9 @@ const AddModal: FC<AddModalProps> = (props) => {
}, [onCancel]);
const initClusterId = () => {
if (initialValues?.cluster_id) {
return initialValues.cluster_id;
}
const cluster_id =
clusterList?.find((item) => item.provider === ProviderValueMap.Docker)
?.value || clusterList?.[0]?.value;
@@ -361,14 +364,12 @@ const AddModal: FC<AddModalProps> = (props) => {
const handleOnOpen = () => {
if (props.deploymentType === 'modelFiles') {
form.current?.form?.setFieldsValue({
...props.initialValues,
cluster_id: initClusterId()
...props.initialValues
});
handleOnValuesChange?.({
changedValues: {},
allValues: {
...props.initialValues,
cluster_id: initClusterId()
...props.initialValues
},
source: source
});
@@ -422,7 +423,7 @@ const AddModal: FC<AddModalProps> = (props) => {
message: []
});
};
}, [open, clusterList]);
}, [open, clusterList, initialValues?.cluster_id]);
return (
<GSDrawer
@@ -115,7 +115,7 @@ export const useGenerateWorkerOptions = () => {
const [workersList, setWorkersList] = useState<
Global.BaseOption<
number,
{ state: string; labels: Record<string, string> }
{ state: string; labels: Record<string, string>; cluster_id: number }
>[]
>([]);
@@ -129,7 +129,11 @@ export const useGenerateWorkerOptions = () => {
value: cluster.id,
parent: true,
children: workerList
.filter((worker) => worker.cluster_id === cluster.id)
.filter(
(worker) =>
worker.cluster_id === cluster.id &&
worker.state === WorkerStatusMap.ready
)
.map((worker) => ({
disabled: WorkerStatusMap.ready !== worker.state,
state: worker.state,
@@ -166,6 +170,7 @@ export const useGenerateWorkerOptions = () => {
generateCascaderWorkerOptions(workerList, clusterList);
setWorkersList(
workerList.map((item) => ({
cluster_id: item.cluster_id,
state: item.state,
label: item.name,
value: item.id