Web:Client:Add onTerminate.
This commit is contained in:
parent
c151f16a79
commit
e205fb5d78
@ -36,6 +36,7 @@ const DataReassignmentDialog = ({
|
||||
setDataReassignmentDialogVisible,
|
||||
dataReassignment,
|
||||
dataReassignmentProgress,
|
||||
dataReassignmentTerminate,
|
||||
currentColorScheme,
|
||||
currentUser,
|
||||
deleteProfile,
|
||||
@ -108,8 +109,9 @@ const DataReassignmentDialog = ({
|
||||
.then((res) => {
|
||||
setPercent(res.percentage);
|
||||
|
||||
if (res.percentage !== 100) return;
|
||||
if (!res.isCompleted) return;
|
||||
|
||||
toastr.success(t("Common:ChangesSavedSuccessfully"));
|
||||
clearInterval(timerId);
|
||||
isDeleteProfile && updateAccountsAfterDeleteUser();
|
||||
})
|
||||
@ -124,9 +126,30 @@ const DataReassignmentDialog = ({
|
||||
|
||||
dataReassignment(user.id, selectedUser.id, isDeleteProfile)
|
||||
.then(() => {
|
||||
toastr.success(t("Common:ChangesSavedSuccessfully"));
|
||||
checkProgress(user.id);
|
||||
dataReassignmentTerminate(user.id).then(() => {
|
||||
checkProgress(user.id);
|
||||
timerId = setInterval(() => checkProgress(user.id), 100);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
toastr.error(error?.response?.data?.error?.message);
|
||||
});
|
||||
|
||||
timerId = setInterval(() => checkProgress(user.id), 1000);
|
||||
// timerId = setInterval(() => checkProgress(user.id), 100);
|
||||
|
||||
// .then(() => {
|
||||
// timerId = setInterval(() => checkProgress(user.id), 10);
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// toastr.error(error?.response?.data?.error?.message);
|
||||
// });
|
||||
};
|
||||
|
||||
const onTerminate = () => {
|
||||
dataReassignmentTerminate(user.id)
|
||||
.then(() => {
|
||||
toastr.success(t("Common:ChangesSavedSuccessfully"));
|
||||
})
|
||||
.catch((error) => {
|
||||
toastr.error(error?.response?.data?.error?.message);
|
||||
@ -199,6 +222,7 @@ const DataReassignmentDialog = ({
|
||||
onReassign={onReassign}
|
||||
percent={percent}
|
||||
onClose={onClose}
|
||||
onTerminate={onTerminate}
|
||||
/>
|
||||
</ModalDialog.Footer>
|
||||
</StyledModalDialog>
|
||||
@ -213,7 +237,11 @@ export default inject(({ auth, peopleStore, setup }) => {
|
||||
setIsDeleteUserReassignmentYourself,
|
||||
} = peopleStore.dialogStore;
|
||||
const { currentColorScheme } = auth.settingsStore;
|
||||
const { dataReassignment, dataReassignmentProgress } = setup;
|
||||
const {
|
||||
dataReassignment,
|
||||
dataReassignmentProgress,
|
||||
dataReassignmentTerminate,
|
||||
} = setup;
|
||||
|
||||
const { user: currentUser } = peopleStore.authStore.userStore;
|
||||
|
||||
@ -226,6 +254,7 @@ export default inject(({ auth, peopleStore, setup }) => {
|
||||
dataReassignment,
|
||||
currentUser,
|
||||
dataReassignmentProgress,
|
||||
dataReassignmentTerminate,
|
||||
deleteProfile: dataReassignmentDeleteProfile,
|
||||
setFilter,
|
||||
isDeleteUserReassignmentYourself,
|
||||
|
@ -130,9 +130,9 @@ const Progress = ({ fromUser, toUser, isReassignCurrentUser, percent, t }) => {
|
||||
</div>
|
||||
|
||||
<div className="progress-status">
|
||||
{percent < 50 ? inProgressNode : allDataTransferredNode}
|
||||
{percent < 70 ? inProgressNode : allDataTransferredNode}
|
||||
|
||||
{percent < 50 ? (
|
||||
{percent < 70 ? (
|
||||
<Text noSelect>{t("PeopleTranslations:PendingTitle")}...</Text>
|
||||
) : percent < 100 ? (
|
||||
inProgressNode
|
||||
|
@ -14,6 +14,7 @@ const Body = ({
|
||||
percent,
|
||||
currentColorScheme,
|
||||
onTogglePeopleSelector,
|
||||
onTerminate,
|
||||
}) => {
|
||||
if (!tReady) return <DataReassignmentLoader />;
|
||||
|
||||
@ -28,6 +29,7 @@ const Body = ({
|
||||
: selectedUser.label
|
||||
}
|
||||
percent={percent}
|
||||
onTerminate={onTerminate}
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -12,18 +12,17 @@ const Footer = ({
|
||||
onReassign,
|
||||
percent,
|
||||
onClose,
|
||||
onTerminate,
|
||||
}) => {
|
||||
if (showProgress) {
|
||||
return (
|
||||
<StyledFooterWrapper>
|
||||
<div className="button-wrapper">
|
||||
<Button
|
||||
label={
|
||||
percent === 100 ? t("Common:OkButton") : t("Common:CancelButton")
|
||||
}
|
||||
label={percent === 100 ? t("Common:OkButton") : "Abort transfer"}
|
||||
size="normal"
|
||||
scale
|
||||
onClick={onClose}
|
||||
onClick={percent === 100 ? onClose : onTerminate}
|
||||
/>
|
||||
</div>
|
||||
</StyledFooterWrapper>
|
||||
|
@ -451,6 +451,10 @@ class SettingsSetupStore {
|
||||
return api.settings.dataReassignmentProgress(id);
|
||||
};
|
||||
|
||||
dataReassignmentTerminate = (id) => {
|
||||
return api.settings.dataReassignmentTerminate(id);
|
||||
};
|
||||
|
||||
getCommonThirdPartyList = async () => {
|
||||
const res = await api.settings.getCommonThirdPartyList();
|
||||
|
||||
|
@ -419,6 +419,15 @@ export function dataReassignmentProgress(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function dataReassignmentTerminate(id) {
|
||||
const data = { id };
|
||||
return request({
|
||||
method: "put",
|
||||
url: `/people/reassign/terminate`,
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function ownerChange(ownerId, confirmKey = null) {
|
||||
const data = { ownerId };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user