-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20404: Edit packages feature (#21812)
## 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>
- Loading branch information
1 parent
ca45468
commit cd6342b
Showing
49 changed files
with
1,465 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Software installer packages, self-service flag, scripts, pre-install query, and self-service availability can now be edited in-place rather than needing to be deleted and re-added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.file-details { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
|
||
&__info { | ||
display: flex; | ||
gap: $pad-medium; | ||
align-items: center; | ||
width: 100%; | ||
text-align: left; | ||
} | ||
|
||
&__name { | ||
font-size: $x-small; | ||
font-weight: $bold; | ||
} | ||
|
||
&__platform { | ||
font-size: $xx-small; | ||
color: $ui-fleet-black-75; | ||
} | ||
|
||
&__edit { | ||
display: flex; | ||
align-items: center; // Center the button vertically | ||
margin-right: -$pad-medium; // Adjust for button padding | ||
} | ||
|
||
label { | ||
display: flex; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./FileDetails"; |
Oops, something went wrong.