0001-Bug-587-Fix.patch
src/sunstone/public/js/plugins/hosts-tab.js | ||
---|---|---|
416 | 416 |
//updates the host select by refreshing the options in it |
417 | 417 |
function updateHostSelect(){ |
418 | 418 | |
419 |
hosts_select = makeSelectOptions(dataTable_hosts,1,2,7,"DISABLED"); |
|
419 |
hosts_select = makeSelectOptions(dataTable_hosts,1,2,7,"DISABLED",-1);
|
|
420 | 420 | |
421 | 421 |
} |
422 | 422 |
src/sunstone/public/js/plugins/images-tab.js | ||
---|---|---|
474 | 474 | |
475 | 475 |
//Updates the select input field with an option for each image |
476 | 476 |
function updateImageSelect(){ |
477 |
images_select = makeSelectOptions(dataTable_images,1,3,8,"DISABLED"); |
|
477 |
images_select = |
|
478 |
makeSelectOptions(dataTable_images,1,3,8,"DISABLED",2); |
|
478 | 479 |
|
479 | 480 |
//update static selectors: |
480 | 481 |
//in the VM section |
... | ... | |
499 | 500 |
function addImageElement(request, image_json){ |
500 | 501 |
var element = imageElementArray(image_json); |
501 | 502 |
addElement(element,dataTable_images); |
502 |
//NOTE that the select is not updated because newly added images |
|
503 |
//are disabled by default |
|
503 |
updateImageSelect(); |
|
504 | 504 |
} |
505 | 505 | |
506 | 506 |
// Callback to refresh the list of images |
src/sunstone/public/js/plugins/templates-tab.js | ||
---|---|---|
750 | 750 | |
751 | 751 |
//Updates the select input field with an option for each template |
752 | 752 |
function updateTemplateSelect(){ |
753 |
templates_select = makeSelectOptions(dataTable_templates,1,3,5,"No"); |
|
753 |
templates_select = |
|
754 |
makeSelectOptions(dataTable_templates,1,3,5,"no",2); |
|
754 | 755 |
|
755 | 756 |
//update static selectors: |
756 | 757 |
$('#create_vm_dialog #template_id').html(templates_select); |
... | ... | |
774 | 775 |
function addTemplateElement(request, template_json){ |
775 | 776 |
var element = templateElementArray(template_json); |
776 | 777 |
addElement(element,dataTable_templates); |
777 |
//NOTE that the select is not updated because newly added templates |
|
778 |
//are not public |
|
778 |
updateTemplateSelect(); |
|
779 | 779 |
} |
780 | 780 | |
781 | 781 |
// Callback to refresh the list of templates |
src/sunstone/public/js/plugins/vnets-tab.js | ||
---|---|---|
308 | 308 | |
309 | 309 |
//updates the vnet select different options |
310 | 310 |
function updateNetworkSelect(){ |
311 |
vnetworks_select= makeSelectOptions(dataTable_vNetworks,1,3,6,"no") |
|
311 |
vnetworks_select= |
|
312 |
makeSelectOptions(dataTable_vNetworks,1,3,6,"no",2); |
|
312 | 313 | |
313 | 314 |
//update static selectors: |
314 | 315 |
//in the VM creation dialog |
src/sunstone/public/js/sunstone-util.js | ||
---|---|---|
313 | 313 |
//not defined then it returns "uid UID". |
314 | 314 |
//TODO not very nice to hardcode a dataTable here... |
315 | 315 |
function getUserName(uid){ |
316 |
var user = "uid "+uid;
|
|
316 |
var user = uid; |
|
317 | 317 |
if (typeof(dataTable_users) == "undefined") { |
318 | 318 |
return user; |
319 | 319 |
} |
... | ... | |
382 | 382 | |
383 | 383 |
//returns a HTML string with a select input code generated from |
384 | 384 |
//a dataTable |
385 |
function makeSelectOptions(dataTable,id_col,name_col,status_col,status_bad){ |
|
385 |
function makeSelectOptions(dataTable, |
|
386 |
id_col,name_col, |
|
387 |
status_col, |
|
388 |
status_bad, |
|
389 |
user_col){ |
|
386 | 390 |
var nodes = dataTable.fnGetData(); |
387 | 391 |
var select = "<option value=\"\">Please select</option>"; |
388 | 392 |
var array; |
... | ... | |
390 | 394 |
var id = this[id_col]; |
391 | 395 |
var name = this[name_col]; |
392 | 396 |
var status = this[status_col]; |
393 |
if (status != status_bad){ |
|
397 |
var user = user_col > 0 ? this[user_col] : false; |
|
398 |
var isMine = user ? (username == user) || (uid == user) : true; |
|
399 |
|
|
400 |
|
|
401 |
if ((status != status_bad) || isMine ){ |
|
394 | 402 |
select +='<option value="'+id+'">'+name+'</option>'; |
395 | 403 |
} |
396 | 404 |
}); |