X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=portal-FE-common%2Fsrc%2Fapp%2Flayout%2Fcomponents%2Ftabbar%2Ftabbar.component.ts;h=b157abbc16adbb8b917afe6512c4e16c0b504151;hb=0964afff41ff186eb0bb2bd679a34513e90d1015;hp=b0b882d3df5a2bdee1d767de58e6d487c1324f6d;hpb=dc35cacae0c16b16985effa1459cf96d646811ff;p=portal.git diff --git a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts index b0b882d3..b157abbc 100644 --- a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts +++ b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts @@ -40,6 +40,7 @@ import { FormControl } from '@angular/forms'; import { DomSanitizer } from '@angular/platform-browser'; import { Tab } from './tab'; 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-tabbar', @@ -49,11 +50,12 @@ import { AddTabFunctionService } from 'src/app/shared/services/tab/add-tab-funct export class TabbarComponent implements OnInit { tabs = []; + tabsInfoObject = []; mainTab = 'Home'; selected = new FormControl(0); collapedSideBar: boolean; - constructor(private sanitizer: DomSanitizer, private addTabFuntionService: AddTabFunctionService) { + constructor(private sanitizer: DomSanitizer, private addTabFuntionService: AddTabFunctionService, private auditLogService: AuditLogService) { } @@ -61,7 +63,9 @@ export class TabbarComponent implements OnInit { this.addTabFuntionService.listen().subscribe((m: any) => { console.log(m); + this.createAppObject(m); this.addTab(true, m.title, m.url); + }) } @@ -76,6 +80,15 @@ export class TabbarComponent implements OnInit { } } + createAppObject(app:any) { + this.tabsInfoObject.push(app); + } + + removeAppObject(index:number) { + this.tabsInfoObject.splice(index, 1); + + } + removeTab(index: number) { this.tabs.splice(index, 1); } @@ -85,6 +98,7 @@ export class TabbarComponent implements OnInit { } tabChanged($event) { + console.log("$event.index "+$event.value); for (const ttab of this.tabs) { ttab.active = false; @@ -99,4 +113,20 @@ export class TabbarComponent implements OnInit { }; return style; } + + auditLog($event) { + var app = this.tabsInfoObject[$event.index - 1]; + var comment = ''; + if(app.content==null || app.content==''){ + comment= app.title; + } + else{ + comment = app.content; + } + this.auditLogService.storeAudit(app.appId, 'tab', comment).subscribe(data => { + console.log('Tab action Saved'); + }, error => { + console.log('auditLog Save Error' + error); + }); + } }