From aad2f585bae5a0b3660335cf3fb0ec7fd02f1544 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Sat, 13 Jun 2026 16:54:29 -0500 Subject: [PATCH] use `PageDisplayToolbar` in editor view as well --- .../src/components/Common/RenameModal.test.ts | 7 +- client/src/components/Common/RenameModal.vue | 4 +- .../components/PageEditor/PageEditorView.vue | 145 ++++++------------ client/src/utils/navigation/navigation.yml | 9 +- lib/galaxy/selenium/navigates_galaxy.py | 32 ++-- .../selenium/test_histories_list.py | 14 +- .../selenium/test_history_pages.py | 13 +- lib/galaxy_test/selenium/test_pages.py | 1 - 8 files changed, 80 insertions(+), 145 deletions(-) diff --git a/client/src/components/Common/RenameModal.test.ts b/client/src/components/Common/RenameModal.test.ts index ff6fa8cfdf9..113d13cb327 100644 --- a/client/src/components/Common/RenameModal.test.ts +++ b/client/src/components/Common/RenameModal.test.ts @@ -23,6 +23,7 @@ const localVue = getLocalVue(); const WORKFLOW_ID = "workflow-abc123"; const WORKFLOW_NAME = "My Test Workflow"; +const INPUT_SELECTOR = "[data-description='workflow name input']"; async function mountRenameModal(name = WORKFLOW_NAME) { const wrapper = mount(RenameModal as object, { @@ -52,7 +53,7 @@ describe("RenameModal tested for renaming workflows", () => { const wrapper = await mountRenameModal(); - await createWrapper(document.body).find("#workflow-name-input").setValue("Renamed Workflow"); + await createWrapper(document.body).find(INPUT_SELECTOR).setValue("Renamed Workflow"); wrapper.findComponent(GModal).vm.$emit("ok"); await flushPromises(); @@ -65,7 +66,7 @@ describe("RenameModal tested for renaming workflows", () => { const wrapper = await mountRenameModal(); - await createWrapper(document.body).find("#workflow-name-input").setValue("Attempted New Name"); + await createWrapper(document.body).find(INPUT_SELECTOR).setValue("Attempted New Name"); wrapper.findComponent(GModal).vm.$emit("ok"); await flushPromises(); @@ -77,7 +78,7 @@ describe("RenameModal tested for renaming workflows", () => { // Simulate parent closing and reopening the modal (destroys old instance) wrapper.destroy(); await mountRenameModal(); - expect((createWrapper(document.body).find("#workflow-name-input").element as HTMLInputElement).value).toBe( + expect((createWrapper(document.body).find(INPUT_SELECTOR).element as HTMLInputElement).value).toBe( WORKFLOW_NAME, ); }); diff --git a/client/src/components/Common/RenameModal.vue b/client/src/components/Common/RenameModal.vue index 5636f8c990f..9eff7bcee2c 100644 --- a/client/src/components/Common/RenameModal.vue +++ b/client/src/components/Common/RenameModal.vue @@ -63,15 +63,15 @@ async function onRename(newName: string) { show :ok-text="localize('Rename')" :ok-disabled="nameInvalid || renaming" - :title="`Rename ${props.itemType}: ${props.name}`" + :title="`Rename ${capitalizeFirstLetter(props.itemType)}: ${props.name}`" confirm :close-on-ok="false" @ok="onRename(nameModel)" @close="emit('close')" @cancel="emit('close')"> -import { faArrowLeft, faEye, faHistory, faSave, faSpinner, faUsers } from "@fortawesome/free-solid-svg-icons"; +import { faSpinner, faUsers } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { BAlert, BBadge, BButton } from "bootstrap-vue"; +import { BAlert } from "bootstrap-vue"; import { computed, onMounted, onUnmounted, ref, watch } from "vue"; import { useRouter } from "vue-router/composables"; -import { getGalaxyInstance } from "@/app"; -import type { RouterPushOptions } from "@/components/History/Content/router-push-options"; +// import { getGalaxyInstance } from "@/app"; +// import type { RouterPushOptions } from "@/components/History/Content/router-push-options"; import { PAGE_LABELS } from "@/components/Page/constants"; import { useWindowAwareNavigation } from "@/composables/windowAwareNavigation"; import { useHistoryStore } from "@/stores/historyStore"; import { type PageEditorMode, usePageEditorStore } from "@/stores/pageEditorStore"; +import GButton from "../BaseComponents/GButton.vue"; import ObjectPermissionsModal from "./ObjectPermissionsModal.vue"; import PageDisplayOnly from "./PageDisplayOnly.vue"; +import PageDisplayToolbar from "./PageDisplayToolbar.vue"; import PageRevisionList from "./PageRevisionList.vue"; import PageRevisionView from "./PageRevisionView.vue"; -import ClickToEdit from "@/components/ClickToEdit.vue"; import MarkdownEditor from "@/components/Markdown/MarkdownEditor.vue"; const props = defineProps<{ @@ -125,39 +126,33 @@ function handleEdit() { } } -async function handleSave() { - await store.savePage(); -} - -async function handleSaveAndView() { - await store.savePage(); - if (props.invocationId) { - router.push(`/workflows/invocations/${props.invocationId}/reports?id=${props.pageId}`); - return; - } - if (store.currentPage) { - const Galaxy = getGalaxyInstance(); - const isWmActive = Galaxy?.frame?.active; - if (isWmActive) { - const url = `/published/page?id=${props.pageId}&embed=true`; - const options: RouterPushOptions = { - title: `${labels.value.entityName}: ${store.currentTitle || labels.value.defaultTitle}`, - preventWindowManager: false, - }; - // @ts-ignore - monkeypatched router - router.push(url, options); - } else { - const data = store.currentPage as any; - if (data.username && data.slug) { - window.location.href = `/u/${data.username}/p/${data.slug}`; - } - } - } -} - -function handleTitleChange(newTitle: string) { - store.updateTitle(newTitle); -} +// TODO: Uncomment when router guards with unsaved changes protection are implemented +// Before, we had a Save & View button that is now removed. +// async function handleSaveAndView() { +// await store.savePage(); +// if (props.invocationId) { +// router.push(`/workflows/invocations/${props.invocationId}/reports?id=${props.pageId}`); +// return; +// } +// if (store.currentPage) { +// const Galaxy = getGalaxyInstance(); +// const isWmActive = Galaxy?.frame?.active; +// if (isWmActive) { +// const url = `/published/page?id=${props.pageId}&embed=true`; +// const options: RouterPushOptions = { +// title: `${labels.value.entityName}: ${store.currentTitle || labels.value.defaultTitle}`, +// preventWindowManager: false, +// }; +// // @ts-ignore - monkeypatched router +// router.push(url, options); +// } else { +// const data = store.currentPage as any; +// if (data.username && data.slug) { +// window.location.href = `/u/${data.username}/p/${data.slug}`; +// } +// } +// } +// } function handleContentUpdate(newContent: string) { store.updateContent(newContent); @@ -208,78 +203,24 @@ function handleRevisionRestore(revisionId: string) {