Commit 6fe23cb6 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20221010-partition' into feat-20221012-environment

parents ae2068b5 28b78e92
......@@ -28,6 +28,8 @@ type IQueueSelectProps = {
error?: boolean;
helperText?: string;
disabled?: boolean;
cpuLoading?: boolean;
gpuLoading?: boolean;
};
type IMemoryLi = {
......@@ -65,7 +67,10 @@ const QueueSelect = (props: IQueueSelectProps) => {
error,
helperText,
disabled,
cpuLoading = false,
gpuLoading = false,
} = props;
// 队列列表由外面传入的设计是考虑到一个表单可能有多次队列选择, 请求队列接口在表单页面完成可以减少请求
const Message = useMessage();
const [activePartition, setActivePartition] = useState("");
const [open, setOpen] = useState(false);
......@@ -341,6 +346,7 @@ const QueueSelect = (props: IQueueSelectProps) => {
handleRow={(e: any) => handleRow(e)}
activeId={activePartition}
tableKey="partition"
loading={cpuLoading}
></MyTable>
)}
{queueType === "GPU" && (
......@@ -357,6 +363,7 @@ const QueueSelect = (props: IQueueSelectProps) => {
handleRow={(e: any) => handleRow(e)}
activeId={activePartition}
tableKey="partition"
loading={gpuLoading}
></MyTable>
)}
</div>
......
......@@ -43,27 +43,36 @@ const ConfigForm = (props: ConfigFormProps) => {
const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]);
const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]);
const { run: getHardwreListFn } = useMyRequest(getHardwreList, {
onSuccess: (res, params) => {
if (params[0].computeType === "CPU") {
const { run: getCpuList, loading: cpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setCpuList(res.data);
} else {
setGpuList(res.data);
},
}
);
const { run: getGpuList, loading: gpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setGpuList(res.data);
},
});
}
);
useEffect(() => {
getHardwreListFn({
zoneId &&
getCpuList({
zoneId,
computeType: "CPU",
});
}, [getHardwreListFn, zoneId]);
}, [getCpuList, zoneId]);
useEffect(() => {
getHardwreListFn({
zoneId &&
getGpuList({
zoneId,
computeType: "GPU",
});
}, [getHardwreListFn, zoneId]);
}, [getGpuList, zoneId]);
const [nameHelp, setNameHelp] = useState({
error: false,
......@@ -332,6 +341,8 @@ const ConfigForm = (props: ConfigFormProps) => {
originalGpuList={gpuList}
error={parameter.error || false}
helperText={parameter.helperText}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
></QueueSelect>
)}
{(parameter.domType || "").toLowerCase() === "input" && (
......
......@@ -32,6 +32,8 @@ type IParameterSettingProps = {
setTemplateConfigInfo: any;
cpuList: Array<IQueueLi>;
gpuList: Array<IQueueLi>;
cpuLoading?: boolean;
gpuLoading?: boolean;
};
const ParameterSetting = (props: IParameterSettingProps) => {
const {
......@@ -40,6 +42,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
taskId,
cpuList,
gpuList,
cpuLoading = false,
gpuLoading = false,
} = props; // 算子大数组
const [isShowAllDese, setIsShowAllDese] = useState(false); // 是否展示全部描述
const [fileSelectOpen, setFileSelectOpen] = useState(false); // 选择输出路径的弹窗显示控制
......@@ -294,6 +298,8 @@ const ParameterSetting = (props: IParameterSettingProps) => {
error={parameter.error || false}
helperText={parameter.helperText}
disabled={parameter.parameterGroup === "out"}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
></QueueSelect>
)}
{(parameter.domType || "").toLowerCase() === "input" && (
......
......@@ -70,29 +70,36 @@ const WorkFlowEdit = observer((props: IProps) => {
const [cpuList, setCpuList] = useState<Array<IQueueLi>>([]);
const [gpuList, setGpuList] = useState<Array<IQueueLi>>([]);
const { run: getHardwreListFn } = useMyRequest(getHardwreList, {
onSuccess: (res, params) => {
if (params[0].computeType === "CPU") {
const { run: getCpuList, loading: cpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setCpuList(res.data);
} else {
setGpuList(res.data);
},
}
);
const { run: getGpuList, loading: gpuLoading } = useMyRequest(
getHardwreList,
{
onSuccess: (res) => {
setGpuList(res.data);
},
});
}
);
useEffect(() => {
zoneId &&
getHardwreListFn({
getCpuList({
zoneId,
computeType: "CPU",
});
}, [getHardwreListFn, zoneId]);
}, [getCpuList, zoneId]);
useEffect(() => {
zoneId &&
getHardwreListFn({
getGpuList({
zoneId,
computeType: "GPU",
});
}, [getHardwreListFn, zoneId]);
}, [getGpuList, zoneId]);
// 是否要监听删除时间
const listenState = useMemo(() => {
......@@ -276,6 +283,8 @@ const WorkFlowEdit = observer((props: IProps) => {
taskId={selectTaskId || ""}
cpuList={cpuList}
gpuList={gpuList}
cpuLoading={cpuLoading}
gpuLoading={gpuLoading}
/>
)}
<div
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment