Skip to content

Commit f2a2129

Browse files
fetch "collection" view for HDCAs in GenericItem and useInvocationGraph
For the generic content items (used outside of the history panel), there is no need to fetch the entire "element" view when displaying the content item unexpanded. Therefore, I have made the default view "collection", until you click to expand an HDCA which is when the `DatasetCollectionProvider` is remounted to fetch the "element" (detailed) view for the HDCA.
1 parent e8432b1 commit f2a2129

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

client/src/api/datasetCollections.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ export type CollectionType = string;
1818
* Fetches the details of a collection.
1919
* @param params.id The ID of the collection (HDCA) to fetch.
2020
*/
21-
export async function fetchCollectionDetails(params: { hdca_id: string }): Promise<HDCADetailed> {
21+
export async function fetchCollectionDetails(
22+
params: { hdca_id: string },
23+
query?: { view?: string }
24+
): Promise<HDCADetailed> {
2225
const { data, error } = await GalaxyApi().GET("/api/dataset_collections/{hdca_id}", {
23-
params: { path: params },
26+
params: { path: params, query: query },
2427
});
2528

2629
if (error) {

client/src/components/History/Content/GenericItem.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
2-
<component :is="providerComponent" :id="itemId" v-slot="{ result: item, loading }" auto-refresh>
2+
<component
3+
:is="providerComponent"
4+
:id="itemId"
5+
:key="view"
6+
v-slot="{ result: item, loading }"
7+
:view="view"
8+
auto-refresh>
39
<LoadingSpan v-if="loading" message="Loading dataset" />
410
<div v-else>
511
<ContentItem
@@ -11,7 +17,7 @@
1117
:expand-dataset="expandDataset"
1218
:is-dataset="item.history_content_type == 'dataset' || item.element_type == 'hda'"
1319
@update:expand-dataset="expandDataset = $event"
14-
@view-collection="viewCollection = !viewCollection"
20+
@view-collection="onViewCollection"
1521
@delete="onDelete"
1622
@toggleHighlights="onHighlight(item)"
1723
@undelete="onUndelete(item)"
@@ -60,6 +66,7 @@ export default {
6066
return {
6167
viewCollection: false,
6268
expandDataset: false,
69+
view: this.itemSrc === "hdca" ? "collection" : "element",
6370
};
6471
},
6572
computed: {
@@ -124,6 +131,12 @@ export default {
124131
this.onError(error, "Failed to highlight related items");
125132
}
126133
},
134+
onViewCollection(collection) {
135+
if (this.view === "collection" && collection.model_class === "HistoryDatasetCollectionAssociation") {
136+
this.view = "element";
137+
}
138+
this.viewCollection = !this.viewCollection;
139+
},
127140
},
128141
};
129142
</script>

client/src/components/providers/DatasetCollectionProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import { fetchCollectionDetails } from "@/api/datasetCollections";
55
// There isn't really a good way to know when to stop polling for HDCA updates,
66
// but we know the populated_state should at least be ok.
77
export default SingleQueryProvider(
8-
(params) => fetchCollectionDetails({ hdca_id: params.id }),
8+
(params) => fetchCollectionDetails({ hdca_id: params.id }, params.view ? { view: params.view } : undefined),
99
(result) => result.populated_state === "ok"
1010
);

client/src/composables/useInvocationGraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ export function useInvocationGraph(
334334
set(graphStep, "state", getContentItemState(hda));
335335
set(graphStep, "nodeText", `${hda.hid}: <b>${hda.name}</b>`);
336336
} else {
337-
const hdca = await fetchCollectionDetails({ hdca_id: inputItem.id });
337+
const hdca = await fetchCollectionDetails({ hdca_id: inputItem.id }, { view: "collection" });
338338
// TODO: Same type mismatch as above
339339
set(graphStep, "state", getContentItemState(hdca));
340340
set(graphStep, "nodeText", `${hdca.hid}: <b>${hdca.name}</b>`);

0 commit comments

Comments
 (0)