Files
SCM-Manager/scm-ui/ui-webapp/src/admin/plugins/components/SuccessNotification.tsx

35 lines
1.1 KiB
TypeScript
Raw Normal View History

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");
};
render() {
const { t } = this.props;
return (
<Notification type="success">
{this.createMessageForPluginAction()}{" "}
2019-10-21 10:57:56 +02:00
<a onClick={e => window.location.reload(true)}>{t("plugins.modal.reload")}</a>
</Notification>
);
}
}
export default withTranslation("admin")(InstallSuccessNotification);