Skip to content

Commit

Permalink
Merge branch 'release_24.0' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed May 15, 2024
2 parents 076f298 + fa3ef46 commit 08e9bcf
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const rerunUrl = computed(() =>
const showCollectionDetailsUrl = computed(() =>
props.dsc.job_source_type == "Job" ? `/jobs/${props.dsc.job_source_id}/view` : null
);
const disableDownload = props.dsc.populated_state !== "ok";
function onDownload() {
window.location.href = downloadUrl.value;
}
Expand All @@ -28,6 +30,7 @@ function onDownload() {
<b-button-group>
<b-button
title="Download Collection"
:disabled="disableDownload"
class="rounded-0 text-decoration-none"
size="sm"
variant="link"
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Login/ChangePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ref } from "vue";
import { useRouter } from "vue-router/composables";
import { withPrefix } from "@/utils/redirect";
import { errorMessageAsString } from "@/utils/simple-error";
interface Props {
token?: string;
Expand Down Expand Up @@ -36,8 +37,7 @@ async function submit() {
router.push("/");
} catch (error: any) {
variant.value = "danger";
const errMsg = error.response && error.response.data && error.response.data.err_msg;
message.value = errMsg || "Password change failed for an unknown reason.";
message.value = errorMessageAsString(error, "Password change failed for an unknown reason.");
}
}
</script>
Expand Down
12 changes: 5 additions & 7 deletions client/src/components/Login/LoginForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import axios, { type AxiosError } from "axios";
import axios from "axios";
import {
BAlert,
BButton,
Expand All @@ -18,6 +18,7 @@ import { useRouter } from "vue-router/composables";
import localize from "@/utils/localization";
import { withPrefix } from "@/utils/redirect";
import { errorMessageAsString } from "@/utils/simple-error";
import NewUserConfirmation from "@/components/Login/NewUserConfirmation.vue";
import ExternalLogin from "@/components/User/ExternalIdentities/ExternalLogin.vue";
Expand Down Expand Up @@ -106,14 +107,13 @@ async function submitLogin() {
}
} catch (e) {
loading.value = false;
const error = e as AxiosError<{ err_msg?: string }>;
messageVariant.value = "danger";
const message = error.response && error.response.data && error.response.data.err_msg;
const message = errorMessageAsString(e, "Login failed for an unknown reason.");
if (connectExternalProvider.value && message && message.toLowerCase().includes("invalid")) {
messageText.value = message + " Try logging in to the existing account through an external provider below.";
} else {
messageText.value = message || "Login failed for an unknown reason.";
messageText.value = message;
}
if (message === "Invalid password.") {
passwordState.value = false;
Expand All @@ -132,10 +132,8 @@ async function resetLogin() {
messageVariant.value = "info";
messageText.value = response.data.message;
} catch (e) {
const error = e as AxiosError<{ err_msg?: string }>;
messageVariant.value = "danger";
const errMsg = error.response?.data && error.response.data.err_msg;
messageText.value = errMsg || "Password reset failed for an unknown reason.";
messageText.value = errorMessageAsString(e, "Password reset failed for an unknown reason.");
} finally {
loading.value = false;
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Login/NewUserConfirmation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ref } from "vue";
import { useRouter } from "vue-router/composables";
import { withPrefix } from "@/utils/redirect";
import { errorMessageAsString } from "@/utils/simple-error";
interface Props {
termsUrl?: string;
Expand Down Expand Up @@ -58,8 +59,7 @@ async function submit() {
}
} catch (error: any) {
messageVariant.value = "danger";
const errMsg = error.response.data && error.response.data.err_msg;
messageText.value = errMsg || "Login failed for an unknown reason.";
messageText.value = errorMessageAsString(error, "Login failed for an unknown reason.");
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/Login/RegisterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { computed, ref } from "vue";
import { Toast } from "@/composables/toast";
import localize from "@/utils/localization";
import { withPrefix } from "@/utils/redirect";
import { errorMessageAsString } from "@/utils/simple-error";
import ExternalLogin from "@/components/User/ExternalIdentities/ExternalLogin.vue";
Expand Down Expand Up @@ -81,8 +82,7 @@ async function submit() {
window.location.href = props.redirect || withPrefix("/");
} catch (error: any) {
disableCreate.value = false;
const errMsg = error.response.data && error.response.data.err_msg;
messageText.value = errMsg || "Registration failed for an unknown reason.";
messageText.value = errorMessageAsString(error, "Registration failed for an unknown reason.");
}
}
</script>
Expand Down Expand Up @@ -215,7 +215,6 @@ async function submit() {
</div>
</div>
</template>

<style scoped lang="scss">
.embed-container {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Markdown/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type WorkflowLabelKind = "input" | "output" | "step";
const SINGLE_QUOTE = "'";
const DOUBLE_QUOTE = '"';

export function splitMarkdown(markdown: string, preserveWhitespace: boolean = false) {
export function splitMarkdown(markdown: string, preserveWhitespace = false) {
const sections: Section[] = [];
const markdownErrors = [];
let digest = markdown;
Expand Down
10 changes: 0 additions & 10 deletions client/src/components/Popper/usePopper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,14 @@ export function usePopperjs(

case "hover": {
on(referenceRef.value!, "mouseover", doMouseover);
on(popperRef.value!, "mouseover", doMouseover);
on(referenceRef.value!, "mouseout", doMouseout);
on(popperRef.value!, "mouseout", doMouseout);
on(referenceRef.value!, "mousedown", doMouseout);
on(popperRef.value!, "mousedown", doMouseout);
break;
}

case "focus": {
on(referenceRef.value!, "focus", doOpen);
on(popperRef.value!, "focus", doOpen);
on(referenceRef.value!, "blur", doClose);
on(popperRef.value!, "blur", doClose);
break;
}

Expand All @@ -218,16 +213,11 @@ export function usePopperjs(
off(referenceRef.value!, "click", doToggle);

off(referenceRef.value!, "mouseover", doMouseover);
off(popperRef.value!, "mouseover", doMouseover);
off(referenceRef.value!, "mouseout", doMouseout);
off(popperRef.value!, "mouseout", doMouseout);
off(referenceRef.value!, "mousedown", doMouseout);
off(popperRef.value!, "mousedown", doMouseout);

off(referenceRef.value!, "focus", doOpen);
off(popperRef.value!, "focus", doOpen);
off(referenceRef.value!, "blur", doClose);
off(popperRef.value!, "blur", doClose);
};
const doCloseForDocument = (e: Event) => {
if (referenceRef.value?.contains(e.target as Element)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function fetchAllHistoriesSizeSummary(): Promise<ItemSizeSummary[]>

export async function fetchHistoryContentsSizeSummary(
historyId: string,
limit: number = 5000,
limit = 5000,
objectStoreId: string | null = null
) {
const q = ["purged", "history_content_type"];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import axios, { type AxiosError } from "axios";
import { BAlert, BButton, BForm, BFormCheckbox, BFormGroup } from "bootstrap-vue";
import { errorMessageAsString } from "utils/simple-error";
import { computed, onMounted, ref } from "vue";
import Multiselect from "vue-multiselect";
Expand Down Expand Up @@ -82,10 +83,8 @@ async function submitOIDCLogin(idp: string) {
window.location = data.redirect_uri;
}
} catch (e) {
const error = e as AxiosError<{ err_msg?: string }>;
messageVariant.value = "danger";
const message = error.response?.data && error.response.data.err_msg;
messageText.value = message || "Login failed for an unknown reason.";
messageText.value = errorMessageAsString(e, "Login failed for an unknown reason.");
} finally {
loading.value = false;
}
Expand Down Expand Up @@ -113,10 +112,8 @@ async function submitCILogon(idp: string | null) {
window.location = data.redirect_uri;
}
} catch (e) {
const error = e as AxiosError<{ err_msg?: string }>;
messageVariant.value = "danger";
const message = error.response?.data && error.response.data.err_msg;
messageText.value = message || "Login failed for an unknown reason.";
messageText.value = errorMessageAsString(e, "Login failed for an unknown reason.");
} finally {
loading.value = false;
}
Expand Down
11 changes: 6 additions & 5 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,18 @@ export default {
}
});
function resetStores() {
async function resetStores() {
hasChanges.value = false;
connectionStore.$reset();
stepStore.$reset();
stateStore.$reset();
commentStore.$reset();
undoRedoStore.$reset();
await nextTick();
}
onUnmounted(() => {
resetStores();
onUnmounted(async () => {
await resetStores();
emit("update:confirmation", false);
});
Expand Down Expand Up @@ -574,7 +575,7 @@ export default {
hide_modal(); // hide other modals created in utilities also...
},
async onRefactor(response) {
this.resetStores();
await this.resetStores();
await fromSimple(this.id, response.workflow);
this._loadEditorData(response.workflow);
},
Expand Down Expand Up @@ -887,7 +888,7 @@ export default {
},
async _loadCurrent(id, version) {
if (!this.isNewTempWorkflow) {
this.resetStores();
await this.resetStores();
this.onWorkflowMessage("Loading workflow...", "progress");
try {
Expand Down
12 changes: 10 additions & 2 deletions lib/galaxy/files/sources/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _create_entry(
record = self.repository.create_draft_record(entry_data["name"], public_name, user_context=user_context)
return {
"uri": self.repository.to_plugin_uri(record["id"]),
"name": record["metadata"]["title"],
"name": record["title"],
"external_link": record["links"]["self_html"],
}

Expand Down Expand Up @@ -253,6 +253,7 @@ def create_draft_record(
response = requests.post(self.records_url, json=create_record_request, headers=headers)
self._ensure_response_has_expected_status_code(response, 201)
record = response.json()
record["title"] = self._get_record_title(record)
return record

def upload_file_to_draft_record(
Expand Down Expand Up @@ -359,16 +360,23 @@ def _get_records_from_response(self, response: dict) -> List[RemoteDirectory]:
for record in records:
uri = self.to_plugin_uri(record_id=record["id"])
path = self.plugin.to_relative_path(uri)
name = self._get_record_title(record)
rval.append(
{
"class": "Directory",
"name": record["metadata"]["title"],
"name": name,
"uri": uri,
"path": path,
}
)
return rval

def _get_record_title(self, record: InvenioRecord) -> str:
title = record.get("title")
if not title and "metadata" in record:
title = record["metadata"].get("title")
return title or "No title"

def _get_record_files_from_response(self, record_id: str, response: dict) -> List[RemoteFile]:
files_enabled = response.get("enabled", False)
if not files_enabled:
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/managers/hdcas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Dict

from galaxy import model
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.managers import (
annotatable,
base,
Expand Down Expand Up @@ -40,6 +41,8 @@ def stream_dataset_collection(dataset_collection_instance, upstream_mod_zip=Fals


def write_dataset_collection(dataset_collection_instance, archive):
if not dataset_collection_instance.collection.populated_optimized:
raise RequestParameterInvalidException("Attempt to write dataset collection that has not been populated yet")
names, hdas = get_hda_and_element_identifiers(dataset_collection_instance)
for name, hda in zip(names, hdas):
if hda.state != hda.states.OK:
Expand Down
10 changes: 6 additions & 4 deletions lib/galaxy/webapps/galaxy/api/history_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ def download_dataset_collection_history_content(
"""Download the content of a history dataset collection as a `zip` archive
while maintaining approximate collection structure.
"""
archive = self.service.get_dataset_collection_archive_for_download(trans, id)
return StreamingResponse(archive.response(), headers=archive.get_headers())
return self._download_collection(trans, id)

@router.get(
"/api/dataset_collections/{id}/download",
Expand All @@ -644,8 +643,7 @@ def download_dataset_collection(
"""Download the content of a history dataset collection as a `zip` archive
while maintaining approximate collection structure.
"""
archive = self.service.get_dataset_collection_archive_for_download(trans, id)
return StreamingResponse(archive.response(), headers=archive.get_headers())
return self._download_collection(trans, id)

@router.post(
"/api/histories/{history_id}/contents/dataset_collections/{id}/prepare_download",
Expand Down Expand Up @@ -1089,3 +1087,7 @@ def materialize_to_history(
)
rval = self.service.materialize(trans, materialize_request)
return rval

def _download_collection(self, trans, id):
archive = self.service.get_dataset_collection_archive_for_download(trans, id)
return StreamingResponse(archive.response(), headers=archive.get_headers())

0 comments on commit 08e9bcf

Please sign in to comment.