From d40b9af10c7ac5573ffbfac8da7de3cce708d5b2 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sun, 27 Oct 2019 18:01:51 -0400 Subject: [PATCH 1/7] Simplify manager use in markdown_util. --- lib/galaxy/managers/markdown_util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/markdown_util.py b/lib/galaxy/managers/markdown_util.py index 04629abea27..ad36a4b0f1e 100644 --- a/lib/galaxy/managers/markdown_util.py +++ b/lib/galaxy/managers/markdown_util.py @@ -76,6 +76,9 @@ def ready_galaxy_markdown_for_export(trans, internal_galaxy_markdown): """ hdas_manager = HDAManager(trans.app) workflows_manager = WorkflowsManager(trans.app) + job_manager = JobManager(trans.app) + collection_manager = DatasetCollectionManager(trans.app) + extra_rendering_data = {} def _remap(container, line): @@ -118,7 +121,6 @@ def ready_galaxy_markdown_for_export(trans, internal_galaxy_markdown): stored_workflow = workflows_manager.get_stored_accessible_workflow(trans, encoded_id) ensure_rendering_data_for("workflows", encoded_id)["name"] = stored_workflow.name elif container == "history_dataset_collection_display": - collection_manager = DatasetCollectionManager(trans.app) hdca = collection_manager.get_dataset_collection_instance(trans, "history", encoded_id) hdca_serializer = HDCASerializer(trans.app) hdca_view = hdca_serializer.serialize_to_view( @@ -128,11 +130,9 @@ def ready_galaxy_markdown_for_export(trans, internal_galaxy_markdown): extra_rendering_data["history_dataset_collections"] = {} ensure_rendering_data_for("history_dataset_collections", encoded_id).update(hdca_view) elif container == "tool_stdout": - job_manager = JobManager(trans.app) job = job_manager.get_accessible_job(trans, object_id) ensure_rendering_data_for("jobs", encoded_id)["tool_stdout"] = job.tool_stdout or "*No Standard Output Available*" elif container == "tool_stderr": - job_manager = JobManager(trans.app) job = job_manager.get_accessible_job(trans, object_id) ensure_rendering_data_for("jobs", encoded_id)["tool_stderr"] = job.tool_stderr or "*No Standard Error Available*" return (line, False) From 7b2a010e37281d0b269d5b9ecbcefdeacea1d191 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sun, 27 Oct 2019 20:14:33 -0400 Subject: [PATCH 2/7] Copy-paste typo for invocation reports. --- lib/galaxy/managers/markdown_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/managers/markdown_util.py b/lib/galaxy/managers/markdown_util.py index ad36a4b0f1e..ef834bf06a1 100644 --- a/lib/galaxy/managers/markdown_util.py +++ b/lib/galaxy/managers/markdown_util.py @@ -115,7 +115,7 @@ def ready_galaxy_markdown_for_export(trans, internal_galaxy_markdown): elif container == "history_dataset_info": hda = hdas_manager.get_accessible(object_id, trans.user) info = hda.info - extend_history_dataset_rendering_data("info", info, "*No Dataset Peek Available*") + extend_history_dataset_rendering_data("info", info, "*No Dataset Info Available*") elif container == "workflow_display": # TODO: should be workflow id... stored_workflow = workflows_manager.get_stored_accessible_workflow(trans, encoded_id) From 92c65d5add609fb17772b0be6bd2bf91e5ca64b1 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 14 Nov 2019 16:33:40 -0500 Subject: [PATCH 3/7] Refactor DataDialog to allow selection of workflows, collections as well. --- .../components/DataDialog/DataDialog.test.js | 42 ++++++---- .../components/DataDialog/DataDialog.vue | 76 +++++++---------- .../scripts/components/DataDialog/services.js | 2 +- .../DataDialogSearch.vue | 0 .../DataDialogTable.vue | 6 +- .../DatasetCollectionDialog.test.js | 68 +++++++++++++++ .../DatasetCollectionDialog.vue | 84 +++++++++++++++++++ .../SelectionDialog/SelectionDialog.test.js | 53 ++++++++++++ .../SelectionDialog/SelectionDialog.vue | 69 +++++++++++++++ .../SelectionDialog/SelectionDialogMixin.js | 17 ++++ .../SelectionDialog/WorkflowDialog.test.js | 69 +++++++++++++++ .../SelectionDialog/WorkflowDialog.vue | 76 +++++++++++++++++ .../scripts/components/Workflow/services.js | 2 +- client/galaxy/scripts/utils/data.js | 43 ++++++++-- client/galaxy/scripts/utils/simple-error.js | 8 +- 15 files changed, 544 insertions(+), 71 deletions(-) rename client/galaxy/scripts/components/{DataDialog => SelectionDialog}/DataDialogSearch.vue (100%) rename client/galaxy/scripts/components/{DataDialog => SelectionDialog}/DataDialogTable.vue (92%) create mode 100644 client/galaxy/scripts/components/SelectionDialog/DatasetCollectionDialog.test.js create mode 100644 client/galaxy/scripts/components/SelectionDialog/DatasetCollectionDialog.vue create mode 100644 client/galaxy/scripts/components/SelectionDialog/SelectionDialog.test.js create mode 100644 client/galaxy/scripts/components/SelectionDialog/SelectionDialog.vue create mode 100644 client/galaxy/scripts/components/SelectionDialog/SelectionDialogMixin.js create mode 100644 client/galaxy/scripts/components/SelectionDialog/WorkflowDialog.test.js create mode 100644 client/galaxy/scripts/components/SelectionDialog/WorkflowDialog.vue diff --git a/client/galaxy/scripts/components/DataDialog/DataDialog.test.js b/client/galaxy/scripts/components/DataDialog/DataDialog.test.js index bf3b01019c9..1b254b98638 100644 --- a/client/galaxy/scripts/components/DataDialog/DataDialog.test.js +++ b/client/galaxy/scripts/components/DataDialog/DataDialog.test.js @@ -1,10 +1,10 @@ -import { mount } from "@vue/test-utils"; import DataDialog from "./DataDialog.vue"; +import SelectionDialog from "components/SelectionDialog/SelectionDialog.vue"; import { __RewireAPI__ as rewire } from "./DataDialog"; import { Model } from "./model.js"; import { UrlTracker } from "./utilities.js"; import { Services } from "./services"; -import Vue from "vue"; +import { mount, createLocalVue } from "@vue/test-utils"; const mockOptions = { callback: () => {}, @@ -80,9 +80,9 @@ describe("services/Services:isDataset", () => { expect(services.isDataset({ history_content_type: "dataset" })).to.equals(true); expect(services.isDataset({ history_content_type: "xyz" })).to.equals(false); expect(services.isDataset({ type: "file" })).to.equals(true); - expect(services.getRecord({ hid: 1, history_content_type: "dataset" }).isDataset).to.equals(true); - expect(services.getRecord({ hid: 2, history_content_type: "xyz" }).isDataset).to.equals(false); - expect(services.getRecord({ type: "file" }).isDataset).to.equals(true); + expect(services.getRecord({ hid: 1, history_content_type: "dataset" }).isLeaf).to.equals(true); + expect(services.getRecord({ hid: 2, history_content_type: "xyz" }).isLeaf).to.equals(false); + expect(services.getRecord({ type: "file" }).isLeaf).to.equals(true); }); }); @@ -137,18 +137,32 @@ describe("DataDialog.vue", () => { }; beforeEach(() => { - rewire.__Rewire__("Services", mockServices); + rewire.__Rewire__("getGalaxyInstance", () => { + root: "root"; + }); + const localVue = createLocalVue(); wrapper = mount(DataDialog, { - propsData: mockOptions + propsData: mockOptions, + attachToDocument: true, + localVue }); }); - it("loads correctly, shows datasets and folders", async () => { - expect(wrapper.find(":first-child div").classes()).contain("data-dialog-modal"); - expect(wrapper.find(".fa-spinner").text()).to.equals(""); - expect(wrapper.contains(".fa-spinner")).to.equals(true); - await Vue.nextTick(); - expect(wrapper.findAll(".fa-folder").length).to.equals(2); - expect(wrapper.findAll(".fa-file-o").length).to.equals(2); + it("loads correctly, embeds a SelectionDialog", async () => { + expect(wrapper.find(SelectionDialog).is(SelectionDialog)).to.equals(true); + // Cannot get nested slot templates to render into the wrapper + /// Lots of open issues around this + /// ... Maybe because named slots have many issues + // - https://github.com/vuejs/vue-test-utils/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+slot + // ... Maybe because it is a modal and no longer inside the template DOM element? + // - https://github.com/vuejs/vue-test-utils/issues/1333 + + // expect(wrapper.find(".fa-spinner").text()).to.equals(""); + // expect(wrapper.contains(".fa-spinner")).to.equals(true); + // await Vue.nextTick(); + // expect(wrapper.findAll(".fa-folder").length).to.equals(2); + // expect(wrapper.findAll(".fa-file-o").length).to.equals(2); + + // SelectionDialog DOM properties are tested now in SelectionDialog.test.js however. }); }); diff --git a/client/galaxy/scripts/components/DataDialog/DataDialog.vue b/client/galaxy/scripts/components/DataDialog/DataDialog.vue index 73c4b8cd250..11319f2d468 100644 --- a/client/galaxy/scripts/components/DataDialog/DataDialog.vue +++ b/client/galaxy/scripts/components/DataDialog/DataDialog.vue @@ -1,10 +1,14 @@