@eui/tools 4.17.10 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/.version.properties +1 -1
  2. package/CHANGELOG.md +13 -0
  3. package/package.json +1 -1
  4. package/scripts/csdr/cli/app.js +21 -10
  5. package/scripts/csdr/cli/skeletons/app-eui10/angular-config.json +20 -0
  6. package/scripts/csdr/cli/skeletons/app-eui10/dependencies-base.json +2 -0
  7. package/scripts/csdr/cli/skeletons/app-eui10/dependencies-composite.json +5 -0
  8. package/scripts/csdr/cli/skeletons/app-eui10/gitignore_TO_REPLACE +63 -0
  9. package/scripts/csdr/cli/skeletons/app-eui10/mock/app/models/user.js +8 -0
  10. package/scripts/csdr/cli/skeletons/app-eui10/mock/app/routes/index.js +5 -0
  11. package/scripts/csdr/cli/skeletons/app-eui10/mock/app/routes/user_routes.js +24 -0
  12. package/scripts/csdr/cli/skeletons/app-eui10/mock/db/db.json +12 -0
  13. package/scripts/csdr/cli/skeletons/app-eui10/mock/server.js +16 -0
  14. package/scripts/csdr/cli/skeletons/app-eui10/package.json +6 -0
  15. package/scripts/csdr/cli/skeletons/app-eui10/scripts.json +5 -0
  16. package/scripts/csdr/cli/skeletons/app-eui10/src/app/app-routing.module.ts +18 -0
  17. package/scripts/csdr/cli/skeletons/app-eui10/src/app/app-starter.service.ts +68 -0
  18. package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.component.html +29 -0
  19. package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.component.ts +55 -0
  20. package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.module.ts +27 -0
  21. package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/components/.gitkeep +0 -0
  22. package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/core.module.ts +84 -0
  23. package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/reducers/index.ts +33 -0
  24. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home-routing.module.ts +15 -0
  25. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.component.html +7 -0
  26. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.component.ts +19 -0
  27. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.module.ts +18 -0
  28. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page1/page1.component.html +7 -0
  29. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page1/page1.component.ts +7 -0
  30. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page2/page2.component.html +7 -0
  31. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page2/page2.component.ts +7 -0
  32. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1-routing.module.ts +18 -0
  33. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.component.html +7 -0
  34. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.component.ts +8 -0
  35. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.module.ts +21 -0
  36. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2-routing.module.ts +16 -0
  37. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.component.html +8 -0
  38. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.component.ts +7 -0
  39. package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.module.ts +17 -0
  40. package/scripts/csdr/cli/skeletons/app-eui10/src/app/shared/shared.module.ts +21 -0
  41. package/scripts/csdr/cli/skeletons/app-eui10/src/app/shared/testing/router.mock.ts +18 -0
  42. package/scripts/csdr/cli/skeletons/app-eui10/src/assets/config/env-json-config.json +8 -0
  43. package/scripts/csdr/cli/skeletons/app-eui10/src/assets/i18n/en.json +7 -0
  44. package/scripts/csdr/cli/skeletons/app-eui10/src/assets/i18n/fr.json +7 -0
  45. package/scripts/csdr/cli/skeletons/app-eui10/src/config/global.ts +20 -0
  46. package/scripts/csdr/cli/skeletons/app-eui10/src/config/index.ts +8 -0
  47. package/scripts/csdr/cli/skeletons/app-eui10/src/config/modules.ts +4 -0
  48. package/scripts/csdr/cli/skeletons/app-eui10/src/environments/environment.prod.ts +9 -0
  49. package/scripts/csdr/cli/skeletons/app-eui10/src/environments/environment.ts +9 -0
  50. package/scripts/csdr/cli/skeletons/app-eui10/src/index.html +21 -0
  51. package/scripts/csdr/cli/skeletons/app-eui10/src/styles.scss +1 -0
  52. package/scripts/csdr/cli/skeletons/app-eui10/tslint.json +17 -0
@@ -1 +1 @@
1
- 4.17.10
1
+ 4.18.0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 4.18.0 (2021-12-08)
2
+
3
+ ##### New Features
4
+
5
+ * **other:**
6
+ * added cli app skeleton for v10 apps - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([5272fbbe](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/5272fbbe2c7e52c4177b9105b213f5d586e766cc))
7
+ ##### Bug Fixes
8
+
9
+ * **other:**
10
+ * remove skeletons spec files ([d4f4eeb0](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d4f4eeb0ea9ca40cb5012cb14918ca3a98062f87))
11
+
12
+ * * *
13
+ * * *
1
14
  ## 4.17.10 (2021-12-07)
2
15
 
3
16
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "4.17.10",
3
+ "version": "4.18.0",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -12,7 +12,9 @@ const configUtils = require('../config/config-utils');
12
12
 
13
13
  // CONSTANTS
14
14
  const TARGET_ROOT_PATH = path.join(process.cwd(), 'apps');
15
- const APP_DEFAULT_SKELETON_PATH = path.join(__dirname, 'skeletons', 'app');
15
+ const APP_SKELETON_EUI7_PATH = path.join(__dirname, 'skeletons', 'app');
16
+ const APP_SKELETON_EUI10_PATH = path.join(__dirname, 'skeletons', 'app-eui10');
17
+ const APP_SKELETON_EUI13_PATH = path.join(__dirname, 'skeletons', 'app-eui13');
16
18
  const APP_SHOWCASE_SKELETON_PATH = path.join(__dirname, 'skeletons', 'app-showcase');
17
19
  const APP_SHOWCASE_SKELETON_EUI13_PATH = path.join(__dirname, 'skeletons', 'app-showcase-eui13');
18
20
 
@@ -22,8 +24,9 @@ const defaultConfig = {
22
24
  SHOWCASE: 'showcase'
23
25
  },
24
26
  appVersion: {
25
- DEFAULT: 'eui10',
26
- EUI13: 'eui13'
27
+ EUI7: 'v7',
28
+ EUI10: 'v10',
29
+ EUI13: 'v13'
27
30
  },
28
31
  appName: 'my-app',
29
32
  appScope: '@app'
@@ -54,13 +57,13 @@ const prompt = () => {
54
57
  name: 'appVersion',
55
58
  message: 'Select eUI version target :',
56
59
  choices: [
57
- { name: 'v10', value: defaultConfig.pkgFrontendVersion.DEFAULT },
58
- { name: 'v13', value: defaultConfig.pkgFrontendVersion.EUI13 },
60
+ { name: 'v10', value: defaultConfig.appVersion.EUI10 },
61
+ { name: 'v13', value: defaultConfig.appVersion.EUI13 },
59
62
  ],
60
- default: defaultConfig.appType.DEFAULT,
61
- when: function (answers) {
62
- return (answers.appType === defaultConfig.appType.SHOWCASE);
63
- },
63
+ default: defaultConfig.appVersion.EUI10,
64
+ // when: function (answers) {
65
+ // return (answers.appType === defaultConfig.appType.SHOWCASE);
66
+ // },
64
67
  validate: function (value) {
65
68
  if (value.length) {
66
69
  return true;
@@ -101,7 +104,15 @@ const build = (name, scope, appType, targetPath, appVersion) => {
101
104
  .then(() => {
102
105
  tools.logInfo('Copying skeleton to target');
103
106
  if (appType === defaultConfig.appType.DEFAULT) {
104
- return tools.copydir(APP_DEFAULT_SKELETON_PATH, targetPath, true);
107
+ if (appVersion === defaultConfig.appVersion.EUI13) {
108
+ return tools.copydir(APP_SKELETON_EUI13_PATH, targetPath, true);
109
+ }
110
+ if (appVersion === defaultConfig.appVersion.EUI10) {
111
+ return tools.copydir(APP_SKELETON_EUI10_PATH, targetPath, true);
112
+ }
113
+ if (appVersion === defaultConfig.appVersion.EUI7) {
114
+ return tools.copydir(APP_SKELETON_EUI7_PATH, targetPath, true);
115
+ }
105
116
 
106
117
  } else if (appType === defaultConfig.appType.SHOWCASE) {
107
118
  if (appVersion === defaultConfig.appVersion.EUI13) {
@@ -0,0 +1,20 @@
1
+ {
2
+ "build": {
3
+ "assets": [
4
+ "apps/@app.name@/src/favicon.ico",
5
+ "apps/@app.name@/src/assets",
6
+ {
7
+ "glob": "**/*",
8
+ "input": "node_modules/@eui/core/assets/",
9
+ "output": "./assets"
10
+ }
11
+ ],
12
+ "styles": [
13
+ "node_modules/@eui/styles/dist/styles/eui.css",
14
+ "node_modules/@eui/styles/dist/styles/eui-components.css",
15
+ "node_modules/@eui/styles/dist/styles/eui-next.css",
16
+ "apps/@app.name@/src/styles.scss"
17
+ ],
18
+ "scripts": []
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+ "@eui/deps-base": "^10.0.0"
4
+ }
5
+ }
@@ -0,0 +1,63 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+
3
+ # compiled output
4
+ **/node_modules
5
+ **/target
6
+ **/build
7
+ **/dist
8
+ **/out-tsc
9
+ **/tmp
10
+ **/tests/reports
11
+ # /src/assets/i18n-compiled/*
12
+ # /src/assets/openid-login-config*
13
+
14
+ # IDEs and editors
15
+ /.idea
16
+ .project
17
+ .classpath
18
+ .c9/
19
+ *.launch
20
+ .settings/
21
+ *.sublime-workspace
22
+
23
+ # IDE - VSCode
24
+ .vscode/*
25
+ !.vscode/settings.json
26
+ !.vscode/tasks.json
27
+ !.vscode/launch.json
28
+ !.vscode/extensions.json
29
+
30
+ # misc
31
+ /.sass-cache
32
+ /connect.lock
33
+ /coverage
34
+ /libpeerconnection.log
35
+ npm-debug.log
36
+ testem.log
37
+ /typings
38
+ yarn-error.log
39
+
40
+ # e2e
41
+ /e2e/*.js
42
+ /e2e/*.map
43
+
44
+ # System Files
45
+ .DS_Store
46
+ Thumbs.db
47
+
48
+ /*.iml
49
+
50
+ /proxy-mock.conf.json
51
+ /proxy.conf.json
52
+ /src/assets/dynamic-config.prod.json
53
+ /src/assets/jsrsasign-all-min.js
54
+ /src/assets/oidc-client.min.js
55
+ /src/assets/openid-login-config.json
56
+ /src/assets/openid-login.js
57
+ /src/karma.conf.js
58
+ /src/main.ts
59
+ /src/polyfills.ts
60
+ /src/test.ts
61
+ /tsconfig.app.json
62
+ /tsconfig.spec.json
63
+ /webpack.extra.js
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ id: 0,
3
+ firstName: '',
4
+ lastName: '',
5
+ email: '',
6
+ isAdmin: false,
7
+ birthdate: null
8
+ }
@@ -0,0 +1,5 @@
1
+ const userRoutes = require('./user_routes');
2
+
3
+ module.exports = function (app, db) {
4
+ userRoutes(app, db);
5
+ };
@@ -0,0 +1,24 @@
1
+ const User = require('../models/user');
2
+ const uuid = require('uuid');
3
+
4
+ module.exports = function (app, db) {
5
+ db.then(db => {
6
+
7
+ app.get('/api/user-details', (req, res) => {
8
+ res.send(db.get('user-details'))
9
+ });
10
+
11
+ app.get('/api/users', (req, res) => {
12
+ res.send(db.get('users'))
13
+ });
14
+
15
+ app.post('/api/users', (req, res) => {
16
+ db.get('users')
17
+ .push({ ...User, ...req.body, ...{ id: uuid.v1() } })
18
+ .last()
19
+ .write()
20
+ .then(user => res.send(user))
21
+ });
22
+
23
+ });
24
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "user-details": {
3
+ "firstName": "John",
4
+ "lastName": "Doe",
5
+ "fullName": "John Doe",
6
+ "organisationRef": {
7
+ "id": "123456", "abbreviation": "DIGIT.B.3"
8
+ },
9
+ "userId": "doejohn",
10
+ "email": "John.DOE@ec.europa.eu"
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ const express = require('express');
2
+ const bodyParser = require('body-parser');
3
+ const app = express();
4
+ const low = require('lowdb')
5
+ const FileAsync = require('lowdb/adapters/FileAsync')
6
+ const adapter = new FileAsync('apps/@app.name@/mock/db/db.json')
7
+ const db = low(adapter)
8
+ const port = 3000;
9
+
10
+ app.use(bodyParser.urlencoded({ extended: true }));
11
+
12
+ require('./app/routes')(app, db);
13
+
14
+ app.listen(port, () => {
15
+ console.log('We are live on ' + port);
16
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@app.name@",
3
+ "version": "1.0.0",
4
+ "license": "EUPL-1.1",
5
+ "private": true
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "@app.name@:start-mock-server": "nodemon --ext js --watch ./apps/@app.name@/mock ./apps/@app.name@/mock/server.js",
3
+ "@app.name@:start-serve": "eui-scripts serve-app @app.name@ --configuration=proxy-mock",
4
+ "@app.name@:start": "npm-run-all --parallel @app.name@:start-mock-server @app.name@:start-serve"
5
+ }
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+
4
+ const routes: Routes = [
5
+ { path: '', redirectTo: 'home', pathMatch: 'full' },
6
+ { path: 'index.jsp', redirectTo: 'home' },
7
+ { path: 'home', loadChildren: './features/home/home.module#Module' },
8
+ { path: 'module1', loadChildren: './features/module1/module1.module#Module' },
9
+ { path: 'module2', loadChildren: './features/module2/module2.module#Module' },
10
+
11
+ ];
12
+
13
+ @NgModule({
14
+ imports: [
15
+ RouterModule.forRoot(routes),
16
+ ],
17
+ })
18
+ export class AppRoutingModule {}
@@ -0,0 +1,68 @@
1
+ import { Inject, Injectable } from '@angular/core';
2
+ import {
3
+ CONFIG_TOKEN,
4
+ UserService,
5
+ EuiAppConfig,
6
+ UserDetails,
7
+ UserPreferences,
8
+ I18nService,
9
+ } from '@eui/core';
10
+ import { HttpClient } from '@angular/common/http';
11
+ import { Observable, of, zip } from 'rxjs';
12
+ import { switchMap } from 'rxjs/operators';
13
+
14
+ @Injectable({
15
+ providedIn: 'root',
16
+ })
17
+ export class AppStarterService {
18
+ defaultUserPreferences: UserPreferences;
19
+
20
+ constructor(
21
+ protected userService: UserService,
22
+ protected i18nService: I18nService,
23
+ @Inject(CONFIG_TOKEN) private config: EuiAppConfig,
24
+ protected http: HttpClient,
25
+ ) {
26
+ }
27
+
28
+ start(): Observable<any> {
29
+
30
+ return zip(
31
+ this.initUserService().pipe(
32
+ switchMap((userStatus) => {
33
+ console.log(userStatus);
34
+ return this.i18nService.init();
35
+ }),
36
+ ),
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Fetches user details,
42
+ * create user: UserState object
43
+ * then initialise to the UserService on run time
44
+ */
45
+ initUserService(): Observable<any> {
46
+ return zip(
47
+ this.fetchUserDetails(),
48
+ ).pipe(
49
+ switchMap(([userDetails]) => {
50
+ return this.userService.init(userDetails);
51
+ }));
52
+ }
53
+
54
+ /**
55
+ * Fetches user details
56
+ */
57
+ private fetchUserDetails(): Observable<UserDetails> {
58
+ // const url = this.config.modules.your_custom_module.your_custom_endpoint
59
+ const moduleCoreApi = this.config.modules.core;
60
+ const url = `${moduleCoreApi.base}${moduleCoreApi.userDetails}`;
61
+ const user = { userId: 'anonymous' };
62
+
63
+ if (!url) {
64
+ return of(user);
65
+ }
66
+ return this.http.get<UserDetails>(url);
67
+ }
68
+ }
@@ -0,0 +1,29 @@
1
+ <eui-app [userInfos]="userInfos?.fullName" isSidebarOpen=true>
2
+ <eui-app-toolbar>
3
+ <eui-toolbar>
4
+ <eui-toolbar-logo></eui-toolbar-logo>
5
+ <eui-toolbar-app appName="@app.name@"></eui-toolbar-app>
6
+ <eui-toolbar-environment>MOCK</eui-toolbar-environment>
7
+ <eui-toolbar-items euiPositionRight>
8
+ <eui-toolbar-item-user-profile>
9
+ <eui-user-profile-menu>
10
+ <eui-user-profile-menu-item>
11
+ <eui-icon iconClass="eui-icon-person-thin"></eui-icon> {{ 'eui.my-profile-informations' | translate }}
12
+ </eui-user-profile-menu-item>
13
+ <eui-user-profile-menu-item>
14
+ <eui-icon iconClass="eui-icon-logout-thin"></eui-icon> {{ 'eui.sign-out' | translate }}
15
+ </eui-user-profile-menu-item>
16
+ </eui-user-profile-menu>
17
+ </eui-toolbar-item-user-profile>
18
+ <eui-toolbar-item-notifications>
19
+ <eui-notifications [count]="notificationItems?.length" [items]="notificationItems"></eui-notifications>
20
+ </eui-toolbar-item-notifications>
21
+ </eui-toolbar-items>
22
+ </eui-toolbar>
23
+ </eui-app-toolbar>
24
+ <eui-app-sidebar>
25
+ <eui-app-sidebar-body>
26
+ <eui-app-sidebar-menu [items]="sidebarItems"></eui-app-sidebar-menu>
27
+ </eui-app-sidebar-body>
28
+ </eui-app-sidebar>
29
+ </eui-app>
@@ -0,0 +1,55 @@
1
+ import { Component, OnDestroy, OnInit } from '@angular/core';
2
+ import { Store } from '@ngrx/store';
3
+ import {
4
+ getUserState,
5
+ UserState,
6
+ } from '@eui/core';
7
+ import { Observable, Subscription } from 'rxjs';
8
+ import { AppStarterService } from './app-starter.service';
9
+
10
+ @Component({
11
+ selector: 'app-root',
12
+ templateUrl: './app.component.html',
13
+ })
14
+ export class AppComponent implements OnInit, OnDestroy {
15
+ userInfos: UserState;
16
+ // Observe state changes
17
+ userState: Observable<UserState>;
18
+ // an array to keep all subscriptions and easily unsubscribe
19
+ subs: Subscription[] = [];
20
+
21
+ sidebarItems = [
22
+ { label: 'Home', url: 'home', iconClass: 'eui-icon-home' },
23
+ { label: 'Module 1', url: 'module1', iconClass: 'eui-icon-work', children: [
24
+ { label: 'page 1', url: 'module1/page1' },
25
+ { label: 'page 2', url: 'module1/page2' },
26
+ ] },
27
+ { label: 'Module 2', url: 'module2', iconClass: 'eui-icon-work' },
28
+ ];
29
+ notificationItems = [
30
+ { label: 'Title label 1', subLabel: 'Subtitle label' },
31
+ { label: 'Title label 2', subLabel: 'Subtitle label' },
32
+ { label: 'Title label 3', subLabel: 'Subtitle label' },
33
+ { label: 'Title label 4', subLabel: 'Subtitle label' },
34
+ ];
35
+
36
+ constructor(
37
+ private store: Store<any>,
38
+ private appStarterService: AppStarterService,
39
+ ) {
40
+ this.appStarterService.start().subscribe(() => {
41
+ this.userState = <any>this.store.select(getUserState);
42
+ this.subs.push(this.userState.subscribe((user: UserState) => {
43
+ this.userInfos = { ...user };
44
+ console.log(user);
45
+ }));
46
+ });
47
+ }
48
+
49
+ ngOnInit() {
50
+ }
51
+
52
+ ngOnDestroy() {
53
+ this.subs.forEach((s: Subscription) => s.unsubscribe());
54
+ }
55
+ }
@@ -0,0 +1,27 @@
1
+ import { BrowserModule } from '@angular/platform-browser';
2
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
3
+ import { NgModule } from '@angular/core';
4
+
5
+ import { AppRoutingModule } from './app-routing.module';
6
+ import { AppComponent } from './app.component';
7
+ import { CoreModule } from './core/core.module';
8
+ import { AppStarterService } from './app-starter.service';
9
+
10
+ @NgModule({
11
+ declarations: [
12
+ AppComponent,
13
+ ],
14
+ imports: [
15
+ BrowserModule,
16
+ BrowserAnimationsModule,
17
+ CoreModule,
18
+ AppRoutingModule,
19
+ ],
20
+ providers: [
21
+ AppStarterService,
22
+ ],
23
+ bootstrap: [
24
+ AppComponent,
25
+ ],
26
+ })
27
+ export class AppModule {}
@@ -0,0 +1,84 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { TranslateModule } from '@ngx-translate/core';
3
+ import { StoreModule } from '@ngrx/store';
4
+ import { EffectsModule } from '@ngrx/effects';
5
+ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
6
+
7
+ import { HTTP_INTERCEPTORS } from '@angular/common/http';
8
+ import {
9
+ CachePreventionInterceptor,
10
+ CorsSecurityInterceptor,
11
+ CsrfPreventionInterceptor,
12
+ EuLoginSessionTimeoutHandlingInterceptor,
13
+ CoreModule as EuiCoreModule,
14
+ translateConfig,
15
+ CoreModuleEffects,
16
+ EUI_CONFIG_TOKEN,
17
+ } from '@eui/core';
18
+
19
+ import { appConfig } from '../../config/index';
20
+ import { environment } from '../../environments/environment';
21
+
22
+ import { REDUCER_TOKEN, getReducers, metaReducers } from './reducers/index';
23
+
24
+ import { SharedModule } from '../shared/shared.module';
25
+
26
+ @NgModule({
27
+ imports: [
28
+ SharedModule,
29
+ EuiCoreModule.forRoot(),
30
+ EffectsModule.forRoot([...CoreModuleEffects]),
31
+ TranslateModule.forRoot(translateConfig),
32
+ StoreModule.forRoot(REDUCER_TOKEN, { metaReducers }),
33
+ !environment.production ? StoreDevtoolsModule.instrument({ maxAge: 50 }) : [],
34
+ ],
35
+ declarations: [
36
+ ],
37
+ exports: [
38
+ SharedModule,
39
+ ],
40
+ providers: [
41
+ {
42
+ provide: REDUCER_TOKEN,
43
+ deps: [],
44
+ useFactory: getReducers,
45
+ },
46
+ {
47
+ provide: EUI_CONFIG_TOKEN,
48
+ useValue: { appConfig: appConfig, environment: environment }
49
+ },
50
+ {
51
+ // Sets the withCredentials on Ajax Request to send the JSESSIONID cookie to another domain.
52
+ // This is necessary when a request is being made to another domain that is protected by EU Login.
53
+ provide: HTTP_INTERCEPTORS,
54
+ useClass: CorsSecurityInterceptor,
55
+ multi: true,
56
+ },
57
+ {
58
+ // WARNING: in case of OpenID this is not needed since OpenID is stateless therefore no revalidation needed.
59
+ // When the authentication session is invalid, we need to re-authenticate. The browser refreshes the current URL,
60
+ // and lets the EU Login client redirect to the official EU Login page.
61
+ provide: HTTP_INTERCEPTORS,
62
+ useClass: EuLoginSessionTimeoutHandlingInterceptor,
63
+ multi: true,
64
+ },
65
+ {
66
+ // Adds HTTP header to each Ajax request that ensures the request is set by a piece of JavaScript code in the application.
67
+ // This prevents dynamically-loaded content from forging a request in the name of the currently logged-in user.
68
+ // Be aware that this assumes that cross-site scripting (XSS) is already put in place, (default setting in Angular).
69
+ provide: HTTP_INTERCEPTORS,
70
+ useClass: CsrfPreventionInterceptor,
71
+ multi: true,
72
+ },
73
+ {
74
+ // Asks the intermediate proxies not to return a cache copy of the resource.
75
+ // In matter of fact forces each server in the chain to validate the freshness of the resource.
76
+ provide: HTTP_INTERCEPTORS,
77
+ useClass: CachePreventionInterceptor,
78
+ multi: true,
79
+ },
80
+ ]
81
+ })
82
+ export class CoreModule {
83
+
84
+ }
@@ -0,0 +1,33 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { MetaReducer } from '@ngrx/store';
3
+ import { storeFreeze } from 'ngrx-store-freeze';
4
+ import { reducers as coreReducers, CoreState, getAppState, localStorageSync } from '@eui/core';
5
+
6
+ import { environment } from '../../../environments/environment';
7
+
8
+ export const REDUCER_TOKEN = new InjectionToken<any>('Registered Reducers');
9
+
10
+ /**
11
+ * Define here your app state
12
+ *
13
+ * [IMPORTANT]
14
+ * There are some **reserved** slice of the state
15
+ * that you **can not** use in your application ==> app |user | notification
16
+ */
17
+ /* tslint:disable-next-line */
18
+ export interface AppState extends CoreState {
19
+ // [key: string]: fromTaskManager.State | any;
20
+ }
21
+
22
+ /**
23
+ * Define here the reducers of your app
24
+ */
25
+ const rootReducer = Object.assign({}, coreReducers, {
26
+ // [fromTaskManager.namespace]: fromTaskManager.reducers,
27
+ });
28
+
29
+ export function getReducers() {
30
+ return rootReducer;
31
+ }
32
+
33
+ export const metaReducers: MetaReducer<AppState>[] = !environment.production ? [localStorageSync, storeFreeze] : [localStorageSync];
@@ -0,0 +1,15 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+
4
+ import { HomeComponent } from './home.component';
5
+
6
+ const routes: Routes = [
7
+ { path: '', component: HomeComponent },
8
+ ];
9
+
10
+ @NgModule({
11
+ imports: [
12
+ RouterModule.forChild(routes)
13
+ ],
14
+ })
15
+ export class HomeRoutingModule {}
@@ -0,0 +1,7 @@
1
+ <eui-page>
2
+ <eui-page-header label="{{ 'page.home.title' | translate }}"></eui-page-header>
3
+
4
+ <eui-page-content>
5
+
6
+ </eui-page-content>
7
+ </eui-page>
@@ -0,0 +1,19 @@
1
+ import { Component } from '@angular/core';
2
+ import { UxAppShellService } from '@eui/core';
3
+
4
+ @Component({
5
+ templateUrl: './home.component.html',
6
+ })
7
+ export class HomeComponent {
8
+ constructor(
9
+ private asService: UxAppShellService,
10
+ ) {
11
+ }
12
+
13
+ onUpdateAppName() {
14
+ this.asService.setState({
15
+ ...this.asService.state,
16
+ appName: 'Updated app name'
17
+ })
18
+ }
19
+ }
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { SharedModule } from '../../shared/shared.module';
4
+
5
+ import { HomeRoutingModule } from './home-routing.module';
6
+
7
+ import { HomeComponent } from './home.component';
8
+
9
+ @NgModule({
10
+ imports: [
11
+ SharedModule,
12
+ HomeRoutingModule,
13
+ ],
14
+ declarations: [
15
+ HomeComponent,
16
+ ],
17
+ })
18
+ export class Module {}
@@ -0,0 +1,7 @@
1
+ <div id="page-title">
2
+ <h2>Module1 - Page 1</h2>
3
+ </div>
4
+
5
+ <ux-panel label="Panel">
6
+ Panel content
7
+ </ux-panel>
@@ -0,0 +1,7 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ templateUrl: './page1.component.html'
5
+ })
6
+ export class Page1Component {
7
+ }
@@ -0,0 +1,7 @@
1
+ <div id="page-title">
2
+ <h2>Module 1 - page 2</h2>
3
+ </div>
4
+
5
+ <ux-panel label="Panel">
6
+ Panel content
7
+ </ux-panel>
@@ -0,0 +1,7 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ templateUrl: './page2.component.html'
5
+ })
6
+ export class Page2Component {
7
+ }
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+ import { Page1Component } from './components/page1/page1.component';
4
+ import { Page2Component } from './components/page2/page2.component';
5
+ import { Module1Component } from './module1.component';
6
+
7
+ const routes: Routes = [
8
+ { path: '', component: Module1Component },
9
+ { path: 'page1', component: Page1Component },
10
+ { path: 'page2', component: Page2Component },
11
+ ];
12
+
13
+ @NgModule({
14
+ imports: [
15
+ RouterModule.forChild(routes)
16
+ ],
17
+ })
18
+ export class Module1RoutingModule {}
@@ -0,0 +1,7 @@
1
+ <eui-page>
2
+ <eui-page-header label="Module 1"></eui-page-header>
3
+
4
+ <eui-page-content>
5
+
6
+ </eui-page-content>
7
+ </eui-page>
@@ -0,0 +1,8 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ templateUrl: './module1.component.html',
5
+ })
6
+ export class Module1Component {
7
+
8
+ }
@@ -0,0 +1,21 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { Module1RoutingModule } from './module1-routing.module';
3
+ import { Module1Component } from './module1.component';
4
+ import { Page1Component } from './components/page1/page1.component';
5
+ import { Page2Component } from './components/page2/page2.component';
6
+
7
+ import { SharedModule } from '../../shared/shared.module';
8
+
9
+ @NgModule({
10
+ imports: [
11
+ SharedModule,
12
+ Module1RoutingModule,
13
+ ],
14
+ declarations: [
15
+ Module1Component,
16
+ Page1Component,
17
+ Page2Component,
18
+ ],
19
+ })
20
+ export class Module {
21
+ }
@@ -0,0 +1,16 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+ import { Module2Component } from './module2.component';
4
+
5
+ const routes: Routes = [
6
+ { path: '', component: Module2Component },
7
+ ];
8
+
9
+ @NgModule({
10
+ imports: [
11
+ RouterModule.forChild([
12
+ { path: '', component: Module2Component }
13
+ ])
14
+ ],
15
+ })
16
+ export class Module2RoutingModule {}
@@ -0,0 +1,8 @@
1
+ <eui-page>
2
+ <eui-page-header label="Module 2"></eui-page-header>
3
+
4
+ <eui-page-content>
5
+
6
+
7
+ </eui-page-content>
8
+ </eui-page>
@@ -0,0 +1,7 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ templateUrl: './module2.component.html'
5
+ })
6
+ export class Module2Component {
7
+ }
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { Module2RoutingModule } from './module2-routing.module';
3
+ import { Module2Component } from './module2.component';
4
+
5
+ import { SharedModule } from '../../shared/shared.module';
6
+
7
+ @NgModule({
8
+ imports: [
9
+ SharedModule,
10
+ Module2RoutingModule,
11
+ ],
12
+ declarations: [
13
+ Module2Component,
14
+ ],
15
+ })
16
+ export class Module {
17
+ }
@@ -0,0 +1,21 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { TranslateModule } from '@ngx-translate/core';
3
+
4
+ import { UxAllModule } from '@eui/components';
5
+ import { EuiAllModule } from '@eui/components-next';
6
+
7
+ @NgModule({
8
+ imports: [
9
+ UxAllModule,
10
+ EuiAllModule,
11
+ TranslateModule,
12
+ ],
13
+ declarations: [
14
+ ],
15
+ exports: [
16
+ UxAllModule,
17
+ EuiAllModule,
18
+ TranslateModule,
19
+ ]
20
+ })
21
+ export class SharedModule {}
@@ -0,0 +1,18 @@
1
+ import { NavigationEnd } from '@angular/router';
2
+ import { Observable } from 'rxjs/Observable';
3
+
4
+ export class RouterMock {
5
+ routerState = { root: '' };
6
+ public navigationEnd = new NavigationEnd(0, 'http://url1', 'http://url2');
7
+ public events = new Observable(observer => {
8
+ observer.next(this.navigationEnd);
9
+ observer.complete();
10
+ });
11
+
12
+ constructor() {}
13
+
14
+ createUrlTree() {}
15
+
16
+ serializeUrl() {}
17
+
18
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "modules": {
3
+ "core": {
4
+ "base": "/api",
5
+ "userDetails": "/user-details"
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "page.home.title": "Welcome to eUI!",
3
+ "app.search.button": "Search",
4
+ "eui.my-profile-informations": "My profile information",
5
+ "eui.you-are-logged-in-as": "You are logged in as",
6
+ "eui.sign-out": "Sign out"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "page.home.title": "Bienvenue dans eUI!",
3
+ "app.search.button": "Chercher",
4
+ "eui.my-profile-informations": "My profile information FR",
5
+ "eui.you-are-logged-in-as": "You are logged in as FR",
6
+ "eui.sign-out": "Sign out FR"
7
+ }
@@ -0,0 +1,20 @@
1
+ import { GlobalConfig } from '@eui/core';
2
+
3
+ export const GLOBAL: GlobalConfig = {
4
+ appTitle: 'CSDR-app',
5
+ i18n: {
6
+ i18nService: {
7
+ defaultLanguage: 'en',
8
+ languages: ['en', 'fr'],
9
+ },
10
+ i18nLoader: {
11
+ i18nFolders: ['i18n-eui', 'i18n'],
12
+ },
13
+ },
14
+ user: {
15
+ defaultUserPreferences: {
16
+ dashboard: { },
17
+ lang: 'en',
18
+ },
19
+ },
20
+ };
@@ -0,0 +1,8 @@
1
+ import { EuiAppConfig } from '@eui/core';
2
+ import { GLOBAL } from './global';
3
+ import { MODULES } from './modules';
4
+
5
+ export const appConfig: EuiAppConfig = {
6
+ global: GLOBAL,
7
+ modules: MODULES,
8
+ };
@@ -0,0 +1,4 @@
1
+ import { ModulesConfig } from '@eui/core';
2
+
3
+ export const MODULES: ModulesConfig = {
4
+ };
@@ -0,0 +1,9 @@
1
+ import { EuiEnvConfig } from '@eui/core';
2
+
3
+ export const environment: EuiEnvConfig = {
4
+ production: true,
5
+ enableDevToolRedux: false,
6
+ envDynamicConfig: {
7
+ uri: 'assets/config/env-json-config.json',
8
+ },
9
+ };
@@ -0,0 +1,9 @@
1
+ import { EuiEnvConfig } from '@eui/core';
2
+
3
+ export const environment: EuiEnvConfig = {
4
+ production: false,
5
+ enableDevToolRedux: true,
6
+ envDynamicConfig: {
7
+ uri: 'assets/config/env-json-config.json',
8
+ },
9
+ };
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>@app.name@</title>
7
+ <base href="/">
8
+
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
11
+ </head>
12
+
13
+ <body>
14
+ <app-root>
15
+ <div id="loader-wrapper">
16
+ <div id="loader"></div>
17
+ </div>
18
+ </app-root>
19
+ </body>
20
+
21
+ </html>
@@ -0,0 +1 @@
1
+ /* You can add global styles to this file, and also import other style files */
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "app",
8
+ "camelCase"
9
+ ],
10
+ "component-selector": [
11
+ true,
12
+ "element",
13
+ "app",
14
+ "kebab-case"
15
+ ]
16
+ }
17
+ }