<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #48571 # Checklist for submitter If some of the following don't apply, delete the relevant line. No changes file as this is a subtask - [ ] 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. - [x] Timeouts are implemented and retries are limited to avoid infinite loops - [x] If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes ## Testing - [x] Added/updated automated tests - [x] Where appropriate, [automated tests simulate multiple hosts and test for host isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing) (updates to one hosts's records do not affect another) - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a Premium-only **Assets** tab to Configuration Profiles, with JSON asset list, upload, download, copy, and delete (delete limited for technician views). * Added a Premium-only **Assets** entry to the command palette configuration controls. * Introduced a new **file-json** graphic type and enhanced user-scoped profile indicators (with iOS/iPad-specific behavior). * **Bug Fixes** * Updated navigation so the **Assets** view opens consistently from settings and the command palette. * Improved visual alignment of tooltip/icon elements in asset and scope displays. * **Tests** * Added coverage for Assets, upload/download/delete behaviors, and related UI components. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import React from "react";
|
|
import classnames from "classnames";
|
|
|
|
import Graphic from "components/Graphic";
|
|
import { GraphicNames } from "components/graphics";
|
|
|
|
const baseClass = "list-item";
|
|
|
|
export type ISupportedGraphicNames = Extract<
|
|
GraphicNames,
|
|
| "file-configuration-profile"
|
|
| "file-sh"
|
|
| "file-ps1"
|
|
| "file-py"
|
|
| "file-script"
|
|
| "file-pdf"
|
|
| "file-pkg"
|
|
| "file-p7m"
|
|
| "file-pem"
|
|
| "file-json"
|
|
| "file-certificate"
|
|
>;
|
|
|
|
/**
|
|
* A generic ListItem component that can be used to display a list of items. It
|
|
* encapsulates the UI logic and styling for displaying a graphic, title,
|
|
* details, and actions.
|
|
*/
|
|
interface IListItemProps {
|
|
/** The graphic you want to display for this list item. */
|
|
graphic?: ISupportedGraphicNames;
|
|
title: string | JSX.Element;
|
|
details?: React.ReactNode;
|
|
/** A collection of React Nodes that will render as list item actions. Can be
|
|
* used to render buttons, links, etc.
|
|
*/
|
|
actions?: React.ReactNode;
|
|
/** An optional function to call when the user clicks anywhere in the ListItem */
|
|
onClick?: () => void;
|
|
className?: string;
|
|
}
|
|
|
|
const ListItem = ({
|
|
graphic,
|
|
title,
|
|
details,
|
|
actions,
|
|
onClick,
|
|
className,
|
|
}: IListItemProps) => {
|
|
const classNames = classnames(baseClass, className);
|
|
return (
|
|
<div className={classNames} onClick={onClick}>
|
|
<div className={`${baseClass}__main-content`}>
|
|
{graphic && <Graphic name={graphic} />}
|
|
<div className={`${baseClass}__info`}>
|
|
<span className={`${baseClass}__title`}>{title}</span>
|
|
{details && <div className={`${baseClass}__details`}>{details}</div>}
|
|
</div>
|
|
</div>
|
|
{actions && <div className={`${baseClass}__actions`}>{actions}</div>}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ListItem;
|