diff --git a/@overflow/commons/ui/pipe/index.ts b/@overflow/commons/ui/pipe/index.ts index 113fc28..1899a16 100644 --- a/@overflow/commons/ui/pipe/index.ts +++ b/@overflow/commons/ui/pipe/index.ts @@ -1,2 +1,7 @@ +import { ObjectKeys } from "./object-keys"; +import { stringPrettify } from "./string-prettify"; + export const PIPES = [ + ObjectKeys, + stringPrettify ]; diff --git a/@overflow/commons/ui/pipe/object-keys.ts b/@overflow/commons/ui/pipe/object-keys.ts new file mode 100644 index 0000000..7449c8c --- /dev/null +++ b/@overflow/commons/ui/pipe/object-keys.ts @@ -0,0 +1,8 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'objectKeys' }) +export class ObjectKeys implements PipeTransform { + transform(value: any, args: any[] = null): any { + return Object.keys(value); + } +} \ No newline at end of file diff --git a/@overflow/commons/ui/pipe/string-prettify.ts b/@overflow/commons/ui/pipe/string-prettify.ts new file mode 100644 index 0000000..9040407 --- /dev/null +++ b/@overflow/commons/ui/pipe/string-prettify.ts @@ -0,0 +1,10 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'stringPrettify' }) +export class stringPrettify implements PipeTransform { + transform(value: string): any { + value = value.replace('-', ' '); + value = value.replace('_', ' '); + return value.charAt(0).toUpperCase() + value.slice(1); + } +} \ No newline at end of file diff --git a/src/commons/component/host-detail.component.html b/src/commons/component/host-detail.component.html index d0eac6a..b76187d 100644 --- a/src/commons/component/host-detail.component.html +++ b/src/commons/component/host-detail.component.html @@ -30,16 +30,14 @@ {{host.mac}} -
  • - Discovered by - {{host.discoveredBy.join(',')}} -
  • - - + +
    + {{key | stringPrettify}}: {{host.meta[key]}} +
    diff --git a/src/commons/component/host-detail.component.ts b/src/commons/component/host-detail.component.ts index 5b2ad47..8e7177f 100644 --- a/src/commons/component/host-detail.component.ts +++ b/src/commons/component/host-detail.component.ts @@ -12,11 +12,11 @@ export class HostDetailComponent { @Input() host: Host; ports: Port[]; selectedPort: Port; + discoveredBy: string; constructor( ) { } - }