Web: Files: Disabled save and cancel buttons when is saving comment.

# Conflicts:
#	products/ASC.Files/Client/src/pages/VersionHistory/Section/Body/VersionRow.js
This commit is contained in:
Tatiana Lopaeva 2021-10-21 13:56:02 +03:00
parent ee0e64365a
commit b35c9b6922

View File

@ -38,7 +38,7 @@ const VersionRow = (props) => {
} = props;
const [showEditPanel, setShowEditPanel] = useState(false);
const [commentValue, setCommentValue] = useState(info.comment);
const [isSavingComment, setIsSavingComment] = useState(false);
const canEdit = info.access === 1 || info.access === 0;
@ -55,10 +55,12 @@ const VersionRow = (props) => {
const onChange = (e) => setCommentValue(e.target.value);
const onSaveClick = () => {
setIsSavingComment(true);
updateCommentVersion(info.id, commentValue, info.version)
.catch((err) => toastr.error(err))
.finally(() => {
onEditComment();
setIsSavingComment(false);
});
};
@ -162,6 +164,7 @@ const VersionRow = (props) => {
fontSize={12}
heightTextArea={54}
value={commentValue}
isDisabled={isSavingComment}
/>
<Box className="version_modal-dialog">
<ModalDialog
@ -180,10 +183,12 @@ const VersionRow = (props) => {
onChange={onChange}
heightTextArea={298}
value={commentValue}
isDisabled={isSavingComment}
/>
</ModalDialog.Body>
<ModalDialog.Footer>
<Button
isDisabled={isSavingComment}
className="version_save-button"
label={t("Common:SaveButton")}
size="big"
@ -233,6 +238,7 @@ const VersionRow = (props) => {
displayProp="inline-block"
>
<Button
isDisabled={isSavingComment}
size="base"
scale={true}
primary
@ -245,6 +251,7 @@ const VersionRow = (props) => {
displayProp="inline-block"
>
<Button
isDisabled={isSavingComment}
size="base"
scale={true}
onClick={onCancelClick}