From 21bf5919a91041f48825c309e6a491e18c38b1c7 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Mon, 6 Nov 2017 20:42:47 -0800 Subject: [PATCH] Rewire AuthorizeOperationBtn; create new selector for filtering definitions --- .../auth/authorize-operation-btn.jsx | 28 +++++++------------ src/core/components/operation.jsx | 11 ++++++-- src/core/plugins/auth/selectors.js | 7 +++++ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/core/components/auth/authorize-operation-btn.jsx b/src/core/components/auth/authorize-operation-btn.jsx index 7c2f2448..760bac2a 100644 --- a/src/core/components/auth/authorize-operation-btn.jsx +++ b/src/core/components/auth/authorize-operation-btn.jsx @@ -1,25 +1,23 @@ import React from "react" import PropTypes from "prop-types" -import ImPropTypes from "react-immutable-proptypes" export default class AuthorizeOperationBtn extends React.Component { + static propTypes = { + isAuthorized: PropTypes.bool.isRequired, + onClick: PropTypes.func + } + onClick =(e) => { e.stopPropagation() + let { onClick } = this.props - let { security, authActions, authSelectors } = this.props - let definitions = authSelectors.getDefinitionsByNames(security) - - authActions.showDefinitions(definitions) + if(onClick) { + onClick() + } } render() { - let { security, authSelectors } = this.props - - let isAuthorized = authSelectors.isAuthorized(security) - - if(isAuthorized === null) { - return null - } + let { isAuthorized } = this.props return (