1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

M #~: Minor fixes in datatable (#909)

This commit is contained in:
Sergio Betanzos 2021-03-03 18:11:41 +01:00 committed by GitHub
parent 8889887303
commit d81be5c2cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 36 deletions

View File

@ -18,8 +18,6 @@ define(function(require) {
/*
DEPENDENCIES
*/
var Notifier = require("utils/notifier");
// require('foundation.tab');
var BaseFormPanel = require("utils/form-panels/form-panel");
var Sunstone = require("sunstone");
var OpenNebulaAction = require("opennebula/action");
@ -178,8 +176,12 @@ define(function(require) {
{ value: "reserve_from", text: "Reserve", select: "networks", extra: true },
{ value: "id", text: "Existing", select: "networks", extra: false },
];
// reset global variables on form
this.roleTabObjects = {};
this.numberOfNetworks = 0;
var numberOfNetworks = 0;
var roles_index = 0;
var that = this;
//this render a schedule action form
@ -200,8 +202,8 @@ define(function(require) {
$(".add_service_network", context).unbind("click");
$(".add_service_network", context).bind("click", function() {
var nic_index = that.numberOfNetworks;
that.numberOfNetworks++;
var nic_index = numberOfNetworks;
numberOfNetworks++;
$(".service_networks tbody").append(
@ -290,11 +292,10 @@ define(function(require) {
$(".service_network_type", "tr#network"+nic_index).val(that.networksType[0].value).change();
});
that.roles_index = 0;
//$("#tf_btn_roles", context).unbind("click");
$("#tf_btn_roles", context).bind("click", function(){
that.addRoleTab(that.roles_index, context);
that.roles_index++;
that.addRoleTab(roles_index, context);
roles_index++;
});
// Fill parents table
@ -341,6 +342,10 @@ define(function(require) {
Tips.setup(context);
UserInputs.setup(context);
// Add first role
$("#tf_btn_roles", context).click();
return false;
}
@ -393,7 +398,6 @@ define(function(require) {
if(scheduleActions){
post = false;
roles = roles.map(role => {
var data = "";
if(role.vm_template_contents){
var template_contents = TemplateUtils.stringToTemplate(role.vm_template_contents);
var new_vm_template_contents = "";
@ -475,11 +479,6 @@ define(function(require) {
var role_id = $(this).attr("role_id");
that.roleTabObjects[role_id].onShow();
});
// Remove role tabs
$("#roles_tabs i.remove-tab", context).trigger("click");
// Add first role
$("#tf_btn_roles", context).click();
}
function _fill(context, element) {
@ -581,8 +580,6 @@ define(function(require) {
that.roleTabObjects[role_id].fill(role_context, value, network_names);
});
//_redo_service_networks_selector(context, that);
$.each(element.TEMPLATE.BODY.roles, function(index, value){
var role_context = $(".role_content", context)[index];
var str = "";

View File

@ -16,7 +16,6 @@
define(function(require) {
// Dependencies
var Locale = require('utils/locale');
var Tips = require('utils/tips');
var TemplatesTable = require('tabs/templates-tab/datatable');
var TemplateUtils = require('utils/template-utils');
@ -50,7 +49,8 @@ define(function(require) {
function _role_tab_content(){
var opts = {
info: false,
select: true
select: true,
force_refresh: true
};
this.templatesTable = new TemplatesTable("roleTabTemplates"+this.html_role_id, opts);

View File

@ -21,11 +21,8 @@ define(function(require) {
var TabDataTable = require('utils/tab-datatable');
var SunstoneConfig = require('sunstone-config');
var Sunstone = require('sunstone');
var OpenNebula = require('opennebula');
var Locale = require('utils/locale');
var Humanize = require('utils/humanize');
var Notifier = require('utils/notifier');
var LabelsUtils = require('utils/labels/utils');
var SearchDropdown = require('hbs!./datatable/search');
var Status = require('utils/status');

View File

@ -18,8 +18,6 @@ define(function(require) {
/*
DEPENDENCIES
*/
// require('foundation.tab');
var BaseFormPanel = require("utils/form-panels/form-panel");
var Sunstone = require("sunstone");
var Locale = require("utils/locale");
@ -29,8 +27,6 @@ define(function(require) {
var AffinityRoleTab = require("tabs/vmgroup-tab/utils/affinity-role-tab");
var Notifier = require("utils/notifier");
var Utils = require("../utils/common");
/*
TEMPLATES
*/
@ -88,12 +84,6 @@ define(function(require) {
*/
function _htmlWizard() {
var opts = {
info: false,
select: true
};
return TemplateWizardHTML({
"affinity-role-tab": this.affinity_role_tab.html(),
"formPanelId": this.formPanelId

View File

@ -46,10 +46,6 @@ define(function(require) {
return RoleTab;
function _role_tab_content(){
var opts = {
info: false,
select: true
};
var optsTable = {
info: false,
select: true,
@ -129,7 +125,6 @@ define(function(require) {
}
$(".btn_group_host_vm_roles").on("click", "i.remove_host_affinity", function() {
var affinity = $(this.parentElement.parentElement).attr('typeAffinity');
var value = $(this.parentElement).attr('value');
$(this.parentElement.parentElement).remove();
var index = -1;
if(affinity == "AFFINED"){

View File

@ -1239,6 +1239,7 @@ define(function(require) {
var pool_filter = SunstoneConfig.isChangedFilter()? -4 : -2;
if (that.selectOptions.zone_id == undefined) {
OpenNebula[that.resource].list({
options: { force: that.conf.force_refresh || false },
data : {pool_filter : pool_filter},
timeout: true,
success: success_func,
@ -1246,6 +1247,7 @@ define(function(require) {
});
} else {
OpenNebula[that.resource].list_in_zone({
options: { force: that.conf.force_refresh || false },
data: {zone_id: that.selectOptions.zone_id, pool_filter : pool_filter},
timeout: true,
success: success_func,