This is an automated email from the ASF dual-hosted git repository.

shamrick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new acbb64a0c9 Fix unbound method called on users table controller scope 
(#7342)
acbb64a0c9 is described below

commit acbb64a0c9e964b020ea1b41e49db86ff202d8cd
Author: ocket8888 <[email protected]>
AuthorDate: Mon Feb 6 11:25:29 2023 -0700

    Fix unbound method called on users table controller scope (#7342)
---
 .../table/capabilityUsers/TableCapabilityUsersController.js       | 2 +-
 .../common/modules/table/roleUsers/TableRoleUsersController.js    | 2 +-
 .../modules/table/tenantUsers/TableTenantUsersController.js       | 2 +-
 .../app/src/common/modules/table/users/TableUsersController.js    | 8 ++++++--
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/traffic_portal/app/src/common/modules/table/capabilityUsers/TableCapabilityUsersController.js
 
b/traffic_portal/app/src/common/modules/table/capabilityUsers/TableCapabilityUsersController.js
index f5ec079cca..4b9e30454e 100644
--- 
a/traffic_portal/app/src/common/modules/table/capabilityUsers/TableCapabilityUsersController.js
+++ 
b/traffic_portal/app/src/common/modules/table/capabilityUsers/TableCapabilityUsersController.js
@@ -35,7 +35,7 @@ var TableCapabilityUsersController = function(capability, 
capUsers, $controller,
 
        $scope.capability = capability[0];
 
-       $scope.relativeLoginTime = dateUtils.relativeLoginTime;
+       $scope.relativeLoginTime = arg => dateUtils.relativeLoginTime(arg);
 
        $scope.editUser = function(id) {
                locationUtils.navigateToPath('/users/' + id);
diff --git 
a/traffic_portal/app/src/common/modules/table/roleUsers/TableRoleUsersController.js
 
b/traffic_portal/app/src/common/modules/table/roleUsers/TableRoleUsersController.js
index b11ec8a3ea..c792221eb2 100644
--- 
a/traffic_portal/app/src/common/modules/table/roleUsers/TableRoleUsersController.js
+++ 
b/traffic_portal/app/src/common/modules/table/roleUsers/TableRoleUsersController.js
@@ -35,7 +35,7 @@ var TableRoleUsersController = function(roles, roleUsers, 
$controller, $scope, $
 
        $scope.role = roles[0];
 
-       $scope.relativeLoginTime = dateUtils.relativeLoginTime;
+       $scope.relativeLoginTime = arg => dateUtils.relativeLoginTime(arg);
 
        $scope.editUser = function(id) {
                locationUtils.navigateToPath('/users/' + id);
diff --git 
a/traffic_portal/app/src/common/modules/table/tenantUsers/TableTenantUsersController.js
 
b/traffic_portal/app/src/common/modules/table/tenantUsers/TableTenantUsersController.js
index 89b19eae5f..582d4a6b0a 100644
--- 
a/traffic_portal/app/src/common/modules/table/tenantUsers/TableTenantUsersController.js
+++ 
b/traffic_portal/app/src/common/modules/table/tenantUsers/TableTenantUsersController.js
@@ -35,7 +35,7 @@ var TableTenantUsersController = function(tenant, 
tenantUsers, $controller, $sco
 
        $scope.tenant = tenant;
 
-       $scope.relativeLoginTime = dateUtils.relativeLoginTime;
+       $scope.relativeLoginTime = arg => dateUtils.relativeLoginTime(arg);
 
        $scope.editUser = function(id) {
                locationUtils.navigateToPath('/users/' + id);
diff --git 
a/traffic_portal/app/src/common/modules/table/users/TableUsersController.js 
b/traffic_portal/app/src/common/modules/table/users/TableUsersController.js
index 555c5bcf5f..4784fc65b6 100644
--- a/traffic_portal/app/src/common/modules/table/users/TableUsersController.js
+++ b/traffic_portal/app/src/common/modules/table/users/TableUsersController.js
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+/** @typedef {import("jquery")} $ */
+
 /**
  * @param {*} users
  * @param {*} $scope
@@ -30,7 +32,7 @@ var TableUsersController = function(users, $scope, $state, 
dateUtils, locationUt
 
     $scope.users = users;
 
-    $scope.relativeLoginTime = dateUtils.relativeLoginTime;
+    $scope.relativeLoginTime = arg => dateUtils.relativeLoginTime(arg);
 
     $scope.columns = [
         { "name": "Full Name", "visible": true, "searchable": true },
@@ -66,6 +68,8 @@ var TableUsersController = function(users, $scope, $state, 
dateUtils, locationUt
     };
 
     angular.element(document).ready(function () {
+               // DataTable plugin typings not included.
+               // @ts-ignore
         usersTable = $('#usersTable').DataTable({
             "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
             "iDisplayLength": 25,
@@ -74,7 +78,7 @@ var TableUsersController = function(users, $scope, $state, 
dateUtils, locationUt
             "initComplete": function() {
                 try {
                     // need to create the show/hide column checkboxes and bind 
to the current visibility
-                    $scope.columns = 
JSON.parse(localStorage.getItem('DataTables_usersTable_/')).columns;
+                    $scope.columns = 
JSON.parse(localStorage.getItem('DataTables_usersTable_/') ?? "").columns;
                 } catch (e) {
                     console.error("Failure to retrieve required column info 
from localStorage (key=DataTables_usersTable_/):", e);
                 }

Reply via email to