@@ -3,12 +3,12 @@ import { storeToRefs } from "pinia";
33import { computed , onMounted , type Ref , ref } from " vue" ;
44import { useRouter } from " vue-router/composables" ;
55
6- import { type Dataset , fetchPlugin , fetchPluginHistoryItems , type Plugin } from " @/api/plugins" ;
6+ import { fetchPlugin , fetchPluginHistoryItems , type Plugin } from " @/api/plugins" ;
77import type { OptionType } from " @/components/SelectionField/types" ;
88import { useMarkdown } from " @/composables/markdown" ;
99import { useHistoryStore } from " @/stores/historyStore" ;
1010
11- import { getTestExtensions , getTestUrls } from " ./utilities" ;
11+ import { getRequiresDataset , getTestExtensions , getTestUrls } from " ./utilities" ;
1212
1313import VisualizationExamples from " ./VisualizationExamples.vue" ;
1414import Heading from " @/components/Common/Heading.vue" ;
@@ -27,20 +27,20 @@ const props = defineProps<{
2727}>();
2828
2929const errorMessage = ref (" " );
30+ const formatsVisible = ref (false );
3031const plugin: Ref <Plugin | undefined > = ref ();
3132
32- const urlData = computed (() => getTestUrls (plugin .value ));
3333const extensions = computed (() => getTestExtensions (plugin .value ));
34- const formatsVisible = ref (false );
35-
36- function addHidToName(hdas : Array <Dataset >) {
37- return hdas .map ((entry ) => ({ id: entry .id , name: ` ${entry .hid }: ${entry .name } ` }));
38- }
34+ const requiresDataset = computed (() => getRequiresDataset (plugin .value ));
35+ const testUrls = computed (() => getTestUrls (plugin .value ));
3936
4037async function doQuery() {
4138 if (currentHistoryId .value && plugin .value ) {
4239 const data = await fetchPluginHistoryItems (plugin .value .name , currentHistoryId .value );
43- return addHidToName (data .hdas );
40+ return [
41+ ... (! requiresDataset .value ? [{ id: " " , name: ` Open visualization... ` }] : []),
42+ ... data .hdas .map ((hda ) => ({ id: hda .id , name: ` ${hda .hid }: ${hda .name } ` })),
43+ ];
4444 } else {
4545 return [];
4646 }
@@ -51,7 +51,8 @@ async function getPlugin() {
5151}
5252
5353function onSelect(dataset : OptionType ) {
54- router .push (` /visualizations/display?visualization=${plugin .value ?.name }&dataset_id=${dataset .id } ` , {
54+ const query = dataset .id ? ` &dataset_id=${dataset .id } ` : " " ;
55+ router .push (` /visualizations/display?visualization=${plugin .value ?.name }${query } ` , {
5556 // @ts-ignore
5657 title: dataset .name ,
5758 });
@@ -73,11 +74,11 @@ defineExpose({ doQuery });
7374 :logo =" plugin?.logo"
7475 :name =" plugin?.html" >
7576 <template v-slot :buttons >
76- <VisualizationExamples :url-data =" urlData " />
77+ <VisualizationExamples :url-data =" testUrls " />
7778 </template >
7879 <div class =" my-3" >
7980 <SelectionField
80- object-name =" Select a dataset ..."
81+ object-name =" Make a selection ..."
8182 object-title =" Select to Visualize"
8283 object-type =" history_dataset_id"
8384 :object-query =" doQuery"
0 commit comments