Skip to content

Commit

Permalink
B #3066 no show datatables if type is a VMTEMPLATE (#3154)
Browse files Browse the repository at this point in the history
  • Loading branch information
jloboescalona2 authored and Tino Vázquez committed Apr 1, 2019
1 parent a43acea commit d177039
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ define(function(require) {
DEPENDENCIES
*/

var BaseFormPanel = require('utils/form-panels/form-panel');
var Sunstone = require('sunstone');
var Locale = require('utils/locale');
var Notifier = require('utils/notifier');
var Tips = require('utils/tips');
var DataStoresTable = require('tabs/datastores-tab/datatable');
var DataStore = require('opennebula/datastore');
var OpenNebulaMarketPlaceApp = require('opennebula/marketplaceapp');
var Config = require('sunstone-config');
var OpenNebula = require('opennebula');
var TemplateUtils = require('utils/template-utils');
var BaseFormPanel = require("utils/form-panels/form-panel");
var Sunstone = require("sunstone");
var Locale = require("utils/locale");
var Notifier = require("utils/notifier");
var Tips = require("utils/tips");
var DataStoresTable = require("tabs/datastores-tab/datatable");
var DataStore = require("opennebula/datastore");
var OpenNebulaMarketPlaceApp = require("opennebula/marketplaceapp");
var Config = require("sunstone-config");
var OpenNebula = require("opennebula");
var TemplateUtils = require("utils/template-utils");

/*
TEMPLATES
*/

var TemplateWizardHTML = require('hbs!./export/wizard');
var TemplateWizardHTML = require("hbs!./export/wizard");

/*
CONSTANTS
*/

var FORM_PANEL_ID = require('./export/formPanelId');
var TAB_ID = require('../tabId');
var FORM_PANEL_ID = require("./export/formPanelId");
var TAB_ID = require("../tabId");

/*
CONSTRUCTOR
Expand All @@ -52,18 +52,18 @@ define(function(require) {
this.formPanelId = FORM_PANEL_ID;
this.tabId = TAB_ID;
this.actions = {
'export': {
'title': Locale.tr("Download App To OpenNebula"),
'buttonText': Locale.tr("Download"),
'resetButton': false
"export": {
"title": Locale.tr("Download App To OpenNebula"),
"buttonText": Locale.tr("Download"),
"resetButton": false
}
};

this.datastoresTable = new DataStoresTable(
FORM_PANEL_ID + 'datastoresTable', {
'select': true,
'selectOptions': {
'filter_fn': function(ds) { return ds.TYPE == DataStore.TYPES.IMAGE_DS; } // Show system DS only
FORM_PANEL_ID + "datastoresTable", {
"select": true,
"selectOptions": {
"filter_fn": function(ds) { return ds.TYPE == DataStore.TYPES.IMAGE_DS; } // Show system DS only
}
});

Expand All @@ -87,55 +87,49 @@ define(function(require) {

function _htmlWizard() {
return TemplateWizardHTML({
'formPanelId': this.formPanelId,
'template': this.type == "VMTEMPLATE",
'datastoresTableHTML': this.datastoresTable.dataTableHTML
"formPanelId": this.formPanelId,
"template": this.type == "VMTEMPLATE",
"datastoresTableHTML": this.datastoresTable.dataTableHTML
});
}

function _onShow(context) {
Sunstone.disableFormPanelSubmit(TAB_ID);

this.datastoresTable.resetResourceTableSelect();

if(this.type === "VMTEMPLATE"){
this.datastoresTable.dataTable.parents("#placeDatatableDatastore").remove();
}else{
this.datastoresTable.resetResourceTableSelect();
}
$("#NAME", context).focus();

return false;
}

// Set up the create datastore context
function _setup(context) {
Tips.setup(context);

this.datastoresTable.initialize();
this.datastoresTable.idInput().attr('required', '');

$('input#NAME', context).on('input', function(){
this.datastoresTable.idInput().attr("required", "");
$("input#NAME", context).on("input", function(){
var vmname = $("#VMNAME", context).val();

if (vmname == "" || vmname == $(this).data("prev")){
$("#VMNAME", context).val($(this).val());
}

$(this).data("prev", $(this).val());
});
}

function _setResourceId(context, resourceId, type) {
this.resourceId = resourceId;
this.type = type;

OpenNebula.MarketPlaceApp.show({
data : {
id: resourceId
},
success: function(request,app_json){
$('input#NAME', context).val(app_json.MARKETPLACEAPP.NAME).trigger('input');

$("input#NAME", context).val(app_json.MARKETPLACEAPP.NAME).trigger("input");
if (app_json.MARKETPLACEAPP.TEMPLATE.VMTEMPLATE64 != undefined){
$(".vmname", context).show();
}

Sunstone.enableFormPanelSubmit(TAB_ID);
},
error: Notifier.onError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
</div>
{{#unless template}}
<fieldset>
<fieldset id="placeDatatableDatastore">
<legend>{{tr "Select the Datastore to store the resource"}}</legend>
{{{datastoresTableHTML}}}
</fieldset>
Expand Down

0 comments on commit d177039

Please sign in to comment.