import { Component , Input } from '@angular/core' ; import { RenderResult } from '../../../models/cmdb-render' ; class MetaView { private readonly headers : { [ key ] : object | string | number ; } [ ] = [ { 'Public ID' : this . objectID } , { 'Type ID' : this . typeID } , { 'Type Name' : this . typeName } , { 'Creation Time' : this . creationTime } , { 'Author ID' : this . authorID } , { 'Author Name' : this . authorName } ] ; constructor ( public objectID , public typeID , public typeName , public creationTime , public authorID , public authorName ) { } public get headerLine ( ) { return this . headers ; } } @ Component ( { selector : 'cmdb-object-view-meta' , templateUrl : './object-view-meta.component.html' , styleUrls : [ './object-view-meta.component.scss' ] } ) export class ObjectViewMetaComponent { public meteObject : MetaView = null ; private _renderResult : any ; @ Input ( 'renderResult' ) public set renderResult ( data ) { if ( data !== undefined ) { this . _renderResult = data ; this . meteObject = new MetaView ( this . renderResult . object_information . object_id , this . renderResult . type_information . type_id , this . renderResult . type_information . type_label , this . renderResult . object_information . creation_time . $date , this . renderResult . object_information . author_id , this . renderResult . object_information . author_name ) ; } } public get renderResult ( ) : RenderResult { return this . _renderResult ; } public isObject ( value ) { return typeof value === 'object' ; } }