diff --git a/frontend/pages/DashboardPage/cards/ActivityFeed/components/SoftwareDetailsModal/SoftwareDetailsModal.tsx b/frontend/pages/DashboardPage/cards/ActivityFeed/components/SoftwareDetailsModal/SoftwareDetailsModal.tsx index b36c3345fe..34f7eac36d 100644 --- a/frontend/pages/DashboardPage/cards/ActivityFeed/components/SoftwareDetailsModal/SoftwareDetailsModal.tsx +++ b/frontend/pages/DashboardPage/cards/ActivityFeed/components/SoftwareDetailsModal/SoftwareDetailsModal.tsx @@ -11,13 +11,28 @@ import TooltipWrapper from "components/TooltipWrapper"; const baseClass = "software-details-modal"; interface ITargetValueProps { - labels: ILabelSoftwareTitle[]; + labelIncludeAny?: ILabelSoftwareTitle[]; + labelExcludeAny?: ILabelSoftwareTitle[]; } -const TargetValue = ({ labels }: ITargetValueProps) => { - if (labels.length === 1) { - return <>labels[0].name; +const TargetValue = ({ + labelIncludeAny, + labelExcludeAny, +}: ITargetValueProps) => { + if (!labelIncludeAny && !labelExcludeAny) { + return <>All hosts; } + + let valueText = ""; + let labels: ILabelSoftwareTitle[] = []; + if (labelIncludeAny) { + valueText = "Custom - include any label"; + labels = labelIncludeAny; + } else if (labelExcludeAny) { + valueText = "Custom - exclude any label"; + labels = labelExcludeAny; + } + return ( ( @@ -27,36 +42,11 @@ const TargetValue = ({ labels }: ITargetValueProps) => { ))} > - {labels.length} labels + {valueText} ); }; -const generateTargetTitle = ( - labelIncludeAny?: ILabelSoftwareTitle[], - labelExcludeAny?: ILabelSoftwareTitle[] -) => { - if (labelIncludeAny && labelIncludeAny.length > 0) { - return "Targets (include any)"; - } else if (labelExcludeAny && labelExcludeAny.length > 0) { - return "Targets (exclude any)"; - } - return "Targets"; -}; - -const generateTargetValue = ( - labelIncludeAny?: ILabelSoftwareTitle[], - labelExcludeAny?: ILabelSoftwareTitle[] -) => { - // handle single label case - if (labelIncludeAny) { - return ; - } else if (labelExcludeAny) { - return ; - } - return "None"; -}; - interface ISoftwareDetailsModalProps { details: IActivityDetails; onCancel: () => void; @@ -67,7 +57,6 @@ const SoftwareDetailsModal = ({ onCancel, }: ISoftwareDetailsModalProps) => { const { labels_include_any, labels_exclude_any } = details; - const hasTargets = labels_include_any || labels_exclude_any; return ( - {hasTargets && ( - - )} + + } + />