@igea/oac_frontend 1.0.49 → 1.0.50

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -94,7 +94,8 @@
94
94
  "submit": "Save",
95
95
  "reset": "Reset",
96
96
  "show_more": "Show more",
97
- "confirm": "Confirm"
97
+ "confirm": "Confirm",
98
+ "download": "Download"
98
99
  }
99
100
  },
100
101
  "search": {
@@ -97,7 +97,8 @@
97
97
  "submit": "Invia",
98
98
  "reset": "Reimposta",
99
99
  "show_more": "Mostra di più",
100
- "confirm": "Conferma"
100
+ "confirm": "Conferma",
101
+ "download": "Scarica"
101
102
  }
102
103
  },
103
104
  "search": {
@@ -52,6 +52,29 @@ document.addEventListener('DOMContentLoaded', () => {
52
52
  }
53
53
  },
54
54
  methods: {
55
+ download(outFormat){
56
+ this.openPostInNewTab("/backend/ontology/convert/ttl/" + outFormat, {
57
+ file: this.serializedForm
58
+ });
59
+ },
60
+ openPostInNewTab(url, params) {
61
+ const form = document.createElement("form");
62
+ form.method = "POST";
63
+ form.action = url;
64
+ form.target = "_blank";
65
+ for (const key in params) {
66
+ if (params.hasOwnProperty(key)) {
67
+ const input = document.createElement("input");
68
+ input.type = "hidden";
69
+ input.name = key;
70
+ input.value = params[key];
71
+ form.appendChild(input);
72
+ }
73
+ }
74
+ document.body.appendChild(form);
75
+ form.submit();
76
+ form.remove();
77
+ },
55
78
  initShaclForm() {
56
79
  var _this = this;
57
80
  this.form = document.querySelector("shacl-form");
@@ -242,7 +265,7 @@ document.addEventListener('DOMContentLoaded', () => {
242
265
 
243
266
  },
244
267
  reset() {
245
-
268
+ window.location.reload();
246
269
  }
247
270
  }
248
271
  });
@@ -85,7 +85,18 @@
85
85
  <!-- Buttons -->
86
86
  <div class="col-12 text-center mt-4">
87
87
  <button v-if="validForm" @click="save()" type="submit" class="btn btn-primary me-2">{{ t('investigation.new.submit') }}</button>
88
- <button @click="reset()" type="button" class="btn btn-secondary">{{ t('investigation.new.reset') }}</button>
88
+ <button style="margin-left:30px;" title="{{ t('investigation.new.download') }}"
89
+ @click="download('xml')" type="button" class="btn btn-secondary">
90
+ <span>RDF/XML</span><i class="fa-solid fa-file-arrow-down"></i>
91
+ </button>
92
+ <button style="margin-left:30px;" title="{{ t('investigation.new.download') }}"
93
+ @click="download('ttl')" type="button" class="btn btn-secondary">
94
+ <span>TURTLE</span><i class="fa-solid fa-file-arrow-down"></i>
95
+ </button>
96
+ <button style="margin-left:30px;" title="{{ t('investigation.new.reset') }}"
97
+ @click="reset()" type="button" class="btn btn-secondary">
98
+ <i class="fa-solid fa-broom"></i>
99
+ </button>
89
100
  </div>
90
101
  {% if user.role in [0, 1] %}
91
102
  <fieldset id="shacl-output" style="margin-top:10px;
@@ -96,6 +107,16 @@
96
107
  <pre :style="outputStyle">{@ serializedForm @}</pre>
97
108
  </fieldset>
98
109
  {% endif %}
110
+ {% else %}
111
+ <div class="col-12 text-center mt-4">
112
+ <button @click="download('xml')" type="button" class="btn btn-secondary">
113
+ <span>RDF/XML</span><i class="fa-solid fa-file-arrow-down"></i>
114
+ </button>
115
+ <button style="margin-left:30px;" title="{{ t('investigation.new.download') }}"
116
+ @click="download('ttl')" type="button" class="btn btn-secondary">
117
+ <span>TURTLE</span><i class="fa-solid fa-file-arrow-down"></i>
118
+ </button>
119
+ </div>
99
120
  {% endif %}
100
121
 
101
122
  <div style="margin-top:200px;"></div>