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