@@ -8,6 +8,7 @@ import { usePersistentToggle } from "@/composables/persistentToggle";
88import { useDatasetStore } from " @/stores/datasetStore" ;
99import { useDatatypesMapperStore } from " @/stores/datatypesMapperStore" ;
1010import { useDatatypeStore } from " @/stores/datatypeStore" ;
11+ import STATES from " @/utils/datasetStates" ;
1112import { withPrefix } from " @/utils/redirect" ;
1213import { bytesToString } from " @/utils/utils" ;
1314
@@ -41,6 +42,7 @@ const props = withDefaults(defineProps<Props>(), {
4142const iframeLoading = ref (true );
4243
4344const dataset = computed (() => datasetStore .getDataset (props .datasetId ));
45+ const downloadUrl = computed (() => withPrefix (` /datasets/${props .datasetId }/display ` ));
4446const headerState = computed (() => (headerCollapsed .value ? " closed" : " open" ));
4547
4648// Track datatype loading state
@@ -51,23 +53,16 @@ const isLoading = computed(() => {
5153 return datasetStore .isLoadingDataset (props .datasetId ) || isDatatypeLoading .value || datatypesMapperStore .loading ;
5254});
5355
54- const showError = computed (
55- () => dataset .value && (dataset .value .state === " error" || dataset .value .state === " failed_metadata" ),
56- );
56+ // Match datatype variant
5757const isAutoDownloadType = computed (
5858 () => dataset .value && datatypeStore .isDatatypeAutoDownload (dataset .value .file_ext ),
5959);
60- const downloadUrl = computed (() => withPrefix (` /datasets/${props .datasetId }/display ` ));
61- const preferredVisualization = computed (
62- () => dataset .value && datatypeStore .getPreferredVisualization (dataset .value .file_ext ),
63- );
6460const isBinaryDataset = computed (() => {
6561 if (! dataset .value ?.file_ext || ! datatypesMapperStore .datatypesMapper ) {
6662 return false ;
6763 }
6864 return datatypesMapperStore .datatypesMapper .isSubTypeOfAny (dataset .value .file_ext , [" galaxy.datatypes.binary" ]);
6965});
70-
7166const isImageDataset = computed (() => {
7267 if (! dataset .value ?.file_ext || ! datatypesMapperStore .datatypesMapper ) {
7368 return false ;
@@ -76,11 +71,19 @@ const isImageDataset = computed(() => {
7671 " galaxy.datatypes.images.Image" ,
7772 ]);
7873});
79-
8074const isPdfDataset = computed (() => {
8175 return dataset .value ?.file_ext === " pdf" ;
8276});
8377
78+ // Has a preferred visualization?
79+ const preferredVisualization = computed (
80+ () => dataset .value && datatypeStore .getPreferredVisualization (dataset .value .file_ext ),
81+ );
82+
83+ // Match dataset state
84+ const showError = computed (() => dataset .value && STATES .ERROR === dataset .value .state );
85+ const showOk = computed (() => dataset .value && STATES .OK_STATES .includes (dataset .value .state ));
86+
8487// Watch for changes to the dataset to fetch datatype info
8588watch (
8689 () => dataset .value ?.file_ext ,
@@ -149,20 +152,21 @@ watch(
149152 </header >
150153 <BNav v-if =" !displayOnly" pills class =" my-2 p-2 bg-light border-bottom" >
151154 <BNavItem
155+ v-if =" showOk"
152156 title =" View a preview of the dataset contents"
153157 :active =" tab === 'preview'"
154158 :to =" `/datasets/${datasetId}/preview`" >
155159 <FontAwesomeIcon :icon =" faEye" class =" mr-1" /> Preview
156160 </BNavItem >
157161 <BNavItem
158- v-if =" preferredVisualization"
162+ v-if =" showOk && preferredVisualization"
159163 title =" View raw dataset contents"
160164 :active =" tab === 'raw'"
161165 :to =" `/datasets/${datasetId}/raw`" >
162166 <FontAwesomeIcon :icon =" faFileAlt" class =" mr-1" /> Raw
163167 </BNavItem >
164168 <BNavItem
165- v-if =" !showError "
169+ v-if =" showOk "
166170 title =" Explore available visualizations for this dataset"
167171 :active =" tab === 'visualize'"
168172 :to =" `/datasets/${datasetId}/visualize`" >
0 commit comments