[WIFI-12585] Fix entity button on device page

Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
Charles
2023-05-10 10:18:55 +02:00
parent db5611233b
commit 37666c5075
3 changed files with 23 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(38)", "version": "2.10.0(39)",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ucentral-client", "name": "ucentral-client",
"version": "2.10.0(38)", "version": "2.10.0(39)",
"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(38)", "version": "2.10.0(39)",
"description": "", "description": "",
"private": true, "private": true,
"main": "index.tsx", "main": "index.tsx",

View File

@@ -14,6 +14,25 @@ import { CardBody } from 'components/Containers/Card/CardBody';
import { CardHeader } from 'components/Containers/Card/CardHeader'; import { CardHeader } from 'components/Containers/Card/CardHeader';
import { LoadingOverlay } from 'components/LoadingOverlay'; import { LoadingOverlay } from 'components/LoadingOverlay';
const interfaceNameLabel = (v?: string) => {
if (!v) return '';
if (v.startsWith('up')) {
const split = v.split('v');
const vlanId = split[split.length - 1];
return vlanId === '0' ? 'Upstream' : `Upstream - Vlan ${vlanId}`;
}
if (v.startsWith('down')) {
const split = v.split('v');
const vlanId = split[split.length - 1];
return vlanId === '0' ? 'Downstream' : `Downstream - Vlan ${vlanId}`;
}
return v;
};
type Props = { type Props = {
serialNumber: string; serialNumber: string;
}; };
@@ -61,7 +80,7 @@ const DeviceStatisticsCard = ({ serialNumber }: Props) => {
{parsedData?.interfaces {parsedData?.interfaces
? Object.keys(parsedData.interfaces).map((v) => ( ? Object.keys(parsedData.interfaces).map((v) => (
<option value={v} key={uuid()}> <option value={v} key={uuid()}>
{v} {interfaceNameLabel(v)}
</option> </option>
)) ))
: null} : null}