Load themes as sound as possible
This commit is contained in:
parent
b2aac08921
commit
eab150cd33
|
@ -11,7 +11,6 @@ import {
|
||||||
ScreenService,
|
ScreenService,
|
||||||
ScrollService,
|
ScrollService,
|
||||||
ServerService,
|
ServerService,
|
||||||
ThemeService,
|
|
||||||
User,
|
User,
|
||||||
UserLocalStorageService
|
UserLocalStorageService
|
||||||
} from '@app/core'
|
} from '@app/core'
|
||||||
|
@ -93,7 +92,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||||
private domSanitizer: DomSanitizer,
|
private domSanitizer: DomSanitizer,
|
||||||
private screenService: ScreenService,
|
private screenService: ScreenService,
|
||||||
private hotkeysService: HotkeysService,
|
private hotkeysService: HotkeysService,
|
||||||
private themeService: ThemeService,
|
|
||||||
private hooks: HooksService,
|
private hooks: HooksService,
|
||||||
private location: PlatformLocation,
|
private location: PlatformLocation,
|
||||||
private modalService: NgbModal,
|
private modalService: NgbModal,
|
||||||
|
@ -115,7 +113,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||||
this.serverConfig = this.serverService.getHTMLConfig()
|
this.serverConfig = this.serverService.getHTMLConfig()
|
||||||
|
|
||||||
this.hooks.runAction('action:application.init', 'common')
|
this.hooks.runAction('action:application.init', 'common')
|
||||||
this.themeService.initialize()
|
|
||||||
|
|
||||||
this.authService.loadClientCredentials()
|
this.authService.loadClientCredentials()
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class PluginService implements ClientHook {
|
||||||
initializePlugins () {
|
initializePlugins () {
|
||||||
this.pluginsManager.loadPluginsList(this.server.getHTMLConfig())
|
this.pluginsManager.loadPluginsList(this.server.getHTMLConfig())
|
||||||
|
|
||||||
this.pluginsManager.ensurePluginsAreLoaded('common')
|
return this.pluginsManager.ensurePluginsAreLoaded('common')
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeCustomModal (customModal: CustomModalComponent) {
|
initializeCustomModal (customModal: CustomModalComponent) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { LoadingBarModule } from '@ngx-loading-bar/core'
|
import { LoadingBarModule } from '@ngx-loading-bar/core'
|
||||||
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
|
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
|
||||||
import { ToastModule } from 'primeng/toast'
|
import { ToastModule } from 'primeng/toast'
|
||||||
import { tap } from 'rxjs/operators'
|
import { switchMap } from 'rxjs/operators'
|
||||||
import { AppComponent } from './app/app.component'
|
import { AppComponent } from './app/app.component'
|
||||||
import routes from './app/app.routes'
|
import routes from './app/app.routes'
|
||||||
import {
|
import {
|
||||||
|
@ -20,6 +20,7 @@ import {
|
||||||
PreloadSelectedModulesList,
|
PreloadSelectedModulesList,
|
||||||
RedirectService,
|
RedirectService,
|
||||||
ServerService,
|
ServerService,
|
||||||
|
ThemeService,
|
||||||
getCoreProviders
|
getCoreProviders
|
||||||
} from './app/core'
|
} from './app/core'
|
||||||
import { getMainProviders } from './app/shared/shared-main/main-providers'
|
import { getMainProviders } from './app/shared/shared-main/main-providers'
|
||||||
|
@ -28,17 +29,24 @@ import { logger } from './root-helpers'
|
||||||
|
|
||||||
registerLocaleData(localeOc, 'oc')
|
registerLocaleData(localeOc, 'oc')
|
||||||
|
|
||||||
export function loadConfigFactory (server: ServerService, pluginService: PluginService, redirectService: RedirectService) {
|
export function loadConfigFactory (
|
||||||
|
server: ServerService,
|
||||||
|
pluginService: PluginService,
|
||||||
|
themeService: ThemeService,
|
||||||
|
redirectService: RedirectService
|
||||||
|
) {
|
||||||
const initializeServices = () => {
|
const initializeServices = () => {
|
||||||
redirectService.init()
|
redirectService.init()
|
||||||
pluginService.initializePlugins()
|
themeService.initialize()
|
||||||
|
|
||||||
|
return pluginService.initializePlugins()
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const result = server.loadHTMLConfig()
|
const result = server.loadHTMLConfig()
|
||||||
if (result) return result.pipe(tap(() => initializeServices()))
|
if (result) return result.pipe(switchMap(() => initializeServices()))
|
||||||
|
|
||||||
initializeServices()
|
return initializeServices()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +98,7 @@ const bootstrap = () => bootstrapApplication(AppComponent, {
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: loadConfigFactory,
|
useFactory: loadConfigFactory,
|
||||||
deps: [ ServerService, PluginService, RedirectService ],
|
deps: [ ServerService, PluginService, ThemeService, RedirectService ],
|
||||||
multi: true
|
multi: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue