Skip to content

Commit 6a69062

Browse files
committed
[UPDATED]- Added metadata tag to file manager
1 parent e0dcb13 commit 6a69062

1 file changed

Lines changed: 61 additions & 2 deletions

File tree

  • src/components/vuetify-file-browser

src/components/vuetify-file-browser/List.vue

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<template>
22
<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>
312
<confirm ref="confirm"></confirm>
413
<file-viewer-dialog ref="fileviewer"></file-viewer-dialog>
514
<name-modify-dialog ref="namemodify"></name-modify-dialog>
@@ -203,6 +212,15 @@
203212
<span>View file</span>
204213
</v-tooltip>
205214

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+
206224
<v-tooltip bottom>
207225
<template v-slot:activator="{ on }">
208226
<v-btn icon @click.stop="copyItemPathToClipboard(item)" v-on="on">
@@ -285,6 +303,9 @@ import FilesAPI from "@/api/FilesAPI"
285303
import Vue from 'vue'
286304
import * as minimatch from 'minimatch'
287305
import miscs from '@/utils/miscs.js'
306+
import ConfigurationAPI from "@/api/ConfigurationAPI.js"
307+
import PreferenceAPI from "@/api/PreferenceAPI"
308+
288309
289310
export default {
290311
name: 'List',
@@ -324,7 +345,9 @@ export default {
324345
{'type':'contains', 'label': 'Contains'},
325346
{'type':'custom', 'label': 'Custom'}],
326347
caseSentive: false,
327-
maxSize: 0 // in bytes
348+
maxSize: 0, // in bytes
349+
selectedtag: null,
350+
overlay: false
328351
};
329352
},
330353
computed: {
@@ -673,6 +696,39 @@ export default {
673696
let extension = item.basename.split(".").pop()
674697
return (item.type === "file" && ["txt", "out", "err", "json", "xml", "pref", "csv","rtx","rtf"].includes(extension) )
675698
},
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+
},
676732
async viewItem(item){
677733
console.log("reading:" + item.path)
678734
console.log("reading:" + item.path)
@@ -711,9 +767,12 @@ export default {
711767
}
712768
},
713769
},
714-
mounted() {
770+
async mounted() {
715771
this.filter = "";
716772
this.filterChanged();
773+
let _current_api = await PreferenceAPI.get_config()
774+
this.selectedtag = _current_api.metadatatag
775+
717776
}
718777
};
719778
</script>

0 commit comments

Comments
 (0)