Skip to content

Remove UI gating in GitOps mode for excepted entities#42486

Merged
sgress454 merged 10 commits intomainfrom
sgress454/gitops-exceptions-pr4-ui-gating
Mar 31, 2026
Merged

Remove UI gating in GitOps mode for excepted entities#42486
sgress454 merged 10 commits intomainfrom
sgress454/gitops-exceptions-pr4-ui-gating

Conversation

@sgress454
Copy link
Copy Markdown
Contributor

@sgress454 sgress454 commented Mar 26, 2026

Related issue: Resolves #42184

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 for more information.

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.

  • If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes

Testing

For unreleased bug fixes in a release candidate, one of:

  • Confirmed that the fix is not expected to adversely impact load test results
  • Alerted the release DRI if additional load testing is needed

Database migrations

  • Checked schema for all modified table for columns that will auto-update timestamps during migration.
  • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
  • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).

New Fleet configuration settings

  • Setting(s) is/are explicitly excluded from GitOps

If you didn't check the box above, follow this checklist for GitOps-enabled settings:

  • Verified that the setting is exported via fleetctl generate-gitops
  • Verified the setting is documented in a separate PR to the GitOps documentation
  • Verified that the setting is cleared on the server if it is not supplied in a YAML file (or that it is documented as being optional)
  • Verified that any relevant UI is disabled when GitOps mode is enabled

fleetd/orbit/Fleet Desktop

  • Verified compatibility with the latest released version of Fleet (see Must rule)
  • If the change applies to only one platform, confirmed that runtime.GOOS is used as needed to isolate changes
  • Verified that fleetd runs on macOS, Linux and Windows
  • Verified auto-update works from the released version of component to the new version (see tools/tuf/test)

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for GitOps exceptions per entity type (labels, software, secrets), allowing specific areas to bypass GitOps mode restrictions when configured.
  • Bug Fixes

    • Improved GitOps mode behavior to properly respect per-entity-type exception settings across software, labels, and secrets management.
  • Tests

    • Extended test coverage for GitOps exception handling scenarios.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 80.76923% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.70%. Comparing base (18c97ab) to head (22a6ffc).
⚠️ Report is 37 commits behind head on main.

Files with missing lines Patch % Lines
...ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx 50.00% 2 Missing ⚠️
...etailsPage/EditSoftwareModal/EditSoftwareModal.tsx 0.00% 1 Missing ⚠️
...ePage/components/forms/PackageForm/PackageForm.tsx 0.00% 1 Missing ⚠️
...mponents/forms/SoftwareVppForm/SoftwareVppForm.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #42486    +/-   ##
========================================
  Coverage   66.70%   66.70%            
========================================
  Files        2535     2536     +1     
  Lines      203449   203456     +7     
  Branches     9231     9117   -114     
========================================
+ Hits       135716   135722     +6     
- Misses      55456    55457     +1     
  Partials    12277    12277            
Flag Coverage Δ
frontend 54.60% <80.76%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sgress454 sgress454 force-pushed the sgress454/gitops-exceptions-pr4-ui-gating branch from 5da9174 to 014aca7 Compare March 27, 2026 16:31
@sgress454
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Walkthrough

This PR introduces GitOps mode exceptions for three entity types: labels, software, and secrets. When GitOps mode is globally enabled, individual entity types can now be exempted via configuration flags. The implementation adds an optional entityType prop to GitOpsModeTooltipWrapper that evaluates whether an entity's exception flag is enabled to determine if UI interactions should be allowed despite GitOps mode being active. Configuration interfaces are extended to include an IGitOpsExceptions object with boolean flags for each entity type. Multiple UI components across labels, software, and secrets pages are updated to pass entity types and respect exception flags when controlling disabled states for create, edit, and delete operations.

Possibly related PRs

  • #30555: Modifies UI actions wrapped by GitOpsModeTooltipWrapper to disable delete/edit controls under GitOps mode and updates related component usage patterns.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description references the related issue (#42184) and includes the required checklist template, but all checkboxes remain unchecked despite this being a code change affecting UI, testing, and configuration. Complete the checklist by checking relevant items and providing explicit confirmation of completed testing, changes files, and validation work.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing UI gating for entities exempted from GitOps mode, which reflects the core objective of the PR.
Linked Issues check ✅ Passed The PR implements all conditions of satisfaction from issue #42184: exception-based UI gating for labels, software, and secrets entities, allowing create/edit/delete operations when exceptions are enabled.
Out of Scope Changes check ✅ Passed All changes directly support the PR objective of enabling UI operations for excepted GitOps entities. Configuration interfaces, components, pages, and tests are all cohesively focused on implementing the exception-based gating logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sgress454/gitops-exceptions-pr4-ui-gating

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx (1)

104-120: ⚠️ Potential issue | 🟡 Minor

Missing dependencies in useCallback.

The renderTable callback references labelsGitOpsManaged and config?.gitops.repository_url but these aren't included in the dependency array. If these values change (e.g., config update), the table won't re-render with updated GitOps state.

Proposed fix
-  }, [currentUser, error, isLoading, labels, onClickAction]);
+  }, [currentUser, error, isLoading, labels, onClickAction, labelsGitOpsManaged, config?.gitops.repository_url]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx` around lines 104
- 120, The renderTable useCallback is missing dependencies for
labelsGitOpsManaged and the repo URL from config, so update the dependency array
of renderTable (the useCallback that returns <LabelsTable ... />) to include
labelsGitOpsManaged and the config value used (e.g., config or
config?.gitops.repository_url) so the callback re-runs when those change; keep
existing dependencies currentUser, error, isLoading, labels, onClickAction and
add the new ones.
frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx (1)

96-109: ⚠️ Potential issue | 🟠 Major

Gate the "Edit" option for GitOps-managed labels to match "Delete" behavior.

Currently, "Edit" remains enabled (disabled: false at line 100) while "Delete" is gated with disabled: labelsGitOpsManaged (line 107). The edit page also lacks GitOps validation. Either gate "Edit" in the dropdown at line 97-102, or confirm backend API prevents updates on GitOps-managed labels. The current state creates an inconsistency where users can navigate to edit a managed label even though deletion is blocked.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx`
around lines 96 - 109, The "Edit" option is inconsistently enabled for
GitOps-managed labels; in the block that builds options (inside the
hasEditPermission(currentUser, label) branch) change the Edit option to respect
the labelsGitOpsManaged flag like Delete does — set disabled:
labelsGitOpsManaged (instead of false) and add tooltipContent: gitOpsTooltip so
the dropdown prevents edits and shows the same GitOps tooltip; keep the existing
guard that skips host_vitals (label.label_membership_type !== "host_vitals").
🧹 Nitpick comments (2)
frontend/hooks/useSoftwareInstallerMeta.ts (1)

128-134: Consider consistency in accessing gitops config properties.

Lines 128-131 destructure from config?.gitops, while line 133 accesses config?.gitops.exceptions?.software directly. This works correctly due to optional chaining, but for consistency you could destructure exceptions as well.

♻️ Optional refactor for consistency
 const {
   gitops_mode_enabled: configGitOpsModeEnabled,
   repository_url: repoURL,
+  exceptions,
 } = config?.gitops || {};

-const softwareExcepted = !!config?.gitops.exceptions?.software;
+const softwareExcepted = !!exceptions?.software;
 const gitOpsModeEnabled = !!configGitOpsModeEnabled && !softwareExcepted;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/hooks/useSoftwareInstallerMeta.ts` around lines 128 - 134,
Destructure the exceptions property from config?.gitops instead of accessing
config?.gitops.exceptions?.software inline: add exceptions (or
exceptions?.software) to the existing destructure alongside gitops_mode_enabled
and repository_url, compute softwareExcepted from that local variable, and keep
the existing gitOpsModeEnabled logic (use the destructured exceptions to derive
softwareExcepted and then gitOpsModeEnabled) so all gitops properties are
accessed consistently; reference the existing identifiers gitops_mode_enabled,
repository_url, exceptions, softwareExcepted, and gitOpsModeEnabled when making
the change.
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx (1)

56-56: Remove unused gitOpsModeEnabled prop from interface and component signature.

The prop is defined in IEditSoftwareModalProps but never destructured in the component function. The component computes gitOpsModeEnabled locally from the app context (lines 82-84), and the parent component (SoftwareSummaryCard) does not pass this prop when rendering the component.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx`
at line 56, Remove the unused gitOpsModeEnabled prop: delete gitOpsModeEnabled
from the IEditSoftwareModalProps interface and from the EditSoftwareModal
component parameter list (the function signature), and then run TypeScript
checks to remove any resulting unused-variable warnings or imports; ensure the
component continues to compute gitOpsModeEnabled locally (via app context in the
body of EditSoftwareModal) and that no other code expects this prop (e.g.,
SoftwareSummaryCard) so type signatures remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx`:
- Around line 41-42: The expression computing labelsGitOpsManaged can throw if
config.gitops.exceptions is undefined; update the check in the
labelsGitOpsManaged assignment to safely access exceptions (use optional
chaining on exceptions) so it evaluates like checking
config?.gitops?.exceptions?.labels, ensuring you reference the existing
labelsGitOpsManaged constant and the config.gitops.exceptions path when making
the change.

---

Outside diff comments:
In `@frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx`:
- Around line 96-109: The "Edit" option is inconsistently enabled for
GitOps-managed labels; in the block that builds options (inside the
hasEditPermission(currentUser, label) branch) change the Edit option to respect
the labelsGitOpsManaged flag like Delete does — set disabled:
labelsGitOpsManaged (instead of false) and add tooltipContent: gitOpsTooltip so
the dropdown prevents edits and shows the same GitOps tooltip; keep the existing
guard that skips host_vitals (label.label_membership_type !== "host_vitals").

In `@frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx`:
- Around line 104-120: The renderTable useCallback is missing dependencies for
labelsGitOpsManaged and the repo URL from config, so update the dependency array
of renderTable (the useCallback that returns <LabelsTable ... />) to include
labelsGitOpsManaged and the config value used (e.g., config or
config?.gitops.repository_url) so the callback re-runs when those change; keep
existing dependencies currentUser, error, isLoading, labels, onClickAction and
add the new ones.

---

Nitpick comments:
In `@frontend/hooks/useSoftwareInstallerMeta.ts`:
- Around line 128-134: Destructure the exceptions property from config?.gitops
instead of accessing config?.gitops.exceptions?.software inline: add exceptions
(or exceptions?.software) to the existing destructure alongside
gitops_mode_enabled and repository_url, compute softwareExcepted from that local
variable, and keep the existing gitOpsModeEnabled logic (use the destructured
exceptions to derive softwareExcepted and then gitOpsModeEnabled) so all gitops
properties are accessed consistently; reference the existing identifiers
gitops_mode_enabled, repository_url, exceptions, softwareExcepted, and
gitOpsModeEnabled when making the change.

In
`@frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx`:
- Line 56: Remove the unused gitOpsModeEnabled prop: delete gitOpsModeEnabled
from the IEditSoftwareModalProps interface and from the EditSoftwareModal
component parameter list (the function signature), and then run TypeScript
checks to remove any resulting unused-variable warnings or imports; ensure the
component continues to compute gitOpsModeEnabled locally (via app context in the
body of EditSoftwareModal) and that no other code expects this prop (e.g.,
SoftwareSummaryCard) so type signatures remain consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 49a4914f-83ef-4300-b8ea-c108e163a429

📥 Commits

Reviewing files that changed from the base of the PR and between 6853b51 and 014aca7.

📒 Files selected for processing (26)
  • frontend/__mocks__/configMock.ts
  • frontend/components/EnrollSecrets/EnrollSecretModal/EnrollSecretModal.tsx
  • frontend/components/EnrollSecrets/EnrollSecretTable/EnrollSecretRow/EnrollSecretRow.tsx
  • frontend/components/GitOpsModeTooltipWrapper/GitOpsModeTooltipWrapper.tests.tsx
  • frontend/components/GitOpsModeTooltipWrapper/GitOpsModeTooltipWrapper.tsx
  • frontend/hooks/useSoftwareInstallerMeta.ts
  • frontend/interfaces/config.ts
  • frontend/pages/ManageControlsPage/Secrets/Secrets.tsx
  • frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx
  • frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx
  • frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/AddPatchPolicyModal/AddPatchPolicyModal.tsx
  • frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditAutoUpdateConfigModal/EditAutoUpdateConfigModal.tsx
  • frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx
  • frontend/pages/SoftwarePage/components/cards/SoftwareDetailsSummary/SoftwareDetailsSummary.tsx
  • frontend/pages/SoftwarePage/components/forms/PackageForm/PackageForm.tsx
  • frontend/pages/SoftwarePage/components/forms/SoftwareAndroidForm/SoftwareAndroidForm.tsx
  • frontend/pages/SoftwarePage/components/forms/SoftwareVppForm/SoftwareVppForm.tsx
  • frontend/pages/SoftwarePage/components/modals/ManageSoftwareAutomationsModal/ManageSoftwareAutomationsModal.tsx
  • frontend/pages/admin/IntegrationsPage/cards/MdmSettings/components/EndUserMigrationSection/EndUserMigrationSection.tests.tsx
  • frontend/pages/admin/OrgSettingsPage/cards/FleetDesktop/FleetDesktop.tests.tsx
  • frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx
  • frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTable.tsx
  • frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx
  • frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx
  • frontend/pages/labels/NewLabelPage/NewLabelPage.tsx
  • frontend/pages/labels/components/LabelForm/LabelForm.tsx

@sgress454 sgress454 marked this pull request as ready for review March 27, 2026 18:01
@sgress454 sgress454 requested a review from a team as a code owner March 27, 2026 18:01
Copilot AI review requested due to automatic review settings March 27, 2026 18:01
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@sgress454 sgress454 force-pushed the sgress454/gitops-exceptions-pr4-ui-gating branch from 014aca7 to 78e7e8f Compare March 27, 2026 18:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the frontend GitOps-mode UI gating so labels, software, and secrets controls remain interactive when their corresponding GitOps exception is enabled, primarily by extending GitOpsModeTooltipWrapper to understand per-entity exceptions.

Changes:

  • Added gitops.exceptions typing to config and introduced GitOpsEntityType for exception-aware gating.
  • Extended GitOpsModeTooltipWrapper with an entityType prop to bypass disabling when that entity is excepted.
  • Applied exception-aware gating across labels/software/secrets UI controls and updated related tests/mocks.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/pages/labels/components/LabelForm/LabelForm.tsx Wraps “Save” with exception-aware GitOps tooltip wrapper for labels.
frontend/pages/labels/NewLabelPage/NewLabelPage.tsx Wraps “Save” with exception-aware GitOps tooltip wrapper for labels.
frontend/pages/labels/ManageLabelsPage/ManageLabelsPage.tsx Computes labels GitOps-managed state and passes it (and repo URL) down to the labels table.
frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx Disables label deletion in actions dropdown when labels are GitOps-managed and adds tooltip content.
frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTable.tsx Plumbs GitOps-managed state + repo URL into table header generation.
frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx Wraps label edit/delete icon buttons with exception-aware GitOps tooltip wrapper.
frontend/pages/admin/OrgSettingsPage/cards/FleetDesktop/FleetDesktop.tests.tsx Updates config mock usage to include gitops.exceptions.
frontend/pages/admin/IntegrationsPage/cards/MdmSettings/components/EndUserMigrationSection/EndUserMigrationSection.tests.tsx Updates config mock usage to include gitops.exceptions.
frontend/pages/SoftwarePage/components/modals/ManageSoftwareAutomationsModal/ManageSoftwareAutomationsModal.tsx Treats GitOps mode as disabled for software when software is excepted; passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/components/forms/SoftwareVppForm/SoftwareVppForm.tsx Treats GitOps mode as disabled for software when software is excepted; passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/components/forms/SoftwareAndroidForm/SoftwareAndroidForm.tsx Treats GitOps mode as disabled for software when software is excepted; passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/components/forms/PackageForm/PackageForm.tsx Treats GitOps mode as disabled for software when software is excepted.
frontend/pages/SoftwarePage/components/cards/SoftwareDetailsSummary/SoftwareDetailsSummary.tsx Treats GitOps mode as disabled for software when software is excepted.
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx Treats GitOps mode as disabled for software when software is excepted.
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditAutoUpdateConfigModal/EditAutoUpdateConfigModal.tsx Treats GitOps mode as disabled for software when software is excepted; passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/AddPatchPolicyModal/AddPatchPolicyModal.tsx Passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm.tsx Passes entityType="software" to wrapper.
frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareCustomPackage/SoftwareCustomPackage.tsx Treats GitOps mode as disabled for software when software is excepted.
frontend/pages/ManageControlsPage/Secrets/Secrets.tsx Passes entityType="secrets" to wrapper in secrets UI.
frontend/interfaces/config.ts Adds IGitOpsExceptions, GitOpsEntityType, and gitops.exceptions to config typings.
frontend/hooks/useSoftwareInstallerMeta.ts Treats GitOps mode as disabled for software when software is excepted.
frontend/components/GitOpsModeTooltipWrapper/GitOpsModeTooltipWrapper.tsx Adds entityType and exception-aware bypass behavior.
frontend/components/GitOpsModeTooltipWrapper/GitOpsModeTooltipWrapper.tests.tsx Adds tests for exception-aware behavior.
frontend/components/EnrollSecrets/EnrollSecretTable/EnrollSecretRow/EnrollSecretRow.tsx Passes entityType="secrets" to wrapper for enrollment secret row actions.
frontend/components/EnrollSecrets/EnrollSecretModal/EnrollSecretModal.tsx Passes entityType="secrets" to wrapper in enrollment secret modal actions.
frontend/mocks/configMock.ts Adds default gitops.exceptions to mock config.
Comments suppressed due to low confidence (1)

frontend/pages/labels/ManageLabelsPage/LabelsTable/LabelsTableConfig.tsx:103

  • In GitOps-managed mode (labelsGitOpsManaged), the dropdown still offers an enabled "Edit" action. That allows navigating into the edit UI even though edits can’t be saved, which conflicts with the intended UI gating behavior. Disable the "Edit" option (and attach the same GitOps tooltip content) when labelsGitOpsManaged is true.
  if (hasEditPermission(currentUser, label)) {
    if (label.label_membership_type !== "host_vitals") {
      options.push({
        label: "Edit",
        disabled: false,
        value: "edit",
      });
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@iansltx iansltx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the GitOps mode duplication is now a lot heavier on software UIs that have that check explicitly rather than as the component. Maybe that should be extracted?

const gitOpsModeEnabled = config?.gitops.gitops_mode_enabled || false;
const softwareExcepted = !!config?.gitops.exceptions?.software;
const gitOpsModeEnabled =
(config?.gitops.gitops_mode_enabled && !softwareExcepted) || false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a holdover from previously, but do we actually need the || false here?

@sgress454 sgress454 force-pushed the sgress454/gitops-exceptions-pr4-ui-gating branch from 78e7e8f to 0f1de82 Compare March 30, 2026 15:27
@sgress454
Copy link
Copy Markdown
Contributor Author

Feels like the GitOps mode duplication is now a lot heavier on software UIs that have that check explicitly rather than as the component. Maybe that should be extracted?

Good call. Made a useGitopsMode hook that takes an optional entity type param, and returns yea or nay on whether GitOps mode should be considered enabled, as well as the repo url. Replaced a lot of duplicated AppContext loading and parsing code with e.g. const { gitOpsModeEnabled } = useGitopsMode("software")

Copy link
Copy Markdown
Member

@iansltx iansltx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's a lot cleaner, thanks!

@sgress454 sgress454 merged commit e62bdf1 into main Mar 31, 2026
19 checks passed
@sgress454 sgress454 deleted the sgress454/gitops-exceptions-pr4-ui-gating branch March 31, 2026 14:11
@coderabbitai coderabbitai bot mentioned this pull request Apr 13, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update GitOps mode UI gating to take exceptions into account

3 participants