Commit 85659d99 by chamath

View MC user Audit trial added.

parent 7113eeee
......@@ -10,6 +10,7 @@ import { ConfirmationService, DragDropModule, FileUploadModule, InputMaskModule,
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app.routing';
import { AppService } from './app.service';
import { AuditTrailModule } from './audit-trail/audit-trail.module';
import { AdminIframePageComponent } from './components/admin-portal/admin-iframe-page/admin-iframe-page.component';
import { AdminPortalLayoutComponent } from './components/admin-portal/admin-portal-layout/admin-portal-layout.component';
import { AdminPortalLayoutService } from './components/admin-portal/admin-portal-layout/admin-portal-layout.service';
......@@ -52,7 +53,8 @@ import { GoogleTagManagerService } from './services/google-tag-manager.service';
MultiSelectModule,
DndModule,
FileUploadModule,
KeyFilterModule
KeyFilterModule,
AuditTrailModule
],
declarations: [
AppComponent,
......
import { PrimeNGModules } from '../utils/common.modules.import';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { OneITModule } from '../oneit/oneit.module';
import { AuditTabService } from './components/audit-tab/audit-tab.service';
import { AuditTabComponent } from './components/audit-tab/audit-tab.component';
let components = [
AuditTabComponent
];
let services = [
AuditTabService
];
@NgModule({
imports: [
...PrimeNGModules,
CommonModule,
FormsModule,
OneITModule,
],
declarations: [
...components,
],
exports : [
...components,
],
providers : [
...services,
]
})
export class AuditTrailModule { }
<p-progressSpinner *ngIf="showLoader"></p-progressSpinner>
<div class="ui-g-12 ui-md-12" *ngIf="!showLoader && BO">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane show active" id="v-pills-details" role="tabpanel" aria-labelledby="v-pills-details-tab">
<h3 class="tab-header">Audit Trail</h3>
<div class="dashboard">
<div class="chat">
<div class="event" *ngFor="let event of events">
<div class="ui-g-12 ui-md-6 ui-lg-6">
<h4 class="event-header">Audit Event:</h4>
</div>
<div class="ui-g-12 ui-md-6 ui-lg-6">&nbsp;</div>
<div class="ui-g-12 ui-md-6 ui-lg-6">
<div class="ui-g-12 ui-md-3 ui-lg-3">
<strong>User</strong>
</div>
<div class="ui-g-12 ui-md-3 ui-lg-3">{{event.UserName}}({{event.UserID}})</div>
</div>
<div class="ui-g-12 ui-md-6 ui-lg-6">
<div class="ui-g-12 ui-md-3 ui-lg-3">
<strong>Date</strong>
</div>
<div class="ui-g-12 ui-md-3 ui-lg-3">{{event.ObjectCreated | date: 'dd MMM yyyy hh:mm'}}</div>
</div>
<div class="ui-g-12 ui-md-6 ui-lg-6" *ngIf="event.Description">
<div class="ui-g-12 ui-md-6 ui-lg-6">
<strong>Description</strong>
</div>
<div class="ui-g-12 ui-md-6 ui-lg-6">{{event.Description}}</div>
</div>
<div *ngFor="let changeSet of event.DirectChangeSets">
<div class="ui-g-12 ui-md-6 ui-lg-6">
<div class="ui-g-12 ui-md-6 ui-lg-6">
<p>Change Set : {{changeSet.ReferenceClass}} : {{changeSet.ReferenceID}} ({{changeSet.ObjectStatus?.Name}})</p>
</div>
</div>
<p-table #notesTablesTable [columns]="changeTablesCols" [value]="changeSet.Changes" [paginator]="false" >
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" [style.width]="col.width">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.noSort">
{{col.header}}
<p-sortIcon [field]="col.field" *ngIf="!col.noSort"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
<tr>
<td>
<label> {{rowData.FieldName}} </label>
</td>
<td>
<label> {{rowData.ChangeType.Description}} </label>
</td>
<td>
<label> {{rowData.OldValue}} </label>
</td>
<td>
<label> {{rowData.NewValue}} </label>
</td>
</tr>
</ng-template>
</p-table>
<br><br>
</div>
<div *ngFor="let changeSet of event.ChangeSet">
<div *ngFor="let affectedScope of changeSet.UnallocatedAffectedScopes">
<div class="ui-g-12 ui-md-12 ui-lg-12">
<div class="ui-g-12 ui-md-6 ui-lg-6">
{{affectedScope.Relationship}}
</div>
</div>
<div class="ui-g-12 ui-md-12 ui-lg-12">
<div class="ui-g-12 ui-md-6 ui-lg-6">
Change Set : {{affectedScope.ChangeSet?.ReferenceClass}} : {{affectedScope.ChangeSet?.ReferenceID}} ({{affectedScope.ChangeSet?.ObjectStatus?.Name}})
</div>
</div>
<p-table #notesTablesTable [columns]="changeTablesCols" [value]="affectedScope.ChangeSet?.Changes" [paginator]="false" >
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" [style.width]="col.width">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.noSort">
{{col.header}}
<p-sortIcon [field]="col.field" *ngIf="!col.noSort"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
<tr>
<td>
<label> {{rowData.FieldName}} </label>
</td>
<td>
<label> {{rowData.ChangeType.Description}} </label>
</td>
<td>
<label> {{rowData.OldValue}} </label>
</td>
<td>
<label> {{rowData.NewValue}} </label>
</td>
</tr>
</ng-template>
</p-table>
<br><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
h4.event-header {
margin: 0px;
}
div.ui-g-12.ui-md-6 {
padding: 0px;
}
\ No newline at end of file
import { Component, Input, OnDestroy, OnInit, ViewChild, OnChanges, SimpleChange } from '@angular/core';
import { NgForm } from '@angular/forms';
import { Subscription } from 'rxjs';
import { UtilsService } from '../../../oneit/services/utils.service';
import { UserService } from '../../../oneit/services/user.service';
import { AuditTabService } from './audit-tab.service';
@Component({
selector: 'app-audit-tab',
templateUrl: './audit-tab.component.html',
styleUrls: ['./audit-tab.component.scss'],
})
export class AuditTabComponent implements OnInit, OnDestroy, OnChanges {
subscriptions : Array<Subscription> = [];
@ViewChild('form') form : NgForm;
@Input() BO : any;
@Input() ShowAffectedObjects : boolean = true;
events : any[] = [];
showLoader : boolean = false;
reloadTextarea : boolean = false;
showScrollToBottom : boolean = false;
currentUserID : string;
inProgress : boolean = false;
changeTablesCols = [
{ field: 'Field', header: 'Field', width: '25%', noSort: true, noFilter: true},
{ field: 'ChangeType.Description', header: 'Change Type', width: '25%', noSort: true, noFilter: true},
{ field: 'OldValue', header: 'Old', width: '25%', noSort: true, noFilter: true},
{ field: 'NewValue', header: 'New', width: '25%', noSort: true, noFilter: true},
];
constructor(
private utilsService : UtilsService,
private auditTabService : AuditTabService,
private userService : UserService,
) {
}
ngOnInit() {
this.currentUserID = this.userService.getUserid();
}
ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
for (let propName in changes) {
if(propName == 'BO') {
setTimeout(() => {
if (this.BO && this.BO.ObjectID) {
this.getEvents();
}
}, 500);
}
}
}
ngOnDestroy(){
this.utilsService.unsubscribeSubscriptions(this.subscriptions);
}
private getEvents() {
if (this.BO && this.BO.ObjectID) {
this.subscriptions.push(
this.auditTabService.getAuditEvents(this.BO, ['ChangeSet', 'ChangeSet.Changes','ChangeSet.AffectedScope',
'ChangeSet.AffectedScope.ChangeSet','DirectChangeSets', 'DirectChangeSets.Changes',
'ChangeSet.UnallocatedAffectedScopes','ChangeSet.UnallocatedAffectedScopes.ChangeSet'], this.ShowAffectedObjects)
.subscribe(
data => {
this.events = data;
},
error => {
this.utilsService.handleError(error);
}
)
);
}
}
}
import { SearchAudit } from './audit.model';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import { SearchService } from '../../../oneit/services/search.service';
import { UtilsService } from '../../../oneit/services/utils.service';
@Injectable()
export class AuditTabService {
DocumentTypes : any;
openDocument = new Subject<any>();
constructor(
private searchService : SearchService,
private utilsService : UtilsService,
) {
}
getAuditEvents(bo, assocs, ShowAffectedObjects): Observable<any> {
let searchAudit = new SearchAudit();
searchAudit.RelatesToID = parseInt(this.utilsService.getId(bo.ObjectID));
searchAudit.RelatesToClass = bo.ObjectClass;
searchAudit.ShowAffectedObjects = ShowAffectedObjects;
return this.searchService.getObjects("AuditEvents", "All", searchAudit, assocs, null, null, null, null, null)
.map(
data => {
return this.utilsService.convertResponseToObjects(data, assocs);
}
);
}
}
\ No newline at end of file
export class SearchAudit {
RelatesToID : number;
RelatesToClass : string;
ShowAffectedObjects : boolean;
}
\ No newline at end of file
......@@ -98,122 +98,8 @@
</div>
</div>
</p-tabPanel>
<p-tabPanel header="Audit Trail" >
<div class="ui-g-12 ui-md-12">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-details" role="tabpanel" aria-labelledby="v-pills-details-tab">
<h2 class="tab-header">Audit Trail</h2>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> Audit Event: by Peter Smith (25585) </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> 10 Feb 2020 15:45 </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> Changeset: Update Profile: 2568554 (Edit) </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-12">
<p-table #bosTable [columns]="bosCols" [value]="bos" [paginator]="false" >
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" [style.width]="col.width">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.noSort">
{{col.header}}
<p-sortIcon [field]="col.field" *ngIf="!col.noSort"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
<tr>
<td>
{{rowData.Field}}
</td>
<td>
{{rowData.ChangeType}}
</td>
<td>
{{rowData.Old}}
</td>
<td>
{{rowData.New}}
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-12">
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> Audit Event: by Peter Smith (25585) </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> 02 Feb 2020 15:45 </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-5">
<label> Changeset: Workplace Preference (Culture) : 2568554 (NEW) </label>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-12">
<p-table #bosTable [columns]="bosCols" [value]="bos" [paginator]="false" >
<ng-template pTemplate="colgroup" let-columns>
<colgroup>
<col *ngFor="let col of columns" [style.width]="col.width">
</colgroup>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field" [pSortableColumnDisabled]="col.noSort">
{{col.header}}
<p-sortIcon [field]="col.field" *ngIf="!col.noSort"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
<tr>
<td>
{{rowData.Field}}
</td>
<td>
{{rowData.ChangeType}}
</td>
<td>
{{rowData.Old}}
</td>
<td>
{{rowData.New}}
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-12">
</div>
</div>
</div>
</div>
</div>
<p-tabPanel header="Audit Trail" headerStyleClass="contactdetails">
<app-audit-tab [BO]="careerUser.Candidate.User"></app-audit-tab>
</p-tabPanel>
</p-tabView>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment