Skip to content

Commit

Permalink
Merge branch 'release_24.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Jun 5, 2024
2 parents 3359a75 + 0122cdb commit ec17295
Show file tree
Hide file tree
Showing 36 changed files with 482 additions and 293 deletions.
4 changes: 4 additions & 0 deletions client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export function isHistorySummaryExtended(history: AnyHistory): history is Histor
return "contents_active" in history && "user_id" in history;
}

export function isHistoryItem(item: object): item is HistoryItemSummary {
return item && "history_content_type" in item;
}

type QuotaUsageResponse = components["schemas"]["UserQuotaUsage"];

/** Represents a registered user.**/
Expand Down
8 changes: 4 additions & 4 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export interface paths {
post: operations["file_sources__test_new_instance_configuration"];
};
"/api/file_source_instances/{user_file_source_id}": {
/** Get a list of persisted file source instances defined by the requesting user. */
/** Get a persisted user file source instance. */
get: operations["file_sources__instances_get"];
/** Update or upgrade user file source instance. */
put: operations["file_sources__instances_update"];
Expand Down Expand Up @@ -1266,7 +1266,7 @@ export interface paths {
post: operations["object_stores__test_new_instance_configuration"];
};
"/api/object_store_instances/{user_object_store_id}": {
/** Get a persisted object store instances owned by the requesting user. */
/** Get a persisted user object store instance. */
get: operations["object_stores__instances_get"];
/** Update or upgrade user object store instance. */
put: operations["object_stores__instances_update"];
Expand Down Expand Up @@ -14966,7 +14966,7 @@ export interface operations {
};
};
file_sources__instances_get: {
/** Get a list of persisted file source instances defined by the requesting user. */
/** Get a persisted user file source instance. */
parameters: {
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
header?: {
Expand Down Expand Up @@ -20890,7 +20890,7 @@ export interface operations {
};
};
object_stores__instances_get: {
/** Get a persisted object store instances owned by the requesting user. */
/** Get a persisted user object store instance. */
parameters: {
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
header?: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ConfigTemplates/InstanceDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const emit = defineEmits<{
:href="routeUpgrade"
@keypress="router.push(routeUpgrade)"
@click.prevent="router.push(routeUpgrade)">
<FontAwesomeIcon icon="arrowUp" />
<FontAwesomeIcon :icon="faArrowUp" />
<span v-localize>Upgrade</span>
</button>
<button
Expand Down
8 changes: 7 additions & 1 deletion client/src/components/DataDialog/DataDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Record {
interface Props {
allowUpload?: boolean;
callback?: (results: Array<Record>) => void;
filterOkState?: boolean;
format?: string;
library?: boolean;
modalStatic?: boolean;
Expand All @@ -34,6 +35,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
allowUpload: true,
callback: () => {},
filterOkState: false,
format: "download",
library: true,
modalStatic: false,
Expand Down Expand Up @@ -90,7 +92,11 @@ function formatRows() {
/** Returns the default url i.e. the url of the current history **/
function getHistoryUrl() {
return `${getAppRoot()}api/histories/${props.history}/contents?deleted=false`;
let queryString = "&q=deleted&qv=false";
if (props.filterOkState) {
queryString += "&q=state-eq&qv=ok";
}
return `${getAppRoot()}api/histories/${props.history}/contents?v=dev${queryString}`;
}
/** Called when the modal is hidden */
Expand Down
11 changes: 11 additions & 0 deletions client/src/components/Dataset/DatasetAsImage/DatasetAsImage.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { computedAsync } from "@vueuse/core";
import { computed } from "vue";
import { type PathDestination, useDatasetPathDestination } from "@/composables/datasetPathDestination";
Expand All @@ -24,13 +25,23 @@ const imageUrl = computed(() => {
return pathDestination.value?.fileLink;
});
const isImage = computedAsync(async () => {
if (!imageUrl.value) {
return null;
}
const res = await fetch(imageUrl.value);
const buff = await res.blob();
return buff.type.startsWith("image/");
}, null);
</script>

<template>
<div>
<div v-if="imageUrl" class="w-100 p-2">
<b-card nobody body-class="p-1">
<b-img :src="imageUrl" fluid />
<span v-if="!isImage" class="text-danger">This dataset does not appear to be an image.</span>
</b-card>
</div>
<div v-else>
Expand Down
29 changes: 6 additions & 23 deletions client/src/components/History/CurrentHistory/HistoryPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BAlert } from "bootstrap-vue";
import { storeToRefs } from "pinia";
import { computed, onMounted, type Ref, ref, set as VueSet, unref, watch } from "vue";
import { type HistoryItemSummary, type HistorySummaryExtended, userOwnsHistory } from "@/api";
import { type HistoryItemSummary, type HistorySummaryExtended, isHistoryItem, userOwnsHistory } from "@/api";
import { copyDataset } from "@/api/datasets";
import ExpandedItems from "@/components/History/Content/ExpandedItems";
import SelectedItems from "@/components/History/Content/SelectedItems";
Expand Down Expand Up @@ -225,28 +225,11 @@ function dragSameHistory() {
function getDragData() {
const eventStore = useEventStore();
const multiple = eventStore.multipleDragData;
let data: HistoryItemSummary[] | undefined;
let historyId: string | undefined;
try {
if (multiple) {
const dragData = eventStore.getDragData() as Record<string, HistoryItemSummary>;
// set historyId to the first history_id in the multiple drag data
const firstItem = Object.values(dragData)[0];
if (firstItem) {
historyId = firstItem.history_id;
}
data = Object.values(dragData);
} else {
data = [eventStore.getDragData() as HistoryItemSummary];
if (data[0]) {
historyId = data[0].history_id;
}
}
} catch (error) {
// this was not a valid object for this dropzone, ignore
}
return { data, sameHistory: historyId === props.history.id, multiple };
const dragItems = eventStore.getDragItems();
// Filter out any non-history items
const historyItems = dragItems?.filter((item: any) => isHistoryItem(item)) as HistoryItemSummary[];
const historyId = historyItems?.[0]?.history_id;
return { data: historyItems, sameHistory: historyId === props.history.id, multiple: historyItems?.length > 1 };
}
function getHighlight(item: HistoryItemSummary) {
Expand Down
32 changes: 8 additions & 24 deletions client/src/components/History/Multiple/MultipleViewList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { computed, type Ref, ref } from "vue";
//@ts-ignore missing typedefs
import VirtualList from "vue-virtual-scroll-list";
import { HistoryItemSummary } from "@/api";
import { HistoryItemSummary, isHistoryItem } from "@/api";
import { copyDataset } from "@/api/datasets";
import { useAnimationFrameResizeObserver } from "@/composables/sensors/animationFrameResizeObserver";
import { useAnimationFrameScroll } from "@/composables/sensors/animationFrameScroll";
Expand Down Expand Up @@ -75,37 +75,21 @@ async function onDrop(evt: any) {
}
processingDrop.value = true;
showDropZone.value = false;
let data: HistoryItemSummary[] | undefined;
let originalHistoryId: string | undefined;
const multiple = eventStore.multipleDragData;
try {
if (multiple) {
const dragData = eventStore.getDragData() as Record<string, HistoryItemSummary>;
// set originalHistoryId to the first history_id in the multiple drag data
const firstItem = Object.values(dragData)[0];
if (firstItem) {
originalHistoryId = firstItem.history_id;
}
data = Object.values(dragData);
} else {
data = [eventStore.getDragData() as HistoryItemSummary];
if (data[0]) {
originalHistoryId = data[0].history_id;
}
}
} catch (error) {
// this was not a valid object for this dropzone, ignore
}
const dragItems = eventStore.getDragItems();
// Filter out any non-history items
const historyItems = dragItems?.filter((item: any) => isHistoryItem(item)) as HistoryItemSummary[];
const multiple = historyItems.length > 1;
const originalHistoryId = historyItems?.[0]?.history_id;
if (data && originalHistoryId) {
if (historyItems && originalHistoryId) {
await historyStore.createNewHistory();
const currentHistoryId = historyStore.currentHistoryId;
let datasetCount = 0;
let collectionCount = 0;
if (currentHistoryId) {
// iterate over the data array and copy each item to the new history
for (const item of data) {
for (const item of historyItems) {
const dataSource = item.history_content_type === "dataset" ? "hda" : "hdca";
await copyDataset(item.id, currentHistoryId, item.history_content_type, dataSource)
.then(() => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Panels/VisualizationPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ onMounted(() => {
<BAlert v-else v-localize variant="info" show> No matching visualization found. </BAlert>
</div>
<DataDialog
v-if="showDataDialog"
v-if="currentHistoryId && showDataDialog"
format=""
:history="currentHistoryId"
:filter-ok-state="true"
@onOk="createVisualization"
@onCancel="showDataDialog = false" />
</ActivityPanel>
Expand Down
4 changes: 3 additions & 1 deletion client/src/entry/analysis/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ export default {
this.$router.confirmation = this.confirmation;
},
currentHistory() {
this.Galaxy.currHistoryPanel.syncCurrentHistoryModel(this.currentHistory);
if (!this.embedded) {
this.Galaxy.currHistoryPanel.syncCurrentHistoryModel(this.currentHistory);
}
},
},
mounted() {
Expand Down
8 changes: 8 additions & 0 deletions client/src/stores/eventStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const useEventStore = defineStore("eventStore", () => {
return dragData.value;
}

function getDragItems(): EventData[] {
if (!dragData.value) {
return [];
}
return multipleDragData.value ? (Object.values(dragData.value) as EventData[]) : [dragData.value];
}

function setDragData(data: EventData, multiple = false) {
dragData.value = data;
multipleDragData.value = multiple;
Expand All @@ -32,6 +39,7 @@ export const useEventStore = defineStore("eventStore", () => {
multipleDragData,
clearDragData,
getDragData,
getDragItems,
setDragData,
};
});
7 changes: 3 additions & 4 deletions client/src/utils/mountVueComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import BootstrapVue from "bootstrap-vue";
import { iconPlugin, localizationPlugin, vueRxShortcutPlugin } from "components/plugins";
import { createPinia, PiniaVuePlugin } from "pinia";
import { getActivePinia, PiniaVuePlugin } from "pinia";
import Vue from "vue";

// Load Pinia
Expand All @@ -22,18 +22,17 @@ Vue.use(vueRxShortcutPlugin);
// font-awesome svg icon registration/loading
Vue.use(iconPlugin);

// Create Pinia
const pinia = createPinia();

export const mountVueComponent = (ComponentDefinition) => {
const component = Vue.extend(ComponentDefinition);
const pinia = getActivePinia();
return (propsData, el) => new component({ propsData, el, pinia });
};

export const replaceChildrenWithComponent = (el, ComponentDefinition, propsData = {}) => {
const container = document.createElement("div");
el.replaceChildren(container);
const component = Vue.extend(ComponentDefinition);
const pinia = getActivePinia();
const mountFn = (propsData, el) => new component({ propsData, el, pinia });
return mountFn(propsData, container);
};
4 changes: 2 additions & 2 deletions client/src/utils/setDrag.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Helper to configure datatransfer for drag & drop operations
*/
import { useEventStore } from "@/stores/eventStore";
import { type EventData, useEventStore } from "@/stores/eventStore";

export function setDrag(evt: DragEvent, data = null, multiple = false) {
export function setDrag(evt: DragEvent, data?: EventData, multiple = false) {
const eventStore = useEventStore();
if (data) {
evt.dataTransfer?.setData("text", JSON.stringify([data]));
Expand Down
123 changes: 62 additions & 61 deletions config/plugins/webhooks/demo/tour_generator/script.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions config/plugins/webhooks/demo/tour_generator/tour_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ window.TourGenerator = Backbone.View.extend({
$("#execute").attr("tour_id", "execute");
Toastr.info("Tour generation might take some time.");
$.getJSON(
`${Galaxy.root}api/webhooks/tour_generator/data/`, {
`${Galaxy.root}api/webhooks/tour_generator/data/`,
{
tool_id: toolId,
tool_version: toolVersion,
},
Expand All @@ -31,7 +32,7 @@ window.TourGenerator = Backbone.View.extend({
}
);
},
_getData: function(obj, attempts = 20, delay = 1000) {
_getData: function (obj, attempts = 20, delay = 1000) {
let datasets = [];
_.each(obj.data.hids, (hid) => {
Galaxy.currHistoryPanel.collection.each((dataset) => {
Expand All @@ -49,8 +50,8 @@ window.TourGenerator = Backbone.View.extend({
console.error("Some of the test datasets cannot be found in the history.");
}
},
_generateTour: function (data) {
const tour = window.bundleEntries.runTour("auto.generated", data);
_generateTour: async function (data) {
const tour = await window.bundleEntries.runTour("auto.generated", data);
// Force ending the tour when pressing the Execute button
$("#execute").on("mousedown", () => {
if (tour) {
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/config/sample/galaxy.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ galaxy:
# defaults to "GLOBAL" if not set or the
# `geographical_server_location_code` value is invalid or unsupported.
# To see a full list of supported locations, visit
# https://galaxyproject.org/admin/carbon_emissions
# https://docs.galaxyproject.org/en/master/admin/carbon_emissions.html
#geographical_server_location_code: GLOBAL

# The estimated power usage effectiveness of the data centre housing
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# a template with multiple versions that could be coherent for unit/integration
# testing upgrading object stores templates
- id: secure_disk
version: 0
name: Secure Disk
description: Secure Disk Bound to You
secrets:
sec1:
help: This is my test secret.
configuration:
type: posix
root: '/data/secure/{{ user.username }}/{{ secrets.sec1 }}/aftersec'
- id: secure_disk
version: 1
name: Secure Disk
description: Secure Disk Bound to You
secrets:
sec1:
help: This is my test secret.
sec2:
help: This is my test secret 2.
configuration:
type: posix
root: '/data/secure/{{ user.username }}/{{ secrets.sec1 }}/{{ secrets.sec2 }}'
- id: secure_disk
version: 2
name: Secure Disk
description: Secure Disk Bound to You
secrets:
sec2:
help: This is my test secret 2.
configuration:
type: posix
root: '/data/secure/{{ user.username }}/newbar/{{ secrets.sec2 }}'
Loading

0 comments on commit ec17295

Please sign in to comment.