@@ -5,64 +5,64 @@ import { JhiLogfileService } from './logfile.service';
55import { JhiRoutesService , Route } from 'app/shared' ;
66
77@Component ( {
8- selector : 'jhi-logfile' ,
9- templateUrl : './logfile.component.html' ,
10- styleUrls : [ 'logfile.scss' ]
8+ selector : 'jhi-logfile' ,
9+ templateUrl : './logfile.component.html' ,
10+ styleUrls : [ 'logfile.scss' ]
1111} )
1212export class JhiLogfileComponent implements OnInit , OnDestroy {
13- activeRoute : Route ;
14- updatingLogfile : boolean ;
15- logtxt : string ;
16- subscription : Subscription ;
13+ activeRoute : Route ;
14+ updatingLogfile : boolean ;
15+ logtxt : string ;
16+ subscription : Subscription ;
1717
18- @ViewChild ( 'logfile' ) private logFileViewer : ElementRef ;
18+ @ViewChild ( 'logfile' ) private logFileViewer : ElementRef ;
1919
20- constructor ( private jhiLogfileService : JhiLogfileService , private routesService : JhiRoutesService ) { }
20+ constructor ( private jhiLogfileService : JhiLogfileService , private routesService : JhiRoutesService ) { }
2121
22- ngOnInit ( ) {
23- this . subscription = this . routesService . routeChanged$ . subscribe ( route => {
24- this . activeRoute = route ;
25- this . displayActiveRouteLog ( ) ;
26- } ) ;
27- }
22+ ngOnInit ( ) {
23+ this . subscription = this . routesService . routeChanged$ . subscribe ( ( route ) => {
24+ this . activeRoute = route ;
25+ this . displayActiveRouteLog ( ) ;
26+ } ) ;
27+ }
2828
29- displayActiveRouteLog ( ) {
30- this . updatingLogfile = true ;
31- if ( this . activeRoute && this . activeRoute . status !== 'DOWN' ) {
32- this . jhiLogfileService . getInstanceLogfile ( this . activeRoute ) . subscribe (
33- logtxt => {
34- this . logtxt = logtxt ;
35- this . updatingLogfile = false ;
36- } ,
37- error => {
38- if ( error . status === 503 || error . status === 500 || error . status === 404 ) {
39- this . logtxt =
40- 'No available logfile. Please note that it is not available by default, you need to set up the Spring Boot properties below! \n' +
41- 'Please check:\n ' +
42- '- if the microservice is up\n ' +
43- '- if these properties are set: \n ' +
44- ' - logging.path\n ' +
45- ' - logging.file (to avoid using the same spring.log)\n\n' +
46- 'See:\n ' +
47- '- https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html\n ' +
48- '- https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html' ;
49- this . updatingLogfile = false ;
50- }
29+ displayActiveRouteLog ( ) {
30+ this . updatingLogfile = true ;
31+ if ( this . activeRoute && this . activeRoute . status !== 'DOWN' ) {
32+ this . jhiLogfileService . getInstanceLogfile ( this . activeRoute ) . subscribe (
33+ ( logtxt ) => {
34+ this . logtxt = logtxt ;
35+ this . updatingLogfile = false ;
36+ } ,
37+ ( error ) => {
38+ if ( error . status === 503 || error . status === 500 || error . status === 404 ) {
39+ this . logtxt =
40+ 'No available logfile. Please note that it is not available by default, you need to set up the Spring Boot properties below! \n' +
41+ 'Please check:\n ' +
42+ '- if the microservice is up\n ' +
43+ '- if these properties are set: \n ' +
44+ ' - logging.path\n ' +
45+ ' - logging.file (to avoid using the same spring.log)\n\n' +
46+ 'See:\n ' +
47+ '- https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html\n ' +
48+ '- https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html' ;
49+ this . updatingLogfile = false ;
50+ }
51+ }
52+ ) ;
5153 }
52- ) ;
5354 }
54- }
5555
56- scrollToBottom ( ) {
57- this . logFileViewer . nativeElement . scrollTop = this . logFileViewer . nativeElement . scrollHeight ;
58- }
56+ scrollToBottom ( ) {
57+ this . logFileViewer . nativeElement . scrollTop = this . logFileViewer . nativeElement . scrollHeight ;
58+ }
5959
60- scrollToTop ( ) {
61- this . logFileViewer . nativeElement . scrollTop = this . logFileViewer . nativeElement . scrolledUp ;
62- }
60+ scrollToTop ( ) {
61+ this . logFileViewer . nativeElement . scrollTop = this . logFileViewer . nativeElement . scrolledUp ;
62+ }
6363
64- ngOnDestroy ( ) {
65- // prevent memory leak when component destroyed
66- this . subscription . unsubscribe ( ) ;
67- }
64+ ngOnDestroy ( ) {
65+ // prevent memory leak when component destroyed
66+ this . subscription . unsubscribe ( ) ;
67+ }
6868}
0 commit comments