@eui/tools 4.17.7 → 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.
- package/.version.properties +1 -1
- package/CHANGELOG.md +41 -0
- package/package.json +1 -1
- package/sandbox.js +4 -10
- package/scripts/csdr/cli/app.js +21 -10
- package/scripts/csdr/cli/skeletons/app-eui10/angular-config.json +20 -0
- package/scripts/csdr/cli/skeletons/app-eui10/dependencies-base.json +2 -0
- package/scripts/csdr/cli/skeletons/app-eui10/dependencies-composite.json +5 -0
- package/scripts/csdr/cli/skeletons/app-eui10/gitignore_TO_REPLACE +63 -0
- package/scripts/csdr/cli/skeletons/app-eui10/mock/app/models/user.js +8 -0
- package/scripts/csdr/cli/skeletons/app-eui10/mock/app/routes/index.js +5 -0
- package/scripts/csdr/cli/skeletons/app-eui10/mock/app/routes/user_routes.js +24 -0
- package/scripts/csdr/cli/skeletons/app-eui10/mock/db/db.json +12 -0
- package/scripts/csdr/cli/skeletons/app-eui10/mock/server.js +16 -0
- package/scripts/csdr/cli/skeletons/app-eui10/package.json +6 -0
- package/scripts/csdr/cli/skeletons/app-eui10/scripts.json +5 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/app-routing.module.ts +18 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/app-starter.service.ts +68 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.component.html +29 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.component.ts +55 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/app.module.ts +27 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/components/.gitkeep +0 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/core.module.ts +84 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/core/reducers/index.ts +33 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home-routing.module.ts +15 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.component.html +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.component.ts +19 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/home/home.module.ts +18 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page1/page1.component.html +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page1/page1.component.ts +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page2/page2.component.html +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/components/page2/page2.component.ts +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1-routing.module.ts +18 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.component.html +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.component.ts +8 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module1/module1.module.ts +21 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2-routing.module.ts +16 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.component.html +8 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.component.ts +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/features/module2/module2.module.ts +17 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/shared/shared.module.ts +21 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/app/shared/testing/router.mock.ts +18 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/assets/config/env-json-config.json +8 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/assets/i18n/en.json +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/assets/i18n/fr.json +7 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/config/global.ts +20 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/config/index.ts +8 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/config/modules.ts +4 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/environments/environment.prod.ts +9 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/environments/environment.ts +9 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/index.html +21 -0
- package/scripts/csdr/cli/skeletons/app-eui10/src/styles.scss +1 -0
- package/scripts/csdr/cli/skeletons/app-eui10/tslint.json +17 -0
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/module.component.ts +35 -16
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui10/src/app/module.ts +50 -9
- package/scripts/csdr/metadata/package.js +96 -0
- package/scripts/csdr/sync/sync-utils.js +4 -4
- package/scripts/utils/build/app/build-app-utils.js +5 -4
- package/scripts/utils/pre-build/injection/externals.js +21 -2
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.18.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
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
|
+
* * *
|
|
14
|
+
## 4.17.10 (2021-12-07)
|
|
15
|
+
|
|
16
|
+
##### Chores
|
|
17
|
+
|
|
18
|
+
* **other:**
|
|
19
|
+
* adapted externals injection for extra route remapping for rfs swap on TRN/PROD - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([da46c778](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/da46c778d9be029c888541fe943d0883657c9fac))
|
|
20
|
+
* translations management MWP-7583 [MWP-7583](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-7583) ([e1b07c0b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/e1b07c0bc37957990be5df7c25fa7ffaa98f23cd))
|
|
21
|
+
|
|
22
|
+
* * *
|
|
23
|
+
* * *
|
|
24
|
+
## 4.17.9 (2021-12-06)
|
|
25
|
+
|
|
26
|
+
##### Chores
|
|
27
|
+
|
|
28
|
+
* **other:**
|
|
29
|
+
* disable style lint for v13 apps - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([9f925fdd](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/9f925fdd3ae8e401045fe8979545dbfdb66181a2))
|
|
30
|
+
|
|
31
|
+
* * *
|
|
32
|
+
* * *
|
|
33
|
+
## 4.17.8 (2021-12-02)
|
|
34
|
+
|
|
35
|
+
##### Chores
|
|
36
|
+
|
|
37
|
+
* **other:**
|
|
38
|
+
* added back yarn.lock removal on sync - add devops-metadata sync feature to prevent new package overlap and merge issues - EUI-4107 [EUI-4107](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-4107) ([f115a19f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f115a19f31b3d473576a122405d45e0c4f83bc83))
|
|
39
|
+
|
|
40
|
+
* * *
|
|
41
|
+
* * *
|
|
1
42
|
## 4.17.7 (2021-12-02)
|
|
2
43
|
|
|
3
44
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -15,6 +15,7 @@ const compositeUtils = require('./scripts/csdr/install/composite-utils');
|
|
|
15
15
|
const installUtils = require('./scripts/csdr/install/install-utils');
|
|
16
16
|
const notificationUtils = require('./scripts/utils/notification/notification-utils');
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
// console.log(configUtils.packages.getPackages());
|
|
19
20
|
// console.log(configUtils.packages.getPackage('eui-tools'));
|
|
20
21
|
|
|
@@ -632,15 +633,8 @@ const notificationUtils = require('./scripts/utils/notification/notification-uti
|
|
|
632
633
|
|
|
633
634
|
return Promise.resolve()
|
|
634
635
|
.then(() => {
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
}).map(p => ({ name: p.name, value: p.name }));
|
|
638
|
-
console.log(csdrProjects);
|
|
639
|
-
|
|
640
|
-
const teams = configUtils.projects.getTeamsProject(csdrProjects, answersProject.project)
|
|
641
|
-
.map(t => ({ name: getLabelTeam(t), value: t }))
|
|
642
|
-
.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0)
|
|
643
|
-
.concat([{ name: '* Install all packages', value: 'all' }]);
|
|
636
|
+
const prjName = 'my-workplace';
|
|
637
|
+
const prj = configUtils.projects.getCsdrProject(prjName);
|
|
644
638
|
|
|
645
|
-
|
|
639
|
+
return injectionUtils.externals.remapRoutesByEnvConfig(prj, 'TRN', true);
|
|
646
640
|
})
|
package/scripts/csdr/cli/app.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
26
|
-
|
|
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.
|
|
58
|
-
{ name: 'v13', value: defaultConfig.
|
|
60
|
+
{ name: 'v10', value: defaultConfig.appVersion.EUI10 },
|
|
61
|
+
{ name: 'v13', value: defaultConfig.appVersion.EUI13 },
|
|
59
62
|
],
|
|
60
|
-
default: defaultConfig.
|
|
61
|
-
when: function (answers) {
|
|
62
|
-
|
|
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
|
-
|
|
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,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,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,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,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 {}
|
|
File without changes
|
|
@@ -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 {}
|