From 4bb40c99ee49bb1900bd92f8ef17ae47105a4ec0 Mon Sep 17 00:00:00 2001 From: Andrew Mellor Date: Mon, 27 Apr 2026 17:45:34 +0100 Subject: [PATCH] updated AB tokens renew and delete options to enabled in gitops mode (#43510) **Related issue:** Resolves #42440 # 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 - [x] QA'd all new/changed functionality manually ## Summary by CodeRabbit * **New Features** * Enabled renewing and deleting Apple Business Manager (AB) tokens in the UI when running in GitOps mode. * Apple Business Manager table actions now adapt to GitOps mode: some actions are disabled and contextual tooltips explain unavailable options (including repository-linked guidance when applicable). --- ...40-renew-ab-tokens-gitopsmode-dropdown-fix | 1 + .../AppleBusinessManagerTable.tsx | 9 ++- .../AppleBusinessManagerTableConfig.tsx | 62 +++++++++++-------- 3 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 changes/42440-renew-ab-tokens-gitopsmode-dropdown-fix diff --git a/changes/42440-renew-ab-tokens-gitopsmode-dropdown-fix b/changes/42440-renew-ab-tokens-gitopsmode-dropdown-fix new file mode 100644 index 0000000000..e3b6337c71 --- /dev/null +++ b/changes/42440-renew-ab-tokens-gitopsmode-dropdown-fix @@ -0,0 +1 @@ +- Renewing and deleting AB tokens in the UI is now enabled in gitops mode \ No newline at end of file diff --git a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTable.tsx b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTable.tsx index 27a3f9aa2a..430a03d5b0 100644 --- a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTable.tsx +++ b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTable.tsx @@ -1,6 +1,7 @@ import React from "react"; import { IMdmAbmToken } from "interfaces/mdm"; +import useGitOpsMode from "hooks/useGitOpsMode"; import TableContainer from "components/TableContainer"; @@ -21,6 +22,8 @@ const AppleBusinessManagerTable = ({ onRenewToken, onDeleteToken, }: IAppleBusinessManagerTableProps) => { + const { gitOpsModeEnabled, repoURL } = useGitOpsMode(); + const onSelectAction = (action: string, abmToken: IMdmAbmToken) => { switch (action) { case "editTeams": @@ -37,7 +40,11 @@ const AppleBusinessManagerTable = ({ } }; - const tableConfig = generateTableConfig(onSelectAction); + const tableConfig = generateTableConfig( + onSelectAction, + gitOpsModeEnabled, + repoURL + ); return ( diff --git a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTableConfig.tsx b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTableConfig.tsx index 9ad4d6bd90..f05c943091 100644 --- a/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTableConfig.tsx +++ b/frontend/pages/admin/IntegrationsPage/cards/MdmSettings/AppleBusinessManagerPage/components/AppleBusinessManagerTable/AppleBusinessManagerTableConfig.tsx @@ -10,7 +10,7 @@ import HeaderCell from "components/TableContainer/DataTable/HeaderCell"; import ActionsDropdown from "components/ActionsDropdown"; import TextCell from "components/TableContainer/DataTable/TextCell"; import TooltipWrapper from "components/TooltipWrapper"; -import GitOpsModeTooltipWrapper from "components/GitOpsModeTooltipWrapper"; +import { getGitOpsModeTipContent } from "utilities/helpers"; import RenewDateCell from "../../../components/RenewDateCell"; import OrgNameCell from "./OrgNameCell"; @@ -28,8 +28,27 @@ const DEFAULT_ACTION_OPTIONS: IDropdownOption[] = [ { value: "delete", label: "Delete", disabled: false }, ]; -const generateActions = () => { - return DEFAULT_ACTION_OPTIONS; +const generateActions = (gitopsModeEnabled: boolean, repoURL?: string) => { + if (!gitopsModeEnabled) { + return DEFAULT_ACTION_OPTIONS; + } + + return DEFAULT_ACTION_OPTIONS.map((option) => { + if (option.value !== "editTeams") { + return option; + } + + return { + ...option, + disabled: true, + ...(repoURL + ? { + tooltip: true, + tooltipContent: getGitOpsModeTipContent(repoURL), + } + : {}), + }; + }); }; const RENEW_DATE_CELL_STATUS_CONFIG: IRenewDateCellStatusConfig = { @@ -52,7 +71,9 @@ const RENEW_DATE_CELL_STATUS_CONFIG: IRenewDateCellStatusConfig = { }; export const generateTableConfig = ( - actionSelectHandler: (value: string, team: IMdmAbmToken) => void + actionSelectHandler: (value: string, team: IMdmAbmToken) => void, + gitopsModeEnabled: boolean, + repoURL?: string ): IAbmTableConfig[] => { return [ { @@ -171,28 +192,17 @@ export const generateTableConfig = ( // but we don't use it. accessor: "id", Cell: (cellProps) => ( - ( -
- - actionSelectHandler(value, cellProps.row.original) - } - placeholder="Actions" - disabled={disableChildren} - variant="small-button" - /> -
- )} - /> +
+ + actionSelectHandler(value, cellProps.row.original) + } + placeholder="Actions" + disabled={false} + variant="small-button" + /> +
), }, ];