From 822fe3dd1819aad87203fca3b9e504204885483b Mon Sep 17 00:00:00 2001 From: Scott Gress Date: Wed, 12 Mar 2025 13:03:12 -0500 Subject: [PATCH] GitOps mode updates (#26733) For #26719 Set of updates based on feedback on the GitOps mode. - [X] On settings/teams/users, keep "Add user" button and "Actions" dropdown enabled - [X] Enable buttons on /settings/integrations/mdm/apple - [x] Disable form fields (no tooltip) + save button (w/ tooltip) on /controls/setup-experience/end-user-auth - [x] Disable "Edit" and "Delete" actions w/ tooltip on software detail page - [x] Update Org Settings -> Advanced options to only disable items available in gitops - Domain - Verify SSL certs - Enable STARTTLS - [x] Disable adding fleet maintained apps --- .../EndUserAuthForm/EndUserAuthForm.tsx | 28 +- .../FleetAppDetailsForm.tsx | 33 +- .../FleetAppDetailsForm/_styles.scss | 5 + .../SoftwareInstallerCard.tsx | 47 ++- .../components/content/ApplePushCertInfo.tsx | 31 +- .../cards/Advanced/Advanced.tsx | 390 +++++++++++------- .../UsersPage/UsersPage.tsx | 1 - .../UsersPage/UsersPageTableConfig.tsx | 20 +- 8 files changed, 337 insertions(+), 218 deletions(-) diff --git a/frontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/components/EndUserAuthForm/EndUserAuthForm.tsx b/frontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/components/EndUserAuthForm/EndUserAuthForm.tsx index 924992b54c..df774eec37 100644 --- a/frontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/components/EndUserAuthForm/EndUserAuthForm.tsx +++ b/frontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/components/EndUserAuthForm/EndUserAuthForm.tsx @@ -3,10 +3,13 @@ import { Link } from "react-router"; import PATHS from "router/paths"; import mdmAPI from "services/entities/mdm"; +import classnames from "classnames"; import Button from "components/buttons/Button"; import Checkbox from "components/forms/fields/Checkbox"; +import GitOpsModeTooltipWrapper from "components/GitOpsModeTooltipWrapper"; import { NotificationContext } from "context/notification"; +import { AppContext } from "context/app"; const baseClass = "end-user-auth-form"; @@ -20,6 +23,8 @@ const EndUserAuthForm = ({ defaultIsEndUserAuthEnabled, }: IEndUserAuthFormProps) => { const { renderFlash } = useContext(NotificationContext); + const gitOpsModeEnabled = useContext(AppContext).config?.gitops + .gitops_mode_enabled; const [isEndUserAuthEnabled, setEndUserAuthEnabled] = useState( defaultIsEndUserAuthEnabled @@ -45,21 +50,34 @@ const EndUserAuthForm = ({ } }; + const classes = classnames({ [`${baseClass}--disabled`]: gitOpsModeEnabled }); return (
- + Turn on -

+

Require end users to authenticate with your identity provider (IdP) and agree to an end user license agreement (EULA) when they setup their new macOS hosts.{" "} View IdP and EULA

- + ( + + )} + />
); diff --git a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx index 37d7d723db..d6ce17bb4c 100644 --- a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx +++ b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx @@ -1,4 +1,6 @@ -import React, { useState } from "react"; +import React, { useContext, useState } from "react"; + +import { AppContext } from "context/app"; import { ILabelSummary } from "interfaces/label"; @@ -13,6 +15,7 @@ import { } from "pages/SoftwarePage/helpers"; import AdvancedOptionsFields from "pages/SoftwarePage/components/AdvancedOptionsFields"; +import GitOpsModeTooltipWrapper from "components/GitOpsModeTooltipWrapper"; import { generateFormValidation } from "./helpers"; @@ -59,6 +62,9 @@ const FleetAppDetailsForm = ({ onCancel, onSubmit, }: IFleetAppDetailsFormProps) => { + const gitOpsModeEnabled = useContext(AppContext).config?.gitops + .gitops_mode_enabled; + const [showAdvancedOptions, setShowAdvancedOptions] = useState(false); const [formData, setFormData] = useState({ @@ -138,10 +144,13 @@ const FleetAppDetailsForm = ({ }; const isSubmitDisabled = !formValidation.isValid; + const gitOpsModeDisabledClass = gitOpsModeEnabled + ? "form-fields--disabled" + : ""; return ( -
-
+ +
-
+
- + ( + + )} + /> diff --git a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/_styles.scss b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/_styles.scss index 6cdff34f53..a3cc501759 100644 --- a/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/_styles.scss +++ b/frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/_styles.scss @@ -65,4 +65,9 @@ .info-banner { margin-top: $pad-small; } + + .form-fields--disabled { + @include disabled; + } + } diff --git a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx index a9dbe25ae0..21df1d9cc9 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx @@ -147,6 +147,10 @@ const SoftwareActionsDropdown = ({ onDeleteClick, onEditSoftwareClick, }: IActionsDropdownProps) => { + const config = useContext(AppContext).config; + const { gitops_mode_enabled: gitOpsModeEnabled, repository_url: repoURL } = + config?.gitops || {}; + const onSelect = (action: string) => { switch (action) { case "download": @@ -163,18 +167,49 @@ const SoftwareActionsDropdown = ({ } }; + let options = + installerType === "package" + ? [...SOFTWARE_PACKAGE_DROPDOWN_OPTIONS] + : [...APP_STORE_APP_DROPDOWN_OPTIONS]; + + if (gitOpsModeEnabled) { + const tooltipContent = ( + <> + {repoURL && ( + <> + Manage in{" "} + +
+ + )} + (GitOps mode enabled) + + ); + options = options.map((option) => { + if (option.value === "edit" || option.value === "delete") { + return { + ...option, + disabled: true, + tooltipContent, + }; + } + return option; + }); + } + return (
); @@ -215,13 +250,13 @@ const SoftwareInstallerCard = ({ const installerType = isSoftwarePackage(softwareInstaller) ? "package" : "vpp"; - const { isGlobalAdmin, isGlobalMaintainer, isTeamAdmin, isTeamMaintainer, } = useContext(AppContext); + const { renderFlash } = useContext(NotificationContext); const [showEditSoftwareModal, setShowEditSoftwareModal] = useState(false); diff --git a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleMdmPage/components/content/ApplePushCertInfo.tsx b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleMdmPage/components/content/ApplePushCertInfo.tsx index 80b26fb03a..74f7225298 100644 --- a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleMdmPage/components/content/ApplePushCertInfo.tsx +++ b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleMdmPage/components/content/ApplePushCertInfo.tsx @@ -44,31 +44,12 @@ const ApplePushCertInfo = ({
- ( - - )} - /> - ( - - )} - /> + +
); diff --git a/frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx b/frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx index 22fb3719d7..cd55a74bb1 100644 --- a/frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx +++ b/frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx @@ -192,22 +192,27 @@ const Advanced = ({

Most users do not need to modify these options.

-
+
{appConfig.mdm.enabled_and_configured && ( - ( + + )} /> )} Enable STARTTLS - - When enabled, allows automatic cleanup of -
- hosts that have not communicated with Fleet in -
- the number of days specified in the{" "} - - Host expiry -
- window -
{" "} - setting.{" "} - - (Default: Off) - - - } - > - Host expiry -
+ ( + + When enabled, allows automatic cleanup of +
+ hosts that have not communicated with Fleet in +
+ the number of days specified in the{" "} + + Host expiry +
+ window +
{" "} + setting.{" "} + + (Default: Off) + + + ) + } + > + Host expiry +
+ )} + /> {enableHostExpiry && ( - ( + + )} /> )} - - When enabled, allows automatic cleanup of audit logs older - than the number of days specified in the{" "} - Audit log retention window setting. - - (Default: Off) - - - } - > - Delete activities - + ( + + When enabled, allows automatic cleanup of audit logs + older than the number of days specified in the{" "} + Audit log retention window setting. + + (Default: Off) + + + ) + } + > + Delete activities + + )} + /> {deleteActivities && ( - ( + + )} /> )} - - When enabled, disables the ability to run live queries
- (ad hoc queries executed via the UI or fleetctl).{" "} - - (Default: Off) - - - } - > - Disable live queries -
- - Disabling script execution will block access to run scripts. -
- Scripts may still be added and removed in the UI and API. -
- - (Default: Off) - - - } - helpText="Features that run scripts under-the-hood (e.g. software install, lock/wipe) will still be available." - > - Disable script execution features -
- - When enabled, disables AI features such as pre-filling forms -
- with descriptions generated by a large language model -
- (LLM).{" "} - - (Default: Off) - - - } - helpText="If enabled, only policy queries (SQL) are sent to the LLM. Fleet doesn’t use this data to train models." - > - Disable generative AI features -
- - <> - Disabling query reports will decrease database usage,
- but will prevent you from accessing query results in -
- Fleet and will delete existing reports. This can also be{" "} -
- disabled on a per-query basis by enabling "Discard{" "} -
- data".{" "} - - (Default: Off) - - - - } - helpText="Enabling this setting will delete all existing query reports in Fleet." - > - Disable query reports -
+ ( + + When enabled, disables the ability to run live queries{" "} +
+ (ad hoc queries executed via the UI or fleetctl).{" "} + + (Default: Off) + + + ) + } + > + Disable live queries +
+ )} + /> + ( + + Disabling script execution will block access to run + scripts. +
+ Scripts may still be added and removed in the UI and + API. +
+ + (Default: Off) + + + ) + } + helpText="Features that run scripts under-the-hood (e.g. software install, lock/wipe) will still be available." + > + Disable script execution features +
+ )} + /> + ( + + When enabled, disables AI features such as pre-filling + forms +
+ with descriptions generated by a large language model +
+ (LLM).{" "} + + (Default: Off) + + + ) + } + helpText="If enabled, only policy queries (SQL) are sent to the LLM. Fleet doesn’t use this data to train models." + > + Disable generative AI features +
+ )} + /> + ( + + <> + Disabling query reports will decrease database usage,{" "} +
+ but will prevent you from accessing query results in +
+ Fleet and will delete existing reports. This can also + be
+ disabled on a per-query basis by enabling + "Discard
+ data".{" "} + + (Default: Off) + + + + ) + } + helpText="Enabling this setting will delete all existing query reports in Fleet." + > + Disable query reports +
+ )} + />
{ ? toggleAddUserModal : toggleCreateUserModal, hideButton: userIds.length === 0 && searchString === "", - gitOpsModeCompatible: true, }} onQueryChange={({ searchQuery }) => setSearchString(searchQuery)} inputPlaceHolder="Search" diff --git a/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/UsersPage/UsersPageTableConfig.tsx b/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/UsersPage/UsersPageTableConfig.tsx index 4ca20a2847..6be3388408 100644 --- a/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/UsersPage/UsersPageTableConfig.tsx +++ b/frontend/pages/admin/TeamManagementPage/TeamDetailsWrapper/UsersPage/UsersPageTableConfig.tsx @@ -168,20 +168,12 @@ const generateColumnConfigs = ( disableSortBy: true, accessor: "actions", Cell: (cellProps: IActionsDropdownProps) => ( - ( -
- - actionSelectHandler(value, cellProps.row.original) - } - placeholder="Actions" - disabled={disableChildren} - /> -
- )} + + actionSelectHandler(value, cellProps.row.original) + } + placeholder="Actions" /> ), },