fleet/frontend/components/UploadList/UploadList.tsx
Gabriel Hernandez a5add0b82f
add UI for adding and removing multiple microsoft entra tenant ids (#39910)
**Related issue:** Resolves #39266

> NOTE: activities is in another PR
[here](https://github.com/fleetdm/fleet/pull/39919)

# Checklist for submitter


This adds/updates the UI to enable users to add multiple Microsoft Entra
tenant ids. This also updates the mdm page microsoft entra section.

**New Microsoft Entra card states on mdm page:**

<img width="757" height="107" alt="image"
src="https://github.com/user-attachments/assets/b1c58268-ed75-4055-8192-d74cc7be67f6"
/>

<img width="770" height="131" alt="image"
src="https://github.com/user-attachments/assets/149e08a2-acfc-4f3f-948f-bffce5a27f8a"
/>

<img width="768" height="110" alt="image"
src="https://github.com/user-attachments/assets/74d7bc58-dd64-496e-a36a-44de44aa6b0b"
/>


**New Microsoft Entra page to add/remove multiple tenant ids:**

<img width="792" height="713" alt="image"
src="https://github.com/user-attachments/assets/c34baab8-19ad-4d28-87ea-51955e28f428"
/>

**new add and delete tenant id modals**

<img width="664" height="319" alt="image"
src="https://github.com/user-attachments/assets/d3ccc177-a780-4ec4-a2c0-747edad40ae1"
/>

<img width="664" height="267" alt="image"
src="https://github.com/user-attachments/assets/c08b7992-c440-4c57-9d4e-4b20ae0f5cf2"
/>

- [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] Added/updated automated tests
- [x] QA'd all new/changed functionality manually
2026-02-19 13:19:52 +00:00

49 lines
1.2 KiB
TypeScript

import React from "react";
import classnames from "classnames";
const baseClass = "upload-list";
interface IUploadListProps<T = any> {
/** The attribute name that is used for the react key for each list item.
* This is optional and not needed when the listItem type is a string
*/
keyAttribute?: keyof T;
listItems: T[];
HeadingComponent?: (props: any) => JSX.Element;
ListItemComponent: (props: { listItem: T }) => JSX.Element;
className?: string;
}
const UploadList = <T,>({
keyAttribute,
listItems,
HeadingComponent,
ListItemComponent,
className,
}: IUploadListProps<T>) => {
const items = listItems.map((listItem) => {
return (
<li
key={keyAttribute ? `${listItem[keyAttribute]}` : `${listItem}`}
className={`${baseClass}__list-item`}
>
<ListItemComponent listItem={listItem} />
</li>
);
});
const classNames = classnames(baseClass, className);
return (
<div className={classNames}>
{HeadingComponent && (
<div className={`${baseClass}__header`}>
<HeadingComponent />
</div>
)}
<ul className={`${baseClass}__list`}>{items}</ul>
</div>
);
};
export default UploadList;