Manager refactor, part 1 (#4298)

* Move BackupDatabase and AnonymiseDatabase to internal/manager
* Rename config.Instance to config.Config
* Rename FFMPEG
* Rework manager and initialization process
* Fix Makefile
* Tweak phasher
* Fix config races
* Fix setup error not clearing
This commit is contained in:
DingDongSoLong4
2023-11-28 04:56:46 +02:00
committed by GitHub
parent fc1fc20df4
commit b78771dbcd
45 changed files with 1230 additions and 1213 deletions

View File

@@ -43,7 +43,7 @@ export const Setup: React.FC = () => {
const [storeBlobsInDatabase, setStoreBlobsInDatabase] = useState(false);
const [blobsLocation, setBlobsLocation] = useState("");
const [loading, setLoading] = useState(false);
const [setupError, setSetupError] = useState("");
const [setupError, setSetupError] = useState<string>();
const intl = useIntl();
const history = useHistory();
@@ -617,7 +617,11 @@ export const Setup: React.FC = () => {
},
});
} catch (e) {
if (e instanceof Error) setSetupError(e.message ?? e.toString());
if (e instanceof Error && e.message) {
setSetupError(e.message);
} else {
setSetupError(String(e));
}
} finally {
setLoading(false);
next();
@@ -737,6 +741,11 @@ export const Setup: React.FC = () => {
}
function renderError() {
function onBackClick() {
setSetupError(undefined);
goBack(2);
}
return (
<>
<section>
@@ -758,7 +767,7 @@ export const Setup: React.FC = () => {
</section>
<section className="mt-5">
<div className="d-flex justify-content-center">
<Button variant="secondary mx-2 p-5" onClick={() => goBack(2)}>
<Button variant="secondary mx-2 p-5" onClick={onBackClick}>
<FormattedMessage id="actions.previous_action" />
</Button>
</div>
@@ -851,7 +860,7 @@ export const Setup: React.FC = () => {
}
function renderFinish() {
if (setupError) {
if (setupError !== undefined) {
return renderError();
}