@@ -20,11 +20,26 @@ const { consoleLogManager } = require('../util/consolelog');
20
20
const BaseService = require ( './BaseService' ) ;
21
21
22
22
class DevConsoleService extends BaseService {
23
+ static MODULES = {
24
+ fs : require ( 'fs' ) ,
25
+ }
26
+
23
27
_construct ( ) {
24
28
this . static_lines = [ ] ;
25
29
this . widgets = [ ] ;
26
30
this . identifiers = { } ;
27
31
this . has_updates = false ;
32
+
33
+ try {
34
+ const require = this . require ;
35
+ const fs = require ( 'fs' ) ;
36
+ this . is_docker = fs . existsSync ( '/.dockerenv' ) ;
37
+ } catch ( e ) {
38
+ // if this fails, we assume is_docker should
39
+ // be false.
40
+ this . log . error ( e . message ) ;
41
+ this . is_docker = false ;
42
+ }
28
43
}
29
44
30
45
turn_on_the_warning_lights ( ) {
@@ -60,7 +75,7 @@ class DevConsoleService extends BaseService {
60
75
let positions = [ ] ;
61
76
for ( const w of this . widgets ) {
62
77
let output ; try {
63
- output = w ( ) ;
78
+ output = w ( { is_docker : this . is_docker } ) ;
64
79
} catch ( e ) {
65
80
consoleLogManager . log_raw ( 'error' , e ) ;
66
81
to_remove . push ( w ) ;
@@ -78,6 +93,7 @@ class DevConsoleService extends BaseService {
78
93
for ( let i = this . widgets . length - 1 ; i >= 0 ; i -- ) {
79
94
if ( size_ok ( ) ) break ;
80
95
const w = this . widgets [ i ] ;
96
+ if ( w . critical ) continue ;
81
97
if ( ! w . unimportant ) continue ;
82
98
n_hidden ++ ;
83
99
const [ start , length ] = positions [ i ] ;
@@ -89,8 +105,9 @@ class DevConsoleService extends BaseService {
89
105
}
90
106
for ( let i = this . widgets . length - 1 ; i >= 0 ; i -- ) {
91
107
if ( size_ok ( ) ) break ;
92
- n_hidden ++ ;
93
108
const w = this . widgets [ i ] ;
109
+ if ( w . critical ) continue ;
110
+ n_hidden ++ ;
94
111
const [ start , length ] = positions [ i ] ;
95
112
this . static_lines . splice ( start , length ) ;
96
113
}
0 commit comments