show specific notification for each plugin action

This commit is contained in:
Eduard Heimbuch
2020-03-19 10:06:54 +01:00
parent ae8c6a2391
commit 99e2781d93
4 changed files with 29 additions and 6 deletions

View File

@@ -61,7 +61,10 @@
"newVersion": "Neue Version", "newVersion": "Neue Version",
"dependencyNotification": "Mit diesem Plugin werden folgende Abhängigkeiten mit installiert, wenn sie noch nicht vorhanden sind!", "dependencyNotification": "Mit diesem Plugin werden folgende Abhängigkeiten mit installiert, wenn sie noch nicht vorhanden sind!",
"dependencies": "Abhängigkeiten", "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", "reload": "jetzt neu laden",
"restartNotification": "Der SCM-Manager Kontext sollte nur neu gestartet werden, wenn aktuell niemand damit arbeitet.", "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.",

View File

@@ -61,7 +61,10 @@
"newVersion": "New version", "newVersion": "New version",
"dependencyNotification": "With this plugin, the following dependencies will be installed if they are not available yet!", "dependencyNotification": "With this plugin, the following dependencies will be installed if they are not available yet!",
"dependencies": "Dependencies", "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", "reload": "reload now",
"restartNotification": "You should only restart the scm-manager context if no one else is currently working with it.", "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.",

View File

@@ -161,7 +161,7 @@ class PluginModal extends React.Component<Props, State> {
} }
renderNotifications = () => { renderNotifications = () => {
const { t } = this.props; const { t, pluginAction } = this.props;
const { restart, error, success } = this.state; const { restart, error, success } = this.state;
if (error) { if (error) {
return ( return (
@@ -172,7 +172,7 @@ class PluginModal extends React.Component<Props, State> {
} else if (success) { } else if (success) {
return ( return (
<div className="media"> <div className="media">
<SuccessNotification /> <SuccessNotification pluginAction={pluginAction} />
</div> </div>
); );
} else if (restart) { } else if (restart) {

View File

@@ -1,13 +1,30 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Notification } from "@scm-manager/ui-components"; import { Notification } from "@scm-manager/ui-components";
import { PluginAction } from "./PluginEntry";
type Props = WithTranslation & {
pluginAction?: string;
};
class InstallSuccessNotification extends React.Component<Props> {
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<WithTranslation> {
render() { render() {
const { t } = this.props; const { t } = this.props;
return ( return (
<Notification type="success"> <Notification type="success">
{t("plugins.modal.successNotification")}{" "} {this.createMessageForPluginAction()}{" "}
<a onClick={e => window.location.reload(true)}>{t("plugins.modal.reload")}</a> <a onClick={e => window.location.reload(true)}>{t("plugins.modal.reload")}</a>
</Notification> </Notification>
); );