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