Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B #3066 no show datatables if type is a VMTEMPLATE #3154

Merged
merged 1 commit into from
Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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