File

src/app/audit/audit-record-details/audit-record-details.component.ts

Description

Provides details for an AuditRecord.

Implements

OnInit OnDestroy

Example

Metadata

selector app-details
styleUrls styles.scss
templateUrl ./audit-record-details.component.html

Index

Properties
Methods

Constructor

constructor(auditRecordService: AuditRecordService, notificationService: NotificationService, route: ActivatedRoute, routingStateService: RoutingStateService, loggerService: LoggerService)

Constructor

Parameters :
Name Type Optional Description
auditRecordService AuditRecordService
notificationService NotificationService
route ActivatedRoute
routingStateService RoutingStateService
loggerService LoggerService

Methods

cancel
cancel()

Back action Navigate to the previous URL or /audit-records

Returns : void
loadAuditRecordDetails
loadAuditRecordDetails()

Used to load properties

Returns : void
ngOnDestroy
ngOnDestroy()

Will cleanup any {@link Subscription}s to prevent memory leaks.

Returns : void
ngOnInit
ngOnInit()

Init

Returns : void
refresh
refresh()

Refresh page, load the current version informations

Returns : void

Properties

auditRecord
auditRecord: AuditRecord
Type : AuditRecord

AuditRecord

Private ngUnsubscribe$
ngUnsubscribe$: Subject<any>
Type : Subject<any>

Unsubscribe

import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AuditRecordService } from '../audit-record.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { RoutingStateService } from '../../shared/services/routing-state.service';
import { NotificationService } from '../../shared/services/notification.service';
import { LoggerService } from '../../shared/services/logger.service';
import { HttpAppError, AppError } from '../../shared/model/error.model';
import { AuditRecord } from '../../shared/model/audit-record.model';

/**
 * Provides details for an AuditRecord.
 *
 * @author Gunnar Hillert
 */
@Component({
  selector: 'app-details',
  styleUrls: ['./styles.scss'],
  templateUrl: './audit-record-details.component.html'
})
export class AuditRecordDetailsComponent implements OnInit, OnDestroy {

  /**
   * Unsubscribe
   */
  private ngUnsubscribe$: Subject<any> = new Subject();

  /**
   * AuditRecord
   */
  auditRecord: AuditRecord;

  /**
   * Constructor
   *
   * @param {AuditRecordService} auditRecordService
   * @param {NotificationService} notificationService
   * @param {ActivatedRoute} route
   * @param {RoutingStateService} routingStateService
   * @param {LoggerService} loggerService
   */
  constructor(private auditRecordService: AuditRecordService,
              private notificationService: NotificationService,
              private route: ActivatedRoute,
              private routingStateService: RoutingStateService,
              private loggerService: LoggerService) {
  }

  /**
   * Init
   */
  ngOnInit() {
    this.loggerService.log('Audit Record Details');

    this.route.params
      .subscribe(params => {
        this.auditRecord = new AuditRecord();
        this.auditRecord.auditRecordId = params.auditRecordId as number;
        this.refresh();
      });
  }

  /**
   * Will cleanup any {@link Subscription}s to prevent
   * memory leaks.
   */
  ngOnDestroy() {
    this.ngUnsubscribe$.next();
    this.ngUnsubscribe$.complete();
  }

  /**
   * Refresh page, load the current version informations
   */
  refresh() {
    this.loadAuditRecordDetails();
  }

  /**
   * Used to load properties
   */
  loadAuditRecordDetails() {
    this.loggerService.log('Retrieving Audit Record details for id ' + this.auditRecord.auditRecordId + '.');
    this.auditRecordService.getAuditRecordDetails(this.auditRecord.auditRecordId)
      .pipe(takeUntil(this.ngUnsubscribe$))
      .subscribe((auditRecord: AuditRecord) => {
          this.auditRecord = auditRecord;
        },
        error => {
          if (HttpAppError.is404(error)) {
            this.cancel();
          }
          this.notificationService.error(AppError.is(error) ? error.getMessage() : error);
        });
  }

  /**
   * Back action
   * Navigate to the previous URL or /audit-records
   */
  cancel() {
    this.routingStateService.back('/audit-records', /^(\/audit-records\/)/);
  }
}
<app-page id="audit-record-details-list">

  <app-page-head>
    <app-page-head-back [defaultUrl]="'/audit-records'" [isNotRegex]="'^(\/audit-records\/)'"></app-page-head-back>
    <app-page-head-title>Audit Records Details (<strong>{{ auditRecord.auditRecordId }}</strong>)</app-page-head-title>
  </app-page-head>


  <div dataflowLayoutType type="large">

    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Id:</strong>
      </div>
      <div class="col-md-21">
        {{ auditRecord.auditRecordId }}
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Created On:</strong>
      </div>
      <div class="col-md-21">
        {{ auditRecord.createdOn | dataflowDateTime }}
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Action:</strong>
      </div>
      <div class="col-md-21">
        <app-audit-record-action [auditRecord]="auditRecord"></app-audit-record-action>
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Operation:</strong>
      </div>
      <div class="col-md-21">
        <app-audit-record-operation [auditRecord]="auditRecord"></app-audit-record-operation>
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Operation Id:</strong>
      </div>
      <div class="col-md-21">
        <strong>{{ auditRecord.correlationId }}</strong>
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Created By:</strong>
      </div>
      <div class="col-md-21">
        {{ auditRecord.createdBy ? auditRecord.createdBy : 'N/A' }}
      </div>
    </div>
    <div class="row audit-summary-row">
      <div class="col-md-3">
        <strong>Data:</strong>
      </div>
      <div class="col-md-21">
        <pre class="audit-pre">{{ auditRecord.auditData | json }}</pre>
      </div>
    </div>

  </div>

</app-page>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""