From 5d67762432ce435092e334df23d31f8c49b36a11 Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Wed, 2 Oct 2019 14:42:07 -0600 Subject: [PATCH 1/4] issue 3863 - adjust column headers when tab is selected and data table is visible --- .../private/cdns/config/ConfigController.js | 12 ++++++++++-- .../modules/private/cdns/config/config.tpl.html | 16 ++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js index 8483a36b83..6741e3106d 100644 --- a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js +++ b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js @@ -17,7 +17,7 @@ * under the License. */ -let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $state, $uibModal, locationUtils, cdnService, propertiesModel) { +let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $state, $timeout, $uibModal, locationUtils, cdnService, propertiesModel) { const oldConfig = currentSnapshot.config, newConfig = newSnapshot.config; @@ -155,6 +155,14 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta }); }; + $scope.tabSelected = function() { + // issue 3863 - adjust column headers when tab is selected and data table is visible. hacky...sorry... + $timeout(function () { + $($.fn.dataTable.tables(true)).DataTable() + .columns.adjust(); + }, 10); + }; + $scope.navigateToPath = locationUtils.navigateToPath; angular.element(document).ready(function () { @@ -187,5 +195,5 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta }; -ConfigController.$inject = ['cdn', 'currentSnapshot', 'newSnapshot', '$scope', '$state', '$uibModal', 'locationUtils', 'cdnService', 'propertiesModel']; +ConfigController.$inject = ['cdn', 'currentSnapshot', 'newSnapshot', '$scope', '$state', '$timeout', '$uibModal', 'locationUtils', 'cdnService', 'propertiesModel']; module.exports = ConfigController; diff --git a/traffic_portal/app/src/modules/private/cdns/config/config.tpl.html b/traffic_portal/app/src/modules/private/cdns/config/config.tpl.html index 3b1ecda860..503947d669 100644 --- a/traffic_portal/app/src/modules/private/cdns/config/config.tpl.html +++ b/traffic_portal/app/src/modules/private/cdns/config/config.tpl.html @@ -32,7 +32,7 @@
- + General Config
[ {{configCount.added}} | {{configCount.removed}} | {{configCount.updated}} ]
@@ -58,7 +58,7 @@
- + Traffic Routers
[ {{contentRoutersCount.added}} | {{contentRoutersCount.removed}} | {{contentRoutersCount.updated}} ]
@@ -84,7 +84,7 @@
- + Traffic Monitors
[ {{monitorsCount.added}} | {{monitorsCount.removed}} | {{monitorsCount.updated}} ]
@@ -110,7 +110,7 @@
- + Traffic Servers
[ {{contentServersCount.added}} | {{contentServersCount.removed}} | {{contentServersCount.updated}} ]
@@ -136,7 +136,7 @@
- + Delivery Services
[ {{deliveryServicesCount.added}} | {{deliveryServicesCount.removed}} | {{deliveryServicesCount.updated}} ]
@@ -162,7 +162,7 @@
- + Edge Cache Groups
[ {{edgeLocationsCount.added}} | {{edgeLocationsCount.removed}} | {{edgeLocationsCount.updated}} ]
@@ -188,7 +188,7 @@
- + TR Cache Groups
[ {{trLocationsCount.added}} | {{trLocationsCount.removed}} | {{trLocationsCount.updated}} ]
@@ -214,7 +214,7 @@
- + Stats
[ {{statsCount.added}} | {{statsCount.removed}} | {{statsCount.updated}} ]
From ce8ced843312842c6bf4ff4c0b45720c81a6dc1d Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Fri, 4 Oct 2019 09:27:49 -0600 Subject: [PATCH 2/4] uses window.setTimout instead of $timeout --- .../src/modules/private/cdns/config/ConfigController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js index 6741e3106d..8cabee61b4 100644 --- a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js +++ b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js @@ -17,7 +17,7 @@ * under the License. */ -let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $state, $timeout, $uibModal, locationUtils, cdnService, propertiesModel) { +let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $state, $uibModal, locationUtils, cdnService, propertiesModel) { const oldConfig = currentSnapshot.config, newConfig = newSnapshot.config; @@ -157,10 +157,10 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta $scope.tabSelected = function() { // issue 3863 - adjust column headers when tab is selected and data table is visible. hacky...sorry... - $timeout(function () { + window.setTimeout(function() { $($.fn.dataTable.tables(true)).DataTable() .columns.adjust(); - }, 10); + },10); }; $scope.navigateToPath = locationUtils.navigateToPath; @@ -195,5 +195,5 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta }; -ConfigController.$inject = ['cdn', 'currentSnapshot', 'newSnapshot', '$scope', '$state', '$timeout', '$uibModal', 'locationUtils', 'cdnService', 'propertiesModel']; +ConfigController.$inject = ['cdn', 'currentSnapshot', 'newSnapshot', '$scope', '$state', '$uibModal', 'locationUtils', 'cdnService', 'propertiesModel']; module.exports = ConfigController; From bd172e624616d3adafb88ad2925b71d125251609 Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Tue, 8 Oct 2019 08:28:55 -0600 Subject: [PATCH 3/4] increases timeout of column adjust hack --- .../app/src/modules/private/cdns/config/ConfigController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js index 8cabee61b4..dc046d809b 100644 --- a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js +++ b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js @@ -160,7 +160,7 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta window.setTimeout(function() { $($.fn.dataTable.tables(true)).DataTable() .columns.adjust(); - },10); + },100); }; $scope.navigateToPath = locationUtils.navigateToPath; From c9571774ca543fa530357f17e00b22bd29887f16 Mon Sep 17 00:00:00 2001 From: Jeremy Mitchell Date: Tue, 8 Oct 2019 08:35:48 -0600 Subject: [PATCH 4/4] removes 'export as csv' button from snapshot table as it does not work with object values --- .../app/src/modules/private/cdns/config/ConfigController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js index dc046d809b..6b8dc2e556 100644 --- a/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js +++ b/traffic_portal/app/src/modules/private/cdns/config/ConfigController.js @@ -174,6 +174,7 @@ let ConfigController = function (cdn, currentSnapshot, newSnapshot, $scope, $sta "language": { "emptyTable": "No pending changes" }, + "buttons": [], "columnDefs": [ { 'orderable': false, 'targets': [2, 3] } ]