root / ui / templates / standard.html @ c5ffb0de
History | View | Annotate | Download (13.9 kB)
1 | 42f67a2a | Dimitris Moraitis | {% load i18n %} |
---|---|---|---|
2 | 42f67a2a | Dimitris Moraitis | |
3 | 42f67a2a | Dimitris Moraitis | <!-- the standard view -->
|
4 | 42f67a2a | Dimitris Moraitis | <div id="machinesview" class="standard"> |
5 | 6902f72e | clopy | <div id="emptymachineslist"><h1 id="welcomeheader">{% trans "Welcome to the ocean!" %}</h1><br /> |
6 | 09ec6db2 | clopy | <span class="welcomebody">{% trans "From this panel you will be able to manage your Virtual Machines (VMs). If you don't know what a VM is: take the " %}<a href="#">{% trans "tour" %}</a>.</span><br /><br /> |
7 | 09ec6db2 | clopy | <span class="welcomebody">{% trans "The panel is currently empty, because you don't have any VMs yet. You can start by creating your new VM by clicking the blue button on the right. The wizard will guide you through the hole process." %}</span><br /><br /> |
8 | 5ef04f85 | Constantinos Venetsanopoulos | <span class="welcomefooter">{% trans "For more information or help, click " %}<a href="#">{% trans "here" %}</a>.</span> |
9 | 6902f72e | clopy | </div>
|
10 | 42f67a2a | Dimitris Moraitis | <div id="spinner"></div> |
11 | 42f67a2a | Dimitris Moraitis | <div class="machine" id="machine-template" style="display:none"> |
12 | 6d0a36e5 | Dimitris Moraitis | <div class="actions"> |
13 | 6d0a36e5 | Dimitris Moraitis | <a href="#" class="action-start">{% trans "Start" %}</a> |
14 | 6d0a36e5 | Dimitris Moraitis | <a href="#" class="action-reboot">{% trans "Reboot" %}</a> |
15 | 6d0a36e5 | Dimitris Moraitis | <a href="#" class="action-shutdown">{% trans "Shutdown" %}</a> |
16 | f3632e8d | Christodoulos Psaltis | <a href="#" class="action-destroy">{% trans "Destroy" %}</a> |
17 | 6d0a36e5 | Dimitris Moraitis | </div>
|
18 | 42f67a2a | Dimitris Moraitis | <div class="state"> |
19 | 42f67a2a | Dimitris Moraitis | <div class="status">{% trans "Running" %}</div> |
20 | 42f67a2a | Dimitris Moraitis | <div class="indicator"></div> |
21 | 42f67a2a | Dimitris Moraitis | <div class="indicator"></div> |
22 | 42f67a2a | Dimitris Moraitis | <div class="indicator"></div> |
23 | 42f67a2a | Dimitris Moraitis | <div class="indicator"></div> |
24 | 1d72dcdc | Markos Gogoulos | <img class="spinner" style="display:none" src="/static/progress.gif" /> |
25 | 1d72dcdc | Markos Gogoulos | <img class="wave" style="display:none" src="/static/wave.gif" /> |
26 | 42f67a2a | Dimitris Moraitis | </div>
|
27 | 42f67a2a | Dimitris Moraitis | <img class="logo" src="" /> |
28 | 42f67a2a | Dimitris Moraitis | <a href="#" class="name"> |
29 | 528a931a | Christodoulos Psaltis | <h5>{% trans "Name: " %}<span class="name">node.name</span><span class="rename"></span></h5> |
30 | 42f67a2a | Dimitris Moraitis | </a>
|
31 | 42f67a2a | Dimitris Moraitis | <a href="#" class="ip"> |
32 | 528a931a | Christodoulos Psaltis | <h5>{% trans "IP: " %}<span class="public">node.public_ip</span></h5> |
33 | 42f67a2a | Dimitris Moraitis | </a>
|
34 | 42f67a2a | Dimitris Moraitis | <h5 class="settings"> |
35 | 42f67a2a | Dimitris Moraitis | {% trans "Show:" %} <a href="#">{% trans "disks" %}</a> | <a href="#">{% trans "networks" %}</a> | <a href="#">{% trans "group" %}</a> |
36 | 42f67a2a | Dimitris Moraitis | </h5>
|
37 | 6d0a36e5 | Dimitris Moraitis | |
38 | 267403ca | Dimitris Moraitis | <div class="confirm_single"> |
39 | c2464ef2 | Christodoulos Psaltis | <button class="yes">{% trans "Confirm" %}</button> |
40 | c2464ef2 | Christodoulos Psaltis | <button class="no">{% trans "Cancel" %}</button> |
41 | 31343277 | Christodoulos Psaltis | </div>
|
42 | 695e1b21 | Dimitris Moraitis | <div class="action_error" align="center"> |
43 | 528a931a | Christodoulos Psaltis | {% trans "<span class='orange'>Error</span> on" %} <span class="action">{% trans "error action" %}</span> |
44 | 038383b1 | Dimitris Moraitis | <span class="code"></span> |
45 | 695e1b21 | Dimitris Moraitis | <span class="message"></span> |
46 | 528a931a | Christodoulos Psaltis | <button class="details">{% trans "Details" %}</button> |
47 | 879748ec | Markos Gogoulos | </div>
|
48 | c2464ef2 | Christodoulos Psaltis | <div class="separator"></div> |
49 | 42f67a2a | Dimitris Moraitis | </div>
|
50 | 42f67a2a | Dimitris Moraitis | |
51 | 42f67a2a | Dimitris Moraitis | <div class="running"></div> |
52 | e5b0ba20 | Vangelis Koukis | <div id="mini" class="separator"></div> |
53 | 42f67a2a | Dimitris Moraitis | <div class="terminated"></div> |
54 | 42f67a2a | Dimitris Moraitis | </div>
|
55 | 42f67a2a | Dimitris Moraitis | |
56 | 42f67a2a | Dimitris Moraitis | <script>
|
57 | 990772be | Dimitris Moraitis |
|
58 | 42f67a2a | Dimitris Moraitis | // intercept reboot click
|
59 | 42f67a2a | Dimitris Moraitis | $("div.actions a.action-reboot").live('click', function(){
|
60 | 42f67a2a | Dimitris Moraitis | var serverID = $(this).parent().parent().attr("id");
|
61 | 42f67a2a | Dimitris Moraitis | var serverName = $(this).parent().prevAll("a.name").find("span.name").text();
|
62 | 267403ca | Dimitris Moraitis | var found = false;
|
63 | 695e1b21 | Dimitris Moraitis |
|
64 | aa0534a7 | Dimitris Moraitis | $(this).parent().children('a').removeClass('selected');
|
65 | aa0534a7 | Dimitris Moraitis | $(this).addClass('selected');
|
66 | 695e1b21 | Dimitris Moraitis | $(this).parent().addClass('display');
|
67 | 695e1b21 | Dimitris Moraitis | $(this).parent().parent().find('.action_error').hide();
|
68 | 267403ca | Dimitris Moraitis | for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
|
69 | 267403ca | Dimitris Moraitis | if (pending_actions[i][1]==serverID){
|
70 | 267403ca | Dimitris Moraitis | pending_actions[i][0] = reboot;
|
71 | 267403ca | Dimitris Moraitis | found = true
|
72 | 267403ca | Dimitris Moraitis | }
|
73 | 267403ca | Dimitris Moraitis | }
|
74 | 267403ca | Dimitris Moraitis | if (!found) // no pending action for this server was found, so let's just add it to the list
|
75 | 267403ca | Dimitris Moraitis | pending_actions.push([reboot, serverID, serverName])
|
76 | 267403ca | Dimitris Moraitis | update_confirmations();
|
77 | 42f67a2a | Dimitris Moraitis | return false;
|
78 | 42f67a2a | Dimitris Moraitis | });
|
79 | 42f67a2a | Dimitris Moraitis | |
80 | 42f67a2a | Dimitris Moraitis | // intercept shutdown click
|
81 | 42f67a2a | Dimitris Moraitis | $("div.actions a.action-shutdown").live('click', function(){
|
82 | 42f67a2a | Dimitris Moraitis | var serverID = $(this).parent().parent().attr("id");
|
83 | 42f67a2a | Dimitris Moraitis | var serverName = $(this).parent().prevAll("a.name").find("span.name").text();
|
84 | 267403ca | Dimitris Moraitis | var found = false;
|
85 | aa0534a7 | Dimitris Moraitis | $(this).parent().children('a').removeClass('selected');
|
86 | aa0534a7 | Dimitris Moraitis | $(this).addClass('selected');
|
87 | aa0534a7 | Dimitris Moraitis | $(this).parent().addClass('display')
|
88 | 695e1b21 | Dimitris Moraitis | $(this).parent().parent().find('.action_error').hide();
|
89 | aa0534a7 | Dimitris Moraitis | |
90 | 267403ca | Dimitris Moraitis | for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
|
91 | 267403ca | Dimitris Moraitis | if (pending_actions[i][1]==serverID){
|
92 | 267403ca | Dimitris Moraitis | pending_actions[i][0] = shutdown;
|
93 | 267403ca | Dimitris Moraitis | found = true
|
94 | 267403ca | Dimitris Moraitis | }
|
95 | 267403ca | Dimitris Moraitis | }
|
96 | 267403ca | Dimitris Moraitis | if (!found) // no pending action for this server was found, so let's just add it to the list
|
97 | 267403ca | Dimitris Moraitis | pending_actions.push([shutdown, serverID, serverName])
|
98 | 267403ca | Dimitris Moraitis | update_confirmations();
|
99 | 42f67a2a | Dimitris Moraitis | return false;
|
100 | 42f67a2a | Dimitris Moraitis | });
|
101 | eae0a59a | Dimitris Moraitis | |
102 | 42f67a2a | Dimitris Moraitis | // intercept start click
|
103 | 42f67a2a | Dimitris Moraitis | $("div.actions a.action-start").live('click', function(){
|
104 | 42f67a2a | Dimitris Moraitis | var serverID = $(this).parent().parent().attr("id");
|
105 | 42f67a2a | Dimitris Moraitis | var serverName = $(this).parent().prevAll("a.name").find("span.name").text();
|
106 | 267403ca | Dimitris Moraitis | var found = false;
|
107 | aa0534a7 | Dimitris Moraitis | $(this).parent().children('a').removeClass('selected');
|
108 | aa0534a7 | Dimitris Moraitis | $(this).addClass('selected');
|
109 | aa0534a7 | Dimitris Moraitis | $(this).parent().addClass('display')
|
110 | 695e1b21 | Dimitris Moraitis | $(this).parent().parent().find('.action_error').hide();
|
111 | 695e1b21 | Dimitris Moraitis | |
112 | 267403ca | Dimitris Moraitis | for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
|
113 | 267403ca | Dimitris Moraitis | if (pending_actions[i][1]==serverID){
|
114 | 267403ca | Dimitris Moraitis | pending_actions[i][0] = start;
|
115 | 267403ca | Dimitris Moraitis | found = true
|
116 | 267403ca | Dimitris Moraitis | }
|
117 | 267403ca | Dimitris Moraitis | }
|
118 | 267403ca | Dimitris Moraitis | if (!found) // no pending action for this server was found, so let's just add it to the list
|
119 | 267403ca | Dimitris Moraitis | pending_actions.push([start, serverID, serverName])
|
120 | 267403ca | Dimitris Moraitis | update_confirmations();
|
121 | 267403ca | Dimitris Moraitis | return false;
|
122 | 267403ca | Dimitris Moraitis | });
|
123 | 267403ca | Dimitris Moraitis | |
124 | f3632e8d | Christodoulos Psaltis | // intercept destroy click
|
125 | f3632e8d | Christodoulos Psaltis | $("div.actions a.action-destroy").live('click', function(){
|
126 | f3632e8d | Christodoulos Psaltis | var serverID = $(this).parent().parent().attr("id");
|
127 | f3632e8d | Christodoulos Psaltis | var serverName = $(this).parent().prevAll("a.name").find("span.name").text();
|
128 | f3632e8d | Christodoulos Psaltis | var found = false;
|
129 | f3632e8d | Christodoulos Psaltis | $(this).parent().children('a').removeClass('selected');
|
130 | f3632e8d | Christodoulos Psaltis | $(this).addClass('selected');
|
131 | f3632e8d | Christodoulos Psaltis | $(this).parent().addClass('display')
|
132 | f3632e8d | Christodoulos Psaltis | $(this).parent().parent().find('.action_error').hide();
|
133 | f3632e8d | Christodoulos Psaltis | |
134 | f3632e8d | Christodoulos Psaltis | for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it
|
135 | f3632e8d | Christodoulos Psaltis | if (pending_actions[i][1]==serverID){
|
136 | c5ffb0de | Christodoulos Psaltis | pending_actions[i][0] = destroy;
|
137 | f3632e8d | Christodoulos Psaltis | found = true
|
138 | f3632e8d | Christodoulos Psaltis | }
|
139 | f3632e8d | Christodoulos Psaltis | }
|
140 | f3632e8d | Christodoulos Psaltis | if (!found) // no pending action for this server was found, so let's just add it to the list
|
141 | f3632e8d | Christodoulos Psaltis | pending_actions.push([destroy, serverID, serverName])
|
142 | f3632e8d | Christodoulos Psaltis | update_confirmations();
|
143 | f3632e8d | Christodoulos Psaltis | return false;
|
144 | f3632e8d | Christodoulos Psaltis | });
|
145 | f3632e8d | Christodoulos Psaltis | |
146 | 267403ca | Dimitris Moraitis | $("div.confirm_single .yes").live('click', function(){
|
147 | 267403ca | Dimitris Moraitis | var serverID = $(this).parent().parent().attr("id");
|
148 | 267403ca | Dimitris Moraitis | for (i=0;i<pending_actions.length;i++){ // if there is a pending action for this server execute it
|
149 | 267403ca | Dimitris Moraitis | if (pending_actions[i][1]==serverID){
|
150 | a1a31201 | Dimitris Moraitis | action = pending_actions.splice(i,1)[0]; // extract action
|
151 | a1a31201 | Dimitris Moraitis | action[0]([action[1]]); // execute action
|
152 | 267403ca | Dimitris Moraitis | }
|
153 | 267403ca | Dimitris Moraitis | }
|
154 | 267403ca | Dimitris Moraitis | $(this).parent().hide();
|
155 | aa0534a7 | Dimitris Moraitis | $(this).parent().parent().children('div.actions').children('a').removeClass('selected');
|
156 | aa0534a7 | Dimitris Moraitis | $(this).parent().parent().children('.state').children('.spinner').show()
|
157 | aa0534a7 | Dimitris Moraitis | $(this).parent().parent().children('div.actions').removeClass('display');
|
158 | 3d286f84 | Dimitris Moraitis | update_confirmations();
|
159 | 42f67a2a | Dimitris Moraitis | return false;
|
160 | 42f67a2a | Dimitris Moraitis | });
|
161 | 42f67a2a | Dimitris Moraitis | |
162 | 267403ca | Dimitris Moraitis | $("div.confirm_single .no").live('click', function(){
|
163 | 267403ca | Dimitris Moraitis | // remove the action from the pending list
|
164 | 267403ca | Dimitris Moraitis | var serverID = $(this).parent().parent().attr("id");
|
165 | aa0534a7 | Dimitris Moraitis |
|
166 | aa0534a7 | Dimitris Moraitis | $(this).parent().parent().children('div.actions').children('a').removeClass('selected');
|
167 | aa0534a7 | Dimitris Moraitis | $(this).parent().parent().children('div.actions').removeClass('display');
|
168 | 267403ca | Dimitris Moraitis | for (i=0;i<pending_actions.length;i++){ // if there is a pending action for this server remove it
|
169 | 267403ca | Dimitris Moraitis | if (pending_actions[i][1]==serverID){
|
170 | 267403ca | Dimitris Moraitis | pending_actions.splice(i,1);
|
171 | 267403ca | Dimitris Moraitis | }
|
172 | 267403ca | Dimitris Moraitis | }
|
173 | 267403ca | Dimitris Moraitis | $(this).parent().hide();
|
174 | 3d286f84 | Dimitris Moraitis | update_confirmations();
|
175 | 267403ca | Dimitris Moraitis | return false;
|
176 | 267403ca | Dimitris Moraitis | });
|
177 | 267403ca | Dimitris Moraitis | |
178 | 695e1b21 | Dimitris Moraitis | $("div.action_error .details").live('click', function(){
|
179 | 695e1b21 | Dimitris Moraitis | // remove the action from the pending list
|
180 | 038383b1 | Dimitris Moraitis | ajax_error($(this).parent().children('.code').text(), undefined, $(this).parent().children('.action').text(), $(this).parent().children('.message').text());
|
181 | 695e1b21 | Dimitris Moraitis | $(this).parent().hide();
|
182 | 695e1b21 | Dimitris Moraitis | });
|
183 | 695e1b21 | Dimitris Moraitis | |
184 | 695e1b21 | Dimitris Moraitis | |
185 | eae0a59a | Dimitris Moraitis | // update the servers list
|
186 | eae0a59a | Dimitris Moraitis | function update_machines_view(data){
|
187 | eae0a59a | Dimitris Moraitis | /*
|
188 | 1a49199e | Dimitris Moraitis | Go through the servers in the input data. Update existing entries, add
|
189 | eae0a59a | Dimitris Moraitis | new ones to the list
|
190 | eae0a59a | Dimitris Moraitis | */
|
191 | 7e45ddef | Dimitris Moraitis | $.each(data.servers.values, function(i,server){
|
192 | 150eb972 | Christodoulos Psaltis | existing = $('#' + server.id);
|
193 | eae0a59a | Dimitris Moraitis |
|
194 | 87feccc4 | Dimitris Moraitis | // if multiple machines exist in the DOM, delete all but one
|
195 | 87feccc4 | Dimitris Moraitis | // defensive coding - that shouldn't happen normally
|
196 | 87feccc4 | Dimitris Moraitis | while (existing.length > 1){
|
197 | eae0a59a | Dimitris Moraitis | existing.remove();
|
198 | eae0a59a | Dimitris Moraitis | }
|
199 | eae0a59a | Dimitris Moraitis |
|
200 | 87feccc4 | Dimitris Moraitis | // server already exists in DOM
|
201 | 1a49199e | Dimitris Moraitis | if (existing.length){
|
202 | ab5282e4 | Dimitris Moraitis | $("div.machine:last-child").find("div.separator").show();
|
203 | ab5282e4 | Dimitris Moraitis | |
204 | 87feccc4 | Dimitris Moraitis | // if the status is deleted, delete it from the DOM
|
205 | 87feccc4 | Dimitris Moraitis | if (server.status == 'DELETED') {
|
206 | 1a49199e | Dimitris Moraitis | existing.remove();
|
207 | 81d48bff | Christodoulos Psaltis | try {
|
208 | 1a49199e | Dimitris Moraitis | console.info(existing.find("a.name span.name").text() + ' removed');
|
209 | 1a49199e | Dimitris Moraitis | } catch(err) {}
|
210 | 1a49199e | Dimitris Moraitis | } else if (existing.find(".status").text() != STATUS_MESSAGES[server.status]) {
|
211 | 1a49199e | Dimitris Moraitis |
|
212 | 1a49199e | Dimitris Moraitis | try { // firebug console logging
|
213 | 150eb972 | Christodoulos Psaltis | console.info(existing.find("a.name span.name").text() + ' from '
|
214 | 150eb972 | Christodoulos Psaltis | + existing.find(".status").text() + ' to ' + STATUS_MESSAGES[server.status]);
|
215 | 81d48bff | Christodoulos Psaltis | } catch(err) {}
|
216 | 1a49199e | Dimitris Moraitis |
|
217 | 1a49199e | Dimitris Moraitis | if (['BUILD','ACTIVE','REBOOT'].indexOf(server.status) >= 0 &&
|
218 | 1a49199e | Dimitris Moraitis | [STATUS_MESSAGES['STOPPED'], STATUS_MESSAGES['ERROR']].indexOf(existing.find(".status").text()) >= 0) {
|
219 | 1a49199e | Dimitris Moraitis | // from stopped to running
|
220 | 1a49199e | Dimitris Moraitis | moved = existing.clone().appendTo(".running");
|
221 | 1a49199e | Dimitris Moraitis | moved.find("img.logo").attr("src","static/machines/"+image_tags[server.imageRef]+'.png');
|
222 | 1a49199e | Dimitris Moraitis | existing.remove();
|
223 | 1a49199e | Dimitris Moraitis | existing = moved;
|
224 | 1a49199e | Dimitris Moraitis | } else if (['STOPPED','ERROR'].indexOf(server.status) >= 0 &&
|
225 | 1a49199e | Dimitris Moraitis | [STATUS_MESSAGES['ACTIVE'], STATUS_MESSAGES['BUILD'], STATUS_MESSAGES['REBOOT']].indexOf(existing.find(".status").text()) >= 0) {
|
226 | 1a49199e | Dimitris Moraitis | moved = existing.clone().appendTo(".terminated");
|
227 | 1a49199e | Dimitris Moraitis | moved.find("img.logo").attr("src","static/machines/"+image_tags[server.imageRef]+'-off.png');
|
228 | 1a49199e | Dimitris Moraitis | existing.remove();
|
229 | 1a49199e | Dimitris Moraitis | existing = moved;
|
230 | 309d7ed2 | Dimitris Moraitis | }
|
231 | 309d7ed2 | Dimitris Moraitis | existing.find('.spinner').hide();
|
232 | 309d7ed2 | Dimitris Moraitis | existing.find(' .wave').attr('src','static/wave.gif').show();
|
233 | 309d7ed2 | Dimitris Moraitis | setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
|
234 | eae0a59a | Dimitris Moraitis | existing.find(".status").text(STATUS_MESSAGES[server.status]);
|
235 | 87feccc4 | Dimitris Moraitis |
|
236 | eae0a59a | Dimitris Moraitis | }
|
237 | eae0a59a | Dimitris Moraitis | existing.find("a.name span.name").text(server.name);
|
238 | 7e45ddef | Dimitris Moraitis | existing.find("a.ip span.public").text(String(server.addresses.values[0].values[0].addr).replace(',',' '));
|
239 | 87feccc4 | Dimitris Moraitis | } else if (server.status != 'DELETED') {
|
240 | 1a49199e | Dimitris Moraitis | // If it does not exist and it's not deleted, we should create it
|
241 | eae0a59a | Dimitris Moraitis | var machine = $("#machine-template").clone().attr("id", server.id).fadeIn("slow");
|
242 | eae0a59a | Dimitris Moraitis | machine.find("a.name span.name").text(server.name);
|
243 | b335768e | Markos Gogoulos | machine.find("img.logo").attr("src","static/machines/"+image_tags[server.imageRef]+'.png');
|
244 | b335768e | Markos Gogoulos | machine.find("span.imagetag").text(image_tags[server.imageRef]);
|
245 | 7e45ddef | Dimitris Moraitis | machine.find("a.ip span.public").text(String(server.addresses.values[0].values[0].addr).replace(',',' '));
|
246 | eae0a59a | Dimitris Moraitis | machine.find(".status").text(STATUS_MESSAGES[server.status]);
|
247 | eae0a59a | Dimitris Moraitis | if (['BUILD', 'ACTIVE', 'REBOOT'].indexOf(server.status) >= 0){
|
248 | eae0a59a | Dimitris Moraitis | machine.appendTo(".running");
|
249 | eae0a59a | Dimitris Moraitis | } else {
|
250 | b335768e | Markos Gogoulos | machine.find("img.logo").attr("src","static/machines/"+image_tags[server.imageRef]+'-off.png');
|
251 | eae0a59a | Dimitris Moraitis | machine.appendTo(".terminated");
|
252 | eae0a59a | Dimitris Moraitis | }
|
253 | 309d7ed2 | Dimitris Moraitis | //machine.find(' .wave').attr('src','static/wave.gif').show();
|
254 | 309d7ed2 | Dimitris Moraitis | //setTimeout("$('#" + server.id +" .wave').attr('src','').hide()", 3000);
|
255 | eae0a59a | Dimitris Moraitis | }
|
256 | eae0a59a | Dimitris Moraitis | });
|
257 | eae0a59a | Dimitris Moraitis | |
258 | eae0a59a | Dimitris Moraitis | $("#spinner").hide();
|
259 | ed81826a | Christodoulos Psaltis | // show all separators
|
260 | ed81826a | Christodoulos Psaltis | $("div.machine div.separator").show();
|
261 | ed81826a | Christodoulos Psaltis | // hide the last one
|
262 | e5b0ba20 | Vangelis Koukis | $("div.machine:last-child").find("div.separator").hide();
|
263 | e5b0ba20 | Vangelis Koukis | // the separator shows only when running and terminated machines are available
|
264 | c58db69b | Christodoulos Psaltis | if ($(".terminated a.name").length > 0 && $(".running a.name").length > 0) {
|
265 | e5b0ba20 | Vangelis Koukis | $("#mini.separator").fadeIn("slow");
|
266 | e5b0ba20 | Vangelis Koukis | } else {
|
267 | e5b0ba20 | Vangelis Koukis | $("#mini.separator").fadeOut("slow");
|
268 | eae0a59a | Dimitris Moraitis | }
|
269 | 6902f72e | clopy | |
270 | 935bb83f | Markos Gogoulos | // show message in case user has no servers!
|
271 | 935bb83f | Markos Gogoulos | if (servers.length == 0) {
|
272 | 6902f72e | clopy | showWelcome()
|
273 | 6902f72e | clopy | } else {
|
274 | 6902f72e | clopy | hideWelcome()
|
275 | 6902f72e | clopy | }
|
276 | 309d7ed2 | Dimitris Moraitis |
|
277 | 309d7ed2 | Dimitris Moraitis | // set confirm box position
|
278 | 82bf6df0 | Dimitris Moraitis | if (window.innerHeight - 220 < $('#machinesview').height())
|
279 | 309d7ed2 | Dimitris Moraitis | $('.confirm_multiple').addClass('fixed');
|
280 | 309d7ed2 | Dimitris Moraitis | else
|
281 | 309d7ed2 | Dimitris Moraitis | $('.confirm_multiple').removeClass('fixed');
|
282 | eae0a59a | Dimitris Moraitis | }
|
283 | eae0a59a | Dimitris Moraitis | |
284 | a1a31201 | Dimitris Moraitis | // indicate that the requested action was succesfully completed
|
285 | a1a31201 | Dimitris Moraitis | function display_success(serverID) {
|
286 | 6d0a36e5 | Dimitris Moraitis | |
287 | a1a31201 | Dimitris Moraitis | }
|
288 | a1a31201 | Dimitris Moraitis | |
289 | 879748ec | Markos Gogoulos | // indicate that the requested action was not completed
|
290 | 038383b1 | Dimitris Moraitis | function display_failure(status, serverID, action, responseText) {
|
291 | 879748ec | Markos Gogoulos | $('#'+serverID+ ' .spinner').hide();
|
292 | 879748ec | Markos Gogoulos | $('#'+serverID+ ' .action_error .action').text(action);
|
293 | 038383b1 | Dimitris Moraitis | $('#'+serverID+ ' .action_error .code').text(status);
|
294 | 038383b1 | Dimitris Moraitis | $('#'+serverID+ ' .action_error .message').text(responseText);
|
295 | 879748ec | Markos Gogoulos | $('#'+serverID+ ' .action_error').show();
|
296 | 695e1b21 | Dimitris Moraitis |
|
297 | 879748ec | Markos Gogoulos | }
|
298 | 879748ec | Markos Gogoulos | |
299 | 146b6003 | Dimitris Moraitis | if (images.length == 0) {
|
300 | 146b6003 | Dimitris Moraitis | // populate image list
|
301 | 146b6003 | Dimitris Moraitis | update_images();
|
302 | 146b6003 | Dimitris Moraitis | }
|
303 | 146b6003 | Dimitris Moraitis | if (flavors.length == 0) {
|
304 | 146b6003 | Dimitris Moraitis | // configure flavors
|
305 | 146b6003 | Dimitris Moraitis | update_flavors();
|
306 | 146b6003 | Dimitris Moraitis | }
|
307 | c53d09e2 | Christodoulos Psaltis | // set the label of the multiple buttons
|
308 | c53d09e2 | Christodoulos Psaltis | $('div.confirm_multiple button.yes').text('Confirm All');
|
309 | c53d09e2 | Christodoulos Psaltis | $('div.confirm_multiple button.no').text('Cancel All');
|
310 | 82bf6df0 | Dimitris Moraitis | |
311 | 82bf6df0 | Dimitris Moraitis | // reposition multiple confirmation box on window resize
|
312 | 82bf6df0 | Dimitris Moraitis | $(window).resize(function(){
|
313 | 82bf6df0 | Dimitris Moraitis | if (this.innerHeight - 220 < $('#machinesview').height())
|
314 | 82bf6df0 | Dimitris Moraitis | $('.confirm_multiple').addClass('fixed');
|
315 | 82bf6df0 | Dimitris Moraitis | else
|
316 | 82bf6df0 | Dimitris Moraitis | $('.confirm_multiple').removeClass('fixed');
|
317 | 82bf6df0 | Dimitris Moraitis | });
|
318 | 82bf6df0 | Dimitris Moraitis | |
319 | c53d09e2 | Christodoulos Psaltis | // start updating vm list
|
320 | 146b6003 | Dimitris Moraitis | update_vms(UPDATE_INTERVAL);
|
321 | 2ed4ced5 | Markos Gogoulos | </script> |