Hide labels for platforms with no hosts. (#1998)

Rather than displaying 0 hosts for each of the platforms, remove the platform
listing. The platforms will appear once they have a host.
This commit is contained in:
Zachary Wasserman 2019-02-12 12:03:55 -08:00 committed by GitHub
parent c8229cc0d6
commit 4135ad7d3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,7 +41,9 @@ class HostSidePanel extends Component {
const { onFilterLabels } = this;
const allHostLabels = filter(labels, { type: 'all' });
const hostStatusLabels = filter(labels, { type: 'status' });
const hostPlatformLabels = filter(labels, { type: 'platform' });
const hostPlatformLabels = filter(labels, (label) => {
return label.type === 'platform' && label.count > 0;
});
const customLabels = filter(labels, (label) => {
const lowerDisplayText = label.display_text.toLowerCase();
@ -78,7 +80,7 @@ class HostSidePanel extends Component {
selectedLabel={selectedLabel}
type="platform"
/>
<hr className={`${baseClass}__hr`} />
{hostPlatformLabels.length > 0 && <hr className={`${baseClass}__hr`} />}
<div className={`${baseClass}__panel-group-item`}>
<Icon name="label" />
<span className="title">LABELS</span>