mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Bug #1873: Show only one alert for multiple instantations
This commit is contained in:
parent
64be7f77b6
commit
5942896c8c
@ -316,10 +316,18 @@ var template_actions = {
|
||||
},
|
||||
|
||||
"Template.instantiate" : {
|
||||
type: "multiple",
|
||||
call: OpenNebula.Template.instantiate,
|
||||
elements: templateElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Template.instantiate_quiet" : {
|
||||
type: "single",
|
||||
call: OpenNebula.Template.instantiate,
|
||||
error: onError,
|
||||
notify: true
|
||||
notify: false
|
||||
},
|
||||
|
||||
"Template.instantiate_vms" : {
|
||||
@ -332,9 +340,7 @@ var template_actions = {
|
||||
}
|
||||
else
|
||||
{
|
||||
$.each(nodes,function(){
|
||||
Sunstone.runAction("Template.instantiate",this,"");
|
||||
});
|
||||
Sunstone.runAction("Template.instantiate", nodes);
|
||||
}
|
||||
|
||||
Sunstone.runAction("VM.refresh");
|
||||
@ -4379,22 +4385,29 @@ function setupInstantiateTemplateDialog(){
|
||||
n_times_int=parseInt(n_times,10);
|
||||
};
|
||||
|
||||
var extra_info = "";
|
||||
if (n_times_int > 1) {
|
||||
extra_info = n_times_int+" times";
|
||||
}
|
||||
|
||||
notifySubmit("Template.instantiate",template_id, extra_info);
|
||||
|
||||
if (!vm_name.length){ //empty name use OpenNebula core default
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
Sunstone.runAction("Template.instantiate", template_id, "");
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, "");
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm_name.indexOf("%i") == -1){//no wildcard, all with the same name
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
Sunstone.runAction("Template.instantiate", template_id, vm_name);
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, vm_name);
|
||||
};
|
||||
} else { //wildcard present: replace wildcard
|
||||
var name = "";
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
name = vm_name.replace(/%i/gi,i);
|
||||
Sunstone.runAction("Template.instantiate", template_id, name);
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, name);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ var vm_actions = {
|
||||
"VM.create" : {
|
||||
type: "custom",
|
||||
call: function(id,name) {
|
||||
Sunstone.runAction("Template.instantiate",id,name);
|
||||
Sunstone.runAction("Template.instantiate",[id],name);
|
||||
Sunstone.runAction("VM.list");
|
||||
},
|
||||
callback: addVMachineElement,
|
||||
@ -2950,22 +2950,29 @@ function setupCreateVMDialog(){
|
||||
n_times_int=parseInt(n_times,10);
|
||||
};
|
||||
|
||||
var extra_info = "";
|
||||
if (n_times_int > 1) {
|
||||
extra_info = n_times_int+" times";
|
||||
}
|
||||
|
||||
notifySubmit("Template.instantiate",template_id, extra_info);
|
||||
|
||||
if (!vm_name.length){ //empty name use OpenNebula core default
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
Sunstone.runAction("Template.instantiate", template_id, "");
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, "");
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm_name.indexOf("%i") == -1){ //no wildcard
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
Sunstone.runAction("Template.instantiate", template_id, vm_name);
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, vm_name);
|
||||
};
|
||||
} else { //wildcard present: replace wildcard
|
||||
var name = "";
|
||||
for (var i=0; i< n_times_int; i++){
|
||||
name = vm_name.replace(/%i/gi,i);
|
||||
Sunstone.runAction("Template.instantiate", template_id, name);
|
||||
Sunstone.runAction("Template.instantiate_quiet", template_id, name);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user