|
1 | 1 | <template> |
2 | 2 | <v-card flat tile class="d-flex flex-column"> |
| 3 | + <v-overlay v-model="overlay"> |
| 4 | + <v-row align="center" justify="center"><label >Loading metedata...</label> </v-row> |
| 5 | + <v-row align="center" justify="center"><v-progress-circular |
| 6 | + color="primary" |
| 7 | + indeterminate |
| 8 | + size="64" |
| 9 | + ></v-progress-circular></v-row> |
| 10 | + |
| 11 | + </v-overlay> |
3 | 12 | <confirm ref="confirm"></confirm> |
4 | 13 | <file-viewer-dialog ref="fileviewer"></file-viewer-dialog> |
5 | 14 | <name-modify-dialog ref="namemodify"></name-modify-dialog> |
|
203 | 212 | <span>View file</span> |
204 | 213 | </v-tooltip> |
205 | 214 |
|
| 215 | + <v-tooltip bottom v-if="canMetadata(item)"> |
| 216 | + <template v-slot:activator="{ on }"> |
| 217 | + <v-btn icon @click.stop="viewMetadata(item)" v-on="on"> |
| 218 | + <v-icon >mdi-tag</v-icon> |
| 219 | + </v-btn> |
| 220 | + </template> |
| 221 | + <span>View Metadata</span> |
| 222 | + </v-tooltip> |
| 223 | + |
206 | 224 | <v-tooltip bottom> |
207 | 225 | <template v-slot:activator="{ on }"> |
208 | 226 | <v-btn icon @click.stop="copyItemPathToClipboard(item)" v-on="on"> |
@@ -285,6 +303,9 @@ import FilesAPI from "@/api/FilesAPI" |
285 | 303 | import Vue from 'vue' |
286 | 304 | import * as minimatch from 'minimatch' |
287 | 305 | import miscs from '@/utils/miscs.js' |
| 306 | +import ConfigurationAPI from "@/api/ConfigurationAPI.js" |
| 307 | +import PreferenceAPI from "@/api/PreferenceAPI" |
| 308 | + |
288 | 309 |
|
289 | 310 | export default { |
290 | 311 | name: 'List', |
@@ -324,7 +345,9 @@ export default { |
324 | 345 | {'type':'contains', 'label': 'Contains'}, |
325 | 346 | {'type':'custom', 'label': 'Custom'}], |
326 | 347 | caseSentive: false, |
327 | | - maxSize: 0 // in bytes |
| 348 | + maxSize: 0, // in bytes |
| 349 | + selectedtag: null, |
| 350 | + overlay: false |
328 | 351 | }; |
329 | 352 | }, |
330 | 353 | computed: { |
@@ -673,6 +696,39 @@ export default { |
673 | 696 | let extension = item.basename.split(".").pop() |
674 | 697 | return (item.type === "file" && ["txt", "out", "err", "json", "xml", "pref", "csv","rtx","rtf"].includes(extension) ) |
675 | 698 | }, |
| 699 | + canMetadata(item){ |
| 700 | + let extension = item.basename.split(".").pop() |
| 701 | + return (item.type === "file" && ["tif", "tiff", "ome-tiff", "nd2", "czi", "ims", "lif","oib"].includes(extension) ) |
| 702 | + }, |
| 703 | + |
| 704 | + async viewMetadata(item){ |
| 705 | + console.log("reading:" + item.path) |
| 706 | + console.log("reading:" + item.path) |
| 707 | + try{ |
| 708 | + this.overlay =true |
| 709 | + const response= await ConfigurationAPI.execute_metedata_script(btoa(item.path), this.selectedtag, false, false, false) |
| 710 | + this.overlay =false |
| 711 | + console.log(response) |
| 712 | + if(response.commandResult.length > 0){ |
| 713 | + let json_out = JSON.parse(response.commandResult[0].out) |
| 714 | + if (json_out.results.success) { |
| 715 | + await this.$refs.fileviewer.open( |
| 716 | + item.path, |
| 717 | + JSON.stringify(json_out.results.metadata, null, 2) |
| 718 | + ) |
| 719 | +
|
| 720 | + } |
| 721 | + } |
| 722 | + } |
| 723 | + catch(err){ |
| 724 | + Vue.notify({ |
| 725 | + group: 'sysnotif', |
| 726 | + type: 'error', |
| 727 | + title: 'View Metadata', |
| 728 | + text: 'Problem reading metadata:' + String(err) |
| 729 | + }) |
| 730 | + } |
| 731 | + }, |
676 | 732 | async viewItem(item){ |
677 | 733 | console.log("reading:" + item.path) |
678 | 734 | console.log("reading:" + item.path) |
@@ -711,9 +767,12 @@ export default { |
711 | 767 | } |
712 | 768 | }, |
713 | 769 | }, |
714 | | - mounted() { |
| 770 | + async mounted() { |
715 | 771 | this.filter = ""; |
716 | 772 | this.filterChanged(); |
| 773 | + let _current_api = await PreferenceAPI.get_config() |
| 774 | + this.selectedtag = _current_api.metadatatag |
| 775 | + |
717 | 776 | } |
718 | 777 | }; |
719 | 778 | </script> |
|
0 commit comments