1 import { Component, OnInit, ViewChild } from '@angular/core';
2 import { SdcUiServices } from 'onap-ui-angular';
3 import { Activity } from '../../../../models/activity';
4 import { ActivityLogService } from '../../../services/activity-log.service';
5 import { WorkspaceService } from '../workspace.service';
8 selector: 'activity-log',
9 templateUrl: './activity-log.component.html',
10 styleUrls: ['./activity-log.component.less', '../../../../../assets/styles/table-style.less']
12 export class ActivityLogComponent implements OnInit {
14 activities: Activity[] = [];
15 temp: Activity[] = [];
17 constructor(private workspaceService: WorkspaceService,
18 private activityLogService: ActivityLogService,
19 private loaderService: SdcUiServices.LoaderService) {
23 this.loaderService.activate();
24 const componentId: string = this.workspaceService.metadata.uniqueId;
25 const componentType: string = this.workspaceService.metadata.componentType;
26 this.activityLogService.getActivityLog(componentType, componentId).subscribe((logs) => {
27 this.activities = logs;
28 this.temp = [...logs];
29 this.loaderService.deactivate();
30 }, (error) => { this.loaderService.deactivate(); });
34 const val = event.target.value.toLowerCase();
37 const temp = this.temp.filter((activity: Activity) => {
39 activity.COMMENT.toLowerCase().indexOf(val) !== -1 ||
40 activity.STATUS.toLowerCase().indexOf(val) !== -1 ||
41 activity.ACTION.toLowerCase().indexOf(val) !== -1 ||
42 activity.MODIFIER.toLowerCase().indexOf(val) !== -1;
46 this.activities = temp;