|
|
@@ -35,7 +35,6 @@ import React, {
|
|
|
} from 'react';
|
|
|
import {
|
|
|
MODELS_API,
|
|
|
- createModel,
|
|
|
deleteModel,
|
|
|
deleteModelInstance,
|
|
|
queryModelInstancesList,
|
|
|
@@ -58,6 +57,7 @@ import Filters from '../filters';
|
|
|
import useEditDeployment from '../hooks/use-edit-deployment';
|
|
|
import useModelsColumns from '../hooks/use-models-columns';
|
|
|
import useViewInstanceLogs from '../hooks/use-view-instance-logs';
|
|
|
+import { handleCreateModelWithConflict } from '../utils/handleSoftDeleteConflict';
|
|
|
import DeployModal from './deployment/deploy-modal';
|
|
|
import UpdateModelModal from './deployment/update-modal';
|
|
|
import Instances from './instance/instances';
|
|
|
@@ -222,15 +222,25 @@ const Models: React.FC<ModelsProps> = ({
|
|
|
|
|
|
const handleModalOk = async (data: FormData) => {
|
|
|
const currentData = openEditModalStatus.currentData;
|
|
|
+
|
|
|
+ const onSuccess = () => {
|
|
|
+ closeEditModal();
|
|
|
+ message.success(intl.formatMessage({ id: 'common.message.success' }));
|
|
|
+ setTimeout(() => {
|
|
|
+ handleSearch();
|
|
|
+ }, 150);
|
|
|
+ restoreScrollHeight();
|
|
|
+ };
|
|
|
+
|
|
|
try {
|
|
|
if (currentData.realAction === PageAction.COPY) {
|
|
|
- const modelData = await createModel({
|
|
|
- data
|
|
|
+ await handleCreateModelWithConflict(data, (modelData) => {
|
|
|
+ if (data.replicas > 0) {
|
|
|
+ updateExpandedRowKeys([modelData.id, ...expandedRowKeys]);
|
|
|
+ }
|
|
|
+ onSuccess();
|
|
|
});
|
|
|
-
|
|
|
- if (data.replicas > 0) {
|
|
|
- updateExpandedRowKeys([modelData.id, ...expandedRowKeys]);
|
|
|
- }
|
|
|
+ return;
|
|
|
}
|
|
|
if (currentData.realAction === PageAction.EDIT) {
|
|
|
await updateModel({
|
|
|
@@ -242,12 +252,7 @@ const Models: React.FC<ModelsProps> = ({
|
|
|
updateExpandedRowKeys([currentData.row.id, ...expandedRowKeys]);
|
|
|
}
|
|
|
}
|
|
|
- closeEditModal();
|
|
|
- message.success(intl.formatMessage({ id: 'common.message.success' }));
|
|
|
- setTimeout(() => {
|
|
|
- handleSearch();
|
|
|
- }, 150);
|
|
|
- restoreScrollHeight();
|
|
|
+ onSuccess();
|
|
|
} catch (error) {}
|
|
|
};
|
|
|
|
|
|
@@ -274,16 +279,13 @@ const Models: React.FC<ModelsProps> = ({
|
|
|
};
|
|
|
|
|
|
const handleCreateModel = async (data: FormData) => {
|
|
|
- try {
|
|
|
- const modelData = await createModel({
|
|
|
- data
|
|
|
- });
|
|
|
+ await handleCreateModelWithConflict(data, (modelData) => {
|
|
|
setOpenDeployModal({
|
|
|
...openDeployModal,
|
|
|
show: false
|
|
|
});
|
|
|
refreshListStatus(modelData);
|
|
|
- } catch (error) {}
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const handleLogModalCancel = () => {
|