feat(devices): default useTLS and allowSelfSigned checkbox to true on Add Device - #3480
feat(devices): default useTLS and allowSelfSigned checkbox to true on Add Device#3480DevipriyaS17 wants to merge 3 commits into
Conversation
|
@DevipriyaS17 - it should go as feat not a bug fix. Also, set |
There was a problem hiding this comment.
Pull request overview
Updates the enterprise “Add Device” dialog so new devices default to using TLS (HTTPS/16993) by checking the Use TLS checkbox by default, aligning initial device-connection defaults with secure transport expectations in the enterprise flow.
Changes:
- Default
useTLSform control value changed fromfalse→trueinAddDeviceEnterpriseComponent. - Unit test fixtures updated to expect
useTLS: truein submitted device payloads.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/app/shared/add-device-enterprise/add-device-enterprise.component.ts | Changes the reactive form default so useTLS starts enabled for new devices. |
| src/app/shared/add-device-enterprise/add-device-enterprise.component.spec.ts | Updates test inputs/expectations to match the new useTLS default. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:120
- The non-CIRA TLS checkbox state is only preserved when transitioning from non-CIRA → CIRA (via
!wasCIRA). When a CIRA device is loaded initially (constructor setsuseCIRA = trueand callsonCIRAChange(true)), the currentuseTLS/allowSelfSignedvalues are overwritten tofalsewithout being captured, so toggling CIRA off later restores the hard-coded defaults instead of the device’s existing values.
// Preserve non-CIRA checkbox state before enforcing CIRA constraints.
if (!wasCIRA) {
this.lastNonCIRAUseTLS = this.form.get('useTLS')?.value ?? true
this.lastNonCIRAAllowSelfSigned = this.form.get('allowSelfSigned')?.value ?? true
}
src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:66
- This PR is described as defaulting only the “Use TLS” checkbox to checked, but it also changes
allowSelfSignedto defaulttrue. If that’s intentional, the PR title/description should call out the behavior change (it materially affects certificate validation); if it’s not intentional, keepallowSelfSigneddefaulting tofalse.
useTLS: [true],
allowSelfSigned: [true],
proxy.conf.json:5
proxy.conf.jsonis added but is not referenced anywhere in repo configuration (no matches inangular.json/package scripts), and it’s also not mentioned in the PR description. If this file is required for local development, wire it into the relevantng serveconfiguration/script and document it in the PR; otherwise it’s likely accidental and should be removed to avoid confusing contributors.
{
"/api": {
"target": "http://localhost:8181",
"secure": false,
"logLevel": "info"
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/app/shared/add-device-enterprise/add-device-enterprise.component.ts:141
onCIRAChange(false)always patchesuseTLS/allowSelfSignedfromlastNonCIRA*. Since the constructor callsonCIRAChange(this.useCIRA)afterform.patchValue(device), editing/loading a non-CIRA device will overwrite any persisted TLS settings (e.g., a device saved withuseTLS: falsewill be forced back totrue). Only restorelastNonCIRA*when actually transitioning from CIRA → non-CIRA (i.e., the controls were disabled).
this.form.patchValue({
useTLS: this.lastNonCIRAUseTLS,
allowSelfSigned: this.lastNonCIRAAllowSelfSigned,
mpsusername: 'admin',
mpspassword: ''
src/app/shared/add-device-enterprise/add-device-enterprise.component.spec.ts:179
- The new toggle-restoration test covers CIRA on/off, but there’s no regression test for loading/editing an existing non-CIRA device whose saved TLS values are
false. Given the constructor callsonCIRAChange(false)afterpatchValue(device), this is an important scenario to prevent accidentally flipping persisted settings during edit.
it('should restore prior non-CIRA TLS values after toggling CIRA off', () => {
component.form.patchValue({
useTLS: false,
allowSelfSigned: true
})
PR Checklist
What are you changing?
The "Use TLS" and allowSelfSigned checkbox in the Add Device dialog is now
checked by default, so new devices connect over HTTPS (port 16993)
unless the user explicitly unchecks it.
If the there are associated PRs in other repositories, please link them here
device-management-toolkit/console#1169