@abi-software/flatmapvuer 0.5.9 → 0.5.10
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/CHANGELOG.md +402 -402
- package/LICENSE +201 -201
- package/README.md +105 -105
- package/babel.config.js +14 -14
- package/package-lock.json +18473 -18473
- package/package.json +79 -79
- package/public/index.html +17 -17
- package/src/App.vue +228 -228
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +7 -7
- package/src/components/AnnotationTool.vue +403 -403
- package/src/components/EventBus.js +2 -2
- package/src/components/ExternalResourceCard.vue +98 -98
- package/src/components/FlatmapVuer.vue +2070 -2059
- package/src/components/MultiFlatmapVuer.vue +535 -536
- package/src/components/ProvenancePopup.vue +422 -422
- package/src/components/SelectionsGroup.vue +249 -249
- package/src/components/Tooltip.vue +52 -52
- package/src/components/TreeControls.vue +231 -231
- package/src/components/index.js +9 -9
- package/src/components/legends/DynamicLegends.vue +112 -112
- package/src/components/legends/SvgLegends.vue +67 -67
- package/src/icons/fonts/mapicon-species.eot +0 -0
- package/src/icons/fonts/mapicon-species.svg +14 -14
- package/src/icons/fonts/mapicon-species.ttf +0 -0
- package/src/icons/fonts/mapicon-species.woff +0 -0
- package/src/icons/mapicon-species-style.css +42 -42
- package/src/icons/yellowstar.js +5 -5
- package/src/legends/legend.svg +25 -25
- package/src/main.js +8 -8
- package/src/nerve-map.js +99 -0
- package/src/services/flatmapQueries.js +415 -415
- package/vue.config.js +31 -31
- package/dist/demo.html +0 -10
- package/dist/flatmapvuer.common.js +0 -22741
- package/dist/flatmapvuer.common.js.map +0 -1
- package/dist/flatmapvuer.css +0 -1
- package/dist/flatmapvuer.umd.js +0 -22751
- package/dist/flatmapvuer.umd.js.map +0 -1
- package/dist/flatmapvuer.umd.min.js +0 -4
- package/dist/flatmapvuer.umd.min.js.map +0 -1
|
@@ -1,403 +1,403 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-main class="main">
|
|
3
|
-
<div class="block">
|
|
4
|
-
<el-row class="info-field">
|
|
5
|
-
<span class="title">Feature Annotations</span>
|
|
6
|
-
</el-row>
|
|
7
|
-
<template v-if="annotationEntry">
|
|
8
|
-
<el-row
|
|
9
|
-
v-for="(key, label) in displayPair"
|
|
10
|
-
v-show="annotationEntry[key]"
|
|
11
|
-
class="dialog-text"
|
|
12
|
-
:key="key"
|
|
13
|
-
>
|
|
14
|
-
<strong>{{ label }}: </strong> {{ annotationEntry[key] }}
|
|
15
|
-
</el-row>
|
|
16
|
-
<template v-if="prevSubs.length > 0">
|
|
17
|
-
<div v-show="showSubmissions" class="hide" @click="showSubmissions = false">
|
|
18
|
-
Hide previous submissions
|
|
19
|
-
<i class="el-icon-arrow-up"></i>
|
|
20
|
-
</div>
|
|
21
|
-
<div v-show="!showSubmissions" class="hide" @click="showSubmissions = true">
|
|
22
|
-
Show previous {{ prevSubs.length }} submission(s)
|
|
23
|
-
<i class="el-icon-arrow-down"></i>
|
|
24
|
-
</div>
|
|
25
|
-
<template v-if="showSubmissions">
|
|
26
|
-
<el-row class="dialog-spacer"></el-row>
|
|
27
|
-
<el-row class="dialog-text">
|
|
28
|
-
<strong class="sub-title">Previous submissions:</strong>
|
|
29
|
-
</el-row>
|
|
30
|
-
<div class="entry" v-for="(sub, index) in prevSubs" :key="index">
|
|
31
|
-
<el-row class="dialog-text">
|
|
32
|
-
<strong>{{ formatTime(sub.created) }}</strong> {{ sub.creator.name }}
|
|
33
|
-
</el-row>
|
|
34
|
-
<el-row class="dialog-text">
|
|
35
|
-
<strong>Evidence: </strong>
|
|
36
|
-
<el-row v-for="(evidence) in sub.evidence" :key="evidence" class="dialog-text">
|
|
37
|
-
<a :href="evidence" target="_blank"> {{ evidence }}</a>
|
|
38
|
-
</el-row>
|
|
39
|
-
</el-row>
|
|
40
|
-
<el-row class="dialog-text">
|
|
41
|
-
<strong>Comment: </strong> {{ sub.comment }}
|
|
42
|
-
</el-row>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
</template>
|
|
46
|
-
<template v-if="authenticated">
|
|
47
|
-
<template v-if="isEditable">
|
|
48
|
-
<el-row class="dialog-spacer"></el-row>
|
|
49
|
-
<el-row v-if="!editing">
|
|
50
|
-
<i
|
|
51
|
-
class="el-icon-edit standard-icon"
|
|
52
|
-
@click="editing = true"
|
|
53
|
-
/>
|
|
54
|
-
</el-row>
|
|
55
|
-
<template v-else>
|
|
56
|
-
<el-row class="dialog-text">
|
|
57
|
-
<strong class="sub-title">Suggest changes:</strong>
|
|
58
|
-
</el-row>
|
|
59
|
-
<el-row class="dialog-text">
|
|
60
|
-
<strong>Evidvence:</strong>
|
|
61
|
-
</el-row>
|
|
62
|
-
<el-row v-for="(value, index) in evidence" :key="value">
|
|
63
|
-
<el-col :span="20">
|
|
64
|
-
{{ evidence[index] }}
|
|
65
|
-
</el-col>
|
|
66
|
-
<el-col :span="4">
|
|
67
|
-
<i
|
|
68
|
-
class="el-icon-close standard-icon"
|
|
69
|
-
@click="removeEvidence(index)"
|
|
70
|
-
/>
|
|
71
|
-
</el-col>
|
|
72
|
-
</el-row>
|
|
73
|
-
<el-row>
|
|
74
|
-
<el-input
|
|
75
|
-
size="mini"
|
|
76
|
-
placeholder="Enter"
|
|
77
|
-
v-model="newEvidence"
|
|
78
|
-
@change="evidenceEntered($event)"
|
|
79
|
-
>
|
|
80
|
-
<el-select
|
|
81
|
-
:popper-append-to-body="false"
|
|
82
|
-
v-model="evidencePrefix"
|
|
83
|
-
placeholder="Select"
|
|
84
|
-
class="select-box"
|
|
85
|
-
popper-class="flatmap_dropdown"
|
|
86
|
-
slot="prepend"
|
|
87
|
-
>
|
|
88
|
-
<el-option v-for="item in evidencePrefixes" :key="item" :label="item" :value="item">
|
|
89
|
-
<el-row>
|
|
90
|
-
<el-col :span="12">{{ item }}</el-col>
|
|
91
|
-
</el-row>
|
|
92
|
-
</el-option>
|
|
93
|
-
</el-select>
|
|
94
|
-
</el-input>
|
|
95
|
-
</el-row>
|
|
96
|
-
<el-row>
|
|
97
|
-
<strong>Comment:</strong>
|
|
98
|
-
</el-row>
|
|
99
|
-
<el-row class="dialog-text">
|
|
100
|
-
<el-input
|
|
101
|
-
type="textarea"
|
|
102
|
-
:autosize="{ minRows: 2, maxRows: 4}"
|
|
103
|
-
placeholder="Enter"
|
|
104
|
-
v-model="comment"
|
|
105
|
-
/>
|
|
106
|
-
</el-row>
|
|
107
|
-
<el-row class="dialog-text">
|
|
108
|
-
<el-button
|
|
109
|
-
class="button"
|
|
110
|
-
type="primary"
|
|
111
|
-
plain
|
|
112
|
-
@click="submit"
|
|
113
|
-
>
|
|
114
|
-
Submit
|
|
115
|
-
</el-button>
|
|
116
|
-
</el-row>
|
|
117
|
-
</template>
|
|
118
|
-
<el-row class="dialog-text" v-if="errorMessage">
|
|
119
|
-
<strong class="sub-title"> {{ errorMessage }}
|
|
120
|
-
</strong>
|
|
121
|
-
</el-row>
|
|
122
|
-
</template>
|
|
123
|
-
</template>
|
|
124
|
-
</template>
|
|
125
|
-
</div>
|
|
126
|
-
</el-main>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<script>
|
|
131
|
-
/* eslint-disable no-alert, no-console */
|
|
132
|
-
/* eslint-disable no-alert, no-console */
|
|
133
|
-
import Vue from "vue";
|
|
134
|
-
import { AnnotationService } from "@abi-software/sparc-annotation";
|
|
135
|
-
import { Button, Col, Input, Main, Row, Select } from "element-ui";
|
|
136
|
-
import lang from "element-ui/lib/locale/lang/en";
|
|
137
|
-
import locale from "element-ui/lib/locale";
|
|
138
|
-
|
|
139
|
-
locale.use(lang);
|
|
140
|
-
Vue.use(Button);
|
|
141
|
-
Vue.use(Col);
|
|
142
|
-
Vue.use(Input);
|
|
143
|
-
Vue.use(Main);
|
|
144
|
-
Vue.use(Row);
|
|
145
|
-
Vue.use(Select);
|
|
146
|
-
|
|
147
|
-
export default {
|
|
148
|
-
name: "AnnotationTool",
|
|
149
|
-
props: {
|
|
150
|
-
annotationEntry: {
|
|
151
|
-
type: Object,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
inject: ['flatmapAPI'],
|
|
155
|
-
data: function() {
|
|
156
|
-
return {
|
|
157
|
-
displayPair: {
|
|
158
|
-
"Feature ID": "featureId",
|
|
159
|
-
"Tooltip": "label",
|
|
160
|
-
"Models": "models",
|
|
161
|
-
"Name": "name",
|
|
162
|
-
"Resource": "resourceId"
|
|
163
|
-
},
|
|
164
|
-
editing: false,
|
|
165
|
-
evidencePrefixes: [
|
|
166
|
-
"DOI:",
|
|
167
|
-
"PMID:",
|
|
168
|
-
],
|
|
169
|
-
evidencePrefix: "DOI:",
|
|
170
|
-
evidence: [ ],
|
|
171
|
-
authenticated: false,
|
|
172
|
-
newEvidence: '',
|
|
173
|
-
comment: '',
|
|
174
|
-
prevSubs: [ ],
|
|
175
|
-
showSubmissions: true,
|
|
176
|
-
errorMessage: "",
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
computed: {
|
|
180
|
-
isEditable: function() {
|
|
181
|
-
return this.annotationEntry['resourceId'] && this.annotationEntry['featureId'];
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
methods: {
|
|
185
|
-
evidenceEntered: function(value) {
|
|
186
|
-
if (value) {
|
|
187
|
-
this.evidence.push(this.evidencePrefix + value);
|
|
188
|
-
this.newEvidence = "";
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
formatTime: function(dateString) {
|
|
192
|
-
const options = { year: "numeric", month: "long", day: "numeric",
|
|
193
|
-
hour: "numeric", minute: "numeric", second: "numeric" };
|
|
194
|
-
return new Date(dateString).toLocaleDateString(undefined, options);
|
|
195
|
-
},
|
|
196
|
-
updatePrevSubmissions: function() {
|
|
197
|
-
if (this.$annotator && this.authenticated) {
|
|
198
|
-
if (this.annotationEntry['resourceId'] &&
|
|
199
|
-
this.annotationEntry['featureId']) {
|
|
200
|
-
this.$annotator.itemAnnotations(this.annotationEntry['resourceId'],
|
|
201
|
-
this.annotationEntry['featureId']).then((value) => {
|
|
202
|
-
this.prevSubs = value;
|
|
203
|
-
})
|
|
204
|
-
.catch((reason) => {
|
|
205
|
-
console.log(reason); // Error!
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
submit: function() {
|
|
211
|
-
if ((this.evidence.length > 0) || this.comment) {
|
|
212
|
-
if (this.annotationEntry['resourceId'] &&
|
|
213
|
-
this.annotationEntry['featureId']) {
|
|
214
|
-
const evidenceURLs = [];
|
|
215
|
-
this.evidence.forEach((evidence) => {
|
|
216
|
-
if (evidence.includes("DOI:")) {
|
|
217
|
-
const link = evidence.replace("DOI:", "https://doi.org/");
|
|
218
|
-
evidenceURLs.push(new URL(link));
|
|
219
|
-
} else if (evidence.includes("PMID:")) {
|
|
220
|
-
const link = evidence.replace("PMID:", "https://pubmed.ncbi.nlm.nih.gov/");
|
|
221
|
-
evidenceURLs.push(new URL(link));
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
const userAnnotation = {
|
|
225
|
-
resource: this.annotationEntry['resourceId'],
|
|
226
|
-
item: this.annotationEntry['featureId'],
|
|
227
|
-
evidence: evidenceURLs,
|
|
228
|
-
comment: this.comment,
|
|
229
|
-
}
|
|
230
|
-
this.$annotator.addAnnotation(userAnnotation).then(() => {
|
|
231
|
-
this.errorMessage = "";
|
|
232
|
-
this.resetSubmission();
|
|
233
|
-
this.updatePrevSubmissions();
|
|
234
|
-
})
|
|
235
|
-
.catch(() => {
|
|
236
|
-
this.errorMessage = "There is a problem with the submission, please try again later";
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
removeEvidence: function(index) {
|
|
242
|
-
this.evidence.splice(index, 1);
|
|
243
|
-
},
|
|
244
|
-
resetSubmission: function() {
|
|
245
|
-
this.editing = false;
|
|
246
|
-
this.evidence = [];
|
|
247
|
-
this.newFeature = '';
|
|
248
|
-
this.comment = '';
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
watch: {
|
|
252
|
-
annotationEntry: {
|
|
253
|
-
handler: function() {
|
|
254
|
-
this.resetSubmission();
|
|
255
|
-
this.updatePrevSubmissions();
|
|
256
|
-
},
|
|
257
|
-
immediate: false,
|
|
258
|
-
deep: false,
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
mounted: function() {
|
|
262
|
-
if (!this.$annotator) {
|
|
263
|
-
Vue.prototype.$annotator = new AnnotationService(
|
|
264
|
-
`${this.flatmapAPI}annotator`);
|
|
265
|
-
}
|
|
266
|
-
this.$annotator.authenticate().then((userData) => {
|
|
267
|
-
if (userData.name && userData.email) {
|
|
268
|
-
this.authenticated = true;
|
|
269
|
-
this.updatePrevSubmissions();
|
|
270
|
-
} else {
|
|
271
|
-
this.errorMessage = "";
|
|
272
|
-
}
|
|
273
|
-
})
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
</script>
|
|
277
|
-
|
|
278
|
-
<style scoped lang="scss">
|
|
279
|
-
@import "~element-ui/packages/theme-chalk/src/button";
|
|
280
|
-
@import "~element-ui/packages/theme-chalk/src/col";
|
|
281
|
-
@import "~element-ui/packages/theme-chalk/src/input";
|
|
282
|
-
@import "~element-ui/packages/theme-chalk/src/main";
|
|
283
|
-
@import "~element-ui/packages/theme-chalk/src/row";
|
|
284
|
-
@import "~element-ui/packages/theme-chalk/src/select";
|
|
285
|
-
|
|
286
|
-
.info-field {
|
|
287
|
-
display:flex;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.block {
|
|
291
|
-
margin-bottom: 0.5em;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.button {
|
|
295
|
-
padding-top:5px;
|
|
296
|
-
padding-bottom:5px;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.standard-icon {
|
|
300
|
-
color: $app-primary-color;
|
|
301
|
-
&:hover {
|
|
302
|
-
cursor: pointer;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.dialog-text {
|
|
307
|
-
color: rgb(48, 49, 51);
|
|
308
|
-
font-size: 14px;
|
|
309
|
-
font-weight: normal;
|
|
310
|
-
line-height: 20px;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.main {
|
|
314
|
-
font-size: 14px;
|
|
315
|
-
text-align: left;
|
|
316
|
-
line-height: 1.5em;
|
|
317
|
-
font-family: Asap, sans-serif,Helvetica;
|
|
318
|
-
font-weight: 400;
|
|
319
|
-
/* outline: thin red solid; */
|
|
320
|
-
padding: 1em !important;
|
|
321
|
-
overflow-x: hidden;
|
|
322
|
-
overflow-y: auto;
|
|
323
|
-
min-width: 20rem;
|
|
324
|
-
max-height: 400px;
|
|
325
|
-
scrollbar-width: thin;
|
|
326
|
-
|
|
327
|
-
&::-webkit-scrollbar {
|
|
328
|
-
width: 4px;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
&::-webkit-scrollbar-thumb {
|
|
332
|
-
border-radius: 10px;
|
|
333
|
-
box-shadow: inset 0 0 6px #c0c4cc;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.title {
|
|
338
|
-
font-size: 18px;
|
|
339
|
-
font-weight: 500;
|
|
340
|
-
font-weight: bold;
|
|
341
|
-
padding-bottom: 8px;
|
|
342
|
-
color: rgb(131, 0, 191);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
.sub-title {
|
|
346
|
-
font-size: 16px;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
.dialog-spacer {
|
|
351
|
-
border-bottom: 1px solid #e4e7ed;
|
|
352
|
-
margin-bottom: 10px;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
.submit {
|
|
356
|
-
color: $app-primary-color;
|
|
357
|
-
&:hover {
|
|
358
|
-
cursor: pointer;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.entry ~ .entry {
|
|
363
|
-
border-top: 1px solid #e4e7ed;
|
|
364
|
-
margin-top: 10px;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.hide{
|
|
368
|
-
color: $app-primary-color;
|
|
369
|
-
cursor: pointer;
|
|
370
|
-
margin-right: 6px;
|
|
371
|
-
margin-top: 3px;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
::v-deep .el-input__inner, ::v-deep .el-textarea__inner{
|
|
375
|
-
font-family: Asap, sans-serif;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.select-box {
|
|
379
|
-
width:80px;
|
|
380
|
-
background-color: var(--white);
|
|
381
|
-
font-weight: 500;
|
|
382
|
-
color:rgb(48, 49, 51);;
|
|
383
|
-
::v-deep .el-input__inner {
|
|
384
|
-
height:30px;
|
|
385
|
-
color: rgb(48, 49, 51);
|
|
386
|
-
}
|
|
387
|
-
::v-deep .el-input__icon {
|
|
388
|
-
line-height:30px
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
::v-deep .flatmap_dropdown {
|
|
393
|
-
min-width: 80px!important;
|
|
394
|
-
.el-select-dropdown__item {
|
|
395
|
-
white-space: nowrap;
|
|
396
|
-
text-align: left;
|
|
397
|
-
&.selected {
|
|
398
|
-
color: $app-primary-color;
|
|
399
|
-
font-weight: normal;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-main class="main">
|
|
3
|
+
<div class="block">
|
|
4
|
+
<el-row class="info-field">
|
|
5
|
+
<span class="title">Feature Annotations</span>
|
|
6
|
+
</el-row>
|
|
7
|
+
<template v-if="annotationEntry">
|
|
8
|
+
<el-row
|
|
9
|
+
v-for="(key, label) in displayPair"
|
|
10
|
+
v-show="annotationEntry[key]"
|
|
11
|
+
class="dialog-text"
|
|
12
|
+
:key="key"
|
|
13
|
+
>
|
|
14
|
+
<strong>{{ label }}: </strong> {{ annotationEntry[key] }}
|
|
15
|
+
</el-row>
|
|
16
|
+
<template v-if="prevSubs.length > 0">
|
|
17
|
+
<div v-show="showSubmissions" class="hide" @click="showSubmissions = false">
|
|
18
|
+
Hide previous submissions
|
|
19
|
+
<i class="el-icon-arrow-up"></i>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-show="!showSubmissions" class="hide" @click="showSubmissions = true">
|
|
22
|
+
Show previous {{ prevSubs.length }} submission(s)
|
|
23
|
+
<i class="el-icon-arrow-down"></i>
|
|
24
|
+
</div>
|
|
25
|
+
<template v-if="showSubmissions">
|
|
26
|
+
<el-row class="dialog-spacer"></el-row>
|
|
27
|
+
<el-row class="dialog-text">
|
|
28
|
+
<strong class="sub-title">Previous submissions:</strong>
|
|
29
|
+
</el-row>
|
|
30
|
+
<div class="entry" v-for="(sub, index) in prevSubs" :key="index">
|
|
31
|
+
<el-row class="dialog-text">
|
|
32
|
+
<strong>{{ formatTime(sub.created) }}</strong> {{ sub.creator.name }}
|
|
33
|
+
</el-row>
|
|
34
|
+
<el-row class="dialog-text">
|
|
35
|
+
<strong>Evidence: </strong>
|
|
36
|
+
<el-row v-for="(evidence) in sub.evidence" :key="evidence" class="dialog-text">
|
|
37
|
+
<a :href="evidence" target="_blank"> {{ evidence }}</a>
|
|
38
|
+
</el-row>
|
|
39
|
+
</el-row>
|
|
40
|
+
<el-row class="dialog-text">
|
|
41
|
+
<strong>Comment: </strong> {{ sub.comment }}
|
|
42
|
+
</el-row>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</template>
|
|
46
|
+
<template v-if="authenticated">
|
|
47
|
+
<template v-if="isEditable">
|
|
48
|
+
<el-row class="dialog-spacer"></el-row>
|
|
49
|
+
<el-row v-if="!editing">
|
|
50
|
+
<i
|
|
51
|
+
class="el-icon-edit standard-icon"
|
|
52
|
+
@click="editing = true"
|
|
53
|
+
/>
|
|
54
|
+
</el-row>
|
|
55
|
+
<template v-else>
|
|
56
|
+
<el-row class="dialog-text">
|
|
57
|
+
<strong class="sub-title">Suggest changes:</strong>
|
|
58
|
+
</el-row>
|
|
59
|
+
<el-row class="dialog-text">
|
|
60
|
+
<strong>Evidvence:</strong>
|
|
61
|
+
</el-row>
|
|
62
|
+
<el-row v-for="(value, index) in evidence" :key="value">
|
|
63
|
+
<el-col :span="20">
|
|
64
|
+
{{ evidence[index] }}
|
|
65
|
+
</el-col>
|
|
66
|
+
<el-col :span="4">
|
|
67
|
+
<i
|
|
68
|
+
class="el-icon-close standard-icon"
|
|
69
|
+
@click="removeEvidence(index)"
|
|
70
|
+
/>
|
|
71
|
+
</el-col>
|
|
72
|
+
</el-row>
|
|
73
|
+
<el-row>
|
|
74
|
+
<el-input
|
|
75
|
+
size="mini"
|
|
76
|
+
placeholder="Enter"
|
|
77
|
+
v-model="newEvidence"
|
|
78
|
+
@change="evidenceEntered($event)"
|
|
79
|
+
>
|
|
80
|
+
<el-select
|
|
81
|
+
:popper-append-to-body="false"
|
|
82
|
+
v-model="evidencePrefix"
|
|
83
|
+
placeholder="Select"
|
|
84
|
+
class="select-box"
|
|
85
|
+
popper-class="flatmap_dropdown"
|
|
86
|
+
slot="prepend"
|
|
87
|
+
>
|
|
88
|
+
<el-option v-for="item in evidencePrefixes" :key="item" :label="item" :value="item">
|
|
89
|
+
<el-row>
|
|
90
|
+
<el-col :span="12">{{ item }}</el-col>
|
|
91
|
+
</el-row>
|
|
92
|
+
</el-option>
|
|
93
|
+
</el-select>
|
|
94
|
+
</el-input>
|
|
95
|
+
</el-row>
|
|
96
|
+
<el-row>
|
|
97
|
+
<strong>Comment:</strong>
|
|
98
|
+
</el-row>
|
|
99
|
+
<el-row class="dialog-text">
|
|
100
|
+
<el-input
|
|
101
|
+
type="textarea"
|
|
102
|
+
:autosize="{ minRows: 2, maxRows: 4}"
|
|
103
|
+
placeholder="Enter"
|
|
104
|
+
v-model="comment"
|
|
105
|
+
/>
|
|
106
|
+
</el-row>
|
|
107
|
+
<el-row class="dialog-text">
|
|
108
|
+
<el-button
|
|
109
|
+
class="button"
|
|
110
|
+
type="primary"
|
|
111
|
+
plain
|
|
112
|
+
@click="submit"
|
|
113
|
+
>
|
|
114
|
+
Submit
|
|
115
|
+
</el-button>
|
|
116
|
+
</el-row>
|
|
117
|
+
</template>
|
|
118
|
+
<el-row class="dialog-text" v-if="errorMessage">
|
|
119
|
+
<strong class="sub-title"> {{ errorMessage }}
|
|
120
|
+
</strong>
|
|
121
|
+
</el-row>
|
|
122
|
+
</template>
|
|
123
|
+
</template>
|
|
124
|
+
</template>
|
|
125
|
+
</div>
|
|
126
|
+
</el-main>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
/* eslint-disable no-alert, no-console */
|
|
132
|
+
/* eslint-disable no-alert, no-console */
|
|
133
|
+
import Vue from "vue";
|
|
134
|
+
import { AnnotationService } from "@abi-software/sparc-annotation";
|
|
135
|
+
import { Button, Col, Input, Main, Row, Select } from "element-ui";
|
|
136
|
+
import lang from "element-ui/lib/locale/lang/en";
|
|
137
|
+
import locale from "element-ui/lib/locale";
|
|
138
|
+
|
|
139
|
+
locale.use(lang);
|
|
140
|
+
Vue.use(Button);
|
|
141
|
+
Vue.use(Col);
|
|
142
|
+
Vue.use(Input);
|
|
143
|
+
Vue.use(Main);
|
|
144
|
+
Vue.use(Row);
|
|
145
|
+
Vue.use(Select);
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
name: "AnnotationTool",
|
|
149
|
+
props: {
|
|
150
|
+
annotationEntry: {
|
|
151
|
+
type: Object,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
inject: ['flatmapAPI'],
|
|
155
|
+
data: function() {
|
|
156
|
+
return {
|
|
157
|
+
displayPair: {
|
|
158
|
+
"Feature ID": "featureId",
|
|
159
|
+
"Tooltip": "label",
|
|
160
|
+
"Models": "models",
|
|
161
|
+
"Name": "name",
|
|
162
|
+
"Resource": "resourceId"
|
|
163
|
+
},
|
|
164
|
+
editing: false,
|
|
165
|
+
evidencePrefixes: [
|
|
166
|
+
"DOI:",
|
|
167
|
+
"PMID:",
|
|
168
|
+
],
|
|
169
|
+
evidencePrefix: "DOI:",
|
|
170
|
+
evidence: [ ],
|
|
171
|
+
authenticated: false,
|
|
172
|
+
newEvidence: '',
|
|
173
|
+
comment: '',
|
|
174
|
+
prevSubs: [ ],
|
|
175
|
+
showSubmissions: true,
|
|
176
|
+
errorMessage: "",
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
computed: {
|
|
180
|
+
isEditable: function() {
|
|
181
|
+
return this.annotationEntry['resourceId'] && this.annotationEntry['featureId'];
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
methods: {
|
|
185
|
+
evidenceEntered: function(value) {
|
|
186
|
+
if (value) {
|
|
187
|
+
this.evidence.push(this.evidencePrefix + value);
|
|
188
|
+
this.newEvidence = "";
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
formatTime: function(dateString) {
|
|
192
|
+
const options = { year: "numeric", month: "long", day: "numeric",
|
|
193
|
+
hour: "numeric", minute: "numeric", second: "numeric" };
|
|
194
|
+
return new Date(dateString).toLocaleDateString(undefined, options);
|
|
195
|
+
},
|
|
196
|
+
updatePrevSubmissions: function() {
|
|
197
|
+
if (this.$annotator && this.authenticated) {
|
|
198
|
+
if (this.annotationEntry['resourceId'] &&
|
|
199
|
+
this.annotationEntry['featureId']) {
|
|
200
|
+
this.$annotator.itemAnnotations(this.annotationEntry['resourceId'],
|
|
201
|
+
this.annotationEntry['featureId']).then((value) => {
|
|
202
|
+
this.prevSubs = value;
|
|
203
|
+
})
|
|
204
|
+
.catch((reason) => {
|
|
205
|
+
console.log(reason); // Error!
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
submit: function() {
|
|
211
|
+
if ((this.evidence.length > 0) || this.comment) {
|
|
212
|
+
if (this.annotationEntry['resourceId'] &&
|
|
213
|
+
this.annotationEntry['featureId']) {
|
|
214
|
+
const evidenceURLs = [];
|
|
215
|
+
this.evidence.forEach((evidence) => {
|
|
216
|
+
if (evidence.includes("DOI:")) {
|
|
217
|
+
const link = evidence.replace("DOI:", "https://doi.org/");
|
|
218
|
+
evidenceURLs.push(new URL(link));
|
|
219
|
+
} else if (evidence.includes("PMID:")) {
|
|
220
|
+
const link = evidence.replace("PMID:", "https://pubmed.ncbi.nlm.nih.gov/");
|
|
221
|
+
evidenceURLs.push(new URL(link));
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
const userAnnotation = {
|
|
225
|
+
resource: this.annotationEntry['resourceId'],
|
|
226
|
+
item: this.annotationEntry['featureId'],
|
|
227
|
+
evidence: evidenceURLs,
|
|
228
|
+
comment: this.comment,
|
|
229
|
+
}
|
|
230
|
+
this.$annotator.addAnnotation(userAnnotation).then(() => {
|
|
231
|
+
this.errorMessage = "";
|
|
232
|
+
this.resetSubmission();
|
|
233
|
+
this.updatePrevSubmissions();
|
|
234
|
+
})
|
|
235
|
+
.catch(() => {
|
|
236
|
+
this.errorMessage = "There is a problem with the submission, please try again later";
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
removeEvidence: function(index) {
|
|
242
|
+
this.evidence.splice(index, 1);
|
|
243
|
+
},
|
|
244
|
+
resetSubmission: function() {
|
|
245
|
+
this.editing = false;
|
|
246
|
+
this.evidence = [];
|
|
247
|
+
this.newFeature = '';
|
|
248
|
+
this.comment = '';
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
watch: {
|
|
252
|
+
annotationEntry: {
|
|
253
|
+
handler: function() {
|
|
254
|
+
this.resetSubmission();
|
|
255
|
+
this.updatePrevSubmissions();
|
|
256
|
+
},
|
|
257
|
+
immediate: false,
|
|
258
|
+
deep: false,
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
mounted: function() {
|
|
262
|
+
if (!this.$annotator) {
|
|
263
|
+
Vue.prototype.$annotator = new AnnotationService(
|
|
264
|
+
`${this.flatmapAPI}annotator`);
|
|
265
|
+
}
|
|
266
|
+
this.$annotator.authenticate().then((userData) => {
|
|
267
|
+
if (userData.name && userData.email) {
|
|
268
|
+
this.authenticated = true;
|
|
269
|
+
this.updatePrevSubmissions();
|
|
270
|
+
} else {
|
|
271
|
+
this.errorMessage = "";
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
</script>
|
|
277
|
+
|
|
278
|
+
<style scoped lang="scss">
|
|
279
|
+
@import "~element-ui/packages/theme-chalk/src/button";
|
|
280
|
+
@import "~element-ui/packages/theme-chalk/src/col";
|
|
281
|
+
@import "~element-ui/packages/theme-chalk/src/input";
|
|
282
|
+
@import "~element-ui/packages/theme-chalk/src/main";
|
|
283
|
+
@import "~element-ui/packages/theme-chalk/src/row";
|
|
284
|
+
@import "~element-ui/packages/theme-chalk/src/select";
|
|
285
|
+
|
|
286
|
+
.info-field {
|
|
287
|
+
display:flex;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.block {
|
|
291
|
+
margin-bottom: 0.5em;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.button {
|
|
295
|
+
padding-top:5px;
|
|
296
|
+
padding-bottom:5px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.standard-icon {
|
|
300
|
+
color: $app-primary-color;
|
|
301
|
+
&:hover {
|
|
302
|
+
cursor: pointer;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.dialog-text {
|
|
307
|
+
color: rgb(48, 49, 51);
|
|
308
|
+
font-size: 14px;
|
|
309
|
+
font-weight: normal;
|
|
310
|
+
line-height: 20px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.main {
|
|
314
|
+
font-size: 14px;
|
|
315
|
+
text-align: left;
|
|
316
|
+
line-height: 1.5em;
|
|
317
|
+
font-family: Asap, sans-serif,Helvetica;
|
|
318
|
+
font-weight: 400;
|
|
319
|
+
/* outline: thin red solid; */
|
|
320
|
+
padding: 1em !important;
|
|
321
|
+
overflow-x: hidden;
|
|
322
|
+
overflow-y: auto;
|
|
323
|
+
min-width: 20rem;
|
|
324
|
+
max-height: 400px;
|
|
325
|
+
scrollbar-width: thin;
|
|
326
|
+
|
|
327
|
+
&::-webkit-scrollbar {
|
|
328
|
+
width: 4px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&::-webkit-scrollbar-thumb {
|
|
332
|
+
border-radius: 10px;
|
|
333
|
+
box-shadow: inset 0 0 6px #c0c4cc;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.title {
|
|
338
|
+
font-size: 18px;
|
|
339
|
+
font-weight: 500;
|
|
340
|
+
font-weight: bold;
|
|
341
|
+
padding-bottom: 8px;
|
|
342
|
+
color: rgb(131, 0, 191);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.sub-title {
|
|
346
|
+
font-size: 16px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
.dialog-spacer {
|
|
351
|
+
border-bottom: 1px solid #e4e7ed;
|
|
352
|
+
margin-bottom: 10px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.submit {
|
|
356
|
+
color: $app-primary-color;
|
|
357
|
+
&:hover {
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.entry ~ .entry {
|
|
363
|
+
border-top: 1px solid #e4e7ed;
|
|
364
|
+
margin-top: 10px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.hide{
|
|
368
|
+
color: $app-primary-color;
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
margin-right: 6px;
|
|
371
|
+
margin-top: 3px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
::v-deep .el-input__inner, ::v-deep .el-textarea__inner{
|
|
375
|
+
font-family: Asap, sans-serif;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.select-box {
|
|
379
|
+
width:80px;
|
|
380
|
+
background-color: var(--white);
|
|
381
|
+
font-weight: 500;
|
|
382
|
+
color:rgb(48, 49, 51);;
|
|
383
|
+
::v-deep .el-input__inner {
|
|
384
|
+
height:30px;
|
|
385
|
+
color: rgb(48, 49, 51);
|
|
386
|
+
}
|
|
387
|
+
::v-deep .el-input__icon {
|
|
388
|
+
line-height:30px
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
::v-deep .flatmap_dropdown {
|
|
393
|
+
min-width: 80px!important;
|
|
394
|
+
.el-select-dropdown__item {
|
|
395
|
+
white-space: nowrap;
|
|
396
|
+
text-align: left;
|
|
397
|
+
&.selected {
|
|
398
|
+
color: $app-primary-color;
|
|
399
|
+
font-weight: normal;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
</style>
|