@abi-software/mapintegratedvuer 1.21.1 → 1.22.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/README.md +23 -5
- package/assets/location-icon.html +33 -1
- package/assets/styleguide.css +18 -18
- package/cypress.config.js +7 -9
- package/dist/{ConnectivityGraph-CZMROk9r.js → ConnectivityGraph-BBZ3Dgat.js} +3 -3
- package/dist/{ContentMixin-Vn34n5t2.js → ContentMixin-B-O_IwPg.js} +16 -18
- package/dist/{DynamicMarkerMixin-BS6t7w_i.js → DynamicMarkerMixin-B9iqtP_f.js} +1 -1
- package/dist/{Flatmap-BejxA0uz.js → Flatmap-BoEFI50b.js} +4 -4
- package/dist/{Iframe-BWbhTjCR.js → Iframe-Slj-LQTF.js} +4 -4
- package/dist/{MultiFlatmap-nlmsH-Ib.js → MultiFlatmap-l6aBn6x3.js} +17 -5
- package/dist/{Plot-ChbPsDZX.js → Plot-CIhEip5b.js} +2 -2
- package/dist/{Scaffold-C6f7c7Ha.js → Scaffold-D5ZGCDvt.js} +4 -4
- package/dist/{Simulation-DcJScRYo.js → Simulation-C5o5DXRb.js} +2 -2
- package/dist/{connectivities-UXTqf7_0.js → connectivities-Br3MpoAv.js} +154 -95
- package/dist/index.html +9 -6
- package/dist/mapintegratedvuer.js +5506 -5582
- package/dist/mapintegratedvuer.umd.cjs +196 -196
- package/dist/style.css +1 -1
- package/eslint.config.js +39 -15
- package/package.json +12 -6
- package/public/index.html +9 -6
- package/src/App.vue +224 -255
- package/src/assets/_variables.scss +12 -10
- package/src/assets/header-icon.scss +8 -9
- package/src/assets/mapicon-species-style.css +10 -8
- package/src/assets/styles.scss +1 -1
- package/src/components/ContentBar.vue +99 -106
- package/src/components/ContentVuer.vue +36 -39
- package/src/components/ContextCard.vue +238 -199
- package/src/components/ContextHelp.vue +22 -26
- package/src/components/CustomSplitter.vue +32 -43
- package/src/components/DatasetHeader.vue +37 -41
- package/src/components/DialogToolbarContent.vue +292 -256
- package/src/components/FlatmapContextCard.vue +52 -57
- package/src/components/MapContent.vue +111 -87
- package/src/components/ResizeSensor.vue +8 -13
- package/src/components/SearchControls.vue +26 -35
- package/src/components/SimulatedData.js +196 -219
- package/src/components/SplitDialog.vue +139 -129
- package/src/components/SplitFlow.vue +433 -239
- package/src/components/index.js +1 -3
- package/src/components/scripts/simulation_data.js +393 -397
- package/src/components/scripts/utilities.js +108 -78
- package/src/components/viewers/CellDLViewer.vue +9 -9
- package/src/components/viewers/ConnectivityGraph.vue +9 -12
- package/src/components/viewers/Flatmap.vue +23 -25
- package/src/components/viewers/Iframe.vue +8 -10
- package/src/components/viewers/MultiFlatmap.vue +73 -69
- package/src/components/viewers/Plot.vue +6 -7
- package/src/components/viewers/Scaffold.vue +73 -63
- package/src/components/viewers/Simulation.vue +10 -15
- package/src/main.js +16 -21
- package/src/mixins/ContentMixin.js +208 -178
- package/src/mixins/DynamicMarkerMixin.js +14 -18
- package/src/mixins/RetrieveContextCardMixin.js +35 -30
- package/src/mixins/S3Bucket.vue +10 -13
- package/src/services/knowledgeMapping.js +53 -53
- package/src/services/tagging.js +4 -4
- package/src/stores/connectivities.js +46 -8
- package/src/stores/entries.js +7 -9
- package/src/stores/index.js +7 -7
- package/src/stores/settings.js +23 -31
- package/src/stores/splitFlow.js +395 -298
- package/vite.bundle-build.js +24 -26
- package/vite.config.js +22 -21
- package/vite.static-build.js +4 -4
- package/vitest.workspace.js +1 -3
- package/vuese-generator.js +47 -55
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="context-card-container"
|
|
2
|
+
<div class="context-card-container" ref="container">
|
|
3
3
|
<div v-show="showContextCard">
|
|
4
|
-
<div
|
|
4
|
+
<div
|
|
5
|
+
v-if="showDetails && Object.keys(contextData).length !== 0"
|
|
6
|
+
v-loading="loading"
|
|
7
|
+
class="context-card"
|
|
8
|
+
>
|
|
5
9
|
<div class="card-left">
|
|
6
|
-
<img :src="banner" class="context-image"
|
|
10
|
+
<img :src="banner" class="context-image" />
|
|
7
11
|
</div>
|
|
8
12
|
<div class="card-right scrollbar">
|
|
9
13
|
<div>
|
|
10
|
-
<div class="title">{{contextData.heading}}</div>
|
|
11
|
-
<div v-html="parseMarkdown(contextData.description)"/>
|
|
14
|
+
<div class="title">{{ contextData.heading }}</div>
|
|
15
|
+
<div v-html="parseMarkdown(contextData.description)" />
|
|
12
16
|
<!-- <br/> -->
|
|
13
17
|
</div>
|
|
14
18
|
</div>
|
|
@@ -17,9 +21,15 @@
|
|
|
17
21
|
<el-collapse v-if="originalSource && originalSource.length" v-model="activeName">
|
|
18
22
|
<el-collapse-item title="View/Hide source data links" name="sourceDataLinks">
|
|
19
23
|
<ul class="source-data-list">
|
|
20
|
-
<template v-for="(source, i) in originalSource" :key="'source-'+ i">
|
|
24
|
+
<template v-for="(source, i) in originalSource" :key="'source-' + i">
|
|
21
25
|
<li>
|
|
22
|
-
<a
|
|
26
|
+
<a
|
|
27
|
+
v-if="source && source.path"
|
|
28
|
+
:href="generateFileLink(source)"
|
|
29
|
+
target="_blank"
|
|
30
|
+
>
|
|
31
|
+
View {{ source.name }}
|
|
32
|
+
</a>
|
|
23
33
|
</li>
|
|
24
34
|
</template>
|
|
25
35
|
</ul>
|
|
@@ -31,9 +41,7 @@
|
|
|
31
41
|
<ul class="source-data-list">
|
|
32
42
|
<template v-for="(source, i) in flatmapSource" :key="'flatmap-' + i">
|
|
33
43
|
<li>
|
|
34
|
-
<span @click="flatmapClick(source)">
|
|
35
|
-
For {{ source.name }}
|
|
36
|
-
</span>
|
|
44
|
+
<span @click="flatmapClick(source)">For {{ source.name }}</span>
|
|
37
45
|
</li>
|
|
38
46
|
</template>
|
|
39
47
|
</ul>
|
|
@@ -41,45 +49,75 @@
|
|
|
41
49
|
<div>
|
|
42
50
|
<!-- Show sampeles and views seperately if they do not match -->
|
|
43
51
|
<template v-if="!samplesUnderViews">
|
|
44
|
-
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">
|
|
45
|
-
|
|
52
|
+
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">
|
|
53
|
+
Scaffold Views
|
|
54
|
+
</div>
|
|
55
|
+
<template v-for="(view, i) in contextData.views" :key="i + '_1'">
|
|
46
56
|
<div @click="openViewFile(view)" class="context-card-view">
|
|
47
|
-
<img class="view-image" :src="getFileFromPath(view.thumbnail)"
|
|
48
|
-
<div class="view-description">{{view.description}}</div>
|
|
57
|
+
<img class="view-image" :src="getFileFromPath(view.thumbnail)" />
|
|
58
|
+
<div class="view-description">{{ view.description }}</div>
|
|
49
59
|
</div>
|
|
50
|
-
<div class="padding"/>
|
|
60
|
+
<div class="padding" />
|
|
51
61
|
</template>
|
|
52
|
-
<div style="margin-bottom: 16px
|
|
53
|
-
<div v-if="contextData.samples && contextData.samples.length > 0" class="subtitle">
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
<div style="margin-bottom: 16px" />
|
|
63
|
+
<div v-if="contextData.samples && contextData.samples.length > 0" class="subtitle">
|
|
64
|
+
Samples on Scaffold
|
|
65
|
+
</div>
|
|
66
|
+
<template v-for="(sample, i) in contextData.samples" :key="i + '_3'">
|
|
67
|
+
<span class="context-card-item cursor-pointer" @click="toggleSampleDetails(i)">
|
|
68
|
+
<div v-bind:key="i + '_6'" style="display: flex">
|
|
69
|
+
<div
|
|
70
|
+
v-if="sample.color"
|
|
71
|
+
class="color-box"
|
|
72
|
+
:style="'background-color:' + sample.color"
|
|
73
|
+
></div>
|
|
74
|
+
<img
|
|
75
|
+
class="key-image"
|
|
76
|
+
v-else-if="sample.thumbnail"
|
|
77
|
+
:src="getFileFromPath(sample.thumbnail)"
|
|
78
|
+
/>
|
|
79
|
+
{{ sample.heading }}
|
|
80
|
+
<i class="el-icon-warning-outline info"></i>
|
|
81
|
+
</div>
|
|
82
|
+
</span>
|
|
83
|
+
<div v-if="sampleDetails[i]" v-html="sample.description" />
|
|
84
|
+
<a
|
|
85
|
+
v-if="sampleDetails[i] && sample.path"
|
|
86
|
+
:href="generateFileLink(sample)"
|
|
87
|
+
target="_blank"
|
|
88
|
+
>
|
|
89
|
+
View Source
|
|
90
|
+
</a>
|
|
91
|
+
<div class="padding" />
|
|
66
92
|
</template>
|
|
67
93
|
</template>
|
|
68
94
|
|
|
69
95
|
<!-- Show samples under views if the ids match -->
|
|
70
96
|
<template v-else>
|
|
71
|
-
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
<div v-if="contextData.views && contextData.views.length > 0" class="subtitle">
|
|
98
|
+
Scaffold Views
|
|
99
|
+
</div>
|
|
100
|
+
<template v-for="(view, i) in contextData.views" :key="i + '_1'">
|
|
101
|
+
<span @click="viewClicked(view, i)" class="context-card-view">
|
|
102
|
+
<img class="view-image" :src="getFileFromPath(view.thumbnail)" />
|
|
103
|
+
<div class="view-description">
|
|
104
|
+
{{ view.description }}
|
|
105
|
+
<i class="el-icon-warning-outline info"></i>
|
|
106
|
+
</div>
|
|
76
107
|
</span>
|
|
77
|
-
<div v-if="sampleDetails[i]" v-html="samplesMatching(view.id).description"/>
|
|
78
|
-
<a
|
|
79
|
-
|
|
108
|
+
<div v-if="sampleDetails[i]" v-html="samplesMatching(view.id).description" />
|
|
109
|
+
<a
|
|
110
|
+
v-bind:key="i + '_5'"
|
|
111
|
+
v-if="sampleDetails[i] && samplesMatching(view.id).path"
|
|
112
|
+
:href="generateFileLink(samplesMatching(view.id))"
|
|
113
|
+
target="_blank"
|
|
114
|
+
>
|
|
115
|
+
View Source
|
|
116
|
+
</a>
|
|
117
|
+
<div class="padding" />
|
|
80
118
|
|
|
81
119
|
<!-- Extra padding if sample details is open -->
|
|
82
|
-
<div v-if="sampleDetails[i]" class="padding"/>
|
|
120
|
+
<div v-if="sampleDetails[i]" class="padding" />
|
|
83
121
|
</template>
|
|
84
122
|
</template>
|
|
85
123
|
</div>
|
|
@@ -94,34 +132,32 @@
|
|
|
94
132
|
</div>
|
|
95
133
|
</template>
|
|
96
134
|
|
|
97
|
-
|
|
98
135
|
<script>
|
|
99
|
-
|
|
100
|
-
import { CopyToClipboard } from "@abi-software/map-utilities";
|
|
136
|
+
import { CopyToClipboard } from '@abi-software/map-utilities';
|
|
101
137
|
import { mapStores } from 'pinia';
|
|
102
138
|
import tagging from '../services/tagging';
|
|
103
139
|
import '@abi-software/map-utilities/dist/style.css';
|
|
104
140
|
import EventBus from './EventBus';
|
|
105
141
|
//provide the s3Bucket related methods and data.
|
|
106
|
-
import S3Bucket from
|
|
142
|
+
import S3Bucket from '../mixins/S3Bucket.vue';
|
|
107
143
|
import { useSettingsStore } from '../stores/settings';
|
|
108
144
|
|
|
109
|
-
import { marked } from 'marked'
|
|
110
|
-
import xss from 'xss'
|
|
145
|
+
import { marked } from 'marked';
|
|
146
|
+
import xss from 'xss';
|
|
111
147
|
|
|
112
|
-
const addFilesToPathIfMissing = function(path){
|
|
113
|
-
if (!path.includes('files')){
|
|
114
|
-
return 'files/' + path
|
|
148
|
+
const addFilesToPathIfMissing = function (path) {
|
|
149
|
+
if (!path.includes('files')) {
|
|
150
|
+
return 'files/' + path;
|
|
115
151
|
} else {
|
|
116
|
-
return path
|
|
152
|
+
return path;
|
|
117
153
|
}
|
|
118
|
-
}
|
|
154
|
+
};
|
|
119
155
|
|
|
120
|
-
const convertBackslashToForwardSlash = function(path){
|
|
121
|
-
path = path.replaceAll('\\','/')
|
|
122
|
-
path = path.replaceAll('\\\\', '/')
|
|
123
|
-
return path
|
|
124
|
-
}
|
|
156
|
+
const convertBackslashToForwardSlash = function (path) {
|
|
157
|
+
path = path.replaceAll('\\', '/');
|
|
158
|
+
path = path.replaceAll('\\\\', '/');
|
|
159
|
+
return path;
|
|
160
|
+
};
|
|
125
161
|
|
|
126
162
|
// const switchPathToDirectory = function(path){
|
|
127
163
|
// let newPath = path.split('/')
|
|
@@ -129,9 +165,8 @@ const convertBackslashToForwardSlash = function(path){
|
|
|
129
165
|
// return newPath.join('/')
|
|
130
166
|
// }
|
|
131
167
|
|
|
132
|
-
|
|
133
168
|
export default {
|
|
134
|
-
name:
|
|
169
|
+
name: 'contextCard',
|
|
135
170
|
components: {
|
|
136
171
|
CopyToClipboard,
|
|
137
172
|
},
|
|
@@ -154,77 +189,77 @@ export default {
|
|
|
154
189
|
loadingOriginalSource: true,
|
|
155
190
|
originalSource: [],
|
|
156
191
|
flatmapSource: [],
|
|
157
|
-
activeName:
|
|
158
|
-
copyContent:
|
|
192
|
+
activeName: '',
|
|
193
|
+
copyContent: '',
|
|
159
194
|
};
|
|
160
195
|
},
|
|
161
196
|
watch: {
|
|
162
197
|
'entry.contextCardUrl': {
|
|
163
|
-
handler(val){
|
|
198
|
+
handler(val) {
|
|
164
199
|
if (val) {
|
|
165
200
|
// used for hardcoding data
|
|
166
|
-
if (val === true){
|
|
167
|
-
console.error('asked for hardcoding but none provided')
|
|
201
|
+
if (val === true) {
|
|
202
|
+
console.error('asked for hardcoding but none provided');
|
|
168
203
|
} else {
|
|
169
|
-
this.getContextFile(val)
|
|
170
|
-
this.showContextCard = true
|
|
204
|
+
this.getContextFile(val);
|
|
205
|
+
this.showContextCard = true;
|
|
171
206
|
}
|
|
172
207
|
} else {
|
|
173
|
-
this.showContextCard = false
|
|
208
|
+
this.showContextCard = false;
|
|
174
209
|
}
|
|
175
210
|
},
|
|
176
|
-
immediate: true
|
|
211
|
+
immediate: true,
|
|
177
212
|
},
|
|
178
213
|
'entry.s3uri': {
|
|
179
|
-
handler(val){
|
|
214
|
+
handler(val) {
|
|
180
215
|
this.updateS3Bucket(val);
|
|
181
216
|
},
|
|
182
|
-
immediate: true
|
|
183
|
-
}
|
|
217
|
+
immediate: true,
|
|
218
|
+
},
|
|
184
219
|
},
|
|
185
220
|
computed: {
|
|
186
221
|
...mapStores(useSettingsStore),
|
|
187
|
-
flatmapAPI: function() {
|
|
222
|
+
flatmapAPI: function () {
|
|
188
223
|
return this.settingsStore.flatmapAPI;
|
|
189
224
|
},
|
|
190
|
-
samplesUnderViews: function(){
|
|
191
|
-
if (this.contextData){
|
|
192
|
-
if (this.contextData.samplesUnderViews){
|
|
193
|
-
return true
|
|
225
|
+
samplesUnderViews: function () {
|
|
226
|
+
if (this.contextData) {
|
|
227
|
+
if (this.contextData.samplesUnderViews) {
|
|
228
|
+
return true;
|
|
194
229
|
} else {
|
|
195
|
-
let viewId = this.contextData.views?.map(v=>v.id) || [];
|
|
196
|
-
let samplesView = this.contextData.samples?.map(s=>s.view) || [];
|
|
230
|
+
let viewId = this.contextData.views?.map((v) => v.id) || [];
|
|
231
|
+
let samplesView = this.contextData.samples?.map((s) => s.view) || [];
|
|
197
232
|
|
|
198
233
|
// get matching values
|
|
199
|
-
let matching = viewId.filter(v=>samplesView.includes(v))
|
|
234
|
+
let matching = viewId.filter((v) => samplesView.includes(v));
|
|
200
235
|
|
|
201
236
|
// check all arrays have the same length (which means all values are in all three)
|
|
202
|
-
if (
|
|
203
|
-
return true
|
|
237
|
+
if (viewId.length === matching.length && matching.length === samplesView.length) {
|
|
238
|
+
return true;
|
|
204
239
|
}
|
|
205
240
|
}
|
|
206
241
|
}
|
|
207
242
|
return false;
|
|
208
243
|
},
|
|
209
|
-
banner: function(){
|
|
210
|
-
if (this.contextData.banner){
|
|
211
|
-
return this.getFileFromPath(this.contextData.banner)
|
|
244
|
+
banner: function () {
|
|
245
|
+
if (this.contextData.banner) {
|
|
246
|
+
return this.getFileFromPath(this.contextData.banner);
|
|
212
247
|
} else if (this.contextData && this.contextData.views && this.contextData.views.length > 0) {
|
|
213
|
-
if(this.contextData.views[0].thumbnail){
|
|
214
|
-
return this.getFileFromPath(this.contextData.views[0].thumbnail)
|
|
248
|
+
if (this.contextData.views[0].thumbnail) {
|
|
249
|
+
return this.getFileFromPath(this.contextData.views[0].thumbnail);
|
|
215
250
|
}
|
|
216
251
|
}
|
|
217
|
-
return this.entry.banner
|
|
252
|
+
return this.entry.banner;
|
|
218
253
|
},
|
|
219
254
|
},
|
|
220
255
|
methods: {
|
|
221
|
-
flatmapClick: function(source) {
|
|
256
|
+
flatmapClick: function (source) {
|
|
222
257
|
const newView = {
|
|
223
|
-
type:
|
|
258
|
+
type: 'Flatmap',
|
|
224
259
|
resource: source.flatmapUUID,
|
|
225
|
-
label: this.contextData.heading
|
|
260
|
+
label: this.contextData.heading,
|
|
226
261
|
};
|
|
227
|
-
EventBus.emit(
|
|
262
|
+
EventBus.emit('CreateNewEntry', newView);
|
|
228
263
|
},
|
|
229
264
|
updateCopyContent: function () {
|
|
230
265
|
const contentArray = [];
|
|
@@ -244,7 +279,7 @@ export default {
|
|
|
244
279
|
let sourceDataLinks = '<div><strong>Source data links</strong></div>';
|
|
245
280
|
const sourceLinks = [];
|
|
246
281
|
|
|
247
|
-
this.originalSource.forEach((source
|
|
282
|
+
this.originalSource.forEach((source) => {
|
|
248
283
|
const path = this.generateFileLink(source);
|
|
249
284
|
let sourceContent = `<div>${source.name}</div>`;
|
|
250
285
|
sourceContent += `\n`;
|
|
@@ -260,11 +295,11 @@ export default {
|
|
|
260
295
|
let flatmapDataLinks = '<div><strong>Associated flatmaps from source</strong></div>';
|
|
261
296
|
const flatmapLinks = [];
|
|
262
297
|
|
|
263
|
-
this.flatmapSource.forEach((source
|
|
264
|
-
const path = this.generateFileLink(source);
|
|
298
|
+
this.flatmapSource.forEach((source) => {
|
|
265
299
|
let flatmapContent = `<div>${source.name}</div>`;
|
|
266
|
-
let flatmapSource = this.flatmapAPI
|
|
267
|
-
`${this.flatmapAPI}viewer?id=${source.flatmapUUID}`
|
|
300
|
+
let flatmapSource = this.flatmapAPI
|
|
301
|
+
? `${this.flatmapAPI}viewer?id=${source.flatmapUUID}`
|
|
302
|
+
: source.flatmapUUID;
|
|
268
303
|
flatmapContent += `\n`;
|
|
269
304
|
flatmapContent += `<div><a href="${flatmapSource}">${flatmapSource}</a></div>`;
|
|
270
305
|
flatmapLinks.push(`<li>${flatmapContent}</li>`);
|
|
@@ -278,7 +313,7 @@ export default {
|
|
|
278
313
|
let scaffoldViews = '<div><strong>Scaffold Views</strong></div>';
|
|
279
314
|
const views = [];
|
|
280
315
|
|
|
281
|
-
this.contextData.views.forEach((view
|
|
316
|
+
this.contextData.views.forEach((view) => {
|
|
282
317
|
const viewContents = [];
|
|
283
318
|
const viewPath = this.getFileFromPath(view.path);
|
|
284
319
|
let viewContent = `<div>${view.description}</div>`;
|
|
@@ -310,7 +345,7 @@ export default {
|
|
|
310
345
|
let sampleViews = '<div><strong>Samples on Scaffold</strong></div>';
|
|
311
346
|
const samples = [];
|
|
312
347
|
|
|
313
|
-
this.contextData.samples.forEach((sample
|
|
348
|
+
this.contextData.samples.forEach((sample) => {
|
|
314
349
|
let sampleContents = '';
|
|
315
350
|
sampleContents += `<div>${sample.heading}</div>`;
|
|
316
351
|
sampleContents += `\n`;
|
|
@@ -330,94 +365,98 @@ export default {
|
|
|
330
365
|
|
|
331
366
|
return contentArray.join('\n\n<br>');
|
|
332
367
|
},
|
|
333
|
-
samplesMatching: function(viewId){
|
|
334
|
-
if (this.contextData && this.contextData.samples){
|
|
335
|
-
return this.contextData.samples.filter(s=>s.view == viewId)[0]
|
|
336
|
-
}
|
|
337
|
-
else return []
|
|
368
|
+
samplesMatching: function (viewId) {
|
|
369
|
+
if (this.contextData && this.contextData.samples) {
|
|
370
|
+
return this.contextData.samples.filter((s) => s.view == viewId)[0];
|
|
371
|
+
} else return [];
|
|
338
372
|
},
|
|
339
|
-
viewClicked: function(view, i){
|
|
340
|
-
this.openViewFile(view)
|
|
341
|
-
this.toggleSampleDetails(i)
|
|
373
|
+
viewClicked: function (view, i) {
|
|
374
|
+
this.openViewFile(view);
|
|
375
|
+
this.toggleSampleDetails(i);
|
|
342
376
|
},
|
|
343
377
|
getContextFile: function (contextFileUrl) {
|
|
344
|
-
this.loading = true
|
|
378
|
+
this.loading = true;
|
|
345
379
|
fetch(contextFileUrl)
|
|
346
|
-
.then((response) =>{
|
|
347
|
-
if (!response.ok){
|
|
348
|
-
throw Error(response.statusText)
|
|
380
|
+
.then((response) => {
|
|
381
|
+
if (!response.ok) {
|
|
382
|
+
throw Error(response.statusText);
|
|
349
383
|
} else {
|
|
350
|
-
|
|
384
|
+
return response.json();
|
|
351
385
|
}
|
|
352
386
|
})
|
|
353
387
|
.then((data) => {
|
|
354
|
-
this.contextData = data
|
|
355
|
-
this.loading = false
|
|
356
|
-
this.addDiscoverIdsToContextData()
|
|
388
|
+
this.contextData = data;
|
|
389
|
+
this.loading = false;
|
|
390
|
+
this.addDiscoverIdsToContextData();
|
|
357
391
|
})
|
|
358
392
|
.catch((err) => {
|
|
359
393
|
//set defaults if we hit an error
|
|
360
|
-
console.error('caught error!', err)
|
|
361
|
-
this.loading = false
|
|
394
|
+
console.error('caught error!', err);
|
|
395
|
+
this.loading = false;
|
|
362
396
|
});
|
|
363
397
|
},
|
|
364
|
-
removeDoubleFilesPath: function(path){
|
|
398
|
+
removeDoubleFilesPath: function (path) {
|
|
365
399
|
if (path) {
|
|
366
|
-
if (path.includes('files/')){
|
|
367
|
-
return path.replace('files/', '')
|
|
400
|
+
if (path.includes('files/')) {
|
|
401
|
+
return path.replace('files/', '');
|
|
368
402
|
} else if (path.includes('files\\')) {
|
|
369
|
-
return path.replace('files\\', '')
|
|
403
|
+
return path.replace('files\\', '');
|
|
370
404
|
} else {
|
|
371
|
-
return path
|
|
405
|
+
return path;
|
|
372
406
|
}
|
|
373
407
|
}
|
|
374
408
|
},
|
|
375
|
-
toggleSampleDetails: function(i){
|
|
376
|
-
if (this.sampleDetails[i] === undefined){
|
|
409
|
+
toggleSampleDetails: function (i) {
|
|
410
|
+
if (this.sampleDetails[i] === undefined) {
|
|
377
411
|
this.sampleDetails[i] = true;
|
|
378
412
|
} else {
|
|
379
413
|
this.sampleDetails[i] = !this.sampleDetails[i];
|
|
380
414
|
}
|
|
381
415
|
},
|
|
382
|
-
getFileFromPath: function(path){
|
|
416
|
+
getFileFromPath: function (path) {
|
|
383
417
|
// for hardcoded data
|
|
384
|
-
if(this.entry.contextCardUrl === true){
|
|
385
|
-
return path
|
|
418
|
+
if (this.entry.contextCardUrl === true) {
|
|
419
|
+
return path;
|
|
386
420
|
}
|
|
387
|
-
path = this.removeDoubleFilesPath(path)
|
|
388
|
-
return
|
|
421
|
+
path = this.removeDoubleFilesPath(path);
|
|
422
|
+
return `${this.envVars.API_LOCATION}s3-resource/${this.getS3Prefix()}files/${path}${this.getS3Args()}`;
|
|
389
423
|
},
|
|
390
424
|
// This is used later when generateing links to the resource on sparc.science (see generateFileLink)
|
|
391
|
-
addDiscoverIdsToContextData(){
|
|
392
|
-
this.contextData.samples.forEach((sample, i)=>{
|
|
393
|
-
if (sample && sample.doi && sample.doi !==
|
|
394
|
-
fetch(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
425
|
+
addDiscoverIdsToContextData() {
|
|
426
|
+
this.contextData.samples.forEach((sample, i) => {
|
|
427
|
+
if (sample && sample.doi && sample.doi !== '') {
|
|
428
|
+
fetch(
|
|
429
|
+
`${this.envVars.PENNSIEVE_API_LOCATION}/discover/datasets/doi/${this.splitDoiFromUrl(sample.doi)}`,
|
|
430
|
+
)
|
|
431
|
+
.then((response) => response.json())
|
|
432
|
+
.then((data) => {
|
|
433
|
+
this.contextData.samples[i].discoverId = data.id;
|
|
434
|
+
this.contextData.samples[i].version = data.version;
|
|
435
|
+
});
|
|
400
436
|
} else {
|
|
401
|
-
|
|
402
|
-
|
|
437
|
+
this.contextData.samples[i].discoverId = this.entry.discoverId;
|
|
438
|
+
this.contextData.samples[i].version = this.entry.version;
|
|
403
439
|
}
|
|
404
|
-
})
|
|
440
|
+
});
|
|
405
441
|
},
|
|
406
|
-
processPathForUrl(path){
|
|
407
|
-
path = convertBackslashToForwardSlash(path)
|
|
408
|
-
path = addFilesToPathIfMissing(path)
|
|
409
|
-
return encodeURIComponent(path)
|
|
442
|
+
processPathForUrl(path) {
|
|
443
|
+
path = convertBackslashToForwardSlash(path);
|
|
444
|
+
path = addFilesToPathIfMissing(path);
|
|
445
|
+
return encodeURIComponent(path);
|
|
410
446
|
},
|
|
411
|
-
splitDoiFromUrl(url){
|
|
412
|
-
return url.split('https://doi.org/').pop()
|
|
447
|
+
splitDoiFromUrl(url) {
|
|
448
|
+
return url.split('https://doi.org/').pop();
|
|
413
449
|
},
|
|
414
|
-
generateFileLink(sample){
|
|
450
|
+
generateFileLink(sample) {
|
|
415
451
|
const path = this.processPathForUrl(sample.path);
|
|
416
452
|
const version = sample.version || '';
|
|
417
453
|
let link = '';
|
|
418
454
|
|
|
419
455
|
if (sample.datasetURL) {
|
|
420
|
-
const datasetFileURL = sample.datasetURL.replace(
|
|
456
|
+
const datasetFileURL = sample.datasetURL.replace(
|
|
457
|
+
/datasets\/(\d+)\/version\/(\d+)/,
|
|
458
|
+
'datasets/file/$1/$2',
|
|
459
|
+
);
|
|
421
460
|
link = `${datasetFileURL}?path=${path}`;
|
|
422
461
|
} else if (sample.discoverId) {
|
|
423
462
|
link = `${this.envVars.ROOT_URL}/datasets/file/${sample.discoverId}/${version}?path=${path}`;
|
|
@@ -425,15 +464,15 @@ export default {
|
|
|
425
464
|
|
|
426
465
|
return link;
|
|
427
466
|
},
|
|
428
|
-
parseMarkdown(markdown){
|
|
429
|
-
const returned_data = xss(marked.parse(markdown))
|
|
430
|
-
this.$emit('context-ready')
|
|
431
|
-
return returned_data
|
|
467
|
+
parseMarkdown(markdown) {
|
|
468
|
+
const returned_data = xss(marked.parse(markdown));
|
|
469
|
+
this.$emit('context-ready');
|
|
470
|
+
return returned_data;
|
|
432
471
|
},
|
|
433
|
-
openViewFile: function(view){
|
|
472
|
+
openViewFile: function (view) {
|
|
434
473
|
// note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
|
|
435
|
-
const viewUrl = this.getFileFromPath(view.path)
|
|
436
|
-
this.$emit(
|
|
474
|
+
const viewUrl = this.getFileFromPath(view.path);
|
|
475
|
+
this.$emit('scaffold-view-clicked', viewUrl);
|
|
437
476
|
},
|
|
438
477
|
fetchDOIURL: async function (doi) {
|
|
439
478
|
const doiKey = doi.includes('https://doi.org/') ? this.splitDoiFromUrl(doi) : doi;
|
|
@@ -446,86 +485,86 @@ export default {
|
|
|
446
485
|
}
|
|
447
486
|
const data = await response.json();
|
|
448
487
|
|
|
449
|
-
const urlEntry = data.values?.find(item => item.type === 'URL');
|
|
488
|
+
const urlEntry = data.values?.find((item) => item.type === 'URL');
|
|
450
489
|
|
|
451
490
|
if (urlEntry && urlEntry.data && urlEntry.data.value) {
|
|
452
491
|
return urlEntry.data.value;
|
|
453
492
|
}
|
|
454
493
|
|
|
455
|
-
throw new Error(
|
|
494
|
+
throw new Error('Redirect URL not found in DOI metadata');
|
|
456
495
|
} catch (error) {
|
|
457
|
-
throw new Error(error);
|
|
496
|
+
throw new Error('Failed to resolve DOI redirect URL', { cause: error });
|
|
458
497
|
}
|
|
459
498
|
},
|
|
460
|
-
getOriginalSource: function() {
|
|
461
|
-
const discoverId = this.entry.discoverId
|
|
462
|
-
const filesPos = 'files/'.length
|
|
463
|
-
const path =
|
|
464
|
-
this.entry.resource.indexOf(
|
|
465
|
-
this.entry.resource.lastIndexOf(
|
|
499
|
+
getOriginalSource: function () {
|
|
500
|
+
const discoverId = this.entry.discoverId;
|
|
501
|
+
const filesPos = 'files/'.length;
|
|
502
|
+
const path = this.entry.resource.substring(
|
|
503
|
+
this.entry.resource.indexOf('files/') + filesPos,
|
|
504
|
+
this.entry.resource.lastIndexOf('?'),
|
|
505
|
+
);
|
|
466
506
|
const params = new URLSearchParams({
|
|
467
507
|
discoverId,
|
|
468
|
-
path
|
|
508
|
+
path,
|
|
469
509
|
});
|
|
470
|
-
const url = `${this.envVars.API_LOCATION}/file_info/get_original_source?${params.toString()}
|
|
510
|
+
const url = `${this.envVars.API_LOCATION}/file_info/get_original_source?${params.toString()}`;
|
|
471
511
|
fetch(url)
|
|
472
|
-
.then((response) =>{
|
|
473
|
-
if (!response.ok){
|
|
474
|
-
throw Error(response.statusText)
|
|
512
|
+
.then((response) => {
|
|
513
|
+
if (!response.ok) {
|
|
514
|
+
throw Error(response.statusText);
|
|
475
515
|
} else {
|
|
476
|
-
|
|
516
|
+
return response.json();
|
|
477
517
|
}
|
|
478
518
|
})
|
|
479
519
|
.then((data) => {
|
|
480
|
-
this.loadingOriginalSource = false
|
|
520
|
+
this.loadingOriginalSource = false;
|
|
481
521
|
if (data.result) {
|
|
482
522
|
data.result.forEach(async (result) => {
|
|
483
523
|
if (result.doi) {
|
|
484
524
|
const datasetURL = await this.fetchDOIURL(result.doi);
|
|
485
|
-
result.datasetURL = datasetURL
|
|
486
|
-
result.name = result.name || result.path.split('/').pop()
|
|
525
|
+
result.datasetURL = datasetURL;
|
|
526
|
+
result.name = result.name || result.path.split('/').pop();
|
|
487
527
|
}
|
|
488
528
|
if (result.flatmapUUID) {
|
|
489
|
-
this.flatmapSource.push(result)
|
|
529
|
+
this.flatmapSource.push(result);
|
|
490
530
|
} else {
|
|
491
|
-
this.originalSource.push(result)
|
|
531
|
+
this.originalSource.push(result);
|
|
492
532
|
}
|
|
493
|
-
})
|
|
533
|
+
});
|
|
494
534
|
if (this.flatmapSource.length || this.originalSource.length) {
|
|
495
|
-
this.copyContent = this.updateCopyContent()
|
|
535
|
+
this.copyContent = this.updateCopyContent();
|
|
496
536
|
}
|
|
497
537
|
}
|
|
498
|
-
this.loadingOriginalSource = false
|
|
538
|
+
this.loadingOriginalSource = false;
|
|
499
539
|
})
|
|
500
540
|
.catch((err) => {
|
|
501
541
|
//set defaults if we hit an error
|
|
502
|
-
console.error('caught error!', err)
|
|
503
|
-
this.loadingOriginalSource = false
|
|
542
|
+
console.error('caught error!', err);
|
|
543
|
+
this.loadingOriginalSource = false;
|
|
504
544
|
});
|
|
505
545
|
},
|
|
506
546
|
onCopied: function () {
|
|
507
547
|
const { label, type, discoverId } = this.entry;
|
|
508
548
|
const category = type ? `${label} ${type}` : label;
|
|
509
549
|
tagging.sendEvent({
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
550
|
+
event: 'interaction_event',
|
|
551
|
+
event_name: `portal_maps_context_card_copy`,
|
|
552
|
+
category: category || '',
|
|
553
|
+
location: 'map_toolbar',
|
|
554
|
+
dataset_id: discoverId ? discoverId + '' : '',
|
|
515
555
|
});
|
|
516
|
-
}
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
mounted: function () {
|
|
559
|
+
this.copyContent = this.updateCopyContent();
|
|
560
|
+
this.getOriginalSource();
|
|
517
561
|
},
|
|
518
|
-
mounted: function() {
|
|
519
|
-
this.copyContent = this.updateCopyContent()
|
|
520
|
-
this.getOriginalSource()
|
|
521
|
-
}
|
|
522
562
|
};
|
|
523
563
|
</script>
|
|
524
564
|
|
|
525
565
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
526
566
|
<style scoped lang="scss">
|
|
527
|
-
|
|
528
|
-
.hide{
|
|
567
|
+
.hide {
|
|
529
568
|
color: #e4e7ed;
|
|
530
569
|
cursor: pointer;
|
|
531
570
|
}
|
|
@@ -548,7 +587,7 @@ export default {
|
|
|
548
587
|
}
|
|
549
588
|
}
|
|
550
589
|
|
|
551
|
-
.context-card{
|
|
590
|
+
.context-card {
|
|
552
591
|
background-color: white;
|
|
553
592
|
font-size: 14px;
|
|
554
593
|
position: relative;
|
|
@@ -566,7 +605,7 @@ export default {
|
|
|
566
605
|
}
|
|
567
606
|
}
|
|
568
607
|
|
|
569
|
-
.context-card-view{
|
|
608
|
+
.context-card-view {
|
|
570
609
|
cursor: pointer;
|
|
571
610
|
margin-bottom: 8px;
|
|
572
611
|
display: flex;
|
|
@@ -588,7 +627,7 @@ export default {
|
|
|
588
627
|
width: 516px;
|
|
589
628
|
}
|
|
590
629
|
|
|
591
|
-
.context-image{
|
|
630
|
+
.context-image {
|
|
592
631
|
width: 150px;
|
|
593
632
|
height: auto;
|
|
594
633
|
}
|
|
@@ -601,8 +640,8 @@ export default {
|
|
|
601
640
|
margin-right: 8px;
|
|
602
641
|
}
|
|
603
642
|
|
|
604
|
-
.card-left{
|
|
605
|
-
flex: 0.8
|
|
643
|
+
.card-left {
|
|
644
|
+
flex: 0.8;
|
|
606
645
|
}
|
|
607
646
|
|
|
608
647
|
.card-right {
|
|
@@ -623,7 +662,7 @@ export default {
|
|
|
623
662
|
cursor: pointer;
|
|
624
663
|
}
|
|
625
664
|
|
|
626
|
-
.info{
|
|
665
|
+
.info {
|
|
627
666
|
transform: rotate(180deg);
|
|
628
667
|
color: $app-primary-color;
|
|
629
668
|
margin-left: 8px;
|
|
@@ -633,11 +672,11 @@ export default {
|
|
|
633
672
|
margin-bottom: 8px;
|
|
634
673
|
}
|
|
635
674
|
|
|
636
|
-
.title{
|
|
675
|
+
.title {
|
|
637
676
|
font-weight: bold;
|
|
638
677
|
}
|
|
639
678
|
|
|
640
|
-
.subtitle{
|
|
679
|
+
.subtitle {
|
|
641
680
|
font-weight: bold;
|
|
642
681
|
margin-bottom: 8px;
|
|
643
682
|
}
|
|
@@ -678,13 +717,13 @@ export default {
|
|
|
678
717
|
|
|
679
718
|
.context-card-container {
|
|
680
719
|
a {
|
|
681
|
-
color: #
|
|
720
|
+
color: #8300bf;
|
|
682
721
|
}
|
|
683
722
|
}
|
|
684
723
|
|
|
685
724
|
.source-data-list {
|
|
686
725
|
span {
|
|
687
|
-
color: #
|
|
726
|
+
color: #8300bf;
|
|
688
727
|
text-decoration: underline;
|
|
689
728
|
cursor: pointer;
|
|
690
729
|
}
|