Skip to content

feat: hide CIRA in profile when disabled on the server#3445

Open
nmgaston wants to merge 4 commits into
mainfrom
hideDisabledCIRA
Open

feat: hide CIRA in profile when disabled on the server#3445
nmgaston wants to merge 4 commits into
mainfrom
hideDisabledCIRA

Conversation

@nmgaston

@nmgaston nmgaston commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This pull request refines the handling of the CIRA (Cloud Internet Remote Access) feature in the profile management UI, improving both the user experience and code maintainability. The main changes ensure that CIRA options only appear when available, prevent users from selecting CIRA when it's disabled, and clean up related UI and translation strings. The test suite is expanded to cover these scenarios.

CIRA feature handling and UI improvements:

  • The CIRA connection option and related fields in profile-detail.component.html are now only shown if CIRA is enabled, preventing users from selecting or viewing CIRA options when the feature is unavailable. The fallback logic ensures profiles referencing CIRA automatically switch to a supported mode if CIRA is disabled.
  • The warning icon and tooltip indicating a profile uses CIRA when it's disabled are removed from the profiles list, streamlining the UI.

Logic and state management:

  • Introduced a new ciraAvailabilityResolved signal to track when the server's CIRA feature status is known, preventing premature changes to profile forms before the server response arrives.
    Test coverage:

  • Added and updated tests in profile-detail.component.spec.ts to verify correct behavior when CIRA is enabled, disabled, or the feature status is pending, including automatic fallback logic and UI visibility.
    Translation cleanup:

  • Removed unused translation strings related to CIRA being disabled from all localization files, as the warning and inline notes are no longer shown in the UI.

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Anything the reviewer should know when reviewing this PR?

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Profile Detail UI to hide the CIRA connection mode when the server reports CIRA is disabled (enterprise mode), and adds/extends unit tests to validate the expected behavior.

Changes:

  • Wrap the CIRA connection-mode UI in a ciraEnabled() gate so the option is not rendered when disabled.
  • Simplify the CIRA config selector rendering (removing the previous “disabled but referenced” read-only/warning path).
  • Add unit tests covering enterprise CIRA disabled/enabled/error behavior and basic DOM visibility expectations.

Reviewed changes

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

File Description
src/app/profiles/profile-detail/profile-detail.component.html Conditionally renders the CIRA connection-mode UI based on ciraEnabled() and simplifies the CIRA config UI.
src/app/profiles/profile-detail/profile-detail.component.spec.ts Adds tests for enterprise CIRA feature gating and introduces a helper to recreate the component after toggling environment.cloud.

Comment thread src/app/profiles/profile-detail/profile-detail.component.html Outdated
Comment thread src/app/profiles/profile-detail/profile-detail.component.spec.ts Outdated
Comment thread src/app/profiles/profile-detail/profile-detail.component.spec.ts Outdated
Comment thread src/app/profiles/profile-detail/profile-detail.component.html Outdated
@nmgaston
nmgaston force-pushed the hideDisabledCIRA branch 2 times, most recently from ff9cead to 16a256b Compare July 16, 2026 19:10
@nmgaston
nmgaston requested a review from Copilot July 16, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/app/profiles/profile-detail/profile-detail.component.html

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Comment thread src/app/profiles/profile-detail/profile-detail.component.html

This comment was marked as low quality.

This comment was marked as low quality.

This comment was marked as low quality.

@nmgaston
nmgaston marked this pull request as ready for review July 17, 2026 03:52
@nmgaston
nmgaston requested a review from Copilot July 21, 2026 17:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/app/profiles/profile-detail/profile-detail.component.ts:294

  • In enterprise mode before getFeatures() resolves, setConnectionMode() can set connectionMode to CIRA (because !ciraAvailabilityResolved() is true) while the template hides the CIRA radio entirely (@if (ciraEnabled())). This can leave the radio-group with no visible selection and still allow a user to submit a CIRA-based profile before feature availability is known (a race where a CIRA-disabled server could receive a CIRA update if the user saves quickly).

Consider either (a) blocking submit / disabling the Save button while CIRA availability is unresolved and the form is in CIRA mode, or (b) rendering a disabled “CIRA (loading…)” option until availability resolves so the selection stays visible but not actionable until the server response arrives.

  setConnectionMode(data: Profile): void {
    const canUseCira = this.ciraEnabled() || !this.ciraAvailabilityResolved()

    if (data.tlsMode != null && data.tlsMode > 0) {
      this.profileForm.controls.connectionMode.setValue(this.connectionMode.tls)
    } else if (data.ciraConfigName != null && canUseCira) {
      this.profileForm.controls.connectionMode.setValue(this.connectionMode.cira)
    } else {
      this.profileForm.controls.connectionMode.setValue(this.connectionMode.direct)
    }

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.

2 participants