wait until restart is complete

This commit is contained in:
Sebastian Sdorra
2019-08-22 08:24:01 +02:00
parent 6351e39c12
commit b796e45fb4
4 changed files with 79 additions and 19 deletions

View File

@@ -14,6 +14,8 @@ import {
Notification
} from "@scm-manager/ui-components";
import classNames from "classnames";
import waitForRestart from "./waitForRestart";
import InstallSuccessNotification from "./InstallSuccessNotification";
type Props = {
plugin: Plugin,
@@ -63,10 +65,20 @@ class PluginModal extends React.Component<Props, State> {
};
if (restart) {
this.setState({
...newState,
success: true
});
waitForRestart()
.then(() => {
this.setState({
...newState,
success: true
});
})
.catch(error => {
this.setState({
loading: false,
success: false,
error
});
});
} else {
this.setState(newState, () => {
refresh();
@@ -150,12 +162,7 @@ class PluginModal extends React.Component<Props, State> {
} else if (success) {
return (
<div className="media">
<Notification type="success">
{t("plugins.modal.successNotification")}{" "}
<a onClick={e => window.location.reload()}>
{t("plugins.modal.reload")}
</a>
</Notification>
<InstallSuccessNotification />
</div>
);
} else if (restart) {