matrix-dimension/web/app/app.module.ts

165 lines
7.5 KiB
TypeScript
Raw Normal View History

2017-12-22 23:08:10 -05:00
import { ApplicationRef, Injector, NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { HttpModule } from "@angular/http";
import { FormsModule } from "@angular/forms";
import { AppComponent } from "./app.component";
import { HomeComponent } from "./home/home.component";
import { routing } from "./app.routing";
2017-12-09 18:34:59 -05:00
import { createNewHosts, removeNgStyles } from "@angularclass/hmr";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { RiotComponent } from "./riot/riot.component";
import { UiSwitchModule } from "angular2-ui-switch";
import { ScalarClientApiService } from "./shared/services/scalar/scalar-client-api.service";
import { ToasterModule } from "angular2-toaster";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ScalarCloseComponent } from "./riot/scalar-close/scalar-close.component";
2017-08-27 01:26:00 -04:00
import { BootstrapModalModule } from "ngx-modialog/plugins/bootstrap";
import { ModalModule } from "ngx-modialog";
import { GenericWidgetWrapperComponent } from "./widget-wrappers/generic/generic.component";
2017-12-15 01:46:17 -05:00
import { ToggleFullscreenDirective } from "./shared/directives/toggle-fullscreen.directive";
2017-12-22 23:08:10 -05:00
import { FullscreenButtonComponent } from "./elements/fullscreen-button/fullscreen-button.component";
import { VideoWidgetWrapperComponent } from "./widget-wrappers/video/video.component";
import { JitsiWidgetWrapperComponent } from "./widget-wrappers/jitsi/jitsi.component";
import { GCalWidgetWrapperComponent } from "./widget-wrappers/gcal/gcal.component";
import { PageHeaderComponent } from "./page-header/page-header.component";
2017-12-22 23:08:10 -05:00
import { SpinnerComponent } from "./elements/spinner/spinner.component";
import { BreadcrumbsModule } from "ng2-breadcrumbs";
import { RiotHomeComponent } from "./riot/riot-home/home.component";
2017-12-15 23:22:34 -05:00
import { IntegrationBagComponent } from "./integration-bag/integration-bag.component";
import { ScalarServerApiService } from "./shared/services/scalar/scalar-server-api.service";
import { AdminApiService } from "./shared/services/admin/admin-api.service";
import { ServiceLocator } from "./shared/registry/locator.service";
2017-12-22 23:08:10 -05:00
import { IboxComponent } from "./elements/ibox/ibox.component";
2017-12-22 23:33:37 -05:00
import { CustomWidgetConfigComponent } from "./configs/widget/custom/custom.widget.component";
import { ConfigScreenWidgetComponent } from "./configs/widget/config-screen/config-screen.widget.component";
2017-12-23 15:16:05 -05:00
import { EtherpadWidgetConfigComponent } from "./configs/widget/etherpad/etherpad.widget.component";
import { NameService } from "./shared/services/name.service";
import { GoogleCalendarWidgetConfigComponent } from "./configs/widget/google-calendar/gcal.widget.component";
import { GoogleDocsWidgetConfigComponent } from "./configs/widget/google-docs/gdoc.widget.component";
2017-12-23 16:16:22 -05:00
import { JitsiWidgetConfigComponent } from "./configs/widget/jitsi/jitsi.widget.component";
2017-12-23 17:03:24 -05:00
import { TwitchWidgetConfigComponent } from "./configs/widget/twitch/twitch.widget.component";
2017-12-23 17:28:42 -05:00
import { YoutubeWidgetConfigComponent } from "./configs/widget/youtube/youtube.widget.component";
2017-12-23 20:47:41 -05:00
import { AdminComponent } from "./admin/admin.component";
import { AdminHomeComponent } from "./admin/home/home.component";
import { AdminWidgetsComponent } from "./admin/widgets/widgets.component";
import { AdminWidgetEtherpadConfigComponent } from "./admin/widgets/etherpad/etherpad.component";
import { AdminWidgetJitsiConfigComponent } from "./admin/widgets/jitsi/jitsi.component";
import { AdminIntegrationsApiService } from "./shared/services/admin/admin-integrations-api.service";
import { IntegrationsApiService } from "./shared/services/integrations/integrations-api.service";
import { WidgetApiService } from "./shared/services/integrations/widget-api.service";
import { AdminAppserviceApiService } from "./shared/services/admin/admin-appservice-api.service";
import { AdminNebApiService } from "./shared/services/admin/admin-neb-api.service";
import { AdminUpstreamApiService } from "./shared/services/admin/admin-upstream-api.service";
import { AdminNebComponent } from "./admin/neb/neb.component";
import { AdminEditNebComponent } from "./admin/neb/edit/edit.component";
import { AdminAddSelfhostedNebComponent } from "./admin/neb/add-selfhosted/add-selfhosted.component";
import { AdminNebAppserviceConfigComponent } from "./admin/neb/appservice-config/appservice-config.component";
2018-03-24 23:17:44 -04:00
import { AdminNebGiphyConfigComponent } from "./admin/neb/config/giphy/giphy.component";
2018-03-24 23:44:05 -04:00
import { AdminNebGuggyConfigComponent } from "./admin/neb/config/guggy/guggy.component";
import { AdminNebGoogleConfigComponent } from "./admin/neb/config/google/google.component";
2018-03-24 23:55:35 -04:00
import { AdminNebImgurConfigComponent } from "./admin/neb/config/imgur/imgur.component";
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
routing,
NgbModule.forRoot(),
UiSwitchModule,
ToasterModule,
BrowserAnimationsModule,
ModalModule.forRoot(),
BootstrapModalModule,
BreadcrumbsModule,
],
declarations: [
AppComponent,
HomeComponent,
RiotComponent,
2017-12-15 23:22:34 -05:00
IntegrationBagComponent,
PageHeaderComponent,
SpinnerComponent,
ScalarCloseComponent,
GenericWidgetWrapperComponent,
ToggleFullscreenDirective,
FullscreenButtonComponent,
VideoWidgetWrapperComponent,
JitsiWidgetWrapperComponent,
GCalWidgetWrapperComponent,
RiotHomeComponent,
2017-12-22 23:08:10 -05:00
IboxComponent,
ConfigScreenWidgetComponent,
2017-12-22 23:33:37 -05:00
CustomWidgetConfigComponent,
2017-12-23 15:16:05 -05:00
EtherpadWidgetConfigComponent,
2017-12-23 15:32:07 -05:00
GoogleCalendarWidgetConfigComponent,
2017-12-23 15:44:19 -05:00
GoogleDocsWidgetConfigComponent,
2017-12-23 16:16:22 -05:00
JitsiWidgetConfigComponent,
2017-12-23 17:03:24 -05:00
TwitchWidgetConfigComponent,
2017-12-23 17:28:42 -05:00
YoutubeWidgetConfigComponent,
2017-12-23 20:47:41 -05:00
AdminComponent,
AdminHomeComponent,
AdminWidgetsComponent,
AdminWidgetEtherpadConfigComponent,
AdminWidgetJitsiConfigComponent,
AdminNebComponent,
AdminEditNebComponent,
AdminAddSelfhostedNebComponent,
AdminNebAppserviceConfigComponent,
2018-03-24 23:17:44 -04:00
AdminNebGiphyConfigComponent,
2018-03-24 23:44:05 -04:00
AdminNebGuggyConfigComponent,
AdminNebGoogleConfigComponent,
2018-03-24 23:55:35 -04:00
AdminNebImgurConfigComponent,
2017-12-23 20:47:41 -05:00
// Vendor
],
providers: [
AdminApiService,
AdminIntegrationsApiService,
IntegrationsApiService,
WidgetApiService,
ScalarClientApiService,
ScalarServerApiService,
2017-12-23 15:16:05 -05:00
NameService,
AdminAppserviceApiService,
AdminNebApiService,
AdminUpstreamApiService,
{provide: Window, useValue: window},
// Vendor
],
bootstrap: [AppComponent],
entryComponents: [
AdminWidgetEtherpadConfigComponent,
AdminWidgetJitsiConfigComponent,
AdminNebAppserviceConfigComponent,
2018-03-24 23:17:44 -04:00
AdminNebGiphyConfigComponent,
2018-03-24 23:44:05 -04:00
AdminNebGuggyConfigComponent,
AdminNebGoogleConfigComponent,
2018-03-24 23:55:35 -04:00
AdminNebImgurConfigComponent,
]
})
export class AppModule {
2017-12-22 23:08:10 -05:00
constructor(public appRef: ApplicationRef, injector: Injector) {
ServiceLocator.injector = injector;
}
hmrOnInit(store) {
2017-08-27 01:26:00 -04:00
console.log("HMR store", store);
}
hmrOnDestroy(store) {
let cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
// recreate elements
store.disposeOldHosts = createNewHosts(cmpLocation);
// remove styles
removeNgStyles();
}
hmrAfterDestroy(store) {
// display new elements
store.disposeOldHosts();
delete store.disposeOldHosts;
}
}