summaryrefslogtreecommitdiffstats
path: root/portal-FE-common/src/app/layout/components
diff options
context:
space:
mode:
Diffstat (limited to 'portal-FE-common/src/app/layout/components')
-rw-r--r--portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html6
-rw-r--r--portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts3
-rw-r--r--portal-FE-common/src/app/layout/components/tabbar/tabbar.component.ts32
3 files changed, 36 insertions, 5 deletions
diff --git a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html
index 1e0518b5..d43328d5 100644
--- a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html
+++ b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.html
@@ -38,7 +38,7 @@
<div style="display: flex; flex-direction:column">
<mat-tab-group [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)"
- (selectedTabChange)="tabChanged($event)">
+ (selectedTabChange)="tabChanged($event);auditLog($event)" >
<mat-tab [label]="mainTab">
<!--
<mat-grid-list cols="5">
@@ -68,10 +68,10 @@
</mat-tab>
- <mat-tab *ngFor="let tab of tabs; let index = index">
+ <mat-tab *ngFor="let tab of tabs; let index = index" >
<ng-template mat-tab-label>
{{tab.label | elipsis: 13}} &nbsp;
- <i class="icon ion-md-close-circle" (click)="removeTab(index)"></i>
+ <i class="icon ion-md-close-circle" (click)="removeTab(index);removeAppObject(index)"></i>
</ng-template>
diff --git a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts
index 76aaa3e7..066d73ff 100644
--- a/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts
+++ b/portal-FE-common/src/app/layout/components/tabbar/tabbar.component.spec.ts
@@ -43,6 +43,7 @@ import { NgMaterialModule } from 'src/app/ng-material-module';
import { Component } from '@angular/core';
import { ElipsisPipe } from 'src/app/shared/pipes/elipsis/elipsis.pipe';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { HttpClientTestingModule} from '@angular/common/http/testing';
describe('TabbarComponent', () => {
let component: TabbarComponent;
@@ -51,7 +52,7 @@ describe('TabbarComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TabbarComponent, AppSideBarStubComponent, AppUserBarStubComponent,RouterOutletStubComponent,AppFooterBarStubComponent,ElipsisPipe],
- imports: [NgMaterialModule,BrowserAnimationsModule]
+ imports: [NgMaterialModule,BrowserAnimationsModule,HttpClientTestingModule]
})
.compileComponents();
}));
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);
+ });
+ }
}