2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
2019-10-23 15:47:08 +02:00
|
|
|
import { WithTranslation, withTranslation } from "react-i18next";
|
2019-10-20 18:02:52 +02:00
|
|
|
import { Notification } from "@scm-manager/ui-components";
|
2020-03-19 10:06:54 +01:00
|
|
|
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");
|
|
|
|
|
};
|
2019-10-19 16:38:07 +02:00
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { t } = this.props;
|
|
|
|
|
return (
|
|
|
|
|
<Notification type="success">
|
2020-03-19 10:06:54 +01:00
|
|
|
{this.createMessageForPluginAction()}{" "}
|
2019-10-21 10:57:56 +02:00
|
|
|
<a onClick={e => window.location.reload(true)}>{t("plugins.modal.reload")}</a>
|
2019-10-19 16:38:07 +02:00
|
|
|
</Notification>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
export default withTranslation("admin")(InstallSuccessNotification);
|