2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END===========================================
39 import { Component, OnInit, ViewChild } from '@angular/core';
40 import { GetAccessService } from 'src/app/shared/services/get-access/get-access.service';
41 import { MatTableDataSource, MatPaginator } from '@angular/material';
42 import { environment } from '../../../environments/environment';
45 selector: 'app-get-access',
46 templateUrl: './get-access.component.html',
47 styleUrls: ['./get-access.component.scss']
49 export class GetAccessComponent implements OnInit {
50 api = environment.api;
51 isLoadingTable: boolean;
53 displayedColumns: string[] = ['function', 'applicationName', 'roleName', 'currentRole', 'requestStatus'];
54 getAccessDataSource = new MatTableDataSource(this.appTable);
55 @ViewChild(MatPaginator) paginator: MatPaginator;
57 getAccessUrl = this.api.getAccessUrl;
58 getAccessName = this.api.getAccessName;
59 getAccessInfo = this.api.getAccessInfo;
61 constructor(private getAccessService: GetAccessService) { }
65 this.getAccessAppsList();
68 applyFilter(filterValue: string) {
69 this.getAccessDataSource.filter = filterValue.trim().toLowerCase();
72 // Convert this code to typescript after mylogins feature is back again
73 // var resultAccessValue = null;
75 // $scope.openAppRoleModal = (itemData) => {
76 // if(resultAccessValue){
81 // orgUserId: $scope.orgUserId,
82 // firstName: $scope.firstName,
83 // lastName: $scope.lastName,
84 // headerText: itemData.app_name,
88 // templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html',
89 // controller: 'ExternalRequestAccessCtrl',
90 // controllerAs: 'userInfo',
96 // userProfileService.getUserProfile().then(
97 // function(profile) {
98 // $scope.orgUserId = profile.orgUserId;
99 // $scope.firstName = profile.firstName;
100 // $scope.lastName = profile.lastName;
103 getAccessAppsList() {
104 this.showSpinner = true;
105 this.getAccessService.getListOfApp().subscribe((_res: any) => {
107 // $log.info('GetAccessCtrl::updateAppsList: getting res');
108 var result = (typeof (_res) != "undefined" && _res != null) ? _res : null;
109 this.showSpinner = false;
110 // $log.info('GetAccessCtrl::updateAppsList: result',result);
111 // $log.info('GetAccessCtrl::updateAppsList: done');
113 // $log.info('GetAccessCtrl::updateAppsList source: ', source);
114 for (var i = 0; i < source.length; i++) {
115 var dataArr = source[i];
116 var checkEcompFuncAvail = 'Function Not Available';
117 var reqStatus = 'Pending';
118 dataArr.ecompFunction = (dataArr.ecompFunction === null) ? checkEcompFuncAvail : dataArr.ecompFunction;
119 dataArr.reqType = (dataArr.reqType === 'P') ? reqStatus : dataArr.reqType;
121 ecomp_function: dataArr.ecompFunction,
122 app_name: dataArr.appName,
123 role_name: dataArr.roleName,
124 current_role: dataArr.roleActive,
125 request_type: dataArr.reqType
127 tableData.push(dataTemp);
129 this.appTable = tableData;
130 this.getAccessDataSource = new MatTableDataSource(this.appTable);
131 this.getAccessDataSource.paginator = this.paginator;
133 this.isLoadingTable = false;