Skip to content

Commit 9b6efa3

Browse files
committed
style: UI changes from review
1 parent 0f5100d commit 9b6efa3

16 files changed

Lines changed: 102 additions & 131 deletions

src/app/devices/devices.service.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,6 @@ export class DevicesService {
526526
)
527527
}
528528

529-
markRpeDisabledAfterErase(deviceId: string): void {
530-
this.rpeDisabledAfterErase.add(deviceId)
531-
this.updateAmtFeaturesCache(deviceId, { rpe: false })
532-
}
533-
534529
private applyRpeOverride(deviceId: string, features: AMTFeaturesResponse): AMTFeaturesResponse {
535530
if (!this.rpeDisabledAfterErase.has(deviceId)) {
536531
return features

src/app/devices/remote-platform-erase/remote-platform-erase.component.html

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
<div style="padding: 8px 0">
2929
<mat-slide-toggle
30+
color="primary"
3031
data-cy="remoteEraseCheckbox"
3132
[checked]="platformEraseEnabled()"
3233
[disabled]="isLoading()"
@@ -50,48 +51,51 @@ <h3>
5051
<p>{{ 'remotePlatformErase.caps.description.value' | translate }}</p>
5152

5253
@for (cap of eraseCaps(); track cap.key; let i = $index) {
53-
<div data-cy="eraseCapItem" style="padding: 4px 0">
54-
<mat-checkbox
55-
[formControl]="eraseCapControl(i)"
56-
(change)="onCapChange()"
57-
[attr.aria-describedby]="'rpe-cap-desc-' + cap.key"
58-
data-cy="eraseCapCheckbox">
59-
<div>
60-
<div>{{ 'remotePlatformErase.cap.' + cap.key + '.label.value' | translate }}</div>
61-
<small [id]="'rpe-cap-desc-' + cap.key">
62-
{{ 'remotePlatformErase.cap.' + cap.key + '.desc.value' | translate }}
63-
</small>
64-
@if (!cap.supported) {
65-
<div>
66-
<small
67-
><em>{{ 'remotePlatformErase.capUnsupported.value' | translate }}</em></small
68-
>
69-
</div>
70-
}
71-
</div>
72-
</mat-checkbox>
73-
@if (cap.key === 'secureEraseSsds' && isSsdSelected()) {
74-
<div style="padding-left: 40px; padding-top: 8px">
75-
<mat-checkbox
76-
[formControl]="ssdEncryptedControl"
77-
(change)="onSsdEncryptedChange($event.checked)"
78-
data-cy="ssdEncryptedCheckbox">
79-
{{ 'remotePlatformErase.ssdEncrypted.label.value' | translate }}
80-
</mat-checkbox>
81-
@if (isSsdEncrypted()) {
82-
<mat-form-field style="display: block; padding-top: 8px">
83-
<mat-label>{{ 'remotePlatformErase.ssdPassword.label.value' | translate }}</mat-label>
84-
<input
85-
matInput
86-
type="password"
87-
[formControl]="ssdPasswordControl"
88-
data-cy="ssdPasswordInput"
89-
autocomplete="off" />
90-
</mat-form-field>
91-
}
92-
</div>
93-
}
94-
</div>
54+
<!-- Hide the CSME unconfigure option for now until we have a better way to control the power of this option. -->
55+
@if (cap.key !== 'csmeUnconfigure') {
56+
<div data-cy="eraseCapItem" style="padding: 4px 0">
57+
<mat-checkbox
58+
[formControl]="eraseCapControl(i)"
59+
(change)="onCapChange()"
60+
[attr.aria-describedby]="'rpe-cap-desc-' + cap.key"
61+
data-cy="eraseCapCheckbox">
62+
<div>
63+
<div>{{ 'remotePlatformErase.cap.' + cap.key + '.label.value' | translate }}</div>
64+
<small [id]="'rpe-cap-desc-' + cap.key">
65+
{{ 'remotePlatformErase.cap.' + cap.key + '.desc.value' | translate }}
66+
</small>
67+
@if (!cap.supported) {
68+
<div>
69+
<small
70+
><em>{{ 'remotePlatformErase.capUnsupported.value' | translate }}</em></small
71+
>
72+
</div>
73+
}
74+
</div>
75+
</mat-checkbox>
76+
@if (cap.key === 'secureEraseSsds' && isSsdSelected()) {
77+
<div style="padding-left: 40px; padding-top: 8px">
78+
<mat-checkbox
79+
[formControl]="ssdEncryptedControl"
80+
(change)="onSsdEncryptedChange($event.checked)"
81+
data-cy="ssdEncryptedCheckbox">
82+
{{ 'remotePlatformErase.ssdEncrypted.label.value' | translate }}
83+
</mat-checkbox>
84+
@if (isSsdEncrypted()) {
85+
<mat-form-field style="display: block; padding-top: 8px">
86+
<mat-label>{{ 'remotePlatformErase.ssdPassword.label.value' | translate }}</mat-label>
87+
<input
88+
matInput
89+
type="password"
90+
[formControl]="ssdPasswordControl"
91+
data-cy="ssdPasswordInput"
92+
autocomplete="off" />
93+
</mat-form-field>
94+
}
95+
</div>
96+
}
97+
</div>
98+
}
9599
}
96100

97101
@if (isCsmeExclusiveSelected()) {

src/app/devices/remote-platform-erase/remote-platform-erase.component.spec.ts

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { HttpErrorResponse } from '@angular/common/http'
1717
import { Router } from '@angular/router'
1818
import { UserConsentService } from '../user-consent.service'
1919

20+
const VISIBLE_PLATFORM_ERASE_CAPABILITIES = PLATFORM_ERASE_CAPABILITIES.filter((cap) => cap.key !== 'csmeUnconfigure')
21+
2022
const mockAMTFeatures: AMTFeaturesResponse = {
2123
userConsent: 'none',
2224
KVM: true,
@@ -404,7 +406,7 @@ describe('RemotePlatformEraseComponent', () => {
404406
component.toggleFeature(true)
405407
fixture.detectChanges()
406408
const capItems = fixture.nativeElement.querySelectorAll('[data-cy="eraseCapItem"]')
407-
expect(capItems.length).toBe(PLATFORM_ERASE_CAPABILITIES.length)
409+
expect(capItems.length).toBe(VISIBLE_PLATFORM_ERASE_CAPABILITIES.length)
408410
})
409411

410412
it('should show a checkbox for each capability, disabled for unsupported ones', () => {
@@ -413,7 +415,7 @@ describe('RemotePlatformEraseComponent', () => {
413415
component.toggleFeature(true)
414416
fixture.detectChanges()
415417
const checkboxes = fixture.nativeElement.querySelectorAll('[data-cy="eraseCapCheckbox"]')
416-
expect(checkboxes.length).toBe(PLATFORM_ERASE_CAPABILITIES.length)
418+
expect(checkboxes.length).toBe(VISIBLE_PLATFORM_ERASE_CAPABILITIES.length)
417419
// tpmClear (index 1) and csmeUnconfigure (index 3) not supported — always disabled
418420
expect(component.eraseCapControl(1).disabled).toBeTrue()
419421
expect(component.eraseCapControl(3).disabled).toBeTrue()
@@ -518,43 +520,6 @@ describe('RemotePlatformEraseComponent', () => {
518520
})
519521
})
520522

521-
describe('after successful erase', () => {
522-
beforeEach(() => {
523-
devicesServiceSpy.getAMTFeatures.and.returnValue(of({ ...mockAMTFeatures, rpe: true }))
524-
component.ngOnInit()
525-
component.toggleFeature(true)
526-
component.eraseCapControl(0).setValue(true)
527-
component.onCapChange()
528-
matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) } as any)
529-
})
530-
531-
it('should reset platformEraseEnabled to false', () => {
532-
component.initiateErase()
533-
expect(component.platformEraseEnabled()).toBeFalse()
534-
})
535-
536-
it('should reset amtFeatures.rpe to false', () => {
537-
component.initiateErase()
538-
expect(component.amtFeatures()?.rpe).toBeFalse()
539-
})
540-
541-
it('should reset selectedCapsCount to 0', () => {
542-
component.initiateErase()
543-
expect(component.selectedCapsCount()).toBe(0)
544-
})
545-
546-
it('should uncheck all cap form controls', () => {
547-
component.initiateErase()
548-
expect(component.eraseCapControl(0).value).toBeFalse()
549-
})
550-
551-
it('should disable capability checkboxes after successful erase', () => {
552-
component.initiateErase()
553-
expect(component.eraseCapControl(0).disabled).toBeTrue()
554-
expect(component.eraseCapControl(2).disabled).toBeTrue()
555-
})
556-
})
557-
558523
describe('CSME exclusivity', () => {
559524
beforeEach(() => {
560525
devicesServiceSpy.getAMTFeatures.and.returnValue(
@@ -709,18 +674,6 @@ describe('RemotePlatformEraseComponent', () => {
709674
expect(component.ssdPasswordControl.value).toBe('')
710675
})
711676

712-
it('should reset SSD controls after successful erase', () => {
713-
component.eraseCapControl(0).setValue(true)
714-
component.onCapChange()
715-
component.onSsdEncryptedChange(true)
716-
component.ssdPasswordControl.setValue('secret')
717-
matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) } as any)
718-
component.initiateErase()
719-
expect(component.isSsdSelected()).toBeFalse()
720-
expect(component.isSsdEncrypted()).toBeFalse()
721-
expect(component.ssdPasswordControl.value).toBe('')
722-
})
723-
724677
it('should reset SSD controls when CSME is selected', () => {
725678
devicesServiceSpy.getRemoteEraseCapabilities.and.returnValue(
726679
of({ secureEraseAllSSDs: true, tpmClear: false, restoreBIOSToEOM: true, unconfigureCSME: true })

src/app/devices/remote-platform-erase/remote-platform-erase.component.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export class RemotePlatformEraseComponent implements OnInit {
252252
)
253253
.subscribe()
254254
}
255+
255256
postUserConsentDecision(result: any, operations: string): Observable<any> {
256257
if (result === false) {
257258
return of(null)
@@ -344,21 +345,15 @@ export class RemotePlatformEraseComponent implements OnInit {
344345
enableSOL: this.amtFeatures()?.SOL ?? false,
345346
enableIDER: this.amtFeatures()?.IDER ?? false,
346347
ocr: this.amtFeatures()?.ocr ?? false,
347-
rpe: false
348+
rpe: true
348349
}
349-
this.devicesService.markRpeDisabledAfterErase(this.deviceId())
350350
this.devicesService
351351
.setAmtFeatures(this.deviceId(), payload)
352352
.pipe(catchError(() => EMPTY))
353353
.subscribe()
354-
this.amtFeatures.update((f) => (f ? { ...f, rpe: false } : f))
355-
this.platformEraseEnabled.set(false)
356354

357-
this.eraseCapsArray.controls.forEach((c) => c.setValue(false, { emitEvent: false }))
358-
this.selectedCapsCount.set(0)
359-
this.isCsmeExclusiveSelected.set(false)
360-
this.resetSsdControls()
361-
this.updateCapControlStates()
355+
// Preserve selected operations after completion and refresh computed UI state.
356+
this.onCapChange()
362357
}
363358
}
364359
})

src/assets/i18n/ar.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,8 @@
28512851
},
28522852
"remotePlatformErase.description": {
28532853
"description": "عنوان فرعي لبطاقة ميزة مسح المنصة عن بُعد",
2854-
"value": "تشغيل محو آمن عن بُعد للأقراص و TPM و BIOS أو Intel CSME على هذا الجهاز. لا يمكن استرداد البيانات الممحوة."
2854+
"value": "تشغيل محو آمن عن بُعد للأقراص و TPM و BIOS على هذا الجهاز. لا يمكن استرداد البيانات الممحوة.",
2855+
"_value_old": "تشغيل محو آمن عن بُعد للأقراص و TPM و BIOS أو Intel CSME على هذا الجهاز. لا يمكن استرداد البيانات الممحوة."
28552856
},
28562857
"remotePlatformErase.warning": {
28572858
"description": "رسالة تحذير حول تمكين مسح المنصة عن بُعد",
@@ -2983,7 +2984,8 @@
29832984
},
29842985
"remotePlatformErase.selectionCount": {
29852986
"description": "تسمية توضح عدد عمليات المحو المحددة حاليًا",
2986-
"value": "تم تحديد {{selected}} من أصل {{total}} عمليات"
2987+
"value": "تم تحديد {{selected}} من أصل 3 عمليات",
2988+
"_value_old": "تم تحديد {{selected}} من أصل {{total}} عمليات"
29872989
},
29882990
"remotePlatformErase.capUnsupported": {
29892991
"description": "تسمية تظهر في صف القدرة عندما لا يدعمها الجهاز",

src/assets/i18n/de.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,8 @@
28512851
},
28522852
"remotePlatformErase.description": {
28532853
"description": "Untertitel der Funktionskarte für Remote-Plattformlöschung",
2854-
"value": "Löst aus der Ferne ein sicheres Löschen von Laufwerken, TPM, BIOS oder Intel CSME auf diesem Gerät aus. Gelöschte Daten können nicht wiederhergestellt werden."
2854+
"value": "Löst aus der Ferne ein sicheres Löschen von Laufwerken, TPM und BIOS auf diesem Gerät aus. Gelöschte Daten können nicht wiederhergestellt werden.",
2855+
"_value_old": "Löst aus der Ferne ein sicheres Löschen von Laufwerken, TPM, BIOS oder Intel CSME auf diesem Gerät aus. Gelöschte Daten können nicht wiederhergestellt werden."
28552856
},
28562857
"remotePlatformErase.warning": {
28572858
"description": "Warnmeldung zur Aktivierung der Remote-Plattformlöschung",
@@ -2983,7 +2984,8 @@
29832984
},
29842985
"remotePlatformErase.selectionCount": {
29852986
"description": "Beschriftung, die anzeigt, wie viele Löschvorgänge derzeit ausgewählt sind",
2986-
"value": "{{selected}} von {{total}} Vorgängen ausgewählt"
2987+
"value": "{{selected}} von 3 Vorgängen ausgewählt",
2988+
"_value_old": "{{selected}} von {{total}} Vorgängen ausgewählt"
29872989
},
29882990
"remotePlatformErase.capUnsupported": {
29892991
"description": "Beschriftung in einer Fähigkeitszeile, wenn das Gerät diese nicht unterstützt",

src/assets/i18n/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,8 @@
10631063
},
10641064
"remotePlatformErase.description": {
10651065
"description": "Subtitle for the Remote Platform Erase feature card",
1066-
"value": "Remotely trigger a secure erase of drives, TPM, BIOS, or Intel CSME on this device. Erased data cannot be recovered."
1066+
"value": "Remotely trigger a secure erase of drives, TPM, or BIOS on this device. Erased data cannot be recovered.",
1067+
"_value_old": "Remotely trigger a secure erase of drives, TPM, BIOS, or Intel CSME on this device. Erased data cannot be recovered."
10671068
},
10681069
"remotePlatformErase.warning": {
10691070
"description": "Warning message about enabling Remote Platform Erase",
@@ -1079,7 +1080,8 @@
10791080
},
10801081
"remotePlatformErase.selectionCount": {
10811082
"description": "Caption showing how many erase capabilities are currently selected",
1082-
"value": "{{selected}} of {{total}} operations selected"
1083+
"value": "{{selected}} of 3 operations selected",
1084+
"_value_old": "{{selected}} of {{total}} operations selected"
10831085
},
10841086
"remotePlatformErase.capUnsupported": {
10851087
"description": "Caption shown on a capability row when the device does not support it",

src/assets/i18n/es.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,8 @@
28512851
},
28522852
"remotePlatformErase.description": {
28532853
"description": "Subtítulo para la tarjeta de función de borrado remoto de plataforma",
2854-
"value": "Activa de forma remota un borrado seguro de unidades, TPM, BIOS o Intel CSME en este dispositivo. Los datos borrados no se pueden recuperar."
2854+
"value": "Activa de forma remota un borrado seguro de unidades, TPM y BIOS en este dispositivo. Los datos borrados no se pueden recuperar.",
2855+
"_value_old": "Activa de forma remota un borrado seguro de unidades, TPM, BIOS o Intel CSME en este dispositivo. Los datos borrados no se pueden recuperar."
28552856
},
28562857
"remotePlatformErase.warning": {
28572858
"description": "Mensaje de advertencia sobre la habilitación del borrado remoto de plataforma",
@@ -2983,7 +2984,8 @@
29832984
},
29842985
"remotePlatformErase.selectionCount": {
29852986
"description": "Indicador que muestra cuántas operaciones de borrado están seleccionadas actualmente",
2986-
"value": "{{selected}} de {{total}} operaciones seleccionadas"
2987+
"value": "{{selected}} de 3 operaciones seleccionadas",
2988+
"_value_old": "{{selected}} de {{total}} operaciones seleccionadas"
29872989
},
29882990
"remotePlatformErase.capUnsupported": {
29892991
"description": "Indicador mostrado en una fila de capacidad cuando el dispositivo no la admite",

src/assets/i18n/fi.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,8 @@
28512851
},
28522852
"remotePlatformErase.description": {
28532853
"description": "Etäalustan pyyhintäominaisuuden kortin alaotsikko",
2854-
"value": "Käynnistää etänä suojatun poiston tämän laitteen asemille, TPM:lle, BIOSille tai Intel CSME:lle. Poistettuja tietoja ei voi palauttaa."
2854+
"value": "Käynnistää etänä suojatun poiston tämän laitteen asemille, TPM:lle ja BIOSille. Poistettuja tietoja ei voi palauttaa.",
2855+
"_value_old": "Käynnistää etänä suojatun poiston tämän laitteen asemille, TPM:lle, BIOSille tai Intel CSME:lle. Poistettuja tietoja ei voi palauttaa."
28552856
},
28562857
"remotePlatformErase.warning": {
28572858
"description": "Varoitusviesti etäalustan pyyhinnän käyttöönotosta",
@@ -2983,7 +2984,8 @@
29832984
},
29842985
"remotePlatformErase.selectionCount": {
29852986
"description": "Teksti, joka näyttää kuinka monta pyyhintätoimintoa on valittu",
2986-
"value": "{{selected}} / {{total}} toimintoa valittu"
2987+
"value": "{{selected}} / 3 toimintoa valittu",
2988+
"_value_old": "{{selected}} / {{total}} toimintoa valittu"
29872989
},
29882990
"remotePlatformErase.capUnsupported": {
29892991
"description": "Teksti, joka näytetään ominaisuusrivillä, kun laite ei tue sitä",

src/assets/i18n/fr.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,8 @@
28512851
},
28522852
"remotePlatformErase.description": {
28532853
"description": "Sous-titre de la carte de fonctionnalité d'effacement distant de la plateforme",
2854-
"value": "Déclenche à distance un effacement sécurisé des disques, TPM, BIOS ou Intel CSME sur cet appareil. Les données effacées ne peuvent pas être récupérées."
2854+
"value": "Déclenche à distance un effacement sécurisé des disques, TPM et BIOS sur cet appareil. Les données effacées ne peuvent pas être récupérées.",
2855+
"_value_old": "Déclenche à distance un effacement sécurisé des disques, TPM, BIOS ou Intel CSME sur cet appareil. Les données effacées ne peuvent pas être récupérées."
28552856
},
28562857
"remotePlatformErase.warning": {
28572858
"description": "Message d'avertissement concernant l'activation de l'effacement distant de la plateforme",
@@ -2983,7 +2984,8 @@
29832984
},
29842985
"remotePlatformErase.selectionCount": {
29852986
"description": "Légende indiquant combien d'opérations d'effacement sont actuellement sélectionnées",
2986-
"value": "{{selected}} opération(s) sélectionnée(s) sur {{total}}"
2987+
"value": "{{selected}} opération(s) sélectionnée(s) sur 3",
2988+
"_value_old": "{{selected}} opération(s) sélectionnée(s) sur {{total}}"
29872989
},
29882990
"remotePlatformErase.capUnsupported": {
29892991
"description": "Légende affichée sur une ligne de capacité lorsque l'appareil ne la prend pas en charge",

0 commit comments

Comments
 (0)