next-gen-gui: Add button to restore default theme (#7433)
This adds a button in the top right that changes the config back to the default theme. Code wise, it takes the header that was previously a part of the dashboard component and moves it to the app component, and then adds the button there. Possibly the header should be a component of it's own, but that's more of refactor that can happen separately I think. The config change uses the new config API to just patch the relevant setting. I'm not doing an automatic reload because 1) I don't want to figure out how to do it correctly and 2) this doesn't work reliably anyway, as for example the current gen GUI does a reload and ends up with connection refused as the API service is still reloading...
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { SystemConfigService } from './services/system-config.service';
|
||||
import { MessageService } from './services/message.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -6,5 +8,16 @@ import { Component } from '@angular/core';
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent {
|
||||
constructor() { }
|
||||
constructor(
|
||||
private systemConfigService: SystemConfigService,
|
||||
private messageService: MessageService,
|
||||
) { }
|
||||
|
||||
restoreDefaultTheme(): void {
|
||||
this.systemConfigService
|
||||
.setGUITheme('default')
|
||||
.subscribe(() => {
|
||||
this.messageService.add('The default GUI theme has been selected. Please hit "Reload" in your browser.')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user