@abi-software/flatmapvuer 0.6.1-auth.0 → 0.6.1-auth.2

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.0",
3
+ "version": "0.6.1-auth.2",
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.5.10",
46
+ "@abi-software/flatmap-viewer": "^2.4.4",
47
47
  "@abi-software/sparc-annotation": "0.2.0",
48
- "@abi-software/svg-sprite": "^0.4.0-vue3.3",
48
+ "@abi-software/svg-sprite": "^0.4.0-vue3-beta.0",
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
@@ -229,7 +229,7 @@ export default {
229
229
  //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
230
230
  //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
231
231
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/",
232
- userApiKey: '',
232
+ userApiKey: undefined,
233
233
  ElIconSetting: shallowRef(ElIconSetting)
234
234
  }
235
235
  },
@@ -60,70 +60,52 @@
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">
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>
63
+ <el-icon class="standard-icon"><el-icon-edit /></el-icon>
78
64
  </el-row>
79
65
  <template v-else>
80
66
  <el-row class="dialog-text">
81
67
  <strong class="sub-title">Suggest changes:</strong>
82
68
  </el-row>
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"
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"
111
100
  >
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>
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>
127
109
  <el-row>
128
110
  <strong>Comment:</strong>
129
111
  </el-row>
@@ -157,10 +139,10 @@ import {
157
139
  ArrowDown as ElIconArrowDown,
158
140
  Edit as ElIconEdit,
159
141
  Close as ElIconClose,
160
- Delete as ElIconDelete,
161
- Finished as ElIconFinished,
162
142
  } from '@element-plus/icons-vue'
163
143
  /* eslint-disable no-alert, no-console */
144
+ /* eslint-disable no-alert, no-console */
145
+ import { AnnotationService } from '@abi-software/sparc-annotation'
164
146
  import {
165
147
  ElButton as Button,
166
148
  ElCol as Col,
@@ -189,7 +171,7 @@ export default {
189
171
  type: Object,
190
172
  },
191
173
  },
192
- inject: ['flatmapAPI', 'userApiKey', '$annotator'],
174
+ inject: ['flatmapAPI', 'userApiKey'],
193
175
  data: function () {
194
176
  return {
195
177
  displayPair: {
@@ -209,29 +191,14 @@ export default {
209
191
  prevSubs: [],
210
192
  showSubmissions: true,
211
193
  errorMessage: '',
212
- creator: undefined
213
194
  }
214
195
  },
215
196
  computed: {
216
197
  isEditable: function () {
217
198
  return (
218
- this.annotationEntry['resourceId'] &&
219
- this.annotationEntry['featureId']
199
+ this.annotationEntry['resourceId'] && this.annotationEntry['featureId']
220
200
  )
221
201
  },
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
- }
235
202
  },
236
203
  methods: {
237
204
  evidenceEntered: function (value) {
@@ -273,21 +240,6 @@ export default {
273
240
  }
274
241
  },
275
242
  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
-
291
243
  if (this.evidence.length > 0 || this.comment) {
292
244
  if (
293
245
  this.annotationEntry['resourceId'] &&
@@ -311,16 +263,10 @@ export default {
311
263
  item: this.annotationEntry['featureId'],
312
264
  evidence: evidenceURLs,
313
265
  comment: this.comment,
314
- feature: this.annotationEntry['feature']
315
- }
316
- if (this.annotationEntry['type'] === 'deleted') {
317
- userAnnotation.feature = undefined
318
266
  }
319
- if (this.creator) userAnnotation.creator = this.creator
320
267
  this.$annotator
321
268
  .addAnnotation(this.userApiKey, userAnnotation)
322
269
  .then(() => {
323
- this.$emit('annotation', userAnnotation)
324
270
  this.errorMessage = ''
325
271
  this.resetSubmission()
326
272
  this.updatePrevSubmissions()
@@ -355,10 +301,13 @@ export default {
355
301
  },
356
302
  },
357
303
  mounted: function () {
304
+ if (!this.$annotator) {
305
+ this.$annotator = new AnnotationService(
306
+ `${this.flatmapAPI}annotator`
307
+ )
308
+ }
358
309
  this.$annotator.authenticate(this.userApiKey).then((userData) => {
359
310
  if (userData.name && userData.email) {
360
- this.creator = userData
361
- if (!userData.orcid) this.creator.orcid = '0000-0000-0000-0000'
362
311
  this.authenticated = true
363
312
  this.updatePrevSubmissions()
364
313
  } else {