mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
fix(devices): [PM-18757] resolve invalid device data error for Android devices
The device management screen was incorrectly evaluating the truthiness of DeviceView.type enum, causing "Invalid device data" errors when an Android device (type = 0) was present. Changed the check to explicitly verify for undefined values instead of truthy checks. - Updated type checking to use explicit undefined checks - Added translations for error messages - Improved error handling with specific messages for missing data Fixes PM-18757
This commit is contained in:
@@ -180,8 +180,20 @@ export class DeviceManagementComponent {
|
||||
private updateDeviceTable(devices: Array<DeviceView>): void {
|
||||
this.dataSource.data = devices
|
||||
.map((device: DeviceView): DeviceTableData | null => {
|
||||
if (!device.id || !device.type || !device.creationDate) {
|
||||
this.validationService.showError(new Error("Invalid device data"));
|
||||
if (device.id == undefined) {
|
||||
this.validationService.showError(new Error(this.i18nService.t("deviceIdMissing")));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (device.type == undefined) {
|
||||
this.validationService.showError(new Error(this.i18nService.t("deviceTypeMissing")));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (device.creationDate == undefined) {
|
||||
this.validationService.showError(
|
||||
new Error(this.i18nService.t("deviceCreationDateMissing")),
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -9412,6 +9412,15 @@
|
||||
"deviceManagementDesc": {
|
||||
"message": "Configure device management for Bitwarden using the implementation guide for your platform."
|
||||
},
|
||||
"deviceIdMissing": {
|
||||
"message": "Device ID is missing"
|
||||
},
|
||||
"deviceTypeMissing": {
|
||||
"message": "Device type is missing"
|
||||
},
|
||||
"deviceCreationDateMissing": {
|
||||
"message": "Device creation date is missing"
|
||||
},
|
||||
"desktopRequired": {
|
||||
"message": "Desktop required"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user