mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
show specific notification for each plugin action
This commit is contained in:
@@ -161,7 +161,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
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<Props, State> {
|
||||
} else if (success) {
|
||||
return (
|
||||
<div className="media">
|
||||
<SuccessNotification />
|
||||
<SuccessNotification pluginAction={pluginAction} />
|
||||
</div>
|
||||
);
|
||||
} else if (restart) {
|
||||
|
||||
@@ -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<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() {
|
||||
const { t } = this.props;
|
||||
return (
|
||||
<Notification type="success">
|
||||
{t("plugins.modal.successNotification")}{" "}
|
||||
{this.createMessageForPluginAction()}{" "}
|
||||
<a onClick={e => window.location.reload(true)}>{t("plugins.modal.reload")}</a>
|
||||
</Notification>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user