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