Web: AutoBackup: Added disable input if folder was deleted, added removing folder when switch between options.

This commit is contained in:
Tatiana Lopaeva 2022-07-07 16:51:31 +03:00
parent 41a2c421b1
commit 05db277f00
3 changed files with 12 additions and 6 deletions

View File

@ -64,6 +64,7 @@ class SelectFolderInput extends React.PureComponent {
this.setState({
resultingFolderTree,
baseId: resultingId,
isLoading: false,
});
}

View File

@ -83,18 +83,18 @@ class AutomaticBackup extends React.PureComponent {
getProgress(t);
const [
commonThirdPartyList,
thirdPartyList,
backupSchedule,
backupStorage,
] = await Promise.all([
getThirdPartyCommonFolderTree,
getThirdPartyCommonFolderTree(),
getBackupSchedule(),
getBackupStorage(),
]);
setThirdPartyStorage(backupStorage);
setBackupSchedule(backupSchedule);
commonThirdPartyList && setCommonThirdPartyList(commonThirdPartyList);
thirdPartyList && setCommonThirdPartyList(thirdPartyList);
setDefaultOptions(t, this.periodsObject, this.weekdaysLabelArray);
@ -374,7 +374,9 @@ class AutomaticBackup extends React.PureComponent {
const { isInitialLoading, isLoadingData, isError } = this.state;
const isDisabledThirdPartyList = commonThirdPartyList?.length === 0;
const isDisabledThirdPartyList = isCheckedThirdParty
? false
: commonThirdPartyList?.length === 0;
const commonProps = {
isLoadingData,

View File

@ -8,10 +8,11 @@ import ScheduleComponent from "./ScheduleComponent";
class ThirdPartyModule extends React.PureComponent {
constructor(props) {
super(props);
const { setSelectedFolder, isResourcesDefault } = props;
this.state = {
isPanelVisible: false,
};
!isResourcesDefault && setSelectedFolder("");
}
onClickInput = () => {
@ -53,11 +54,12 @@ class ThirdPartyModule extends React.PureComponent {
isPanelVisible={isPanelVisible}
isError={isError}
foldersType="third-party"
isDisabled={isLoadingData}
isDisabled={commonThirdPartyList.length === 0 || isLoadingData}
id={passedId}
isReset={isReset}
isSuccessSave={isSuccessSave}
foldersList={commonThirdPartyList}
withoutBasicSelection
/>
</div>
<ScheduleComponent isLoadingData={isLoadingData} {...rest} />
@ -84,5 +86,6 @@ export default inject(({ backup }) => {
setSelectedFolder,
passedId,
commonThirdPartyList,
isResourcesDefault,
};
})(withTranslation("Settings")(observer(ThirdPartyModule)));