Revision f533f224 ui/templates/networks.html
b/ui/templates/networks.html | ||
---|---|---|
1 | 1 |
{% load i18n %} |
2 | 2 |
|
3 |
<div id="networks" class="separator"></div> |
|
3 |
<!-- the create button --> |
|
4 |
<div id="networks-createcontainer"> |
|
5 |
<div id="beforecreate"></div> |
|
6 |
<a id="networkscreate" rel="#networks-wizard" href="#">{% trans "Create New +" %}</a> |
|
7 |
</div> |
|
4 | 8 |
|
5 |
<div id="networks-container"> |
|
6 |
<!-- the create button --> |
|
7 |
<div id="networks-createcontainer"> |
|
8 |
<a id="networkscreate" rel="#networkswizard" href="#">{% trans "Create New +" %}</a> |
|
9 |
<!-- add new network overlay --> |
|
10 |
<div> |
|
11 |
<div class="modal" id="networks-wizard"> |
|
12 |
<div class="header"> |
|
13 |
</div> |
|
14 |
<h2>{% trans "Name your network" %}</h2> |
|
15 |
<hr class="topruler" /> |
|
16 |
<div class="container"> |
|
17 |
<div class="name-input"> |
|
18 |
<label>{% trans "Name" %}:</label> |
|
19 |
<input type="text" class="text" name="machine_name"></input> |
|
20 |
<span class="help">{% trans "(* Required field)" %}</span> |
|
21 |
</div> |
|
22 |
</div> |
|
23 |
<hr class="bottomruler" /> |
|
24 |
<button type="button" id="add-network-cancel" class="cancel">{% trans "Cancel" %}</button> |
|
25 |
<button type="button" id="add-network-create" class="create">{% trans "Create Network" %}</button> |
|
26 |
<hr class="separator-end"></hr> |
|
9 | 27 |
</div> |
10 |
<div class="network" id="internet-template"> |
|
28 |
</div> |
|
29 |
|
|
30 |
<!-- networks list --> |
|
31 |
<div id="networks-container"> |
|
32 |
<!-- spinner while loading list --> |
|
33 |
<div class = "large-spinner"></div> |
|
34 |
|
|
35 |
<!-- public network template --> |
|
36 |
<div class="network" id="public-template"> |
|
11 | 37 |
<div class="actions"> |
12 |
<a href="#" class="action-network-add">{% trans "Add Machine" %}</a> |
|
13 |
</div> |
|
38 |
{# Commented out the following until there is full public network support #} |
|
39 |
{# <a href="#" class="action-add">{% trans "Add Machine" %}</a> #} |
|
40 |
</div> |
|
41 |
<div class="confirm_single"> |
|
42 |
<button class="yes">{% trans "Confirm" %}</button> |
|
43 |
<button class="no">{% trans "Cancel" %}</button> |
|
44 |
</div> |
|
45 |
<div class="action_error" align="center"> |
|
46 |
{% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span> |
|
47 |
<span class="code"></span> |
|
48 |
<span class="message"></span> |
|
49 |
<button class="details">{% trans "Details" %}</button> |
|
50 |
</div> |
|
14 | 51 |
<div class="state"> |
15 | 52 |
<div class="status">{% trans "Public Network" %}</div> |
16 | 53 |
<div class="indicator"></div> |
17 | 54 |
<div class="indicator"></div> |
18 | 55 |
<div class="indicator"></div> |
19 | 56 |
<div class="indicator"></div> |
20 |
</div>
|
|
57 |
</div> |
|
21 | 58 |
<img class="network-logos" src="/static/internet.png" /> |
22 | 59 |
<div href="#" class="name-div"> |
23 | 60 |
<h5 class="namecontainer"> |
... | ... | |
25 | 62 |
</h5> |
26 | 63 |
</div> |
27 | 64 |
<h5 class="network-machines"> |
28 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %} (2)</span> |
|
65 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %}</span> |
|
66 |
(<span class="machines-count">1</span>) |
|
29 | 67 |
</h5> |
30 | 68 |
<div class="network-contents"> |
31 | 69 |
<div class="network-placeholder"> |
32 | 70 |
<div class="network-contents-start-separator"></div> |
33 |
<div class="network-machine" id="machine-template"> |
|
34 |
<div class="machine-actions"> |
|
35 |
<a href="#" class="action-disconnect">{% trans "Disconnect" %}</a> |
|
36 |
<a href="#" class="action-details">{% trans "Details" %}</a> |
|
37 |
</div> |
|
38 |
<div class="state"> |
|
39 |
<div class="status"><span class="discreet">IPv4:</span> 192.94.73.15</div> |
|
40 |
<div class="status"><span class="discreet">IPv6:</span> vv</div> |
|
41 |
<img class="spinner" style="display:none" src="/static/progress.gif" /> |
|
42 |
<img class="wave" style="display:none" src="/static/wave.gif" /> |
|
43 |
</div> |
|
44 |
<img class="logo" src="/static/machines/debian-on.png" /> |
|
45 |
<div class='network-remove-machine'><span class="remove-icon">X</span></div> |
|
46 |
<div href="#" class="machine-name-div"> |
|
47 |
<h5 class="namecontainer editable"> |
|
48 |
<span class="name">my desktop1</span><span class="rename"></span> |
|
49 |
<div class="editbuttons" style="display:none"> |
|
50 |
<span class="save" /> |
|
51 |
<span class="cancel" /> |
|
52 |
</div> |
|
53 |
</h5> |
|
54 |
</div> |
|
55 |
<h5> |
|
56 |
<span class="ip">{% trans "IPs" %}</span> | |
|
57 |
<span class="show-firewall">{% trans "Firewall" %}</span> |
|
58 |
(<span class="firewall-on">{% trans "On" %}</span>) |
|
59 |
</h5> |
|
60 |
<div class="firewall-content"> |
|
61 |
<div class="firewall-contents-start-separator"></div> |
|
62 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
63 |
<span class="checkbox-legends">{% trans "Unprotected mode (Firewall off)" %}</span> |
|
64 |
<br /> |
|
65 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
66 |
<span class="checkbox-legends">{% trans "Fully protected mode (Firewall on)" %}</span> |
|
67 |
<br /> |
|
68 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
69 |
<span class="checkbox-legends">{% trans "Basically protected mode (Firewall on)" %}</span> |
|
70 |
<br /> |
|
71 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
72 |
<span class="checkbox-legends">{% trans "Custom protection" %} <a href="#" class="firewall-settings">{% trans "settings" %}</a> {% trans "(Advanced users only)" %}</span> |
|
73 |
<button type="submit" class="firewall-apply">{% trans "Apply" %}</button> |
|
74 |
<div class="firewall-contents-end-separator"></div> |
|
75 |
</div> |
|
71 |
<div class="machines-list"> |
|
72 |
<!-- append machines here --> |
|
76 | 73 |
</div> |
77 |
<div class="network-separator machines"></div> |
|
78 |
<div class="network-machine" id="machine-template"> |
|
79 |
<div class="machine-actions"> |
|
80 |
<a href="#" class="action-disconnect">{% trans "Disconnect" %}</a> |
|
81 |
<a href="#" class="action-details">{% trans "Details" %}</a> |
|
82 |
</div> |
|
83 |
<div class="state"> |
|
84 |
<div class="status"><span class="discreet">IPv4:</span> 192.94.73.18</div> |
|
85 |
<div class="status"><span class="discreet">IPv6:</span> vv</div> |
|
86 |
<img class="spinner" style="display:none" src="/static/progress.gif" /> |
|
87 |
<img class="wave" style="display:none" src="/static/wave.gif" /> |
|
88 |
</div> |
|
89 |
<img class="logo" src="/static/machines/windows-off.png" /> |
|
90 |
<div class='network-remove-machine'><span class="remove-icon">X</span></div> |
|
91 |
<div href="#" class="machine-name-div"> |
|
92 |
<h5 class="namecontainer editable"> |
|
93 |
<span class="name">my desktop1</span><span class="rename"></span> |
|
94 |
<div class="editbuttons" style="display:none"> |
|
95 |
<span class="save" /> |
|
96 |
<span class="cancel" /> |
|
97 |
</div> |
|
98 |
</h5> |
|
99 |
</div> |
|
100 |
<h5> |
|
101 |
<span class="ip">{% trans "IPs" %}</span> | |
|
102 |
<span class="show-firewall" href="#">{% trans "Firewall" %}</span> |
|
103 |
(<span class="firewall-off">{% trans "Off" %}</span>) |
|
104 |
</h5> |
|
105 |
<div class="firewall-content"> |
|
106 |
<div class="firewall-contents-start-separator"></div> |
|
107 |
<input type="radio" class="checkboxes" name="image-id2" /> |
|
108 |
<span class="checkbox-legends">{% trans "Unprotected mode (Firewall off)" %}</span> |
|
109 |
<br /> |
|
110 |
<input type="radio" class="checkboxes" name="image-id2" /> |
|
111 |
<span class="checkbox-legends">{% trans "Fully protected mode (Firewall on)" %}</span> |
|
112 |
<br /> |
|
113 |
<input type="radio" class="checkboxes" name="image-id2" /> |
|
114 |
<span class="checkbox-legends">{% trans "Basically protected mode (Firewall on)" %}</span> |
|
115 |
<br /> |
|
116 |
<input type="radio" class="checkboxes" name="image-id2" /> |
|
117 |
<span class="checkbox-legends">{% trans "Custom protection" %} <a href="#" class="firewall-settings">{% trans "settings" %}</a> {% trans "(Advanced users only)" %}</span> |
|
118 |
<button type="submit" class="firewall-apply">{% trans "Apply" %}</button> |
|
119 |
<div class="firewall-contents-end-separator"></div> |
|
120 |
</div> |
|
121 |
</div> |
|
122 |
<div class="network-separator machines"></div> |
|
123 | 74 |
<div class="empty-network-slot" id="machine-template"> |
124 |
<div class='network-add-machine'><span class="add-icon">+</span></div> |
|
75 |
<div class='network-add-machine'> |
|
76 |
{# Replace the following with the comment below for full public network functionality #} |
|
77 |
{# <span class="add-icon">+</span> #} |
|
78 |
<span> </span> |
|
79 |
</div> |
|
125 | 80 |
</div> |
126 | 81 |
</div> |
127 | 82 |
<div class="network-contents-end-separator"></div> |
128 | 83 |
</div> |
129 | 84 |
</div> |
130 |
<div id="internet-separator"></div> |
|
131 |
<div id="private-networks">
|
|
132 |
<div class="network" id="network-template">
|
|
133 |
<div class="actions">
|
|
134 |
<a href="#" class="action-add">{% trans "Add Machine" %}</a>
|
|
135 |
<a href="#" class="action-network-edit">{% trans "Edit" %}</a>
|
|
136 |
<a href="#" class="action-network-destroy">{% trans "Destroy" %}</a>
|
|
137 |
</div>
|
|
138 |
<div class="state">
|
|
139 |
<div class="status">{% trans "Private Network" %}</div>
|
|
140 |
<div class="indicator"></div>
|
|
141 |
<div class="indicator"></div>
|
|
142 |
<div class="indicator"></div>
|
|
143 |
<div class="indicator"></div>
|
|
144 |
</div>
|
|
145 |
<img class="network-logos" src="/static/network.png" />
|
|
146 |
<div href="#" class="name-div">
|
|
147 |
<h5 class="namecontainer">
|
|
148 |
<span class="name">{% trans "My Network 1" %}</span><span class="rename-network"></span>
|
|
149 |
</h5>
|
|
85 |
|
|
86 |
<!-- template for machines in public network -->
|
|
87 |
<div class="network-machine" id="public-machine-template">
|
|
88 |
<div class="machine-actions">
|
|
89 |
<a href="#" class="action-details">{% trans "Details" %}</a>
|
|
90 |
</div>
|
|
91 |
<div class="confirm_single">
|
|
92 |
<button class="yes">{% trans "Confirm" %}</button>
|
|
93 |
<button class="no">{% trans "Cancel" %}</button>
|
|
94 |
</div> |
|
95 |
<div class="action_error" align="center">
|
|
96 |
{% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span>
|
|
97 |
<span class="code"></span>
|
|
98 |
<span class="message"></span>
|
|
99 |
<button class="details">{% trans "Details" %}</button>
|
|
100 |
</div>
|
|
101 |
<div class="state">
|
|
102 |
<div class="ip4-container status">
|
|
103 |
<span class="discreet">{% trans "IPv4" %}: </span>
|
|
104 |
<span class="ip4">192.94.73.15</span>
|
|
150 | 105 |
</div> |
151 |
<h5 class="network-machines"> |
|
152 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %} (2)</span> |
|
153 |
</h5> |
|
154 |
<div class="network-contents"> |
|
155 |
<div class="network-placeholder"> |
|
156 |
<div class="network-contents-start-separator"></div> |
|
157 |
<div class="network-machine" id="machine-template"> |
|
158 |
<div class="machine-actions"> |
|
159 |
<a href="#" class="action-disconnect">{% trans "Disconnect" %}</a> |
|
160 |
<a href="#" class="action-details">{% trans "Details" %}</a> |
|
161 |
</div> |
|
162 |
<div class="state"> |
|
163 |
<div class="status"><span class="discreet">IPv4:</span> 192.94.73.15</div> |
|
164 |
<div class="status"><span class="discreet">IPv6:</span> vv</div> |
|
165 |
<img class="spinner" style="display:none" src="/static/progress.gif" /> |
|
166 |
<img class="wave" style="display:none" src="/static/wave.gif" /> |
|
167 |
</div> |
|
168 |
<img class="logo" src="/static/machines/debian-on.png" /> |
|
169 |
<div class='network-remove-machine'><span class="remove-icon">X</span></div> |
|
170 |
<div href="#" class="machine-name-div"> |
|
171 |
<h5 class="namecontainer editable"> |
|
172 |
<span class="name">my desktop1</span><span class="rename"></span> |
|
173 |
<div class="editbuttons" style="display:none"> |
|
174 |
<span class="save" /> |
|
175 |
<span class="cancel" /> |
|
176 |
</div> |
|
177 |
</h5> |
|
178 |
</div> |
|
179 |
<h5> |
|
180 |
<span class="machine-connect">{% trans "Connect" %}</span> {% trans "to manage private IPs" %} |
|
181 |
</h5> |
|
182 |
<div class="firewall-content"> |
|
183 |
firewall content |
|
184 |
</div> |
|
185 |
</div> |
|
186 |
<div class="network-separator machines"></div> |
|
187 |
<div class="network-machine" id="machine-template"> |
|
188 |
<div class="machine-actions"> |
|
189 |
<a href="#" class="action-disconnect">{% trans "Disconnect" %}</a> |
|
190 |
<a href="#" class="action-details">{% trans "Details" %}</a> |
|
191 |
</div> |
|
192 |
<div class="state"> |
|
193 |
<div class="status"><span class="discreet">IPv4:</span> 192.94.73.18</div> |
|
194 |
<div class="status"><span class="discreet">IPv6:</span> vv</div> |
|
195 |
<img class="spinner" style="display:none" src="/static/progress.gif" /> |
|
196 |
<img class="wave" style="display:none" src="/static/wave.gif" /> |
|
197 |
</div> |
|
198 |
<img class="logo" src="/static/machines/ubuntu-on.png" /> |
|
199 |
<div class='network-remove-machine'><span class="remove-icon">X</span></div> |
|
200 |
<div href="#" class="machine-name-div"> |
|
201 |
<h5 class="namecontainer editable"> |
|
202 |
<span class="name">my desktop1</span><span class="rename"></span> |
|
203 |
<div class="editbuttons" style="display:none"> |
|
204 |
<span class="save" /> |
|
205 |
<span class="cancel" /> |
|
206 |
</div> |
|
207 |
</h5> |
|
208 |
</div> |
|
209 |
<h5> |
|
210 |
<span class="machine-connect">{% trans "Connect" %}</span> {% trans "to manage private IPs" %} |
|
211 |
</h5> |
|
212 |
</div> |
|
213 |
<div class="network-separator machines"></div> |
|
214 |
<div class="empty-network-slot" id="machine-template"> |
|
215 |
<div class='network-add-machine'><span class="add-icon">+</span></div> |
|
216 |
</div> |
|
217 |
</div> |
|
218 |
<div class="network-contents-end-separator"></div> |
|
106 |
<div class="ip6-container status"> |
|
107 |
<span class="discreet">{% trans "IPv6" %}: </span> |
|
108 |
<span class="ip6">vv</span> |
|
219 | 109 |
</div> |
110 |
<img class="spinner" style="display:none" src="/static/icons/indicators/medium/progress.gif" /> |
|
111 |
<img class="wave" style="display:none" src="/static/icons/indicators/medium/wave.gif" /> |
|
220 | 112 |
</div> |
221 |
<div class="network-separator"></div> |
|
222 |
<div class="network" id="network-template"> |
|
223 |
<div class="actions"> |
|
224 |
<a href="#" class="action-add">{% trans "Add Machine" %}</a> |
|
225 |
<a href="#" class="action-network-edit">{% trans "Edit" %}</a> |
|
226 |
<a href="#" class="action-network-destroy">{% trans "Destroy" %}</a> |
|
227 |
</div> |
|
228 |
<div class="state"> |
|
229 |
<div class="status">{% trans "Private Network" %}</div> |
|
230 |
<div class="indicator"></div> |
|
231 |
<div class="indicator"></div> |
|
232 |
<div class="indicator"></div> |
|
233 |
<div class="indicator"></div> |
|
234 |
</div> |
|
235 |
<img class="network-logos" src="/static/network.png" /> |
|
236 |
<div href="#" class="name-div"> |
|
237 |
<h5 class="namecontainer"> |
|
238 |
<span class="name">{% trans "My Network 2" %}</span><span class="rename-network"></span> |
|
239 |
</h5> |
|
240 |
</div> |
|
241 |
<h5 class="network-machines"> |
|
242 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %} (0)</span> |
|
113 |
<img class="logo" src="/static/icons/machines/medium/debian-on.png" /> |
|
114 |
<div class='network-remove-machine'> |
|
115 |
{# Replace the following with the comment below for full public network functionality #} |
|
116 |
{# <span class="remove-icon">X</span> #} |
|
117 |
<span> </span> |
|
118 |
</div> |
|
119 |
<div href="#" class="machine-name-div"> |
|
120 |
<h5 class="namecontainer"> |
|
121 |
<span class="name">my desktop1</span> |
|
243 | 122 |
</h5> |
244 |
<div class="network-contents"> |
|
245 |
<div class="network-placeholder"> |
|
246 |
<div class="network-contents-start-separator"></div> |
|
247 |
<div class="empty-network-slot" id="machine-template"> |
|
248 |
<div class='network-add-machine'><span class="add-icon">+</span></div> |
|
249 |
</div> |
|
123 |
</div> |
|
124 |
<h5> |
|
125 |
<span class="ip">{% trans "IPs" %}</span> | |
|
126 |
<span class="show-firewall">{% trans "Firewall" %}</span> |
|
127 |
(<span class="firewall-off">{% trans "Off" %}</span>) |
|
128 |
</h5> |
|
129 |
<div class="firewall-content"> |
|
130 |
<div class="firewall-contents-start-separator"></div> |
|
131 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
132 |
<span class="checkbox-legends">{% trans "Unprotected mode (Firewall off)" %}</span> |
|
133 |
<br /> |
|
134 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
135 |
<span class="checkbox-legends">{% trans "Fully protected mode (Firewall on)" %}</span> |
|
136 |
<br /> |
|
137 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
138 |
<span class="checkbox-legends">{% trans "Basically protected mode (Firewall on)" %}</span> |
|
139 |
<br /> |
|
140 |
<input type="radio" class="checkboxes" name="image-id1" /> |
|
141 |
<span class="checkbox-legends">{% trans "Custom protection" %} <a href="#" class="firewall-settings">{% trans "settings" %}</a> {% trans "(Advanced users only)" %}</span> |
|
142 |
<button type="submit" class="firewall-apply">{% trans "Apply" %}</button> |
|
143 |
<div class="firewall-contents-end-separator"></div> |
|
144 |
</div> |
|
145 |
<div class="network-separator machines"></div> |
|
146 |
</div> |
|
147 |
|
|
148 |
<!-- private network template --> |
|
149 |
<div class="network" id="private-template"> |
|
150 |
<div class="actions"> |
|
151 |
<a href="#" class="action-add">{% trans "Add Machine" %}</a> |
|
152 |
<a href="#" class="action-network-destroy">{% trans "Destroy" %}</a> |
|
153 |
</div> |
|
154 |
<div class="confirm_single"> |
|
155 |
<button class="yes">{% trans "Confirm" %}</button> |
|
156 |
<button class="no">{% trans "Cancel" %}</button> |
|
157 |
</div> |
|
158 |
<div class="action_error" align="center"> |
|
159 |
{% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span> |
|
160 |
<span class="code"></span> |
|
161 |
<span class="message"></span> |
|
162 |
<button class="details">{% trans "Details" %}</button> |
|
163 |
</div> |
|
164 |
<div class="state"> |
|
165 |
<div class="status">{% trans "Private Network" %}</div> |
|
166 |
<div class="indicator"></div> |
|
167 |
<div class="indicator"></div> |
|
168 |
<div class="indicator"></div> |
|
169 |
<div class="indicator"></div> |
|
170 |
<img class="spinner" style="display:none" src="/static/icons/indicators/medium/progress.gif" /> |
|
171 |
<img class="wave" style="display:none" src="/static/icons/indicators/medium/wave.gif" /> |
|
172 |
</div> |
|
173 |
<img class="network-logos" src="/static/network.png" /> |
|
174 |
<div href="#" class="name-div"> |
|
175 |
<h5 class="namecontainer editable"> |
|
176 |
<span class="name">{% trans "My Network 1" %}</span> |
|
177 |
<span class="rename-network"></span> |
|
178 |
<div class="editbuttons" style="display:none"> |
|
179 |
<span class="save" /> |
|
180 |
<span class="cancel" /> |
|
250 | 181 |
</div> |
251 |
<div class="network-contents-end-separator"></div> |
|
252 |
</div> |
|
182 |
</h5> |
|
253 | 183 |
</div> |
254 |
<div class="network-separator"></div> |
|
255 |
<div class="network" id="network-template"> |
|
256 |
<div class="actions"> |
|
257 |
<a href="#" class="action-add">{% trans "Add Machine" %}</a> |
|
258 |
<a href="#" class="action-network-edit">{% trans "Edit" %}</a> |
|
259 |
<a href="#" class="action-network-destroy">{% trans "Destroy" %}</a> |
|
260 |
</div> |
|
261 |
<div class="state"> |
|
262 |
<div class="status">{% trans "Private Network" %}</div> |
|
263 |
<div class="indicator"></div> |
|
264 |
<div class="indicator"></div> |
|
265 |
<div class="indicator"></div> |
|
266 |
<div class="indicator"></div> |
|
267 |
</div> |
|
268 |
<img class="network-logos" src="/static/network.png" /> |
|
269 |
<div href="#" class="name-div"> |
|
270 |
<h5 class="namecontainer"> |
|
271 |
<span class="name">{% trans "My Network 3" %}</span><span class="rename-network"></span> |
|
272 |
</h5> |
|
184 |
<h5 class="network-machines"> |
|
185 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %}</span> |
|
186 |
(<span class="machines-count">1</span>) |
|
187 |
</h5> |
|
188 |
<div class="network-contents"> |
|
189 |
<div class="network-placeholder"> |
|
190 |
<div class="network-contents-start-separator"></div> |
|
191 |
<div class="machines-list"> |
|
192 |
<!-- append machines here --> |
|
193 |
</div> |
|
194 |
<div class="empty-network-slot" id="machine-template"> |
|
195 |
<div class='network-add-machine'><span class="add-icon">+</span></div> |
|
196 |
</div> |
|
273 | 197 |
</div> |
274 |
<h5 class="network-machines"> |
|
275 |
{% trans "Show:" %} <span class="show-machines">{% trans "machines" %} (0)</span> |
|
198 |
<div class="network-contents-end-separator"></div> |
|
199 |
</div> |
|
200 |
<div class="separator"></div> |
|
201 |
</div> |
|
202 |
|
|
203 |
<!-- template for machines in private network --> |
|
204 |
<div class="network-machine" id="private-machine-template"> |
|
205 |
<div class="machine-actions"> |
|
206 |
<a href="#" class="action-disconnect">{% trans "Disconnect" %}</a> |
|
207 |
<a href="#" class="action-details">{% trans "Details" %}</a> |
|
208 |
</div> |
|
209 |
<div class="confirm_single"> |
|
210 |
<button class="yes">{% trans "Confirm" %}</button> |
|
211 |
<button class="no">{% trans "Cancel" %}</button> |
|
212 |
</div> |
|
213 |
<div class="action_error" align="center"> |
|
214 |
{% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span> |
|
215 |
<span class="code"></span> |
|
216 |
<span class="message"></span> |
|
217 |
<button class="details">{% trans "Details" %}</button> |
|
218 |
</div> |
|
219 |
<div class="state"> |
|
220 |
<img class="spinner" style="display:none" src="/static/icons/indicators/medium/progress.gif" /> |
|
221 |
<img class="wave" style="display:none" src="/static/icons/indicators/medium/wave.gif" /> |
|
222 |
</div> |
|
223 |
<img class="logo" src="/static/icons/machines/medium/debian-on.png" /> |
|
224 |
<div class='network-remove-machine'><span class="remove-icon">X</span></div> |
|
225 |
<div href="#" class="machine-name-div"> |
|
226 |
<h5 class="namecontainer editable"> |
|
227 |
<span class="name">my desktop1</span> |
|
276 | 228 |
</h5> |
277 |
<div class="network-contents"> |
|
278 |
<div class="network-placeholder"> |
|
279 |
<div class="network-contents-start-separator"></div> |
|
280 |
<div class="empty-network-slot" id="machine-template"> |
|
281 |
<div class='network-add-machine'><span class="add-icon">+</span></div> |
|
229 |
</div> |
|
230 |
<h5> |
|
231 |
<span class="machine-connect">{% trans "Connect" %}</span> {% trans "to manage private IPs" %} |
|
232 |
</h5> |
|
233 |
<div class="network-separator machines"></div> |
|
234 |
</div> |
|
235 |
|
|
236 |
<!-- the actual structure to be populated --> |
|
237 |
<div class="public-networks"></div> |
|
238 |
<div class="private-networks" style="display:none;"></div> |
|
239 |
</div> |
|
240 |
|
|
241 |
<!-- add servers to network overlay --> |
|
242 |
<div> |
|
243 |
<div id="add-machines-wizard" class="modal"> |
|
244 |
<h3 class="popup-header">{% trans "Add machine" %}</h3> |
|
245 |
<p style='display:none;'>hidden network id</p> |
|
246 |
<div class="popup-body"> |
|
247 |
<div class="popup-body-inner"> |
|
248 |
<div class="popup-title">{% trans "Select machines to add to:" %}</div> |
|
249 |
<div class="network-name"></div> |
|
250 |
<div class="popup-separator"></div> |
|
251 |
<div class="machines-container"> |
|
252 |
<div class="large-spinner"></div> |
|
253 |
<div id='machine-entry-template' style="display:none;"> |
|
254 |
<input type="checkbox" /> |
|
255 |
<img class=list-logo src="/static/icons/machines/small/debian-on.png" title="debian"></img> |
|
256 |
<span class="machine-name">kati</span> |
|
282 | 257 |
</div> |
283 | 258 |
</div> |
284 |
<div class="network-contents-end-separator"></div> |
|
285 | 259 |
</div> |
286 | 260 |
</div> |
261 |
<div class="buttons"> |
|
262 |
<button type="button" class="cancel" id="add-server-cancel">{% trans "Cancel" %}</button> |
|
263 |
<button type="button" class="add" id="add-server-add">{% trans "Add" %}</button> |
|
264 |
</div> |
|
287 | 265 |
</div> |
288 | 266 |
</div> |
289 |
<div id="networks" class="separator"></div> |
|
267 |
|
|
268 |
<a id="add-machines-overlay" href="#" rel="#add-machines-wizard"></a> |
|
269 |
|
|
270 |
<!-- multiple confirmation dialog --> |
|
271 |
<div class="confirm_multiple"> |
|
272 |
<p>{% trans "Your actions will affect" %} <span class="actionLen">XX</span> {% trans "networks" %}</p> |
|
273 |
<button class="yes">{% trans "Confirm All" %}</button> |
|
274 |
<button class="no">{% trans "Cancel All" %}</button> |
|
275 |
</div> |
|
290 | 276 |
|
291 | 277 |
<script> |
292 |
// hide the all of the networks contents |
|
293 |
$(".network-contents").hide(); |
|
294 |
// toggle the component with class network-contents |
|
295 |
$(".show-machines").click(function() { |
|
296 |
$(this).parent().next(".network-contents").slideToggle(600); |
|
278 |
// add network wizard initialization |
|
279 |
$(function() { |
|
280 |
// create wizard overlay |
|
281 |
$("a#networkscreate").overlay({ |
|
282 |
mask: '#000', |
|
283 |
effect: 'default', |
|
284 |
top: '10%', |
|
285 |
closeOnClick: false, |
|
286 |
oneInstance: false, |
|
287 |
closeOnEsc: true, |
|
288 |
load: false |
|
289 |
}); |
|
297 | 290 |
}); |
298 |
// toggle the component with class network-contents |
|
299 |
$(".network-logos").click(function() { |
|
300 |
$(this).siblings(".network-contents").slideToggle(600); |
|
291 |
|
|
292 |
// intercept click to create new private network |
|
293 |
$("#networkscreate").click(function() { |
|
294 |
// reset and load wizard |
|
295 |
$('#networks-wizard span.help').removeClass('red'); |
|
296 |
$('#networks-wizard input').val(''); |
|
297 |
$('#networks-wizard #add-network-create').text('{% trans 'Create Network' %}'); |
|
298 |
$("#networks-wizard").show(); |
|
299 |
$('#networks-wizard input').focus(); |
|
300 |
$("a#networkscreate").data('overlay').load(); |
|
301 |
return false; |
|
301 | 302 |
}); |
302 | 303 |
|
303 |
// intercept click to remove machine from network |
|
304 |
$(".remove-icon").click(function() { |
|
305 |
$(this).parent().parent().next('div.network-separator').fadeOut(); |
|
306 |
$(this).parent().parent().fadeOut(); |
|
304 |
// exit the add machine to network wizard |
|
305 |
$("#add-network-cancel").live('click', function() { |
|
306 |
$("a#networkscreate").overlay().close(); |
|
307 | 307 |
}); |
308 | 308 |
|
309 |
// intercept click to add machine to network |
|
310 |
$(".add-icon").click(function() { |
|
311 |
//var newEntry = $(".network-machine")[0].clone(); |
|
312 |
//$(this).parent().parent().append(newEntry); |
|
309 |
// add selected machines to network |
|
310 |
$("#add-network-create").live('click', function() { |
|
311 |
if ($('#networks-wizard input').val() == '') { |
|
312 |
$('#networks-wizard input').focus(); |
|
313 |
$('#networks-wizard span.help').addClass('red'); |
|
314 |
} else { |
|
315 |
$(this).text(''); |
|
316 |
$(this).html('<img src="/static/icons/indicators/medium/horizontal-progress.gif"></img>'); |
|
317 |
networkName = $('#networks-wizard input').val(); |
|
318 |
create_network(networkName); |
|
319 |
} |
|
320 |
return false; |
|
313 | 321 |
}); |
314 | 322 |
|
315 |
// hide the all of the firewall contents |
|
316 |
$(".firewall-content").hide(); |
|
317 |
// toggle the component with class firewall-contents |
|
318 |
$(".show-firewall").click(function() { |
|
323 |
// toggle component with class network-contents |
|
324 |
$("#networks-pane .show-machines").live('click', function() { |
|
325 |
$(this).parent().next("#networks-pane .network-contents").slideToggle(600); |
|
326 |
return false; |
|
327 |
}); |
|
328 |
|
|
329 |
// toggle component with class network-contents |
|
330 |
$("#networks-pane .network-logos").live('click', function() { |
|
331 |
$(this).siblings("#networks-pane .network-contents").slideToggle(600); |
|
332 |
return false; |
|
333 |
}); |
|
334 |
|
|
335 |
//initiate network renaming |
|
336 |
$("#networks-pane .name-div .rename-network, #networks-pane .name-div h5.editable span.name").live('click', function() { |
|
337 |
$(this).parent().find('.name').html("<input id=\"txtEdit\" type=\"text\" class=\"nametextbox\" value=\"" + |
|
338 |
$(this).parent().find('.name').text() + |
|
339 |
"\" / ><span class=\"oldValue\">" + |
|
340 |
$(this).parent().find('.name').text() + "</span>"); |
|
341 |
$(this).parent().find('.rename-network').hide(); |
|
342 |
$(this).parent().find(".editbuttons").fadeIn(); |
|
343 |
$(this).parent().find(".nametextbox").focus().select(); |
|
344 |
$(this).parent().removeClass('editable'); |
|
345 |
|
|
346 |
//submit wizard by pressing enter on the name textbox |
|
347 |
$("#txtEdit").keydown(function (e) { |
|
348 |
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { |
|
349 |
$(this).parent().parent().find('div.editbuttons span.save').click(); |
|
350 |
return false; |
|
351 |
} else if ((e.which && e.which == 27) || (e.keyCode && e.keyCode == 27)) { |
|
352 |
$(this).parent().parent().find('div.editbuttons span.cancel').click(); |
|
353 |
return true; |
|
354 |
} |
|
355 |
}); |
|
356 |
return false; |
|
357 |
}); |
|
358 |
|
|
359 |
//rename machine |
|
360 |
$("#networks-pane .name-div .editbuttons .save").live('click', function() { |
|
361 |
networkID = $(this).closest('.network').attr("id").split('-').pop(); |
|
362 |
networkName = $(this).parent().parent().find('.nametextbox').val(); |
|
363 |
if (networkName.trim() == ''){ |
|
364 |
return false; |
|
365 |
} |
|
366 |
$(this).parent().parent().find('.name').html($(this).parent().parent().find('.nametextbox').val()); |
|
367 |
$(this).parent().parent().find(".editbuttons").fadeOut("fast"); |
|
368 |
$(this).parent().parent().find(".rename-network").fadeIn("slow"); |
|
369 |
rename_network(networkID, networkName); |
|
370 |
return false; |
|
371 |
}); |
|
372 |
|
|
373 |
//cancel renaming |
|
374 |
$("#networks-pane .name-div .editbuttons .cancel").live('click', function() { |
|
375 |
$(this).parent().parent().find('.name').html($(this).parent().parent().find('.oldValue').text()); |
|
376 |
$(this).parent().parent().find(".editbuttons").hide(); |
|
377 |
$(this).parent().parent().find(".rename-network").fadeIn(); |
|
378 |
$(this).parent().parent().addClass('editable'); |
|
379 |
return false; |
|
380 |
}); |
|
381 |
|
|
382 |
// intercept click to delete network |
|
383 |
$("#networks-pane .action-network-destroy").live('click', function() { |
|
384 |
var networkID = $(this).parent().parent().attr('id').split('-').pop(); |
|
385 |
var networkName = $(this).parent().parent().find(".name-div span.name").text(); |
|
386 |
var found = false; |
|
387 |
$(this).parent().children('a').removeClass('selected'); |
|
388 |
$(this).addClass('selected'); |
|
389 |
$(this).parent().addClass('display') |
|
390 |
$(this).parent().parent().find('.action_error').hide(); |
|
391 |
for (i=0; i < pending_actions.length; i++){ // if there is already a pending action for this network replace it |
|
392 |
if (pending_actions[i][0] == delete_network && pending_actions[i][1] == networkID){ |
|
393 |
pending_actions[i][0] = delete_network; |
|
394 |
found = true |
|
395 |
} |
|
396 |
} |
|
397 |
if (!found) { |
|
398 |
// no pending action for this network was found, so let's just add it to the list |
|
399 |
pending_actions.push([delete_network, networkID, networkName]); |
|
400 |
} |
|
401 |
update_network_confirmations(); |
|
402 |
return false; |
|
403 |
}); |
|
404 |
|
|
405 |
// intercept click to remove machine from network |
|
406 |
$("#networks-pane .remove-icon").live('click', function() { |
|
407 |
$(this).closest('.network-machine').find('.action-disconnect').click(); |
|
408 |
return false; |
|
409 |
}); |
|
410 |
|
|
411 |
// intercept click to remove machine from network |
|
412 |
$("#networks-pane .action-disconnect").live('click', function() { |
|
413 |
var serverID = $(this).parent().parent().attr('id').split('-').pop(); |
|
414 |
var networkID = $(this).closest('.network').attr('id').split('-').pop(); |
|
415 |
var found = false; |
|
416 |
$(this).parent().children('a').removeClass('selected'); |
|
417 |
$(this).addClass('selected'); |
|
418 |
$(this).parent().addClass('display') |
|
419 |
$(this).parent().parent().find('.action_error').hide(); |
|
420 |
for (i=0; i < pending_actions.length; i++){ |
|
421 |
// if there is already a pending action for this network replace it |
|
422 |
if (pending_actions[i][0] == remove_server_from_network && |
|
423 |
pending_actions[i][1] == networkID && |
|
424 |
pending_actions[i][2] == serverID) { |
|
425 |
pending_actions[i][0] = remove_server_from_network; |
|
426 |
found = true |
|
427 |
} |
|
428 |
} |
|
429 |
if (!found) { |
|
430 |
// no pending action for this network was found, so let's just add it to the list |
|
431 |
pending_actions.push([remove_server_from_network, networkID, serverID]); |
|
432 |
} |
|
433 |
update_network_confirmations(); |
|
434 |
return false; |
|
435 |
}); |
|
436 |
|
|
437 |
$("#networks-pane .action-details").live('click', function() { |
|
438 |
var serverID = $(this).parent().parent().attr('id').split('-').pop(); |
|
439 |
$.cookie('view', '2'); |
|
440 |
$.cookie('server', serverID); |
|
441 |
$('a#machines').click(); |
|
442 |
return false |
|
443 |
}); |
|
444 |
|
|
445 |
// add machines wizard initialization |
|
446 |
$(function() { |
|
447 |
// create wizard overlay |
|
448 |
$("a#add-machines-overlay").overlay({ |
|
449 |
mask: '#000', |
|
450 |
effect: 'default', |
|
451 |
top: '10%', |
|
452 |
closeOnClick: false, |
|
453 |
oneInstance: false, |
|
454 |
closeOnEsc: true, |
|
455 |
load: false |
|
456 |
}); |
|
457 |
}); |
|
458 |
|
|
459 |
// intercept click to add machine to network |
|
460 |
$("#networks-pane .action-add").live('click', function() { |
|
461 |
// reset pre-existing values |
|
462 |
$('#add-server-add').text('{% trans 'Add' %}'); |
|
463 |
$("#add-machines-wizard .network-name").text($(this).closest('.network').find('.name-div span.name').text()); |
|
464 |
$("#add-machines-wizard p").text($(this).closest('.network').attr('id').split('-').pop()); |
|
465 |
$("#add-machines-wizard .large-spinner").show(); |
|
466 |
$('[id^="list-entry-server-"]').remove(); |
|
467 |
// list new values |
|
468 |
list_machines(); |
|
469 |
// load wizard |
|
470 |
$("#add-machines-wizard").show(); |
|
471 |
$("a#add-machines-overlay").data('overlay').load(); |
|
472 |
return false; |
|
473 |
}); |
|
474 |
|
|
475 |
//submit wizard by pressing enter on the name textbox |
|
476 |
$("#networks-wizard div.name-input input.text").keypress(function (e) { |
|
477 |
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { |
|
478 |
$('#add-network-create').click(); |
|
479 |
return false; |
|
480 |
} else { |
|
481 |
return true; |
|
482 |
} |
|
483 |
}); |
|
484 |
|
|
485 |
// intercept click to bring up the add machine to network wizard |
|
486 |
$("#networks-pane .add-icon").live('click', function() { |
|
487 |
$(this).closest('.network').find('.action-add').click(); |
|
488 |
}); |
|
489 |
|
|
490 |
// get machines in public network and list them in add server to network wizard |
|
491 |
function list_machines() { |
|
492 |
var networkID = $("#add-machines-wizard p").text(); |
|
493 |
// get the list of servers from the UI |
|
494 |
var all_machines = $("#networks-pane .public-networks .network-machine"); |
|
495 |
|
|
496 |
$.each(all_machines, function(i, machine) { |
|
497 |
var currentID = machine.id.split('-').pop(); |
|
498 |
// if machine already exists in private network |
|
499 |
if ( $('#net-' + networkID + '-server-' + currentID).length > 0 ) { |
|
500 |
// do nothing |
|
501 |
} else { |
|
502 |
// put it in the list |
|
503 |
var entry = $("#add-machines-wizard #machine-entry-template").clone().attr("id", "list-entry-server-" + currentID); |
|
504 |
entry.find('input').attr("name", currentID); |
|
505 |
entry.find('img').attr('src', '/static/icons/machines/small/' + $(machine).find('img.logo').attr('src').split('/').pop()); |
|
506 |
entry.find('.machine-name').text($(machine).find('span.name').text()); |
|
507 |
entry.appendTo("#add-machines-wizard .machines-container"); |
|
508 |
} |
|
509 |
}); |
|
510 |
$("#add-machines-wizard .large-spinner").hide(); |
|
511 |
$('[id^="list-entry-server-"]').fadeIn("slow"); |
|
512 |
return false; |
|
513 |
} |
|
514 |
|
|
515 |
// exit the add machine to network wizard |
|
516 |
$("#add-server-cancel").live('click', function() { |
|
517 |
$("a#add-machines-overlay").overlay().close(); |
|
518 |
}); |
|
519 |
|
|
520 |
// add selected machines to network |
|
521 |
$("#add-server-add").live('click', function() { |
|
522 |
var selections = $("#add-machines-wizard :checkbox:checked"); |
|
523 |
var networkID = $("#add-machines-wizard p").text(); |
|
524 |
var serverIDs = []; |
|
525 |
$.each(selections, function(i, selection) { |
|
526 |
serverIDs.push(selection.name); |
|
527 |
}); |
|
528 |
$(this).text(''); |
|
529 |
add_server_to_network(networkID, serverIDs); |
|
530 |
$(this).html('<img src="/static/icons/indicators/medium/horizontal-progress.gif"></img>'); |
|
531 |
return false; |
|
532 |
}); |
|
533 |
|
|
534 |
// toggle component with class firewall-contents |
|
535 |
$("#networks-pane .show-firewall").live('click', function() { |
|
319 | 536 |
$(this).parent().next(".firewall-content").slideToggle(600); |
320 | 537 |
}); |
321 | 538 |
|
322 | 539 |
//hide firewall content on apply click |
323 |
$(".firewall-apply").click(function() {
|
|
540 |
$("#networks-pane .firewall-apply").live('click', function() {
|
|
324 | 541 |
$(this).parent().slideToggle(600); |
542 |
return false; |
|
543 |
}); |
|
544 |
|
|
545 |
// confirm single action |
|
546 |
$("#networks-pane div.confirm_single .yes").live('click', function() { |
|
547 |
// this works both for server and network actions |
|
548 |
var serverID = []; |
|
549 |
if ($(this).closest('.network-machine').attr('id')) { |
|
550 |
serverID = $(this).closest('.network-machine').attr('id').split('-').pop(); |
|
551 |
} |
|
552 |
var networkID = $(this).closest('.network').attr("id").split('-').pop(); |
|
553 |
// execute actions |
|
554 |
for (i=0;i<pending_actions.length;i++){ |
|
555 |
// if there is a pending action for this server execute it |
|
556 |
if (pending_actions[i][0] == delete_network && |
|
557 |
pending_actions[i][1] == networkID){ |
|
558 |
action = pending_actions.splice(i,1)[0]; |
|
559 |
$(this).parent().parent().find('.status').text(TRANSITIONS['Destroying']); |
|
560 |
$(this).parent().parent().find('.spinner').show(); |
|
561 |
action[0]([action[1]]); // execute action |
|
562 |
} else if ( pending_actions[i][0] == remove_server_from_network && |
|
563 |
pending_actions[i][1] == networkID && |
|
564 |
pending_actions[i][2] == serverID) { |
|
565 |
action = pending_actions.splice(i,1)[0]; |
|
566 |
action[0]([action[1]], [action[2]]); // execute action |
|
567 |
} |
|
568 |
} |
|
569 |
$(this).parent().hide(); |
|
570 |
$(this).parent().prev().children('a').removeClass('selected'); |
|
571 |
$(this).parent().prev().removeClass('display'); |
|
572 |
update_network_confirmations(); |
|
573 |
return false; |
|
574 |
}); |
|
575 |
|
|
576 |
// cancel single action |
|
577 |
$("#networks-pane div.confirm_single .no").live('click', function(){ |
|
578 |
// this works both for server and network actions |
|
579 |
var serverID = []; |
|
580 |
if ($(this).closest('.network-machine').attr('id')) { |
|
581 |
serverID = $(this).closest('.network-machine').attr('id').split('-').pop(); |
|
582 |
} |
|
583 |
var networkID = $(this).closest('.network').attr("id").split('-').pop(); |
|
584 |
// remove the action from the pending list |
|
585 |
$(this).parent().prev().children('a').removeClass('selected'); |
|
586 |
$(this).parent().prev().removeClass('display'); |
|
587 |
for (i=0; i < pending_actions.length; i++){ // if there is a pending action for this network remove it |
|
588 |
if (pending_actions[i][0] == delete_network && pending_actions[i][1] == networkID){ |
|
589 |
pending_actions.splice(i,1); |
|
590 |
} else if ( pending_actions[i][0] == remove_server_from_network && |
|
591 |
pending_actions[i][1] == networkID && |
|
592 |
pending_actions[i][2] == serverID) { |
|
593 |
pending_actions.splice(i,1); |
|
594 |
} |
|
595 |
} |
|
596 |
$(this).parent().hide(); |
|
597 |
update_network_confirmations(); |
|
598 |
return false; |
|
599 |
}); |
|
600 |
|
|
601 |
// show, single action, error details |
|
602 |
$("#networks-pane div.action_error .details").live('click', function(){ |
|
603 |
// remove the action from the pending list |
|
604 |
ajax_error($(this).parent().children('.code').text(), |
|
605 |
undefined, |
|
606 |
$(this).parent().children('.action').text(), |
|
607 |
$(this).parent().children('.message').text()); |
|
608 |
$(this).parent().hide(); |
|
609 |
return false; |
|
610 |
}); |
|
611 |
|
|
612 |
// confirm all actions |
|
613 |
$("#networks-pane div.confirm_multiple .yes").live('click', function(){ |
|
614 |
while(pending_actions.length > 0){ // if there is a pending action for this network execute it |
|
615 |
action = pending_actions.pop(); // extract action |
|
616 |
var networkID = action[1]; |
|
617 |
$('#networks-pane .selected').removeClass('selected'); |
|
618 |
$('#networks-pane .display').removeClass('display'); |
|
619 |
if (action[0] == delete_network) { |
|
620 |
$('#networks-pane #net-' + networkID + ' .status').text(TRANSITIONS['Destroying']); |
|
621 |
$('#networks-pane #net-' + networkID + ' .spinner').show(); |
|
622 |
action[0]([networkID]); // execute action |
|
623 |
} else if (action[0] == remove_server_from_network) { |
|
624 |
action[0]([action[1]], [action[2]]); // execute action |
|
625 |
} |
|
626 |
} |
|
627 |
update_network_confirmations(); |
|
628 |
return false; |
|
629 |
}); |
|
630 |
|
|
631 |
// cancel all actions |
|
632 |
$("#networks-pane div.confirm_multiple .no").live('click', function(){ |
|
633 |
pending_actions = []; |
|
634 |
$('#networks-pane .selected').removeClass('selected'); |
|
635 |
$('#networks-pane .display').removeClass('display'); |
|
636 |
update_network_confirmations(); |
|
637 |
return false; |
|
638 |
}); |
|
639 |
|
|
640 |
// update the networks list |
|
641 |
function update_networks_view(servers_data, networks_data){ |
|
642 |
/* |
|
643 |
Go through the input data. Update existing entries, add |
|
644 |
new ones to the list |
|
645 |
*/ |
|
646 |
|
|
647 |
// check for changes in networks |
|
648 |
if (networks_data){ |
|
649 |
/* |
|
650 |
Here we are interested in private networks only |
|
651 |
and not for any server they might contain |
|
652 |
*/ |
|
653 |
|
|
654 |
// update private networks |
|
655 |
$.each(networks_data.networks.values, function(i,network) { |
|
656 |
// search DOM for this network |
|
657 |
existing = $('#networks-pane #net-' + network.id); |
|
658 |
|
|
659 |
// if multiple machines exist in the DOM, delete all but one |
|
660 |
// defensive coding - that shouldn't happen normally |
|
661 |
while (existing.length > 1){ |
|
662 |
existing.remove(); |
|
663 |
} |
|
664 |
// If network already exists in DOM, update it |
|
665 |
if (existing.length){ |
|
666 |
// network was deleted |
|
667 |
if (network.status == 'DELETED') { |
|
668 |
existing.remove(); |
|
669 |
} |
|
670 |
|
|
671 |
// network was renamed |
|
672 |
if (existing.find('.name-div span.name').text() != network.name) { |
|
673 |
// set the new name |
|
674 |
existing.find('.name-div span.name').text(network.name); |
|
675 |
} |
|
676 |
} |
|
677 |
// If network does not exist in DOM, create it, do not take into account public network |
|
678 |
else if (network.id != 'public'){ |
|
679 |
var privNet = $("#networks-pane #private-template").clone().attr("id", "net-" + network.id); |
|
680 |
privNet.find(".name-div span.name").text(network.name).fadeIn("slow"); |
|
681 |
privNet.appendTo("#networks-pane .private-networks"); |
|
682 |
} |
|
683 |
}); |
|
684 |
} |
|
685 |
|
|
686 |
// check for changes in servers |
|
687 |
if (servers_data) { |
|
688 |
/* |
|
689 |
Here we are interested in any server contained |
|
690 |
either in a public network or a private one |
|
691 |
*/ |
|
692 |
$.each(servers_data.servers.values, function(i,server) { |
|
693 |
/* |
|
694 |
First update the public network |
|
695 |
*/ |
|
696 |
|
|
697 |
// search public network's DOM for this server |
|
698 |
existing_public = $('#networks-pane #net-pub-server-' + server.id); |
|
699 |
// get the server's OS icon |
|
700 |
var server_image = os_icon(server.metadata); |
|
701 |
|
|
702 |
// if multiple servers exist in public network, delete all but one |
|
703 |
// defensive coding - that shouldn't happen normally |
|
704 |
while (existing_public.length > 1){ |
|
705 |
existing_public.remove(); |
|
706 |
} |
|
707 |
|
|
708 |
// server was deleted |
|
709 |
if (server.status == 'DELETED') { |
|
710 |
existing_public.remove(); |
|
711 |
} |
|
712 |
|
|
713 |
// If server already exists in public network, update it |
|
714 |
if (existing_public.length){ |
|
715 |
// server was renamed |
|
716 |
if (server.name != existing_public.find('span.name').text()) { |
|
717 |
existing_public.find('span.name').text(server.name); |
|
718 |
} |
|
719 |
// server has changed state |
|
720 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
721 |
existing_public.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
722 |
} else { |
|
723 |
existing_public.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
724 |
} |
|
725 |
// server has new ips |
|
726 |
var old_ip4 = existing_public.find('span.ip4').text(); |
|
727 |
var old_ip6 = existing_public.find('span.ip6').text(); |
|
728 |
// the following are valid because the public ips always come in this order from the api |
|
729 |
var new_ips = get_public_ips(server); |
|
730 |
var new_ip4 = new_ips['ip4']; |
|
731 |
var new_ip6 = new_ips['ip6']; |
|
732 |
if (old_ip4 != new_ip4) { |
|
733 |
if (new_ips['ip4'] == undefined) { |
|
734 |
existing_public.find(".ip4-container").hide(); |
|
735 |
} else { |
|
736 |
existing_public.find('span.ip4').text(new_ip4); |
|
737 |
} |
|
738 |
} |
|
739 |
if (old_ip6 != new_ip6) { |
|
740 |
if (new_ip6 == undefined) { |
|
741 |
existing_public.find(".ip6-container").hide(); |
|
742 |
} else { |
|
743 |
existing_public.find('span.ip6').text(new_ip6); |
|
744 |
} |
|
745 |
} |
|
746 |
//TODO: server has changed OS |
|
747 |
} |
|
748 |
// If server does not exist in public network, create it |
|
749 |
else { |
|
750 |
var machine = $("#networks-pane #public-machine-template").clone().attr("id", "net-pub-server-" + server.id).fadeIn("slow"); |
|
751 |
machine.find('span.name').text(server.name); |
|
752 |
// find and display ips |
|
753 |
var ips = get_public_ips(server); |
|
754 |
if (ips['ip4'] == undefined) { |
|
755 |
machine.find(".ip4-container").hide(); |
|
756 |
} else { |
|
757 |
machine.find("span.ip4").text(ips['ip4']); |
|
758 |
} |
|
759 |
if (ips['ip6'] == undefined) { |
|
760 |
machine.find(".ip6-container").hide(); |
|
761 |
} else { |
|
762 |
machine.find("span.ip6").text(ips['ip6']); |
|
763 |
} |
|
764 |
// add the proper icon |
|
765 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
766 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
767 |
} else { |
|
768 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
769 |
} |
|
770 |
machine.appendTo("#networks-pane .public-networks .machines-list"); |
|
771 |
} |
|
772 |
/* |
|
773 |
Now update all private networks |
|
774 |
Since one server may belong to more than one private networks, |
|
775 |
we follow a different approach. |
|
776 |
We check each server and add, update or leave it as it is accordingly |
|
777 |
*/ |
|
778 |
try { |
|
779 |
$.each(server.addresses.values, function(i,server_net) { |
|
780 |
// find in which private networks it belongs |
|
781 |
if (server_net.id != "public") { |
|
782 |
var existing_private = $("#networks-pane .private-networks #net-" + server_net.id + "-server-" + server.id); |
|
783 |
// add new server |
|
784 |
if (!existing_private.length) { |
|
785 |
var machine = $("#networks-pane #private-machine-template").clone().attr("id", "net-" + server_net.id + "-server-" + server.id).fadeIn("slow"); |
|
786 |
machine.find('span.name').text(server.name); |
|
787 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
788 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
789 |
} else { |
|
790 |
machine.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
791 |
} |
|
792 |
machine.appendTo("#networks-pane .private-networks #net-" + server_net.id + " .machines-list"); |
|
793 |
} |
|
794 |
// server was deleted |
|
795 |
if (server.status == 'DELETED') { |
|
796 |
existing_private.remove(); |
|
797 |
} |
|
798 |
// server was renamed |
|
799 |
if (server.name != existing_private.find('span.name').text()) { |
|
800 |
existing_private.find('span.name').text(server.name); |
|
801 |
} |
|
802 |
// server has changed state |
|
803 |
if (server.status=='BUILD' || server.status=='ACTIVE' ||server.status=='REBOOT') { |
|
804 |
existing_private.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-on.png'); |
|
805 |
} else { |
|
806 |
existing_private.find("img.logo").attr("src","static/icons/machines/medium/" + server_image + '-off.png'); |
|
807 |
} |
|
808 |
//TODO: server has changed OS |
|
809 |
} |
|
810 |
}); |
|
811 |
} catch (err) { |
|
812 |
try{console.info('Server ' + server.id + ' has no network addresses')}catch(err){}; |
|
813 |
} |
|
814 |
}); |
|
815 |
} |
|
816 |
|
|
817 |
$("#networks-pane #networks-container > .large-spinner").hide(); |
|
818 |
|
|
819 |
// show all separators and hide the last one |
|
820 |
$("div.private-networks div.network div.separator").show(); |
|
821 |
$("div.private-networks div.network div.separator:last").hide(); |
|
822 |
// update the counters of servers in each network |
|
823 |
var nets = $('#networks-pane .network'); |
|
824 |
$.each(nets, function(i,net) { |
|
825 |
$(net).find('span.machines-count').text($(net).find('.network-machine').length); |
|
826 |
}); |
|
827 |
|
|
828 |
// the private div shows only when private networks are available |
|
829 |
if ($("div.private-networks div.network").length > 0) { |
|
830 |
$("div.private-networks").fadeIn("slow"); |
|
831 |
} else { |
|
832 |
$("div.private-networks").fadeOut("slow"); |
|
833 |
} |
|
834 |
} |
|
835 |
|
|
836 |
// reposition multiple confirmation box on window resize |
|
837 |
$(window).resize(function(){ |
|
838 |
if (this.innerHeight - 220 < $('#networks-pane #networks-container').height()) |
|
839 |
$('#networks-pane .confirm_multiple').addClass('fixed'); |
|
840 |
else |
|
841 |
$('#networks-pane .confirm_multiple').removeClass('fixed'); |
|
325 | 842 |
}); |
843 |
|
|
844 |
// basic functions executed on page load |
|
845 |
// hide the all of the networks contents |
|
846 |
$("#networks-pane .network-contents").hide(); |
|
847 |
// hide the all of the firewall contents |
|
848 |
$("#networks-pane .firewall-content").hide(); |
|
849 |
changes_since = 0; // to reload full list of servers |
|
850 |
networks_changes_since= 0; // to reload full list of networks |
|
851 |
// there is alway one public network to render |
|
852 |
var pubNet = $("#networks-pane #public-template").clone().attr("id", "pub").fadeIn("slow"); |
|
853 |
pubNet.appendTo("#networks-pane .public-networks"); |
|
854 |
update_networks(UPDATE_INTERVAL); |
|
855 |
|
|
326 | 856 |
</script> |
Also available in: Unified diff