mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Host Details Page: Hide action buttons for observers only (#1027)
This commit is contained in:
parent
c695093c70
commit
6e5a45eb60
1 changed files with 10 additions and 1 deletions
|
|
@ -53,6 +53,7 @@ export class HostDetailsPage extends Component {
|
|||
queries: PropTypes.arrayOf(queryInterface),
|
||||
queryErrors: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||
isBasicTier: PropTypes.bool,
|
||||
isOnlyObserver: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
@ -195,11 +196,16 @@ export class HostDetailsPage extends Component {
|
|||
|
||||
renderActionButtons = () => {
|
||||
const { toggleDeleteHostModal, toggleQueryHostModal } = this;
|
||||
const { host } = this.props;
|
||||
const { host, isOnlyObserver } = this.props;
|
||||
|
||||
const isOnline = host.status === "online";
|
||||
const isOffline = host.status === "offline";
|
||||
|
||||
// Hide action buttons for global and team only observers
|
||||
if (isOnlyObserver) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${baseClass}__action-button-container`}>
|
||||
<div data-tip data-for="query" data-tip-disable={isOnline}>
|
||||
|
|
@ -640,7 +646,9 @@ const mapStateToProps = (state, ownProps) => {
|
|||
const host = entityGetter(state).get("hosts").findBy({ id: hostID });
|
||||
const { loading: isLoadingHost } = state.entities.hosts;
|
||||
const config = state.app.config;
|
||||
const currentUser = state.auth.user;
|
||||
const isBasicTier = permissionUtils.isBasicTier(config);
|
||||
const isOnlyObserver = permissionUtils.isOnlyObserver(currentUser);
|
||||
|
||||
return {
|
||||
host,
|
||||
|
|
@ -649,6 +657,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||
queries,
|
||||
queryErrors,
|
||||
isBasicTier,
|
||||
isOnlyObserver,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue