Merge pull request #185 from stephb9959/main

[WIFI-12603] Fallback if country code is contained in device type
This commit is contained in:
Charles Bourque
2023-05-15 19:27:27 +02:00
committed by GitHub
5 changed files with 17 additions and 4 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "ucentral-client", "name": "ucentral-client",
"version": "2.10.0(39)", "version": "2.10.0(40)",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ucentral-client", "name": "ucentral-client",
"version": "2.10.0(39)", "version": "2.10.0(40)",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@chakra-ui/icons": "^2.0.18", "@chakra-ui/icons": "^2.0.18",

View File

@@ -1,6 +1,6 @@
{ {
"name": "ucentral-client", "name": "ucentral-client",
"version": "2.10.0(39)", "version": "2.10.0(40)",
"description": "", "description": "",
"private": true, "private": true,
"main": "index.tsx", "main": "index.tsx",

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -61,6 +61,19 @@ const DeviceSummary = ({ serialNumber }: Props) => {
return '-'; return '-';
}; };
const getDeviceCompatible = () => {
if (!getDevice.data?.compatible) return undefined;
if (!getDevice.data?.compatible.includes('-')) return getDevice.data?.compatible;
const split = getDevice.data?.compatible.split('-');
if (split[split.length - 1]?.length === 2) return split[0]?.trim();
return getDevice.data?.compatible;
};
return ( return (
<Card mb={4}> <Card mb={4}>
<CardHeader <CardHeader
@@ -74,7 +87,7 @@ const DeviceSummary = ({ serialNumber }: Props) => {
<CardBody> <CardBody>
<Flex w="100%" alignItems="center"> <Flex w="100%" alignItems="center">
<Image <Image
src={`devices/${getDevice.data?.compatible}.png`} src={`devices/${getDeviceCompatible()}.png`}
alt={getDevice?.data?.compatible} alt={getDevice?.data?.compatible}
fallback={ fallback={
<Box minW="220px" w="220px" h="220px" mr={4} display="flex"> <Box minW="220px" w="220px" h="220px" mr={4} display="flex">