@abi-software/flatmapvuer 0.6.1-auth.6 → 0.6.1-auth.7

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/flatmapvuer",
3
- "version": "0.6.1-auth.6",
3
+ "version": "0.6.1-auth.7",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,9 +43,9 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "^2.4.4",
46
+ "@abi-software/flatmap-viewer": "^2.5.10",
47
47
  "@abi-software/sparc-annotation": "0.2.0",
48
- "@abi-software/svg-sprite": "^0.4.0-vue3-beta.0",
48
+ "@abi-software/svg-sprite": "^0.4.0-vue3.3",
49
49
  "@element-plus/icons-vue": "^2.3.1",
50
50
  "css-element-queries": "^1.2.2",
51
51
  "element-plus": "2.5.5",
package/src/App.vue CHANGED
@@ -224,9 +224,9 @@ export default {
224
224
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
225
225
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
226
226
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
227
- flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
227
+ // flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
228
228
  //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
229
- //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
229
+ flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/",
230
230
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
231
231
  ElIconSetting: shallowRef(ElIconSetting)
232
232
  }
@@ -60,52 +60,70 @@
60
60
  <template v-if="isEditable">
61
61
  <el-row class="dialog-spacer"></el-row>
62
62
  <el-row v-if="!editing">
63
- <el-icon class="standard-icon"><el-icon-edit /></el-icon>
63
+ <el-icon class="standard-icon">
64
+ <el-icon-edit @click="editing = true" />
65
+ </el-icon>
66
+ <el-icon
67
+ class="standard-icon"
68
+ v-if="isDeleted"
69
+ >
70
+ <el-icon-delete @click="submit"/>
71
+ </el-icon>
72
+ <el-icon
73
+ class="standard-icon"
74
+ v-else-if="isPositionUpdated"
75
+ >
76
+ <el-icon-finished @click="submit" />
77
+ </el-icon>
64
78
  </el-row>
65
79
  <template v-else>
66
80
  <el-row class="dialog-text">
67
81
  <strong class="sub-title">Suggest changes:</strong>
68
82
  </el-row>
69
- <el-row class="dialog-text">
70
- <strong>Evidvence:</strong>
71
- </el-row>
72
- <el-row v-for="(value, index) in evidence" :key="value">
73
- <el-col :span="20">
74
- {{ evidence[index] }}
75
- </el-col>
76
- <el-col :span="4">
77
- <el-icon class="standard-icon"><el-icon-close /></el-icon>
78
- </el-col>
79
- </el-row>
80
- <el-row>
81
- <el-input
82
- size="mini"
83
- placeholder="Enter"
84
- v-model="newEvidence"
85
- @change="evidenceEntered($event)"
86
- >
87
- <template #prepend>
88
- <el-select
89
- :teleported="false"
90
- v-model="evidencePrefix"
91
- placeholder="Select"
92
- class="select-box"
93
- popper-class="flatmap_dropdown"
94
- >
95
- <el-option
96
- v-for="item in evidencePrefixes"
97
- :key="item"
98
- :label="item"
99
- :value="item"
83
+ <template v-if="!isDeleted">
84
+ <el-row class="dialog-text">
85
+ <strong>Evidvence:</strong>
86
+ </el-row>
87
+ <el-row v-for="(value, index) in evidence" :key="value">
88
+ <el-col :span="20">
89
+ {{ evidence[index] }}
90
+ </el-col>
91
+ <el-col :span="4">
92
+ <el-icon class="standard-icon">
93
+ <el-icon-close @click="removeEvidence(index)" />
94
+ </el-icon>
95
+ </el-col>
96
+ </el-row>
97
+ <el-row>
98
+ <el-input
99
+ size="small"
100
+ placeholder="Enter"
101
+ v-model="newEvidence"
102
+ @change="evidenceEntered($event)"
103
+ >
104
+ <template #prepend>
105
+ <el-select
106
+ :teleported="false"
107
+ v-model="evidencePrefix"
108
+ placeholder="Select"
109
+ class="select-box"
110
+ popper-class="flatmap_dropdown"
100
111
  >
101
- <el-row>
102
- <el-col :span="12">{{ item }}</el-col>
103
- </el-row>
104
- </el-option>
105
- </el-select>
106
- </template>
107
- </el-input>
108
- </el-row>
112
+ <el-option
113
+ v-for="item in evidencePrefixes"
114
+ :key="item"
115
+ :label="item"
116
+ :value="item"
117
+ >
118
+ <el-row>
119
+ <el-col :span="12">{{ item }}</el-col>
120
+ </el-row>
121
+ </el-option>
122
+ </el-select>
123
+ </template>
124
+ </el-input>
125
+ </el-row>
126
+ </template>
109
127
  <el-row>
110
128
  <strong>Comment:</strong>
111
129
  </el-row>
@@ -139,10 +157,10 @@ import {
139
157
  ArrowDown as ElIconArrowDown,
140
158
  Edit as ElIconEdit,
141
159
  Close as ElIconClose,
160
+ Delete as ElIconDelete,
161
+ Finished as ElIconFinished,
142
162
  } from '@element-plus/icons-vue'
143
163
  /* eslint-disable no-alert, no-console */
144
- /* eslint-disable no-alert, no-console */
145
- import { AnnotationService } from '@abi-software/sparc-annotation'
146
164
  import {
147
165
  ElButton as Button,
148
166
  ElCol as Col,
@@ -171,7 +189,7 @@ export default {
171
189
  type: Object,
172
190
  },
173
191
  },
174
- inject: ['flatmapAPI', 'userApiKey'],
192
+ inject: ['flatmapAPI', 'userApiKey', '$annotator'],
175
193
  data: function () {
176
194
  return {
177
195
  displayPair: {
@@ -191,14 +209,29 @@ export default {
191
209
  prevSubs: [],
192
210
  showSubmissions: true,
193
211
  errorMessage: '',
212
+ creator: undefined
194
213
  }
195
214
  },
196
215
  computed: {
197
216
  isEditable: function () {
198
217
  return (
199
- this.annotationEntry['resourceId'] && this.annotationEntry['featureId']
218
+ this.annotationEntry['resourceId'] &&
219
+ this.annotationEntry['featureId']
200
220
  )
201
221
  },
222
+ isPositionUpdated: function () {
223
+ return (
224
+ this.annotationEntry['resourceId'] &&
225
+ this.annotationEntry['type'] === 'updated' &&
226
+ this.annotationEntry['positionUpdated']
227
+ )
228
+ },
229
+ isDeleted: function () {
230
+ return (
231
+ this.annotationEntry['resourceId'] &&
232
+ this.annotationEntry['type'] === 'deleted'
233
+ )
234
+ }
202
235
  },
203
236
  methods: {
204
237
  evidenceEntered: function (value) {
@@ -240,6 +273,21 @@ export default {
240
273
  }
241
274
  },
242
275
  submit: function () {
276
+ // User can either update/delete annotation directly
277
+ // or provide extra comments for update/delete action
278
+ if (
279
+ this.annotationEntry['type'] === 'updated' &&
280
+ this.annotationEntry['positionUpdated']
281
+ ) {
282
+ this.comment = this.comment ?
283
+ `Position Updated: ${this.comment}` :
284
+ 'Position Updated'
285
+ } else if (this.annotationEntry['type'] === 'deleted') {
286
+ this.comment = this.comment ?
287
+ `Feature Deleted: ${this.comment}` :
288
+ 'Feature Deleted'
289
+ }
290
+
243
291
  if (this.evidence.length > 0 || this.comment) {
244
292
  if (
245
293
  this.annotationEntry['resourceId'] &&
@@ -263,10 +311,16 @@ export default {
263
311
  item: this.annotationEntry['featureId'],
264
312
  evidence: evidenceURLs,
265
313
  comment: this.comment,
314
+ feature: this.annotationEntry['feature']
315
+ }
316
+ if (this.annotationEntry['type'] === 'deleted') {
317
+ userAnnotation.feature = undefined
266
318
  }
319
+ if (this.creator) userAnnotation.creator = this.creator
267
320
  this.$annotator
268
321
  .addAnnotation(this.userApiKey, userAnnotation)
269
322
  .then(() => {
323
+ this.$emit('annotation', userAnnotation)
270
324
  this.errorMessage = ''
271
325
  this.resetSubmission()
272
326
  this.updatePrevSubmissions()
@@ -301,13 +355,10 @@ export default {
301
355
  },
302
356
  },
303
357
  mounted: function () {
304
- if (!this.$annotator) {
305
- this.$annotator = new AnnotationService(
306
- `${this.flatmapAPI}annotator`
307
- )
308
- }
309
358
  this.$annotator.authenticate(this.userApiKey).then((userData) => {
310
359
  if (userData.name && userData.email) {
360
+ this.creator = userData
361
+ if (!userData.orcid) this.creator.orcid = '0000-0000-0000-0000'
311
362
  this.authenticated = true
312
363
  this.updatePrevSubmissions()
313
364
  } else {