Revision b13b401f
b/ui/templates/machines_single.html | ||
---|---|---|
241 | 241 |
$("#machinesview-single.single div.action-start").live('click', function(){ |
242 | 242 |
var serverID = $(this).closest(".single-container").attr("id"); |
243 | 243 |
var serverName = $(this).closest("div.upper").find(".machine-details div.name").text(); |
244 |
var found = false; |
|
245 |
$(this).closest('div.single-actions').children('div.single-action').removeClass('selected'); |
|
244 |
$('#machinesview-single').find('div.single-action').removeClass('selected'); |
|
246 | 245 |
$(this).addClass('selected'); |
247 | 246 |
$(this).parent().parent().find('.action_error').hide(); |
248 |
// if there is already a pending action for this server replace it |
|
249 |
for (i=0; i<pending_actions.length; i++) { |
|
250 |
if (pending_actions[i][1] == serverID) { |
|
251 |
pending_actions[i][0] = start; |
|
252 |
found = true |
|
253 |
} |
|
254 |
} |
|
255 |
// no pending action for this server was found, so let's just add it to the list |
|
256 |
if (!found) |
|
257 |
pending_actions.push([start, serverID, serverName]) |
|
258 |
update_confirmations() |
|
247 |
// reset pending actions so not to allow multiple actions in this view |
|
248 |
pending_actions = []; |
|
249 |
pending_actions.push([start, serverID, serverName]); |
|
250 |
update_confirmations(); |
|
259 | 251 |
return false; |
260 | 252 |
}); |
261 | 253 |
|
... | ... | |
263 | 255 |
$("#machinesview-single.single div.action-shutdown").live('click', function(){ |
264 | 256 |
var serverID = $(this).closest(".single-container").attr("id"); |
265 | 257 |
var serverName = $(this).closest("div.upper").find(".machine-details div.name").text(); |
266 |
var found = false; |
|
267 |
$(this).closest('div.single-actions').children('div.single-action').removeClass('selected'); |
|
258 |
$('#machinesview-single').find('div.single-action').removeClass('selected'); |
|
268 | 259 |
$(this).addClass('selected'); |
269 | 260 |
$(this).parent().parent().find('.action_error').hide(); |
270 |
// if there is already a pending action for this server replace it |
|
271 |
for (i=0; i<pending_actions.length; i++) { |
|
272 |
if (pending_actions[i][1] == serverID) { |
|
273 |
pending_actions[i][0] = shutdown; |
|
274 |
found = true |
|
275 |
} |
|
276 |
} |
|
277 |
// no pending action for this server was found, so let's just add it to the list |
|
278 |
if (!found) |
|
279 |
pending_actions.push([shutdown, serverID, serverName]) |
|
261 |
// reset pending actions so not to allow multiple actions in this view |
|
262 |
pending_actions = []; |
|
263 |
pending_actions.push([shutdown, serverID, serverName]); |
|
280 | 264 |
update_confirmations(); |
281 | 265 |
return false; |
282 | 266 |
}); |
... | ... | |
285 | 269 |
$("#machinesview-single.single div.action-reboot").live('click', function(){ |
286 | 270 |
var serverID = $(this).closest(".single-container").attr("id"); |
287 | 271 |
var serverName = $(this).closest("div.upper").find(".machine-details div.name").text(); |
288 |
var found = false; |
|
289 |
$(this).closest('div.single-actions').children('div.single-action').removeClass('selected'); |
|
272 |
$('#machinesview-single').find('div.single-action').removeClass('selected'); |
|
290 | 273 |
$(this).addClass('selected'); |
291 | 274 |
$(this).parent().parent().find('.action_error').hide(); |
292 |
// if there is already a pending action for this server replace it |
|
293 |
for (i=0; i<pending_actions.length; i++) { |
|
294 |
if (pending_actions[i][1] == serverID) { |
|
295 |
pending_actions[i][0] = reboot; |
|
296 |
found = true |
|
297 |
} |
|
298 |
} |
|
299 |
// no pending action for this server was found, so let's just add it to the list |
|
300 |
if (!found) |
|
301 |
pending_actions.push([reboot, serverID, serverName]) |
|
275 |
// reset pending actions so not to allow multiple actions in this view |
|
276 |
pending_actions = []; |
|
277 |
pending_actions.push([reboot, serverID, serverName]); |
|
302 | 278 |
update_confirmations(); |
303 | 279 |
return false; |
304 | 280 |
}); |
... | ... | |
307 | 283 |
$("#machinesview-single.single div.action-destroy").live('click', function(){ |
308 | 284 |
var serverID = $(this).closest(".single-container").attr("id"); |
309 | 285 |
var serverName = $(this).closest("div.upper").find(".machine-details div.name").text(); |
310 |
var found = false; |
|
311 |
$(this).closest('div.single-actions').children('div.single-action').removeClass('selected'); |
|
286 |
$('#machinesview-single').find('div.single-action').removeClass('selected'); |
|
312 | 287 |
$(this).addClass('selected'); |
313 | 288 |
$(this).parent().parent().find('.action_error').hide(); |
314 |
// if there is already a pending action for this server replace it |
|
315 |
for (i=0; i<pending_actions.length; i++) { |
|
316 |
if (pending_actions[i][1] == serverID) { |
|
317 |
pending_actions[i][0] = destroy; |
|
318 |
found = true |
|
319 |
} |
|
320 |
} |
|
321 |
if (!found) // no pending action for this server was found, so let's just add it to the list |
|
322 |
pending_actions.push([destroy, serverID, serverName]) |
|
289 |
// reset pending actions so not to allow multiple actions in this view |
|
290 |
pending_actions = []; |
|
291 |
pending_actions.push([destroy, serverID, serverName]); |
|
323 | 292 |
update_confirmations(); |
324 | 293 |
return false; |
325 | 294 |
}); |
... | ... | |
328 | 297 |
$("#machinesview-single.single div.action-console").live('click', function(){ |
329 | 298 |
var serverID = $(this).closest(".single-container").attr("id"); |
330 | 299 |
var serverName = $(this).closest("div.upper").find(".machine-details div.name").text(); |
331 |
var found = false; |
|
332 |
$(this).closest('div.single-actions').children('div.single-action').removeClass('selected'); |
|
300 |
$('#machinesview-single').find('div.single-action').removeClass('selected'); |
|
333 | 301 |
$(this).addClass('selected'); |
334 | 302 |
$(this).parent().parent().find('.action_error').hide(); |
335 |
// if there is already a pending action for this server replace it |
|
336 |
for (i=0; i<pending_actions.length; i++) { |
|
337 |
if (pending_actions[i][1] == serverID) { |
|
338 |
pending_actions[i][0] = open_console; |
|
339 |
found = true |
|
340 |
} |
|
341 |
} |
|
342 |
// no pending action for this server was found, so let's just add it to the list |
|
343 |
if (!found) |
|
344 |
pending_actions.push([open_console, serverID, serverName]) |
|
303 |
// reset pending actions so not to allow multiple actions in this view |
|
304 |
pending_actions = []; |
|
305 |
pending_actions.push([open_console, serverID, serverName]); |
|
345 | 306 |
update_confirmations(); |
346 | 307 |
return false; |
347 | 308 |
}); |
... | ... | |
634 | 595 |
} |
635 | 596 |
|
636 | 597 |
//enable prev-next buttons |
637 |
$("#machinesview-single.single .column3 .previous").live('click', function(){ |
|
598 |
$("#machinesview-single.single .column3 .previous").live('click', function() { |
|
599 |
// set behavior |
|
638 | 600 |
if ($("#machinesview-single.single .column3 .selected").attr("id") == $("#machinesview-single.single .column3 .server-name:eq(1)").attr("id")) { |
639 | 601 |
return false; |
640 | 602 |
} else { |
... | ... | |
651 | 613 |
} |
652 | 614 |
}); |
653 | 615 |
|
654 |
$("#machinesview-single.single .column3 .next").live('click', function(){ |
|
616 |
$("#machinesview-single.single .column3 .next").live('click', function() { |
|
617 |
// set behavior |
|
655 | 618 |
if ($("#machinesview-single.single .column3 .selected").attr("id") == $("#machinesview-single.single .column3 .server-name:last").attr("id")) { |
656 | 619 |
return false; |
657 | 620 |
} else { |
Also available in: Unified diff