Chore UI update setup experience copy (#25000)

relates to #25001

quick updates to some of the UI copy on the setup experience add
software modal and the software details modal for the software
activities.

- [x] Manual QA for all new/changed functionality
This commit is contained in:
Gabriel Hernandez 2024-12-23 17:01:36 -06:00 committed by GitHub
parent 1a1ec72483
commit 328a19489f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 44 deletions

View file

@ -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 (
<TooltipWrapper
tipContent={labels.map((label) => (
@ -27,36 +42,11 @@ const TargetValue = ({ labels }: ITargetValueProps) => {
</>
))}
>
{labels.length} labels
{valueText}
</TooltipWrapper>
);
};
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 <TargetValue labels={labelIncludeAny} />;
} else if (labelExcludeAny) {
return <TargetValue labels={labelExcludeAny} />;
}
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 (
<Modal
@ -85,18 +74,15 @@ const SoftwareDetailsModal = ({
title="Self-Service"
value={details.self_service ? "Yes" : "No"}
/>
{hasTargets && (
<DataSet
title={generateTargetTitle(
labels_include_any,
labels_exclude_any
)}
value={generateTargetValue(
labels_include_any,
labels_exclude_any
)}
/>
)}
<DataSet
title="Target"
value={
<TargetValue
labelIncludeAny={labels_include_any}
labelExcludeAny={labels_exclude_any}
/>
}
/>
</div>
<div className="modal-cta-wrap">
<Button onClick={onCancel} variant="brand">

View file

@ -79,7 +79,12 @@ const SelectSoftwareModal = ({
);
return (
<Modal className={baseClass} title="Select software" onExit={onExit}>
<Modal
className={baseClass}
title="Select software"
width="large"
onExit={onExit}
>
<>
<SelectSoftwareTable
softwareTitles={softwareTitles}

View file

@ -72,6 +72,12 @@ const SelectSoftwareTable = ({
searchQueryColumn="name"
isClientSideFilter
onClearSelection={() => onChangeSelectAll(false)}
renderTableHelpText={() => (
<p className={`${baseClass}__help-text`}>
Software will be installed on all hosts. Currently, custom targets
(labels) don&apos;t apply during set up experience.
</p>
)}
/>
);
};

View file

@ -4,4 +4,8 @@
max-height: 343px;
overflow-y: auto;
}
&__help-text {
font-size: $xx-small;
}
}