mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 05:43:41 +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 {
|
private updateDeviceTable(devices: Array<DeviceView>): void {
|
||||||
this.dataSource.data = devices
|
this.dataSource.data = devices
|
||||||
.map((device: DeviceView): DeviceTableData | null => {
|
.map((device: DeviceView): DeviceTableData | null => {
|
||||||
if (!device.id || !device.type || !device.creationDate) {
|
if (device.id == undefined) {
|
||||||
this.validationService.showError(new Error("Invalid device data"));
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9412,6 +9412,15 @@
|
|||||||
"deviceManagementDesc": {
|
"deviceManagementDesc": {
|
||||||
"message": "Configure device management for Bitwarden using the implementation guide for your platform."
|
"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": {
|
"desktopRequired": {
|
||||||
"message": "Desktop required"
|
"message": "Desktop required"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user