Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX[#14565]: container and ml models custom property apis are sending wrong payload #14566

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,17 @@ const ContainerPage = () => {
}
};

const handleUpdateContainerData = (updatedData: Container) => {
const jsonPatch = compare(omitBy(containerData, isUndefined), updatedData);
const handleUpdateContainerData = useCallback(
(updatedData: Container) => {
const jsonPatch = compare(
omitBy(containerData, isUndefined),
chirag-madlani marked this conversation as resolved.
Show resolved Hide resolved
updatedData
);

return patchContainerDetails(containerData?.id ?? '', jsonPatch);
};
return patchContainerDetails(containerData?.id ?? '', jsonPatch);
},
[containerData]
);

const handleUpdateDescription = async (updatedDescription: string) => {
try {
Expand Down Expand Up @@ -418,18 +424,33 @@ const ContainerPage = () => {
}
};

const handleExtensionUpdate = async (updatedContainer: Container) => {
try {
const response = await handleUpdateContainerData(updatedContainer);
setContainerData({
...response,
tags: sortTagsCaseInsensitive(response.tags ?? []),
});
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
};
const handleExtensionUpdate = useCallback(
async (updatedContainer: Container) => {
if (isUndefined(containerData)) {
return;
}

try {
const response = await handleUpdateContainerData({
...containerData,
extension: updatedContainer.extension,
});
setContainerData({
...response,
tags: sortTagsCaseInsensitive(response.tags ?? []),
});
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
},
[
containerData,
handleUpdateContainerData,
getEntityFeedCount,
setContainerData,
]
);

const handleUpdateDataModel = async (
updatedDataModel: Container['dataModel']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,17 @@ const MlModelPage = () => {
}
}, [mlModelPermissions, mlModelFqn]);

const saveUpdatedMlModelData = (updatedData: Mlmodel) => {
const jsonPatch = compare(omitBy(mlModelDetail, isUndefined), updatedData);
const saveUpdatedMlModelData = useCallback(
(updatedData: Mlmodel) => {
const jsonPatch = compare(
omitBy(mlModelDetail, isUndefined),
updatedData
);

return patchMlModelDetails(mlModelDetail.id, jsonPatch);
};
return patchMlModelDetails(mlModelDetail.id, jsonPatch);
},
[mlModelDetail]
);

const descriptionUpdateHandler = async (updatedMlModel: Mlmodel) => {
try {
Expand Down Expand Up @@ -230,19 +236,25 @@ const MlModelPage = () => {
}
};

const handleExtensionUpdate = async (updatedMlModel: Mlmodel) => {
try {
const data = await saveUpdatedMlModelData(updatedMlModel);
setMlModelDetail(data);
} catch (error) {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: getEntityName(mlModelDetail),
})
);
}
};
const handleExtensionUpdate = useCallback(
async (updatedMlModel: Mlmodel) => {
try {
const data = await saveUpdatedMlModelData({
...mlModelDetail,
extension: updatedMlModel.extension,
});
setMlModelDetail(data);
} catch (error) {
showErrorToast(
error as AxiosError,
t('server.entity-updating-error', {
entity: getEntityName(mlModelDetail),
})
);
}
},
[saveUpdatedMlModelData, setMlModelDetail, mlModelDetail]
);

const createThread = async (data: CreateThread) => {
try {
Expand Down
Loading