fleet/frontend/components/FileUploader/FileUploader.tsx

296 lines
8.6 KiB
TypeScript
Raw Normal View History

2025-09-29 17:10:41 +00:00
import React, { useState, useRef } from "react";
UI for bootstrap package flows (#11288) relates to #10935 This is the UI for all the flows around adding, removing, downloading, and viewing information about a bootstrap package for fleet mdm. This is pretty comprehensive but includes: ### Backend **Update `Get host/id`** to include bootstrap package name ```json { "macos_setup": { ... "bootstrap_package_name": "test.pkg" } } ``` ### Frontend **UI for ABM not being set up**: ![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png) **UIs for uploading, downloading, and deleting bootstrap package**: ![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png) ![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png) ![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png) **UIs for seeing bootstrap status aggregate data** ![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png) **UIs for filtering hosts by bootstrap status** ![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png) **UIs for seeing package status on host details and my device page**: ![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png) ![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png) - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Roberto Dip <dip.jesusr@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 15:10:41 +00:00
import classnames from "classnames";
import Button from "components/buttons/Button";
2023-10-10 22:00:45 +00:00
import Card from "components/Card";
import { GraphicNames } from "components/graphics";
import Icon from "components/Icon";
import Graphic from "components/Graphic";
import FileDetails from "components/FileDetails";
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
import GitOpsModeTooltipWrapper from "components/GitOpsModeTooltipWrapper";
import TooltipWrapper from "components/TooltipWrapper";
const baseClass = "file-uploader";
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-vpp"
| "file-png"
>;
interface IFileUploaderProps {
label?: React.ReactNode;
graphicName: ISupportedGraphicNames | ISupportedGraphicNames[];
2025-10-28 16:44:17 +00:00
message: React.ReactNode;
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
title?: string;
/** allow error state within the file uploader, as opposed to on its label */
internalError?: string;
2023-10-10 22:00:45 +00:00
additionalInfo?: string;
/** Controls the loading spinner on the upload button */
isLoading?: boolean;
/** Disables the upload button */
disabled?: boolean;
/** A comma separated string of one or more file types accepted to upload.
2023-10-10 22:00:45 +00:00
* This is the same as the html accept attribute.
* https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept
*/
UI for bootstrap package flows (#11288) relates to #10935 This is the UI for all the flows around adding, removing, downloading, and viewing information about a bootstrap package for fleet mdm. This is pretty comprehensive but includes: ### Backend **Update `Get host/id`** to include bootstrap package name ```json { "macos_setup": { ... "bootstrap_package_name": "test.pkg" } } ``` ### Frontend **UI for ABM not being set up**: ![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png) **UIs for uploading, downloading, and deleting bootstrap package**: ![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png) ![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png) ![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png) **UIs for seeing bootstrap status aggregate data** ![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png) **UIs for filtering hosts by bootstrap status** ![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png) **UIs for seeing package status on host details and my device page**: ![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png) ![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png) - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Roberto Dip <dip.jesusr@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 15:10:41 +00:00
accept?: string;
/** The text to display on the upload button
* @default "Upload"
*/
buttonMessage?: string;
UI for bootstrap package flows (#11288) relates to #10935 This is the UI for all the flows around adding, removing, downloading, and viewing information about a bootstrap package for fleet mdm. This is pretty comprehensive but includes: ### Backend **Update `Get host/id`** to include bootstrap package name ```json { "macos_setup": { ... "bootstrap_package_name": "test.pkg" } } ``` ### Frontend **UI for ABM not being set up**: ![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png) **UIs for uploading, downloading, and deleting bootstrap package**: ![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png) ![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png) ![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png) **UIs for seeing bootstrap status aggregate data** ![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png) **UIs for filtering hosts by bootstrap status** ![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png) **UIs for seeing package status on host details and my device page**: ![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png) ![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png) - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Roberto Dip <dip.jesusr@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 15:10:41 +00:00
className?: string;
/** renders the button to open the file uploader to appear as a button or
* a link.
* @default "button"
*/
2025-09-29 17:10:41 +00:00
buttonType?: "button" | "brand-inverse-icon";
/** renders a tooltip for the button. If `gitopsCompatible` is set to `true`
* this tooltip will not be rendered if gitops mode is enabled. */
buttonTooltip?: React.ReactNode;
onFileUpload: (files: FileList | null) => void;
/** renders the current file with the edit pencil button */
canEdit?: boolean;
/** renders the current file with the delete trash button */
onDeleteFile?: () => void;
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
/** if provided, will be called when the button is clicked
* instead of opening the file selector. Useful if you want to
* show the file selector UI but handle the file selection
* in a modal.
*/
onButtonClick?: () => void;
fileDetails?: {
name: string;
2025-10-28 16:44:17 +00:00
description?: React.ReactNode;
};
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
/** Indicates that this file uploader deals with an entity that can be managed by GitOps, and so should be disabled when gitops mode is enabled */
gitopsCompatible?: boolean;
/** Whether or not GitOpsMode is enabled. Has no effect if `gitopsCompatible` is false */
gitOpsModeEnabled?: boolean;
}
/**
* A component that encapsulates the UI for uploading a file and a file selected.
*/
export const FileUploader = ({
label,
graphicName: graphicNames,
message,
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
title,
internalError,
2023-10-10 22:00:45 +00:00
additionalInfo,
isLoading = false,
disabled = false,
UI for bootstrap package flows (#11288) relates to #10935 This is the UI for all the flows around adding, removing, downloading, and viewing information about a bootstrap package for fleet mdm. This is pretty comprehensive but includes: ### Backend **Update `Get host/id`** to include bootstrap package name ```json { "macos_setup": { ... "bootstrap_package_name": "test.pkg" } } ``` ### Frontend **UI for ABM not being set up**: ![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png) **UIs for uploading, downloading, and deleting bootstrap package**: ![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png) ![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png) ![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png) **UIs for seeing bootstrap status aggregate data** ![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png) **UIs for filtering hosts by bootstrap status** ![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png) **UIs for seeing package status on host details and my device page**: ![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png) ![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png) - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Roberto Dip <dip.jesusr@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 15:10:41 +00:00
accept,
className,
buttonMessage = "Upload",
buttonType = "button",
buttonTooltip,
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
onButtonClick,
onFileUpload,
canEdit = false,
onDeleteFile,
fileDetails,
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
gitopsCompatible = false,
gitOpsModeEnabled = false,
}: IFileUploaderProps) => {
const [isFileSelected, setIsFileSelected] = useState(!!fileDetails);
const fileInputRef = useRef<HTMLInputElement>(null);
const classes = classnames(baseClass, className, {
[`${baseClass}__file-preview`]: isFileSelected,
[`${baseClass}__error`]: !!internalError,
});
2025-09-29 17:10:41 +00:00
const buttonVariant =
buttonType === "button" ? "default" : "brand-inverse-icon";
const triggerFileInput = () => {
fileInputRef.current?.click();
};
const onFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {
const target = e.currentTarget;
// Ensure target is the expected input element to prevent DOM manipulation
if (target && target.type === "file") {
const files = target.files;
onFileUpload(files);
setIsFileSelected(true);
if (fileInputRef.current) {
fileInputRef.current.value = "";
}
}
};
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Enter") {
e.preventDefault();
triggerFileInput();
}
};
UI for bootstrap package flows (#11288) relates to #10935 This is the UI for all the flows around adding, removing, downloading, and viewing information about a bootstrap package for fleet mdm. This is pretty comprehensive but includes: ### Backend **Update `Get host/id`** to include bootstrap package name ```json { "macos_setup": { ... "bootstrap_package_name": "test.pkg" } } ``` ### Frontend **UI for ABM not being set up**: ![image](https://user-images.githubusercontent.com/1153709/234018772-3221e27b-50a4-454e-8e9f-b62c9d349010.png) **UIs for uploading, downloading, and deleting bootstrap package**: ![image](https://user-images.githubusercontent.com/1153709/234017915-871f252f-bf80-4282-9acf-5ebea12c6efa.png) ![image](https://user-images.githubusercontent.com/1153709/234018029-322a5f30-dd22-44e3-b9ae-a4af7acb68b4.png) ![image](https://user-images.githubusercontent.com/1153709/234018163-4b84a2ce-a064-4952-a63d-0c8307391052.png) **UIs for seeing bootstrap status aggregate data** ![image](https://user-images.githubusercontent.com/1153709/234018107-455d63ab-5b2c-4727-ad20-eef6b269c336.png) **UIs for filtering hosts by bootstrap status** ![image](https://user-images.githubusercontent.com/1153709/234018334-170fe93a-700e-48eb-b198-2a1cc54d31a7.png) **UIs for seeing package status on host details and my device page**: ![image](https://user-images.githubusercontent.com/1153709/234018488-7b515db4-1248-4be7-8de3-9b74bb5d4795.png) ![image](https://user-images.githubusercontent.com/1153709/234018525-d653cb2d-9ef9-437e-8eba-141e557f4f39.png) - [x] Changes file added for user-visible changes in `changes/` or `orbit/changes/`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Roberto Dip <dip.jesusr@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
2023-04-27 15:10:41 +00:00
const renderLabel = () => {
return label ? (
<div className={`${baseClass}__label form-field__label`}>{label}</div>
) : null;
};
const renderGraphics = () => {
const graphicNamesArr =
typeof graphicNames === "string" ? [graphicNames] : graphicNames;
return graphicNamesArr.map((graphicName) => (
<Graphic
key={`${graphicName}-graphic`}
className={`${baseClass}__graphic`}
name={graphicName}
/>
));
};
const renderUploadButton = () => {
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
let buttonMarkup = (
<>
Update `FileUploader` button layout and styling (#36808) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #36804 - Update text/icon order when relevant, remove redundant `label` causing padding inconsistencies <img width="965" height="1521" alt="Screenshot 2025-12-05 at 2 10 14 PM" src="https://github.com/user-attachments/assets/fb8df8f4-f98a-4a26-8c82-b846576529a9" /> - Confirm UI/UX everywhere it's used: <img width="619" height="553" alt="Screenshot 2025-12-05 at 2 23 23 PM" src="https://github.com/user-attachments/assets/87295511-e84b-4f68-8403-2fb1dc1c7ccf" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 23 06 PM" src="https://github.com/user-attachments/assets/e6f995af-ba77-477d-84ad-0acc4104314e" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 19 59 PM" src="https://github.com/user-attachments/assets/20bd6cd9-2340-4dbb-a9cc-8c46fe64a847" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 20 25 PM" src="https://github.com/user-attachments/assets/62c8694a-2380-47b9-b59b-6878a4f49d8e" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 21 19 PM" src="https://github.com/user-attachments/assets/7ec9487a-3387-4060-aebb-421c5e878329" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 29 PM" src="https://github.com/user-attachments/assets/f8509f38-a143-4a96-84f3-3c791cd5177c" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 15 PM" src="https://github.com/user-attachments/assets/acc42d69-8c79-4a11-a0eb-fadf4dc10523" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 16 50 PM" src="https://github.com/user-attachments/assets/eea89d0d-648c-4d1b-94e8-cba0226200fc" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 21 35 PM" src="https://github.com/user-attachments/assets/36dc034d-dfa8-4dd1-8b76-a282e4e52aca" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 45 PM" src="https://github.com/user-attachments/assets/a7050ad9-c0a2-42e0-a76f-15b9bb171d8b" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 22 45 PM" src="https://github.com/user-attachments/assets/cb3a0d7c-270a-46aa-ae6a-e2695e41c26a" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 19 14 PM" src="https://github.com/user-attachments/assets/982a072c-2523-4bf5-b67a-82506ac844cc" /> # 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/` - [x] QA'd all new/changed functionality manually
2025-12-05 22:59:12 +00:00
{buttonMessage}
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
{buttonType === "brand-inverse-icon" && (
<Icon color="core-fleet-green" name="upload" />
)}
</>
);
// If we want to actual do file uploading, wrap in a label that
// references the hidden file input. Otherwise just use a span.
if (!onButtonClick) {
buttonMarkup = <label htmlFor="upload-file">{buttonMarkup}</label>;
} else {
buttonMarkup = <span>{buttonMarkup}</span>;
}
// the gitops mode tooltip wrapper takes presedence over other button
// renderings
if (gitopsCompatible) {
return (
<GitOpsModeTooltipWrapper
tipOffset={8}
renderChildren={(disableChildren) => (
<TooltipWrapper
className={`${baseClass}__manual-install-tooltip`}
tipContent={buttonTooltip}
disableTooltip={disableChildren || !buttonTooltip}
position="top"
showArrow
underline={false}
>
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
<Button
className={`${baseClass}__upload-button`}
variant={buttonVariant}
isLoading={isLoading}
disabled={disabled || disableChildren}
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
customOnKeyDown={!onButtonClick ? handleKeyDown : undefined}
onClick={onButtonClick || undefined}
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
tabIndex={0}
>
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
{buttonMarkup}
UI - GitOps Mode: Core abstractions, first batch of applications (#26401) ## For #26229 – Part 1 ![ezgif-6bbe6d60c12ed4](https://github.com/user-attachments/assets/37a04b64-abd7-4605-b4ac-9542836ff562) - This PR contains the core abstractions, routes, API updates, and types for GitOps mode in the UI. Since this work will touch essentially every part of the Fleet UI, it is ripe for merge conflicts. To mitigate such conflicts, I'll be merging this work in a number of iterative PRs. ~To effectively gate any of this work from showing until it is all merged to `main`, [this commit](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) hides the settings section that allows enabling/disabling this setting, effectively feature flagging the entire thing. In the last of these iterative PRs, that commit will be reverted to engage the entire feature. For testing purposes, reviewers can `git revert feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings section for this feature is feature flagged until all PRs are merged - to show the setting section while testing, run `ALLOW_GITOPS_MODE=true NODE_ENV=development yarn run webpack --progress --watch` in place of `make generate-dev` - Changes file will be added and feature flag removed in the last PR - [x] Settings page with routing, form, API integration (hidden until last PR) - [x] Activities - [x] Navbar indicator - Apply GOM conditional UI to: - [x] Manage enroll secret modal: .5 - Controls > - [x] Scripts: - Setup experience > - [x] Install software > Select software modal - [x] OS Settings > - [x] Custom settings - [x] Disk encryption - [x] OS Updates 2/18/25, added to this PR: - [x] Controls > Setup experience > Run script - [x] Software > - [x] Manage automations modal - [x] Add software > - [x] App Store (VPP) - [x] Custom package - [x] Queries - [x] Manage - [x] Automations modal - [x] New - [x] Edit - [x] Policies - [x] Manage - [x] New - [x] Edit - Manage automations - [x] Calendar events - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-02-20 16:41:07 +00:00
</Button>
</TooltipWrapper>
)}
/>
);
}
return (
<TooltipWrapper
className={`${baseClass}__upload-button`}
position="top"
tipContent={buttonTooltip}
underline={false}
showArrow
disableTooltip={!buttonTooltip}
>
<Button
className={`${baseClass}__upload-button`}
variant={buttonVariant}
isLoading={isLoading}
disabled={disabled}
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
customOnKeyDown={!onButtonClick ? handleKeyDown : undefined}
onClick={onButtonClick || undefined}
tabIndex={0}
>
Update `FileUploader` button layout and styling (#36808) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #36804 - Update text/icon order when relevant, remove redundant `label` causing padding inconsistencies <img width="965" height="1521" alt="Screenshot 2025-12-05 at 2 10 14 PM" src="https://github.com/user-attachments/assets/fb8df8f4-f98a-4a26-8c82-b846576529a9" /> - Confirm UI/UX everywhere it's used: <img width="619" height="553" alt="Screenshot 2025-12-05 at 2 23 23 PM" src="https://github.com/user-attachments/assets/87295511-e84b-4f68-8403-2fb1dc1c7ccf" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 23 06 PM" src="https://github.com/user-attachments/assets/e6f995af-ba77-477d-84ad-0acc4104314e" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 19 59 PM" src="https://github.com/user-attachments/assets/20bd6cd9-2340-4dbb-a9cc-8c46fe64a847" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 20 25 PM" src="https://github.com/user-attachments/assets/62c8694a-2380-47b9-b59b-6878a4f49d8e" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 21 19 PM" src="https://github.com/user-attachments/assets/7ec9487a-3387-4060-aebb-421c5e878329" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 29 PM" src="https://github.com/user-attachments/assets/f8509f38-a143-4a96-84f3-3c791cd5177c" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 15 PM" src="https://github.com/user-attachments/assets/acc42d69-8c79-4a11-a0eb-fadf4dc10523" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 16 50 PM" src="https://github.com/user-attachments/assets/eea89d0d-648c-4d1b-94e8-cba0226200fc" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 21 35 PM" src="https://github.com/user-attachments/assets/36dc034d-dfa8-4dd1-8b76-a282e4e52aca" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 17 45 PM" src="https://github.com/user-attachments/assets/a7050ad9-c0a2-42e0-a76f-15b9bb171d8b" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 22 45 PM" src="https://github.com/user-attachments/assets/cb3a0d7c-270a-46aa-ae6a-e2695e41c26a" /> <img width="1464" height="959" alt="Screenshot 2025-12-05 at 2 19 14 PM" src="https://github.com/user-attachments/assets/982a072c-2523-4bf5-b67a-82506ac844cc" /> # 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/` - [x] QA'd all new/changed functionality manually
2025-12-05 22:59:12 +00:00
{buttonMarkup}
</Button>
</TooltipWrapper>
);
};
const renderTitle = () => {
if (internalError) {
return (
<div className={`${baseClass}__internal-error`}>{internalError}</div>
);
}
if (title) {
return <div className={`${baseClass}__title`}>{title}</div>;
}
return null;
};
const renderFileUploader = () => {
return (
<div className="content-wrapper">
<div className="outer">
<div className="inner">
<div className={`${baseClass}__graphics`}>{renderGraphics()}</div>
{renderTitle()}
<p className={`${baseClass}__message`}>{message}</p>
{additionalInfo && (
<p className={`${baseClass}__additional-info`}>
{additionalInfo}
</p>
Update add script UI (#34349) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #32632 # Details This PR updates the Script Library page in the following ways: * When no scripts are uploaded for a team, it shows the "Add script" UI with a button that opens a new "Add Script" modal * When scripts are uploaded, the "Add script" button is instead added to the header of the scripts list, and clicking it opens that modal # 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. ## Testing - [ ] Added/updated automated tests working on this - [X] QA'd all new/changed functionality manually - [X] Test empty state: go to controls/scripts/library for a team with no scripts. Clicking "upload" button in empty state should open the add script modal. - [X] In the modal, select a .ps1 script. Should not see additional text. - [X] Close modal without uploading. Re-open. File field should be cleared & upload button visible again. - [X] Select a .sh script. Should see additional text about macOS and Linux. - [X] Add script. Make sure script saves and modal closes. - [X] Once script has been added, make sure empty state is gone and "Add script" button is at the top of the list. - [X] Go to /controls/os-settings/custom-settings for a team with no profiles uploaded. Make sure empty state text styles match the empty state for script uploads. - [X] Open modal to add profile. Make sure upload text styles match the script upload modal. - [X] Enable GitOps mode. Go to controls/scripts/library for a team with scripts added. Make sure new "Add script" button is disabled w/ standard tooltip in GitOps mode. Scripts empty state: <img width="697" height="352" alt="image" src="https://github.com/user-attachments/assets/32f0f246-bddb-4bb7-bc39-48d9978de9fa" /> Scripts uploader: <img width="745" height="590" alt="image" src="https://github.com/user-attachments/assets/f82414e2-9318-4543-b5ca-41e759662587" /> Scripts uploader with .sh <img width="750" height="539" alt="image" src="https://github.com/user-attachments/assets/0b989067-921a-4d18-93ed-09aac90fc9cb" /> Scripts table: <img width="686" height="256" alt="image" src="https://github.com/user-attachments/assets/848f1b56-6e9e-48d4-9a03-6fdf5427301e" /> Profiles empty state: <img width="700" height="377" alt="image" src="https://github.com/user-attachments/assets/8f92bcd9-2215-41f6-a540-4774f7e9542b" /> Profiles uploader: <img width="707" height="682" alt="image" src="https://github.com/user-attachments/assets/eef216af-3447-48e7-882a-e42e888e1c17" />
2025-10-17 15:49:59 +00:00
)}
</div>
{renderUploadButton()}
{/* If onButtonClick is provided, we're not actually uploading files here. */}
{!onButtonClick && (
<input
ref={fileInputRef}
accept={accept}
id="upload-file"
type="file"
onChange={onFileSelect}
/>
)}
</div>
</div>
);
};
return (
<div className={`${baseClass}__wrapper form-field`}>
{renderLabel()}
<Card color="grey" className={classes}>
{fileDetails ? (
<FileDetails
graphicNames={graphicNames}
fileDetails={fileDetails}
canEdit={canEdit}
onDeleteFile={onDeleteFile}
onFileSelect={onFileSelect}
accept={accept}
gitopsCompatible={gitopsCompatible}
gitOpsModeEnabled={gitOpsModeEnabled}
/>
) : (
renderFileUploader()
)}
</Card>
</div>
);
};
export default FileUploader;