From c2008a79f18878daa64b230697bde7f78d348397 Mon Sep 17 00:00:00 2001 From: Jorge Lobo Date: Fri, 29 Mar 2019 12:44:34 +0100 Subject: [PATCH] B #3066 no show datatables if type is a VMTEMPLATE --- .../marketplaceapps-tab/form-panels/export.js | 72 +++++++++---------- .../form-panels/export/wizard.hbs | 2 +- 2 files changed, 34 insertions(+), 40 deletions(-) diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export.js index 7e2c3e2e298..741d11e4726 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export.js +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export.js @@ -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 @@ -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 } }); @@ -87,36 +87,33 @@ 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()); }); } @@ -124,18 +121,15 @@ define(function(require) { 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 diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export/wizard.hbs b/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export/wizard.hbs index 08db447af1c..8ed850ae49a 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export/wizard.hbs +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/form-panels/export/wizard.hbs @@ -37,7 +37,7 @@ {{#unless template}} -
+
{{tr "Select the Datastore to store the resource"}} {{{datastoresTableHTML}}}