2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
23 constructor($log, $scope, $stateParams, getAccessService, userProfileService, ExternalRequestAccessService, applicationsService, ngDialog) {
24 // $log.debug('GetAccessCtrl: appService param is: ' + applicationsService.goGetAccessAppName);
25 var resultAccessValue = null;
26 var externalRequest = true;
28 $scope.openAppRoleModal = (itemData) => {
29 if(resultAccessValue){
34 attuid: $scope.attuid,
35 firstName: $scope.firstName,
36 lastName: $scope.lastName,
37 headerText: itemData.app_name,
38 extReqValue : externalRequest
42 templateUrl: 'app/views/catalog/add-catalog-dialogs/new-catalog.modal.html',
43 controller: 'NewCatalogModalCtrl',
44 controllerAs: 'userInfo',
50 userProfileService.getUserProfile().then(
52 $scope.attuid = profile.orgUserId;
53 $scope.firstName = profile.firstName;
54 $scope.lastName = profile.lastName;
57 this.updateAppsList = () => {
58 ExternalRequestAccessService.getExternalRequestAccessServiceInfo().then(
60 resultAccessValue = property.accessValue;
62 $log.error('GetAccessCtrl: failed getExternalRequestAccessServiceInfo: ' + JSON.Stringify(err));
64 getAccessService.getListOfApp().then(res=> {
66 // $log.info('GetAccessCtrl::updateAppsList: getting res');
67 var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null;
68 // $log.info('GetAccessCtrl::updateAppsList: result',result);
69 // $log.info('GetAccessCtrl::updateAppsList: done');
71 // $log.info('GetAccessCtrl::updateAppsList source: ', source);
72 for(var i=0;i<source.length; i++){
73 var dataArr = source[i];
74 var checkEcompFuncAvail = 'Ecomp Function Not Available' ;
75 var reqStatus = 'Pending';
76 dataArr.ecompFunction = (dataArr.ecompFunction === null) ? checkEcompFuncAvail : dataArr.ecompFunction;
77 dataArr.reqType = (dataArr.reqType === 'P') ? reqStatus : dataArr.reqType;
79 ecomp_function: dataArr.ecompFunction,
80 app_name:dataArr.appName,
81 role_name:dataArr.roleName,
82 current_role:dataArr.roleActive,
83 request_type:dataArr.reqType
85 tableData.push(dataTemp);
87 this.appTable=tableData;
89 var len = tableData.length;
90 this.totalPage = Math.ceil(len/this.viewPerPage);
92 if( $stateParams.appName != null)
93 this.searchString = $stateParams.appName;
95 this.searchString = applicationsService.goGetAccessAppName;
96 // the parameter has been used; clear the value.
97 applicationsService.goGetAccessAppName = '';
99 $log.error('GetAccessCtrl:error:: ', err);
101 this.isLoadingTable = false;
105 this.updateTable = (num) => {
106 this.startIndex=this.viewPerPage*(num-1);
107 this.currentPage = num;
110 // $log.info('GetAccessCtrl:: initializing...');
111 this.searchString = '';
112 this.getAccessTableHeaders = ['ECOMP Function', 'Application Name', 'Role Name', 'Current Role', 'Request Status'];
114 this.updateAppsList();
117 this.currentPage = 1;
123 GetAccessCtrl.$inject = ['$log', '$scope', '$stateParams', 'getAccessService', 'userProfileService', 'ExternalRequestAccessService','applicationsService', 'ngDialog'];
124 angular.module('ecompApp').controller('GetAccessCtrl', GetAccessCtrl);