1
- import { Component , ElementRef , OnInit , ViewChild } from '@angular/core' ;
1
+ import { Component , ElementRef , HostBinding , OnInit , ViewChild } from '@angular/core' ;
2
2
import { MatDialog } from '@angular/material' ;
3
3
import { AddServerDialogComponent } from './components/add-server-dialog/add-server-dialog.component' ;
4
4
import { RedisInstance } from './models/redis-instance' ;
@@ -19,6 +19,8 @@ import {PageModel} from './models/page-model';
19
19
import { ADD_COMMAND , CLEAR_HISTORY , TOGGLE_CLI } from './ngrx/actions/cli-actions' ;
20
20
import { ConfirmDialogComponent } from './components/confirm-dialog/confirm-dialog.component' ;
21
21
import { InformationDialogComponent } from './components/information-dialog/information-dialog.component' ;
22
+ import { SettingsDialogComponent } from './components/settings-dialog/settings-dialog.component' ;
23
+ import { ThemeConfig } from './theme-config' ;
22
24
23
25
/**
24
26
* return a new right page component
@@ -59,6 +61,7 @@ export class AppComponent implements OnInit {
59
61
60
62
private requireId = '' ;
61
63
64
+
62
65
constructor ( public dialogService : MatDialog ,
63
66
private redisService : RedisService ,
64
67
private util : UtilService ,
@@ -132,11 +135,15 @@ export class AppComponent implements OnInit {
132
135
ins . expanded = true ;
133
136
}
134
137
if ( ins . expanded ) {
135
- this . _store . dispatch ( { type : REQ_FETCH_TREE , payload : { id : ins . id , scb : ( ) => {
136
- if ( expandNodes ) {
137
- setTimeout ( ( ) => this . expandDeepCommand$ . next ( ) , 0 ) ;
138
+ this . _store . dispatch ( {
139
+ type : REQ_FETCH_TREE , payload : {
140
+ id : ins . id , scb : ( ) => {
141
+ if ( expandNodes ) {
142
+ setTimeout ( ( ) => this . expandDeepCommand$ . next ( ) , 0 ) ;
143
+ }
144
+ }
138
145
}
139
- } } } ) ;
146
+ } ) ;
140
147
}
141
148
}
142
149
}
@@ -159,6 +166,9 @@ export class AppComponent implements OnInit {
159
166
}
160
167
161
168
ngOnInit ( ) : void {
169
+ // set theme
170
+ const theme = localStorage . getItem ( ThemeConfig . THEME_KEY ) || ThemeConfig . THEMES [ 0 ] ;
171
+ document . getElementById ( ThemeConfig . BODY_ID ) . classList . add ( `${ theme } -theme` ) ;
162
172
}
163
173
164
174
/**
@@ -181,6 +191,13 @@ export class AppComponent implements OnInit {
181
191
} ) ;
182
192
}
183
193
194
+ onSettingsEvt ( ) {
195
+ this . dialogService . open ( SettingsDialogComponent , {
196
+ width : '300px' ,
197
+ height : '400px'
198
+ } ) ;
199
+ }
200
+
184
201
/**
185
202
* when user enter values and click ok to add new value for redis
186
203
* @param newValue the new value model
0 commit comments