From 4135ad7d3fa654ec52375cfa1f0201b702569778 Mon Sep 17 00:00:00 2001 From: Zachary Wasserman Date: Tue, 12 Feb 2019 12:03:55 -0800 Subject: [PATCH] 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. --- .../components/side_panels/HostSidePanel/HostSidePanel.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx b/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx index 070d25651e..98dfd1b588 100644 --- a/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx +++ b/frontend/components/side_panels/HostSidePanel/HostSidePanel.jsx @@ -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" /> -
+ {hostPlatformLabels.length > 0 &&
}
LABELS