Skip to content

Commit

Permalink
Merge branch 'release_24.1' into usegalaxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Jun 12, 2024
2 parents 4feaa2b + a995057 commit 841c3cb
Show file tree
Hide file tree
Showing 33 changed files with 292 additions and 82 deletions.
5 changes: 5 additions & 0 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8555,6 +8555,11 @@ export interface components {
* @default false
*/
use_cached_job?: boolean | null;
/**
* Version
* @description The version of the workflow to invoke.
*/
version?: number | null;
};
/**
* ItemTagsCreatePayload
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/Form/FormElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { faCaretSquareDown, faCaretSquareUp } from "@fortawesome/free-regular-svg-icons";
import { faArrowsAltH, faExclamation, faTimes } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { sanitize } from "dompurify";
import type { ComputedRef } from "vue";
import { computed, ref, useAttrs } from "vue";
import { linkify } from "@/utils/utils";
import type { FormParameterAttributes, FormParameterTypes, FormParameterValue } from "./parameterTypes";
import FormBoolean from "./Elements/FormBoolean.vue";
Expand Down Expand Up @@ -181,7 +184,9 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] !
:class="{ alert: hasAlert, 'alert-info': hasAlert }">
<div v-if="hasAlert" class="ui-form-error">
<FontAwesomeIcon class="mr-1" icon="fa-exclamation" />
<span class="ui-form-error-text" v-html="props.error || props.warning" />
<span
class="ui-form-error-text"
v-html="linkify(sanitize(props.error || props.warning, { USE_PROFILES: { html: true } }))" />
</div>

<div class="ui-form-title">
Expand Down
9 changes: 2 additions & 7 deletions client/src/components/Sharing/Embeds/WorkflowEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useDebounce } from "@vueuse/core";
import { BButton, BFormCheckbox, BFormInput, BInputGroup, BInputGroupAppend } from "bootstrap-vue";
import { computed, reactive, ref } from "vue";
import { getAppRoot } from "@/onload/loadConfig";
import { copy } from "@/utils/clipboard";
import { getFullAppUrl } from "@/utils/utils";
import ZoomControl from "@/components/Workflow/Editor/ZoomControl.vue";
import WorkflowPublished from "@/components/Workflow/Published/WorkflowPublished.vue";
Expand Down Expand Up @@ -39,13 +39,8 @@ function onChangePosition(event: Event, xy: "x" | "y") {
}
}
const root = computed(() => {
const port = window.location.port ? `:${window.location.port}` : "";
return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`;
});
const embedUrl = computed(() => {
let url = `${root.value}published/workflow?id=${props.id}&embed=true`;
let url = getFullAppUrl(`published/workflow?id=${props.id}&embed=true`);
url += `&buttons=${settings.buttons}`;
url += `&about=${settings.about}`;
url += `&heading=${settings.heading}`;
Expand Down
8 changes: 2 additions & 6 deletions client/src/components/Sharing/SharingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getGalaxyInstance } from "@/app";
import { useToast } from "@/composables/toast";
import { getAppRoot } from "@/onload/loadConfig";
import { errorMessageAsString } from "@/utils/simple-error";
import { getFullAppUrl } from "@/utils/utils";
import type { Item, ShareOption } from "./item";
Expand Down Expand Up @@ -52,11 +53,6 @@ const item = ref<Item>({
extra: defaultExtra(),
});
const itemRoot = computed(() => {
const port = window.location.port ? `:${window.location.port}` : "";
return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`;
});
const itemUrl = reactive({
prefix: "",
slug: "",
Expand All @@ -68,7 +64,7 @@ watch(
if (value) {
const index = value.lastIndexOf("/");
itemUrl.prefix = itemRoot.value + value.substring(0, index + 1);
itemUrl.prefix = getFullAppUrl(value.substring(0, index + 1));
itemUrl.slug = value.substring(index + 1);
}
},
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ export default {
this.report.markdown = markdown;
},
onRun() {
const runUrl = `/workflows/run?id=${this.id}`;
const runUrl = `/workflows/run?id=${this.id}${
this.version !== undefined ? `&version=${this.version}` : ""
}`;
this.onNavigate(runUrl);
},
async onNavigate(url, forceSave = false, ignoreChanges = false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { computed } from "vue";
import { RouterLink } from "vue-router";
import { getAppRoot } from "@/onload/loadConfig";
import { useUserStore } from "@/stores/userStore";
import { getFullAppUrl } from "@/utils/utils";
import Heading from "@/components/Common/Heading.vue";
import CopyToClipboard from "@/components/CopyToClipboard.vue";
Expand Down Expand Up @@ -42,17 +42,12 @@ const gravatarSource = computed(
const publishedByUser = computed(() => `/workflows/list_published?owner=${props.workflowInfo?.owner}`);
const root = computed(() => {
const port = window.location.port ? `:${window.location.port}` : "";
return `${window.location.protocol}//${window.location.hostname}${port}${getAppRoot()}`;
});
const relativeLink = computed(() => {
return `/published/workflow?id=${props.workflowInfo.id}`;
});
const fullLink = computed(() => {
return `${root.value}${relativeLink.value.substring(1)}`;
return getFullAppUrl(relativeLink.value.substring(1));
});
const userOwned = computed(() => {
Expand Down
10 changes: 7 additions & 3 deletions client/src/components/Workflow/Run/WorkflowRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ const router = useRouter();
interface Props {
workflowId: string;
version?: string;
preferSimpleForm?: boolean;
simpleFormTargetHistory?: string;
simpleFormUseJobCache?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
version: undefined,
preferSimpleForm: false,
simpleFormTargetHistory: "current",
simpleFormUseJobCache: false,
Expand All @@ -49,7 +51,9 @@ const workflowName = ref("");
const workflowModel: any = ref(null);
const currentHistoryId = computed(() => historyStore.currentHistoryId);
const editorLink = computed(() => `/workflows/edit?id=${props.workflowId}`);
const editorLink = computed(
() => `/workflows/edit?id=${props.workflowId}${props.version ? `&version=${props.version}` : ""}`
);
const historyStatusKey = computed(() => `${currentHistoryId.value}_${lastUpdateTime.value}`);
const isOwner = computed(() => currentUser.value?.username === workflowModel.value.runData.owner);
const lastUpdateTime = computed(() => historyItemsStore.lastUpdateTime);
Expand All @@ -74,7 +78,7 @@ function handleSubmissionError(error: string) {
}
function loadRun() {
getRunData(props.workflowId)
getRunData(props.workflowId, props.version || undefined)
.then((runData) => {
const incomingModel = new WorkflowRunModel(runData);
simpleForm.value = props.preferSimpleForm;
Expand Down Expand Up @@ -116,7 +120,7 @@ function loadRun() {
}
async function onImport() {
const response = await copyWorkflow(props.workflowId, workflowModel.value.runData.owner);
const response = await copyWorkflow(props.workflowId, workflowModel.value.runData.owner, props.version);
router.push(`/workflows/edit?id=${response.id}`);
}
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Workflow/Run/WorkflowRunForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</span>
</BAlert>
<div class="h4 clearfix mb-3">
<b>Workflow: {{ model.name }}</b>
<b>Workflow: {{ model.name }}</b> <i>(version: {{ model.runData.version + 1 }})</i>
<ButtonSpinner
id="run-workflow"
class="float-right"
Expand Down Expand Up @@ -231,6 +231,7 @@ export default {
// the user is already warned if tool versions are wrong,
// they can still choose to invoke the workflow anyway.
require_exact_tool_versions: false,
version: this.model.runData.version,
};
console.debug("WorkflowRunForm::onExecute()", "Ready for submission.", jobDef);
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Workflow/Run/WorkflowRunFormSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
or send the results to a new one using the run settings ⚙️
</span>
</BAlert>
<b>Workflow: {{ model.name }}</b>
<b>Workflow: {{ model.name }}</b> <i>(version: {{ model.runData.version + 1 }})</i>
<ButtonSpinner
id="run-workflow"
:wait="waitingForRequest"
Expand Down Expand Up @@ -200,6 +200,7 @@ export default {
batch: true,
use_cached_job: this.useCachedJobs,
require_exact_tool_versions: false,
version: this.model.runData.version,
};
if (this.sendToNewHistory) {
data.new_history_name = this.model.name;
Expand Down
8 changes: 6 additions & 2 deletions client/src/components/Workflow/Run/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import { rethrowSimple } from "utils/simple-error";
* for implementation). This contains the data needed to render the UI for workflows.
*
* @param {String} workflowId - (Stored?) Workflow ID to fetch data for.
* @param {String} version - Version of the workflow to fetch.
*/
export async function getRunData(workflowId) {
const url = `${getAppRoot()}api/workflows/${workflowId}/download?style=run`;
export async function getRunData(workflowId, version = null) {
let url = `${getAppRoot()}api/workflows/${workflowId}/download?style=run`;
if (version) {
url += `&version=${version}`;
}
try {
const response = await axios.get(url);
return response.data;
Expand Down
40 changes: 29 additions & 11 deletions client/src/components/Workflow/WorkflowActionsExtend.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
<script setup lang="ts">
import { library } from "@fortawesome/fontawesome-svg-core";
import { faStar as farStar } from "@fortawesome/free-regular-svg-icons";
import {
faCaretDown,
faCopy,
faDownload,
faFileExport,
faShareAlt,
faStar,
faTrashRestore,
} from "@fortawesome/free-solid-svg-icons";
import { faCopy, faDownload, faLink, faShareAlt, faTrashRestore } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BButton } from "bootstrap-vue";
import { storeToRefs } from "pinia";
Expand All @@ -19,9 +10,11 @@ import { copyWorkflow, undeleteWorkflow } from "@/components/Workflow/workflows.
import { useConfirmDialog } from "@/composables/confirmDialog";
import { Toast } from "@/composables/toast";
import { useUserStore } from "@/stores/userStore";
import { copy } from "@/utils/clipboard";
import { withPrefix } from "@/utils/redirect";
import { getFullAppUrl } from "@/utils/utils";
library.add(faCaretDown, faCopy, faDownload, faFileExport, faShareAlt, farStar, faStar, faTrashRestore);
library.add(faCopy, faDownload, faLink, faShareAlt, faTrashRestore);
interface Props {
workflow: any;
Expand Down Expand Up @@ -72,11 +65,36 @@ async function onRestore() {
Toast.info("Workflow restored");
}
}
const relativeLink = computed(() => {
return `/published/workflow?id=${props.workflow.id}`;
});
const fullLink = computed(() => {
return getFullAppUrl(relativeLink.value.substring(1));
});
function onCopyPublicLink() {
copy(fullLink.value);
Toast.success("Link to workflow copied");
}
</script>

<template>
<div class="workflow-actions-extend flex-gapx-1">
<BButtonGroup>
<BButton
v-if="workflow.published && !workflow.deleted"
id="workflow-copy-public-button"
v-b-tooltip.hover.noninteractive
:size="buttonSize"
title="Copy link to workflow"
variant="outline-primary"
@click="onCopyPublicLink">
<FontAwesomeIcon :icon="faLink" fixed-width />
<span class="compact-view">Link to Workflow</span>
</BButton>

<BButton
v-if="!isAnonymous && !shared && !workflow.deleted"
id="workflow-copy-button"
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Workflow/WorkflowIndicators.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { library } from "@fortawesome/fontawesome-svg-core";
import { faGlobe, faLink, faShieldAlt, faUser, faUsers } from "@fortawesome/free-solid-svg-icons";
import { faFileImport, faGlobe, faShieldAlt, faUser, faUsers } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BBadge, BButton } from "bootstrap-vue";
import { computed } from "vue";
Expand All @@ -12,7 +12,7 @@ import { copy } from "@/utils/clipboard";
import UtcDate from "@/components/UtcDate.vue";
library.add(faShieldAlt, faLink, faGlobe, faUsers, faUser);
library.add(faFileImport, faGlobe, faShieldAlt, faUsers, faUser);
interface Props {
workflow: any;
Expand Down Expand Up @@ -116,7 +116,7 @@ function onViewUserPublished() {
size="sm"
class="workflow-external-link inline-icon-button"
:title="sourceTitle">
<FontAwesomeIcon :icon="faLink" fixed-width @click="onCopyLink" />
<FontAwesomeIcon :icon="faFileImport" fixed-width @click="onCopyLink" />
</BButton>

<span class="mr-1">
Expand Down
10 changes: 8 additions & 2 deletions client/src/components/Workflow/WorkflowRunButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { faPlay } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BButton } from "bootstrap-vue";
import { computed } from "vue";
library.add(faPlay);
Expand All @@ -11,9 +12,14 @@ interface Props {
full?: boolean;
title?: string;
disabled?: boolean;
version?: number;
}
defineProps<Props>();
const props = defineProps<Props>();
const runPath = computed(
() => `/workflows/run?id=${props.id}${props.version !== undefined ? `&version=${props.version}` : ""}`
);
</script>

<template>
Expand All @@ -25,7 +31,7 @@ defineProps<Props>();
variant="primary"
size="sm"
:disabled="disabled"
:to="`/workflows/run?id=${id}`">
:to="runPath">
<FontAwesomeIcon :icon="faPlay" fixed-width />

<span v-if="full" v-localize>Run</span>
Expand Down
8 changes: 6 additions & 2 deletions client/src/components/Workflow/workflows.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export async function updateWorkflow(id: string, changes: object): Promise<Workf
return data;
}

export async function copyWorkflow(id: string, currentOwner: string): Promise<Workflow> {
const { data: workflowData } = await axios.get(withPrefix(`/api/workflows/${id}/download`));
export async function copyWorkflow(id: string, currentOwner: string, version?: string): Promise<Workflow> {
let path = `/api/workflows/${id}/download`;
if (version) {
path += `?version=${version}`;
}
const { data: workflowData } = await axios.get(withPrefix(path));

workflowData.name = `Copy of ${workflowData.name}`;
const currentUsername = useUserStore().currentUser?.username;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function getWorkflowName() {
size="sm"
variant="secondary"
:disabled="isDeletedWorkflow"
:to="`/workflows/edit?id=${getWorkflowId()}`">
:to="`/workflows/edit?id=${getWorkflowId()}&version=${workflowVersion}`">
<FontAwesomeIcon :icon="faEdit" />
<span v-localize>Edit</span>
</BButton>
Expand All @@ -218,7 +218,8 @@ function getWorkflowName() {
: 'This workflow has been deleted.'
"
:disabled="isDeletedWorkflow"
full />
full
:version="workflowVersion" />
</BButtonGroup>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions client/src/entry/analysis/modules/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default {
},
workflowParams() {
const workflowId = this.query.workflow_id;
const version = this.query.version;
let preferSimpleForm = this.config.simplified_workflow_run_ui == "prefer";
const preferSimpleFormOverride = this.query.simplified_workflow_run_ui;
if (preferSimpleFormOverride == "prefer") {
Expand All @@ -68,6 +69,7 @@ export default {
const simpleFormUseJobCache = this.config.simplified_workflow_run_ui_job_cache == "on";
return {
workflowId,
version,
preferSimpleForm,
simpleFormTargetHistory,
simpleFormUseJobCache,
Expand Down
Loading

0 comments on commit 841c3cb

Please sign in to comment.