From 78dbf3c771c78bcfac95dcb37d063b4d7b56d299 Mon Sep 17 00:00:00 2001 From: Laurence Maultsby Date: Fri, 14 Apr 2017 10:26:02 -0400 Subject: [PATCH] Composer buttons grayed out Signed-off-by: Laurence Maultsby --- .../composer/src/src/components/Button.js | 9 ++++++++- .../src/src/components/CatalogPanel.js | 2 +- .../src/src/components/ComposerApp.js | 7 +++++-- .../src/src/components/ComposerAppToolbar.js | 20 +++++++++---------- .../composer/src/src/styles/Button.scss | 4 ++-- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/skyquake/plugins/composer/src/src/components/Button.js b/skyquake/plugins/composer/src/src/components/Button.js index 6ef41bf93..65b90fdfc 100644 --- a/skyquake/plugins/composer/src/src/components/Button.js +++ b/skyquake/plugins/composer/src/src/components/Button.js @@ -58,8 +58,15 @@ const Button = React.createClass({ const title = this.props.title; const draggable = this.props.draggable; const className = ClassNames(this.props.className, 'Button'); + let style = { + } + if(this.props.disabled) { + style.pointerEvents = 'none'; + style.cursor = 'not-allowed'; + style.opacity = 0.25; + } return ( -
+
{ src ? : null } {label}
diff --git a/skyquake/plugins/composer/src/src/components/CatalogPanel.js b/skyquake/plugins/composer/src/src/components/CatalogPanel.js index d7ebf0f43..a3574e73e 100644 --- a/skyquake/plugins/composer/src/src/components/CatalogPanel.js +++ b/skyquake/plugins/composer/src/src/components/CatalogPanel.js @@ -117,7 +117,7 @@ const CatalogPanel = React.createClass({ const isLoading = this.props.isLoading; return (
- +
{(() => { if (isLoading) { diff --git a/skyquake/plugins/composer/src/src/components/ComposerApp.js b/skyquake/plugins/composer/src/src/components/ComposerApp.js index fd3fc9460..629f409dc 100644 --- a/skyquake/plugins/composer/src/src/components/ComposerApp.js +++ b/skyquake/plugins/composer/src/src/components/ComposerApp.js @@ -157,6 +157,7 @@ const ComposerApp = React.createClass({ let html = null; let self = this; const User = this.context.userProfile || {}; + const rbacDisabled = !isRBACValid(User, [PROJECT_ROLES.CAT_ADMIN]); if(this.state.hasModel) { function onClickUpdateSelection(event) { @@ -205,7 +206,8 @@ const ComposerApp = React.createClass({ + filterByType={self.state.filterCatalogByTypeValue} + rbacDisabled={rbacDisabled} /> { (self.state.panelTabShown == 'descriptor') ? @@ -235,7 +238,7 @@ const ComposerApp = React.createClass({ isEditingVNFD={isEditingVNFD} isModified={isModified} isNew={isNew} - disabled={!hasItem || !isRBACValid(User, [PROJECT_ROLES.CAT_ADMIN])} + disabled={!hasItem || rbacDisabled} onClick={event => event.stopPropagation()} panelTabShown={self.state.panelTabShown}/>
diff --git a/skyquake/plugins/composer/src/src/components/ComposerAppToolbar.js b/skyquake/plugins/composer/src/src/components/ComposerAppToolbar.js index 458e774c8..c1302ab52 100644 --- a/skyquake/plugins/composer/src/src/components/ComposerAppToolbar.js +++ b/skyquake/plugins/composer/src/src/components/ComposerAppToolbar.js @@ -136,11 +136,8 @@ const ComposerAppToolbar = React.createClass({ const style = {left: this.props.layout.left}; const saveClasses = ClassNames('ComposerAppSave', {'primary-action': this.props.isModified || this.props.isNew}); const cancelClasses = ClassNames('ComposerAppCancel', {'secondary-action': this.props.isModified}); - if (this.props.disabled) { - return ( -
- ); - } + let isDisabled = this.props.disabled; + console.log('rbacDisabled', isDisabled ) const hasSelection = SelectionManager.getSelections().length > 0; if(this.props.panelTabShown != 'descriptor') { style.pointerEvents = 'none'; @@ -156,35 +153,38 @@ const ComposerAppToolbar = React.createClass({ if (this.props.isEditingNSD || this.props.isEditingVNFD) { return (
-
); } })()}
-
); diff --git a/skyquake/plugins/composer/src/src/styles/Button.scss b/skyquake/plugins/composer/src/src/styles/Button.scss index 8220f0aa9..9af34bf9c 100644 --- a/skyquake/plugins/composer/src/src/styles/Button.scss +++ b/skyquake/plugins/composer/src/src/styles/Button.scss @@ -1,6 +1,6 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -67,4 +67,4 @@ font-size: 11px; } } -} \ No newline at end of file +} -- 2.17.1