Unverified Commit 7253c220 authored by Alireza Heidari's avatar Alireza Heidari
Browse files

🔨: replace direct URL construction with the `getFullAppUrl` utility function...

🔨: replace direct URL construction with the `getFullAppUrl` utility function in `WorkflowEmbed`, `SharingPage`, `WorkflowInformation` and `WorkflowActionsExtend`
parent c5d1231c
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -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";
@@ -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}`;
+2 −6
Original line number Diff line number Diff line
@@ -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";

@@ -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: "",
@@ -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);
        }
    },
+2 −7
Original line number Diff line number Diff line
@@ -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";
@@ -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(() => {
+2 −7
Original line number Diff line number Diff line
@@ -9,10 +9,10 @@ import { computed } from "vue";
import { copyWorkflow, undeleteWorkflow } from "@/components/Workflow/workflows.services";
import { useConfirmDialog } from "@/composables/confirmDialog";
import { Toast } from "@/composables/toast";
import { getAppRoot } from "@/onload/loadConfig";
import { useUserStore } from "@/stores/userStore";
import { copy } from "@/utils/clipboard";
import { withPrefix } from "@/utils/redirect";
import { getFullAppUrl } from "@/utils/utils";

library.add(faCopy, faDownload, faLink, faShareAlt, faTrashRestore);

@@ -66,17 +66,12 @@ async function onRestore() {
    }
}

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.workflow.id}`;
});

const fullLink = computed(() => {
    return `${root.value}${relativeLink.value.substring(1)}`;
    return getFullAppUrl(relativeLink.value.substring(1));
});

function onCopyPublicLink() {