From 3b2bb6e94deb4fb3572fa1e5734b17cacedb6a5f Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 2 Feb 2023 10:47:25 +0100 Subject: [PATCH 01/17] test validators for optional parameters --- lib/galaxy/tools/parameters/basic.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index e84317ff557..e50d5a01bec 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -327,6 +327,15 @@ class SimpleTextToolParameter(ToolParameter): input_source = ensure_input_source(input_source) super().__init__(tool, input_source) self.optional = input_source.get_bool("optional", False) + + if not self.optional: + try: + for validator in self.validators: + validator.validate("") + self.optional = True + except ValueError: + self.optional = False + if self.optional: self.value = None else: From 9cf8af6d2155d186b5982780c8e7617f738eede0 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 2 Feb 2023 12:18:54 +0100 Subject: [PATCH 02/17] check type Co-authored-by: Marius van den Beek --- lib/galaxy/tools/parameters/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index e50d5a01bec..9fb5e937fff 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -328,7 +328,7 @@ class SimpleTextToolParameter(ToolParameter): super().__init__(tool, input_source) self.optional = input_source.get_bool("optional", False) - if not self.optional: + if not self.optional and self.type == "text": try: for validator in self.validators: validator.validate("") From 896af3d693a53c702b8a19caececcb30bf61e5c6 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 2 Feb 2023 12:36:32 +0100 Subject: [PATCH 03/17] add validator to optional test --- test/unit/app/tools/test_parameter_parsing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/app/tools/test_parameter_parsing.py b/test/unit/app/tools/test_parameter_parsing.py index 6c0c01ca28c..abfe41c5c0f 100644 --- a/test/unit/app/tools/test_parameter_parsing.py +++ b/test/unit/app/tools/test_parameter_parsing.py @@ -91,7 +91,9 @@ class TestParameterParsing(BaseParameterTestCase): def test_parse_optional(self): param = self._parameter_for( xml=""" - + + + """ ) assert param.optional is False From be0ff2511b624d4b7443e4ea9e955687999f8760 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 2 Feb 2023 13:55:36 +0100 Subject: [PATCH 04/17] fix inline test --- lib/galaxy/tools/parameters/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 9fb5e937fff..6b9094c9fa5 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -362,7 +362,7 @@ class TextToolParameter(SimpleTextToolParameter): >>> p = TextToolParameter(None, XML('')) >>> print(p.name) _name - >>> assert sorted(p.to_dict(trans).items()) == [('area', False), ('argument', None), ('datalist', []), ('help', ''), ('hidden', False), ('is_dynamic', False), ('label', ''), ('model_class', 'TextToolParameter'), ('name', '_name'), ('optional', False), ('refresh_on_change', False), ('type', 'text'), ('value', u'default')] + >>> assert sorted(p.to_dict(trans).items()) == [('area', False), ('argument', None), ('datalist', []), ('help', ''), ('hidden', False), ('is_dynamic', False), ('label', ''), ('model_class', 'TextToolParameter'), ('name', '_name'), ('optional', True), ('refresh_on_change', False), ('type', 'text'), ('value', u'default')] """ def __init__(self, tool, input_source): From 6135d965dc7326cae598bbc6f12e6b65d638dfee Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Fri, 3 Feb 2023 14:21:48 +0100 Subject: [PATCH 05/17] load on job state change --- .../History/CurrentCollection/CollectionPanel.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/src/components/History/CurrentCollection/CollectionPanel.vue b/client/src/components/History/CurrentCollection/CollectionPanel.vue index eb69d0ee598..fcc6942e9ce 100644 --- a/client/src/components/History/CurrentCollection/CollectionPanel.vue +++ b/client/src/components/History/CurrentCollection/CollectionPanel.vue @@ -4,6 +4,7 @@ Date: Thu, 2 Feb 2023 02:16:00 +0500 Subject: [PATCH 06/17] Create ToolSuccess route and refactor component --- client/src/components/Tool/ToolForm.vue | 24 ++- client/src/components/Tool/ToolSuccess.vue | 143 ++++++++---------- .../components/Tool/ToolSuccessMessage.vue | 79 ++++++++++ client/src/entry/analysis/router.js | 6 + client/src/store/index.js | 2 - client/src/store/jobStore.js | 33 ---- client/src/stores/jobStore.js | 37 +++++ lib/galaxy/webapps/galaxy/buildapp.py | 1 + 8 files changed, 201 insertions(+), 124 deletions(-) create mode 100644 client/src/components/Tool/ToolSuccessMessage.vue delete mode 100644 client/src/store/jobStore.js create mode 100644 client/src/stores/jobStore.js diff --git a/client/src/components/Tool/ToolForm.vue b/client/src/components/Tool/ToolForm.vue index ebb30af69bb..e92ef642764 100644 --- a/client/src/components/Tool/ToolForm.vue +++ b/client/src/components/Tool/ToolForm.vue @@ -10,12 +10,6 @@
- - {{ errorMessage }} @@ -108,7 +102,8 @@ + + diff --git a/client/src/components/Tool/ToolSuccessMessage.vue b/client/src/components/Tool/ToolSuccessMessage.vue new file mode 100644 index 00000000000..12c39f38a92 --- /dev/null +++ b/client/src/components/Tool/ToolSuccessMessage.vue @@ -0,0 +1,79 @@ + + + diff --git a/client/src/entry/analysis/router.js b/client/src/entry/analysis/router.js index 558e962322f..d7a55851a84 100644 --- a/client/src/entry/analysis/router.js +++ b/client/src/entry/analysis/router.js @@ -46,6 +46,7 @@ import Sharing from "components/Sharing/Sharing"; import StoredWorkflowInvocations from "components/Workflow/StoredWorkflowInvocations"; import ToolsJson from "components/ToolsView/ToolsSchemaJson/ToolsJson"; import ToolsList from "components/ToolsList/ToolsList"; +import ToolSuccess from "components/Tool/ToolSuccess"; import TourList from "components/Tour/TourList"; import TourRunner from "components/Tour/TourRunner"; import TrsImport from "components/Workflow/Import/TrsImport"; @@ -252,6 +253,11 @@ export function getRouter(Galaxy) { path: "interactivetool_entry_points/list", component: InteractiveTools, }, + { + path: "jobs/:jobId/success", + component: ToolSuccess, + props: true, + }, { path: "jobs/:jobId/view", component: JobDetails, diff --git a/client/src/store/index.js b/client/src/store/index.js index dd33e13485e..5088eec76f8 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -21,7 +21,6 @@ import { configStore } from "./configStore"; import { toolStore } from "./toolStore"; import { datasetPathDestinationStore } from "./datasetPathDestinationStore"; import { datasetExtFilesStore } from "./datasetExtFilesStore"; -import { jobStore } from "./jobStore"; import { collectionAttributesStore } from "./collectionAttributesStore"; import { panelStore } from "./panelStore"; @@ -61,7 +60,6 @@ export function createStore() { dataset: datasetStore, datasetExtFiles: datasetExtFilesStore, datasetPathDestination: datasetPathDestinationStore, - informationStore: jobStore, invocations: invocationStore, jobMetrics: jobMetricsStore, gridSearch: gridSearchStore, diff --git a/client/src/store/jobStore.js b/client/src/store/jobStore.js deleted file mode 100644 index c5e04d60c41..00000000000 --- a/client/src/store/jobStore.js +++ /dev/null @@ -1,33 +0,0 @@ -export const state = { - job: {}, -}; - -import Vue from "vue"; -import { getAppRoot } from "onload/loadConfig"; -import axios from "axios"; - -const getters = { - job: (state) => (jobId) => { - return state.job[jobId]; - }, -}; - -const actions = { - fetchJob: async ({ commit }, jobId) => { - const { data } = await axios.get(`${getAppRoot()}api/jobs/${jobId}?full=true`); - commit("saveJobForJobId", { jobId, job: data }); - }, -}; - -const mutations = { - saveJobForJobId: (state, { jobId, job }) => { - Vue.set(state.job, jobId, job); - }, -}; - -export const jobStore = { - state, - getters, - actions, - mutations, -}; diff --git a/client/src/stores/jobStore.js b/client/src/stores/jobStore.js new file mode 100644 index 00000000000..bdd38d39e31 --- /dev/null +++ b/client/src/stores/jobStore.js @@ -0,0 +1,37 @@ +/** + * Requests jobs + * Requests response generated by a tool run + */ + +import { defineStore } from "pinia"; +import Vue from "vue"; +import { getAppRoot } from "onload/loadConfig"; +import axios from "axios"; + +export const useJobStore = defineStore("jobStore", { + state: () => ({ + job: {}, + responses: {}, + }), + getters: { + getJob: (state) => { + return (jobId) => state.job[jobId]; + }, + getResponseForJobId: (state) => { + return (jobId) => state.responses[jobId]; + }, + }, + actions: { + async fetchJob(jobId) { + const { data } = await axios.get(`${getAppRoot()}api/jobs/${jobId}?full=true`); + this.saveJobForJobId(jobId, data); + }, + // Setters + saveJobForJobId(jobId, job) { + Vue.set(this.job, jobId, job); + }, + saveResponseForJobId(jobId, response) { + Vue.set(this.responses, jobId, response); + }, + }, +}); diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index db6b8b0c67f..bf56fd39234 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -251,6 +251,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs): webapp.add_client_route("/datasets/{dataset_id}/preview") webapp.add_client_route("/datasets/{dataset_id}/show_params") webapp.add_client_route("/collection/{collection_id}/edit") + webapp.add_client_route("/jobs/{job_id}/success") webapp.add_client_route("/jobs/{job_id}/view") webapp.add_client_route("/workflows/list") webapp.add_client_route("/workflows/list_published") From 2a2d3144e6ce9f1d0e04021517cf054aa7b9b9b9 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Thu, 2 Feb 2023 02:20:48 +0500 Subject: [PATCH 07/17] ToolSuccess route - remove import comment --- client/src/components/Tool/ToolSuccess.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/src/components/Tool/ToolSuccess.vue b/client/src/components/Tool/ToolSuccess.vue index 6013cb77819..86eebfab7d3 100644 --- a/client/src/components/Tool/ToolSuccess.vue +++ b/client/src/components/Tool/ToolSuccess.vue @@ -1,7 +1,5 @@