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

FileBrowserView adjustments #1666

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
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
34 changes: 27 additions & 7 deletions web/src/views/FileBrowserView/FileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,21 @@
v-if="showDelete(item)"
icon
@click="setItemToDelete(item)"
@click.stop
>
<v-icon color="error">
mdi-delete
</v-icon>
</v-btn>
</v-list-item-action>

<v-list-item-action v-if="item.asset">
<v-list-item-action v-if="itemIsViewable(item) && item.asset">
<v-btn
icon
:href="inlineURI(item.asset.asset_id)"
target="_blank"
title="View asset"
@click.stop
>
<v-icon color="primary">
mdi-eye
Expand All @@ -160,6 +163,8 @@
<v-btn
icon
:href="downloadURI(item.asset.asset_id)"
title="Download asset"
@click.stop
>
<v-icon color="primary">
mdi-download
Expand All @@ -173,6 +178,8 @@
:href="assetMetadataURI(item.asset.asset_id)"
target="_blank"
rel="noopener"
title="View asset metadata"
@click.stop
>
<v-icon color="primary">
mdi-information
Expand All @@ -190,6 +197,7 @@
v-if="item.services && item.services.length"
color="primary"
icon
title="Open in external service"
v-bind="attrs"
v-on="on"
>
Expand Down Expand Up @@ -396,12 +404,11 @@ function locationSlice(index: number) {
return `${splitLocation.value.slice(0, index + 1).join('/')}/`;
}

function selectPath(item: AssetPath) {
const { asset, path } = item;

// Return early if path is a file
if (asset) { return; }
location.value = path;
function itemIsViewable(item: AssetPath) {
const nonViewableExtensions = ['nwb', 'zip', 'gz', 'nii', 'tif', 'tiff', 'avi'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised to discover that .tiff is not supported by most of the browsers. It is supported by Safari though. But I also wonder if/how it would interact with some browser extensions which might be there to support viewing those types like https://www.blackice.com/broadcast/10132020TIFFV/index.html ?

const { path } = item;
const extension = path.split('.').pop() || '';
return !nonViewableExtensions.includes(extension);
}

function navigateToParent() {
Expand All @@ -428,6 +435,19 @@ function showDelete(item: AssetPath) {
return props.version === 'draft' && item.asset && (isAdmin.value || isOwner.value);
}

function selectPath(item: AssetPath) {
const { asset, path } = item;

if (asset) {
// path is a file
if (itemIsViewable(item)) {
window.open(inlineURI(asset.asset_id), '_blank');
}
return;
}
location.value = path;
}

async function getItems() {
updating.value = true;
let resp;
Expand Down