argos/dmp-frontend/src/app/app.module.ts

127 lines
4.7 KiB
TypeScript
Raw Normal View History

2019-01-18 18:03:45 +01:00
import { OverlayModule } from '@angular/cdk/overlay';
2018-01-30 10:35:26 +01:00
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { LOCALE_ID, NgModule, APP_INITIALIZER } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
2019-01-18 18:03:45 +01:00
import { MatMomentDateModule, MAT_MOMENT_DATE_FORMATS } from '@angular/material-moment-adapter';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
2019-09-16 17:46:19 +02:00
import { BrowserModule, Title } from '@angular/platform-browser';
2018-11-27 15:03:57 +01:00
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppRoutingModule } from '@app/app-routing.module';
import { AppComponent } from '@app/app.component';
import { CoreServiceModule } from '@app/core/core-service.module';
import { CultureService } from '@app/core/services/culture/culture-service';
import { NotificationModule } from '@app/library/notification/notification.module';
import { LoginModule } from '@app/ui/auth/login/login.module';
import { DatasetCreateWizardModule } from '@app/ui/dataset-create-wizard/dataset-create-wizard.module';
import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
import { HelpContentModule } from '@app/ui/misc/help-content/help-content.module';
import { NavigationModule } from '@app/ui/misc/navigation/navigation.module';
2019-12-13 12:15:12 +01:00
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
import { NavbarModule } from '@app/ui/navbar/navbar.module';
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
import { CommonHttpModule } from '@common/http/common-http.module';
import { CommonUiModule } from '@common/ui/common-ui.module';
2018-11-27 15:03:57 +01:00
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { environment } from 'environments/environment';
import { CookieService } from 'ngx-cookie-service';
import { NgcCookieConsentConfig, NgcCookieConsentModule } from 'ngx-cookieconsent';
import { TranslateServerLoader } from './core/services/language/server.loader';
import { BaseHttpService } from './core/services/http/base-http.service';
import { ConfigurationService } from './core/services/configuration/configuration.service';
import { Oauth2DialogModule } from './ui/misc/oauth2-dialog/oauth2-dialog.module';
2017-12-14 17:43:57 +01:00
2019-01-18 18:03:45 +01:00
// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient, appConfig: ConfigurationService) {
return new TranslateServerLoader(http, appConfig);
//GK: In case we want the original translation provider uncomment the line below.
//return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
2019-01-18 18:03:45 +01:00
}
2018-10-02 16:33:58 +02:00
2019-11-19 17:28:25 +01:00
const cookieConfig: NgcCookieConsentConfig = {
enabled: true,
cookie: {
domain: ""//environment.App // or 'your.domain.com' // it is mandatory to set a domain, for cookies to work properly (see https://goo.gl/S2Hy2A)
2019-11-19 17:28:25 +01:00
},
palette: {
popup: {
background: "#000000",
text: "#ffffff",
link: "#ffffff"
},
button: {
background: "#00b29f",
text: "#ffffff",
border: "transparent"
}
},
content: {
message: "This website uses cookies to enhance the user experience.",
dismiss: "Got it!",
deny: "Refuse cookies",
link: "Learn more",
href: "",//environment.App + "terms-of-service",
2020-06-25 16:52:00 +02:00
policy: "Cookies Policy"
2019-11-19 17:28:25 +01:00
},
position: "bottom-right",
theme: 'edgeless',
type: 'info'
};
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
2019-01-18 18:03:45 +01:00
CoreServiceModule.forRoot(),
AppRoutingModule,
CommonUiModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient, ConfigurationService]
}
}),
2019-01-18 18:03:45 +01:00
HttpClientModule,
OverlayModule,
CommonHttpModule,
MatMomentDateModule,
LoginModule,
2019-01-18 18:03:45 +01:00
//Ui
NotificationModule,
NavigationModule,
BreadcrumbModule,
HelpContentModule,
ReactiveFormsModule,
FormsModule,
DatasetCreateWizardModule,
2019-04-24 11:26:53 +02:00
NavbarModule,
2019-11-19 17:28:25 +01:00
SidebarModule,
NgcCookieConsentModule.forRoot(cookieConfig),
Oauth2DialogModule
2019-01-18 18:03:45 +01:00
],
declarations: [
2019-12-13 12:15:12 +01:00
AppComponent,
ReloadHelperComponent
],
providers: [
2018-10-05 17:00:54 +02:00
{
provide: MAT_DATE_LOCALE,
deps: [CultureService],
2019-01-18 18:03:45 +01:00
useFactory: (cultureService) => cultureService.getCurrentCulture().name
2018-10-05 17:00:54 +02:00
},
2019-01-18 18:03:45 +01:00
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
{ provide: DateAdapter, useClass: MomentUtcDateAdapter },
2018-10-05 17:00:54 +02:00
{
provide: LOCALE_ID,
deps: [CultureService],
2019-01-18 18:03:45 +01:00
useFactory: (cultureService) => cultureService.getCurrentCulture().name
2018-10-05 17:00:54 +02:00
},
2019-11-19 17:28:25 +01:00
Title,
CookieService
],
bootstrap: [AppComponent]
})
export class AppModule { }