1
- import { Component } from '@angular/core' ;
1
+ import { Component , OnInit } from '@angular/core' ;
2
2
import { Meta } from '@angular/platform-browser' ;
3
3
4
4
@Component ( {
5
5
selector : 'footnote' ,
6
6
standalone : true ,
7
7
providers : [ ] ,
8
8
imports : [ ] ,
9
- templateUrl : './footnote.component.html'
9
+ templateUrl : './footnote.component.html' ,
10
+ styleUrl : './footnote.component.css'
10
11
} )
11
- export class FootnoteComponent {
12
-
13
- version : string | undefined ;
14
- timestamp : string | undefined ;
15
- customer : string | undefined ;
16
-
17
- constructor ( private meta : Meta ) {
18
- this . version = this . meta . getTag ( 'name=version' ) ?. content ;
19
- this . version = this . version === '@project.version@' ? 'DEV-SERVER' : this . version ;
20
- this . timestamp = this . meta . getTag ( 'name=timestamp' ) ?. content ;
21
- this . timestamp = this . timestamp === '@timestamp@' ? '-' : this . timestamp ;
22
- this . customer = this . meta . getTag ( 'name=customer' ) ?. content ;
23
- this . customer = this . customer === '@customer@' ? '-' : this . customer ;
12
+ export class FootnoteComponent implements OnInit {
13
+ private static hasLogged = false ;
14
+
15
+ version : string | undefined ;
16
+ timestamp : string | undefined ;
17
+ customer : string | undefined ;
18
+ currentYear = new Date ( ) . getFullYear ( ) ;
19
+ companyName = 'hofi.org'
20
+
21
+ constructor ( private meta : Meta ) {
22
+ }
23
+
24
+ ngOnInit ( ) : void {
25
+ this . version = this . meta . getTag ( 'name=version' ) ?. content ;
26
+ this . version = this . version === '@project.version@' ? 'DEV-SERVER' : this . version ;
27
+ this . timestamp = this . meta . getTag ( 'name=timestamp' ) ?. content ;
28
+ this . timestamp = this . timestamp === '@timestamp@' ? 'DEV-SERVER' : this . timestamp ;
29
+ this . customer = this . meta . getTag ( 'name=customer' ) ?. content ;
30
+ this . customer = this . customer === '@customer@' ? 'DEV-SERVER' : this . customer ;
31
+
32
+ if ( ! FootnoteComponent . hasLogged && this . version !== undefined ) {
33
+ console . info (
34
+ `© ${ this . currentYear } ⋅ ${ this . companyName } ⋅ Build-version: ${ this . version } ⋅ Build-timestamp: ${ this . timestamp } ⋅ Customer: ${ this . customer } `
35
+ ) ;
36
+ FootnoteComponent . hasLogged = true ; // Set the flag to true after logging
24
37
}
38
+ }
25
39
}
0 commit comments