From 1a2f45c64360cb891fd6fce3764860d920ed31b1 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 17 Jan 2023 17:10:32 -0500 Subject: [PATCH 01/31] Ensure that tool form is initialized before attempting updates triggered by history change emission --- client/src/components/Tool/ToolForm.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/Tool/ToolForm.vue b/client/src/components/Tool/ToolForm.vue index 2dc15868beb..ebb30af69bb 100644 --- a/client/src/components/Tool/ToolForm.vue +++ b/client/src/components/Tool/ToolForm.vue @@ -163,6 +163,7 @@ export default { data() { return { disabled: false, + initialized: false, showLoading: true, showForm: false, showEntryPoints: false, @@ -225,7 +226,7 @@ export default { watch: { getLatestCreateTime() { const Galaxy = getGalaxyInstance(); - if (Galaxy && Galaxy.currHistoryPanel) { + if (this.initialized && Galaxy && Galaxy.currHistoryPanel) { console.debug("History change watcher detected a change."); this.onHistoryChange(); } @@ -233,6 +234,7 @@ export default { }, created() { this.requestTool().then(() => { + this.initialized = true; console.debug(`ToolForm::created - Started listening to history changes. [${this.id}]`); }); }, From dde16032028f831197712a836bb5a9409aa005b3 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 22 Jan 2023 12:32:00 +0100 Subject: [PATCH 02/31] Fix re-enabling save button when invalid connections are resolved --- client/src/stores/workflowConnectionStore.ts | 2 +- lib/galaxy_test/selenium/test_workflow_editor.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/src/stores/workflowConnectionStore.ts b/client/src/stores/workflowConnectionStore.ts index 627f5df5525..7748a417e77 100644 --- a/client/src/stores/workflowConnectionStore.ts +++ b/client/src/stores/workflowConnectionStore.ts @@ -124,7 +124,7 @@ export const useConnectionStore = defineStore("workflowConnectionStore", { Vue.set(this.invalidConnections, connectionId, reason); }, dropFromInvalidConnections(this: State, connectionId: string) { - this.invalidConnections[connectionId] = undefined; + Vue.delete(this.invalidConnections, connectionId); }, removeConnection(this: State, terminal: InputTerminal | OutputTerminal | Connection["id"]) { const stepStore = useWorkflowStepStore(); diff --git a/lib/galaxy_test/selenium/test_workflow_editor.py b/lib/galaxy_test/selenium/test_workflow_editor.py index f907926eb07..9be68ab210c 100644 --- a/lib/galaxy_test/selenium/test_workflow_editor.py +++ b/lib/galaxy_test/selenium/test_workflow_editor.py @@ -558,6 +558,17 @@ steps: editor.select_datatype(datatype="bam").wait_for_and_click() editor.node.output_data_row(output_name="out_file1", extension="bam").wait_for_visible() self.assert_connection_invalid("create_2#out_file1", "checksum#input") + save_button = self.components.workflow_editor.save_button + # Assert save button is disabled + assert save_button.has_class("disabled") + # Make connection valid again + editor.change_datatype.wait_for_and_click() + editor.select_datatype_text_search.wait_for_and_send_keys("tabular") + editor.select_datatype(datatype="tabular").wait_for_and_click() + # Assert connection is valid + self.assert_connected("create_2#out_file1", "checksum#input") + # Assert save button is enabled + assert not save_button.has_class("disabled") @selenium_test def test_change_datatype_post_job_action_lost_regression(self): From e7443bbb01ce6c4c49141bcb8e298b36e93ef9a2 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 23 Jan 2023 16:06:28 +0100 Subject: [PATCH 03/31] Use built-in download_to_file instead of relying on curl/wget for conda/involucro installs Fixes https://github.com/galaxyproject/galaxy/issues/15355 --- lib/galaxy/tool_util/deps/conda_util.py | 6 ++---- lib/galaxy/tool_util/deps/mulled/mulled_build.py | 11 +++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/tool_util/deps/conda_util.py b/lib/galaxy/tool_util/deps/conda_util.py index b5bdfd72473..bc91af0c433 100644 --- a/lib/galaxy/tool_util/deps/conda_util.py +++ b/lib/galaxy/tool_util/deps/conda_util.py @@ -24,6 +24,7 @@ import packaging.version from galaxy.util import ( commands, + download_to_file, listify, shlex_join, smart_str, @@ -483,16 +484,13 @@ def hash_conda_packages(conda_packages: Iterable[CondaTarget]) -> str: def install_conda(conda_context: CondaContext, force_conda_build: bool = False) -> int: with tempfile.NamedTemporaryFile(suffix=".sh", prefix="conda_install", delete=False) as temp: script_path = temp.name - download_cmd = commands.download_command(conda_link(), to=script_path) install_cmd = ["bash", script_path, "-b", "-p", conda_context.conda_prefix] package_targets = list(CONDA_PACKAGE_SPECS) if force_conda_build or conda_context.use_local: package_targets.extend(CONDA_BUILD_SPECS) log.info("Installing conda, this may take several minutes.") try: - exit_code = conda_context.shell_exec(download_cmd) - if exit_code: - return exit_code + download_to_file(conda_link(), script_path) exit_code = conda_context.shell_exec(install_cmd) except Exception: log.exception("Failed to install conda") diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build.py b/lib/galaxy/tool_util/deps/mulled/mulled_build.py index 7f99a829b3f..82ca88e156e 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build.py @@ -29,6 +29,7 @@ from galaxy.tool_util.deps.conda_util import ( from galaxy.tool_util.deps.docker_util import command_list as docker_command_list from galaxy.util import ( commands, + download_to_file, safe_makedirs, shlex_join, unicodify, @@ -428,10 +429,12 @@ def ensure_installed(involucro_context, auto_init): def install_involucro(involucro_context): install_path = os.path.abspath(involucro_context.involucro_bin) involucro_context.involucro_bin = install_path - download_cmd = commands.download_command(involucro_link(), to=install_path) - exit_code = involucro_context.shell_exec(download_cmd) - if exit_code: - return exit_code + + try: + download_to_file(involucro_link(), install_path) + except Exception: + log.exception(f"Failed to download involucro from url '{involucro_link()}'") + return 1 try: os.chmod(install_path, os.stat(install_path).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) return 0 From ce93b01b116660760109e698072d083413b084e2 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 23 Jan 2023 15:08:32 -0500 Subject: [PATCH 04/31] Add metadata generation failed dataset details, when metadata fails --- client/src/components/History/Content/model/states.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/History/Content/model/states.js b/client/src/components/History/Content/model/states.js index 150d990b228..2ddfcecbf9e 100644 --- a/client/src/components/History/Content/model/states.js +++ b/client/src/components/History/Content/model/states.js @@ -33,6 +33,7 @@ export const STATES = { /** metadata discovery/setting failed or errored (but otherwise ok) */ failed_metadata: { status: "danger", + text: "Metadata generation failed.", icon: "exclamation-triangle", }, /** was created without a tool */ From f2926ad41f28d569c1c7ae44c79d78c51737483e Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 24 Jan 2023 10:48:06 +0100 Subject: [PATCH 05/31] Fix reference to sample_tool_conf.xml --- .vscode/.test.env | 2 +- .vscode/launch_gitpod.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/.test.env b/.vscode/.test.env index 0fd4d77f2ed..8321bcadf92 100644 --- a/.vscode/.test.env +++ b/.vscode/.test.env @@ -1 +1 @@ -GALAXY_TEST_TOOL_CONF="lib/galaxy/config/sample/tool_conf.xml.sample,test/functional/tools/samples_tool_conf.xml" \ No newline at end of file +GALAXY_TEST_TOOL_CONF="lib/galaxy/config/sample/tool_conf.xml.sample,test/functional/tools/sample_tool_conf.xml" diff --git a/.vscode/launch_gitpod.json b/.vscode/launch_gitpod.json index c9bee582dcd..ebab8a9437a 100644 --- a/.vscode/launch_gitpod.json +++ b/.vscode/launch_gitpod.json @@ -10,7 +10,7 @@ "env": { "GALAXY_CONFIG_FILE": "${workspaceFolder}/config/galaxy.yml", "GALAXY_CONDA_AUTO_INIT": "false", - "GALAXY_CONFIG_TOOL_CONFIG_FILE": "lib/galaxy/config/sample/tool_conf.xml.sample,test/functional/tools/samples_tool_conf.xml", + "GALAXY_CONFIG_TOOL_CONFIG_FILE": "lib/galaxy/config/sample/tool_conf.xml.sample,test/functional/tools/sample_tool_conf.xml", "GALAXY_CONFIG_DATABASE_CONNECTION": "postgresql://localhost/galaxy" } }, From bb5ecb72a24b8b82753b093eaec6b13988ad2c8f Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 24 Jan 2023 13:32:28 +0100 Subject: [PATCH 06/31] Reset confirmation state then unmounting workflow editor Should fix https://github.com/galaxyproject/galaxy/issues/15366 --- client/src/components/Workflow/Editor/Index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index a682769f5ec..92ee4af0680 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -236,7 +236,7 @@ export default { required: true, }, }, - setup() { + setup(props, { emit }) { const { datatypes, datatypesMapper, datatypesMapperLoading } = useDatatypesMapper(); const connectionsStore = useConnectionStore(); const stepStore = useWorkflowStepStore(); @@ -260,6 +260,7 @@ export default { } onUnmounted(() => { resetStores(); + emit("update:confirmation", false); }); return { connectionsStore, From e9cd987e90ec4400b0578d732fc5b203472a8728 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 24 Jan 2023 14:27:10 +0100 Subject: [PATCH 07/31] Allow configuring webpack devserver port Should be useful when you're debugging against a live server and a local instance. --- client/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index 06f773f8f3a..795db78e6f1 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -252,7 +252,7 @@ module.exports = (env = {}, argv = {}) => { publicPath: "/static/dist", }, hot: true, - port: 8081, + port: process.env.WEBPACK_PORT || 8081, host: "0.0.0.0", // proxy *everything* to the galaxy server. // someday, when we have a fully API-driven independent client, this From 31d31cb74f3e1a4bfabd772458c4a551c801a264 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 24 Jan 2023 12:44:10 +0100 Subject: [PATCH 08/31] Extend terminal test --- client/src/components/Workflow/Editor/modules/terminals.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/Workflow/Editor/modules/terminals.test.ts b/client/src/components/Workflow/Editor/modules/terminals.test.ts index 4d41492bc86..00cdd99954c 100644 --- a/client/src/components/Workflow/Editor/modules/terminals.test.ts +++ b/client/src/components/Workflow/Editor/modules/terminals.test.ts @@ -102,6 +102,7 @@ describe("canAccept", () => { dataIn.connect(collectionOut); expect(dataIn.mapOver).toEqual({ collectionType: "list", isCollection: true, rank: 1 }); expect(dataIn.canAccept(collectionOut).canAccept).toBe(false); + expect(dataIn.canAccept(collectionOut).reason).toBe("Input already filled with another connection, delete it before connecting another output."); dataIn.disconnect(collectionOut); expect(dataIn.canAccept(collectionOut).canAccept).toBe(true); expect(dataIn.mapOver).toEqual(NULL_COLLECTION_TYPE_DESCRIPTION); From bd25f11a5d8a638355a984e00a7a5c43813cb51c Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 24 Jan 2023 08:55:22 -0500 Subject: [PATCH 09/31] Have webpack dev server write files to disk by default -- this should be equivalent to the old watch mode --- client/webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/webpack.config.js b/client/webpack.config.js index 795db78e6f1..aa12a065163 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -250,6 +250,7 @@ module.exports = (env = {}, argv = {}) => { allowedHosts: process.env.GITPOD_WORKSPACE_ID ? "all" : "auto", devMiddleware: { publicPath: "/static/dist", + writeToDisk: true, }, hot: true, port: process.env.WEBPACK_PORT || 8081, From 6c99486d8f2096a6c34bf8c4f0be6302ca06a527 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 24 Jan 2023 09:04:53 -0500 Subject: [PATCH 10/31] Client README updates --- client/README.md | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/client/README.md b/client/README.md index 15fad423884..9b23e47280c 100644 --- a/client/README.md +++ b/client/README.md @@ -53,24 +53,12 @@ and these should not be committed. When you're actively developing, it is convenient to have the client automatically rebuild every time you save a file. You can do this using: - make client-watch - -This will first stage client dependencies, initiate a build, and then will -watch for changes in any of the galaxy client source files. When a file is -changed, the client will automatically rebuild, after which you can refresh -your browser to see changes. - -For even more rapid development you can use the webpack development server, -which takes advantage of hot module replacement (HMR). This technique allows -swapping out of javascript modules while the application is running without -requiring a full page reload most of the time, at least in the more modern -parts of the application. - -The command below starts a special webpack dev server after a client -build. - make client-dev-server +Or, with the package scripts from this `client` directory: + + yarn run develop + This will start up an extra client development server running on port 8081. Open your browser to http://localhost:8081 (instead of the default 8080 that Galaxy would run on), and you should see Galaxy like normal. Except now, when @@ -86,6 +74,10 @@ Sometimes you want to run your local UI against a remote Galaxy server. This is CHANGE_ORIGIN=true GALAXY_URL="https://usegalaxy.org/" make client-dev-server +You can also specify a particular port to bind the dev server to: + + WEBPACK_PORT=8083 yarn run develop + ## Running a Separate Server When developing the client it can be helpful to run a local server for the @@ -94,6 +86,11 @@ commands. This command will run galaxy without building the client: make skip-client +Or by setting the following environment variable and running Galaxy however you +prefer: + + GALAXY_SKIP_CLIENT_BUILD=1 ./run.sh + ## Changing Styles/CSS Galaxy uses Sass for its styling, which is a superset of CSS that compiles down From 56a2ace72d2218d086129b3222878329f7f783ee Mon Sep 17 00:00:00 2001 From: Anup Kumar Date: Thu, 12 Jan 2023 11:49:08 +0100 Subject: [PATCH 11/31] Update interactivetool_ml_jupyter_notebook.xml Add changes to GPU Jupyterlab tool based on Jupytool --- .../interactivetool_ml_jupyter_notebook.xml | 245 ++++++++++++++---- 1 file changed, 197 insertions(+), 48 deletions(-) diff --git a/tools/interactive/interactivetool_ml_jupyter_notebook.xml b/tools/interactive/interactivetool_ml_jupyter_notebook.xml index f11cec41589..5d19185d4ef 100644 --- a/tools/interactive/interactivetool_ml_jupyter_notebook.xml +++ b/tools/interactive/interactivetool_ml_jupyter_notebook.xml @@ -1,6 +1,6 @@ - 0.1 + 0.2 docker.io/anupkumar/docker-ml-jupyterlab:galaxy-integration-@VERSION@ @@ -19,71 +19,221 @@ true - + + + + + + + + - - - - + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + @@ -97,10 +247,9 @@ JupyterLab is a next-generation web-based user interface for Project Jupyter. JupyterLab enables you to work with documents and activities such as Jupyter notebooks, text editors, terminals, and custom components in a flexible, integrated, and extensible manner. - Galaxy offers you to use Jupyter Lab directly in Galaxy accessing and interacting with Galaxy datasets as you like. A very common use-case is to + Galaxy offers you to use JupyterLab directly in Galaxy accessing and interacting with Galaxy datasets as you like. A very common use-case is to do the heavy lifting such as performing computation on GPUs and data reduction steps in Galaxy and the plotting and more `interactive` part on smaller datasets in Jupyter Lab. - You can start with a new Jupyter Lab notebook from scratch and wait until the job starts running. Running job will provide you a link which can be opened in the same or another - browser tab. This link opens Jupyter Lab notebook which can be used to prototype machine learning solutions. + You can start with a new JupyterLab notebook from scratch and wait until the job starts running. Running job will provide you a link which can be opened in the same or another browser tab. This link opens JupyterLab notebook which can be used to prototype machine learning solutions. ]]> From 5ab06841dab4bfcb46fd8cdeab266b0f0d82380b Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 24 Jan 2023 16:23:39 -0500 Subject: [PATCH 12/31] Attempt to force result order? --- client/webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/webpack.config.js b/client/webpack.config.js index 795db78e6f1..3389ffb1529 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -28,6 +28,9 @@ const modulesExcludedFromLibs = [ const buildDate = new Date(); +const dns = require('node:dns'); +dns.setDefaultResultOrder('ipv4first'); + module.exports = (env = {}, argv = {}) => { // environment name based on -d, -p, webpack flag const targetEnv = process.env.NODE_ENV == "production" || argv.mode == "production" ? "production" : "development"; From 7674416df0c1cb0c6e73bc3d881aab904b090329 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 24 Jan 2023 16:38:00 -0500 Subject: [PATCH 13/31] Swap default binding from localhost to explicit ipv4 loopback --- client/webpack.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/webpack.config.js b/client/webpack.config.js index 3389ffb1529..e4729ccc555 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -28,9 +28,6 @@ const modulesExcludedFromLibs = [ const buildDate = new Date(); -const dns = require('node:dns'); -dns.setDefaultResultOrder('ipv4first'); - module.exports = (env = {}, argv = {}) => { // environment name based on -d, -p, webpack flag const targetEnv = process.env.NODE_ENV == "production" || argv.mode == "production" ? "production" : "development"; @@ -262,7 +259,10 @@ module.exports = (env = {}, argv = {}) => { // can be a more limited set -- e.g. `/api`, `/auth` proxy: { "**": { - target: process.env.GALAXY_URL || "http://localhost:8080", + // We explicitly use ipv4 loopback instead of localhost to + // avoid ipv6/ipv4 resolution order issues; this should + // align with Galaxy's default. + target: process.env.GALAXY_URL || "http://127.0.0.1:8080", secure: process.env.CHANGE_ORIGIN ? !process.env.CHANGE_ORIGIN : true, changeOrigin: !!process.env.CHANGE_ORIGIN, logLevel: "debug", From 9a6ee51d28fc278b241efbbd7790efe5439439b4 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 24 Jan 2023 12:25:28 -0500 Subject: [PATCH 14/31] Fix workflow editing route for workflows created from history --- lib/galaxy/webapps/galaxy/controllers/workflow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index 8c8038c6384..b5e8861a911 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -711,8 +711,8 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi 'You can edit or run the workflow.' % ( escape(workflow_name), - url_for(controller="workflow", action="editor", id=workflow_id), - url_for(controller="workflows", action="run", id=workflow_id), + url_for("/workflows/edit?id=%s" % workflow_id), + url_for("/workflows/run?id=%s" % workflow_id), ) ) From 71fbbfe0d232ccd77bd58f98f53398d330dbf987 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 24 Jan 2023 20:35:54 -0500 Subject: [PATCH 15/31] Use fstrings instead of % style composition --- lib/galaxy/webapps/galaxy/controllers/workflow.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/workflow.py b/lib/galaxy/webapps/galaxy/controllers/workflow.py index b5e8861a911..88fae496993 100644 --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -706,14 +706,11 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi ) # Index page with message workflow_id = trans.security.encode_id(stored_workflow.id) + edit_url = url_for(f"/workflows/edit?id={workflow_id}") + run_url = url_for(f"/workflows/run?id={workflow_id}") return trans.show_message( - 'Workflow "%s" created from current history. ' - 'You can edit or run the workflow.' - % ( - escape(workflow_name), - url_for("/workflows/edit?id=%s" % workflow_id), - url_for("/workflows/run?id=%s" % workflow_id), - ) + f'Workflow "{escape(workflow_name)}" created from current history. ' + f'You can edit or run the workflow.' ) def get_item(self, trans, id): From c72af2b045b837cf231a7989d09451ae5992582d Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Wed, 25 Jan 2023 10:35:03 +0100 Subject: [PATCH 16/31] fix broken fetch --- client/src/composables/datatypes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/composables/datatypes.ts b/client/src/composables/datatypes.ts index 88a38f045f4..cb29633e4ec 100644 --- a/client/src/composables/datatypes.ts +++ b/client/src/composables/datatypes.ts @@ -29,7 +29,7 @@ export function useDetailedDatatypes() { async function getDatatypes() { try { - const datatypesPromise = datatypesFetcher({ extension_only: true }); + const datatypesPromise = datatypesFetcher({ extension_only: false }); const datatypeEDAMFormatsPromise = edamFormatsFetcher({}); const datatypeEDAMDataPromise = edamDataFetcher({}); From 32961aca6bf68e877dd427c9855509aedb7b414b Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Wed, 25 Jan 2023 12:58:27 +0100 Subject: [PATCH 17/31] fix zoom and refactor --- .../Workflow/Editor/WorkflowGraph.vue | 5 +- .../Workflow/Editor/ZoomControl.vue | 85 +++++++------------ .../composables/{useZoom.ts => d3Zoom.ts} | 18 +--- .../Workflow/Editor/modules/zoomLevels.ts | 59 +++++++++++++ 4 files changed, 97 insertions(+), 70 deletions(-) rename client/src/components/Workflow/Editor/composables/{useZoom.ts => d3Zoom.ts} (76%) create mode 100644 client/src/components/Workflow/Editor/modules/zoomLevels.ts diff --git a/client/src/components/Workflow/Editor/WorkflowGraph.vue b/client/src/components/Workflow/Editor/WorkflowGraph.vue index 2dfdb7841bc..3dc2aa26b14 100644 --- a/client/src/components/Workflow/Editor/WorkflowGraph.vue +++ b/client/src/components/Workflow/Editor/WorkflowGraph.vue @@ -48,9 +48,10 @@ import { useWorkflowStateStore } from "@/stores/workflowEditorStateStore"; import type { TerminalPosition } from "@/stores/workflowEditorStateStore"; import { DatatypesMapperModel } from "@/components/Datatypes/model"; import { useWorkflowStepStore, type Step } from "@/stores/workflowStepStore"; -import { useZoom } from "./composables/useZoom"; +import { useD3Zoom } from "./composables/d3Zoom"; import type { XYPosition } from "@/stores/workflowEditorStateStore"; import type { OutputTerminals } from "./modules/terminals"; +import { minZoom, maxZoom } from "./modules/zoomLevels"; const emit = defineEmits(["transform", "graph-offset", "onRemove", "scrollTo"]); const props = defineProps({ @@ -67,7 +68,7 @@ const canvas: Ref = ref(null); const elementBounding = useElementBounding(canvas, { windowResize: false, windowScroll: false }); const scroll = useScroll(canvas); -const { transform, panBy, setZoom, moveTo } = useZoom(1, 0.2, 5, canvas, scroll); +const { transform, panBy, setZoom, moveTo } = useD3Zoom(1, minZoom, maxZoom, canvas, scroll); const isDragging = ref(false); provide("isDragging", isDragging); diff --git a/client/src/components/Workflow/Editor/ZoomControl.vue b/client/src/components/Workflow/Editor/ZoomControl.vue index 755d89343e4..081ec21fa7a 100644 --- a/client/src/components/Workflow/Editor/ZoomControl.vue +++ b/client/src/components/Workflow/Editor/ZoomControl.vue @@ -1,8 +1,38 @@ + + - -