From d41d9bcf313488a63d2a40141197425c3f3eb1e4 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 20 Dec 2021 14:01:19 -0500 Subject: [PATCH 1/5] Remove unused internal imports from history caching --- .../components/DatasetInformation/DatasetAttributes.test.js | 2 -- .../components/DatasetInformation/DatasetInformation.test.js | 3 +-- .../GenericContentItem/DatasetCollectionUIWrapper.test.js | 2 -- .../ContentItem/GenericContentItem/DatasetUIWrapper.test.js | 2 -- client/src/components/HistoryExport/Index.test.js | 2 -- client/src/components/HistoryExport/ToLink.test.js | 1 - client/src/components/HistoryExport/ToRemoteFile.test.js | 1 - client/src/components/HistoryImport.test.js | 1 - client/src/components/JobInformation/JobInformation.test.js | 1 - client/src/components/JobInformation/JobOutputs.test.js | 1 - client/src/components/JobParameters/JobParameters.test.js | 1 - client/src/components/Masthead/Masthead.test.js | 1 - client/src/components/Upload/UploadModal.test.js | 1 - client/src/components/User/RecentInvocations.test.js | 1 - client/src/components/Workflow/Invocations.test.js | 2 -- client/src/components/WorkflowInvocationState/JobStep.test.js | 2 -- .../WorkflowInvocationState/WorkflowInvocationState.test.js | 1 - 17 files changed, 1 insertion(+), 24 deletions(-) diff --git a/client/src/components/DatasetInformation/DatasetAttributes.test.js b/client/src/components/DatasetInformation/DatasetAttributes.test.js index eeefdddc08f..524d2de08d3 100644 --- a/client/src/components/DatasetInformation/DatasetAttributes.test.js +++ b/client/src/components/DatasetInformation/DatasetAttributes.test.js @@ -9,8 +9,6 @@ import flushPromises from "flush-promises"; const localVue = getLocalVue(); -jest.mock("components/providers/History/caching"); - function buildWrapper(conversion_disable = false) { return mount(DatasetAttributes, { propsData: { diff --git a/client/src/components/DatasetInformation/DatasetInformation.test.js b/client/src/components/DatasetInformation/DatasetInformation.test.js index a850d4c5e30..27f1b23b845 100644 --- a/client/src/components/DatasetInformation/DatasetInformation.test.js +++ b/client/src/components/DatasetInformation/DatasetInformation.test.js @@ -7,7 +7,6 @@ import datasetResponse from "./testData/datasetResponse"; import flushPromises from "flush-promises"; import moment from "moment"; -jest.mock("components/providers/History/caching"); const HDA_ID = "FOO_HDA_ID"; const mockDatasetProvider = { @@ -21,7 +20,7 @@ const mockDatasetProvider = { const localVue = getLocalVue(); -describe("DatasetInformation/DatasetInformation.vue", () => { +describe("DatasetInformation/DatasetInformation", () => { let wrapper; let datasetInfoTable; let axiosMock; diff --git a/client/src/components/History/ContentItem/GenericContentItem/DatasetCollectionUIWrapper.test.js b/client/src/components/History/ContentItem/GenericContentItem/DatasetCollectionUIWrapper.test.js index a05904f499f..a990dd10193 100644 --- a/client/src/components/History/ContentItem/GenericContentItem/DatasetCollectionUIWrapper.test.js +++ b/client/src/components/History/ContentItem/GenericContentItem/DatasetCollectionUIWrapper.test.js @@ -5,8 +5,6 @@ import flushPromises from "flush-promises"; import datasetCollectionRaw from "components/providers/History/test/json/DatasetCollection.json"; import datasetCollectionContent from "components/providers/History/test/json/DatasetCollection.nested.json"; -jest.mock("components/providers/History/caching"); - describe("DatasetUIWrapper.vue with Dataset", () => { let wrapper; let propsData; diff --git a/client/src/components/History/ContentItem/GenericContentItem/DatasetUIWrapper.test.js b/client/src/components/History/ContentItem/GenericContentItem/DatasetUIWrapper.test.js index ddb2d24d477..52aa4cd0e64 100644 --- a/client/src/components/History/ContentItem/GenericContentItem/DatasetUIWrapper.test.js +++ b/client/src/components/History/ContentItem/GenericContentItem/DatasetUIWrapper.test.js @@ -3,8 +3,6 @@ import DatasetUI from "components/History/ContentItem/Dataset/DatasetUI"; import { shallowMount } from "@vue/test-utils"; import raw from "components/providers/History/test/json/Dataset.json"; -jest.mock("components/providers/History/caching"); - describe("DatasetUIWrapper.vue with Dataset", () => { let wrapper; let propsData; diff --git a/client/src/components/HistoryExport/Index.test.js b/client/src/components/HistoryExport/Index.test.js index cb728456b32..830104b2491 100644 --- a/client/src/components/HistoryExport/Index.test.js +++ b/client/src/components/HistoryExport/Index.test.js @@ -4,8 +4,6 @@ import { getLocalVue } from "jest/helpers"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; -jest.mock("components/providers/History/caching"); - const TEST_PLUGINS_URL = "/api/remote_files/plugins"; const localVue = getLocalVue(); diff --git a/client/src/components/HistoryExport/ToLink.test.js b/client/src/components/HistoryExport/ToLink.test.js index e200de34947..39b3defb70f 100644 --- a/client/src/components/HistoryExport/ToLink.test.js +++ b/client/src/components/HistoryExport/ToLink.test.js @@ -12,7 +12,6 @@ const TEST_EXPORTS_URL = `/api/histories/${TEST_HISTORY_ID}/exports`; const TEST_JOB_ID = "test1234job"; jest.mock("components/JobStates/wait"); -jest.mock("components/providers/History/caching"); describe("ToLink.vue", () => { let axiosMock; diff --git a/client/src/components/HistoryExport/ToRemoteFile.test.js b/client/src/components/HistoryExport/ToRemoteFile.test.js index 874e29a8448..275d2076bab 100644 --- a/client/src/components/HistoryExport/ToRemoteFile.test.js +++ b/client/src/components/HistoryExport/ToRemoteFile.test.js @@ -12,7 +12,6 @@ const TEST_JOB_ID = "job123789"; const TEST_EXPORTS_URL = `/api/histories/${TEST_HISTORY_ID}/exports`; jest.mock("components/JobStates/wait"); -jest.mock("components/providers/History/caching"); describe("ToRemoteFile.vue", () => { let axiosMock; diff --git a/client/src/components/HistoryImport.test.js b/client/src/components/HistoryImport.test.js index 86cd33e3ac7..2e304a50588 100644 --- a/client/src/components/HistoryImport.test.js +++ b/client/src/components/HistoryImport.test.js @@ -13,7 +13,6 @@ const TEST_SOURCE_URL = "http://galaxy.example/import"; const TEST_PLUGINS_URL = "/api/remote_files/plugins"; jest.mock("components/JobStates/wait"); -jest.mock("components/providers/History/caching"); describe("HistoryImport.vue", () => { let axiosMock; diff --git a/client/src/components/JobInformation/JobInformation.test.js b/client/src/components/JobInformation/JobInformation.test.js index 9efa8ec5bfe..16c89702379 100644 --- a/client/src/components/JobInformation/JobInformation.test.js +++ b/client/src/components/JobInformation/JobInformation.test.js @@ -11,7 +11,6 @@ import flushPromises from "flush-promises"; import createCache from "vuex-cache"; jest.mock("app"); -jest.mock("components/providers/History/caching"); const JOB_ID = "test_id"; diff --git a/client/src/components/JobInformation/JobOutputs.test.js b/client/src/components/JobInformation/JobOutputs.test.js index 42062b787bd..f5df99bbf54 100644 --- a/client/src/components/JobInformation/JobOutputs.test.js +++ b/client/src/components/JobInformation/JobOutputs.test.js @@ -1,7 +1,6 @@ import JobOutputs from "./JobOutputs"; import { shallowMount } from "@vue/test-utils"; -jest.mock("components/providers/History/caching"); jest.mock("components/providers/DatasetCollectionProvider"); describe("JobInformation/JobOutputs.vue", () => { diff --git a/client/src/components/JobParameters/JobParameters.test.js b/client/src/components/JobParameters/JobParameters.test.js index 7faa3aeaf10..f76f88f223c 100644 --- a/client/src/components/JobParameters/JobParameters.test.js +++ b/client/src/components/JobParameters/JobParameters.test.js @@ -9,7 +9,6 @@ import raw from "components/providers/History/test/json/Dataset.json"; import { userStore } from "store/userStore"; import { configStore } from "store/configStore"; -jest.mock("components/providers/History/caching"); const observe = jest.fn(); const unobserve = jest.fn(); diff --git a/client/src/components/Masthead/Masthead.test.js b/client/src/components/Masthead/Masthead.test.js index ea0e0ef1d65..b395516e313 100644 --- a/client/src/components/Masthead/Masthead.test.js +++ b/client/src/components/Masthead/Masthead.test.js @@ -8,7 +8,6 @@ import { loadWebhookMenuItems } from "./_webhooks"; jest.mock("app"); jest.mock("layout/menu"); jest.mock("./_webhooks"); -jest.mock("components/providers/History/caching"); describe("Masthead.vue", () => { let wrapper; diff --git a/client/src/components/Upload/UploadModal.test.js b/client/src/components/Upload/UploadModal.test.js index e247c8896f4..bd119d78cc1 100644 --- a/client/src/components/Upload/UploadModal.test.js +++ b/client/src/components/Upload/UploadModal.test.js @@ -10,7 +10,6 @@ import MockCurrentUser from "../providers/MockCurrentUser"; import MockCurrentHistory from "components/providers/History/UserHistories/MockCurrentHistory"; jest.mock("app"); -jest.mock("components/providers/History/caching"); const propsData = { chunkUploadSize: 1024, diff --git a/client/src/components/User/RecentInvocations.test.js b/client/src/components/User/RecentInvocations.test.js index 84335bfada8..bca91b0880b 100644 --- a/client/src/components/User/RecentInvocations.test.js +++ b/client/src/components/User/RecentInvocations.test.js @@ -5,7 +5,6 @@ import flushPromises from "flush-promises"; import RecentInvocations from "./RecentInvocations.vue"; -jest.mock("components/providers/History/caching"); jest.mock("./UserServices"); const localVue = getLocalVue(); diff --git a/client/src/components/Workflow/Invocations.test.js b/client/src/components/Workflow/Invocations.test.js index 5e2ac08308d..f273d0a1729 100644 --- a/client/src/components/Workflow/Invocations.test.js +++ b/client/src/components/Workflow/Invocations.test.js @@ -4,8 +4,6 @@ import { getLocalVue } from "jest/helpers"; import invocationData from "./test/json/invocation.json"; import moment from "moment"; -jest.mock("components/providers/History/caching"); - const localVue = getLocalVue(); describe("Invocations.vue without invocation", () => { diff --git a/client/src/components/WorkflowInvocationState/JobStep.test.js b/client/src/components/WorkflowInvocationState/JobStep.test.js index 71d89148600..1de49f115ad 100644 --- a/client/src/components/WorkflowInvocationState/JobStep.test.js +++ b/client/src/components/WorkflowInvocationState/JobStep.test.js @@ -3,8 +3,6 @@ import JobStep from "./JobStep"; import { mount } from "@vue/test-utils"; import jobs from "./test/json/jobs.json"; -jest.mock("components/providers/History/caching"); - import { createLocalVue } from "@vue/test-utils"; // create an extended `Vue` constructor diff --git a/client/src/components/WorkflowInvocationState/WorkflowInvocationState.test.js b/client/src/components/WorkflowInvocationState/WorkflowInvocationState.test.js index 92ecdd69946..6f9fe2cf27f 100644 --- a/client/src/components/WorkflowInvocationState/WorkflowInvocationState.test.js +++ b/client/src/components/WorkflowInvocationState/WorkflowInvocationState.test.js @@ -10,7 +10,6 @@ const invocationJobsSummaryById = { states: {}, populated_state: "ok", }; -jest.mock("components/providers/History/caching"); const localVue = getLocalVue(); From 5cd0d47c3b9f4b535c99e98200af8e8b43f472ea Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 20 Dec 2021 14:14:47 -0500 Subject: [PATCH 2/5] Remove worker related prep, suggested module does not exist anymore --- .../providers/History/caching/index.js | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/client/src/components/providers/History/caching/index.js b/client/src/components/providers/History/caching/index.js index 1dd1c91f6aa..c1bd975cea0 100644 --- a/client/src/components/providers/History/caching/index.js +++ b/client/src/components/providers/History/caching/index.js @@ -17,34 +17,3 @@ export { export { wipeDatabase, clearHistoryDateStore } from "./CacheApi"; -// TODO: The above exports bypass the worker completely for now, swap back to below to use. -//import { toPromise, toOperator } from "./workerClient"; -///** -// * monitor cache for changes -// */ -//export const monitorContentQuery = toOperator("monitorContentQuery"); -//export const monitorDscQuery = toOperator("monitorDscQuery"); -//export const monitorHistoryContent = toOperator("monitorHistoryContent"); -//export const monitorCollectionContent = toOperator("monitorCollectionContent"); -// -///** -// * Loaders -// */ -//export const loadHistoryContents = toOperator("loadHistoryContents"); -//export const loadDscContent = toOperator("loadDscContent"); -// -///** -// * Cache promise functions -// */ -//export const cacheContent = toPromise("cacheContent"); -//export const getCachedContent = toPromise("getCachedContent"); -//export const uncacheContent = toPromise("uncacheContent"); -//export const bulkCacheContent = toPromise("bulkCacheContent"); -//export const cacheCollectionContent = toPromise("cacheCollectionContent"); -//export const getCachedCollectionContent = toPromise("getCachedCollectionContent"); -//export const bulkCacheDscContent = toPromise("bulkCacheDscContent"); -//export const getContentByTypeId = toPromise("getContentByTypeId"); -// -//// Debugging -//export const wipeDatabase = toPromise("wipeDatabase"); -//export const clearHistoryDateStore = toPromise("clearHistoryDateStore"); From 009ac2b5fe34e15256a3457fd327de98cfafffbd Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 20 Dec 2021 14:35:09 -0500 Subject: [PATCH 3/5] Run prettier --- client/src/components/providers/History/caching/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/components/providers/History/caching/index.js b/client/src/components/providers/History/caching/index.js index c1bd975cea0..b913e6f3ba0 100644 --- a/client/src/components/providers/History/caching/index.js +++ b/client/src/components/providers/History/caching/index.js @@ -16,4 +16,3 @@ export { } from "./CacheApi"; export { wipeDatabase, clearHistoryDateStore } from "./CacheApi"; - From 6c947ca550de57e7b87b89f8399d7b9a95d61230 Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 23 Dec 2021 09:27:02 -0500 Subject: [PATCH 4/5] Remove currently unused queries for verification --- .../src/components/History/model/queries.js | 74 ++++--------------- 1 file changed, 13 insertions(+), 61 deletions(-) diff --git a/client/src/components/History/model/queries.js b/client/src/components/History/model/queries.js index 6688082a220..106461ee5eb 100644 --- a/client/src/components/History/model/queries.js +++ b/client/src/components/History/model/queries.js @@ -109,9 +109,8 @@ export async function getHistoryById(id, since) { /** * Create new history - * @param {Object} props Optional history props */ -export async function createNewHistory(props = {}) { +export async function createNewHistory() { // TODO: adjust api, keep this for later // const url = `/histories`; // const data = Object.assign({ name: "New History" }, props); @@ -199,10 +198,9 @@ export async function secureHistory(history) { return await getHistoryById(id); } -// #endregion - -// #region "Current History" - +/** + * Content Current History + */ export async function getCurrentHistoryFromServer() { const url = "/history/current_history_json"; const response = await api.get(url, { @@ -223,31 +221,9 @@ export async function setCurrentHistoryOnServer(history_id) { return doResponse(response); } -// #endregion - -// #region Content Queries - /** - * Loads specific fields for provided content object, handy for loading - * visualizations or any other field that's too unwieldy to reasonably include - * in the standard content caching cycle. - * - * @param {Object} content content object - * @param {Array} fields Array of fields to load + * Content Queries */ -export async function loadContentFields(content, fields = []) { - if (fields.length) { - const { history_id, id, history_content_type: type } = content; - const url = `/histories/${history_id}/contents/${type}s/${id}`; - const params = { keys: fields.join(",") }; - const response = await api.get(url, { params }); - if (response.status != 200) { - throw new Error(response); - } - return response.data; - } - return null; -} /** * Generic content query function originally intended to help with bulk updates @@ -307,27 +283,6 @@ export async function updateContentFields(content, newFields = {}) { return doResponse(response); } -/** - * Undeletes content flagged as deleted. - * @param {Object} content - */ -export async function undeleteContent(content) { - return await updateContentFields(content, { - deleted: false, - }); -} - -/** - * Marks as purged - * @param {*} history - * @param {*} content - */ -export async function purgeContent(history, content) { - const url = `/histories/${history.id}/contents/${content.id}?purge=True`; - const response = await api.delete(url); - return doResponse(response); -} - /** * Bulk update endpoint (TODO: rewrite) * @@ -349,9 +304,9 @@ export async function bulkContentUpdate(history, type_ids = [], fields = {}) { return doResponse(response); } -// #endregion - -// #region Collections +/** + * Collections + */ export async function createDatasetCollection(history, inputs = {}) { const defaults = { @@ -377,14 +332,13 @@ export async function deleteDatasetCollection(collection, recursive = false, pur return doResponse(response); } -// #endregion - -// #region Job Queries - +/** + * Job Queries + */ const jobStash = new Map(); const toolStash = new Map(); -export async function loadJobById(jobId) { +async function loadJobById(jobId) { if (!jobStash.has(jobId)) { const url = `/jobs/${jobId}?full=false`; const response = await api.get(url); @@ -394,7 +348,7 @@ export async function loadJobById(jobId) { return jobStash.get(jobId); } -export async function loadToolForJob(job) { +async function loadToolForJob(job) { const { tool_id, history_id } = job; const key = `${tool_id}-${history_id}`; if (!toolStash.has(key)) { @@ -410,5 +364,3 @@ export async function loadToolFromJob(jobId) { const job = await loadJobById(jobId); return await loadToolForJob(job); } - -// #endregion From 8cca22446408d9bd4631b59b89fb152f6f49a2dc Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 30 Dec 2021 11:52:05 -0500 Subject: [PATCH 5/5] Remove currently unused undelete history query helper --- client/src/components/History/model/queries.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/client/src/components/History/model/queries.js b/client/src/components/History/model/queries.js index 106461ee5eb..ee92eb052dd 100644 --- a/client/src/components/History/model/queries.js +++ b/client/src/components/History/model/queries.js @@ -157,16 +157,6 @@ export async function deleteHistoryById(id, purge = false) { return doResponse(response); } -/** - * Undelete a deleted (but not purged) history - * @param {String} id Encoded history id - */ -export async function undeleteHistoryById(id) { - const url = `/histories/deleted/${id}/undelete`; - const response = await api.post(url, null, { params: stdHistoryParams }); - return doResponse(response); -} - /** * Update specific fields in history * @param {Object} history