@igea/oac_frontend 1.0.60 → 1.0.62
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
CHANGED
|
@@ -27,9 +27,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
27
27
|
enabled: el.dataset.editing == "true",
|
|
28
28
|
serializedForm: "",
|
|
29
29
|
validForm: false,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
saving: false,
|
|
31
|
+
lastUpdateTs: 0,
|
|
32
|
+
lastSaveTs: 0,
|
|
33
|
+
isNew: true,
|
|
34
|
+
labels: {},
|
|
33
35
|
search: {
|
|
34
36
|
offset: 0,
|
|
35
37
|
limit: 10,
|
|
@@ -43,6 +45,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
43
45
|
},
|
|
44
46
|
mounted() {
|
|
45
47
|
this.initShaclForm();
|
|
48
|
+
setInterval(this.autoSave.bind(this), 30*1000);
|
|
46
49
|
},
|
|
47
50
|
computed:{
|
|
48
51
|
outputStyle(){
|
|
@@ -59,6 +62,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
methods: {
|
|
65
|
+
autoSave(){
|
|
66
|
+
// Form must be valid and change time after the last save time
|
|
67
|
+
if(this.lastUpdateTs > this.lastSaveTs && this.validForm){
|
|
68
|
+
// A new "indagine" must have to be saved manually
|
|
69
|
+
// from the user the first time
|
|
70
|
+
if(this.isNew && this.lastSaveTs==0)
|
|
71
|
+
return;
|
|
72
|
+
this.save(true);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
62
75
|
download(outFormat){
|
|
63
76
|
this.openPostInNewTab("/backend/ontology/convert/ttl/" + outFormat, {
|
|
64
77
|
file: this.serializedForm
|
|
@@ -94,6 +107,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
94
107
|
// check if form data validates according to the SHACL shapes
|
|
95
108
|
_this.validForm = event.detail?.valid;
|
|
96
109
|
_this.serializedForm = _this.form.serialize();
|
|
110
|
+
_this.lastUpdateTs = (new Date()).getTime();
|
|
97
111
|
});
|
|
98
112
|
|
|
99
113
|
_this.form.addEventListener("ready", () => {
|
|
@@ -321,18 +335,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
321
335
|
callback()
|
|
322
336
|
},
|
|
323
337
|
|
|
324
|
-
save() {
|
|
338
|
+
save(automatic) {
|
|
339
|
+
if(this.saving) return;
|
|
340
|
+
this.lastSaveTs = (new Date()).getTime();
|
|
341
|
+
automatic = automatic || false;
|
|
342
|
+
this.saving = true;
|
|
325
343
|
var request = axios.post("/backend/ontology/form/save", {
|
|
326
344
|
turtle: this.serializedForm,
|
|
327
345
|
uuid: this.uuid
|
|
328
346
|
});
|
|
329
347
|
request.then(response => {
|
|
330
348
|
var obj = response.data;
|
|
331
|
-
if(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
349
|
+
if(!automatic){
|
|
350
|
+
if(obj.success)
|
|
351
|
+
alert("Saved: OK");
|
|
352
|
+
else
|
|
353
|
+
alert("Error: " + obj.message);
|
|
354
|
+
}
|
|
355
|
+
this.saving = false;
|
|
335
356
|
}).catch(error => {
|
|
357
|
+
this.saving = false;
|
|
336
358
|
console.log(error);
|
|
337
359
|
});
|
|
338
360
|
},
|
|
@@ -2,12 +2,34 @@ const { createApp, ref } = Vue;
|
|
|
2
2
|
|
|
3
3
|
const appId = 'rdf-viewer-app';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'
|
|
5
|
+
//----------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
const classConfig = {
|
|
8
|
+
'E7_Activity': {
|
|
9
|
+
'color': 'rgba(174, 93, 56, 0.5)',
|
|
10
|
+
'label': 'Attività'
|
|
11
|
+
},
|
|
12
|
+
'E42_Identifier': {
|
|
13
|
+
'color': 'rgba(0,0,255,0.5)',
|
|
14
|
+
'label': 'Identificatore'
|
|
15
|
+
},
|
|
16
|
+
'E54_Dimension': {
|
|
17
|
+
'label':'Dimensione'
|
|
18
|
+
},
|
|
19
|
+
'E55_Type': {
|
|
20
|
+
'color': 'rgba(0,255,0,0.70)',
|
|
21
|
+
'label': 'Tipo'
|
|
22
|
+
},
|
|
23
|
+
'P90_has_value': {
|
|
24
|
+
'label': 'Ha valore'
|
|
25
|
+
},
|
|
26
|
+
'S13_Sample': {
|
|
27
|
+
'label': 'Campione'
|
|
28
|
+
}
|
|
9
29
|
};
|
|
10
30
|
|
|
31
|
+
//----------------------------------------------------------
|
|
32
|
+
|
|
11
33
|
const splitName = function(name){
|
|
12
34
|
name = name.split("/").pop();
|
|
13
35
|
name = name.split(":").pop();
|
|
@@ -44,7 +66,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
44
66
|
style="width:32px; height:32px;"
|
|
45
67
|
>
|
|
46
68
|
<i v-else style="margin-left:10px;"></i>
|
|
47
|
-
|
|
69
|
+
<i v-if="node.loadStatus == 'done' && node.predicates.length==0"
|
|
70
|
+
class="fa-solid fa-link-slash"
|
|
71
|
+
style="margin-right:10px;"
|
|
72
|
+
></i>
|
|
73
|
+
{{ classesLabelFor(node) + ' ' + classesTagFor(node) }}
|
|
48
74
|
</div>
|
|
49
75
|
<div v-if="expanded">
|
|
50
76
|
<template v-if="node.predicates && node.predicates.length > 0">
|
|
@@ -96,9 +122,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
96
122
|
if (node.classes && node.classes.length > 0) {
|
|
97
123
|
for(var i=0; i<node.classes.length; i++){
|
|
98
124
|
var clazz = node.classes[i];
|
|
99
|
-
if(
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
if(classConfig.hasOwnProperty(clazz)){
|
|
126
|
+
var _color = classConfig[clazz].color || null;
|
|
127
|
+
if(_color){
|
|
128
|
+
color = _color;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
|
|
102
132
|
}
|
|
103
133
|
}
|
|
104
134
|
}
|
|
@@ -106,7 +136,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
106
136
|
'background-color': `${color}`
|
|
107
137
|
};
|
|
108
138
|
},
|
|
109
|
-
|
|
139
|
+
classesTagFor(node){
|
|
110
140
|
var label = "";
|
|
111
141
|
if(node.classes && node.classes.length > 0){
|
|
112
142
|
var int_label = "";
|
|
@@ -121,6 +151,22 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
121
151
|
}
|
|
122
152
|
return label;
|
|
123
153
|
},
|
|
154
|
+
classesLabelFor(node){
|
|
155
|
+
var label = node.label;
|
|
156
|
+
if(node.classes && node.classes.length > 0){
|
|
157
|
+
for(var i=0; i<node.classes.length; i++){
|
|
158
|
+
var part = splitName(node.classes[i]);
|
|
159
|
+
if(classConfig.hasOwnProperty(part)){
|
|
160
|
+
var _label = classConfig[part].label || null;
|
|
161
|
+
if(_label){
|
|
162
|
+
label = _label;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return label;
|
|
169
|
+
},
|
|
124
170
|
toggleExpand() {
|
|
125
171
|
if ((this.node.predicates && this.node.predicates.length > 0) ||
|
|
126
172
|
(this.node.children && this.node.children.length > 0)) {
|
|
@@ -83,12 +83,14 @@
|
|
|
83
83
|
data-shapes-url="/backend/ontology/schema/ttl2"
|
|
84
84
|
data-values-url="/backend/ontology/form/{{ uuid }}"
|
|
85
85
|
data-shape-subject="http://example.org/shapes/E7ActivityShape"
|
|
86
|
-
data-values-subject="http://diagnostica/e2d49af0-6c52-4fc5-8290-936b87472adf"
|
|
86
|
+
data-values-subject="http://diagnostica/e2d49af0-6c52-4fc5-8290-936b87472adf"
|
|
87
|
+
data-generate-node-shape-reference=""
|
|
87
88
|
></shacl-form>
|
|
88
89
|
{% else %}
|
|
89
90
|
<shacl-form id="shacl-form" data-collapse="open"
|
|
90
91
|
data-values-namespace="pref:"
|
|
91
92
|
data-shapes-url="/backend/ontology/schema/ttl2"
|
|
93
|
+
data-generate-node-shape-reference=""
|
|
92
94
|
></shacl-form>
|
|
93
95
|
{% endif %}
|
|
94
96
|
|
|
@@ -112,9 +114,10 @@
|
|
|
112
114
|
</button>
|
|
113
115
|
-->
|
|
114
116
|
|
|
115
|
-
<button v-if="validForm" style="margin-left:30px;" title="{{ t('investigation.new.confirm') }}"
|
|
116
|
-
@click="save()" type="button" class="btn btn-primary">
|
|
117
|
-
<i class="fa-solid fa-
|
|
117
|
+
<button v-if="validForm" :disabled="saving" style="margin-left:30px;" title="{{ t('investigation.new.confirm') }}"
|
|
118
|
+
@click="save(false)" type="button" :class="['btn', saving ? 'btn-secondary' : 'btn-primary']">
|
|
119
|
+
<i v-if="saving"class="fa-solid fa-spinner"></i>
|
|
120
|
+
<i v-else class="fa-solid fa-save"></i>
|
|
118
121
|
</button>
|
|
119
122
|
|
|
120
123
|
<button style="margin-left:30px;" title="{{ t('investigation.new.reset') }}"
|