clear queues after abort pending changes / do not restart after update all plugins

This commit is contained in:
Eduard Heimbuch
2019-09-28 15:28:40 +02:00
parent 333579ef2a
commit 78b17c17e8
4 changed files with 58 additions and 51 deletions

View File

@@ -29,9 +29,9 @@
"installedNavLink": "Installiert",
"availableNavLink": "Verfügbar"
},
"executePending": "Ausstehende Plugin-Änderungen ausführen",
"executePending": "Ausstehende Änderungen ausführen",
"updateAll": "Alle Plugins aktualisieren",
"cancelPending": "Ausstehende Plugin-Änderungen abbrechen",
"cancelPending": "Ausstehende Änderungen abbrechen",
"noPlugins": "Keine Plugins gefunden.",
"modal": {
"title": {
@@ -50,6 +50,7 @@
"updateAndRestart": "Aktualisieren und Neustarten",
"uninstallAndRestart": "Deinstallieren and Neustarten",
"executeAndRestart": "Ausführen und Neustarten",
"updateAllAndRestart": "Alle aktualisieren und Neustarten",
"abort": "Abbrechen",
"author": "Autor",
"version": "Version",
@@ -60,7 +61,9 @@
"successNotification": "Das Plugin wurde erfolgreich installiert. Um Änderungen an der UI zu sehen, muss die Seite neu geladen werden:",
"reload": "jetzt neu laden",
"restartNotification": "Der SCM-Manager Kontext sollte nur neu gestartet werden, wenn aktuell niemand damit arbeitet.",
"executePending": "Die folgenden Plugin-Änderungen werden ausgeführt. Anschließend wird der SCM-Manager Kontext neu gestartet."
"executePending": "Die folgenden Plugin-Änderungen werden ausgeführt. Anschließend wird der SCM-Manager Kontext neu gestartet.",
"cancelPending": "Die folgenden Plugin-Änderungen werden abgebrochen und zurückgesetzt.",
"updateAllInfo": "Die folgenden Plugins werden aktualisiert. Die Änderungen werden nach dem nächsten Neustart wirksam."
}
},
"repositoryRole": {

View File

@@ -29,9 +29,9 @@
"installedNavLink": "Installed",
"availableNavLink": "Available"
},
"executePending": "Execute pending plugin changes",
"updateAll": "Update all plugins",
"cancelPending": "Cancel pending plugin changes",
"executePending": "Execute pending changes",
"updateAll": "Update all",
"cancelPending": "Cancel pending changes",
"noPlugins": "No plugins found.",
"modal": {
"title": {
@@ -50,6 +50,7 @@
"updateAndRestart": "Update and Restart",
"uninstallAndRestart": "Uninstall and Restart",
"executeAndRestart": "Execute and Restart",
"updateAll": "Update all plugins",
"abort": "Abort",
"author": "Author",
"version": "Version",
@@ -60,7 +61,9 @@
"successNotification": "Successful installed plugin. You have to reload the page, to see ui changes:",
"reload": "reload now",
"restartNotification": "You should only restart the scm-manager context if no one else is currently working with it.",
"executePending": "The following plugin changes will be executed and after that the scm-manager context will be restarted."
"executePending": "The following plugin changes will be executed and after that the scm-manager context will be restarted.",
"cancelPending": "The following plugin changes will be canceled.",
"updateAllInfo": "The following plugin changes will be executed. You need to restart the scm-manager to make these changes effective."
}
},
"repositoryRole": {

View File

@@ -63,7 +63,7 @@ class MultiPluginActionModal extends React.Component<Props, State> {
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
this.cancelPending();
} else if (actionType === MultiPluginActionType.UPDATE_ALL) {
this.updateAllWithRestart();
this.updateAll();
}
};
@@ -97,24 +97,10 @@ class MultiPluginActionModal extends React.Component<Props, State> {
loading: true
});
apiClient
.post(pendingPlugins._links.cancel.href)
.then(() => {
this.setState({
success: true,
loading: false
});
})
.catch(error => {
this.setState({
success: false,
loading: false,
error: error
});
});
apiClient.post(pendingPlugins._links.cancel.href).then(() => this.reload());
};
updateAllWithRestart = () => {
updateAll = () => {
const { installedPlugins } = this.props;
this.setState({
loading: true
@@ -122,20 +108,11 @@ class MultiPluginActionModal extends React.Component<Props, State> {
apiClient
.post(installedPlugins._links.update.href)
.then(waitForRestart)
.then(() => {
this.setState({
success: true,
loading: false
});
})
.catch(error => {
this.setState({
success: false,
loading: false,
error: error
});
});
.then(() => this.reload());
};
reload = () => {
window.location.reload(true);
};
renderModalContent = () => {
@@ -155,7 +132,7 @@ class MultiPluginActionModal extends React.Component<Props, State> {
};
renderUpdatable = () => {
const {installedPlugins, t} = this.props;
const { installedPlugins, t } = this.props;
return (
<>
{installedPlugins &&
@@ -236,17 +213,43 @@ class MultiPluginActionModal extends React.Component<Props, State> {
);
};
renderDescription = () => {
const { t, actionType } = this.props;
if (actionType === MultiPluginActionType.EXECUTE_PENDING) {
return t("plugins.modal.executePending");
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
return t("plugins.modal.cancelPending");
} else if (actionType === MultiPluginActionType.UPDATE_ALL) {
return t("plugins.modal.updateAllInfo");
}
};
renderLabel = () => {
const { t, actionType } = this.props;
if (actionType === MultiPluginActionType.EXECUTE_PENDING) {
return t("plugins.modal.executeAndRestart");
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
return t("plugins.cancelPending");
} else if (actionType === MultiPluginActionType.UPDATE_ALL) {
return t("plugins.updateAll");
}
};
renderBody = () => {
const { t } = this.props;
const { actionType } = this.props;
return (
<>
<div className="media">
<div className="content">
<p>{t("plugins.modal.executePending")}</p>
<p>{this.renderDescription()}</p>
{this.renderModalContent()}
</div>
</div>
{actionType === MultiPluginActionType.EXECUTE_PENDING && (
<div className="media">{this.renderNotifications()}</div>
)}
</>
);
};
@@ -258,7 +261,7 @@ class MultiPluginActionModal extends React.Component<Props, State> {
<ButtonGroup>
<Button
color="warning"
label={t("plugins.modal.executeAndRestart")}
label={this.renderLabel()}
loading={loading}
action={this.executeAction}
disabled={error || success}
@@ -269,10 +272,10 @@ class MultiPluginActionModal extends React.Component<Props, State> {
};
render() {
const { onClose, t } = this.props;
const { onClose } = this.props;
return (
<Modal
title={t("plugins.modal.executeAndRestart")}
title={this.renderLabel()}
closeFunction={onClose}
body={this.renderBody()}
footer={this.renderFooter()}

View File

@@ -144,6 +144,7 @@ public class DefaultPluginManager implements PluginManager {
return getInstalled()
.stream()
.filter(p -> isUpdatable(p.getDescriptor().getInformation().getName()))
.filter(p -> !p.isMarkedForUninstall())
.collect(Collectors.toList());
}
@@ -285,22 +286,19 @@ public class DefaultPluginManager implements PluginManager {
PluginPermissions.manage().check();
pendingUninstallQueue.forEach(PendingPluginUninstallation::cancel);
pendingInstallQueue.forEach(PendingPluginInstallation::cancel);
pendingUninstallQueue.clear();
pendingInstallQueue.clear();
getInstalled().forEach(p -> p.setUninstallable(isUninstallable(p)));
}
@Override
public void updateAll() {
PluginPermissions.manage().check();
boolean pluginUpdated = false;
for (InstalledPlugin installedPlugin : getInstalled()) {
String pluginName = installedPlugin.getDescriptor().getInformation().getName();
if (isUpdatable(pluginName)) {
install(pluginName, false);
pluginUpdated = true;
}
}
if (pluginUpdated) {
restart("update all plugins");
}
}
}