Files
Andrew Mellor de1e14bbee Fleet UI: Add combined include/exclude label targeting for configuration profiles (#46444)
**Related issue:** Resolves #45179

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [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/guides/committing-changes.md#changes-files)
for more information.

- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements), JS
inline code is prevented especially for url redirects, and untrusted
data interpolated into shell scripts/commands is validated against shell
metacharacters.

## Testing

- [x] Added/updated automated tests

- [x] QA'd all new/changed functionality manually


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Configuration profiles now support selecting both include and exclude
labels when uploading MDM profiles
* Profile labels modal displays include and exclude label sections
separately

* **Bug Fixes**
* Delete label confirmation now clarifies that labels used by
configuration profiles cannot be deleted until the profile is removed

* **Style**
  * Added visual check indicators for configured platforms in tabs
* Improved responsive design for profile management and side navigation
layouts

* **Tests**
* Added test coverage for profile labels modal and label deletion
helpers

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/46444?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-04 15:25:25 +01:00

63 lines
1.5 KiB
TypeScript

import React from "react";
import classnames from "classnames";
import Icon from "components/Icon";
type TabCountVariant = "alert" | "pending";
interface ITabTextProps {
className?: string;
children: React.ReactNode;
count?: number;
countVariant?: TabCountVariant;
/** When true, renders a green check icon next to the tab text
* (e.g. to indicate that something is configured for this tab). */
showCheck?: boolean;
}
/*
* This component exists so we can unify the styles
* and add styles to react-tab text.
*/
const baseClass = "tab-text";
const TabText = ({
className,
children,
count,
countVariant,
showCheck,
}: ITabTextProps): JSX.Element => {
const classNames = classnames(baseClass, className);
const countClassNames = classnames(`${baseClass}__count`, {
[`${baseClass}__count__alert`]: countVariant === "alert",
[`${baseClass}__count__pending`]: countVariant === "pending",
});
const renderCount = () => {
if (count && count > 0) {
return <div className={countClassNames}>{count.toLocaleString()}</div>;
}
return undefined;
};
return (
<div className={classNames}>
<div className={`${baseClass}__text`} data-text={children}>
{children}
</div>
{renderCount()}
{showCheck && (
<Icon
name="check"
size="small"
color="core-fleet-green"
className={`${baseClass}__check`}
/>
)}
</div>
);
};
export default TabText;