From ea1c11a96a767c9f4704e1843fa8c3173e27bb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Tue, 1 Oct 2019 17:57:38 +0200 Subject: [PATCH] Cleanup MultiPluginAction --- .../plugins/components/MultiPluginAction.js | 47 +++---------------- .../plugins/containers/PluginsOverview.js | 36 ++++++++------ 2 files changed, 28 insertions(+), 55 deletions(-) diff --git a/scm-ui/src/admin/plugins/components/MultiPluginAction.js b/scm-ui/src/admin/plugins/components/MultiPluginAction.js index 05e145f215..b60374124d 100644 --- a/scm-ui/src/admin/plugins/components/MultiPluginAction.js +++ b/scm-ui/src/admin/plugins/components/MultiPluginAction.js @@ -11,56 +11,21 @@ export const MultiPluginActionType = { }; type Props = { - actionType: string, - pendingPlugins?: PendingPlugins, - installedPlugins?: PluginCollection, - refresh: () => void, + icon: string, + label: string, onClick: () => void, - - // context props - t: (key: string, params?: Object) => string }; class MultiPluginAction extends React.Component { - - renderLabel = () => { - const { t, actionType, installedPlugins } = this.props; - - if (actionType === MultiPluginActionType.EXECUTE_PENDING) { - return t("plugins.executePending"); - } else if (actionType === MultiPluginActionType.CANCEL_PENDING) { - return t("plugins.cancelPending"); - } else { - const outdatedPlugins = installedPlugins._embedded.plugins.filter( - p => p._links.update - ).length; - return t("plugins.outdatedPlugins", { - count: outdatedPlugins - }); - } - }; - - renderIcon = () => { - const { actionType } = this.props; - - if (actionType === MultiPluginActionType.EXECUTE_PENDING) { - return "arrow-circle-right"; - } else if (actionType === MultiPluginActionType.CANCEL_PENDING) { - return "times"; - } else { - return "sync-alt"; - } - }; - render() { - const { onClick } = this.props; + const { onClick, icon, label } = this.props; return ( <>