diff --git a/client/src/components/Workflow/Import/FromFile.vue b/client/src/components/Workflow/Import/FromFile.vue index d5fe4ffa9a5..607f9e9b246 100644 --- a/client/src/components/Workflow/Import/FromFile.vue +++ b/client/src/components/Workflow/Import/FromFile.vue @@ -1,44 +1,40 @@ + + diff --git a/client/src/components/Workflow/Import/FromFileOrUrl.test.ts b/client/src/components/Workflow/Import/FromFileOrUrl.test.ts index f9c759b83be..b324c6cc148 100644 --- a/client/src/components/Workflow/Import/FromFileOrUrl.test.ts +++ b/client/src/components/Workflow/Import/FromFileOrUrl.test.ts @@ -1,6 +1,7 @@ import { getLocalVue } from "@tests/vitest/helpers"; import { mount } from "@vue/test-utils"; import { describe, expect, it, vi } from "vitest"; +import VueRouter from "vue-router"; import FromFile from "./FromFile.vue"; import FromUrl from "./FromUrl.vue"; @@ -17,6 +18,7 @@ vi.mock("axios", () => ({ })); const localVue = getLocalVue(true); +localVue.use(VueRouter); const sharedUrl = "http://127.0.0.1:8081/u/admin/w/unnamed-workflow"; const sharedUrlTrailingSlash = "http://127.0.0.1:8081/u/admin/w/unnamed-workflow/"; @@ -25,7 +27,8 @@ const invalidUrl = "http://127.0.0.1:8081/u/admin/w/unnamed-workflow/additional- describe("FromUrl", () => { it("converts shared urls to json urls", async () => { - const wrapper = mount(FromUrl as object, { localVue }); + const router = new VueRouter(); + const wrapper = mount(FromUrl as object, { localVue, router }); { const input = wrapper.find("#workflow-import-url-input"); @@ -71,7 +74,8 @@ describe("FromUrl", () => { describe("FromFile", () => { it("can mount the component", async () => { - const wrapper = mount(FromFile as object, { localVue }); - expect(wrapper.find("#workflow-import-button").exists()).toBe(true); + const router = new VueRouter(); + const wrapper = mount(FromFile as object, { localVue, router }); + expect(wrapper.find("form").exists()).toBe(true); }); }); diff --git a/client/src/components/Workflow/Import/FromUrl.vue b/client/src/components/Workflow/Import/FromUrl.vue index 4c0658cd5cb..bb53f8507fd 100644 --- a/client/src/components/Workflow/Import/FromUrl.vue +++ b/client/src/components/Workflow/Import/FromUrl.vue @@ -2,6 +2,7 @@ import axios from "axios"; import { BAlert, BForm, BFormGroup, BFormInput } from "bootstrap-vue"; import { computed, type Ref, ref, watch } from "vue"; +import { RouterLink } from "vue-router"; import { useRouter } from "vue-router/composables"; import { getRedirectOnImportPath } from "@/components/Workflow/redirectPath"; @@ -9,14 +10,6 @@ import { withPrefix } from "@/utils/redirect"; import LoadingSpan from "@/components/LoadingSpan.vue"; -interface Props { - hideSubmitButton?: boolean; -} - -const props = withDefaults(defineProps(), { - hideSubmitButton: false, -}); - const emit = defineEmits<{ (e: "input-valid", valid: boolean): void; }>(); @@ -25,14 +18,6 @@ const loading = ref(false); const sourceURL: Ref = ref(null); const errorMessage: Ref = ref(null); -const isImportDisabled = computed(() => { - return !sourceURL.value; -}); - -const importTooltip = computed(() => { - return isImportDisabled.value ? "You must provide a workflow archive URL." : "Import workflow from URL"; -}); - const hasErrorMessage = computed(() => { return errorMessage.value != null; }); @@ -46,11 +31,6 @@ watch(isValid, (newValue) => { emit("input-valid", newValue); }); -// Hide submit button in wizard mode (or when hideSubmitButton is true) -const showSubmitButton = computed(() => { - return !props.hideSubmitButton; -}); - function autoAppendJson(urlString: string): string { const sharedWorkflowRegex = /^(https?:\/\/[\S]+\/u\/[\S]+\/w\/[^\s/]+)\/?$/; const matches = urlString.match(sharedWorkflowRegex); @@ -65,8 +45,7 @@ function autoAppendJson(urlString: string): string { const router = useRouter(); -async function submit(ev: SubmitEvent) { - ev.preventDefault(); +async function submit() { const formData = new FormData(); if (sourceURL.value) { @@ -94,14 +73,14 @@ async function submit(ev: SubmitEvent) { // Expose method for wizard submit async function attemptImport() { - await submit(new Event("submit") as SubmitEvent); + await submit(); } defineExpose({ attemptImport }); diff --git a/client/src/components/Workflow/Import/TrsIdImport.vue b/client/src/components/Workflow/Import/TrsIdImport.vue index f6fb5d3f00a..3c33eed25ed 100644 --- a/client/src/components/Workflow/Import/TrsIdImport.vue +++ b/client/src/components/Workflow/Import/TrsIdImport.vue @@ -134,8 +134,6 @@ defineExpose({ triggerImport });