Skip to content

Commit 1f97fcf

Browse files
committed
styling and minimap
1 parent e84c37b commit 1f97fcf

6 files changed

Lines changed: 186 additions & 17 deletions

File tree

css/style.css

Lines changed: 121 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
body {
22
padding: 50px 0 0 0;
33
}
4+
.bodypadded {
5+
padding: 50px 120px 0 0;
6+
}
47
.ng-hide {
58
display: none;
69
visibility: hidden;
710
opacity: 0;
811
}
12+
913
.form-control {
1014
border-radius: 0;
1115
padding: 2px 6px;
@@ -162,8 +166,94 @@ textarea {
162166
position: fixed;
163167
}
164168
.right-margin {
165-
right: 24px;
169+
right: 140px;
170+
}
171+
.mock {
172+
white-space: nowrap;
173+
overflow: hidden;
174+
text-overflow: ellipsis;
175+
text-align: left;
176+
color: rgba(0, 0, 0, 0.65);
177+
margin: 3px;
178+
font-size: 80%;
179+
}
180+
.mock-machine {
181+
width: 100px;
182+
height: 30px;
183+
background-color: rgba(0, 0, 0, 0.01);
184+
color: rgba(0, 0, 0, 0.45);
185+
margin-bottom: 1px;
186+
margin-top: 0px;
187+
}
188+
.mock-machine-first {
189+
border-top: 3px solid #337ab7;
190+
margin-top: 3px;
191+
}
192+
.mock-main-menu {
193+
display: block;
194+
position: absolute;
195+
top: 0;
196+
z-index: 9999;
197+
width: 100%;
198+
height: 5px;
199+
background-color: #337ab7;
200+
border-bottom: 1px solid rgba(0, 0, 0, 0.01);
201+
margin: 0;
202+
}
203+
.mock-submenu {
204+
-webkit-box-shadow: 0 5px 0px 0px #5b8fbd;
205+
-moz-box-shadow: 0 5px 0px 0px #5b8fbd;
206+
-ms-box-shadow: 0 5px 0px 0px #5b8fbd;
207+
box-shadow: 0 5px 0px 0px #5b8fbd;
208+
}
209+
.mock-disclaimer {
210+
display: block;
211+
width: 100%;
212+
height: 25px;
213+
background-color: #000;
214+
margin: 0;
215+
margin-bottom: -5px;
166216
}
217+
.mock-labinfo {
218+
width: 20px;
219+
height: 30px;
220+
margin-top: 10px;
221+
background-color: rgba(0, 0, 0, 0.01);
222+
border-top: 3px solid #337ab7;
223+
}
224+
.mock-preview-text {
225+
font-size: 40%;
226+
}
227+
.mock-preview {
228+
display: block;
229+
width: 108px;
230+
height: 40px;
231+
border: 1px solid rgba(0, 0, 0, 0.2);
232+
}
233+
#minimap-body {
234+
transform-origin: center top;
235+
}
236+
#minimap {
237+
position: fixed;
238+
z-index: 9998;
239+
text-align: left;
240+
background-color: rgba(255, 255, 255, 1);
241+
right: 0;
242+
top: 0;
243+
width: 120px;
244+
height: 100%;
245+
padding: 0;
246+
border-left: 2px solid rgba(0, 0, 0, 0.2);
247+
border-right: 2px solid rgba(0, 0, 0, 0.2);
248+
font-size: 80%;
249+
}
250+
#minimap *::selection {
251+
background: rgba(0, 0, 0, 0) !important;
252+
}
253+
#minimap *::-moz-selection {
254+
background: rgba(0, 0, 0, 0) !important;
255+
}
256+
167257
/*Modal*/
168258
.modal-kathara {
169259
display: inherit!important;
@@ -181,7 +271,7 @@ textarea {
181271
/*Navbar*/
182272
.navbar-kathara {
183273
position: fixed;
184-
z-index: 9999;
274+
z-index: 9997;
185275
background-color: #337ab7;
186276
color: #fff;
187277
width: 100%;
@@ -191,7 +281,7 @@ textarea {
191281
box-shadow: 0 2px 2px 2px rgba(0, 0, 0, 0.35);
192282
}
193283
.navbar-kathara-primary {
194-
z-index: 9998;
284+
z-index: 9996;
195285
top: 0;
196286
}
197287
.navbar-kathara li a, .navbar-kathara li a:visited, .navbar-kathara li a:focus {
@@ -202,7 +292,7 @@ textarea {
202292
background-color: #5b8fbd;
203293
}
204294
.navbar-kathara-secondary {
205-
z-index: 9999;
295+
z-index: 9995;
206296
top: 51px;
207297
background-color: #5b8fbd;
208298
}
@@ -266,4 +356,30 @@ input[type=file] {
266356
#labInfo {
267357
/*float:left;*/
268358
width: 206px;
269-
}
359+
}
360+
361+
/* scrollbar */
362+
::-webkit-scrollbar {
363+
width: 12px;
364+
}
365+
366+
/* Track */
367+
::-webkit-scrollbar-track {
368+
background: rgb(102, 102, 102);
369+
border-radius: 0;
370+
border: 2px solid rgba(0, 0, 0, 0.15);
371+
}
372+
/* Handle */
373+
::-webkit-scrollbar-thumb {
374+
-webkit-border-radius: 0;
375+
border-radius: 0;
376+
background: #337ab7;
377+
border-radius: 0;
378+
border: 2px solid #2e6da4;
379+
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 1);
380+
}
381+
::-webkit-scrollbar-thumb:window-inactive {
382+
background: #5b8fbd;
383+
border-color: #337ab7;
384+
}
385+
/* end scrollbar*/

electronClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var tmp_folder = app.getPath('userData');
1919
// Listen for app to be ready
2020
app.on('ready', function(){
2121
// Create new window
22-
mainWindow = new BrowserWindow({width: 1366, height: 768});
22+
mainWindow = new BrowserWindow({width: 1366, height: 768, minWidth: 800, minHeight: 580});
2323
// Load html in window
2424
mainWindow.loadURL(url.format({
2525
pathname: path.join(__dirname, 'index.html'),

index.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
<link rel="shortcut icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABjUlEQVQ4ja2RsW7aQByHP87ns2Mj180YlQeIOrBU4nmKisQ7IPECDCwMTHkIxIY6MdKFocrGGzTCjm2dzz6lA9gNahQpaX/TXyd99/3vd/CP6ex2u6/H4/HuHayN4/hbZ7PZ6H6/71VV9SbadV32+/2TNMZ4VVUxHo//XG3tX0Ce59T1EwDX1x9YLpcYYzoSoCxLAKbTKdvtlsPh0IJJklAUBdY6APi+z+Nj2jKiGQDm8zmDwYCbm08kSUKSJKSpJssMAN1uhFJXuK6iEQuAuq6x1jIajVitVtzf/2Q4HHJ7+xmtNb7v0+1GCOGgVIDv+9R1DYB8/t7FYkEQBFhrmc1mWOtcgEI4CCGQUrVdSQCtNXmeE8cxRVGcWw4JwyuUCk4m6QLgeQFZ9oDW+nRelmVbSFmWGGPOZX28sHpe0G4qhEPDyedfZYzBWovrhigVIKV7Ab4U2awShiFpmp7tDvALKRVZ9tBam3jeadZaIxtoMpm8anopaZoioyj6sV6vv7yZBnq93vf3cP83vwGLvrOpZ8u5AwAAAABJRU5ErkJggg==" />
1515
<script src="js/page.js"></script>
1616
</head>
17-
<body id="logos" class="bg-logos">
17+
<body id="logos" class="bg-logos bodypadded">
18+
1819
<script>
1920
var isIE = navigator.userAgent.indexOf('MSIE')!==-1 || navigator.appVersion.indexOf('Trident/') > 0;
2021
if (isIE)
@@ -40,7 +41,7 @@ <h4><a href="https://github.com/Kidel/Netkit-Lab-Generator" target="_blank">http
4041
<br />
4142
<br />
4243
The <a href="https://github.com/Kidel/Netkit-Lab-Generator/graphs/contributors" target="_blank">authors</a>
43-
of this application do not take any responsibility for any malfunction. Remember to check the final configuration for exams and production.
44+
of this application do not take any responsibility for any malfunction. Remember to manually check the final configuration for exams and production.
4445
</div>
4546
</div>
4647

@@ -106,7 +107,7 @@ <h4><a href="https://github.com/Kidel/Netkit-Lab-Generator" target="_blank">http
106107
<th colspan="4">Additional functions</th>
107108
</tr>
108109

109-
<tr data-ng-repeat="x in netkit track by $index">
110+
<tr data-ng-repeat="x in netkit track by $index" id="{{x._uid}}">
110111
<td>
111112
<div><label>Machine {{x.row}}:</label>
112113
<input type="text" data-ng-model="x.name" class="form-control" placeholder="pc" required /></div>
@@ -286,7 +287,7 @@ <h4>Bash file preview:</h4>
286287
</div>
287288

288289
<!-- Side-menu -->
289-
<div id="col1" class="col-xs-2" align="right">
290+
<div id="col1" class="col-xs-1" align="right">
290291
<div class="fixed right-margin side-menu">
291292
<div align="right">
292293
<div class="btn btn-success" data-ng-click="addMachine()"><i class="fa fa-plus" aria-hidden="true"></i><strong>Add machine</strong></div>
@@ -297,6 +298,17 @@ <h4>Bash file preview:</h4>
297298
</div>
298299
</div>
299300

301+
<div id="minimap" class="col-xs-1">
302+
<div id="minimap-body" ng-style="{ 'transform': 'scale(1, ' + minimap_transform + ')' }">
303+
<span id="mock-main-menu" class="mock mock-main-menu"></span>
304+
<span class="mock mock-disclaimer" id="mock-disclaimer"></span>
305+
<div class="btn btn-default mock mock-labinfo" data-ng-click="scrollTo($event, 'labInfo')"></div>
306+
<div data-ng-repeat="x in netkit track by $index" class="btn btn-default mock mock-machine" ng:class="{true:'mock-machine-first', false:''}[$index==0]" data-ng-click="scrollTo($event, x._uid)">{{x.name}}</div>
307+
<div class="mock mock-preview-text">Bash file preview:</div>
308+
<span class="mock mock-preview"></span>
309+
</div>
310+
</div>
311+
300312
<!-- Sub-menu Run on Host -->
301313
<nav id="submenu-0" class="navbar navbar-primary navbar-kathara navbar-kathara-secondary ng-hide">
302314
<div class="container-fluid">
@@ -390,8 +402,6 @@ <h4 class="modal-title">Running Commands</h4>
390402
<script src="js/model.js"></script>
391403
<script src="js/controller.js"></script>
392404

393-
394-
395405
<script>
396406
window.onload= function() {
397407
console.log(" _______ __ __ .__ __ \n \\ \\ _____/ |_| | _|__|/ |_ \n / | \\_/ __ \\ __\\ |/ / \\ __\\ \n / | \\ ___/| | | <| || | \n \\____|__ /\\___ >__| |__|_ \\__||__| \n \\/ \\/ \\/ ");
@@ -442,6 +452,7 @@ <h4 class="modal-title">Running Commands</h4>
442452
titleLink.classList.remove("ng-hide");
443453
}
444454
}
455+
445456
</script>
446457

447458
</body>

js/controller.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,53 @@ app.config(['$compileProvider',
77
}
88
]);
99

10-
app.controller('nc', function($scope) {
10+
app.controller('nc', function($location, $anchorScroll, $scope) {
1111

1212
$scope.app = "include/app.html";
1313

14+
$scope.scrollTo = function(e, hash) {
15+
e.preventDefault();
16+
$location.hash(hash);
17+
$anchorScroll();
18+
};
19+
1420
$scope.labInfo = JSON.clone(labInfo);
15-
$scope.netkit = [JSON.clone(backbone)];
16-
$scope.counter = 1;
21+
$scope.netkit = [];
22+
$scope.counter = 0;
1723
$scope.labInfo.toggle = "enable";
1824

25+
$scope.minimap_transform = 1;
26+
27+
$scope.updateMimimapRatio = function(x) {
28+
var ratio = window.innerHeight / (x + document.getElementById('minimap-body').offsetHeight);
29+
if(ratio < 1) {
30+
$scope.minimap_transform = ratio;
31+
}
32+
else {
33+
$scope.minimap_transform = 1;
34+
}
35+
}
36+
1937
$scope.addMachine = function() {
2038
$scope.counter++;
2139
var p = JSON.clone(backbone);
2240
p.row=$scope.counter;
41+
p._uid=Math.floor((Math.random() * 1000000000000000) + 1);
2342
$scope.netkit.push(p);
2443

2544
changed = true;
45+
$scope.updateMimimapRatio(31);
2646
};
2747

48+
$scope.addMachine();
49+
2850
$scope.removeMachine = function() {
2951
if($scope.netkit.length>1 && confirm("Are you sure you want to remove the machine?")) {
3052
$scope.netkit.pop();
3153
$scope.counter--;
3254

3355
changed = true;
56+
$scope.updateMimimapRatio(-31);
3457
}
3558
};
3659

js/page.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,47 @@ function toggle_tab(event, elem) {
1919
var tab = document.getElementById(href);
2020
tab.className += " active";
2121
var col1 = document.getElementById("col1");
22+
var minimap = document.getElementById("minimap");
23+
var body = document.getElementById("logos");
2224
if(href == "home") {
2325
col1.classList.remove("ng-hide");
26+
minimap.classList.remove("ng-hide");
27+
body.classList.add("bodypadded");
2428
}
2529
else {
2630
col1.classList.add("ng-hide");
31+
minimap.classList.add("ng-hide");
32+
body.classList.remove("bodypadded");
2733
}
2834
}
2935

3036
function collapseDisclaimer(e) {
3137
e.preventDefault();
3238
var disclaimer = document.getElementById("disclaimer");
3339
disclaimer.classList.add("ng-hide");
40+
var mock_disclaimer = document.getElementById("mock-disclaimer");
41+
mock_disclaimer.classList.add("ng-hide");
3442
}
3543

3644
function toggle_submenu(e, number, total) {
45+
var toggled = false;
46+
var mock_main_menu = document.getElementById("mock-main-menu");
3747
for(var i=0; i<total; i++) {
3848
var current_submenu = document.getElementById("submenu-"+i);
3949
if(i==number) {
50+
toggled = true;
4051
current_submenu.classList.remove("ng-hide");
4152
}
4253
else {
4354
current_submenu.classList.add("ng-hide");
4455
}
4556
}
57+
if(toggled) {
58+
mock_main_menu.classList.add("mock-submenu");
59+
}
60+
else {
61+
mock_main_menu.classList.remove("mock-submenu");
62+
}
4663
}
4764

4865
function toggle_tab_and_submenu(event, elem, total_submenus) {
@@ -59,4 +76,4 @@ function close_modal(e){
5976
function show_modal(){
6077
var modal = document.getElementById("command-modal");
6178
modal.classList.remove("ng-hide");
62-
}
79+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
},
1212
"author": "Gaetano Bonofiglio",
1313
"license": "GPL-3.0",
14-
"dependencies": {},
14+
"dependencies": {
15+
"dom-minimap": "^1.7.2"
16+
},
1517
"devDependencies": {
1618
"electron": "^1.7.10"
1719
}

0 commit comments

Comments
 (0)