Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added action icons for viewers #797

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 124 additions & 19 deletions components/FilesTable/FilesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,54 @@
<svg-icon slot="item" name="icon-view" height="1.5rem" width="1.5rem" />
</sparc-tooltip>
</div>
<div
v-if="isBiolucidaViewFile(scope)"
class="circle"
@click="openViewerFile(scope)"
>
<sparc-tooltip
placement="bottom-center"
content="Open Biolucida Viewer"
>
<svg-icon slot="item" name="icon-view" height="1.5rem" width="1.5rem" />
</sparc-tooltip>
</div>
<div
v-if="isPlotViewFile(scope)"
class="circle"
@click="openViewerFile(scope)"
>
<sparc-tooltip
placement="bottom-center"
content="Open Plot Viewer"
>
<svg-icon slot="item" name="icon-view" height="1.5rem" width="1.5rem" />
</sparc-tooltip>
</div>
<div
v-if="isVideoViewFile(scope)"
class="circle"
@click="openViewerFile(scope)"
>
<sparc-tooltip
placement="bottom-center"
content="Open Video Viewer"
>
<svg-icon slot="item" name="icon-view" height="1.5rem" width="1.5rem" />
</sparc-tooltip>
</div>
<div
v-if="isSegmentationViewFile(scope)"
class="circle"
@click="openViewerFile(scope)"
>
<sparc-tooltip
placement="bottom-center"
content="Open Segmentation Viewer"
>
<svg-icon slot="item" name="icon-view" height="1.5rem" width="1.5rem" />
</sparc-tooltip>
</div>
<div
class="circle"
@click="setDialogSelectedFile(scope)"
Expand All @@ -209,9 +257,9 @@
</sparc-tooltip>
</div>
<div
v-if="isTimeseriesFile(scope.row)"
v-if="isTimeseriesViewFile(scope.row)"
class="circle"
@click="openTimeseriesView(scope)"
@click="openViewerFile(scope)"
>
<sparc-tooltip
placement="bottom-center"
Expand Down Expand Up @@ -481,7 +529,7 @@ export default {
this.selected = val
},

isTimeseriesFile(file) {
isTimeseriesViewFile(file) {
const type = propOr('', 'packageType', file)
return type === 'TimeSeries' && process.env.SHOW_TIMESERIES_VIEWER
},
Expand Down Expand Up @@ -751,22 +799,6 @@ export default {
this.$router.push(scaffoldViewLink)
}
},

openTimeseriesView: function(scope) {
const route = {
name: 'file-datasetId-datasetVersion',
params: {
datasetId: this.datasetInfo.id,
datasetVersion: this.datasetInfo.version
},
query: {
path: s3Path(scope.row)
}
}

this.$router.push(route)
},

/**
* Checks if file is a scaffold view port
* @param {Object} scope
Expand Down Expand Up @@ -803,7 +835,80 @@ export default {
}
return false
},
isBiolucidaViewFile: function (scope) {
if (
this.datasetScicrunch &&
(this.datasetScicrunch['biolucida-2d'] || this.datasetScicrunch['biolucida-3d'])
) {
let biolucidaObjects = this.datasetScicrunch['biolucida-2d'].concat(this.datasetScicrunch['biolucida-3d']).filter((item) => item !== undefined)
let shortened = scope.row.path
shortened = shortened.replace('files/', '')
for (let i = 0; i < biolucidaObjects.length; i++) {
if (biolucidaObjects[i].dataset.path === shortened)
return true
}
}
return false
},
isPlotViewFile: function (scope) {
if (
this.datasetScicrunch &&
this.datasetScicrunch['abi-plot']
) {
let plotObjects = this.datasetScicrunch['abi-plot']
let shortened = scope.row.path
shortened = shortened.replace('files/', '')
for (let i = 0; i < plotObjects.length; i++) {
if (plotObjects[i].dataset.path === shortened)
return true
}
}
return false
},
isVideoViewFile: function (scope) {
if (
this.datasetScicrunch &&
this.datasetScicrunch['video']
) {
let videoObjects = this.datasetScicrunch['video']
let shortened = scope.row.path
shortened = shortened.replace('files/', '')
for (let i = 0; i < videoObjects.length; i++) {
if (videoObjects[i].dataset.path === shortened)
return true
}
}
return false
},
isSegmentationViewFile: function (scope) {
if (
this.datasetScicrunch &&
this.datasetScicrunch['mbf-segmentation']
) {
let segmentationObjects = this.datasetScicrunch['mbf-segmentation']
let shortened = scope.row.path
shortened = shortened.replace('files/', '')
for (let i = 0; i < segmentationObjects.length; i++) {
if (segmentationObjects[i].dataset.path === shortened)
return true
}
}
return false
},
openViewerFile(scope) {
const route = {
name: 'file-datasetId-datasetVersion',
params: {
datasetId: this.datasetInfo.id,
datasetVersion: this.datasetInfo.version
},
query: {
path: this.s3Path(scope.row)
}
}

this.$router.push(route)
},
/**
* Compute if the file is an image
* @returns {Boolean}
Expand Down
Loading