From b525f400633591b766ab8938161ee87b1cb7f42a Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 31 May 2018 17:27:00 +0900 Subject: [PATCH] ing --- .../component/noauth-probe-list.component.html | 6 +++++- .../component/noauth-probe-list.component.ts | 1 + @overflow/shared/ui/pipe/index.ts | 5 +++++ @overflow/shared/ui/pipe/uptime.pipe.ts | 14 ++++++++++++++ @overflow/shared/ui/ui.module.ts | 3 +++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 @overflow/shared/ui/pipe/index.ts create mode 100644 @overflow/shared/ui/pipe/uptime.pipe.ts diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.html b/@overflow/noauth-probe/component/noauth-probe-list.component.html index 3428d29..e61eb1e 100644 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.html +++ b/@overflow/noauth-probe/component/noauth-probe-list.component.html @@ -47,7 +47,11 @@ HostID: {{rowData.descriptions.host.hostID}}
- Connected: {{rowData.connectDate | date: 'dd/MM/yyyy'}} ({{rowData.connectAddress}}) + Connected: + + Not Connected + {{rowData.connectDate | date: 'dd/MM/yyyy'}} ({{rowData.connectAddress}}) +
diff --git a/@overflow/noauth-probe/component/noauth-probe-list.component.ts b/@overflow/noauth-probe/component/noauth-probe-list.component.ts index 72e31a6..14e85f2 100644 --- a/@overflow/noauth-probe/component/noauth-probe-list.component.ts +++ b/@overflow/noauth-probe/component/noauth-probe-list.component.ts @@ -29,6 +29,7 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy { private store: Store, private noAuthProbeService: NoAuthProbeService, ) { + this.noauthProbes = []; } ngOnInit() { diff --git a/@overflow/shared/ui/pipe/index.ts b/@overflow/shared/ui/pipe/index.ts new file mode 100644 index 0000000..b5fc40d --- /dev/null +++ b/@overflow/shared/ui/pipe/index.ts @@ -0,0 +1,5 @@ +import { UPTimePipe } from './uptime.pipe'; + +export const PIPES = [ + UPTimePipe, +]; diff --git a/@overflow/shared/ui/pipe/uptime.pipe.ts b/@overflow/shared/ui/pipe/uptime.pipe.ts new file mode 100644 index 0000000..0e21413 --- /dev/null +++ b/@overflow/shared/ui/pipe/uptime.pipe.ts @@ -0,0 +1,14 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { DatePipe } from '@angular/common'; + +@Pipe({ + name: 'ofUPTime' +}) +export class UPTimePipe extends DatePipe implements PipeTransform { + transform(value: any, nullString: string, format = 'mediumDate', timezone?: string, locale?: string): string | null { + if (value == null || value === '' || value !== value) { + return nullString; + } + return super.transform(value, format, timezone, locale); + } +} diff --git a/@overflow/shared/ui/ui.module.ts b/@overflow/shared/ui/ui.module.ts index ee53c75..bf028d8 100644 --- a/@overflow/shared/ui/ui.module.ts +++ b/@overflow/shared/ui/ui.module.ts @@ -4,6 +4,7 @@ import { PRIME_NG_MODULES } from './ui-prime-ng.module'; import { COMPONENTS } from './component'; import { DIRECTIVES } from './directive'; +import { PIPES } from './pipe'; @NgModule({ imports: [ @@ -14,10 +15,12 @@ import { DIRECTIVES } from './directive'; PRIME_NG_MODULES, COMPONENTS, DIRECTIVES, + PIPES, ], declarations: [ COMPONENTS, DIRECTIVES, + PIPES, ], }) export class UIModule { }