mirror of
https://github.com/fleetdm/fleet
synced 2026-05-17 22:18:39 +00:00
## Issue Cerra #20404 ## Description - Add frontend/API backend for editing software packages. GitOps will be a separate PR. ## More - Please see subtasks for change lists - #21611 - #21613 # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [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. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [x] Manual QA for all new/changed functionality Automated tests will follow in another PR. --------- Co-authored-by: Ian Littman <iansltx@gmail.com> Co-authored-by: Luke Heath <luke@fleetdm.com> Co-authored-by: Jacob Shandling <jacob@fleetdm.com> Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import React from "react";
|
|
|
|
import { ISupportedGraphicNames } from "components/FileUploader/FileUploader";
|
|
import Graphic from "components/Graphic";
|
|
import Button from "components/buttons/Button";
|
|
import Icon from "components/Icon";
|
|
|
|
interface IFileDetailsProps {
|
|
graphicNames: ISupportedGraphicNames | ISupportedGraphicNames[];
|
|
fileDetails: {
|
|
name: string;
|
|
platform?: string;
|
|
};
|
|
canEdit: boolean;
|
|
onFileSelect: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
accept?: string;
|
|
}
|
|
|
|
const baseClass = "file-details";
|
|
|
|
const FileDetails = ({
|
|
graphicNames,
|
|
fileDetails,
|
|
canEdit,
|
|
onFileSelect,
|
|
accept,
|
|
}: IFileDetailsProps) => {
|
|
return (
|
|
<div className={baseClass}>
|
|
<div className={`${baseClass}__info`}>
|
|
<Graphic
|
|
name={
|
|
typeof graphicNames === "string" ? graphicNames : graphicNames[0]
|
|
}
|
|
/>
|
|
<div className={`${baseClass}__content`}>
|
|
<div className={`${baseClass}__name`}>{fileDetails.name}</div>
|
|
{fileDetails.platform && (
|
|
<div className={`${baseClass}__platform`}>
|
|
{fileDetails.platform}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{canEdit && (
|
|
<div className={`${baseClass}__edit`}>
|
|
<Button className={`${baseClass}__edit-button`} variant="icon">
|
|
<label htmlFor="edit-file">
|
|
<Icon name="pencil" color="ui-fleet-black-75" />
|
|
</label>
|
|
</Button>
|
|
<input
|
|
accept={accept}
|
|
id="edit-file"
|
|
type="file"
|
|
onChange={onFileSelect}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default FileDetails;
|