Skip to content

Commit 05fbfeb

Browse files
authored
feat!: make router unable to send packets (#86)
New router details: ![image](https://github.com/user-attachments/assets/b712bec5-c683-429d-a534-548a60711457)
1 parent 55c04fd commit 05fbfeb

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/graphics/renderables/device_info.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class DeviceInfo extends StyledInfo {
2222
this.device = device;
2323
this.addCommonInfoFields();
2424
this.addCommonButtons();
25-
this.addSendPacketButton();
2625
}
2726

2827
private addCommonInfoFields() {
@@ -62,7 +61,7 @@ export class DeviceInfo extends StyledInfo {
6261
);
6362
}
6463

65-
private addSendPacketButton() {
64+
addSendPacketButton() {
6665
const { id, viewgraph } = this.device;
6766

6867
const adjacentDevices = viewgraph
@@ -106,6 +105,10 @@ export class DeviceInfo extends StyledInfo {
106105
this.inputFields.push(dynamicTable);
107106
}
108107

108+
addEmptySpace() {
109+
this.inputFields.push(document.createElement("br"));
110+
}
111+
109112
toHTML(): Node[] {
110113
return super.toHTML().concat(this.inputFields);
111114
}

src/types/devices/host.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class Host extends Device {
1919
showInfo(): void {
2020
const info = new DeviceInfo(this);
2121
info.addField("IP Address", this.ip.octets.join("."));
22+
info.addSendPacketButton();
2223
RightBar.getInstance().renderInfo(info);
2324
}
2425

src/types/devices/router.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class Router extends Device {
1919
showInfo(): void {
2020
const info = new DeviceInfo(this);
2121
info.addField("IP Address", this.ip.octets.join("."));
22+
info.addEmptySpace();
2223
info.addRoutingTable(this.viewgraph.getRoutingTable(this.id));
2324
RightBar.getInstance().renderInfo(info);
2425
}

0 commit comments

Comments
 (0)