From 99e2781d93b793e0a395544412e0203cbbb83e75 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Thu, 19 Mar 2020 10:06:54 +0100 Subject: [PATCH 1/2] show specific notification for each plugin action --- scm-ui/ui-webapp/public/locales/de/admin.json | 5 ++++- scm-ui/ui-webapp/public/locales/en/admin.json | 5 ++++- .../admin/plugins/components/PluginModal.tsx | 4 ++-- .../components/SuccessNotification.tsx | 21 +++++++++++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/scm-ui/ui-webapp/public/locales/de/admin.json b/scm-ui/ui-webapp/public/locales/de/admin.json index 2bfc2d6b5b..e65a10eb85 100644 --- a/scm-ui/ui-webapp/public/locales/de/admin.json +++ b/scm-ui/ui-webapp/public/locales/de/admin.json @@ -61,7 +61,10 @@ "newVersion": "Neue Version", "dependencyNotification": "Mit diesem Plugin werden folgende Abhängigkeiten mit installiert, wenn sie noch nicht vorhanden sind!", "dependencies": "Abhängigkeiten", - "successNotification": "Das Plugin wurde erfolgreich installiert. Um Änderungen an der UI zu sehen, muss die Seite neu geladen werden:", + "installedNotification": "Das Plugin wurde erfolgreich installiert. Um Änderungen an der UI zu sehen, muss die Seite neu geladen werden:", + "updatedNotification": "Das Plugin wurde erfolgreich aktualisiert. Um Änderungen an der UI zu sehen, muss die Seite neu geladen werden:", + "uninstalledNotification": "Das Plugin wurde erfolgreich installiert. Um Änderungen an der UI zu sehen, muss die Seite neu geladen werden:", + "executedChangesNotification": "Die Plugin Änderungen wurden erfolgreich durchgeführt. 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.", diff --git a/scm-ui/ui-webapp/public/locales/en/admin.json b/scm-ui/ui-webapp/public/locales/en/admin.json index b061901df2..5e7e44dcd2 100644 --- a/scm-ui/ui-webapp/public/locales/en/admin.json +++ b/scm-ui/ui-webapp/public/locales/en/admin.json @@ -61,7 +61,10 @@ "newVersion": "New version", "dependencyNotification": "With this plugin, the following dependencies will be installed if they are not available yet!", "dependencies": "Dependencies", - "successNotification": "Successful installed plugin. You have to reload the page, to see ui changes:", + "installedNotification": "Successfully installed plugin. You have to reload the page, to see ui changes:", + "updatedNotification": "Successfully updated plugin. You have to reload the page, to see ui changes:", + "uninstalledNotification": "Successfully uninstalled plugin. You have to reload the page, to see ui changes:", + "executedChangesNotification": "Successfully executed plugin changes. 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.", diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx index 1863ce0843..d8dd1bdd9c 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/PluginModal.tsx @@ -161,7 +161,7 @@ class PluginModal extends React.Component { } renderNotifications = () => { - const { t } = this.props; + const { t, pluginAction } = this.props; const { restart, error, success } = this.state; if (error) { return ( @@ -172,7 +172,7 @@ class PluginModal extends React.Component { } else if (success) { return (
- +
); } else if (restart) { diff --git a/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx b/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx index 8e01e84bbd..cbee8e3e15 100644 --- a/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx +++ b/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx @@ -1,13 +1,30 @@ import React from "react"; import { WithTranslation, withTranslation } from "react-i18next"; import { Notification } from "@scm-manager/ui-components"; +import { PluginAction } from "./PluginEntry"; + +type Props = WithTranslation & { + pluginAction?: string; +}; + +class InstallSuccessNotification extends React.Component { + createMessageForPluginAction = () => { + const { pluginAction, t } = this.props; + if (pluginAction === PluginAction.INSTALL) { + return t("plugins.modal.installedNotification"); + } else if (pluginAction === PluginAction.UPDATE) { + return t("plugins.modal.updatedNotification"); + } else if (pluginAction === PluginAction.UNINSTALL) { + return t("plugins.modal.uninstalledNotification"); + } + return t("plugins.modal.executedChangesNotification"); + }; -class InstallSuccessNotification extends React.Component { render() { const { t } = this.props; return ( - {t("plugins.modal.successNotification")}{" "} + {this.createMessageForPluginAction()}{" "} window.location.reload(true)}>{t("plugins.modal.reload")} ); From e30bbcfc6c50016076d451eb1eef868435e58910 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Thu, 19 Mar 2020 10:11:13 +0100 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd6ceb194b..c3f417e570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Extension point to add links to the repository cards from plug ins ([#1041](https://github.com/scm-manager/scm-manager/pull/1041)) +### Fixed +- Show specific notification for plugin actions on plugin administration ([#1057](https://github.com/scm-manager/scm-manager/pull/1057)) + ## 2.0.0-rc5 - 2020-03-12 ### Added - Added footer extension points for links and avatar