Revision 738a9b18
b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js | ||
---|---|---|
1320 | 1320 |
}, |
1321 | 1321 |
|
1322 | 1322 |
// action helper |
1323 |
call: function(action_name, success, error) { |
|
1323 |
call: function(action_name, success, error, params) {
|
|
1324 | 1324 |
var id_param = [this.id]; |
1325 |
|
|
1325 |
|
|
1326 |
params = params || {}; |
|
1326 | 1327 |
success = success || function() {}; |
1327 | 1328 |
error = error || function() {}; |
1328 | 1329 |
|
... | ... | |
1339 | 1340 |
success.apply(this, arguments); |
1340 | 1341 |
snf.api.trigger("call"); |
1341 | 1342 |
}, |
1342 |
error, 'start'); |
|
1343 |
error, 'start', params);
|
|
1343 | 1344 |
break; |
1344 | 1345 |
case 'reboot': |
1345 | 1346 |
this.__make_api_call(this.get_action_url(), // vm actions url |
... | ... | |
1352 | 1353 |
snf.api.trigger("call"); |
1353 | 1354 |
self.set({'reboot_required': false}); |
1354 | 1355 |
}, |
1355 |
error, 'reboot'); |
|
1356 |
error, 'reboot', params);
|
|
1356 | 1357 |
break; |
1357 | 1358 |
case 'shutdown': |
1358 | 1359 |
this.__make_api_call(this.get_action_url(), // vm actions url |
... | ... | |
1364 | 1365 |
success.apply(this, arguments) |
1365 | 1366 |
snf.api.trigger("call"); |
1366 | 1367 |
}, |
1367 |
error, 'shutdown'); |
|
1368 |
error, 'shutdown', params);
|
|
1368 | 1369 |
break; |
1369 | 1370 |
case 'console': |
1370 | 1371 |
this.__make_api_call(this.url() + "/action", "create", {'console': {'type':'vnc'}}, function(data) { |
1371 | 1372 |
var cons_data = data.console; |
1372 | 1373 |
success.apply(this, [cons_data]); |
1373 |
}, undefined, 'console') |
|
1374 |
}, undefined, 'console', params)
|
|
1374 | 1375 |
break; |
1375 | 1376 |
case 'destroy': |
1376 | 1377 |
this.__make_api_call(this.url(), // vm actions url |
... | ... | |
1381 | 1382 |
self.state('DESTROY'); |
1382 | 1383 |
success.apply(this, arguments) |
1383 | 1384 |
}, |
1384 |
error, 'destroy'); |
|
1385 |
error, 'destroy', params);
|
|
1385 | 1386 |
break; |
1386 | 1387 |
default: |
1387 | 1388 |
throw "Invalid VM action ("+action_name+")"; |
1388 | 1389 |
} |
1389 | 1390 |
}, |
1390 | 1391 |
|
1391 |
__make_api_call: function(url, method, data, success, error, action) { |
|
1392 |
__make_api_call: function(url, method, data, success, error, action, extra_params) {
|
|
1392 | 1393 |
var self = this; |
1393 | 1394 |
error = error || function(){}; |
1394 | 1395 |
success = success || function(){}; |
... | ... | |
1406 | 1407 |
display: false, |
1407 | 1408 |
critical: false |
1408 | 1409 |
} |
1410 |
_.extend(params, extra_params) |
|
1409 | 1411 |
this.sync(method, this, params); |
1410 | 1412 |
}, |
1411 | 1413 |
|
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_vms_base_view.js | ||
---|---|---|
315 | 315 |
}, |
316 | 316 |
|
317 | 317 |
connect_to_console: function(vm) { |
318 |
// It seems that Safari allows popup windows only if the window.open |
|
319 |
// call is made within an html element click event context. |
|
320 |
// Otherwise its behaviour is based on "Block Pop-Up Windows" |
|
321 |
// setting, which when enabled no notification appears for the user. |
|
322 |
// Since there is no easy way to check for the setting value we use |
|
323 |
// async:false for the action call so that action success handler |
|
324 |
// which opens the new window is called inside the click event |
|
325 |
// context. |
|
326 |
var use_async = true; |
|
327 |
if ($.client.browser == "Safari") { |
|
328 |
use_async = false; |
|
329 |
} |
|
330 |
|
|
318 | 331 |
vm.call("console", function(console_data) { |
319 | 332 |
var url = vm.get_console_url(console_data); |
320 | 333 |
snf.util.open_window(url, "VM_" + vm.get("id") + "_CONSOLE", {}); |
321 |
})
|
|
334 |
}, undefined, {async: use_async});
|
|
322 | 335 |
} |
323 | 336 |
|
324 | 337 |
}); |
b/snf-cyclades-app/synnefo/ui/static/snf/js/utils.js | ||
---|---|---|
269 | 269 |
menubar: 'no', |
270 | 270 |
toolbar: 'no', |
271 | 271 |
status: 'no', |
272 |
top: 'no', |
|
273 |
left: 'no', |
|
274 | 272 |
height: screen.height, |
275 | 273 |
width: screen.width, |
276 | 274 |
fullscreen: 'yes', |
Also available in: Unified diff