From c2dbc6aea6fa9abfd0740c5e0bbb671881faba8f Mon Sep 17 00:00:00 2001 From: ryzhak Date: Fri, 26 Oct 2018 16:54:39 +0300 Subject: [PATCH] #12 show 'not set' if address is 0x00 --- src/app/dashboard/home/home.component.html | 8 ++++---- src/app/shared/pipes/index.ts | 1 + .../readable-empty-value.pipe.ts | 12 ++++++++++++ src/app/shared/shared.module.ts | 4 +++- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 src/app/shared/pipes/readable-empty-value/readable-empty-value.pipe.ts diff --git a/src/app/dashboard/home/home.component.html b/src/app/dashboard/home/home.component.html index ad3babb..52361c9 100644 --- a/src/app/dashboard/home/home.component.html +++ b/src/app/dashboard/home/home.component.html @@ -20,19 +20,19 @@

Next episode

Next host address - {{ nextEpisode.nextShowHost }} + {{ nextEpisode.nextShowHost | readableEmptyValue }} Next guest address - {{ nextEpisode.nextShowGuest }} + {{ nextEpisode.nextShowGuest | readableEmptyValue }} Previous host address - {{ nextEpisode.prevShowHost }} + {{ nextEpisode.prevShowHost | readableEmptyValue }} Previous guest address - {{ nextEpisode.prevShowGuest }} + {{ nextEpisode.prevShowGuest | readableEmptyValue }} Used ad slots diff --git a/src/app/shared/pipes/index.ts b/src/app/shared/pipes/index.ts index f03b9e3..5453ef7 100644 --- a/src/app/shared/pipes/index.ts +++ b/src/app/shared/pipes/index.ts @@ -1,2 +1,3 @@ +export { ReadableEmptyValuePipe } from './readable-empty-value/readable-empty-value.pipe'; export { ReadableMethodParamPipe } from './readable-method-param/readable-method-param.pipe'; export { ReadableMethodSignPipe } from './readable-method-sign/readable-method-sign.pipe'; diff --git a/src/app/shared/pipes/readable-empty-value/readable-empty-value.pipe.ts b/src/app/shared/pipes/readable-empty-value/readable-empty-value.pipe.ts new file mode 100644 index 0000000..2d30b29 --- /dev/null +++ b/src/app/shared/pipes/readable-empty-value/readable-empty-value.pipe.ts @@ -0,0 +1,12 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'readableEmptyValue' }) +export class ReadableEmptyValuePipe implements PipeTransform { + + transform(value: string) { + let result = "No data"; + if(value == "0x0000000000000000000000000000000000000000") result = "Not set"; + return result; + } + +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index dff455b..81bd192 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -1,17 +1,19 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { ReadableMethodParamPipe, ReadableMethodSignPipe } from './pipes'; +import { ReadableEmptyValuePipe, ReadableMethodParamPipe, ReadableMethodSignPipe } from './pipes'; @NgModule({ imports: [ CommonModule ], declarations: [ + ReadableEmptyValuePipe, ReadableMethodParamPipe, ReadableMethodSignPipe ], exports: [ + ReadableEmptyValuePipe, ReadableMethodParamPipe, ReadableMethodSignPipe ]