<!-- Add the related story/sub-task/bug number, like Resolves#123, or
remove if NA -->
**Related issue:** Resolves#46583
Before implementing changes in the Save policy / Edit policy modal (see
[Figma](https://www.figma.com/design/0F1sw63SuYaKVWlcL7mnc6/-33441-Policies--Custom-targets-with-%22Include-any%22-and-%22Exclude-any%22?node-id=5303-5687&t=Fszpf83KhcZ7ViWh-0)),
I though of making the label selection a reusable component that we
could reuse both in Configuration Profiles and in Policies, so that we
don't repeat ourselves.
## Testing
- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually
I don't have MDM fully wired up but I checked the payloads were sent as
expected.
https://github.com/user-attachments/assets/b2c4898f-c69c-4c05-b76c-e89728842661
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added a dropdown-based target selector and a tabbed Include/Exclude
label selector with Any/All mode.
* **Improvements**
* Unified target/label selection across packages, policies, queries, and
profiles.
* Better empty/loading/error states, selectable badges, help/subtitle
support, and cross-tab disabling of selected labels.
* **Tests**
* Added and updated test coverage for both dropdown and tabbed selector
behaviors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
For #27276
# Details
This PR adds the ability to select labels when saving or editing a query
in the UI, so that the query will only target hosts with those labels.
It follows the API design from
https://github.com/fleetdm/fleet/pull/27196, utilizing the
labels_include_any and labels_exclude_any fields. The expectation is
that when creating or updating a query, labels_include_any and
labels_exclude_any are arrays of label names, and when fetching a single
query, they are arrays of objects with a name and an id key.
Other updates in this PR:
* Removed colons from various headings on the Save Policy Modal and Edit
Policy form
* Updated the "Delete label" text
* Removed "Policy runs on all hosts with these platforms." subheading
underneath the platform selector
* TargetLabelSelector component now has `suppressTitle` flag to turn off
the "Target" title.
For #26649
# Checklist for submitter
- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
## Details
This PR adds the ability to select labels when saving or editing a query
in the UI, so that the query will only target hosts with those labels.
It follows the API design from
https://github.com/fleetdm/fleet/pull/26589, utilizing the
`labels_include_any` field. The expectation is that when creating or
updating a query, `labels_include_any` is an array of label names, and
when fetching a single query, `labels_include_any` is an array of
objects with a `name` and an `id` key.
As part of this work the `TargetLabelSelector` component is updated to
allow it to show a message in place of the dropdown when there are no
custom options (e.g. "include any", "include all", "exclude any") to
choose from.
relates to #24828, #24792
This updates the UI activities software including a new software details
show details modal:
<img width="825" alt="image"
src="https://github.com/user-attachments/assets/3dd3019b-c94c-427b-9c52-d678a311c4bc"
/>
It also includes tests and api integration work for the creating and
reading of scoped software via labels.
> NOTE: still need to do the editing which we can do in another PR when
the API is ready.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality