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

Bug #4615: Fix modal windows in cloud view

(cherry picked from commit 7dc5dd0cfe3af45d8fe111a3486508824e1ec77a)
This commit is contained in:
Carlos Martín 2016-07-01 16:19:19 +02:00
parent 3637812d38
commit 1e6c6238bc
26 changed files with 46 additions and 32 deletions

View File

@ -115,7 +115,7 @@ define(function(require) {
function _onShow(dialog) {
var sel_elems = Sunstone.getDataTable(IMAGES_TAB_ID).elements({names: true});
this.setNames(sel_elems);
this.setNames( {elements: sel_elems} );
//show different text depending on how many elements are selected
if (sel_elems.length > 1) {

View File

@ -64,7 +64,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
}
function _setup(context) {

View File

@ -95,7 +95,7 @@ define(function(require) {
function _onShow(context) {
var sel_elems = Sunstone.getDataTable(ONEFLOW_TEMPLATES_TAB_ID).elements({names: true});
this.setNames(sel_elems);
this.setNames( {elements: sel_elems} );
//show different text depending on how many elements are selected
if (sel_elems.length > 1) {

View File

@ -95,7 +95,7 @@ define(function(require) {
function _onShow(context) {
var sel_elems = Sunstone.getDataTable(TAB_ID).elements({names: true});
this.setNames(sel_elems);
this.setNames( {elements: sel_elems} );
//show different text depending on how many elements are selected
if (sel_elems.length > 1) {

View File

@ -116,7 +116,7 @@ define(function(require) {
function _onShow(context) {
var sel_elems = Sunstone.getDataTable(this.tabId).elements({names: true});
this.setNames(sel_elems);
this.setNames( {elements: sel_elems} );
//show different text depending on how many elements are selected
if (sel_elems.length > 1) {

View File

@ -95,7 +95,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
return false;
}

View File

@ -122,7 +122,7 @@ define(function(require) {
}
function _onShow(dialog) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.groupsTable.refreshResourceTableSelect();

View File

@ -110,7 +110,7 @@ define(function(require) {
var tabId = Sunstone.getTab();
if (tabId == USERS_TAB_ID){
this.setNames( Sunstone.getDataTable(USERS_TAB_ID).elements({names: true}) );
this.setNames( {tabId: USERS_TAB_ID} );
}
return false;

View File

@ -90,7 +90,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.diskTab.onShow(context);

View File

@ -90,7 +90,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.nicTab.onShow(context);

View File

@ -107,7 +107,7 @@ define(function(require) {
}
function _onShow(dialog) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.datastoresTable.resetResourceTableSelect();
this.hostsTable.resetResourceTableSelect();

View File

@ -92,7 +92,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
$("#disk_id", context).val(this.diskId);
$("#snapshot_id", context).val(this.snapshotId);
$("#image_name", context).focus();

View File

@ -84,7 +84,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
$("#disk_id", context).val(this.diskId);
$("#snapshot_name", context).focus();
return false;

View File

@ -94,7 +94,7 @@ define(function(require) {
function _onShow(context) {
var that = this;
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
CapacityInputs.fill(context, that.element);

View File

@ -99,7 +99,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
$("#template_name", context).focus();
return false;
}

View File

@ -83,7 +83,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
$("#snapshot_name", context).focus();
return false;
}

View File

@ -92,7 +92,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.arTab.onShow();
}

View File

@ -133,7 +133,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.vnetsTable.refreshResourceTableSelect();
this.arsTable.refreshResourceTableSelect();

View File

@ -92,7 +92,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
this.arTab.onShow();
}

View File

@ -94,7 +94,7 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(TAB_ID).elements({names: true}) );
this.setNames( {tabId: TAB_ID} );
return false;
}

View File

@ -140,9 +140,9 @@ define(function(require) {
function _onShow(dialog) {
if(this.resource == "datastore"){
this.setNames( Sunstone.getDataTable(DATASTORES_TAB_ID).elements({names: true}) );
this.setNames( {tabId: DATASTORES_TAB_ID} );
}else{
this.setNames( Sunstone.getDataTable(VNETS_TAB_ID).elements({names: true}) );
this.setNames( {tabId: VNETS_TAB_ID} );
}
this.clustersTable.refreshResourceTableSelect();

View File

@ -127,7 +127,7 @@ define(function(require) {
}
var action = Sunstone.getAction(this.actionId);
this.setNames( action.elements({names: true}) );
this.setNames( {elements: action.elements({names: true})} );
if (this.button.custom_select) {
$('div#confirm_select', dialog).html(this.button.custom_select);

View File

@ -80,7 +80,7 @@ define(function(require) {
}
var action = Sunstone.getAction(actionId);
this.setNames( action.elements({names: true}) );
this.setNames( {elements: action.elements({names: true})} );
return false;
}

View File

@ -16,6 +16,7 @@
define(function(require) {
var TemplateUtils = require('utils/template-utils');
var Sunstone = require('sunstone');
function BaseDialog() {
return this;
@ -72,9 +73,27 @@ define(function(require) {
return false;
}
function _setNames(elements){
/**
* Sets the ID & names of the selected objects
*
* @param {Object} opts
* - tabId: Optional. If given, the object names will be taken from
* the selected elements of this tab's dataTable
* - elements: Optional. Array of objects: [{id, name}]
*/
function _setNames(opts){
var html = "";
var elements = undefined;
if (opts.elements != undefined) {
elements = opts.elements;
} else if ( opts.tabId != undefined &&
Sunstone.getDataTable(opts.tabId) != undefined){
elements = Sunstone.getDataTable(opts.tabId).elements({names: true})
}
if (elements) {
html = '<h6 class="subheader">';

View File

@ -138,7 +138,7 @@ define(function(require) {
}
if (this.params.headerTabId != undefined){
this.setNames( Sunstone.getDataTable(this.params.headerTabId).elements({names: true}) );
this.setNames( {tabId: this.params.headerTabId} );
}
return false;

View File

@ -88,13 +88,8 @@ define(function(require) {
}
function _onShow(context) {
this.setNames( Sunstone.getDataTable(this.tabId).elements({names: true}) );
this.setNames( {tabId: this.tabId} );
/*
$("#element_id", context).text(this.element.ID);
$("#element_name", context).text(this.element.NAME);
$("#resource_name", context).text(this.resourceName);
*/
WizardFields.fill(context, this.element.TEMPLATE);
return false;