UI - Update label chooser empty state (#27019)
## For #23830 No labels state –> label present state in 4 places:  - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
co-authored by
Jacob Shandling
parent
a92490c98c
commit
25a3835067
@@ -0,0 +1 @@
|
||||
* Update the empty states when choosing a label scope for new software, queries, and profiles
|
||||
@@ -98,41 +98,22 @@ const LabelChooser = ({
|
||||
?.helpText;
|
||||
};
|
||||
|
||||
const renderLabels = () => {
|
||||
if (isLoading) {
|
||||
return <Spinner centered={false} />;
|
||||
}
|
||||
if (isLoading) {
|
||||
return <Spinner centered={false} />;
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
return <DataError />;
|
||||
}
|
||||
if (isError) {
|
||||
return <DataError />;
|
||||
}
|
||||
|
||||
if (!labels.length) {
|
||||
return (
|
||||
<div className={`${baseClass}__no-labels`}>
|
||||
<span>
|
||||
<Link to={PATHS.LABEL_NEW_DYNAMIC}>Add labels</Link> to target
|
||||
specific hosts.
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return labels.map((label) => {
|
||||
return (
|
||||
<div className={`${baseClass}__label`} key={label.name}>
|
||||
<Checkbox
|
||||
className={`${baseClass}__checkbox`}
|
||||
name={label.name}
|
||||
value={!!selectedLabels[label.name]}
|
||||
onChange={onSelectLabel}
|
||||
parseTarget
|
||||
/>
|
||||
<div className={`${baseClass}__label-name`}>{label.name}</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
};
|
||||
if (!labels.length) {
|
||||
return (
|
||||
<div className={`${baseClass}__no-labels`}>
|
||||
<Link to={PATHS.LABEL_NEW_DYNAMIC}>Add label</Link> to target specific
|
||||
hosts.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${baseClass}__custom-label-chooser`}>
|
||||
@@ -145,7 +126,22 @@ const LabelChooser = ({
|
||||
<div className={`${baseClass}__description`}>
|
||||
{getHelpText(selectedCustomTarget)}
|
||||
</div>
|
||||
<div className={`${baseClass}__checkboxes`}>{renderLabels()}</div>
|
||||
<div className={`${baseClass}__checkboxes`}>
|
||||
{labels.map((label) => {
|
||||
return (
|
||||
<div className={`${baseClass}__label`} key={label.name}>
|
||||
<Checkbox
|
||||
className={`${baseClass}__checkbox`}
|
||||
name={label.name}
|
||||
value={!!selectedLabels[label.name]}
|
||||
onChange={onSelectLabel}
|
||||
parseTarget
|
||||
/>
|
||||
<div className={`${baseClass}__label-name`}>{label.name}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -182,7 +178,7 @@ const TargetLabelSelector = ({
|
||||
onSelectCustomTarget,
|
||||
onSelectLabel,
|
||||
}: ITargetLabelSelectorProps) => {
|
||||
const classNames = classnames(baseClass, className);
|
||||
const classNames = classnames(baseClass, className, "form");
|
||||
|
||||
return (
|
||||
<div className={classNames}>
|
||||
|
||||
@@ -10,19 +10,6 @@
|
||||
margin: $pad-medium 0;
|
||||
}
|
||||
|
||||
&__no-labels {
|
||||
display: flex;
|
||||
height: 187px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: $pad-small;
|
||||
justify-content: center;
|
||||
|
||||
span {
|
||||
color: $ui-fleet-black-75;
|
||||
}
|
||||
}
|
||||
|
||||
&__checkboxes {
|
||||
display: flex;
|
||||
max-height: 187px;
|
||||
|
||||
Reference in New Issue
Block a user