@abi-software/map-utilities 1.4.0 → 1.4.1-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.4.0",
3
+ "version": "1.4.1-beta.0",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -41,7 +41,7 @@
41
41
  <strong class="sub-title">Previous submissions:</strong>
42
42
  </el-row>
43
43
  <div class="entry" v-for="(sub, index) in prevSubs" :key="index">
44
- <el-row class="dialog-text">
44
+ <el-row class="dialog-text" v-if="sub.creator">
45
45
  <strong>{{ formatTime(sub.created) }}</strong>
46
46
  {{ sub.creator.name }}
47
47
  </el-row>
@@ -65,7 +65,7 @@
65
65
  </div>
66
66
  </template>
67
67
  </template>
68
- <template v-if="authenticated">
68
+ <template v-if="authenticated || offlineAnnotate">
69
69
  <template v-if="isEditable">
70
70
  <el-row class="dialog-spacer"></el-row>
71
71
  <el-row v-if="!editing">
@@ -217,6 +217,9 @@ export default {
217
217
  updatedCopyContent: function () {
218
218
  return this.getUpdateCopyContent();
219
219
  },
220
+ offlineAnnotate: function () {
221
+ return this.annotationEntry["offline"];
222
+ },
220
223
  },
221
224
  methods: {
222
225
  processEvidences: function(sub) {
@@ -262,7 +265,15 @@ export default {
262
265
  return new Date(dateString).toLocaleDateString(undefined, options);
263
266
  },
264
267
  updatePrevSubmissions: function () {
265
- if (this.$annotator && this.authenticated) {
268
+ if (this.offlineAnnotate) {
269
+ const offlineAnnotation = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
270
+ this.prevSubs = offlineAnnotation.filter((offline) => {
271
+ return (
272
+ offline.resource === this.annotationEntry.resourceId &&
273
+ offline.item.id === this.annotationEntry.featureId
274
+ )
275
+ });
276
+ } else if (this.$annotator && this.authenticated) {
266
277
  if (
267
278
  this.annotationEntry["resourceId"] &&
268
279
  this.annotationEntry["featureId"]
@@ -342,7 +353,6 @@ export default {
342
353
  this.$annotator
343
354
  ?.addAnnotation(this.userApiKey, userAnnotation)
344
355
  .then(() => {
345
- this.$emit("annotation", userAnnotation);
346
356
  this.errorMessage = "";
347
357
  this.resetSubmission();
348
358
  this.updatePrevSubmissions();
@@ -351,6 +361,7 @@ export default {
351
361
  this.errorMessage =
352
362
  "There is a problem with the submission, please try again later";
353
363
  });
364
+ this.$emit("annotation", userAnnotation);
354
365
  }
355
366
  }
356
367
  },
@@ -396,9 +407,11 @@ export default {
396
407
  if (this.prevSubs.length) {
397
408
  let annotationContent = '<div><strong>Annotations:</strong></div>\n<br>';
398
409
  this.prevSubs.map((sub, index) => {
399
- annotationContent += `<div><strong>Created:</strong>${this.formatTime(sub.created)}</div>\n<br>`;
400
- annotationContent += `<div><strong>Creator:</strong>${sub.creator.name}</div>\n<br>`;
401
- annotationContent += `<div><strong>Email:</strong>${sub.creator.email}</div>\n<br>`;
410
+ if (sub.creator) {
411
+ annotationContent += `<div><strong>Created:</strong>${this.formatTime(sub.created)}</div>\n<br>`;
412
+ annotationContent += `<div><strong>Creator:</strong>${sub.creator.name}</div>\n<br>`;
413
+ annotationContent += `<div><strong>Email:</strong>${sub.creator.email}</div>\n<br>`;
414
+ }
402
415
  if (sub.body.evidence.length) {
403
416
  let evidenceContent = '';
404
417
  sub.body.evidence.forEach((evi, index) => {
@@ -433,10 +446,10 @@ export default {
433
446
  this.creator = userData;
434
447
  if (!userData.orcid) this.creator.orcid = "0000-0000-0000-0000";
435
448
  this.authenticated = true;
436
- this.updatePrevSubmissions();
437
449
  } else {
438
450
  this.errorMessage = "";
439
451
  }
452
+ this.updatePrevSubmissions();
440
453
  });
441
454
  },
442
455
  };