Skip to content

Commit 1564f85

Browse files
committed
Topology, sidebar
1 parent 9568da6 commit 1564f85

File tree

2 files changed

+49
-13
lines changed

2 files changed

+49
-13
lines changed

Protest/Front/topology.css

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
.topology-workspace {
2+
position: absolute;
3+
width: calc(100% - 316px);
4+
height: 100%;
5+
background-color: var(--clr-bg);
6+
overflow: auto;
7+
}
8+
9+
.topology-sidebar {
10+
position: absolute;
11+
right: 8px;
12+
width: 300px;
13+
top: 8px;
14+
bottom: 8px;
15+
background-color: var(--clr-pane);
16+
border-radius: 4px;
17+
overflow-y: auto;
18+
}
19+
120
.topology-device {
221
position: absolute;
322
border-radius: 4px;
423
color: var(--clr-light);
524
max-width: 72px;
625
}
726

8-
.topology-selected {
9-
background-color: color-mix(in srgb, var(--clr-select) 50%, transparent 50%);
10-
outline: 2px solid var(--clr-select);
11-
z-index: 1;
12-
}
13-
1427
.topology-device-icon {
1528
width: 72px;
1629
height: 64px;
@@ -28,3 +41,15 @@
2841
text-overflow: ellipsis;
2942
direction: rtl;
3043
}
44+
45+
.topology-selected {
46+
background-color: color-mix(in srgb, var(--clr-select) 50%, transparent 50%);
47+
outline: 2px solid var(--clr-select);
48+
z-index: 1;
49+
}
50+
51+
.topology-pending {
52+
background-size: 3px 3px;
53+
background-image: radial-gradient(circle, transparent 1px, #c0c0c0 1px);
54+
background-color: transparent;
55+
}

Protest/Front/topology.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@ class Topology extends Window{
1919

2020
this.SetupToolbar();
2121

22-
this.content.style.overflow = "auto";
23-
2422
this.startButton = this.AddToolbarButton("Start discovery", "mono/play.svg?light");
2523
this.stopButton = this.AddToolbarButton("Stop", "mono/stop.svg?light");
24+
this.stopButton.disabled = true;
2625
this.AddToolbarSeparator();
2726

27+
this.workspace = document.createElement("div");
28+
this.workspace.className = "topology-workspace";
29+
this.content.appendChild(this.workspace);
30+
31+
this.sideBar = document.createElement("div");
32+
this.sideBar.className = "topology-sidebar";
33+
this.content.appendChild(this.sideBar);
34+
35+
this.content.style.overflow = "auto";
36+
this.content.style.overflow = "auto";
37+
2838
this.content.onmousedown = ()=> {
2939
if (this.selected) {
3040
this.selected.classList.remove("topology-selected");
@@ -72,8 +82,8 @@ class Topology extends Window{
7282
this.CreateDevice({
7383
file: device,
7484
name: ip,
75-
left: 16 + (count % 10) * 96,
76-
top: 16 + Math.floor(count / 10) * 96
85+
left: 16 + (count % 10) * 112,
86+
top: 16 + Math.floor(count / 10) * 112
7787
});
7888

7989
count++;
@@ -86,10 +96,10 @@ class Topology extends Window{
8696
device.style.left = options.left + "px";
8797
device.style.top = options.top + "px";
8898
device.setAttribute("file", options.file);
89-
this.content.appendChild(device);
99+
this.workspace.appendChild(device);
90100

91101
const icon = document.createElement("div");
92-
icon.className = "topology-device-icon";
102+
icon.className = "topology-device-icon topology-pending";
93103
icon.style.maskImage = "url(mono/switch.svg?light)";
94104
device.appendChild(icon);
95105

@@ -256,7 +266,8 @@ class Topology extends Window{
256266
}
257267

258268
Stop() {
259-
269+
this.startButton.disabled = false;
270+
this.stopButton.disabled = true;
260271
}
261272

262273
}

0 commit comments

Comments
 (0)