1
1
<script lang="ts">
2
2
import {
3
- computed , defineComponent , PropType , reactive ,
3
+ computed , defineComponent , PropType , reactive , ref , Ref ,
4
4
} from ' @vue/composition-api' ;
5
5
import { flattenDeep } from ' lodash' ;
6
6
7
7
import { DataTableHeader } from ' vuetify' ;
8
8
import { humanFileSize } from ' @/data/utils' ;
9
- import { client , BiosampleSearchResult , OmicsProcessingResult } from ' @/data/api' ;
9
+ import {
10
+ client ,
11
+ BiosampleSearchResult ,
12
+ OmicsProcessingResult ,
13
+ api ,
14
+ } from ' @/data/api' ;
10
15
import { stateRefs , acceptTerms } from ' @/store' ;
11
16
import { metaproteomicCategoryEnumToDisplay } from ' @/encoding' ;
12
17
@@ -85,6 +90,25 @@ export default defineComponent({
85
90
},
86
91
];
87
92
93
+ const selectedHtmlDataObject: Ref <any | null > = ref (null );
94
+ const dataModal = ref (false );
95
+ const iframeDataSource = ref (' ' );
96
+ function hasHtmlData(fileType : string ) {
97
+ return [
98
+ ' Kraken2 Krona Plot' ,
99
+ ' GOTTCHA2 Krona Plot' ,
100
+ ' Centrifuge Krona Plot' ,
101
+ ].includes (fileType );
102
+ }
103
+ async function openHtmlDataModal(item : any ) {
104
+ iframeDataSource .value = await api .getDataObjectUrl (item .id );
105
+ selectedHtmlDataObject .value = item ;
106
+ dataModal .value = true ;
107
+ }
108
+ function handleIframeScroll(e ) {
109
+ console .log (e );
110
+ }
111
+
88
112
const termsDialog = reactive ({
89
113
item: null as null | OmicsProcessingResult ,
90
114
value: false ,
@@ -161,6 +185,12 @@ export default defineComponent({
161
185
}
162
186
163
187
return {
188
+ dataModal ,
189
+ hasHtmlData ,
190
+ openHtmlDataModal ,
191
+ selectedHtmlDataObject ,
192
+ iframeDataSource ,
193
+ handleIframeScroll ,
164
194
onAcceptTerms ,
165
195
handleDownload ,
166
196
descriptionMap ,
@@ -186,6 +216,38 @@ export default defineComponent({
186
216
@clicked =" onAcceptTerms"
187
217
/>
188
218
</v-dialog >
219
+ <v-dialog
220
+ v-if =" selectedHtmlDataObject !== null"
221
+ v-model =" dataModal"
222
+ scroll-strategy =" block"
223
+ width =" 80vw"
224
+ >
225
+ <v-card
226
+ class =" d-flex flex-column"
227
+ width =" 100%"
228
+ height =" 80vh"
229
+ >
230
+ <v-card-text class =" d-flex flex-grow-1" >
231
+ <span v-if =" !iframeDataSource" >Loading data</span >
232
+ <iframe
233
+ v-else
234
+ title =" iframe title"
235
+ :src =" iframeDataSource"
236
+ :style =" {border: 'none'}"
237
+ width =" 100%"
238
+ />
239
+ </v-card-text >
240
+ <v-card-actions class =" flex-row" >
241
+ <v-spacer />
242
+ <v-btn
243
+ text
244
+ @click =" dataModal = false"
245
+ >
246
+ Close
247
+ </v-btn >
248
+ </v-card-actions >
249
+ </v-card >
250
+ </v-dialog >
189
251
<v-data-table
190
252
:headers =" headers"
191
253
:items =" items"
@@ -251,7 +313,17 @@ export default defineComponent({
251
313
<span >This file is included in the currently selected bulk download</span >
252
314
</v-tooltip >
253
315
</td >
254
- <td >{{ item.file_type }}</td >
316
+ <td >
317
+ {{ item.file_type }}
318
+ <v-btn
319
+ v-if =" hasHtmlData(item.file_type)"
320
+ color =" primary"
321
+ icon
322
+ @click =" openHtmlDataModal(item)"
323
+ >
324
+ <v-icon >mdi-magnify</v-icon >
325
+ </v-btn >
326
+ </td >
255
327
<td >{{ item.file_type_description }}</td >
256
328
<td >{{ humanFileSize(item.file_size_bytes) }}</td >
257
329
<td >{{ item.downloads }}</td >
0 commit comments