From 8435418bf21ce7059d7b4b11965244cebe8e2c01 Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Wed, 13 May 2020 11:03:21 +0200 Subject: [PATCH] F #4126: custom paginate cloudview (#4715) Signed-off-by: Jorge Lobo --- src/sunstone/etc/sunstone-server.conf | 3 +++ src/sunstone/public/app/sunstone.js | 13 ++++++++++++- src/sunstone/public/app/tabs/provision-tab.js | 4 ++-- .../public/app/tabs/provision-tab/flows/list.js | 3 ++- .../public/app/tabs/provision-tab/templates/list.js | 3 ++- .../public/app/tabs/provision-tab/vms/list.js | 2 +- src/sunstone/views/index.erb | 1 + 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/sunstone/etc/sunstone-server.conf b/src/sunstone/etc/sunstone-server.conf index a54be01c1c..a998ba20ef 100644 --- a/src/sunstone/etc/sunstone-server.conf +++ b/src/sunstone/etc/sunstone-server.conf @@ -233,6 +233,9 @@ - support - nsx +# this is for custom paginate +:paginate: "[[6, 12, 36, 72], [6, 12, 36, 72]]" + # this display button and clock icon in table of vm :leases: suspense: diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index 2e5456ae96..ab48f88629 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -1335,6 +1335,15 @@ define(function(require) { router.resolve(); }; + var _getPaginate = function(){ + var rtn = [[6, 12, 36, 72], [6, 12, 36, 72]]; + if(config && config.system_config && config.system_config.paginate){ + var paginate = config.system_config.paginate; + rtn = typeof paginate === 'string' ? JSON.parse(paginate) : paginate; + } + return rtn; + } + var Sunstone = { "addMainTabs": _addMainTabs, "addMainTab": _addMainTab, @@ -1373,7 +1382,9 @@ define(function(require) { "TOP_INTERVAL": TOP_INTERVAL, - "setupNavigoRoutes": _setupNavigoRoutes + "setupNavigoRoutes": _setupNavigoRoutes, + + "getPaginate": _getPaginate }; return Sunstone; diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 57edb58ec7..991305b0f0 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -755,7 +755,7 @@ define(function(require) { "iDisplayLength": 6, "bAutoWidth": false, "sDom" : "<\"H\">t<\"F\"lp>", - "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]], + "aLengthMenu": Sunstone.getPaginate(), "aoColumnDefs": [ { "bVisible": false, "aTargets": ["all"]} ], @@ -1093,7 +1093,7 @@ define(function(require) { "iDisplayLength": 6, "bAutoWidth": false, "sDom" : "<\"H\">t<\"F\"lp>", - "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]], + "aLengthMenu": Sunstone.getPaginate(), "aaSorting" : [[1, "asc"]], "aoColumnDefs": [ { "bVisible": false, "aTargets": ["all"]} diff --git a/src/sunstone/public/app/tabs/provision-tab/flows/list.js b/src/sunstone/public/app/tabs/provision-tab/flows/list.js index 7f82e01f16..440fe4b2ca 100644 --- a/src/sunstone/public/app/tabs/provision-tab/flows/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/flows/list.js @@ -17,6 +17,7 @@ define(function(require) { // require('foundation.alert'); var OpenNebula = require("opennebula"); + var Sunstone = require("sunstone"); var OpenNebulaService = require("opennebula/service"); var OpenNebulaVm = require("opennebula/vm"); var Locale = require("utils/locale"); @@ -133,7 +134,7 @@ define(function(require) { provision_flows_datatable = $(".provision_flows_table", context).dataTable({ "iDisplayLength": 6, "sDom" : "<\"H\">t<\"F\"lp>", - "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]], + "aLengthMenu": Sunstone.getPaginate(), "aaSorting" : [[0, "desc"]], "aoColumnDefs": [ { "bVisible": false, "aTargets": ["all"]} diff --git a/src/sunstone/public/app/tabs/provision-tab/templates/list.js b/src/sunstone/public/app/tabs/provision-tab/templates/list.js index 3c3a3feab6..cdb5863865 100644 --- a/src/sunstone/public/app/tabs/provision-tab/templates/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/templates/list.js @@ -17,6 +17,7 @@ define(function(require) { // require('foundation.alert'); var OpenNebula = require("opennebula"); + var Sunstone = require("sunstone"); var Locale = require("utils/locale"); var Config = require("sunstone-config"); var Notifier = require("utils/notifier"); @@ -123,7 +124,7 @@ define(function(require) { var provision_templates_datatable = $(".provision_templates_table", context).dataTable({ "iDisplayLength": 8, "sDom" : "<\"H\">t<\"F\"lp>", - "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]], + "aLengthMenu": Sunstone.getPaginate(), "aaSorting" : [[0, "desc"]], "aoColumnDefs": [ { "bVisible": false, "aTargets": ["all"]} diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index 39547f8f3b..a9eebad52f 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -138,7 +138,7 @@ define(function(require) { "iDisplayLength": 6, "bAutoWidth": false, "sDom" : "<\"H\">t<\"F\"lp>", - "aLengthMenu": [[6, 12, 36, 72], [6, 12, 36, 72]], + "aLengthMenu": Sunstone.getPaginate(), "aaSorting" : [[0, "desc"]], "aoColumnDefs": [ { "bVisible": false, "aTargets": ["all"]}, diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 2f95525588..753a79d452 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -43,6 +43,7 @@ 'threshold_high' : '<%= $conf[:threshold_high] %>', }, 'system_config' : { + 'paginate': '<%= $conf[:paginate] %>', 'marketplace_url' : '<%= $conf[:marketplace_url] %>', 'vnc_request_password' : <%= $conf[:vnc_request_password] || false %>, 'vnc_proxy_port' : '<%= $vnc.proxy_port %>',