@igea/oac_frontend 1.0.88 → 1.0.90
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/package.json +2 -2
- package/src/controllers/search_v2.js +35 -0
- package/src/controllers/users_v2.js +71 -0
- package/src/controllers/vocabolaries_v2.js +26 -0
- package/src/index.js +129 -1
- package/src/public/js/app/vue-investigation.js +21 -4
- package/src/public/js/login/login.js +1 -1
- package/src/public/v2/css/v2.css +483 -0
- package/src/public/v2/images/Osservazione in microscopia ottica.jpg +0 -0
- package/src/public/v2/images/Preparazione campioni.jpg +0 -0
- package/src/public/v2/images/Prospezione georadar.jpg +0 -0
- package/src/public/v2/images/banner.png +0 -0
- package/src/public/v2/images/dip_antichita.jpg +0 -0
- package/src/public/v2/images/dip_biologia.jpg +0 -0
- package/src/public/v2/images/dip_sdara.jpg +0 -0
- package/src/public/v2/images/dip_terra.png +0 -0
- package/src/public/v2/images/logo.jpeg +0 -0
- package/src/public/v2/images/logo.jpg +0 -0
- package/src/public/v2/js/v2.js +31 -0
- package/src/views/investigation/form.twig +0 -6
- package/src/views/v2/home.twig +8 -0
- package/src/views/v2/investigation/form.twig +31 -0
- package/src/views/v2/investigation/form_content.twig +167 -0
- package/src/views/v2/layout.twig +51 -0
- package/src/views/v2/partials/footer.twig +8 -0
- package/src/views/v2/partials/header.twig +52 -0
- package/src/views/v2/partials/sidebar.twig +51 -0
- package/src/views/v2/presentazione/finalita.twig +66 -0
- package/src/views/v2/presentazione/partecipanti.twig +40 -0
- package/src/views/v2/presentazione/sistema.twig +62 -0
- package/src/views/v2/search/advanced.twig +86 -0
- package/src/views/v2/search/config.ttl +251 -0
- package/src/views/v2/search/fast.twig +142 -0
- package/src/views/v2/search/index.html +115 -0
- package/src/views/v2/sidebars/admin.twig +18 -0
- package/src/views/v2/sidebars/investigation.twig +4 -0
- package/src/views/v2/sidebars/presentazione.twig +42 -0
- package/src/views/v2/sidebars/search.twig +51 -0
- package/src/views/v2/users/edit.twig +114 -0
- package/src/views/v2/users/index.twig +8 -0
- package/src/views/v2/users/manage.twig +59 -0
- package/src/views/v2/users/reset_password.twig +36 -0
- package/src/views/v2/vocabolaries/edit.twig +61 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igea/oac_frontend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.90",
|
|
4
4
|
"description": "Frontend service for the OAC project",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/chpigea/oac_frontend#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@igea/oac_jwt_helpers": "1.0.
|
|
26
|
+
"@igea/oac_jwt_helpers": "1.0.13",
|
|
27
27
|
"axios": "1.10.0",
|
|
28
28
|
"cookie-parser": "1.4.7",
|
|
29
29
|
"express": "5.1.0",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const DataModel = require('../models/DataModel');
|
|
4
|
+
|
|
5
|
+
module.exports = function(serviceName) {
|
|
6
|
+
|
|
7
|
+
router.get('/fast/:what', (req, res) => {
|
|
8
|
+
let data = new DataModel(req, {
|
|
9
|
+
root: serviceName,
|
|
10
|
+
title: 'Fast Search',
|
|
11
|
+
activeMenu: 'search',
|
|
12
|
+
activeSidebar: 'search',
|
|
13
|
+
activeSidebarItem: 'fast',
|
|
14
|
+
fastType: req.params.what,
|
|
15
|
+
currentPath: req.baseUrl +req.path,
|
|
16
|
+
schema: 'fast_' + req.params.what
|
|
17
|
+
});
|
|
18
|
+
res.render('v2/search/advanced.twig', data.toJson());
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
router.get('/advanced', (req, res) => {
|
|
22
|
+
let data = new DataModel(req, {
|
|
23
|
+
root: serviceName,
|
|
24
|
+
title: 'Advanced Search',
|
|
25
|
+
activeMenu: 'search',
|
|
26
|
+
activeSidebar: 'search',
|
|
27
|
+
activeSidebarItem: 'advanced',
|
|
28
|
+
currentPath: req.baseUrl +req.path,
|
|
29
|
+
schema: 'advanced'
|
|
30
|
+
});
|
|
31
|
+
res.render('v2/search/advanced.twig', data.toJson());
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return router
|
|
35
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const DataModel = require('../models/DataModel');
|
|
4
|
+
|
|
5
|
+
module.exports = function(serviceName) {
|
|
6
|
+
/**
|
|
7
|
+
* @route GET /users/manage: redirect to the users page with list of users
|
|
8
|
+
*/
|
|
9
|
+
router.get('/manage', (req, res) => {
|
|
10
|
+
let data = new DataModel(req, {
|
|
11
|
+
root: serviceName,
|
|
12
|
+
title: 'User Management',
|
|
13
|
+
activeMenu: 'admin',
|
|
14
|
+
activeSidebar: 'admin',
|
|
15
|
+
activeSidebarItem: 'users',
|
|
16
|
+
currentPath: req.baseUrl +req.path,
|
|
17
|
+
});
|
|
18
|
+
res.render('v2/users/manage.twig', data.toJson());
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @route GET /users/:id: redirect to the user page with user details
|
|
23
|
+
*/
|
|
24
|
+
router.get('/:id', (req, res) => {
|
|
25
|
+
let data = new DataModel(req, {
|
|
26
|
+
root: serviceName,
|
|
27
|
+
title: 'User Edit',
|
|
28
|
+
id: req.params.id,
|
|
29
|
+
activeMenu: 'admin',
|
|
30
|
+
activeSidebar: 'admin',
|
|
31
|
+
activeSidebarItem: 'users',
|
|
32
|
+
currentPath: req.baseUrl +req.path,
|
|
33
|
+
});
|
|
34
|
+
res.render('v2/users/edit.twig', data.toJson());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @route POST /users/:id: update or create an user
|
|
39
|
+
*/
|
|
40
|
+
router.post('/:id', (req, res) => {
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @route DELETE /users/:id: delete an user
|
|
46
|
+
*/
|
|
47
|
+
router.delete('/:id', (req, res) => {
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
router.get('/reset_password/:id/:token', (req, res) => {
|
|
52
|
+
let data = new DataModel(req, {
|
|
53
|
+
root: serviceName,
|
|
54
|
+
title: 'Reset password',
|
|
55
|
+
activeMenu: 'admin',
|
|
56
|
+
activeSidebar: 'admin',
|
|
57
|
+
activeSidebarItem: 'users',
|
|
58
|
+
user: {
|
|
59
|
+
id: req.params.id,
|
|
60
|
+
token: req.params.token
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
res.render('v2/users/reset_password.twig', data.toJson());
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return router
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const DataModel = require('../models/DataModel');
|
|
4
|
+
|
|
5
|
+
module.exports = function(serviceName) {
|
|
6
|
+
/**
|
|
7
|
+
* @route GET /users/manage: redirect to the users page with list of users
|
|
8
|
+
*/
|
|
9
|
+
router.get('/manage', (req, res) => {
|
|
10
|
+
let data = new DataModel(req, {
|
|
11
|
+
root: serviceName,
|
|
12
|
+
title: 'Vocabolaries Management',
|
|
13
|
+
activeMenu: 'admin',
|
|
14
|
+
activeSidebar: 'admin',
|
|
15
|
+
activeSidebarItem: 'vocabolaries',
|
|
16
|
+
currentPath: req.baseUrl +req.path,
|
|
17
|
+
});
|
|
18
|
+
res.render('v2/vocabolaries/edit.twig', data.toJson());
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return router
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const getPort = require('get-port');
|
|
|
6
6
|
const cookieParser = require('cookie-parser');
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const i18n = require('i18n');
|
|
9
|
-
const jwtLibFactory = require('@igea/oac_jwt_helpers')
|
|
9
|
+
const jwtLibFactory = require('@igea/oac_jwt_helpers');
|
|
10
10
|
const serviceName = "frontend"
|
|
11
11
|
const DataModel = require('./models/DataModel');
|
|
12
12
|
const jwtLib = jwtLibFactory({
|
|
@@ -38,8 +38,11 @@ i18n.configure({
|
|
|
38
38
|
const app = express();
|
|
39
39
|
let newPort = null
|
|
40
40
|
|
|
41
|
+
app.set('trust proxy', true);
|
|
42
|
+
|
|
41
43
|
app.use(i18n.init);
|
|
42
44
|
app.use(`/${serviceName}`, express.static(path.join(__dirname, 'public')));
|
|
45
|
+
|
|
43
46
|
app.use(cookieParser());
|
|
44
47
|
app.use(express.json());
|
|
45
48
|
app.use(jwtLib.middleware);
|
|
@@ -52,6 +55,15 @@ app.use((req, res, next) => {
|
|
|
52
55
|
next();
|
|
53
56
|
});
|
|
54
57
|
|
|
58
|
+
app.use((req, res, next) => {
|
|
59
|
+
const proto = req.headers['x-forwarded-proto'] || req.protocol;
|
|
60
|
+
const host = req.headers['x-forwarded-host'] || req.get('host');
|
|
61
|
+
|
|
62
|
+
res.locals.baseUrl = `${proto}://${host}/`;
|
|
63
|
+
next();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
|
|
55
67
|
const register = async function(){
|
|
56
68
|
try {
|
|
57
69
|
console.log(`Registering ${serviceName}...`);
|
|
@@ -76,26 +88,41 @@ getPort.default({
|
|
|
76
88
|
const healthRouter = require('./controllers/health.js');
|
|
77
89
|
app.use(`/${serviceName}/health`, healthRouter);
|
|
78
90
|
|
|
91
|
+
|
|
79
92
|
const usersRouter = require('./controllers/users.js')(serviceName);
|
|
80
93
|
app.use(`/${serviceName}/users`, usersRouter);
|
|
94
|
+
const usersRouterV2 = require('./controllers/users_v2.js')(serviceName);
|
|
95
|
+
app.use(`/frontend/v2/users`, usersRouterV2);
|
|
96
|
+
|
|
81
97
|
|
|
82
98
|
const vocabolariesRouter = require('./controllers/vocabolaries.js')(serviceName);
|
|
83
99
|
app.use(`/${serviceName}/vocabolaries`, vocabolariesRouter);
|
|
100
|
+
const vocabolariesRouterV2 = require('./controllers/vocabolaries_v2.js')(serviceName);
|
|
101
|
+
app.use(`/frontend/v2/vocabolaries`, vocabolariesRouterV2);
|
|
102
|
+
|
|
84
103
|
|
|
85
104
|
const searchRouter = require('./controllers/search.js')(serviceName);
|
|
86
105
|
app.use(`/${serviceName}/search`, searchRouter);
|
|
106
|
+
const searchRouterV2 = require('./controllers/search_v2.js')(serviceName);
|
|
107
|
+
app.use(`/frontend/v2/search`, searchRouterV2);
|
|
108
|
+
|
|
87
109
|
|
|
88
110
|
const introductionRouter = require('./controllers/introduction.js')(serviceName);
|
|
89
111
|
app.use(`/${serviceName}/introduction`, introductionRouter);
|
|
112
|
+
|
|
90
113
|
|
|
91
114
|
const investigationRouter = require('./controllers/investigation.js')(serviceName);
|
|
92
115
|
app.use(`/${serviceName}/investigation`, investigationRouter);
|
|
93
116
|
|
|
117
|
+
|
|
94
118
|
const rdfRouter = require('./controllers/rdf.js')(serviceName);
|
|
95
119
|
app.use(`/${serviceName}/rdf`, rdfRouter);
|
|
96
120
|
|
|
121
|
+
|
|
97
122
|
const captchaRouter = require('./controllers/captcha.js');
|
|
98
123
|
app.use(`/${serviceName}/captcha`, captchaRouter);
|
|
124
|
+
|
|
125
|
+
|
|
99
126
|
// ---------------------------------------------------------------------
|
|
100
127
|
// Application routes
|
|
101
128
|
// ---------------------------------------------------------------------
|
|
@@ -112,6 +139,107 @@ getPort.default({
|
|
|
112
139
|
});
|
|
113
140
|
res.render('home', data.toJson());
|
|
114
141
|
});
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
app.get(`/${serviceName}/v2/home`, (req, res) => {
|
|
145
|
+
let data = new DataModel(req, {
|
|
146
|
+
root: `/${serviceName}/v2`,
|
|
147
|
+
title: 'HD-LSD',
|
|
148
|
+
});
|
|
149
|
+
res.render('v2/presentazione/sistema', data.toJson());
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
app.get('/frontend/v2/introduction', (req, res) => {
|
|
153
|
+
let data = new DataModel(req, {
|
|
154
|
+
root: 'frontend/v2',
|
|
155
|
+
title: 'Introduzione',
|
|
156
|
+
activeMenu: 'introduction',
|
|
157
|
+
activeSidebar: 'presentazione',
|
|
158
|
+
activeSidebarItem: 'sistema'
|
|
159
|
+
});
|
|
160
|
+
res.render('v2/presentazione/sistema', data.toJson());
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
app.get('/frontend/v2/finalita', (req, res) => {
|
|
164
|
+
let data = new DataModel(req, {
|
|
165
|
+
root: 'frontend/v2',
|
|
166
|
+
title: 'Finalità',
|
|
167
|
+
|
|
168
|
+
activeMenu: 'introduction',
|
|
169
|
+
activeSidebar: 'presentazione',
|
|
170
|
+
activeSidebarItem: 'finalita'
|
|
171
|
+
});
|
|
172
|
+
res.render('v2/presentazione/finalita', data.toJson());
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
app.get('/frontend/v2/partecipanti', (req, res) => {
|
|
176
|
+
let data = new DataModel(req, {
|
|
177
|
+
root: 'frontend/v2',
|
|
178
|
+
title: 'Partecipanti',
|
|
179
|
+
|
|
180
|
+
activeMenu: 'introduction',
|
|
181
|
+
activeSidebar: 'presentazione',
|
|
182
|
+
activeSidebarItem: 'partecipanti'
|
|
183
|
+
});
|
|
184
|
+
res.render('v2/presentazione/partecipanti', data.toJson());
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
app.get('/frontend/v2/sistema', (req, res) => {
|
|
188
|
+
let data = new DataModel(req, {
|
|
189
|
+
root: 'frontend/v2',
|
|
190
|
+
title: 'Il sistema',
|
|
191
|
+
|
|
192
|
+
activeMenu: 'introduction',
|
|
193
|
+
activeSidebar: 'presentazione',
|
|
194
|
+
activeSidebarItem: 'sistema'
|
|
195
|
+
});
|
|
196
|
+
res.render('v2/presentazione/sistema', data.toJson());
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
app.get('/frontend/v2/investigation/form', async (req, res) => {
|
|
200
|
+
let data = new DataModel(req, {
|
|
201
|
+
root: 'frontend/v2',
|
|
202
|
+
title: 'Indagine',
|
|
203
|
+
activeMenu: 'investigation',
|
|
204
|
+
activeSidebar: 'investigation',
|
|
205
|
+
showForm: true
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
res.render('v2/investigation/form', data.toJson());
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
app.get('/frontend/v2/search', (req, res) => {
|
|
212
|
+
let data = new DataModel(req, {
|
|
213
|
+
root: 'frontend/v2',
|
|
214
|
+
title: 'Ricerca',
|
|
215
|
+
activeMenu: 'search',
|
|
216
|
+
activeSidebar: 'search',
|
|
217
|
+
activeSidebarItem: 'fast',
|
|
218
|
+
fastType: 1,
|
|
219
|
+
schema: 'fast_' + 1
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
res.render('v2/search/advanced', data.toJson());
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
app.get('/frontend/v2/admin', (req, res) => {
|
|
227
|
+
let data = new DataModel(req, {
|
|
228
|
+
root: 'frontend/v2',
|
|
229
|
+
title: 'Amministrazione',
|
|
230
|
+
activeMenu: 'admin',
|
|
231
|
+
activeSidebar: 'admin',
|
|
232
|
+
activeSidebarItem: 'dashboard'
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
res.render('v2/users/index', data.toJson());
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
115
243
|
// ---------------------------------------------------------------------
|
|
116
244
|
// Start listing on the specified port
|
|
117
245
|
app.listen(port, async () => {
|
|
@@ -125,6 +125,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
125
125
|
|
|
126
126
|
const el = document.getElementById(appId);
|
|
127
127
|
|
|
128
|
+
if (!el) {
|
|
129
|
+
console.warn('[vue-investigation] #investigation-app not found, skipping mount');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const showForm = (el.dataset.showForm === 'true');
|
|
133
|
+
|
|
128
134
|
const app = createApp({
|
|
129
135
|
delimiters: ['{@', '@}'],
|
|
130
136
|
data() {
|
|
@@ -160,6 +166,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
160
166
|
}
|
|
161
167
|
},
|
|
162
168
|
mounted() {
|
|
169
|
+
if (showForm) {
|
|
170
|
+
this.resetShaclForm(null, true);
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
this.initShaclForm();
|
|
164
174
|
setInterval(this.autoSave.bind(this), 30*1000);
|
|
165
175
|
// Ascolta eventi dall'autocomplete
|
|
@@ -319,10 +329,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
319
329
|
|
|
320
330
|
// Resetta il riferimento e reinizializza
|
|
321
331
|
this.form = null;
|
|
322
|
-
this.initShaclForm();
|
|
332
|
+
this.initShaclForm(uuid);
|
|
323
333
|
|
|
324
334
|
},
|
|
325
|
-
initShaclForm() {
|
|
335
|
+
initShaclForm(uuid) {
|
|
326
336
|
var _this = this;
|
|
327
337
|
setTimeout(async ()=>{
|
|
328
338
|
_this.form = document.querySelector("shacl-form");
|
|
@@ -358,8 +368,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
358
368
|
else
|
|
359
369
|
_this.makeAttachmentClickable();
|
|
360
370
|
_this.validForm = true;
|
|
361
|
-
_this.
|
|
362
|
-
|
|
371
|
+
if(_this.inEditing)
|
|
372
|
+
_this.serializedForm = _this.form.serialize();
|
|
373
|
+
else{
|
|
374
|
+
setTimeout(async function(){
|
|
375
|
+
var rnd = (new Date()).getTime();
|
|
376
|
+
const response = await fetch("/backend/ontology/form/" + uuid + "?rnd=" + rnd)
|
|
377
|
+
_this.serializedForm = await response.text();
|
|
378
|
+
});
|
|
379
|
+
}
|
|
363
380
|
if(!_this.enabled)
|
|
364
381
|
_this.disableInteractions(_this.form);
|
|
365
382
|
|
|
@@ -7,7 +7,7 @@ onSubmit = function(type){
|
|
|
7
7
|
password: (type == "login") ?
|
|
8
8
|
document.getElementById("password").value : "",
|
|
9
9
|
}).then(response => {
|
|
10
|
-
window.location = "/frontend/introduction
|
|
10
|
+
window.location = "/frontend/v2/introduction";
|
|
11
11
|
}).catch(error => {
|
|
12
12
|
console.log(error);
|
|
13
13
|
});
|