From e64699bfc884e600be480a212ed4dc641c4088cd Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 21 Aug 2019 15:42:03 +0200 Subject: [PATCH] make the whole plugin card clickable and moved spinner to upper right corner --- .../packages/ui-components/src/CardColumn.js | 7 +++- .../admin/plugins/components/PluginEntry.js | 42 ++++++++++++------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/CardColumn.js b/scm-ui-components/packages/ui-components/src/CardColumn.js index 65710c7be2..713e1bced3 100644 --- a/scm-ui-components/packages/ui-components/src/CardColumn.js +++ b/scm-ui-components/packages/ui-components/src/CardColumn.js @@ -46,7 +46,8 @@ type Props = { contentRight?: React.Node, footerLeft: React.Node, footerRight: React.Node, - link: string, + link?: string, + action?: () => void, // context props classes: any @@ -54,9 +55,11 @@ type Props = { class CardColumn extends React.Component { createLink = () => { - const { link } = this.props; + const { link, action } = this.props; if (link) { return ; + } else if (action) { + return {e.preventDefault(); action();}} href="#" />; } return null; }; diff --git a/scm-ui/src/admin/plugins/components/PluginEntry.js b/scm-ui/src/admin/plugins/components/PluginEntry.js index 0ed128e75b..7a8bf6cf6c 100644 --- a/scm-ui/src/admin/plugins/components/PluginEntry.js +++ b/scm-ui/src/admin/plugins/components/PluginEntry.js @@ -23,6 +23,11 @@ const styles = { link: { cursor: "pointer", pointerEvents: "all" + }, + spinner: { + position: "absolute", + right: 0, + top: 0 } }; @@ -49,19 +54,14 @@ class PluginEntry extends React.Component { return {plugin.author}; }; - createFooterLeft = (plugin: Plugin) => { + isInstallable = () => { + const { plugin } = this.props; + return plugin._links && plugin._links.install && plugin._links.install.href; + }; + + createFooterLeft = () => { const { classes } = this.props; - if (plugin.pending) { - return ( - - - - ); - } else if ( - plugin._links && - plugin._links.install && - plugin._links.install.href - ) { + if (this.isInstallable()) { return ( { } }; + createPendingSpinner = () => { + const { plugin, classes } = this.props; + if (plugin.pending) { + return ( + + + + ); + } + return null; + }; + render() { const { plugin, refresh } = this.props; const { showModal } = this.state; const avatar = this.createAvatar(plugin); - const footerLeft = this.createFooterLeft(plugin); + const footerLeft = this.createFooterLeft(); const footerRight = this.createFooterRight(plugin); const modal = showModal ? ( @@ -88,14 +100,14 @@ class PluginEntry extends React.Component { /> ) : null; - // TODO: Add link to plugin page below return ( <>