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

B #3368: missing datastores import market (#3388)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Lobo 2019-05-30 14:36:55 +02:00 committed by Tino Vázquez
parent ed44bca60c
commit e11fa27d66
2 changed files with 29 additions and 17 deletions

View File

@ -46,7 +46,22 @@ define(function(require) {
/*
CONSTRUCTOR
*/
*/
function getDataStore(formPanelId){
var r = null;
if(formPanelId){
r = new DataStoresTable(
formPanelId + "datastoresTable", {
"select": true,
"selectOptions": {
"filter_fn": function(ds) { return ds.TYPE == DataStore.TYPES.IMAGE_DS; }
}
}
);
}
return r;
}
function FormPanel() {
this.formPanelId = FORM_PANEL_ID;
@ -59,13 +74,7 @@ define(function(require) {
}
};
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
}
});
this.datastoresTable = getDataStore(FORM_PANEL_ID);
BaseFormPanel.call(this);
}
@ -88,16 +97,21 @@ define(function(require) {
function _htmlWizard() {
return TemplateWizardHTML({
"formPanelId": this.formPanelId,
"template": this.type == "VMTEMPLATE",
"datastoresTableHTML": this.datastoresTable.dataTableHTML
});
}
function _onShow(context) {
var placeDataStore = "#placeDatatableDatastore";
Sunstone.disableFormPanelSubmit(TAB_ID);
if(this.type === "VMTEMPLATE"){
this.datastoresTable.dataTable.parents("#placeDatatableDatastore").remove();
if(this.type === "VMTEMPLATE" ){
this.datastoresTable.dataTable.parents(placeDataStore).remove();
}else{
if(!($(placeDataStore).length)){
$("#exportMarketPlaceAppFormWizard").append(this.datastoresTable.dataTableHTML);
this.datastoresTable = getDataStore(FORM_PANEL_ID);
this.datastoresTable.initialize();
}
this.datastoresTable.resetResourceTableSelect();
}
$("#NAME", context).focus();

View File

@ -36,10 +36,8 @@
<input id="VMNAME" type="text" wizard_field="VMNAME"/>
</div>
</div>
{{#unless template}}
<fieldset id="placeDatatableDatastore">
<legend>{{tr "Select the Datastore to store the resource"}}</legend>
{{{datastoresTableHTML}}}
</fieldset>
{{/unless}}
<fieldset id="placeDatatableDatastore">
<legend>{{tr "Select the Datastore to store the resource"}}</legend>
{{{datastoresTableHTML}}}
</fieldset>
</form>