-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
245 lines (198 loc) · 9.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!DOCTYPE html>
<html>
<head>
<title>Network Flow Simulator</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="lib/css/vis.min.css" rel="stylesheet" type="text/css">
<link href="lib/css/vis-network.min.css" rel="stylesheet" type="text/css">
<link href="lib/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
<script src="lib/js/vis.min.js"></script>
<script src="lib/js/vis-network.min.js"></script>
<script src="lib/js/jquery.min.js"></script>
<script src="lib/js/jquery-ui.js"></script>
<script src="lib/js/popper.min.js"></script>
<script src="lib/js/bootstrap.min.js"></script>
<script src="lib/js/fontawesome.js"></script>
<script src="js/stored_graphs.js"></script>
<script src="js/network_graph.js"></script>
<script src="js/core.js"></script>
</head>
<body>
<div class="container-fluid" style="padding: 0px">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="#">Network Flow Simulator</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a href="https://github.com/Helias/Network-Flow-Simulator" class="navbar-brand">
<em class="fab fa-github"></em>
Source Code
</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<div class="container">
<div class="row">
<div class="col-9">
<div class="row">
<div class="col-9">
<small>Insert path:</small>
<br>
<input type="text" id="ap" placeholder="s,a,b,t">
</label>
<button OnClick="ng.applyPath(document.getElementById('ap').value)" class="btn btn-primary" id="apply_path">Apply Path</button>
<br>
<label>
<input type="checkbox" id="stepbystep" OnChange="$('#stepbystep_').prop('checked', this.checked)"> Step by step
</label>
<br>
Source:
<input type="text" value="s" id="source" style="width: 50px">
Destination:
<input type="text" value="t" id="dest" style="width: 50px">
<button class="btn btn-success" OnClick="ng.updateSourceDest()">Update</button>
<br>
<br>
<h2>Flow: <strong id="maxflow">0</strong></h2>
</div>
<div class="col-3">
<button class="btn btn-success" id="start" OnClick="start()">Start</button>
<button class="btn btn-info" id="back" OnClick="back()">Back</button>
<button class="btn btn-primary" id="next" OnClick="next()">Next</button>
<button class="btn btn-danger" id="finish" OnClick="finish()">Finish</button>
<br>
<br>
<h2 id="c_p"></h2>
<h2 class="text-danger" id="error"></h2>
</div>
</div>
<div id="network-popUp" class="network-popup">
<span id="operation">node</span> <br>
<table style="margin:auto;">
<tr>
<td>label</td>
<td><input id="node-label" value="z"></td>
</tr>
</table>
<br>
<input type="button" value="Save" id="saveButton" class="btn btn-primary">
<input type="button" value="Cancel" id="cancelButton" class="btn btn-danger">
</div>
<div id="network-popUp-edge" class="network-popup">
<span id="operation-edge">edge</span> <br>
<table style="margin:auto;">
<tr>
<td>capacity</td>
<td><input type="number" id="edge-capacity" value="10"></td>
</tr>
</table>
<br>
<input type="button" value="Save" id="saveButton-edge" class="btn btn-primary">
<input type="button" value="Cancel" id="cancelButton-edge" class="btn btn-danger">
</div>
<div id="network"></div>
</div>
<div class="col-3 text-center">
<div class="card border-primary mb-3">
<div class="card-header">
<strong class="text-primary">
Load/Save Graph
<em class="fa fa-toggle-on toggle-button" id="load-save-on" OnClick="toggleMenu('load-save', 'on')" style="display: none;"></em>
<em class="fa fa-toggle-off toggle-button" id="load-save-off" OnClick="toggleMenu('load-save', 'off')"></em>
</strong>
</div>
<div class="card-body" id="load-save" style="display: none">
<input type="file" id="load-file" OnChange="readTextFile(this)" style="display: none">
<small>Graph Name:</small>
<input type="text" value="myGraph" id="graph-name" class="form-control">
<br>
<button class="btn btn-sm btn-info" OnClick="ng.saveGraph()">Save Graph</button>
<button class="btn btn-sm btn-primary" OnClick="document.getElementById('load-file').click();">Load Graph</button>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="saveModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header bg-primary"></div>
<div class="modal-body">
<h2 class="text-primary">Graph loaded!</h2>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="card border-primary mb-3">
<div class="card-header">
<strong class="text-primary">
Settings
<em class="fa fa-toggle-on toggle-button" id="settings-on" OnClick="toggleMenu('settings', 'on')" style="display: none;"></em>
<em class="fa fa-toggle-off toggle-button" id="settings-off" OnClick="toggleMenu('settings', 'off')"></em>
</strong>
</div>
<div class="card-body" id="settings" style="display: none">
<select id="graphs" OnChange="ng.changeGraph(this.value)" class="form-control">
<option value="--">--</option>
<option value="0" selected="selected">Graph 1</option>
<option value="1">Graph 2</option>
<!-- <option value="2">Graph 3</option> -->
</select>
<br>
<button class="btn btn-sm btn-success" OnClick="ng.newGraph()"><em class="fa fa-plus"></em> New Graph</button>
<button class="btn btn-success btn-sm" OnClick="ng.togglePhysics()">
<em class="fa fa-check" id="p_on" style="font-size: 15px"></em>
<em class="fa fa-times" id="p_off" style="display: none; font-size: 15px"></em>
Physics
</button>
<p></p>
<button class="btn btn-sm btn-danger" OnClick="ng.resetGraph()"><em class="fa fa-sync"></em> Reset Graph</button>
</div>
</div>
<div class="card border-primary mb-3">
<div class="card-header">
<strong class="text-primary">
Paths
<em class="fa fa-toggle-on toggle-button" id="paths-on" OnClick="toggleMenu('paths', 'on')"></em>
<em class="fa fa-toggle-off toggle-button" id="paths-off" OnClick="toggleMenu('paths', 'off')" style="display: none;"></em>
</strong>
</div>
<div class="card-body" id="paths">
Order:
<br>
<button class="btn btn-sm btn-info" OnClick="ng.order = 'lexicographical'; ng.load_paths()">Lexicographical</button>
<button class="btn btn-sm btn-success" OnClick="ng.order = 'edmonds'; ng.load_paths()">Edmonds</button>
<br>
<br>
<label>
<input type="checkbox" id="stepbystep_" OnChange="$('#stepbystep').prop('checked', this.checked)"> Step by step
</label>
<p class="card-text" id="list-paths"></p>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<footer class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<strong class="text-secondary">Coded By <a href="https://github.com/Helias" class="text-secondary">Stefano Borzì</a></strong>
</div>
</footer>
</body>
</html>