diff --git a/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx b/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx
index 6e79afe57c..7229258387 100644
--- a/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx
+++ b/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx
@@ -19,6 +19,7 @@ class HostSidePanel extends Component {
onLabelClick: PropTypes.func,
selectedFilter: PropTypes.string,
statusLabels: statusLabelsInterface,
+ canAddNewLabel: PropTypes.bool,
};
constructor(props) {
@@ -41,6 +42,7 @@ class HostSidePanel extends Component {
onLabelClick,
selectedFilter,
statusLabels,
+ canAddNewLabel,
} = this.props;
const { labelFilter } = this.state;
const { onFilterLabels } = this;
@@ -100,14 +102,15 @@ class HostSidePanel extends Component {
selectedFilter={selectedFilter}
type="label"
/>
-
-
+ {canAddNewLabel ? (
+
+ ) : null}
);
}
diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx
index 8fc5993097..f87605aa5a 100644
--- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx
+++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.jsx
@@ -42,7 +42,6 @@ import NoHosts from "./components/NoHosts";
import EmptyHosts from "./components/EmptyHosts";
import EditColumnsModal from "./components/EditColumnsModal/EditColumnsModal";
import TransferHostModal from "./components/TransferHostModal";
-
import EditColumnsIcon from "../../../../assets/images/icon-edit-columns-16x12@2x.png";
const NEW_LABEL_HASH = "#new_label";
@@ -68,6 +67,7 @@ export class ManageHostsPage extends PureComponent {
hosts: PropTypes.arrayOf(hostInterface),
loadingHosts: PropTypes.bool,
canAddNewHosts: PropTypes.bool,
+ canAddNewLabels: PropTypes.bool,
teams: PropTypes.arrayOf(teamInterface),
isGlobalAdmin: PropTypes.bool,
currentUser: userInterface,
@@ -523,6 +523,7 @@ export class ManageHostsPage extends PureComponent {
selectedFilter,
selectedOsqueryTable,
statusLabels,
+ canAddNewLabels,
} = this.props;
const { onAddLabelClick, onLabelClick, onOsqueryTableSelect } = this;
@@ -543,6 +544,7 @@ export class ManageHostsPage extends PureComponent {
onLabelClick={onLabelClick}
selectedFilter={selectedFilter}
statusLabels={statusLabels}
+ canAddNewLabel={canAddNewLabels}
/>
);
}
@@ -680,6 +682,9 @@ const mapStateToProps = (state, { location, params }) => {
const canAddNewHosts =
permissionUtils.isGlobalAdmin(currentUser) ||
permissionUtils.isGlobalMaintainer(currentUser);
+ const canAddNewLabels =
+ permissionUtils.isGlobalAdmin(currentUser) ||
+ permissionUtils.isGlobalMaintainer(currentUser);
const isGlobalAdmin = permissionUtils.isGlobalAdmin(currentUser);
const teams = memoizedGetEntity(state.entities.teams.data);
@@ -699,6 +704,7 @@ const mapStateToProps = (state, { location, params }) => {
hosts,
loadingHosts,
canAddNewHosts,
+ canAddNewLabels,
isGlobalAdmin,
teams,
};