summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/projects
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/projects')
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projects.html9
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projectsController.js11
2 files changed, 17 insertions, 3 deletions
diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html
index 84902f8..5d514d1 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projects.html
+++ b/testapi/opnfv_testapi/ui/components/projects/projects.html
@@ -38,7 +38,14 @@
<tr style="
text-align: center;">
<th style="width: 1%;">Bulk Select</th>
- <th style="width: 19%;">Name</th>
+ <th style="width: 19%;">Name
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': !ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
<th style="width: 70%;">Description</th>
<th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
index d4fa962..07a58fe 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
@@ -21,7 +21,7 @@
ProjectsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl',
- 'raiseAlert', 'confirmModal', 'authenticate', 'keepState'
+ 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService'
];
/**
@@ -30,7 +30,7 @@
* through projects declared in TestAPI.
*/
function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, authenticate, keepState) {
+ raiseAlert, confirmModal, authenticate, keepState, sortService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/projects';
@@ -44,11 +44,13 @@
ctrl.openBatchDeleteModal = openBatchDeleteModal;
ctrl.projectDelete = projectDelete;
ctrl.batchDelete = batchDelete;
+ ctrl.sortByName = sortByName
ctrl.checkBox = [];
ctrl.checkBoxList = [];
ctrl.name = '';
ctrl.details = '';
+ ctrl.ascending = false;
/**
* This will contact the TestAPI to create a new project.
@@ -72,6 +74,11 @@
});
}
+ function sortByName(){
+ ctrl.data.projects = sortService.sortFunction(ctrl.data.projects, 'name', ctrl.ascending)
+ ctrl.ascending = !ctrl.ascending
+ }
+
/**
* This will open the modal that will show the create
* project view