Web: Added check for connecting a third-party resource: input is disabled if user didn't connecting a third-party resource.
This commit is contained in:
parent
b8460209d3
commit
b6881cd403
@ -177,14 +177,6 @@ export function getCommonFolderList(filter = FilesFilter.getDefault()) {
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getCommonThirdPartyList() {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/files/thirdparty/common",
|
||||
};
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getFavoritesFolderList(filter = FilesFilter.getDefault()) {
|
||||
const options = {
|
||||
method: "get",
|
||||
|
@ -242,3 +242,11 @@ export function updateConsumerProps(newProps) {
|
||||
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getCommonThirdPartyList() {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/files/thirdparty/common",
|
||||
};
|
||||
return request(options);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ class FileInputWithFolderPath extends Component {
|
||||
isReadOnly
|
||||
/>
|
||||
|
||||
<div className="icon" onClick={this.onClickInput}>
|
||||
<div className="icon" onClick={!isDisabled ? this.onClickInput : null}>
|
||||
<IconButton
|
||||
className="icon-button"
|
||||
iconName={"/static/images/catalog.folder.react.svg"}
|
||||
|
@ -13,8 +13,6 @@ import { useTranslation, withTranslation } from "react-i18next";
|
||||
const { auth: authStore } = store;
|
||||
|
||||
const OperationsDialog = ({
|
||||
getCommonThirdPartyList,
|
||||
commonThirdPartyList,
|
||||
commonFolder,
|
||||
operationsFolders,
|
||||
treeFolders,
|
||||
@ -27,7 +25,6 @@ const OperationsDialog = ({
|
||||
getFolderPath,
|
||||
}) => {
|
||||
useEffect(() => {
|
||||
getCommonThirdPartyList();
|
||||
fetchTreeFolders().then(() => getCommonFolder());
|
||||
}, []);
|
||||
|
||||
@ -80,18 +77,8 @@ const OperationsDialog = ({
|
||||
};
|
||||
|
||||
const OperationsDialogWrapper = inject(
|
||||
({
|
||||
auth,
|
||||
filesStore,
|
||||
treeFoldersStore,
|
||||
selectedFolderStore,
|
||||
dialogsStore,
|
||||
}) => {
|
||||
const {
|
||||
commonThirdPartyList,
|
||||
getCommonThirdPartyList,
|
||||
filter,
|
||||
} = filesStore;
|
||||
({ auth, filesStore, treeFoldersStore, selectedFolderStore }) => {
|
||||
const { filter } = filesStore;
|
||||
const { setPanelVisible } = auth;
|
||||
const { getFolderPath } = auth.settingsStore;
|
||||
const {
|
||||
@ -110,8 +97,7 @@ const OperationsDialogWrapper = inject(
|
||||
? expandedPanelKeys
|
||||
: selectedFolderStore.pathParts,
|
||||
filter,
|
||||
commonThirdPartyList,
|
||||
getCommonThirdPartyList,
|
||||
|
||||
commonFolder,
|
||||
operationsFolders,
|
||||
treeFolders,
|
||||
|
@ -43,8 +43,6 @@ class FilesStore {
|
||||
filter = FilesFilter.getDefault(); //TODO: FILTER
|
||||
loadTimeout = null;
|
||||
|
||||
commonThirdPartyList = [];
|
||||
|
||||
constructor(
|
||||
authStore,
|
||||
settingsStore,
|
||||
@ -1218,11 +1216,6 @@ class FilesStore {
|
||||
this.setFile(fileInfo);
|
||||
};
|
||||
|
||||
getCommonThirdPartyList = async () => {
|
||||
this.commonThirdPartyList = await api.files.getCommonThirdPartyList();
|
||||
|
||||
console.log(" this.commonThirdPartyList", this.commonThirdPartyList);
|
||||
};
|
||||
openDocEditor = (id, providerKey = null, tab = null, url = null) => {
|
||||
if (providerKey) {
|
||||
tab
|
||||
|
@ -6,7 +6,7 @@ import styled from "styled-components";
|
||||
import Button from "@appserver/components/button";
|
||||
import Checkbox from "@appserver/components/checkbox";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { getThirdPartyList } from "@appserver/common/api/files";
|
||||
|
||||
import DocumentsModule from "./sub-components/documentsModule";
|
||||
import FileInputWithFolderPath from "@appserver/components/file-input-with-folder-path";
|
||||
|
||||
@ -31,17 +31,6 @@ const StyledComponent = styled.div`
|
||||
margin-top: 16px;
|
||||
}
|
||||
`;
|
||||
// const ManualBackup = () => {
|
||||
// const { t } = useTranslation("Settings");
|
||||
// const [isChecked, setIsChecked] = useState(false);
|
||||
// const [isIncludeMail, setIsIncludeMail] = useState(false);
|
||||
|
||||
// ;
|
||||
// return (
|
||||
|
||||
// );
|
||||
// };
|
||||
|
||||
class ManualBackup extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -58,7 +47,8 @@ class ManualBackup extends React.Component {
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
// getThirdPartyList().then((res) => console.log("res", res));
|
||||
const { getCommonThirdPartyList } = this.props;
|
||||
getCommonThirdPartyList();
|
||||
}
|
||||
onClickCheckbox = (e) => {
|
||||
const name = e.target.name;
|
||||
@ -67,14 +57,20 @@ class ManualBackup extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { t, providers, panelVisible, folderPath } = this.props;
|
||||
const {
|
||||
t,
|
||||
providers,
|
||||
panelVisible,
|
||||
folderPath,
|
||||
commonThirdPartyList,
|
||||
} = this.props;
|
||||
// const {
|
||||
// backupMailTemporaryStorage,
|
||||
// backupMailDocuments,
|
||||
// backupMailThirdParty,
|
||||
// backupMailThirdPartyStorage,
|
||||
// } = this.state;
|
||||
console.log("folderPath", folderPath);
|
||||
console.log("commonThirdPartyList", commonThirdPartyList);
|
||||
return (
|
||||
<StyledComponent>
|
||||
<div className="category-item-wrapper temporary-storage">
|
||||
@ -169,12 +165,18 @@ class ManualBackup extends React.Component {
|
||||
onChange={this.onClickCheckbox}
|
||||
/>
|
||||
</div> */}
|
||||
<FileInputWithFolderPath
|
||||
scale
|
||||
className="backup-folder_path"
|
||||
isDisabled={commonThirdPartyList.length === 0}
|
||||
/>
|
||||
{panelVisible && <OperationsDialog />}
|
||||
<div className="manual-backup_buttons">
|
||||
<Button
|
||||
label={t("MakeCopy")}
|
||||
onClick={() => console.log("click")}
|
||||
primary
|
||||
isDisabled={false}
|
||||
isDisabled={commonThirdPartyList.length === 0}
|
||||
size="medium"
|
||||
tabIndex={10}
|
||||
/>
|
||||
@ -218,12 +220,16 @@ class ManualBackup extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default inject(({ auth }) => {
|
||||
export default inject(({ auth, setup }) => {
|
||||
const { setPanelVisible, panelVisible } = auth;
|
||||
const { folderPath } = auth.settingsStore;
|
||||
const { getCommonThirdPartyList } = setup;
|
||||
const { commonThirdPartyList } = setup.dataManagement;
|
||||
return {
|
||||
setPanelVisible,
|
||||
panelVisible,
|
||||
folderPath,
|
||||
getCommonThirdPartyList,
|
||||
commonThirdPartyList,
|
||||
};
|
||||
})(withTranslation("Settings")(observer(ManualBackup)));
|
||||
|
@ -25,6 +25,10 @@ class SettingsSetupStore {
|
||||
selectedConsumer: {},
|
||||
};
|
||||
|
||||
dataManagement = {
|
||||
commonThirdPartyList: [],
|
||||
};
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
@ -65,6 +69,9 @@ class SettingsSetupStore {
|
||||
this.integration.consumers = consumers;
|
||||
};
|
||||
|
||||
setCommonThirdPartyList = (commonThirdPartyList) => {
|
||||
this.dataManagement.commonThirdPartyList = commonThirdPartyList;
|
||||
};
|
||||
setSelectedConsumer = (selectedConsumerName) => {
|
||||
this.integration.selectedConsumer =
|
||||
this.integration.consumers.find((c) => c.name === selectedConsumerName) ||
|
||||
@ -201,6 +208,12 @@ class SettingsSetupStore {
|
||||
sendOwnerChange = (id) => {
|
||||
return api.settings.sendOwnerChange(id);
|
||||
};
|
||||
|
||||
getCommonThirdPartyList = async () => {
|
||||
const res = await api.settings.getCommonThirdPartyList();
|
||||
|
||||
this.setCommonThirdPartyList(res);
|
||||
};
|
||||
}
|
||||
|
||||
export default SettingsSetupStore;
|
||||
|
Loading…
Reference in New Issue
Block a user