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

118 lines
4.0 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';
2018-11-27 15:03:57 +01:00
import { LOCALE_ID, NgModule } from '@angular/core';
2019-09-23 10:17:03 +02:00
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
2019-01-18 18:03:45 +01:00
import { MatMomentDateModule, MAT_MOMENT_DATE_FORMATS } from '@angular/material-moment-adapter';
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 { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
2019-01-18 18:03:45 +01:00
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';
import { CoreServiceModule } from './core/core-service.module';
import { CultureService } from './core/services/culture/culture-service';
import { NotificationModule } from './library/notification/notification.module';
import { BreadcrumbModule } from './ui/misc/breadcrumb/breadcrumb.module';
import { HelpContentModule } from './ui/misc/help-content/help-content.module';
import { NavigationModule } from './ui/misc/navigation/navigation.module';
import { LoginModule } from './ui/auth/login/login.module';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { DatasetCreateWizardModule } from './ui/dataset-create-wizard/dataset-create-wizard.module';
2019-04-24 11:26:53 +02:00
import { NavbarModule } from './ui/navbar/navbar.module';
import { SidebarModule } from './ui/sidebar/sidebar.module';
2019-11-19 17:28:25 +01:00
import { NgcCookieConsentModule, NgcCookieConsentConfig } from 'ngx-cookieconsent';
import { CookieService } from "ngx-cookie-service";
import { environment } from '../environments/environment';
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) {
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
}
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)
},
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",
2019-11-19 17:28:25 +01:00
policy: "Cookie Policy"
},
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]
}
}),
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)
2019-01-18 18:03:45 +01:00
],
declarations: [
2019-04-24 11:26:53 +02:00
AppComponent
],
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 { }