1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00

B #3335: Add select default zone endpoint (#3437)

* B #3335: add select change default zone endpoint

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>

* Update info-common.js
This commit is contained in:
Jorge Lobo 2019-06-18 12:25:08 +02:00 committed by Tino Vázquez
parent f374fc6145
commit 22ae31375b
5 changed files with 49 additions and 5 deletions

View File

@ -26,6 +26,8 @@ define(function(require) {
var OpenNebulaUser = require("opennebula/user");
var Sunstone = require("sunstone");
var UserCreation = require("tabs/users-tab/utils/user-creation");
var OpenNebula = require('opennebula');
var Notifier = require('utils/notifier');
/*
TEMPLATES
@ -173,6 +175,37 @@ define(function(require) {
}
});
// Change default zone
var default_zone_input = "default_zone_input";
context.off("click", "#div_edit_zone");
context.on("click", "#div_edit_zone", function() {
var options = "<option value=''> - </option>";
OpenNebula.Zone.list({
timeout: true,
success: function (request, obj_list) {
$.each(obj_list, function() {
if(this && this.ZONE && this.ZONE.TEMPLATE && this.ZONE.TEMPLATE.ENDPOINT && this.ZONE.NAME){
options += "<option value=\""+this.ZONE.TEMPLATE.ENDPOINT+"\">"+this.ZONE.NAME+"</option>";
}
});
$(".value_td_zone", context).html("<select id='"+default_zone_input+"'>" +
options +
"</select>");
if (that.element.TEMPLATE.SUNSTONE && that.element.TEMPLATE.SUNSTONE.DEFAULT_ZONE_ENDPOINT) {
$("#"+default_zone_input, context).val(that.element.TEMPLATE.SUNSTONE.DEFAULT_ZONE_ENDPOINT)
}
},
error: Notifier.onError
});
});
context.off("change", "#"+default_zone_input);
context.on("change", "#"+default_zone_input, function() {
var sunstone_setting = {DEFAULT_ZONE_ENDPOINT : $(this).val()};
Sunstone.runAction("User.append_sunstone_setting", that.element.ID, sunstone_setting);
});
return false;
}
});

View File

@ -60,6 +60,15 @@
</div>
</td>
</tr>
<tr>
<td class="key_td">{{tr "Default Zone Endpoint"}}</td>
<td class="value_td_zone">{{valOrDefault sunstone_template.DEFAULT_ZONE_ENDPOINT "-"}}</td>
<td>
<div id="div_edit_zone">
<a id="div_edit_zone_link" class="edit_e" href="#"> <i class="fas fa-edit right"/></a>
</div>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -72,4 +72,4 @@ define(function(require) {
'pre': _pre,
'post': _post
};
});
});

View File

@ -170,4 +170,4 @@ define(function(require) {
""
];
}
});
});

View File

@ -70,9 +70,11 @@ define(function(require) {
type: "single",
call: that.openNebulaResource.show,
callback: function(request, response) {
Sunstone.getDataTable(that.tabId).updateElement(request, response);
if (Sunstone.rightInfoVisible($('#' + that.tabId))) {
Sunstone.insertPanels(that.tabId, response);
if(that && that.tabId && Sunstone && Sunstone.getDataTable && Sunstone.getDataTable(that.tabId)){
Sunstone.getDataTable(that.tabId).updateElement(request, response);
if (Sunstone.rightInfoVisible($('#' + that.tabId))) {
Sunstone.insertPanels(that.tabId, response);
}
}
},
error: Notifier.onError