From 06b1e581feebf2b89dc599c6a1a99cdd83d00f2b Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Tue, 24 Aug 2021 10:30:08 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03928=20Use=20right=20tab=20widget=20in?= =?UTF-8?q?=20impact=20analysis=20and=20make=20sure=20widget=20is=20initia?= =?UTF-8?q?lized=20before=20using=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/layouts/tab-container/tab-container.js | 11 +++++++ js/simple_graph.js | 39 ++++++++++++----------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/js/layouts/tab-container/tab-container.js b/js/layouts/tab-container/tab-container.js index 253a8e985..34719bfa3 100644 --- a/js/layouts/tab-container/tab-container.js +++ b/js/layouts/tab-container/tab-container.js @@ -100,6 +100,17 @@ $(function() this.element.regulartabs(oParams); } }, + /** + * Return tabs widget instance + * @public + */ + GetTabWidget: function () { + if (this.element.hasClass(this.css_classes.is_scrollable)) { + return this.element.scrollabletabs('instance'); + } else { + return this.element.regulartabs('instance'); + } + }, // events bound via _bind are removed automatically // revert other modifications here _destroy: function() diff --git a/js/simple_graph.js b/js/simple_graph.js index ba12124e1..3035d91a5 100644 --- a/js/simple_graph.js +++ b/js/simple_graph.js @@ -466,7 +466,7 @@ $(function() { this._close_all_tooltips(); // Activate the 3rd tab - this.element.closest('.ui-tabs').tabs("option", "active", 2); + this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").option("active", 2); // Scroll into view the group if ($('#'+sGroupId).length > 0) { @@ -698,7 +698,6 @@ $(function() }, _on_resize: function() { - this.element.closest('.ui-tabs').tabs({ heightStyle: "content" }); this.auto_scale(); this._close_all_tooltips(); this.draw(); @@ -754,25 +753,29 @@ $(function() }, refresh_groups: function(aGroups) { - if ($('#impacted_groups').length > 0) - { - - // The "Groups" tab is present, refresh it - if (aGroups.length == 0) + if(this.element.parents('.ibo-tab-container').attr('data-status') === 'loaded'){ + if ($('#impacted_groups').length > 0) { - this.element.closest('.ui-tabs').tabs("disable", 2); - $('#impacted_groups').html(''); - } - else - { - this.element.closest('.ui-tabs').tabs("enable", 2); - $('#impacted_groups').html(''); - var sUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php'; - $.post(sUrl, { operation: 'relation_groups', groups: aGroups }, function(data) { - $('#impacted_groups').html(data); - }); + // The "Groups" tab is present, refresh it + if (aGroups.length == 0) + { + this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").disable(2); + $('#impacted_groups').html(''); + } + else + { + this.element.closest('[data-role="ibo-tab-container"]').tab_container("GetTabWidget").enable(2); + $('#impacted_groups').html(''); + var sUrl = GetAbsoluteUrlAppRoot()+'pages/ajax.render.php'; + $.post(sUrl, { operation: 'relation_groups', groups: aGroups }, function(data) { + $('#impacted_groups').html(data); + }); + } } } + else{ + setTimeout(this.refresh_groups(aGroups), 800); + } }, refresh_lists: function(aLists) {