Add sort functionality to table Component
Added optional sort function to the shared table component.
Table sort is not implemented on any existing table, but will
be used in the redesigned Event Log table.
- Changed table model attribute to two separate properties
data and header to take advantage of $onChanges lifecycle
hook
- Update local user table and user role table to account for
these updates
Tested on Chrome, Safari, Firefox, Edge, IE
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I4fe68e78ae9d1228d7d9350538f61076036b1089
diff --git a/app/users/controllers/user-accounts-controller.js b/app/users/controllers/user-accounts-controller.js
index b5ed1a5..7591a53 100644
--- a/app/users/controllers/user-accounts-controller.js
+++ b/app/users/controllers/user-accounts-controller.js
@@ -17,9 +17,10 @@
$scope.userRoles;
$scope.localUsers;
- $scope.tableModel = {};
- $scope.tableModel.data = [];
- $scope.tableModel.header = ['Username', 'Privilege', 'Account status'];
+ $scope.tableData = [];
+ $scope.tableHeader = [
+ {label: 'Username'}, {label: 'Privilege'}, {label: 'Account status'}
+ ];
/**
* Data table mapper
@@ -61,7 +62,7 @@
APIUtils.getAllUserAccounts()
.then((users) => {
$scope.localUsers = users;
- $scope.tableModel.data = users.map(mapTableData);
+ $scope.tableData = users.map(mapTableData);
})
.catch((error) => {
console.log(JSON.stringify(error));