Skip to content

Commit

Permalink
Merge pull request #17756 from dannon/published_datasets_fixes
Browse files Browse the repository at this point in the history
[24.0] Datasets list anonymous access and history link fixes.
  • Loading branch information
mvdbeek committed Mar 22, 2024
2 parents 21213c0 + 23d03da commit a4e3e4b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 38 deletions.
21 changes: 0 additions & 21 deletions client/src/components/Dataset/DatasetHistory.vue

This file was deleted.

10 changes: 6 additions & 4 deletions client/src/components/Dataset/DatasetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
<DatasetName :item="row.item" @showDataset="onShowDataset" @copyDataset="onCopyDataset" />
</template>
<template v-slot:cell(history_id)="row">
<DatasetHistory :item="row.item" />
<SwitchToHistoryLink
:history-id="row.item.history_id"
:filters="{ deleted: row.item.deleted, visible: row.item.visible, hid: row.item.hid }" />
</template>
<template v-slot:cell(tags)="row">
<StatelessTags
Expand Down Expand Up @@ -49,17 +51,17 @@ import { copyDataset, getDatasets } from "@/api/datasets";
import { updateTags } from "@/api/tags";
import { useHistoryStore } from "@/stores/historyStore";
import DatasetHistory from "./DatasetHistory";
import DatasetName from "./DatasetName";
import DatasetName from "./DatasetName.vue";
import SwitchToHistoryLink from "@/components/History/SwitchToHistoryLink.vue";
export default {
components: {
DatasetHistory,
DatasetName,
LoadingSpan,
DelayedInput,
UtcDate,
StatelessTags,
SwitchToHistoryLink,
},
data() {
return {
Expand Down
5 changes: 1 addition & 4 deletions client/src/components/Dataset/DatasetName.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ describe("Dataset Name", () => {
const state = wrapper.findAll(".name");
expect(state.length).toBe(1);
expect(state.at(0).text()).toBe("name");
const $linkShow = wrapper.find(".dropdown-item:first-child");
$linkShow.trigger("click");
expect(Array.isArray(wrapper.emitted().showDataset)).toBe(true);
const $linkCopy = wrapper.find(".dropdown-item:last-child");
const $linkCopy = wrapper.find(".dropdown-item:first-child");
$linkCopy.trigger("click");
expect(Array.isArray(wrapper.emitted().copyDataset)).toBe(true);
});
Expand Down
7 changes: 0 additions & 7 deletions client/src/components/Dataset/DatasetName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
<span class="name">{{ getName }}</span>
</b-link>
<div class="dropdown-menu" aria-labelledby="dataset-dropdown">
<a class="dropdown-item" href="#" @click.prevent="showDataset">
<span class="fa fa-eye fa-fw mr-1" />
<span>Show in History containing dataset</span>
</a>
<a class="dropdown-item" href="#" @click.prevent="copyDataset">
<span class="fa fa-copy fa-fw mr-1" />
<span>Copy to current History</span>
Expand Down Expand Up @@ -56,9 +52,6 @@ export default {
copyDataset(item) {
this.$emit("copyDataset", this.item);
},
showDataset(item) {
this.$emit("showDataset", this.item);
},
},
};
</script>
Expand Down
17 changes: 15 additions & 2 deletions client/src/components/History/SwitchToHistoryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const historyStore = useHistoryStore();
interface Props {
historyId: string;
filters?: Record<string, string | boolean>;
}
const props = defineProps<Props>();
Expand All @@ -26,11 +27,23 @@ const history = computed(() => historyStore.getHistoryById(props.historyId));
const canSwitch = computed(() => !!history.value && !history.value.archived && !history.value.purged);
const actionText = computed(() => (canSwitch.value ? "Switch to" : "View in new tab"));
const actionText = computed(() => {
if (canSwitch.value) {
if (props.filters) {
return "Show in history";
}
return "Switch to";
}
return "View in new tab";
});
function onClick(history: HistorySummary) {
if (canSwitch.value) {
historyStore.setCurrentHistory(history.id);
if (props.filters) {
historyStore.applyFilters(history.id, props.filters);
} else {
historyStore.setCurrentHistory(history.id);
}
return;
}
viewHistoryInNewTab(history);
Expand Down
1 change: 1 addition & 0 deletions client/src/entry/analysis/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function fetchMenu(options = {}) {
{
title: _l("Datasets"),
url: "/datasets/list_published",
hidden: !Galaxy.user.id,
},
{
title: _l("Histories"),
Expand Down

0 comments on commit a4e3e4b

Please sign in to comment.