@piveau/piveau-hub-ui-modules 4.6.9 → 4.6.11

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.
@@ -1,11 +1,11 @@
1
- import { mapGetters as E } from "vuex";
2
- import { onUnmounted as C, resolveComponent as _, openBlock as w, createElementBlock as h, createBlock as y, withCtx as F, createElementVNode as i, createTextVNode as m, toDisplayString as u, normalizeStyle as I, createCommentVNode as f } from "vue";
3
- import { useRouter as S } from "vue-router";
4
- import { has as T, isNil as U } from "lodash-es";
5
- import M from "axios";
6
- import { saveAs as O } from "file-saver";
7
- import Z from "jquery";
8
- import { getTranslationFor as R } from "../../utils/helpers.mjs";
1
+ import { mapGetters as C } from "vuex";
2
+ import { onUnmounted as _, resolveComponent as I, openBlock as m, createElementBlock as h, createBlock as y, withCtx as F, createElementVNode as l, createTextVNode as w, toDisplayString as u, normalizeStyle as S, createCommentVNode as f } from "vue";
3
+ import { useRouter as U } from "vue-router";
4
+ import { has as T, isNil as M } from "lodash-es";
5
+ import O from "axios";
6
+ import { saveAs as R } from "file-saver";
7
+ import k from "jquery";
8
+ import { getTranslationFor as Z } from "../../utils/helpers.mjs";
9
9
  import x from "../../_virtual/_plugin-vue_export-helper.mjs";
10
10
  const $ = {
11
11
  name: "DownloadAllDistributions",
@@ -19,25 +19,25 @@ const $ = {
19
19
  "small"
20
20
  ],
21
21
  computed: {
22
- ...E("datasetDetails", [
22
+ ...C("datasetDetails", [
23
23
  "getDistributions",
24
24
  "getTitle",
25
25
  "getCatalog",
26
26
  "getLanguages"
27
27
  ]),
28
28
  files() {
29
- const s = (e) => e.lastIndexOf(".") !== -1 ? e.substring(0, e.lastIndexOf(".")) : e, t = (e) => {
30
- if (T(e, "format.id") && !U(e.format.id)) {
31
- const n = e.format.id;
32
- return n.lastIndexOf(".") === -1 ? n.toLowerCase() : n.substring(n.lastIndexOf(".") + 1, n.length).toLowerCase();
29
+ const s = (t) => t.lastIndexOf(".") !== -1 ? t.substring(0, t.lastIndexOf(".")) : t, e = (t) => {
30
+ if (T(t, "format.id") && !M(t.format.id)) {
31
+ const a = t.format.id;
32
+ return a.lastIndexOf(".") === -1 ? a.toLowerCase() : a.substring(a.lastIndexOf(".") + 1, a.length).toLowerCase();
33
33
  }
34
34
  return "";
35
- }, l = (e, n) => `${s(this.getDistributionTitle(e)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH).replace(/\//g, " ").trim()}-${n}` || `${s(this.getDistributionDescription(e)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH).replace(/\//g, " ").trim()}-${n}`, a = (e) => this.showDownloadUrls(e) ? { accessUrl: `${e.accessUrl[0]}`, downloadUrl: `${e.downloadUrls[0]}` } : { accessUrl: `${e.accessUrl[0]}` }, o = (e) => this.getDistributionTitle(e).replace(/,/g, "") || this.getDistributionDescription(e).replace(/,/g, "");
36
- return this.getDistributions.map((e, n) => ({
37
- title: l(e, n + 1),
38
- ...a(e),
39
- format: t(e),
40
- csvReportTitle: o(e)
35
+ }, r = (t, a) => `${s(this.getDistributionTitle(t)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH).replace(/\//g, " ").trim()}-${a}` || `${s(this.getDistributionDescription(t)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH).replace(/\//g, " ").trim()}-${a}`, i = (t) => this.showDownloadUrls(t) ? { accessUrl: `${t.accessUrl[0]}`, downloadUrl: `${t.downloadUrls[0]}` } : { accessUrl: `${t.accessUrl[0]}` }, o = (t) => this.getDistributionTitle(t).replace(/,/g, "") || this.getDistributionDescription(t).replace(/,/g, "");
36
+ return this.getDistributions.map((t, a) => ({
37
+ title: r(t, a + 1),
38
+ ...i(t),
39
+ format: e(t),
40
+ csvReportTitle: o(t)
41
41
  }));
42
42
  }
43
43
  },
@@ -61,48 +61,48 @@ const $ = {
61
61
  };
62
62
  },
63
63
  methods: {
64
- getTranslationFor: R,
65
- async fetchDistributionFiles(s, t, l, a) {
64
+ getTranslationFor: Z,
65
+ async fetchDistributionFiles(s, e, r, i) {
66
66
  const o = [];
67
67
  let d = `filename,status, issue_cause downloadURL, issue_cause accessURL
68
- `, e;
69
- const n = ["wms", "wfs"], k = M.CancelToken;
70
- this.cancelDownloadAllAxiosRequestSource = k.source();
71
- const b = this.$bulkDownloadAxiosInstance, A = { responseType: "blob", cancelToken: this.cancelDownloadAllAxiosRequestSource.token, timeout: this.bulkDownload.TIMEOUT_MS }, L = t.map(async (r) => {
72
- const v = n.find((g) => g === r.format);
68
+ `, t;
69
+ const a = ["wms", "wfs"], L = O.CancelToken;
70
+ this.cancelDownloadAllAxiosRequestSource = L.source();
71
+ const b = this.$bulkDownloadAxiosInstance, A = { responseType: "blob", cancelToken: this.cancelDownloadAllAxiosRequestSource.token, timeout: this.bulkDownload.TIMEOUT_MS }, E = e.map(async (n) => {
72
+ const v = a.find((g) => g === n.format);
73
73
  if (v)
74
- o.push([r.csvReportTitle, "issue", `We can't download ${v} files using the download all button. Please try to download this file using the download button next to the file name.`]);
74
+ o.push([n.csvReportTitle, "issue", `We can't download ${v} files using the download all button. Please try to download this file using the download button next to the file name.`]);
75
75
  else {
76
- let g = !0, D, p = r.format;
77
- T(r, "downloadUrl") ? D = await b.get(r.downloadUrl, A).then((c) => c.status === 200 ? (g = !1, !r.format.length > 0 && (p = a(c.headers["content-type"])), o.push([r.csvReportTitle, "delivered"]), c.data) : Promise.reject(new Error(c.statusText))).catch((c) => {
78
- g = !0, e = c;
79
- }) : e = "no download url available", this.isUrlInvalid(r.downloadUrl) && o.push([r.csvReportTitle, "issue", "url is invalid"]), g && (D = await b.get(r.accessUrl, A).then((c) => c.status === 200 ? (g = !1, r.format.length > 0 && (p = a(c.headers["content-type"])), o.push([r.csvReportTitle, "delivered", e]), c.data) : Promise.reject(new Error(c.statusText))).catch((c) => {
80
- g = !0, o.push([r.csvReportTitle, "issue", e, c]);
81
- })), g || l.file(`${r.title}.${p}`, D, { binary: !0 }), this.isDownloadAllDistributionsCanceled ? (this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.failedDownloads = 0) : (this.downloadedFilesCounter += 1, this.downloadProgress = Math.floor(100 * this.downloadedFilesCounter / this.getDistributions.length), g && (this.failedDownloads += 1));
76
+ let g = !0, p, D = n.format;
77
+ T(n, "downloadUrl") ? p = await b.get(n.downloadUrl, A).then((c) => c.status === 200 ? (g = !1, !n.format.length > 0 && (D = i(c.headers["content-type"])), o.push([n.csvReportTitle, "delivered"]), c.data) : Promise.reject(new Error(c.statusText))).catch((c) => {
78
+ g = !0, t = c;
79
+ }) : t = "no download url available", this.isUrlInvalid(n.downloadUrl) && o.push([n.csvReportTitle, "issue", "url is invalid"]), g && (p = await b.get(n.accessUrl, A).then((c) => c.status === 200 ? (g = !1, n.format.length > 0 && (D = i(c.headers["content-type"])), o.push([n.csvReportTitle, "delivered", t]), c.data) : Promise.reject(new Error(c.statusText))).catch((c) => {
80
+ g = !0, o.push([n.csvReportTitle, "issue", t, c]);
81
+ })), g || r.file(`${n.title}.${D}`, p, { binary: !0 }), this.isDownloadAllDistributionsCanceled ? (this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.failedDownloads = 0) : (this.downloadedFilesCounter += 1, this.downloadProgress = Math.floor(100 * this.downloadedFilesCounter / this.getDistributions.length), g && (this.failedDownloads += 1));
82
82
  }
83
83
  });
84
- await Promise.all(L), o.forEach((r) => {
85
- d += r.join(","), d += `
84
+ await Promise.all(E), o.forEach((n) => {
85
+ d += n.join(","), d += `
86
86
  `;
87
87
  }), s.file("file_report.csv", d, { binary: !0 });
88
88
  },
89
89
  hideDownloadAllModal() {
90
- Z("#downloadAllModal").modal("hide");
90
+ k("#downloadAllModal").modal("hide");
91
91
  },
92
- generateAndSaveZip(s, t) {
92
+ generateAndSaveZip(s, e) {
93
93
  this.isDownloadAllDistributionsCanceled || (this.numberOfFilesToZip = Object.keys(s.files).length, this.isGeneratingZip = !0);
94
- class l {
94
+ class r {
95
95
  constructor(o) {
96
96
  this.message = o, this.name = "UserInterruptException";
97
97
  }
98
98
  }
99
99
  s.generateAsync({ type: "blob", compression: "DEFLATE" }, () => {
100
100
  if (this.isDownloadAllDistributionsCanceled)
101
- throw new l("user canceled generate zip operation");
102
- }).then((a) => {
103
- this.isGeneratingZip = !1, this.isGeneratingZipDone = !0, this.isLoadingAllDistributionFiles = !1, this.downloadAllSuccess = !0, O(a, t);
104
- }).catch((a) => {
105
- this.isGeneratingZip = !1, this.isDownloadAllDistributionsCanceled = !1, this.isLoadingAllDistributionFiles = !1, this.downloadAllError = !0, this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.numberOfFilesToZip = 0, console.warn(a);
101
+ throw new r("user canceled generate zip operation");
102
+ }).then((i) => {
103
+ this.isGeneratingZip = !1, this.isGeneratingZipDone = !0, this.isLoadingAllDistributionFiles = !1, this.downloadAllSuccess = !0, R(i, e);
104
+ }).catch((i) => {
105
+ this.isGeneratingZip = !1, this.isDownloadAllDistributionsCanceled = !1, this.isLoadingAllDistributionFiles = !1, this.downloadAllError = !0, this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.numberOfFilesToZip = 0, console.warn(i);
106
106
  });
107
107
  },
108
108
  cancelDownloadAll(s) {
@@ -119,170 +119,173 @@ const $ = {
119
119
  ), await this.downloadAllDistributions();
120
120
  },
121
121
  async downloadAllDistributions() {
122
- this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.failedDownloads = 0, this.numberOfFilesToZip = 0, this.isGeneratingZip = !1, this.isGeneratingZipDone = !1, this.isLoadingAllDistributionFiles = !0, this.isDownloadAllDistributionsCanceled = !1, this.downloadAllSuccess = !1, this.downloadAllError = !1;
122
+ k("#downloadAllModal").modal("show"), this.downloadedFilesCounter = 0, this.downloadProgress = 0, this.failedDownloads = 0, this.numberOfFilesToZip = 0, this.isGeneratingZip = !1, this.isGeneratingZipDone = !1, this.isLoadingAllDistributionFiles = !0, this.isDownloadAllDistributionsCanceled = !1, this.downloadAllSuccess = !1, this.downloadAllError = !1;
123
123
  const s = (d) => {
124
- const e = d.lastIndexOf("/") + 1, n = d.indexOf(";") !== -1 ? d.indexOf(";") : d.length;
125
- return d.substring(e, n);
126
- }, { default: t } = await import("jszip"), l = new t(), a = `${this.getTranslationFor(this.getTitle, this.$route.query.locale, this.getLanguages)}.zip`, o = l.folder(this.getTranslationFor(this.getCatalog.title, this.$route.query.locale, this.getLanguages));
127
- await this.fetchDistributionFiles(l, this.files, o, s), await this.generateAndSaveZip(l, a);
124
+ const t = d.lastIndexOf("/") + 1, a = d.indexOf(";") !== -1 ? d.indexOf(";") : d.length;
125
+ return d.substring(t, a);
126
+ }, { default: e } = await import("jszip"), r = new e(), i = `${this.getTranslationFor(this.getTitle, this.$route.query.locale, this.getLanguages)}.zip`, o = r.folder(this.getTranslationFor(this.getCatalog.title, this.$route.query.locale, this.getLanguages));
127
+ await this.fetchDistributionFiles(r, this.files, o, s), await this.generateAndSaveZip(r, i);
128
128
  },
129
129
  // handle navigation to extern website (cancel bulk download and hide modal)
130
130
  beforeWindowUnload(s) {
131
131
  this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled && (s.preventDefault(), s.returnValue = "");
132
+ },
133
+ openRessourceAccessPopup() {
134
+ this.openModal(this.trackAndDownloadAllDistributions, !0);
135
+ },
136
+ onClose(s) {
137
+ console.log("CLOSING");
132
138
  }
133
139
  },
134
140
  created() {
135
141
  window.addEventListener("beforeunload", this.beforeWindowUnload);
136
142
  },
143
+ // mounted() {
144
+ // setTimeout(() => {
145
+ // const modal = document.getElementById('externalAccess');
146
+ // modal.addEventListener('click', function() {
147
+ // console.log("CLOSING");
148
+ // });
149
+ // })
150
+ // },
137
151
  beforeUnmount() {
138
152
  window.removeEventListener("beforeunload", this.beforeWindowUnload);
139
153
  },
140
154
  setup() {
141
- const s = S();
142
- C(() => {
143
- s.beforeEach((t, l, a) => {
144
- this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled ? window.confirm(this.$t("message.datasetDetails.datasets.leavePageWindow.text")) ? (this.hideDownloadAllModal(), this.cancelDownloadAll(this.cancelDownloadAllAxiosRequestSource), a()) : a(!1) : (this.hideDownloadAllModal(), a());
155
+ const s = U();
156
+ _(() => {
157
+ s.beforeEach((e, r, i) => {
158
+ this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled ? window.confirm(this.$t("message.datasetDetails.datasets.leavePageWindow.text")) ? (this.hideDownloadAllModal(), this.cancelDownloadAll(this.cancelDownloadAllAxiosRequestSource), i()) : i(!1) : (this.hideDownloadAllModal(), i());
145
159
  })();
146
160
  });
147
161
  }
148
162
  }, G = {
149
163
  key: 0,
150
164
  class: "dsd-download-all-distributions-button"
151
- }, N = {
165
+ }, P = {
152
166
  class: "modal fade",
167
+ "data-backdrop": "static",
168
+ "data-keyboard": "false",
153
169
  id: "downloadAllModal",
170
+ ref: "downloadAllModal",
154
171
  tabindex: "-1",
155
172
  role: "dialog",
156
173
  "aria-labelledby": "download progress",
157
174
  "aria-hidden": "true"
158
- }, P = {
175
+ }, N = {
159
176
  class: "modal-dialog",
160
177
  role: "document"
161
178
  }, q = { class: "modal-content" }, j = { class: "modal-header" }, z = { class: "modal-title" }, V = { class: "modal-body" }, W = { class: "progress" }, H = ["aria-valuenow"], X = { class: "d-flex justify-content-between align-items-center" }, B = ["title"], J = { class: "d-flex justify-content-between align-items-center" }, K = { key: 0 }, Q = { key: 1 }, Y = {
162
179
  key: 0,
163
180
  class: "spinner-grow text-primary",
164
181
  role: "status"
165
- }, tt = {
182
+ }, ee = {
166
183
  key: 1,
167
184
  class: "material-icons check-icon"
168
- }, et = { class: "modal-footer" }, st = {
169
- type: "button",
170
- class: "btn btn-secondary",
171
- "data-dismiss": "modal"
172
- }, ot = {
185
+ }, te = { class: "modal-footer" }, se = {
173
186
  key: 2,
174
187
  type: "button",
175
188
  class: "btn btn-success",
176
189
  "data-dismiss": "modal"
177
190
  };
178
- function it(s, t, l, a, o, d) {
179
- const e = _("pv-button");
180
- return s.getDistributions.length > 1 && s.getCatalog.is_part_of !== "erpd" ? (w(), h("div", G, [
181
- o.isLoadingAllDistributionFiles ? (w(), y(e, {
191
+ function oe(s, e, r, i, o, d) {
192
+ const t = I("pv-button");
193
+ return s.getDistributions.length > 1 && s.getCatalog.is_part_of !== "erpd" ? (m(), h("div", G, [
194
+ o.isLoadingAllDistributionFiles ? (m(), y(t, {
182
195
  key: 0,
183
- small: l.small,
196
+ small: r.small,
184
197
  rounded: !0,
185
- primary: l.primary,
198
+ primary: r.primary,
186
199
  download: !0,
187
- class: "download-all-btn",
188
- "data-toggle": "modal",
189
- "data-target": "#downloadAllModal"
200
+ class: "download-all-btn"
190
201
  }, {
191
- default: F(() => t[2] || (t[2] = [
192
- i("div", { class: "loading-spinner" }, null, -1)
193
- ])),
202
+ default: F(() => [
203
+ e[2] || (e[2] = l("div", { class: "loading-spinner" }, null, -1)),
204
+ w(" " + u(s.$t("message.datasetDetails.datasets.downloadAll")), 1)
205
+ ]),
194
206
  _: 1
195
- }, 8, ["small", "primary"])) : (w(), y(e, {
207
+ }, 8, ["small", "primary"])) : (m(), y(t, {
196
208
  key: 1,
197
209
  class: "download-all-btn",
198
- small: l.small,
210
+ small: r.small,
199
211
  rounded: !0,
200
- primary: l.primary,
212
+ primary: r.primary,
201
213
  download: !0,
202
- action: () => l.openModal(d.trackAndDownloadAllDistributions, !0)
214
+ action: d.openRessourceAccessPopup
203
215
  }, {
204
216
  default: F(() => [
205
- m(u(s.$t("message.datasetDetails.datasets.downloadAll")), 1)
217
+ w(u(s.$t("message.datasetDetails.datasets.downloadAll")), 1)
206
218
  ]),
207
219
  _: 1
208
220
  }, 8, ["small", "primary", "action"])),
209
- t[14] || (t[14] = m()),
210
- i("div", N, [
211
- i("div", P, [
212
- i("div", q, [
213
- i("div", j, [
214
- i("h3", z, u(s.$t("message.datasetDetails.datasets.modal.downloadProgress")), 1),
215
- t[3] || (t[3] = m()),
216
- t[4] || (t[4] = i("button", {
217
- type: "button",
218
- class: "close",
219
- "data-dismiss": "modal",
220
- "aria-label": "Close"
221
- }, [
222
- i("span", { "aria-hidden": "true" }, "×")
223
- ], -1))
221
+ e[12] || (e[12] = w()),
222
+ l("div", P, [
223
+ l("div", N, [
224
+ l("div", q, [
225
+ l("div", j, [
226
+ l("h3", z, u(s.$t("message.datasetDetails.datasets.modal.downloadProgress")), 1)
224
227
  ]),
225
- t[12] || (t[12] = m()),
226
- i("div", V, [
227
- i("div", W, [
228
- i("div", {
228
+ e[10] || (e[10] = w()),
229
+ l("div", V, [
230
+ l("div", W, [
231
+ l("div", {
229
232
  class: "progress-bar",
230
233
  role: "progressbar",
231
- style: I({ width: `${o.downloadProgress}%` }),
234
+ style: S({ width: `${o.downloadProgress}%` }),
232
235
  "aria-valuenow": o.downloadProgress,
233
236
  "aria-valuemin": "0",
234
237
  "aria-valuemax": "100"
235
238
  }, null, 12, H)
236
239
  ]),
237
- t[8] || (t[8] = m()),
238
- i("div", null, u(s.$t("message.datasetDetails.datasets.modal.downloadingFiles")) + " " + u(o.downloadedFilesCounter.toLocaleString("fi")) + "/" + u(s.getDistributions.length.toLocaleString("fi")), 1),
239
- t[9] || (t[9] = m()),
240
- i("div", X, [
241
- i("div", null, u(s.$t("message.datasetDetails.datasets.modal.notDownloaded")) + " " + u(o.failedDownloads.toLocaleString("fi")), 1),
242
- t[5] || (t[5] = m()),
243
- i("i", {
240
+ e[6] || (e[6] = w()),
241
+ l("div", null, u(s.$t("message.datasetDetails.datasets.modal.downloadingFiles")) + " " + u(o.downloadedFilesCounter.toLocaleString("fi")) + "/" + u(s.getDistributions.length.toLocaleString("fi")), 1),
242
+ e[7] || (e[7] = w()),
243
+ l("div", X, [
244
+ l("div", null, u(s.$t("message.datasetDetails.datasets.modal.notDownloaded")) + " " + u(o.failedDownloads.toLocaleString("fi")), 1),
245
+ e[3] || (e[3] = w()),
246
+ l("i", {
244
247
  class: "material-icons help-icon",
245
248
  "data-toggle": "tooltip",
246
249
  "data-placement": "bottom",
247
250
  title: s.$t("message.datasetDetails.datasets.modal.notDownloadedTooltip")
248
251
  }, "help", 8, B)
249
252
  ]),
250
- t[10] || (t[10] = m()),
251
- i("div", J, [
252
- i("div", null, [
253
- m(u(s.$t("message.datasetDetails.datasets.modal.zipNumberOfFiles", { number: o.numberOfFilesToZip.toLocaleString("fi") })) + " ", 1),
254
- o.isLoadingAllDistributionFiles && o.numberOfFilesToZip > 0 ? (w(), h("span", K, u(s.$t("message.datasetDetails.datasets.modal.coupleOfMinutes")), 1)) : o.isLoadingAllDistributionFiles ? (w(), h("span", Q, u(s.$t("message.datasetDetails.datasets.modal.waitingForDownload")), 1)) : f("", !0)
253
+ e[8] || (e[8] = w()),
254
+ l("div", J, [
255
+ l("div", null, [
256
+ w(u(s.$t("message.datasetDetails.datasets.modal.zipNumberOfFiles", { number: o.numberOfFilesToZip.toLocaleString("fi") })) + " ", 1),
257
+ o.isLoadingAllDistributionFiles && o.numberOfFilesToZip > 0 ? (m(), h("span", K, u(s.$t("message.datasetDetails.datasets.modal.coupleOfMinutes")), 1)) : o.isLoadingAllDistributionFiles ? (m(), h("span", Q, u(s.$t("message.datasetDetails.datasets.modal.waitingForDownload")), 1)) : f("", !0)
255
258
  ]),
256
- t[7] || (t[7] = m()),
257
- o.isGeneratingZip ? (w(), h("div", Y, t[6] || (t[6] = [
258
- i("span", { class: "sr-only" }, "Loading...", -1)
259
- ]))) : o.isGeneratingZipDone ? (w(), h("i", tt, "check_circle")) : f("", !0)
259
+ e[5] || (e[5] = w()),
260
+ o.isGeneratingZip ? (m(), h("div", Y, e[4] || (e[4] = [
261
+ l("span", { class: "sr-only" }, "Loading...", -1)
262
+ ]))) : o.isGeneratingZipDone ? (m(), h("i", ee, "check_circle")) : f("", !0)
260
263
  ])
261
264
  ]),
262
- t[13] || (t[13] = m()),
263
- i("div", et, [
264
- i("button", st, u(s.$t("message.datasetDetails.datasets.modal.close")), 1),
265
- t[11] || (t[11] = m()),
266
- !o.downloadAllSuccess && !o.downloadAllError ? (w(), h("button", {
265
+ e[11] || (e[11] = w()),
266
+ l("div", te, [
267
+ !o.downloadAllSuccess && !o.downloadAllError ? (m(), h("button", {
267
268
  key: 0,
268
269
  type: "button",
269
270
  class: "btn btn-danger",
270
271
  "data-dismiss": "modal",
271
- onClick: t[0] || (t[0] = (n) => d.cancelDownloadAll(o.cancelDownloadAllAxiosRequestSource))
272
- }, u(s.$t("message.datasetDetails.datasets.modal.cancel")), 1)) : o.downloadAllError ? (w(), h("button", {
272
+ onClick: e[0] || (e[0] = (a) => d.cancelDownloadAll(o.cancelDownloadAllAxiosRequestSource))
273
+ }, u(s.$t("message.datasetDetails.datasets.modal.cancel")), 1)) : f("", !0),
274
+ e[9] || (e[9] = w()),
275
+ o.downloadAllError ? (m(), h("button", {
273
276
  key: 1,
274
277
  type: "button",
275
278
  class: "btn btn-danger",
276
- onClick: t[1] || (t[1] = (n) => d.trackAndDownloadAllDistributions())
277
- }, u(s.$t("message.datasetDetails.datasets.modal.error")), 1)) : o.downloadAllSuccess ? (w(), h("button", ot, u(s.$t("message.datasetDetails.datasets.modal.okay")), 1)) : f("", !0)
279
+ onClick: e[1] || (e[1] = (a) => d.trackAndDownloadAllDistributions())
280
+ }, u(s.$t("message.datasetDetails.datasets.modal.error")), 1)) : o.downloadAllSuccess ? (m(), h("button", se, u(s.$t("message.datasetDetails.datasets.modal.okay")), 1)) : f("", !0)
278
281
  ])
279
282
  ])
280
283
  ])
281
- ])
284
+ ], 512)
282
285
  ])) : f("", !0);
283
286
  }
284
- const gt = /* @__PURE__ */ x($, [["render", it]]);
287
+ const me = /* @__PURE__ */ x($, [["render", oe]]);
285
288
  export {
286
- gt as default
289
+ me as default
287
290
  };
288
291
  //# sourceMappingURL=DownloadAllDistributions.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DownloadAllDistributions.vue.mjs","sources":["../../../lib/datasetDetails/distributions/DownloadAllDistributions.vue"],"sourcesContent":["<template>\n <div v-if=\"getDistributions.length > 1 && getCatalog.is_part_of !== 'erpd'\" class=\"dsd-download-all-distributions-button\">\n <pv-button v-if=\"isLoadingAllDistributionFiles\" :small=\"small\" :rounded=\"true\" :primary=\"primary\" :download=\"true\"\n class=\"download-all-btn\"\n data-toggle=\"modal\" data-target=\"#downloadAllModal\"\n > \n <div class=\"loading-spinner\"></div>\n </pv-button>\n <pv-button v-else class=\"download-all-btn\" :small=\"small\" :rounded=\"true\" :primary=\"primary\" :download=\"true\" :action=\"() => openModal(trackAndDownloadAllDistributions, true)\">\n {{ $t('message.datasetDetails.datasets.downloadAll') }}\n </pv-button>\n <div class=\"modal fade\" id=\"downloadAllModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"download progress\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h3 class=\"modal-title\">{{ $t('message.datasetDetails.datasets.modal.downloadProgress') }}</h3>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"progress\">\n <div class=\"progress-bar\" role=\"progressbar\" :style=\"{width: `${downloadProgress}%`}\" :aria-valuenow=\"downloadProgress\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n </div>\n <div>\n {{ $t('message.datasetDetails.datasets.modal.downloadingFiles') }} {{ downloadedFilesCounter.toLocaleString('fi') }}/{{getDistributions.length.toLocaleString('fi')}}\n </div>\n <div class=\"d-flex justify-content-between align-items-center\">\n <div>{{ $t('message.datasetDetails.datasets.modal.notDownloaded') }} {{ failedDownloads.toLocaleString('fi') }}</div>\n <i class=\"material-icons help-icon\" data-toggle=\"tooltip\" data-placement=\"bottom\" :title=\"$t('message.datasetDetails.datasets.modal.notDownloadedTooltip')\">help</i>\n </div>\n <div class=\"d-flex justify-content-between align-items-center\">\n <div>{{ $t('message.datasetDetails.datasets.modal.zipNumberOfFiles', { number: numberOfFilesToZip.toLocaleString('fi') }) }}\n <span v-if=\"isLoadingAllDistributionFiles && numberOfFilesToZip > 0\">\n {{ $t('message.datasetDetails.datasets.modal.coupleOfMinutes') }}\n </span> <span v-else-if=\"isLoadingAllDistributionFiles\">\n {{ $t('message.datasetDetails.datasets.modal.waitingForDownload')}}\n </span>\n </div>\n <div v-if=\"isGeneratingZip\" class=\"spinner-grow text-primary\" role=\"status\">\n <span class=\"sr-only\">Loading...</span>\n </div>\n <i v-else-if=\"isGeneratingZipDone\" class=\"material-icons check-icon\">check_circle</i>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">{{ $t('message.datasetDetails.datasets.modal.close') }}</button>\n <button v-if=\"!downloadAllSuccess && !downloadAllError\" type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\" @click=\"cancelDownloadAll(cancelDownloadAllAxiosRequestSource)\">\n {{ $t('message.datasetDetails.datasets.modal.cancel') }}\n </button>\n <button v-else-if=\"downloadAllError\" type=\"button\" class=\"btn btn-danger\" @click=\"trackAndDownloadAllDistributions()\">{{ $t('message.datasetDetails.datasets.modal.error') }}</button>\n <button v-else-if=\"downloadAllSuccess\" type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">{{ $t('message.datasetDetails.datasets.modal.okay') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { mapGetters } from \"vuex\";\nimport { onUnmounted } from 'vue';\nimport { useRouter } from 'vue-router';\n\nimport {has, isNil} from \"lodash\";\nimport axios from \"axios\";\nimport { saveAs } from 'file-saver';\nimport $ from \"jquery\";\nimport { getTranslationFor } from \"../../utils/helpers\";\n\n\nexport default {\n name: \"DownloadAllDistributions\",\n props: [\n 'getDistributionDescription',\n 'getDistributionTitle',\n 'openModal',\n 'isUrlInvalid',\n 'showDownloadUrls',\n 'primary',\n 'small'\n ],\n computed: {\n ...mapGetters('datasetDetails', [\n 'getDistributions',\n 'getTitle',\n 'getCatalog',\n 'getLanguages'\n ]),\n files() {\n const cutFormatEnding = string => (string.lastIndexOf('.') !== -1 ? string.substring(0, string.lastIndexOf('.')) : string);\n const getFormat = (distribution) => {\n if (has(distribution, 'format.id') && !isNil(distribution.format.id)) {\n const type = distribution.format.id;\n return type.lastIndexOf('.') === -1 ? type.toLowerCase() : type.substring(type.lastIndexOf('.') + 1, type.length).toLowerCase();\n }\n return '';\n };\n const getFileName = (distribution, i) =>\n `${cutFormatEnding(this.getDistributionTitle(distribution)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH)\n .replace(/\\//g, ' ').trim()}-${i}`\n || `${cutFormatEnding(this.getDistributionDescription(distribution)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH)\n .replace(/\\//g, ' ').trim()}-${i}`;\n const getUrls = distribution => (this.showDownloadUrls(distribution) ?\n { accessUrl: `${distribution.accessUrl[0]}`, downloadUrl: `${distribution.downloadUrls[0]}` }\n : { accessUrl: `${distribution.accessUrl[0]}` });\n const getFileNameForCSV = distribution => this.getDistributionTitle(distribution).replace(/,/g, '')\n || this.getDistributionDescription(distribution).replace(/,/g, '');\n const files = this.getDistributions\n .map((distribution, i) => ({\n title: getFileName(distribution, i + 1), ...getUrls(distribution), format: getFormat(distribution), csvReportTitle: getFileNameForCSV(distribution),\n }));\n return files\n }\n },\n data() {\n return {\n downloadedFilesCounter: 0,\n numberOfFilesToZip: 0,\n downloadProgress: 0,\n failedDownloads: 0,\n isGeneratingZip: false,\n isGeneratingZipDone: false,\n isLoadingAllDistributionFiles: false,\n cancelDownloadAllAxiosRequestSource: null,\n isDownloadAllDistributionsCanceled: false,\n downloadAllSuccess: false,\n downloadAllError: false,\n bulkDownload: {\n MAX_FILE_TITLE_LENGTH: this.$env.content.datasetDetails.bulkDownload.MAX_FILE_TITLE_LENGTH,\n TIMEOUT_MS: this.$env.content.datasetDetails.bulkDownload.TIMEOUT_MS,\n }\n }\n },\n methods: {\n getTranslationFor,\n async fetchDistributionFiles(zip, files, folder, getContentTypeFormat) {\n const csvReportArray = [];\n let csvReport = 'filename,status, issue_cause downloadURL, issue_cause accessURL\\n';\n let csvDownloadURLIssue;\n const problematicFormats = ['wms', 'wfs'];\n\n const CancelToken = axios.CancelToken;\n this.cancelDownloadAllAxiosRequestSource = CancelToken.source();\n const axiosInstance = this.$bulkDownloadAxiosInstance;\n const requestSettings = { responseType: 'blob', cancelToken: this.cancelDownloadAllAxiosRequestSource.token, timeout: this.bulkDownload.TIMEOUT_MS };\n\n const promises = files.map(async (file) => {\n const problematicFormat = problematicFormats.find(format => format === file.format);\n if (!problematicFormat) {\n let isRejected = true;\n let responseData;\n let fileFormat = file.format;\n\n // try to download from download url\n if (has(file, 'downloadUrl')) {\n responseData = await axiosInstance.get(file.downloadUrl, requestSettings).then((responseDownloadUrl) => {\n if (responseDownloadUrl.status === 200) {\n isRejected = false;\n if (!file.format.length > 0) fileFormat = getContentTypeFormat(responseDownloadUrl.headers['content-type']);\n csvReportArray.push([file.csvReportTitle, 'delivered']);\n return responseDownloadUrl.data;\n }\n return Promise.reject(new Error(responseDownloadUrl.statusText));\n }).catch((error) => {\n isRejected = true;\n csvDownloadURLIssue = error;\n });\n } else csvDownloadURLIssue = 'no download url available';\n if (this.isUrlInvalid(file.downloadUrl)) {\n csvReportArray.push([file.csvReportTitle, 'issue', 'url is invalid']);\n }\n // try to download from access url\n if (isRejected) {\n responseData = await axiosInstance.get(file.accessUrl, requestSettings).then((responseAccessUrl) => {\n if (responseAccessUrl.status === 200) {\n isRejected = false;\n if (file.format.length > 0) fileFormat = getContentTypeFormat(responseAccessUrl.headers['content-type']);\n csvReportArray.push([file.csvReportTitle, 'delivered', csvDownloadURLIssue]);\n return responseAccessUrl.data;\n }\n return Promise.reject(new Error(responseAccessUrl.statusText));\n }).catch((error) => {\n isRejected = true;\n csvReportArray.push([file.csvReportTitle, 'issue', csvDownloadURLIssue, error]);\n });\n }\n if (!isRejected) folder.file(`${file.title}.${fileFormat}`, responseData, { binary: true });\n if (!this.isDownloadAllDistributionsCanceled) {\n this.downloadedFilesCounter += 1;\n this.downloadProgress = Math.floor(100 * this.downloadedFilesCounter / this.getDistributions.length);\n if (isRejected) this.failedDownloads += 1;\n } else {\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.failedDownloads = 0;\n }\n } else csvReportArray.push([file.csvReportTitle, 'issue', `We can't download ${problematicFormat} files using the download all button. Please try to download this file using the download button next to the file name.`]);\n });\n\n await Promise.all(promises);\n csvReportArray.forEach((row) => {\n csvReport += row.join(',');\n csvReport += '\\n';\n });\n zip.file('file_report.csv', csvReport, { binary: true });\n },\n hideDownloadAllModal() {\n $('#downloadAllModal').modal('hide');\n },\n generateAndSaveZip(zip, zipName) {\n if (!this.isDownloadAllDistributionsCanceled) {\n this.numberOfFilesToZip = Object.keys(zip.files).length;\n this.isGeneratingZip = true;\n }\n\n class UserInterruptException {\n constructor(message) {\n this.message = message;\n this.name = 'UserInterruptException';\n }\n }\n\n zip.generateAsync({ type: 'blob', compression: 'DEFLATE' }, () => {\n if (this.isDownloadAllDistributionsCanceled) throw new UserInterruptException('user canceled generate zip operation');\n })\n .then((blob) => {\n this.isGeneratingZip = false;\n this.isGeneratingZipDone = true;\n this.isLoadingAllDistributionFiles = false;\n this.downloadAllSuccess = true;\n saveAs(blob, zipName);\n })\n .catch((e) => {\n this.isGeneratingZip = false;\n this.isDownloadAllDistributionsCanceled = false;\n this.isLoadingAllDistributionFiles = false;\n this.downloadAllError = true;\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.numberOfFilesToZip = 0;\n console.warn(e); // eslint-disable-line\n });\n\n // works with chrome => to make it compatible to more browsers look here https://jimmywarting.github.io/StreamSaver.js/examples/saving-multiple-files.html open developer tools and find saving-multiple-files.html\n // install stream saver and import it + script src=\"https://cdn.jsdelivr.net/npm/web-streams-polyfill@2.0.2/dist/ponyfill.min.js\"\n // if we don't want to use his service worker we can configure something (I think we have to change the mitm url) => read the api https://jimmywarting.github.io/StreamSaver.js\n // I think IE will never work with this solution\n /* const writeStream = streamSaver.createWriteStream(zipName).getWriter();\n zip.generateInternalStream({ type: 'uint8array', streamFiles: true })\n .on('data', data => writeStream.write(data))\n .on('error', err => console.error(err))\n .on('end', () => writeStream.close())\n .resume(); */\n },\n cancelDownloadAll(source) {\n // stops axios operations\n source.cancel('user canceled axios operation');\n // stops zip operation\n this.isDownloadAllDistributionsCanceled = true;\n },\n async trackAndDownloadAllDistributions() {\n if (this.$piwik && this.$piwik.trackDownload) {\n this.$piwik.trackDownload(\n window.location.href,\n {\n files: JSON.stringify(this.files),\n downloadAll: 'true',\n format: 'all',\n }\n );\n }\n return await this.downloadAllDistributions();\n },\n async downloadAllDistributions() {\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.failedDownloads = 0;\n this.numberOfFilesToZip = 0;\n this.isGeneratingZip = false;\n this.isGeneratingZipDone = false;\n this.isLoadingAllDistributionFiles = true;\n this.isDownloadAllDistributionsCanceled = false;\n this.downloadAllSuccess = false;\n this.downloadAllError = false;\n const getContentTypeFormat = (contentType) => {\n const startIndex = contentType.lastIndexOf('/') + 1;\n const endIndex = contentType.indexOf(';') !== -1 ? contentType.indexOf(';') : contentType.length;\n return contentType.substring(startIndex, endIndex);\n };\n\n const {default: JSZip} = await import('jszip');\n const zip = new JSZip();\n const zipName = `${this.getTranslationFor(this.getTitle, this.$route.query.locale, this.getLanguages)}.zip`;\n const folder = zip.folder(this.getTranslationFor(this.getCatalog.title, this.$route.query.locale, this.getLanguages));\n await this.fetchDistributionFiles(zip, this.files, folder, getContentTypeFormat);\n await this.generateAndSaveZip(zip, zipName);\n },\n // handle navigation to extern website (cancel bulk download and hide modal)\n beforeWindowUnload(e) {\n if (this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled) {\n e.preventDefault();\n // Chrome requires returnValue to be set\n e.returnValue = ''; // eslint-disable-line\n }\n }\n },\n created() {\n window.addEventListener('beforeunload', this.beforeWindowUnload);\n },\n beforeUnmount() {\n window.removeEventListener('beforeunload', this.beforeWindowUnload);\n },\n setup() {\n const router = useRouter();\n \n onUnmounted(() => {\n router.beforeEach((to, from, next) => {\n if (this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled) {\n const answer = window.confirm(this.$t('message.datasetDetails.datasets.leavePageWindow.text')); // eslint-disable-line\n if (answer) {\n // if modal is open we have to hide it when user tries to navigate back\n this.hideDownloadAllModal();\n this.cancelDownloadAll(this.cancelDownloadAllAxiosRequestSource);\n next();\n } else {\n next(false);\n }\n } else {\n this.hideDownloadAllModal();\n next();\n }\n })();\n })\n },\n}\n</script>\n\n<style scoped>\n\n</style>\n"],"names":["_sfc_main","mapGetters","cutFormatEnding","string","getFormat","distribution","has","isNil","type","getFileName","i","getUrls","getFileNameForCSV","getTranslationFor","zip","files","folder","getContentTypeFormat","csvReportArray","csvReport","csvDownloadURLIssue","problematicFormats","CancelToken","axios","axiosInstance","requestSettings","promises","file","problematicFormat","format","isRejected","responseData","fileFormat","responseDownloadUrl","error","responseAccessUrl","row","$","zipName","UserInterruptException","message","blob","saveAs","e","source","contentType","startIndex","endIndex","JSZip","router","useRouter","onUnmounted","to","from","next","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_17","_ctx","_openBlock","_createElementBlock","_hoisted_1","$data","_createBlock","_component_pv_button","$props","_withCtx","_cache","_createElementVNode","$options","_createTextVNode","_toDisplayString","_hoisted_2","_hoisted_3","_normalizeStyle","_hoisted_13","_hoisted_14","_createCommentVNode","_hoisted_15","_hoisted_16","_hoisted_18","$event","_hoisted_19"],"mappings":";;;;;;;;;AAuEA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACD,UAAU;AAAA,IACR,GAAGC,EAAW,kBAAkB;AAAA,MAC9B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6CAAA,CAAA,GAAA,CAAA,KACxGI,EAAkB,2BAArCF,EAAiK,UAAjKsB,IAAiKX,EAA5Db,EAAE,GAAA,4CAAA,CAAA,GAAA,CAAA,KAnDnHmB,EAAA,IAAA,EAAA;AAAA;;;;QAAAA,EAAA,IAAA,EAAA;;;"}
1
+ {"version":3,"file":"DownloadAllDistributions.vue.mjs","sources":["../../../lib/datasetDetails/distributions/DownloadAllDistributions.vue"],"sourcesContent":["<template>\n <div v-if=\"getDistributions.length > 1 && getCatalog.is_part_of !== 'erpd'\" class=\"dsd-download-all-distributions-button\">\n <pv-button v-if=\"isLoadingAllDistributionFiles\" :small=\"small\" :rounded=\"true\" :primary=\"primary\" :download=\"true\"\n class=\"download-all-btn\"\n >\n <div class=\"loading-spinner\"></div>\n {{ $t('message.datasetDetails.datasets.downloadAll') }}\n </pv-button>\n <pv-button v-else class=\"download-all-btn\" :small=\"small\" :rounded=\"true\" :primary=\"primary\" :download=\"true\" :action=\"openRessourceAccessPopup\">\n {{ $t('message.datasetDetails.datasets.downloadAll') }}\n </pv-button>\n <div class=\"modal fade\" data-backdrop=\"static\" data-keyboard=\"false\" id=\"downloadAllModal\" ref=\"downloadAllModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"download progress\" aria-hidden=\"true\">\n <div class=\"modal-dialog\" role=\"document\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h3 class=\"modal-title\">{{ $t('message.datasetDetails.datasets.modal.downloadProgress') }}</h3>\n<!-- <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">-->\n<!-- <span aria-hidden=\"true\">&times;</span>-->\n<!-- </button>-->\n </div>\n <div class=\"modal-body\">\n <div class=\"progress\">\n <div class=\"progress-bar\" role=\"progressbar\" :style=\"{width: `${downloadProgress}%`}\" :aria-valuenow=\"downloadProgress\" aria-valuemin=\"0\" aria-valuemax=\"100\"></div>\n </div>\n <div>\n {{ $t('message.datasetDetails.datasets.modal.downloadingFiles') }} {{ downloadedFilesCounter.toLocaleString('fi') }}/{{getDistributions.length.toLocaleString('fi')}}\n </div>\n <div class=\"d-flex justify-content-between align-items-center\">\n <div>{{ $t('message.datasetDetails.datasets.modal.notDownloaded') }} {{ failedDownloads.toLocaleString('fi') }}</div>\n <i class=\"material-icons help-icon\" data-toggle=\"tooltip\" data-placement=\"bottom\" :title=\"$t('message.datasetDetails.datasets.modal.notDownloadedTooltip')\">help</i>\n </div>\n <div class=\"d-flex justify-content-between align-items-center\">\n <div>{{ $t('message.datasetDetails.datasets.modal.zipNumberOfFiles', { number: numberOfFilesToZip.toLocaleString('fi') }) }}\n <span v-if=\"isLoadingAllDistributionFiles && numberOfFilesToZip > 0\">\n {{ $t('message.datasetDetails.datasets.modal.coupleOfMinutes') }}\n </span> <span v-else-if=\"isLoadingAllDistributionFiles\">\n {{ $t('message.datasetDetails.datasets.modal.waitingForDownload')}}\n </span>\n </div>\n <div v-if=\"isGeneratingZip\" class=\"spinner-grow text-primary\" role=\"status\">\n <span class=\"sr-only\">Loading...</span>\n </div>\n <i v-else-if=\"isGeneratingZipDone\" class=\"material-icons check-icon\">check_circle</i>\n </div>\n </div>\n <div class=\"modal-footer\">\n<!-- <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">{{ $t('message.datasetDetails.datasets.modal.close') }}</button>-->\n <button v-if=\"!downloadAllSuccess && !downloadAllError\" type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\" @click=\"cancelDownloadAll(cancelDownloadAllAxiosRequestSource)\">\n {{ $t('message.datasetDetails.datasets.modal.cancel') }}\n </button>\n <button v-if=\"downloadAllError\" type=\"button\" class=\"btn btn-danger\" @click=\"trackAndDownloadAllDistributions()\">{{ $t('message.datasetDetails.datasets.modal.error') }}</button>\n <button v-else-if=\"downloadAllSuccess\" type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">{{ $t('message.datasetDetails.datasets.modal.okay') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { mapGetters } from \"vuex\";\nimport { onUnmounted } from 'vue';\nimport { useRouter } from 'vue-router';\n\nimport {has, isNil} from \"lodash\";\nimport axios from \"axios\";\nimport { saveAs } from 'file-saver';\nimport $ from \"jquery\";\nimport { getTranslationFor } from \"../../utils/helpers\";\n\n\nexport default {\n name: \"DownloadAllDistributions\",\n props: [\n 'getDistributionDescription',\n 'getDistributionTitle',\n 'openModal',\n 'isUrlInvalid',\n 'showDownloadUrls',\n 'primary',\n 'small'\n ],\n computed: {\n ...mapGetters('datasetDetails', [\n 'getDistributions',\n 'getTitle',\n 'getCatalog',\n 'getLanguages'\n ]),\n files() {\n const cutFormatEnding = string => (string.lastIndexOf('.') !== -1 ? string.substring(0, string.lastIndexOf('.')) : string);\n const getFormat = (distribution) => {\n if (has(distribution, 'format.id') && !isNil(distribution.format.id)) {\n const type = distribution.format.id;\n return type.lastIndexOf('.') === -1 ? type.toLowerCase() : type.substring(type.lastIndexOf('.') + 1, type.length).toLowerCase();\n }\n return '';\n };\n const getFileName = (distribution, i) =>\n `${cutFormatEnding(this.getDistributionTitle(distribution)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH)\n .replace(/\\//g, ' ').trim()}-${i}`\n || `${cutFormatEnding(this.getDistributionDescription(distribution)).substring(0, this.bulkDownload.MAX_FILE_TITLE_LENGTH)\n .replace(/\\//g, ' ').trim()}-${i}`;\n const getUrls = distribution => (this.showDownloadUrls(distribution) ?\n { accessUrl: `${distribution.accessUrl[0]}`, downloadUrl: `${distribution.downloadUrls[0]}` }\n : { accessUrl: `${distribution.accessUrl[0]}` });\n const getFileNameForCSV = distribution => this.getDistributionTitle(distribution).replace(/,/g, '')\n || this.getDistributionDescription(distribution).replace(/,/g, '');\n const files = this.getDistributions\n .map((distribution, i) => ({\n title: getFileName(distribution, i + 1), ...getUrls(distribution), format: getFormat(distribution), csvReportTitle: getFileNameForCSV(distribution),\n }));\n return files\n }\n },\n data() {\n return {\n downloadedFilesCounter: 0,\n numberOfFilesToZip: 0,\n downloadProgress: 0,\n failedDownloads: 0,\n isGeneratingZip: false,\n isGeneratingZipDone: false,\n isLoadingAllDistributionFiles: false,\n cancelDownloadAllAxiosRequestSource: null,\n isDownloadAllDistributionsCanceled: false,\n downloadAllSuccess: false,\n downloadAllError: false,\n bulkDownload: {\n MAX_FILE_TITLE_LENGTH: this.$env.content.datasetDetails.bulkDownload.MAX_FILE_TITLE_LENGTH,\n TIMEOUT_MS: this.$env.content.datasetDetails.bulkDownload.TIMEOUT_MS,\n }\n }\n },\n methods: {\n getTranslationFor,\n async fetchDistributionFiles(zip, files, folder, getContentTypeFormat) {\n const csvReportArray = [];\n let csvReport = 'filename,status, issue_cause downloadURL, issue_cause accessURL\\n';\n let csvDownloadURLIssue;\n const problematicFormats = ['wms', 'wfs'];\n\n const CancelToken = axios.CancelToken;\n this.cancelDownloadAllAxiosRequestSource = CancelToken.source();\n const axiosInstance = this.$bulkDownloadAxiosInstance;\n const requestSettings = { responseType: 'blob', cancelToken: this.cancelDownloadAllAxiosRequestSource.token, timeout: this.bulkDownload.TIMEOUT_MS };\n\n const promises = files.map(async (file) => {\n const problematicFormat = problematicFormats.find(format => format === file.format);\n if (!problematicFormat) {\n let isRejected = true;\n let responseData;\n let fileFormat = file.format;\n\n // try to download from download url\n if (has(file, 'downloadUrl')) {\n responseData = await axiosInstance.get(file.downloadUrl, requestSettings).then((responseDownloadUrl) => {\n if (responseDownloadUrl.status === 200) {\n isRejected = false;\n if (!file.format.length > 0) fileFormat = getContentTypeFormat(responseDownloadUrl.headers['content-type']);\n csvReportArray.push([file.csvReportTitle, 'delivered']);\n return responseDownloadUrl.data;\n }\n return Promise.reject(new Error(responseDownloadUrl.statusText));\n }).catch((error) => {\n isRejected = true;\n csvDownloadURLIssue = error;\n });\n } else csvDownloadURLIssue = 'no download url available';\n if (this.isUrlInvalid(file.downloadUrl)) {\n csvReportArray.push([file.csvReportTitle, 'issue', 'url is invalid']);\n }\n // try to download from access url\n if (isRejected) {\n responseData = await axiosInstance.get(file.accessUrl, requestSettings).then((responseAccessUrl) => {\n if (responseAccessUrl.status === 200) {\n isRejected = false;\n if (file.format.length > 0) fileFormat = getContentTypeFormat(responseAccessUrl.headers['content-type']);\n csvReportArray.push([file.csvReportTitle, 'delivered', csvDownloadURLIssue]);\n return responseAccessUrl.data;\n }\n return Promise.reject(new Error(responseAccessUrl.statusText));\n }).catch((error) => {\n isRejected = true;\n csvReportArray.push([file.csvReportTitle, 'issue', csvDownloadURLIssue, error]);\n });\n }\n if (!isRejected) folder.file(`${file.title}.${fileFormat}`, responseData, { binary: true });\n if (!this.isDownloadAllDistributionsCanceled) {\n this.downloadedFilesCounter += 1;\n this.downloadProgress = Math.floor(100 * this.downloadedFilesCounter / this.getDistributions.length);\n if (isRejected) this.failedDownloads += 1;\n } else {\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.failedDownloads = 0;\n }\n } else csvReportArray.push([file.csvReportTitle, 'issue', `We can't download ${problematicFormat} files using the download all button. Please try to download this file using the download button next to the file name.`]);\n });\n\n await Promise.all(promises);\n csvReportArray.forEach((row) => {\n csvReport += row.join(',');\n csvReport += '\\n';\n });\n zip.file('file_report.csv', csvReport, { binary: true });\n },\n hideDownloadAllModal() {\n $('#downloadAllModal').modal('hide');\n },\n generateAndSaveZip(zip, zipName) {\n if (!this.isDownloadAllDistributionsCanceled) {\n this.numberOfFilesToZip = Object.keys(zip.files).length;\n this.isGeneratingZip = true;\n }\n\n class UserInterruptException {\n constructor(message) {\n this.message = message;\n this.name = 'UserInterruptException';\n }\n }\n\n zip.generateAsync({ type: 'blob', compression: 'DEFLATE' }, () => {\n if (this.isDownloadAllDistributionsCanceled) throw new UserInterruptException('user canceled generate zip operation');\n })\n .then((blob) => {\n this.isGeneratingZip = false;\n this.isGeneratingZipDone = true;\n this.isLoadingAllDistributionFiles = false;\n this.downloadAllSuccess = true;\n saveAs(blob, zipName);\n })\n .catch((e) => {\n this.isGeneratingZip = false;\n this.isDownloadAllDistributionsCanceled = false;\n this.isLoadingAllDistributionFiles = false;\n this.downloadAllError = true;\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.numberOfFilesToZip = 0;\n console.warn(e); // eslint-disable-line\n });\n\n // works with chrome => to make it compatible to more browsers look here https://jimmywarting.github.io/StreamSaver.js/examples/saving-multiple-files.html open developer tools and find saving-multiple-files.html\n // install stream saver and import it + script src=\"https://cdn.jsdelivr.net/npm/web-streams-polyfill@2.0.2/dist/ponyfill.min.js\"\n // if we don't want to use his service worker we can configure something (I think we have to change the mitm url) => read the api https://jimmywarting.github.io/StreamSaver.js\n // I think IE will never work with this solution\n /* const writeStream = streamSaver.createWriteStream(zipName).getWriter();\n zip.generateInternalStream({ type: 'uint8array', streamFiles: true })\n .on('data', data => writeStream.write(data))\n .on('error', err => console.error(err))\n .on('end', () => writeStream.close())\n .resume(); */\n },\n cancelDownloadAll(source) {\n // stops axios operations\n source.cancel('user canceled axios operation');\n // stops zip operation\n this.isDownloadAllDistributionsCanceled = true;\n },\n async trackAndDownloadAllDistributions() {\n if (this.$piwik && this.$piwik.trackDownload) {\n this.$piwik.trackDownload(\n window.location.href,\n {\n files: JSON.stringify(this.files),\n downloadAll: 'true',\n format: 'all',\n }\n );\n }\n return await this.downloadAllDistributions();\n },\n async downloadAllDistributions() {\n $('#downloadAllModal').modal('show');\n this.downloadedFilesCounter = 0;\n this.downloadProgress = 0;\n this.failedDownloads = 0;\n this.numberOfFilesToZip = 0;\n this.isGeneratingZip = false;\n this.isGeneratingZipDone = false;\n this.isLoadingAllDistributionFiles = true;\n this.isDownloadAllDistributionsCanceled = false;\n this.downloadAllSuccess = false;\n this.downloadAllError = false;\n const getContentTypeFormat = (contentType) => {\n const startIndex = contentType.lastIndexOf('/') + 1;\n const endIndex = contentType.indexOf(';') !== -1 ? contentType.indexOf(';') : contentType.length;\n return contentType.substring(startIndex, endIndex);\n };\n\n const {default: JSZip} = await import('jszip');\n const zip = new JSZip();\n const zipName = `${this.getTranslationFor(this.getTitle, this.$route.query.locale, this.getLanguages)}.zip`;\n const folder = zip.folder(this.getTranslationFor(this.getCatalog.title, this.$route.query.locale, this.getLanguages));\n await this.fetchDistributionFiles(zip, this.files, folder, getContentTypeFormat);\n await this.generateAndSaveZip(zip, zipName);\n },\n // handle navigation to extern website (cancel bulk download and hide modal)\n beforeWindowUnload(e) {\n if (this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled) {\n e.preventDefault();\n // Chrome requires returnValue to be set\n e.returnValue = ''; // eslint-disable-line\n }\n },\n openRessourceAccessPopup() {\n // const modal = this.$refs.downloadAllModal;\n // const modal = document.getElementById('externalAccess');\n // console.log(\"openRessourceAccessPopup\", modal)\n // modal.addEventListener('shown.bs.modal', function() {\n // console.log(\"CLOSING\");\n // });\n this.openModal(this.trackAndDownloadAllDistributions, true);\n },\n onClose(e) {\n console.log(\"CLOSING\");\n }\n },\n created() {\n window.addEventListener('beforeunload', this.beforeWindowUnload);\n },\n // mounted() {\n // setTimeout(() => {\n // const modal = document.getElementById('externalAccess');\n // modal.addEventListener('click', function() {\n // console.log(\"CLOSING\");\n // });\n // })\n // },\n beforeUnmount() {\n window.removeEventListener('beforeunload', this.beforeWindowUnload);\n // const modal = this.$refs.downloadAllModal.$el;\n // modal.removeEventListener('hide.bs.modal', this.onClose);\n },\n setup() {\n const router = useRouter();\n\n onUnmounted(() => {\n router.beforeEach((to, from, next) => {\n if (this.isLoadingAllDistributionFiles && !this.isDownloadAllDistributionsCanceled) {\n const answer = window.confirm(this.$t('message.datasetDetails.datasets.leavePageWindow.text')); // eslint-disable-line\n if (answer) {\n // if modal is open we have to hide it when user tries to navigate back\n this.hideDownloadAllModal();\n this.cancelDownloadAll(this.cancelDownloadAllAxiosRequestSource);\n next();\n } else {\n next(false);\n }\n } else {\n this.hideDownloadAllModal();\n next();\n }\n })();\n })\n },\n}\n</script>\n\n<style scoped>\n\n</style>\n"],"names":["_sfc_main","mapGetters","cutFormatEnding","string","getFormat","distribution","has","isNil","type","getFileName","i","getUrls","getFileNameForCSV","getTranslationFor","zip","files","folder","getContentTypeFormat","csvReportArray","csvReport","csvDownloadURLIssue","problematicFormats","CancelToken","axios","axiosInstance","requestSettings","promises","file","problematicFormat","format","isRejected","responseData","fileFormat","responseDownloadUrl","error","responseAccessUrl","row","$","zipName","UserInterruptException","message","blob","saveAs","e","source","contentType","startIndex","endIndex","JSZip","router","useRouter","onUnmounted","to","from","next","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_17","_ctx","_openBlock","_createElementBlock","_hoisted_1","$data","_createBlock","_component_pv_button","$props","_withCtx","_createElementVNode","_createTextVNode","$options","_toDisplayString","_cache","_hoisted_2","_hoisted_3","_normalizeStyle","_hoisted_13","_hoisted_14","_createCommentVNode","_hoisted_15","_hoisted_16","$event","_hoisted_18"],"mappings":";;;;;;;;;AAuEA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACD,UAAU;AAAA,IACR,GAAGC,EAAW,kBAAkB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACD,QAAQ;AACN,YAAMC,IAAkB,CAAAC,MAAWA,EAAO,YAAY,GAAG,MAAM,KAAKA,EAAO,UAAU,GAAGA,EAAO,YAAY,GAAG,CAAC,IAAIA,GAC7GC,IAAY,CAACC,MAAiB;AAClC,YAAIC,EAAID,GAAc,WAAW,KAAK,CAACE,EAAMF,EAAa,OAAO,EAAE,GAAG;AACpE,gBAAMG,IAAOH,EAAa,OAAO;AACjC,iBAAOG,EAAK,YAAY,GAAG,MAAM,KAAKA,EAAK,YAAW,IAAKA,EAAK,UAAUA,EAAK,YAAY,GAAG,IAAI,GAAGA,EAAK,MAAM,E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