From d86c814085defec372d5157772e3145b26592675 Mon Sep 17 00:00:00 2001 From: Paul Mck Date: Fri, 29 Mar 2019 15:12:11 +0300 Subject: [PATCH] added build Infromation --- src/modules/core/components/_index.ts | 1 + .../build-information-dialog.component.html | 25 +++++++++++++ .../build-information-dialog.component.scss | 37 +++++++++++++++++++ .../build-information-dialog.component.ts | 16 ++++++++ src/modules/core/components/dialogs/index.ts | 1 + .../components/navbar/navbar.component.html | 11 ++++-- .../components/navbar/navbar.component.scss | 15 ++++++-- src/modules/core/core.module.ts | 7 ++++ .../services/build-information.service.ts | 21 +++++++++++ src/modules/shared/directives/_index.ts | 1 + .../directives/build-information.directive.ts | 23 ++++++++++++ src/modules/shared/shared.module.ts | 4 +- 12 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 src/modules/core/components/dialogs/build-information-dialog.component.html create mode 100644 src/modules/core/components/dialogs/build-information-dialog.component.scss create mode 100644 src/modules/core/components/dialogs/build-information-dialog.component.ts create mode 100644 src/modules/core/components/dialogs/index.ts create mode 100644 src/modules/core/services/build-information.service.ts create mode 100644 src/modules/shared/directives/build-information.directive.ts diff --git a/src/modules/core/components/_index.ts b/src/modules/core/components/_index.ts index ceaeeeb2..139aeb0d 100644 --- a/src/modules/core/components/_index.ts +++ b/src/modules/core/components/_index.ts @@ -1,2 +1,3 @@ export * from './navbar/navbar.component'; export * from './page-not-found/page-not-found.component'; +export * from './dialogs'; diff --git a/src/modules/core/components/dialogs/build-information-dialog.component.html b/src/modules/core/components/dialogs/build-information-dialog.component.html new file mode 100644 index 00000000..309d41fe --- /dev/null +++ b/src/modules/core/components/dialogs/build-information-dialog.component.html @@ -0,0 +1,25 @@ +
+
Build information
+
+
+ {{ serviceInfo.name }} +
+
+
+
+ {{item.key}} +
+
+
+
+ + {{item.value}} + +
+
+
+ +
+
+ +n/a \ No newline at end of file diff --git a/src/modules/core/components/dialogs/build-information-dialog.component.scss b/src/modules/core/components/dialogs/build-information-dialog.component.scss new file mode 100644 index 00000000..e6dbd557 --- /dev/null +++ b/src/modules/core/components/dialogs/build-information-dialog.component.scss @@ -0,0 +1,37 @@ +.build-info { + &__title { + text-transform: uppercase; + text-align: center; + font-size: 18px; + letter-spacing: 1px; + color: #35495a; + margin-bottom: 24px + } + + &__service-info { + margin-bottom: 24px; + } +} + +.service-info { + &__title { + text-transform: uppercase; + letter-spacing: 1px; + color: #213f48; + font-weight: 700; + margin-bottom: 8px + } + &__container { + display: flex; + } + &__key, &__value { + min-height: 24px; + } + &__key { + color: #787d82; + font-size: 12px; + letter-spacing: 1px; + text-align: right; + padding-right: 4px; + } +} \ No newline at end of file diff --git a/src/modules/core/components/dialogs/build-information-dialog.component.ts b/src/modules/core/components/dialogs/build-information-dialog.component.ts new file mode 100644 index 00000000..ab22f05e --- /dev/null +++ b/src/modules/core/components/dialogs/build-information-dialog.component.ts @@ -0,0 +1,16 @@ +import { Component } from '@angular/core'; +import { BuildInformationService } from '@core/services/build-information.service'; +import { Observable } from 'rxjs'; + +@Component({ + templateUrl: './build-information-dialog.component.html', + styleUrls: ['./build-information-dialog.component.scss'], +}) +export class BuildInformationDialogComponent { + buildInfo$: Observable; + constructor( + buildInfo: BuildInformationService + ) { + this.buildInfo$ = buildInfo.getBuildInformation(); + } +} diff --git a/src/modules/core/components/dialogs/index.ts b/src/modules/core/components/dialogs/index.ts new file mode 100644 index 00000000..62c73282 --- /dev/null +++ b/src/modules/core/components/dialogs/index.ts @@ -0,0 +1 @@ +export * from './build-information-dialog.component'; diff --git a/src/modules/core/components/navbar/navbar.component.html b/src/modules/core/components/navbar/navbar.component.html index 9726d16b..1abaa003 100644 --- a/src/modules/core/components/navbar/navbar.component.html +++ b/src/modules/core/components/navbar/navbar.component.html @@ -12,7 +12,12 @@ Applications - - Documentation - + diff --git a/src/modules/core/components/navbar/navbar.component.scss b/src/modules/core/components/navbar/navbar.component.scss index def0974f..40d5166a 100644 --- a/src/modules/core/components/navbar/navbar.component.scss +++ b/src/modules/core/components/navbar/navbar.component.scss @@ -57,13 +57,22 @@ $active-color: white; } } - &__documentation { + &__support-info { + position: absolute; + right: 24px; + } + &__documentation, &__build-info { cursor: pointer; color: rgba(255, 255, 255, 0.5); transition: color .3s ease; - position: absolute; - right: 24px; text-decoration: none; + text-transform: uppercase; + font-weight: 100; + font-size: 10px; + padding-left: 12px; + letter-spacing: 1px; + color: #b6b9bfe6; + &:hover { color: rgba(255, 255, 255, .8); } diff --git a/src/modules/core/core.module.ts b/src/modules/core/core.module.ts index 71add595..d8ee8eeb 100644 --- a/src/modules/core/core.module.ts +++ b/src/modules/core/core.module.ts @@ -40,13 +40,18 @@ import { import { StoreModule } from '@ngrx/store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; +import { BuildInformationDialogComponent } from '@core/components/_index'; import { reducers, CustomRouterStateSerializer } from '@core/reducers'; import { MetricsService } from '@core/services/metrics/metrics.service'; import { ReqstoreService } from '@core/services/reqstore.service'; import { RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store'; import { SharedModule } from '@shared/shared.module'; +import { BuildInformationService } from '@core/services/build-information.service'; @NgModule({ + entryComponents: [ + BuildInformationDialogComponent, + ], imports: [ CommonModule, RouterModule, @@ -88,6 +93,7 @@ import { SharedModule } from '@shared/shared.module'; declarations: [ NavbarComponent, PageNotFoundComponent, + BuildInformationDialogComponent, ], providers: [ ModelBuilder, @@ -104,6 +110,7 @@ import { SharedModule } from '@shared/shared.module'; { provide: RouterStateSerializer, useClass: CustomRouterStateSerializer }, SvgSpriteService, ReqstoreService, + BuildInformationService, ], }) export class CoreModule { } diff --git a/src/modules/core/services/build-information.service.ts b/src/modules/core/services/build-information.service.ts new file mode 100644 index 00000000..f576337f --- /dev/null +++ b/src/modules/core/services/build-information.service.ts @@ -0,0 +1,21 @@ +import { Injectable } from '@angular/core'; +import { HttpService } from '@core/services/http'; +import { Observable } from 'rxjs'; +import { combineLatest } from 'rxjs'; + +@Injectable() +export class BuildInformationService { + private buildInfoApi = '/api/buildinfo'; + private gatewayInfoApi = '/gateway/buildinfo'; + + constructor( + private http: HttpService + ) {} + + getBuildInformation(): Observable { + return combineLatest( + this.http.get(this.buildInfoApi), + this.http.get(this.gatewayInfoApi) + ); + } +} diff --git a/src/modules/shared/directives/_index.ts b/src/modules/shared/directives/_index.ts index e1b580af..7748d3b9 100644 --- a/src/modules/shared/directives/_index.ts +++ b/src/modules/shared/directives/_index.ts @@ -1,2 +1,3 @@ export * from './model-version-status.directive'; export * from './copy-to-buffer.directive'; +export * from './build-information.directive'; diff --git a/src/modules/shared/directives/build-information.directive.ts b/src/modules/shared/directives/build-information.directive.ts new file mode 100644 index 00000000..b099eb47 --- /dev/null +++ b/src/modules/shared/directives/build-information.directive.ts @@ -0,0 +1,23 @@ +import { Directive, HostListener } from '@angular/core'; +import { BuildInformationDialogComponent } from '@core/_index'; +import { DialogService } from '@dialog/dialog.service'; + +@Directive({ + selector: '[hsBuildInformation]', +}) +export class BuildInformationDirective { + constructor( + private dialog: DialogService + ) { + } + + @HostListener('click') + onclick() { + this.dialog.createDialog({ + component: BuildInformationDialogComponent, + styles: { + width: '600px', + }, + }); + } +} diff --git a/src/modules/shared/shared.module.ts b/src/modules/shared/shared.module.ts index aef4d914..c9c0c83d 100644 --- a/src/modules/shared/shared.module.ts +++ b/src/modules/shared/shared.module.ts @@ -47,7 +47,8 @@ import { // Directives import { ModelVersionStatusDirective, - CopyToBufferDirective + CopyToBufferDirective, + BuildInformationDirective, } from './directives/_index'; const PIPES = [ @@ -86,6 +87,7 @@ const COMPONENTS = [ const DIRECTIVES = [ ModelVersionStatusDirective, CopyToBufferDirective, + BuildInformationDirective, ]; @NgModule({