Merge pull request #184 from stephb9959/main

[WIFI-12585] Fix entity button on device page
This commit is contained in:
Charles Bourque
2023-05-10 10:19:35 +02:00
committed by GitHub
3 changed files with 23 additions and 4 deletions

4
package-lock.json generated
View File

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

View File

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

View File

@@ -14,6 +14,25 @@ import { CardBody } from 'components/Containers/Card/CardBody';
import { CardHeader } from 'components/Containers/Card/CardHeader';
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 = {
serialNumber: string;
};
@@ -61,7 +80,7 @@ const DeviceStatisticsCard = ({ serialNumber }: Props) => {
{parsedData?.interfaces
? Object.keys(parsedData.interfaces).map((v) => (
<option value={v} key={uuid()}>
{v}
{interfaceNameLabel(v)}
</option>
))
: null}