Skip to content

Commit

Permalink
Merge pull request galaxyproject#19273 from jmchilton/release_24.2_merge
Browse files Browse the repository at this point in the history
Merge 24.2 into dev.
  • Loading branch information
mvdbeek authored Dec 9, 2024
2 parents 7d25278 + 5909843 commit f38e13a
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 30 deletions.
29 changes: 27 additions & 2 deletions client/src/components/Collections/ListCollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { computed, ref, watch } from "vue";
import draggable from "vuedraggable";
import type { HDASummary, HistoryItemSummary } from "@/api";
import { useConfirmDialog } from "@/composables/confirmDialog";
import { Toast } from "@/composables/toast";
import STATES from "@/mvc/dataset/states";
import { useDatatypesMapperStore } from "@/stores/datatypesMapperStore";
Expand Down Expand Up @@ -41,6 +42,7 @@ const invalidElements = ref<string[]>([]);
const workingElements = ref<HDASummary[]>([]);
const selectedDatasetElements = ref<string[]>([]);
const hideSourceItems = ref(props.defaultHideSourceItems || false);
const atLeastOneElement = ref(true);
const atLeastOneDatasetIsSelected = computed(() => {
return selectedDatasetElements.value.length > 0;
Expand Down Expand Up @@ -227,13 +229,24 @@ function clickSelectAll() {
return element.id;
});
}
const { confirm } = useConfirmDialog();
function clickedCreate(collectionName: string) {
async function clickedCreate(collectionName: string) {
checkForDuplicates();
const returnedElements = props.fromSelection ? workingElements.value : inListElements.value;
atLeastOneElement.value = returnedElements.length > 0;
let confirmed = false;
if (!atLeastOneElement.value) {
confirmed = await confirm("Are you sure you want to create a list with no datasets?", {
title: "Create an empty list",
okTitle: "Create",
okVariant: "primary",
});
}
if (state.value !== "error") {
if (state.value !== "error" && (atLeastOneElement.value || confirmed)) {
emit("clicked-create", returnedElements, collectionName, hideSourceItems.value);
}
}
Expand Down Expand Up @@ -370,6 +383,18 @@ function renameElement(element: any, name: string) {
</BAlert>
</div>

<div v-if="!atLeastOneElement">
<BAlert show variant="warning" dismissible @dismissed="atLeastOneElement = true">
{{ localize("At least one element is needed for the list.") }}
<span v-if="fromSelection">
<a class="cancel-text" href="javascript:void(0)" role="button" @click="emit('on-cancel')">
{{ localize("Cancel") }}
</a>
{{ localize("and reselect new elements.") }}
</span>
</BAlert>
</div>

<div v-if="showDuplicateError">
<BAlert show variant="danger">
{{
Expand Down
58 changes: 31 additions & 27 deletions client/src/components/Collections/PairedListCollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { computed, ref, watch } from "vue";
import draggable from "vuedraggable";
import type { HDASummary, HistoryItemSummary } from "@/api";
import { useConfirmDialog } from "@/composables/confirmDialog";
import { Toast } from "@/composables/toast";
import STATES from "@/mvc/dataset/states";
import { useDatatypesMapperStore } from "@/stores/datatypesMapperStore";
Expand Down Expand Up @@ -81,6 +82,7 @@ const invalidElements = ref<string[]>([]);
const generatedPairs = ref<DatasetPair[]>([]);
const selectedForwardElement = ref<HDASummary | null>(null);
const selectedReverseElement = ref<HDASummary | null>(null);
const atLeastOnePair = ref(true);
// Filters
const forwardFilter = ref(COMMON_FILTERS[DEFAULT_FILTER][0] || "");
Expand Down Expand Up @@ -552,32 +554,6 @@ function _addToUnpaired(dataset: HDASummary) {
workingElements.value.splice(binSearchSortedIndex(0, workingElements.value.length), 0, dataset);
}
// /** add a dataset to the unpaired list in it's proper order */
// _addToUnpaired: function (dataset) {
// // currently, unpaired is natural sorted by name, use binary search to find insertion point
// var binSearchSortedIndex = (low, hi) => {
// if (low === hi) {
// return low;
// }
// var mid = Math.floor((hi - low) / 2) + low;
// var compared = naturalSort(dataset.name, this.workingElements[mid].name);
// if (compared < 0) {
// return binSearchSortedIndex(low, mid);
// } else if (compared > 0) {
// return binSearchSortedIndex(mid + 1, hi);
// }
// // walk the equal to find the last
// while (this.workingElements[mid] && this.workingElements[mid].name === dataset.name) {
// mid++;
// }
// return mid;
// };
// this.workingElements.splice(binSearchSortedIndex(0, this.workingElements.length), 0, dataset);
// },
/**
* Unpair a pair, removing it from paired, and adding the fwd,rev
Expand Down Expand Up @@ -749,9 +725,22 @@ function addUploadedFiles(files: HDASummary[]) {
});
}
const { confirm } = useConfirmDialog();
async function clickedCreate(collectionName: string) {
checkForDuplicates();
if (state.value == "build") {
atLeastOnePair.value = generatedPairs.value.length > 0;
let confirmed = false;
if (!atLeastOnePair.value) {
confirmed = await confirm("Are you sure you want to create a list with no pairs?", {
title: "Create an empty list of pairs",
okTitle: "Create",
okVariant: "primary",
});
}
if (state.value == "build" && (atLeastOnePair.value || confirmed)) {
emit("clicked-create", generatedPairs.value, collectionName, hideSourceItems.value);
}
}
Expand Down Expand Up @@ -827,6 +816,19 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
</ul>
</BAlert>
</div>

<div v-if="!atLeastOnePair">
<BAlert show variant="warning" dismissible @dismissed="atLeastOnePair = true">
{{ localize("At least one pair is needed for the list of pairs.") }}
<span v-if="fromSelection">
<a class="cancel-text" href="javascript:void(0)" role="button" @click="emit('on-cancel')">
{{ localize("Cancel") }}
</a>
{{ localize("and reselect new elements.") }}
</span>
</BAlert>
</div>

<div v-if="!autoPairsPossible">
<BAlert show variant="danger" dismissible @dismissed="autoPairsPossible = true">
{{
Expand All @@ -842,6 +844,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
</span>
</BAlert>
</div>

<div v-if="state == 'duplicates'">
<BAlert show variant="danger">
{{
Expand All @@ -853,6 +856,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
{{ localize("Please fix these duplicates and try again.") }}
</BAlert>
</div>

<CollectionCreator
:oncancel="() => emit('on-cancel')"
:history-id="props.historyId"
Expand Down
7 changes: 6 additions & 1 deletion lib/galaxy/webapps/galaxy/controllers/authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def login(self, trans, provider, idphint=None, next=None):
log.debug(msg)
return trans.show_error_message(msg)
if next:
trans.set_cookie(value=next, name=LOGIN_NEXT_COOKIE_NAME)
trans.set_cookie(value=next, name=LOGIN_NEXT_COOKIE_NAME, age=1)
else:
# If no next parameter is provided, ensure we unset any existing next cookie.
trans.set_cookie(value="/", name=LOGIN_NEXT_COOKIE_NAME)
success, message, redirect_uri = trans.app.authnz_manager.authenticate(provider, trans, idphint)
if success:
return {"redirect_uri": redirect_uri}
Expand Down Expand Up @@ -138,6 +141,8 @@ def callback(self, trans, provider, idphint=None, **kwargs):
trans.handle_user_login(user)
# Record which idp provider was logged into, so we can logout of it later
trans.set_cookie(value=provider, name=PROVIDER_COOKIE_NAME)
# Clear the login next cookie back to default.
trans.set_cookie(value="/", name=LOGIN_NEXT_COOKIE_NAME)
return trans.response.send_redirect(url_for(redirect_url))

@web.expose
Expand Down

0 comments on commit f38e13a

Please sign in to comment.