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