fleet/frontend/pages/ManageControlsPage/Scripts/cards/ScriptLibrary/ScriptLibrary.tsx

229 lines
6.5 KiB
TypeScript
Raw Normal View History

import React, { useCallback, useContext, useRef, useState } from "react";
import { AxiosError } from "axios";
import { useQuery } from "react-query";
import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants";
import PATHS from "router/paths";
import { AppContext } from "context/app";
import { IScript } from "interfaces/script";
import scriptAPI, {
IListScriptsQueryKey,
IScriptsResponse,
} from "services/entities/scripts";
import DataError from "components/DataError";
import InfoBanner from "components/InfoBanner";
import Spinner from "components/Spinner";
import Pagination from "components/Pagination";
import SectionHeader from "components/SectionHeader";
2026-04-27 22:54:34 +00:00
import EmptyState from "components/EmptyState";
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
import UploadList from "../../../../../components/UploadList";
import DeleteScriptModal from "../../components/DeleteScriptModal";
import EditScriptModal from "../../components/EditScriptModal";
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
import ScriptUploadModal from "../../components/ScriptUploadModal";
import ScriptListHeading from "../../components/ScriptListHeading";
import ScriptListItem from "../../components/ScriptListItem";
import ScriptUploader from "../../components/ScriptUploader";
import { IScriptsCommonProps } from "../../ScriptsNavItems";
const baseClass = "script-library";
const SCRIPTS_PER_PAGE = 10;
const DEFAULT_PAGE = 0;
export type IScriptLibraryProps = IScriptsCommonProps;
const ScriptLibrary = ({ router, teamId, location }: IScriptLibraryProps) => {
const currentPage = location.query.page
? parseInt(location.query.page, 10)
: DEFAULT_PAGE;
Technician role FE changes (#39494) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38630 ## Testing - [x] QA'd all new/changed functionality manually Screenshots below were taken with a **Team Technician** user. Same changes apply for a **Global Technician**. #### Controls > OS settings > Disk encryption - Shows table without controls below. - Shows empty state (doesn't allow to turn it on). <img width="1915" height="886" alt="Screenshot 2026-02-10 at 12 24 25 PM" src="https://github.com/user-attachments/assets/3f44d338-e728-4eb2-ad93-e30844201b52" /> <img width="1913" height="907" alt="Screenshot 2026-02-10 at 12 31 38 PM" src="https://github.com/user-attachments/assets/71706e9e-0540-4c25-b5c0-3f7ccff3ba5a" /> #### Controls > OS settings > Custom settings - Changed description to say **View configuration profiles that apply custom settings.** instead of **Create and upload configuration profiles to apply custom settings.**. - **Add profile** not shown within table header. - Trash can icon not shown when hovering over a row within the table. - **Add profile** card not shown on empty state. Instead, "No configuration profiles have been added." is shown. <img width="1911" height="729" alt="Screenshot 2026-02-10 at 12 24 39 PM" src="https://github.com/user-attachments/assets/aa68cbaf-4772-402d-9288-b4be2ddd3250" /> <img width="1912" height="650" alt="Screenshot 2026-02-10 at 12 28 48 PM" src="https://github.com/user-attachments/assets/6a186172-b01f-4314-bb50-4cb533e13bce" /> #### Controls > Scripts > Library - **Add script** not shown within table header. - No actions shown when hovering over a table row. - Can view script by clicking on a table row. - Removed **To run the script across multiple hosts, add a policy automation on the Policies page** line below **To run this script on a host, go to the Hosts page and select a host.**. - Updated copy to `To run this script on a host, go to the Hosts page and select a host. Then, click Actions > Run script.` <img width="1912" height="772" alt="Screenshot 2026-02-10 at 12 25 46 PM" src="https://github.com/user-attachments/assets/83fbc1ec-3a6e-4bb5-865e-b5e7faef1e37" /> <img width="1732" height="761" alt="Screenshot 2026-02-11 at 3 50 33 PM" src="https://github.com/user-attachments/assets/6dda97d7-fde2-4bcd-94b3-fa7368c65528" /> #### Labels Can add label and filter by label <img width="160" height="247" alt="Screenshot 2026-02-10 at 12 51 24 PM" src="https://github.com/user-attachments/assets/ed63b708-27f8-4363-9d4f-9a7b0bf82b21" /> <img width="1901" height="856" alt="Screenshot 2026-02-10 at 12 35 07 PM" src="https://github.com/user-attachments/assets/c2ef5e21-03ab-4955-a22f-cd6ca32f3179" /> <img width="1903" height="937" alt="Screenshot 2026-02-10 at 12 36 11 PM" src="https://github.com/user-attachments/assets/d9d9f3bc-4d71-4c4b-902a-455eec9e057c" /> Can edit/delete labels created by themselves. NOTE: my technician user ID is 37 - note that the **x** label belongs to a different user id, while the second label belongs to ID 37, therefore it can be edited and deleted. <img width="1915" height="1152" alt="Screenshot 2026-02-10 at 12 38 29 PM" src="https://github.com/user-attachments/assets/21f44c11-4e2d-456b-8547-90936b5d7602" /> <img width="1911" height="1154" alt="Screenshot 2026-02-10 at 12 38 42 PM" src="https://github.com/user-attachments/assets/f9f7ea30-11b2-4d2d-9d71-de7299e4b451" /> Can delete manual label from host https://github.com/user-attachments/assets/b64ba6dd-3f54-4dcd-9c57-7bede65122da #### Host details Can run scripts and view their results <img width="1908" height="472" alt="Screenshot 2026-02-10 at 12 52 33 PM" src="https://github.com/user-attachments/assets/d1e40339-ec52-47ff-bc53-c311498ffe80" /> <img width="1882" height="716" alt="Screenshot 2026-02-10 at 12 52 40 PM" src="https://github.com/user-attachments/assets/dd0c2ec3-8cb8-4835-9c6d-f731a7434637" /> <img width="1915" height="718" alt="Screenshot 2026-02-10 at 12 52 48 PM" src="https://github.com/user-attachments/assets/5e7a73e0-ac5b-4d38-b635-770f53dea9e3" /> <img width="1914" height="718" alt="Screenshot 2026-02-10 at 12 52 55 PM" src="https://github.com/user-attachments/assets/b199c796-66b1-46bc-b2b5-fd35e8aa7a7c" /> Can run query associated to host as a live query https://github.com/user-attachments/assets/7aea6f63-e443-4fa0-87dc-48bef84efa2f #### Software Doesn't show trash can icon on software installer card, just the download one. <img width="1423" height="838" alt="Screenshot 2026-02-10 at 1 33 53 PM" src="https://github.com/user-attachments/assets/3a55c226-0bba-43ac-8594-7b5ac0a3684a" /> Can install/uninstall software on a host. Note that **Add software** button is hidden (technicians can't add software). <img width="1378" height="277" alt="Screenshot 2026-02-10 at 3 08 55 PM" src="https://github.com/user-attachments/assets/bf413467-2071-48b6-b62b-f3a721b6057c" /> #### Queries - Can run inherited queries on all hosts https://github.com/user-attachments/assets/09f07e6b-a8c1-453e-81fd-4deb16005836 - Can run team queries on all hosts https://github.com/user-attachments/assets/18b62dea-e159-40ea-b0ed-1d96b6bd40e7 - Can't manage automations or add queries (buttons are not shown at the top-right corner) #### Policies Same as Queries https://github.com/user-attachments/assets/2c24514a-2ae0-47a6-b631-6f9e48fc7b9c #### Protected routes Tested that I can't access routes that have restricted functionality for this role, such as: - **/controls/os-updates**, **/controls/setup-experience** and **/controls/os-settings/certificates** => redirects to **/controls/os-settings** ✅ - **/controls/scripts/progress** => redirects to **/controls/scripts/library** ✅ - **/queries/new** and **/software/add/*** => renders access denied page ✅ --------- Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2026-02-11 21:38:41 +00:00
const { isPremiumTier, isGlobalTechnician, isTeamTechnician } = useContext(
AppContext
);
const isTechnician = isGlobalTechnician || isTeamTechnician;
const [showDeleteScriptModal, setShowDeleteScriptModal] = useState(false);
const [showEditScriptModal, setShowEditScriptModal] = useState(false);
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
const [showAddScriptModal, setShowAddScriptModal] = useState(false);
const selectedScript = useRef<IScript | null>(null);
const {
data: { scripts, meta } = {},
isLoading,
isError,
refetch: refetchScripts,
} = useQuery<
IScriptsResponse,
AxiosError,
IScriptsResponse,
IListScriptsQueryKey[]
>(
[
{
scope: "scripts",
Update API calls in front-end to use new, non-deprecated URLs and params (#41515) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #41391 # Details This PR updates front-end API calls to use new URLs and API params, so that the front end doesn't cause deprecation warnings to appear on the server. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] 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. n/a, should not be user-visible ## Testing - [X] Added/updated automated tests - [ ] QA'd all new/changed functionality manually The biggest risk here is not that we missed a spot that still causes a deprecation warning, but that we might inadvertently make a change that breaks the front end, for instance by sending `fleet_id` to a function that drops it silently and thus sends no ID to the server. Fortunately we use TypeScript in virtually every place affected by these changes, so the code would not compile if there were mismatches between the API expectation and what we're sending. Still, spot checking as many places as possible both for deprecation-warning leaks and loss of functionality is important. ## Summary by CodeRabbit * **Refactor** * Updated API nomenclature across the application to use "fleets" instead of "teams" and "reports" instead of "queries" in endpoint paths and request/response payloads. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-13 03:26:48 +00:00
fleet_id: teamId,
page: currentPage,
per_page: SCRIPTS_PER_PAGE,
},
],
Update API calls in front-end to use new, non-deprecated URLs and params (#41515) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #41391 # Details This PR updates front-end API calls to use new URLs and API params, so that the front end doesn't cause deprecation warnings to appear on the server. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] 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. n/a, should not be user-visible ## Testing - [X] Added/updated automated tests - [ ] QA'd all new/changed functionality manually The biggest risk here is not that we missed a spot that still causes a deprecation warning, but that we might inadvertently make a change that breaks the front end, for instance by sending `fleet_id` to a function that drops it silently and thus sends no ID to the server. Fortunately we use TypeScript in virtually every place affected by these changes, so the code would not compile if there were mismatches between the API expectation and what we're sending. Still, spot checking as many places as possible both for deprecation-warning leaks and loss of functionality is important. ## Summary by CodeRabbit * **Refactor** * Updated API nomenclature across the application to use "fleets" instead of "teams" and "reports" instead of "queries" in endpoint paths and request/response payloads. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-13 03:26:48 +00:00
({ queryKey: [{ fleet_id, page, per_page }] }) =>
scriptAPI.getScripts({ fleet_id, page, per_page }),
{
...DEFAULT_USE_QUERY_OPTIONS,
staleTime: 3000,
}
);
// pagination controls
const path = PATHS.CONTROLS_SCRIPTS_LIBRARY;
const queryString = isPremiumTier ? `?fleet_id=${teamId}&` : "?";
const onPrevPage = useCallback(() => {
router.push(path.concat(`${queryString}page=${currentPage - 1}`));
}, [router, path, currentPage, queryString]);
const onNextPage = useCallback(() => {
router.push(path.concat(`${queryString}page=${currentPage + 1}`));
}, [router, path, currentPage, queryString]);
const { config } = useContext(AppContext);
if (!config) return null;
const onClickScript = (script: IScript) => {
selectedScript.current = script;
setShowEditScriptModal(true);
};
const onEditScript = (script: IScript) => {
selectedScript.current = script;
setShowEditScriptModal(true);
};
const onExitEditScript = () => {
selectedScript.current = null;
setShowEditScriptModal(false);
};
const onClickDelete = (script: IScript) => {
selectedScript.current = script;
setShowDeleteScriptModal(true);
};
const onCancelDelete = () => {
setShowDeleteScriptModal(false);
selectedScript.current = null;
};
const onDeleteScript = () => {
selectedScript.current = null;
setShowDeleteScriptModal(false);
refetchScripts();
};
const renderScriptsList = () => {
if (isLoading) {
return <Spinner />;
}
if (isError) {
return <DataError />;
}
if (currentPage === 0 && !scripts?.length) {
return null;
}
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
const headingComponent = () => (
Technician role FE changes (#39494) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38630 ## Testing - [x] QA'd all new/changed functionality manually Screenshots below were taken with a **Team Technician** user. Same changes apply for a **Global Technician**. #### Controls > OS settings > Disk encryption - Shows table without controls below. - Shows empty state (doesn't allow to turn it on). <img width="1915" height="886" alt="Screenshot 2026-02-10 at 12 24 25 PM" src="https://github.com/user-attachments/assets/3f44d338-e728-4eb2-ad93-e30844201b52" /> <img width="1913" height="907" alt="Screenshot 2026-02-10 at 12 31 38 PM" src="https://github.com/user-attachments/assets/71706e9e-0540-4c25-b5c0-3f7ccff3ba5a" /> #### Controls > OS settings > Custom settings - Changed description to say **View configuration profiles that apply custom settings.** instead of **Create and upload configuration profiles to apply custom settings.**. - **Add profile** not shown within table header. - Trash can icon not shown when hovering over a row within the table. - **Add profile** card not shown on empty state. Instead, "No configuration profiles have been added." is shown. <img width="1911" height="729" alt="Screenshot 2026-02-10 at 12 24 39 PM" src="https://github.com/user-attachments/assets/aa68cbaf-4772-402d-9288-b4be2ddd3250" /> <img width="1912" height="650" alt="Screenshot 2026-02-10 at 12 28 48 PM" src="https://github.com/user-attachments/assets/6a186172-b01f-4314-bb50-4cb533e13bce" /> #### Controls > Scripts > Library - **Add script** not shown within table header. - No actions shown when hovering over a table row. - Can view script by clicking on a table row. - Removed **To run the script across multiple hosts, add a policy automation on the Policies page** line below **To run this script on a host, go to the Hosts page and select a host.**. - Updated copy to `To run this script on a host, go to the Hosts page and select a host. Then, click Actions > Run script.` <img width="1912" height="772" alt="Screenshot 2026-02-10 at 12 25 46 PM" src="https://github.com/user-attachments/assets/83fbc1ec-3a6e-4bb5-865e-b5e7faef1e37" /> <img width="1732" height="761" alt="Screenshot 2026-02-11 at 3 50 33 PM" src="https://github.com/user-attachments/assets/6dda97d7-fde2-4bcd-94b3-fa7368c65528" /> #### Labels Can add label and filter by label <img width="160" height="247" alt="Screenshot 2026-02-10 at 12 51 24 PM" src="https://github.com/user-attachments/assets/ed63b708-27f8-4363-9d4f-9a7b0bf82b21" /> <img width="1901" height="856" alt="Screenshot 2026-02-10 at 12 35 07 PM" src="https://github.com/user-attachments/assets/c2ef5e21-03ab-4955-a22f-cd6ca32f3179" /> <img width="1903" height="937" alt="Screenshot 2026-02-10 at 12 36 11 PM" src="https://github.com/user-attachments/assets/d9d9f3bc-4d71-4c4b-902a-455eec9e057c" /> Can edit/delete labels created by themselves. NOTE: my technician user ID is 37 - note that the **x** label belongs to a different user id, while the second label belongs to ID 37, therefore it can be edited and deleted. <img width="1915" height="1152" alt="Screenshot 2026-02-10 at 12 38 29 PM" src="https://github.com/user-attachments/assets/21f44c11-4e2d-456b-8547-90936b5d7602" /> <img width="1911" height="1154" alt="Screenshot 2026-02-10 at 12 38 42 PM" src="https://github.com/user-attachments/assets/f9f7ea30-11b2-4d2d-9d71-de7299e4b451" /> Can delete manual label from host https://github.com/user-attachments/assets/b64ba6dd-3f54-4dcd-9c57-7bede65122da #### Host details Can run scripts and view their results <img width="1908" height="472" alt="Screenshot 2026-02-10 at 12 52 33 PM" src="https://github.com/user-attachments/assets/d1e40339-ec52-47ff-bc53-c311498ffe80" /> <img width="1882" height="716" alt="Screenshot 2026-02-10 at 12 52 40 PM" src="https://github.com/user-attachments/assets/dd0c2ec3-8cb8-4835-9c6d-f731a7434637" /> <img width="1915" height="718" alt="Screenshot 2026-02-10 at 12 52 48 PM" src="https://github.com/user-attachments/assets/5e7a73e0-ac5b-4d38-b635-770f53dea9e3" /> <img width="1914" height="718" alt="Screenshot 2026-02-10 at 12 52 55 PM" src="https://github.com/user-attachments/assets/b199c796-66b1-46bc-b2b5-fd35e8aa7a7c" /> Can run query associated to host as a live query https://github.com/user-attachments/assets/7aea6f63-e443-4fa0-87dc-48bef84efa2f #### Software Doesn't show trash can icon on software installer card, just the download one. <img width="1423" height="838" alt="Screenshot 2026-02-10 at 1 33 53 PM" src="https://github.com/user-attachments/assets/3a55c226-0bba-43ac-8594-7b5ac0a3684a" /> Can install/uninstall software on a host. Note that **Add software** button is hidden (technicians can't add software). <img width="1378" height="277" alt="Screenshot 2026-02-10 at 3 08 55 PM" src="https://github.com/user-attachments/assets/bf413467-2071-48b6-b62b-f3a721b6057c" /> #### Queries - Can run inherited queries on all hosts https://github.com/user-attachments/assets/09f07e6b-a8c1-453e-81fd-4deb16005836 - Can run team queries on all hosts https://github.com/user-attachments/assets/18b62dea-e159-40ea-b0ed-1d96b6bd40e7 - Can't manage automations or add queries (buttons are not shown at the top-right corner) #### Policies Same as Queries https://github.com/user-attachments/assets/2c24514a-2ae0-47a6-b631-6f9e48fc7b9c #### Protected routes Tested that I can't access routes that have restricted functionality for this role, such as: - **/controls/os-updates**, **/controls/setup-experience** and **/controls/os-settings/certificates** => redirects to **/controls/os-settings** ✅ - **/controls/scripts/progress** => redirects to **/controls/scripts/library** ✅ - **/queries/new** and **/software/add/*** => renders access denied page ✅ --------- Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2026-02-11 21:38:41 +00:00
<ScriptListHeading
onClickAddScript={
isTechnician ? undefined : () => setShowAddScriptModal(true)
}
/>
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
);
return (
<>
<UploadList
keyAttribute="id"
listItems={scripts || []}
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
HeadingComponent={headingComponent}
ListItemComponent={({ listItem }) => (
<ScriptListItem
script={listItem}
onDelete={onClickDelete}
onClickScript={onClickScript}
onEdit={onEditScript}
Technician role FE changes (#39494) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38630 ## Testing - [x] QA'd all new/changed functionality manually Screenshots below were taken with a **Team Technician** user. Same changes apply for a **Global Technician**. #### Controls > OS settings > Disk encryption - Shows table without controls below. - Shows empty state (doesn't allow to turn it on). <img width="1915" height="886" alt="Screenshot 2026-02-10 at 12 24 25 PM" src="https://github.com/user-attachments/assets/3f44d338-e728-4eb2-ad93-e30844201b52" /> <img width="1913" height="907" alt="Screenshot 2026-02-10 at 12 31 38 PM" src="https://github.com/user-attachments/assets/71706e9e-0540-4c25-b5c0-3f7ccff3ba5a" /> #### Controls > OS settings > Custom settings - Changed description to say **View configuration profiles that apply custom settings.** instead of **Create and upload configuration profiles to apply custom settings.**. - **Add profile** not shown within table header. - Trash can icon not shown when hovering over a row within the table. - **Add profile** card not shown on empty state. Instead, "No configuration profiles have been added." is shown. <img width="1911" height="729" alt="Screenshot 2026-02-10 at 12 24 39 PM" src="https://github.com/user-attachments/assets/aa68cbaf-4772-402d-9288-b4be2ddd3250" /> <img width="1912" height="650" alt="Screenshot 2026-02-10 at 12 28 48 PM" src="https://github.com/user-attachments/assets/6a186172-b01f-4314-bb50-4cb533e13bce" /> #### Controls > Scripts > Library - **Add script** not shown within table header. - No actions shown when hovering over a table row. - Can view script by clicking on a table row. - Removed **To run the script across multiple hosts, add a policy automation on the Policies page** line below **To run this script on a host, go to the Hosts page and select a host.**. - Updated copy to `To run this script on a host, go to the Hosts page and select a host. Then, click Actions > Run script.` <img width="1912" height="772" alt="Screenshot 2026-02-10 at 12 25 46 PM" src="https://github.com/user-attachments/assets/83fbc1ec-3a6e-4bb5-865e-b5e7faef1e37" /> <img width="1732" height="761" alt="Screenshot 2026-02-11 at 3 50 33 PM" src="https://github.com/user-attachments/assets/6dda97d7-fde2-4bcd-94b3-fa7368c65528" /> #### Labels Can add label and filter by label <img width="160" height="247" alt="Screenshot 2026-02-10 at 12 51 24 PM" src="https://github.com/user-attachments/assets/ed63b708-27f8-4363-9d4f-9a7b0bf82b21" /> <img width="1901" height="856" alt="Screenshot 2026-02-10 at 12 35 07 PM" src="https://github.com/user-attachments/assets/c2ef5e21-03ab-4955-a22f-cd6ca32f3179" /> <img width="1903" height="937" alt="Screenshot 2026-02-10 at 12 36 11 PM" src="https://github.com/user-attachments/assets/d9d9f3bc-4d71-4c4b-902a-455eec9e057c" /> Can edit/delete labels created by themselves. NOTE: my technician user ID is 37 - note that the **x** label belongs to a different user id, while the second label belongs to ID 37, therefore it can be edited and deleted. <img width="1915" height="1152" alt="Screenshot 2026-02-10 at 12 38 29 PM" src="https://github.com/user-attachments/assets/21f44c11-4e2d-456b-8547-90936b5d7602" /> <img width="1911" height="1154" alt="Screenshot 2026-02-10 at 12 38 42 PM" src="https://github.com/user-attachments/assets/f9f7ea30-11b2-4d2d-9d71-de7299e4b451" /> Can delete manual label from host https://github.com/user-attachments/assets/b64ba6dd-3f54-4dcd-9c57-7bede65122da #### Host details Can run scripts and view their results <img width="1908" height="472" alt="Screenshot 2026-02-10 at 12 52 33 PM" src="https://github.com/user-attachments/assets/d1e40339-ec52-47ff-bc53-c311498ffe80" /> <img width="1882" height="716" alt="Screenshot 2026-02-10 at 12 52 40 PM" src="https://github.com/user-attachments/assets/dd0c2ec3-8cb8-4835-9c6d-f731a7434637" /> <img width="1915" height="718" alt="Screenshot 2026-02-10 at 12 52 48 PM" src="https://github.com/user-attachments/assets/5e7a73e0-ac5b-4d38-b635-770f53dea9e3" /> <img width="1914" height="718" alt="Screenshot 2026-02-10 at 12 52 55 PM" src="https://github.com/user-attachments/assets/b199c796-66b1-46bc-b2b5-fd35e8aa7a7c" /> Can run query associated to host as a live query https://github.com/user-attachments/assets/7aea6f63-e443-4fa0-87dc-48bef84efa2f #### Software Doesn't show trash can icon on software installer card, just the download one. <img width="1423" height="838" alt="Screenshot 2026-02-10 at 1 33 53 PM" src="https://github.com/user-attachments/assets/3a55c226-0bba-43ac-8594-7b5ac0a3684a" /> Can install/uninstall software on a host. Note that **Add software** button is hidden (technicians can't add software). <img width="1378" height="277" alt="Screenshot 2026-02-10 at 3 08 55 PM" src="https://github.com/user-attachments/assets/bf413467-2071-48b6-b62b-f3a721b6057c" /> #### Queries - Can run inherited queries on all hosts https://github.com/user-attachments/assets/09f07e6b-a8c1-453e-81fd-4deb16005836 - Can run team queries on all hosts https://github.com/user-attachments/assets/18b62dea-e159-40ea-b0ed-1d96b6bd40e7 - Can't manage automations or add queries (buttons are not shown at the top-right corner) #### Policies Same as Queries https://github.com/user-attachments/assets/2c24514a-2ae0-47a6-b631-6f9e48fc7b9c #### Protected routes Tested that I can't access routes that have restricted functionality for this role, such as: - **/controls/os-updates**, **/controls/setup-experience** and **/controls/os-settings/certificates** => redirects to **/controls/os-settings** ✅ - **/controls/scripts/progress** => redirects to **/controls/scripts/library** ✅ - **/queries/new** and **/software/add/*** => renders access denied page ✅ --------- Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2026-02-11 21:38:41 +00:00
isTechnician={isTechnician}
/>
)}
/>
<Pagination
disablePrev={isLoading || !meta?.has_previous_results}
disableNext={isLoading || !meta?.has_next_results}
hidePagination={
!isLoading && !meta?.has_previous_results && !meta?.has_next_results
}
onPrevPage={onPrevPage}
onNextPage={onNextPage}
/>
</>
);
};
const renderScriptsDisabledBanner = () => (
<InfoBanner color="yellow">
<div>
<b>Running scripts is disabled in organization settings.</b> You can
still manage your library of macOS and Windows scripts below.
</div>
</InfoBanner>
);
return (
<div className={baseClass}>
<SectionHeader title="Library" alignLeftHeaderVertically />
{config.server_settings.scripts_disabled && renderScriptsDisabledBanner()}
{renderScriptsList()}
Technician role FE changes (#39494) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38630 ## Testing - [x] QA'd all new/changed functionality manually Screenshots below were taken with a **Team Technician** user. Same changes apply for a **Global Technician**. #### Controls > OS settings > Disk encryption - Shows table without controls below. - Shows empty state (doesn't allow to turn it on). <img width="1915" height="886" alt="Screenshot 2026-02-10 at 12 24 25 PM" src="https://github.com/user-attachments/assets/3f44d338-e728-4eb2-ad93-e30844201b52" /> <img width="1913" height="907" alt="Screenshot 2026-02-10 at 12 31 38 PM" src="https://github.com/user-attachments/assets/71706e9e-0540-4c25-b5c0-3f7ccff3ba5a" /> #### Controls > OS settings > Custom settings - Changed description to say **View configuration profiles that apply custom settings.** instead of **Create and upload configuration profiles to apply custom settings.**. - **Add profile** not shown within table header. - Trash can icon not shown when hovering over a row within the table. - **Add profile** card not shown on empty state. Instead, "No configuration profiles have been added." is shown. <img width="1911" height="729" alt="Screenshot 2026-02-10 at 12 24 39 PM" src="https://github.com/user-attachments/assets/aa68cbaf-4772-402d-9288-b4be2ddd3250" /> <img width="1912" height="650" alt="Screenshot 2026-02-10 at 12 28 48 PM" src="https://github.com/user-attachments/assets/6a186172-b01f-4314-bb50-4cb533e13bce" /> #### Controls > Scripts > Library - **Add script** not shown within table header. - No actions shown when hovering over a table row. - Can view script by clicking on a table row. - Removed **To run the script across multiple hosts, add a policy automation on the Policies page** line below **To run this script on a host, go to the Hosts page and select a host.**. - Updated copy to `To run this script on a host, go to the Hosts page and select a host. Then, click Actions > Run script.` <img width="1912" height="772" alt="Screenshot 2026-02-10 at 12 25 46 PM" src="https://github.com/user-attachments/assets/83fbc1ec-3a6e-4bb5-865e-b5e7faef1e37" /> <img width="1732" height="761" alt="Screenshot 2026-02-11 at 3 50 33 PM" src="https://github.com/user-attachments/assets/6dda97d7-fde2-4bcd-94b3-fa7368c65528" /> #### Labels Can add label and filter by label <img width="160" height="247" alt="Screenshot 2026-02-10 at 12 51 24 PM" src="https://github.com/user-attachments/assets/ed63b708-27f8-4363-9d4f-9a7b0bf82b21" /> <img width="1901" height="856" alt="Screenshot 2026-02-10 at 12 35 07 PM" src="https://github.com/user-attachments/assets/c2ef5e21-03ab-4955-a22f-cd6ca32f3179" /> <img width="1903" height="937" alt="Screenshot 2026-02-10 at 12 36 11 PM" src="https://github.com/user-attachments/assets/d9d9f3bc-4d71-4c4b-902a-455eec9e057c" /> Can edit/delete labels created by themselves. NOTE: my technician user ID is 37 - note that the **x** label belongs to a different user id, while the second label belongs to ID 37, therefore it can be edited and deleted. <img width="1915" height="1152" alt="Screenshot 2026-02-10 at 12 38 29 PM" src="https://github.com/user-attachments/assets/21f44c11-4e2d-456b-8547-90936b5d7602" /> <img width="1911" height="1154" alt="Screenshot 2026-02-10 at 12 38 42 PM" src="https://github.com/user-attachments/assets/f9f7ea30-11b2-4d2d-9d71-de7299e4b451" /> Can delete manual label from host https://github.com/user-attachments/assets/b64ba6dd-3f54-4dcd-9c57-7bede65122da #### Host details Can run scripts and view their results <img width="1908" height="472" alt="Screenshot 2026-02-10 at 12 52 33 PM" src="https://github.com/user-attachments/assets/d1e40339-ec52-47ff-bc53-c311498ffe80" /> <img width="1882" height="716" alt="Screenshot 2026-02-10 at 12 52 40 PM" src="https://github.com/user-attachments/assets/dd0c2ec3-8cb8-4835-9c6d-f731a7434637" /> <img width="1915" height="718" alt="Screenshot 2026-02-10 at 12 52 48 PM" src="https://github.com/user-attachments/assets/5e7a73e0-ac5b-4d38-b635-770f53dea9e3" /> <img width="1914" height="718" alt="Screenshot 2026-02-10 at 12 52 55 PM" src="https://github.com/user-attachments/assets/b199c796-66b1-46bc-b2b5-fd35e8aa7a7c" /> Can run query associated to host as a live query https://github.com/user-attachments/assets/7aea6f63-e443-4fa0-87dc-48bef84efa2f #### Software Doesn't show trash can icon on software installer card, just the download one. <img width="1423" height="838" alt="Screenshot 2026-02-10 at 1 33 53 PM" src="https://github.com/user-attachments/assets/3a55c226-0bba-43ac-8594-7b5ac0a3684a" /> Can install/uninstall software on a host. Note that **Add software** button is hidden (technicians can't add software). <img width="1378" height="277" alt="Screenshot 2026-02-10 at 3 08 55 PM" src="https://github.com/user-attachments/assets/bf413467-2071-48b6-b62b-f3a721b6057c" /> #### Queries - Can run inherited queries on all hosts https://github.com/user-attachments/assets/09f07e6b-a8c1-453e-81fd-4deb16005836 - Can run team queries on all hosts https://github.com/user-attachments/assets/18b62dea-e159-40ea-b0ed-1d96b6bd40e7 - Can't manage automations or add queries (buttons are not shown at the top-right corner) #### Policies Same as Queries https://github.com/user-attachments/assets/2c24514a-2ae0-47a6-b631-6f9e48fc7b9c #### Protected routes Tested that I can't access routes that have restricted functionality for this role, such as: - **/controls/os-updates**, **/controls/setup-experience** and **/controls/os-settings/certificates** => redirects to **/controls/os-settings** ✅ - **/controls/scripts/progress** => redirects to **/controls/scripts/library** ✅ - **/queries/new** and **/software/add/*** => renders access denied page ✅ --------- Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2026-02-11 21:38:41 +00:00
{!isLoading &&
currentPage === 0 &&
!scripts?.length &&
(isTechnician ? (
2026-04-27 22:54:34 +00:00
<EmptyState variant="header-list" header="No scripts uploaded" />
Technician role FE changes (#39494) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #38630 ## Testing - [x] QA'd all new/changed functionality manually Screenshots below were taken with a **Team Technician** user. Same changes apply for a **Global Technician**. #### Controls > OS settings > Disk encryption - Shows table without controls below. - Shows empty state (doesn't allow to turn it on). <img width="1915" height="886" alt="Screenshot 2026-02-10 at 12 24 25 PM" src="https://github.com/user-attachments/assets/3f44d338-e728-4eb2-ad93-e30844201b52" /> <img width="1913" height="907" alt="Screenshot 2026-02-10 at 12 31 38 PM" src="https://github.com/user-attachments/assets/71706e9e-0540-4c25-b5c0-3f7ccff3ba5a" /> #### Controls > OS settings > Custom settings - Changed description to say **View configuration profiles that apply custom settings.** instead of **Create and upload configuration profiles to apply custom settings.**. - **Add profile** not shown within table header. - Trash can icon not shown when hovering over a row within the table. - **Add profile** card not shown on empty state. Instead, "No configuration profiles have been added." is shown. <img width="1911" height="729" alt="Screenshot 2026-02-10 at 12 24 39 PM" src="https://github.com/user-attachments/assets/aa68cbaf-4772-402d-9288-b4be2ddd3250" /> <img width="1912" height="650" alt="Screenshot 2026-02-10 at 12 28 48 PM" src="https://github.com/user-attachments/assets/6a186172-b01f-4314-bb50-4cb533e13bce" /> #### Controls > Scripts > Library - **Add script** not shown within table header. - No actions shown when hovering over a table row. - Can view script by clicking on a table row. - Removed **To run the script across multiple hosts, add a policy automation on the Policies page** line below **To run this script on a host, go to the Hosts page and select a host.**. - Updated copy to `To run this script on a host, go to the Hosts page and select a host. Then, click Actions > Run script.` <img width="1912" height="772" alt="Screenshot 2026-02-10 at 12 25 46 PM" src="https://github.com/user-attachments/assets/83fbc1ec-3a6e-4bb5-865e-b5e7faef1e37" /> <img width="1732" height="761" alt="Screenshot 2026-02-11 at 3 50 33 PM" src="https://github.com/user-attachments/assets/6dda97d7-fde2-4bcd-94b3-fa7368c65528" /> #### Labels Can add label and filter by label <img width="160" height="247" alt="Screenshot 2026-02-10 at 12 51 24 PM" src="https://github.com/user-attachments/assets/ed63b708-27f8-4363-9d4f-9a7b0bf82b21" /> <img width="1901" height="856" alt="Screenshot 2026-02-10 at 12 35 07 PM" src="https://github.com/user-attachments/assets/c2ef5e21-03ab-4955-a22f-cd6ca32f3179" /> <img width="1903" height="937" alt="Screenshot 2026-02-10 at 12 36 11 PM" src="https://github.com/user-attachments/assets/d9d9f3bc-4d71-4c4b-902a-455eec9e057c" /> Can edit/delete labels created by themselves. NOTE: my technician user ID is 37 - note that the **x** label belongs to a different user id, while the second label belongs to ID 37, therefore it can be edited and deleted. <img width="1915" height="1152" alt="Screenshot 2026-02-10 at 12 38 29 PM" src="https://github.com/user-attachments/assets/21f44c11-4e2d-456b-8547-90936b5d7602" /> <img width="1911" height="1154" alt="Screenshot 2026-02-10 at 12 38 42 PM" src="https://github.com/user-attachments/assets/f9f7ea30-11b2-4d2d-9d71-de7299e4b451" /> Can delete manual label from host https://github.com/user-attachments/assets/b64ba6dd-3f54-4dcd-9c57-7bede65122da #### Host details Can run scripts and view their results <img width="1908" height="472" alt="Screenshot 2026-02-10 at 12 52 33 PM" src="https://github.com/user-attachments/assets/d1e40339-ec52-47ff-bc53-c311498ffe80" /> <img width="1882" height="716" alt="Screenshot 2026-02-10 at 12 52 40 PM" src="https://github.com/user-attachments/assets/dd0c2ec3-8cb8-4835-9c6d-f731a7434637" /> <img width="1915" height="718" alt="Screenshot 2026-02-10 at 12 52 48 PM" src="https://github.com/user-attachments/assets/5e7a73e0-ac5b-4d38-b635-770f53dea9e3" /> <img width="1914" height="718" alt="Screenshot 2026-02-10 at 12 52 55 PM" src="https://github.com/user-attachments/assets/b199c796-66b1-46bc-b2b5-fd35e8aa7a7c" /> Can run query associated to host as a live query https://github.com/user-attachments/assets/7aea6f63-e443-4fa0-87dc-48bef84efa2f #### Software Doesn't show trash can icon on software installer card, just the download one. <img width="1423" height="838" alt="Screenshot 2026-02-10 at 1 33 53 PM" src="https://github.com/user-attachments/assets/3a55c226-0bba-43ac-8594-7b5ac0a3684a" /> Can install/uninstall software on a host. Note that **Add software** button is hidden (technicians can't add software). <img width="1378" height="277" alt="Screenshot 2026-02-10 at 3 08 55 PM" src="https://github.com/user-attachments/assets/bf413467-2071-48b6-b62b-f3a721b6057c" /> #### Queries - Can run inherited queries on all hosts https://github.com/user-attachments/assets/09f07e6b-a8c1-453e-81fd-4deb16005836 - Can run team queries on all hosts https://github.com/user-attachments/assets/18b62dea-e159-40ea-b0ed-1d96b6bd40e7 - Can't manage automations or add queries (buttons are not shown at the top-right corner) #### Policies Same as Queries https://github.com/user-attachments/assets/2c24514a-2ae0-47a6-b631-6f9e48fc7b9c #### Protected routes Tested that I can't access routes that have restricted functionality for this role, such as: - **/controls/os-updates**, **/controls/setup-experience** and **/controls/os-settings/certificates** => redirects to **/controls/os-settings** ✅ - **/controls/scripts/progress** => redirects to **/controls/scripts/library** ✅ - **/queries/new** and **/software/add/*** => renders access denied page ✅ --------- Co-authored-by: Lucas Manuel Rodriguez <lucas@fleetdm.com>
2026-02-11 21:38:41 +00:00
) : (
<ScriptUploader onButtonClick={() => setShowAddScriptModal(true)} />
))}
{showDeleteScriptModal && selectedScript.current && (
<DeleteScriptModal
scriptName={selectedScript.current?.name}
scriptId={selectedScript.current?.id}
onCancel={onCancelDelete}
UI: Confirm before running scripts (#33679) <!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #28711 and #33685 - Adds a confirmation step to 2 run script user flows: - Host details > Actions > Run script > Actions > Run - Host details > Actions > Run script > Click script name for script details > More actions > Run - For each user flow, canceling / going back takes the user to wherever they came from, e.g., to the run script (scripts table) modal or to the script details modal - Confirming the script run always redirects to the run script (scripts table) modal - Consolidates and streamlines logic of the script modal group - Clarify + solidify modal options in script modal group <img width="1208" height="693" alt="Screenshot 2025-09-30 at 4 12 46 PM" src="https://github.com/user-attachments/assets/160d4105-cbd1-48f5-9d52-1e11f81f87f5" /> # 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 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Added a confirmation dialog before running a script from a host’s details, clearly showing the script and host names. - Improvements - Streamlined script run flow with clearer loading indicators and smoother transitions between modals. - Enhanced modal behavior: consistent close/cancel handling and the ability to return to the previous view after canceling a run. - More consistent actions in script details and run views, reducing unexpected refreshes and interruptions. - Chores - Internal test updates to improve reliability of user interaction simulations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
2025-10-01 17:15:30 +00:00
afterDelete={onDeleteScript}
/>
)}
{showEditScriptModal && selectedScript.current && (
<EditScriptModal
scriptId={selectedScript.current.id}
scriptName={selectedScript.current.name}
onExit={onExitEditScript}
/>
)}
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
{showAddScriptModal && (
<ScriptUploadModal
currentTeamId={teamId}
onExit={() => setShowAddScriptModal(false)}
onSubmit={() => {
setShowAddScriptModal(false);
refetchScripts();
}}
/>
)}
</div>
);
};
export default ScriptLibrary;