Skip to content

Commit

Permalink
Merge pull request #16839 from davelopez/refactor_dataset_services
Browse files Browse the repository at this point in the history
Refactor dataset services
  • Loading branch information
bgruening authored Oct 12, 2023
2 parents 2ca8c37 + 97fb7c5 commit 26eba22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 3 additions & 2 deletions client/src/components/Dataset/DatasetLink/DatasetLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</template>

<script>
import { getCompositeDatasetInfo } from "components/Dataset/services";
import { mapCacheActions } from "vuex-cache";
import { fetchDatasetDetails } from "@/stores/services/dataset.service";
export default {
props: {
history_dataset_id: {
Expand Down Expand Up @@ -57,7 +58,7 @@ export default {
});
} else {
// download whole dataset
getCompositeDatasetInfo(this.history_dataset_id).then((response) => {
fetchDatasetDetails({ id: this.history_dataset_id }).then((response) => {
this.pathDestination = { fileLink: `${response.download_url}?to_ext=${response.file_ext}` };
});
}
Expand Down
10 changes: 1 addition & 9 deletions client/src/components/Dataset/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,5 @@ export async function updateTags(
}

export function getCompositeDatasetLink(historyDatasetId: string, path: string) {
// TODO: historyDatasetId is wrong here, we should expose the route without forcing to provide a history id
return withPrefix(`/api/histories/${historyDatasetId}/contents/${historyDatasetId}/display?filename=${path}`);
}

const getDataset = fetcher.path("/api/histories/{history_id}/contents/{id}").method("get").create();
export async function getCompositeDatasetInfo(id: string) {
// TODO: ${id} as history id is wrong here, we should expose the route without forcing to provide a history id
const { data } = await getDataset({ history_id: id, id });
return data;
return withPrefix(`/api/datasets/${historyDatasetId}/display?filename=${path}`);
}

0 comments on commit 26eba22

Please sign in to comment.