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 isLoadingTable: boolean;
52 displayedColumns: string[] = ['function', 'applicationName', 'roleName', 'currentRole', 'requestStatus'];
53 getAccessDataSource = new MatTableDataSource(this.appTable);
54 @ViewChild(MatPaginator) paginator: MatPaginator;
56 getAccessUrl = environment.getAccessUrl;
57 getAccessName = environment.getAccessName;
58 getAccessInfo = environment.getAccessInfo;
60 constructor(private getAccessService: GetAccessService) { }
64 this.getAccessAppsList();
67 applyFilter(filterValue: string) {
68 this.getAccessDataSource.filter = filterValue.trim().toLowerCase();
71 // Convert this code to typescript after mylogins feature is back again
72 // var resultAccessValue = null;
74 // $scope.openAppRoleModal = (itemData) => {
75 // if(resultAccessValue){
80 // orgUserId: $scope.orgUserId,
81 // firstName: $scope.firstName,
82 // lastName: $scope.lastName,
83 // headerText: itemData.app_name,
87 // templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html',
88 // controller: 'ExternalRequestAccessCtrl',
89 // controllerAs: 'userInfo',
95 // userProfileService.getUserProfile().then(
96 // function(profile) {
97 // $scope.orgUserId = profile.orgUserId;
98 // $scope.firstName = profile.firstName;
99 // $scope.lastName = profile.lastName;
102 getAccessAppsList() {
103 this.showSpinner = true;
104 this.getAccessService.getListOfApp().subscribe((_res: any) => {
106 // $log.info('GetAccessCtrl::updateAppsList: getting res');
107 var result = (typeof (_res) != "undefined" && _res != null) ? _res : null;
108 this.showSpinner = false;
109 // $log.info('GetAccessCtrl::updateAppsList: result',result);
110 // $log.info('GetAccessCtrl::updateAppsList: done');
112 // $log.info('GetAccessCtrl::updateAppsList source: ', source);
113 for (var i = 0; i < source.length; i++) {
114 var dataArr = source[i];
115 var checkEcompFuncAvail = 'Function Not Available';
116 var reqStatus = 'Pending';
117 dataArr.ecompFunction = (dataArr.ecompFunction === null) ? checkEcompFuncAvail : dataArr.ecompFunction;
118 dataArr.reqType = (dataArr.reqType === 'P') ? reqStatus : dataArr.reqType;
120 ecomp_function: dataArr.ecompFunction,
121 app_name: dataArr.appName,
122 role_name: dataArr.roleName,
123 current_role: dataArr.roleActive,
124 request_type: dataArr.reqType
126 tableData.push(dataTemp);
128 this.appTable = tableData;
129 this.getAccessDataSource = new MatTableDataSource(this.appTable);
130 this.getAccessDataSource.paginator = this.paginator;
132 this.isLoadingTable = false;