Skip to content

Commit ceff1e9

Browse files
committed
[mikrotik-sdwan] fix route comments/labels
1 parent 539b190 commit ceff1e9

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/modules/mikrotik-sdwan/TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
- add panel status (default/success etc)
21
- need to think about resetting connection table
32
- do I want to show the hostname or ip address if the entry row is tall enough
43
- maybe a details page with a bugdetailspage showing the entry info

src/modules/mikrotik-sdwan/client/components/RouteList.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Button } from "@mui/material";
1+
import { Box, Button, Stack } from "@mui/material";
22

33
export default function RouteList({ panelId, routes }) {
44
if (routes?.status === "loading" || routes?.status !== "success") {
@@ -57,7 +57,10 @@ export default function RouteList({ panelId, routes }) {
5757
cursor: "default",
5858
}}
5959
>
60-
{route.comment}
60+
<Stack>
61+
<Box>{route.label}</Box>
62+
<Box sx={{ opacity: 0.5 }}>{route.dynamic ? "DYNAMIC" : "STATIC"}</Box>
63+
</Stack>
6164
</Button>
6265
);
6366
})}

src/modules/mikrotik-sdwan/container/services/route-list.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ module.exports = async () => {
1414

1515
return dbRoutes
1616
.map((route) => {
17-
const gatewayLabel = route?.['immediate-gw'].includes('%') ? route?.['immediate-gw'].split('%', 2).slice(1).join('%') : '';
17+
let label = route.comment;
18+
if (!label) {
19+
label = route?.['immediate-gw'].includes('%') ? route?.['immediate-gw'].split('%', 2).slice(1).join('%') : '';
20+
}
1821

1922
return {
2023
id: route.id,
2124
comment: route.comment,
22-
label: gatewayLabel,
25+
label: label,
2326
interface: route.interface,
2427
distance: route.distance,
2528
disabled: route.disabled,

0 commit comments

Comments
 (0)