From 78b17c17e863ebf2fe0d157eacf1ca56100d5d2b Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Sat, 28 Sep 2019 15:28:40 +0200 Subject: [PATCH] clear queues after abort pending changes / do not restart after update all plugins --- scm-ui/public/locales/de/admin.json | 9 ++- scm-ui/public/locales/en/admin.json | 11 ++- .../components/MultiPluginActionModal.js | 79 ++++++++++--------- .../scm/plugin/DefaultPluginManager.java | 10 +-- 4 files changed, 58 insertions(+), 51 deletions(-) diff --git a/scm-ui/public/locales/de/admin.json b/scm-ui/public/locales/de/admin.json index 3da907eb02..395c8ade6a 100644 --- a/scm-ui/public/locales/de/admin.json +++ b/scm-ui/public/locales/de/admin.json @@ -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": { diff --git a/scm-ui/public/locales/en/admin.json b/scm-ui/public/locales/en/admin.json index 245d048684..430949ec26 100644 --- a/scm-ui/public/locales/en/admin.json +++ b/scm-ui/public/locales/en/admin.json @@ -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": { diff --git a/scm-ui/src/admin/plugins/components/MultiPluginActionModal.js b/scm-ui/src/admin/plugins/components/MultiPluginActionModal.js index 3c543bf5c2..a2a127d33f 100644 --- a/scm-ui/src/admin/plugins/components/MultiPluginActionModal.js +++ b/scm-ui/src/admin/plugins/components/MultiPluginActionModal.js @@ -63,7 +63,7 @@ class MultiPluginActionModal extends React.Component { } 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 { 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 { 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 { }; renderUpdatable = () => { - const {installedPlugins, t} = this.props; + const { installedPlugins, t } = this.props; return ( <> {installedPlugins && @@ -236,17 +213,43 @@ class MultiPluginActionModal extends React.Component { ); }; + 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 ( <>
-

{t("plugins.modal.executePending")}

+

{this.renderDescription()}

{this.renderModalContent()}
-
{this.renderNotifications()}
+ {actionType === MultiPluginActionType.EXECUTE_PENDING && ( +
{this.renderNotifications()}
+ )} ); }; @@ -258,7 +261,7 @@ class MultiPluginActionModal extends React.Component {