aboutsummaryrefslogtreecommitdiffstats
path: root/3rd_party/static/onap-ui/components/application/applicationController.js
diff options
context:
space:
mode:
Diffstat (limited to '3rd_party/static/onap-ui/components/application/applicationController.js')
-rw-r--r--3rd_party/static/onap-ui/components/application/applicationController.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/3rd_party/static/onap-ui/components/application/applicationController.js b/3rd_party/static/onap-ui/components/application/applicationController.js
index 094ffdc..134b002 100644
--- a/3rd_party/static/onap-ui/components/application/applicationController.js
+++ b/3rd_party/static/onap-ui/components/application/applicationController.js
@@ -20,17 +20,28 @@
.controller('ApplicationController', ApplicationController);
ApplicationController.$inject = [
- '$http', '$stateParams', '$window', '$sce',
+ '$http', '$state', '$stateParams', '$window', '$sce',
'$uibModal', 'testapiApiUrl', 'raiseAlert', 'ngDialog', '$scope'
];
/**
*/
- function ApplicationController($http, $stateParams, $window, $sce,
+ function ApplicationController($http, $state, $stateParams, $window, $sce,
$uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) {
var ctrl = this;
+ /** Check to see if this page should display community results. */
+ ctrl.isAdministrator = $scope.auth.currentUser.role.indexOf('administrator') != -1;
+ // Should only be on user-results-page if authenticated.
+ if (!$scope.auth.isAuthenticated) {
+ $state.go('home');
+ }
+ // Should only be on applications if administrator
+ if (!ctrl.isAdministrator) {
+ $state.go('home');
+ }
+
function init() {
ctrl.applications = [];
@@ -65,7 +76,7 @@
});
}
- ctrl.toggleApproveApp = function(id, approved) {
+ ctrl.toggleApproveApp = function(id, approved, owner) {
if (approved === 'true') {
var text = 'Are you sure you want to approve this application?';
} else {
@@ -80,6 +91,7 @@
var data = {};
data['item'] = 'approved';
data['approved'] = approved;
+ data['owner'] = owner;
$http.put(updateUrl, JSON.stringify(data), {
transformRequest: angular.identity,
@@ -95,7 +107,7 @@
}
function getApplication() {
- $http.get(testapiApiUrl + "/onap/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage).then(function(response) {
+ $http.get(testapiApiUrl + "/onap/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage + "&applications").then(function(response) {
ctrl.applications = response.data.applications;
ctrl.totalItems = response.data.pagination.total_pages * ctrl.itemsPerPage;
ctrl.currentPage = response.data.pagination.current_page;