1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #3748: Fix oneflow template instantiate

Again... this time when instantiate is called from the individual panel.
The template ID was undefined before
This commit is contained in:
Carlos Martín 2015-07-09 17:58:44 +02:00
parent dc669bbfb7
commit 0adaf76875
2 changed files with 15 additions and 23 deletions

View File

@ -120,8 +120,13 @@ define(function(require) {
return false;
}
var templateId = "" + selected_nodes[0];
Sunstone.resetFormPanel(TAB_ID, INSTANTIATE_DIALOG_ID);
Sunstone.showFormPanel(TAB_ID, INSTANTIATE_DIALOG_ID, "instantiate");
Sunstone.showFormPanel(TAB_ID, INSTANTIATE_DIALOG_ID, "instantiate",
function(formPanelInstance, context) {
formPanelInstance.setTemplateId(context, templateId);
});
}
},

View File

@ -49,10 +49,10 @@ define(function(require) {
FormPanel.FORM_PANEL_ID = FORM_PANEL_ID;
FormPanel.prototype = Object.create(BaseFormPanel.prototype);
FormPanel.prototype.constructor = FormPanel;
FormPanel.prototype.setTemplateId = _setTemplateId;
FormPanel.prototype.htmlWizard = _html;
FormPanel.prototype.submitWizard = _submitWizard;
FormPanel.prototype.onShow = _onShow;
FormPanel.prototype.fill = _fill;
FormPanel.prototype.setup = _setup;
return FormPanel;
@ -75,18 +75,18 @@ define(function(require) {
}
function _onShow(context) {
}
function _setTemplateId(context, templateId) {
var that = this;
Sunstone.disableFormPanelSubmit(TAB_ID);
var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
var template_id = ""+selected_nodes[0];
this.templateId = templateId;
this.service_template_json = {};
OpenNebulaServiceTemplate.show({
data : {
id: template_id
id: templateId
},
timeout: true,
success: function (request, template_json){
@ -145,7 +145,6 @@ define(function(require) {
$("#instantiate_service_user_inputs", context).empty();
}
});
}
function _submitWizard(context) {
@ -155,14 +154,6 @@ define(function(require) {
var n_times = $('#service_n_times',context).val();
var n_times_int=1;
var template_id;
if ($("#TEMPLATE_ID", context).val()) {
template_id = $("#TEMPLATE_ID", context).val();
} else {
var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
template_id = ""+selected_nodes[0];
}
if (n_times.length){
n_times_int=parseInt(n_times,10);
}
@ -200,7 +191,7 @@ define(function(require) {
if (!service_name.length){ //empty name
for (var i=0; i< n_times_int; i++){
Sunstone.runAction("ServiceTemplate.instantiate", template_id, extra_info);
Sunstone.runAction("ServiceTemplate.instantiate", that.templateId, extra_info);
}
} else {
if (service_name.indexOf("%i") == -1){//no wildcard, all with the same name
@ -209,7 +200,7 @@ define(function(require) {
for (var i=0; i< n_times_int; i++){
Sunstone.runAction(
"ServiceTemplate.instantiate",
template_id, extra_info);
that.templateId, extra_info);
}
} else { //wildcard present: replace wildcard
for (var i=0; i< n_times_int; i++){
@ -217,7 +208,7 @@ define(function(require) {
Sunstone.runAction(
"ServiceTemplate.instantiate",
template_id, extra_info);
that.templateId, extra_info);
}
}
}
@ -225,8 +216,4 @@ define(function(require) {
return false;
}
function _fill(context, element) {
var that = this;
}
});