app access audit entry with proper appid
[portal.git] / portal-FE-common / src / app / pages / dashboard-application-catalog / dashboard-application-catalog.component.ts
index ce37339..f26290f 100644 (file)
@@ -46,6 +46,7 @@ import { CatalogModalComponent } from '../catalog-modal/catalog-modal.component'
 import { ExternalRequestAccessService } from 'src/app/shared/services/external-request-access-service/external-request-access.service';
 import { UsersService } from 'src/app/shared/services/users/users.service';
 import { AddTabFunctionService } from 'src/app/shared/services/tab/add-tab-function.service';
+import { AuditLogService } from 'src/app/shared/services/auditLog/audit-log.service';
 
 @Component({
   selector: 'app-dashboard-application-catalog',
@@ -67,7 +68,7 @@ export class DashboardApplicationCatalogComponent implements OnInit {
     return this.applicationCatalogService.options;
   } get layout(): GridsterItem[] {
     return this.applicationCatalogService.layout;
-  } constructor(private applicationCatalogService: ApplicationCatalogService, private externalRequestAccessService: ExternalRequestAccessService, private userService: UsersService,private addTabFuntionService: AddTabFunctionService) {
+  } constructor(private applicationCatalogService: ApplicationCatalogService, private externalRequestAccessService: ExternalRequestAccessService, private userService: UsersService,private addTabFuntionService: AddTabFunctionService, private auditLogService: AuditLogService) {
     this.sortOptions = [{
       index: 0,
       value: 'N',
@@ -119,16 +120,15 @@ export class DashboardApplicationCatalogComponent implements OnInit {
         } else {
           resJson.index = 3;
 
-        }
-
-        
+        } 
+         this.selectedSortType = this.sortOptions[resJson.index];
+        //console.log(this.selectedSortType);
+      this.getAppCatalogService(data);         
       }
          else {
-                 resJson.index = 0;
+                 this.sortTypeChanged('N');
          }
-         this.selectedSortType = this.sortOptions[resJson.index];
-        //console.log(this.selectedSortType);
-      this.getAppCatalogService(data);
+         
                  
     }, error => {
       console.log('getUserAppsSortTypePreference Error Object' + error.message);
@@ -170,6 +170,7 @@ export class DashboardApplicationCatalogComponent implements OnInit {
         this.applicationCatalogService.layout = [];
         for (let entry of data) {
           //console.log("Check the URL" + environment.api.appThumbnail);
+                 if(entry.applicationType != '3'){
           var appCatalog = {
             x: -1,
             y: -1,
@@ -177,7 +178,7 @@ export class DashboardApplicationCatalogComponent implements OnInit {
             name: entry.name,
             subHeaderText: entry.notes,
             imageLink: environment.api.appThumbnail.replace(':appId', <string><any>entry.id),
-            restrictedApp: entry.restrictedApp,
+            applicationType: entry.applicationType,
             select: entry.select,
             access: entry.access,
             pending: entry.pending,
@@ -187,6 +188,7 @@ export class DashboardApplicationCatalogComponent implements OnInit {
           };
           this.applicationCatalogService.addItem(appCatalog);
         }
+               }
       }
     }, error => {
       console.log('getAppCatalogServices Error Object' + error);
@@ -200,7 +202,7 @@ export class DashboardApplicationCatalogComponent implements OnInit {
 
   openAddRoleModal(item: any) {
     //console.log("OpenModal check" + item.id+" "+item.url);
-    if (item.restrictedApp) {
+    if (item.applicationType =='2') {
       // Link-based apps open in their own browser tab
       window.open(item.url, '_blank');
     } else{
@@ -213,4 +215,12 @@ export class DashboardApplicationCatalogComponent implements OnInit {
       this.addTabFuntionService.filter(tabContent);
     }
   }
+
+  auditLog(app:any) {
+    this.auditLogService.storeAudit(app.appid, 'app', app.url).subscribe(data => {
+      console.log('App action Saved');
+    }, error => {
+      console.log('auditLog Save Error' + error);
+    });
+  }
 }
\ No newline at end of file