Web: Files: Added upload method.
This commit is contained in:
parent
40d56075f1
commit
a3ffeadafe
@ -21,6 +21,7 @@ import { combineUrl } from "@appserver/common/utils";
|
|||||||
import { AppServerConfig } from "@appserver/common/constants";
|
import { AppServerConfig } from "@appserver/common/constants";
|
||||||
import config from "../../../../../../package.json";
|
import config from "../../../../../../package.json";
|
||||||
import FloatingButton from "@appserver/common/components/FloatingButton";
|
import FloatingButton from "@appserver/common/components/FloatingButton";
|
||||||
|
import { request } from "@appserver/common/api/client";
|
||||||
|
|
||||||
class RestoreBackup extends React.Component {
|
class RestoreBackup extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -50,6 +51,8 @@ class RestoreBackup extends React.Component {
|
|||||||
"isCheckedThirdParty",
|
"isCheckedThirdParty",
|
||||||
"isCheckedThirdPartyStorage",
|
"isCheckedThirdPartyStorage",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
this.storageId = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -211,6 +214,7 @@ class RestoreBackup extends React.Component {
|
|||||||
selectedFile,
|
selectedFile,
|
||||||
isCheckedThirdPartyStorage,
|
isCheckedThirdPartyStorage,
|
||||||
isCheckedThirdParty,
|
isCheckedThirdParty,
|
||||||
|
formSettings,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
if (isCheckedDocuments || isCheckedThirdParty) {
|
if (isCheckedDocuments || isCheckedThirdParty) {
|
||||||
if (!selectedFileId) return false;
|
if (!selectedFileId) return false;
|
||||||
@ -241,7 +245,7 @@ class RestoreBackup extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
onRestoreClick = () => {
|
onRestoreClick = async () => {
|
||||||
const {
|
const {
|
||||||
isNotify,
|
isNotify,
|
||||||
isCheckedDocuments,
|
isCheckedDocuments,
|
||||||
@ -250,6 +254,7 @@ class RestoreBackup extends React.Component {
|
|||||||
selectedFile,
|
selectedFile,
|
||||||
isCheckedThirdPartyStorage,
|
isCheckedThirdPartyStorage,
|
||||||
isCheckedThirdParty,
|
isCheckedThirdParty,
|
||||||
|
formSettings,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const { history } = this.props;
|
const { history } = this.props;
|
||||||
|
|
||||||
@ -279,29 +284,52 @@ class RestoreBackup extends React.Component {
|
|||||||
storageParams.push(obj);
|
storageParams.push(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(
|
console.log(
|
||||||
// "backupId",
|
"backupId",
|
||||||
// backupId,
|
backupId,
|
||||||
// "storageType",
|
"storageType",
|
||||||
// storageType,
|
storageType,
|
||||||
// "storageParams",
|
"storageParams",
|
||||||
// storageParams,
|
storageParams,
|
||||||
// "isNotify",
|
"isNotify",
|
||||||
// isNotify
|
isNotify,
|
||||||
// );
|
selectedFile
|
||||||
//return;
|
);
|
||||||
startRestore(backupId, storageType, storageParams, isNotify)
|
|
||||||
.then(() => getSettings())
|
try {
|
||||||
.then(() =>
|
if (isCheckedLocalFile) {
|
||||||
history.push(
|
const data = await request({
|
||||||
combineUrl(
|
baseURL: combineUrl(AppServerConfig.proxyURL, config.homepage),
|
||||||
AppServerConfig.proxyURL,
|
method: "post",
|
||||||
config.homepage,
|
url: `/backupFileUpload.ashx`,
|
||||||
"/preparation-portal"
|
responseType: "text",
|
||||||
)
|
data: {
|
||||||
)
|
backupStorageSelector: "4",
|
||||||
)
|
autoBackupSwitch: "1",
|
||||||
.catch((error) => toastr.error(error));
|
autoBackupSettingsStorageSelector: "0",
|
||||||
|
restoreStorageVariants: "3",
|
||||||
|
files: selectedFile,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.error("data", data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// startRestore(backupId, storageType, storageParams, isNotify)
|
||||||
|
// .then(() => getSettings())
|
||||||
|
// .then(() => (this.storageId = ""))
|
||||||
|
// .then(() =>
|
||||||
|
// history.push(
|
||||||
|
// combineUrl(
|
||||||
|
// AppServerConfig.proxyURL,
|
||||||
|
// config.homepage,
|
||||||
|
// "/preparation-portal"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// .catch((error) => toastr.error(error));
|
||||||
};
|
};
|
||||||
|
|
||||||
onSetFormNames = (namesArray) => {
|
onSetFormNames = (namesArray) => {
|
||||||
@ -333,6 +361,10 @@ class RestoreBackup extends React.Component {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onSetStorageId = (storageId) => {
|
||||||
|
this.storageId = storageId;
|
||||||
|
};
|
||||||
render() {
|
render() {
|
||||||
const { t, history } = this.props;
|
const { t, history } = this.props;
|
||||||
const {
|
const {
|
||||||
@ -349,6 +381,7 @@ class RestoreBackup extends React.Component {
|
|||||||
isErrors,
|
isErrors,
|
||||||
isCopyingToLocal,
|
isCopyingToLocal,
|
||||||
downloadingProgress,
|
downloadingProgress,
|
||||||
|
storageId,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const commonRadioButtonProps = {
|
const commonRadioButtonProps = {
|
||||||
@ -361,7 +394,7 @@ class RestoreBackup extends React.Component {
|
|||||||
|
|
||||||
const isDisabledThirdParty =
|
const isDisabledThirdParty =
|
||||||
this.commonThirdPartyList && this.commonThirdPartyList.length === 0;
|
this.commonThirdPartyList && this.commonThirdPartyList.length === 0;
|
||||||
|
console.log("render child ");
|
||||||
return isLoading ? (
|
return isLoading ? (
|
||||||
<Loader className="pageLoader" type="rombs" size="40px" />
|
<Loader className="pageLoader" type="rombs" size="40px" />
|
||||||
) : (
|
) : (
|
||||||
@ -431,6 +464,7 @@ class RestoreBackup extends React.Component {
|
|||||||
formSettings={formSettings}
|
formSettings={formSettings}
|
||||||
onResetFormSettings={this.onResetFormSettings}
|
onResetFormSettings={this.onResetFormSettings}
|
||||||
isErrors={isErrors}
|
isErrors={isErrors}
|
||||||
|
onSetStorageId={this.onSetStorageId}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isCheckedLocalFile && (
|
{isCheckedLocalFile && (
|
||||||
|
Loading…
Reference in New Issue
Block a user