Loading client/src/components/History/adapters/HistoryPanelProxy.js +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ export class HistoryPanelProxy { } switchToHistory(historyId) { this.model.id = historyId; store.dispatch("history/setCurrentHistoryId", historyId); store.dispatch("history/setCurrentHistory", historyId); } async buildCollection(collectionType, selection, hideSourceItems, fromRulesInput = false) { let selectionContent = null; Loading client/src/components/providers/UserHistories.js +2 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { "createNewHistory", "updateHistory", "deleteHistory", "setCurrentHistoryId", "setCurrentHistory", "setHistory", "loadHistories", "secureHistory", Loading Loading @@ -73,7 +73,7 @@ export default { setHistory: this.setHistory, // select new history, basically just needs the id setCurrentHistory: (h) => this.setCurrentHistoryId(h.id), setCurrentHistory: (h) => this.setCurrentHistory(h.id), // create new history then select it createNewHistory: this.createNewHistory, Loading client/src/store/historyStore/historyStore.js +16 −28 Original line number Diff line number Diff line Loading @@ -75,11 +75,9 @@ const getters = { }, }; // Holds promises for in-flight loads const promises = { load: null, byId: new Map(), }; // flags to keep track of loading states const isLoadingHistory = new Map(); let isLoadingHistories = false; const actions = { async copyHistory({ dispatch }, { history, name, copyAll }) { Loading @@ -95,18 +93,18 @@ const actions = { const deletedHistory = await deleteHistoryById(history.id, purge); commit("deleteHistory", deletedHistory); if (getters.firstHistoryId) { return dispatch("setCurrentHistoryId", getters.firstHistoryId); return dispatch("setCurrentHistory", getters.firstHistoryId); } else { return dispatch("createNewHistory"); } }, loadCurrentHistory({ dispatch }) { getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); async loadCurrentHistory({ dispatch }) { return getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); }, loadHistories({ commit }) { if (!promises.load) { if (!isLoadingHistories) { commit("setHistoriesLoading", true); promises.load = getHistoryList() isLoadingHistories = getHistoryList() .then((list) => { commit("setHistories", list); }) Loading @@ -114,31 +112,24 @@ const actions = { console.warn("loadHistories error", err); }) .finally(() => { promises.load = null; isLoadingHistories = false; commit("setHistoriesLoading", false); }); } }, loadHistoryById({ commit, getters, dispatch }, id) { if (!promises.byId.has(id)) { // immediately set if we have something current const existing = getters.getHistoryById(id); if (existing) { commit("setHistory", existing); } // but also check for updates loadHistoryById({ dispatch }, id) { if (!isLoadingHistory.has(id)) { const p = getHistoryById(id) .then((history) => { dispatch("selectHistory", history); dispatch("setHistory", history); }) .catch((err) => { console.warn("loadHistoryById error", id, err); }) .finally(() => { promises.byId.delete(id); isLoadingHistory.delete(id); }); promises.byId.set(id, p); isLoadingHistory.set(id, p); } }, resetHistory({ commit }) { Loading @@ -153,13 +144,10 @@ const actions = { commit("setHistory", history); commit("setCurrentHistoryId", history.id); }, async setCurrentHistoryId({ commit, dispatch, getters }, id) { // Need to do 2 requests because apparently the response from "setHistory" // can't be twisted to be the same as a normal lookup async setCurrentHistory({ dispatch, getters }, id) { if (id !== getters.currentHistoryId) { commit("setCurrentHistoryId", id); const changedHistory = await setCurrentHistoryOnServer(id); dispatch("loadHistoryById", changedHistory.id); dispatch("selectHistory", changedHistory); } }, setHistory({ commit }, history) { Loading client/src/store/historyStore/historyStore.test.js 0 → 100644 +55 −0 Original line number Diff line number Diff line import MockAdapter from "axios-mock-adapter"; import axios from "axios"; import store from "store/index"; // response resource data let nHistories = 3; let currentHistory = 0; const histories = {}; for (let i = 0; i < nHistories; i++) { histories[i] = { id: i }; } describe("historyStore", () => { let axiosMock; beforeEach(() => { axiosMock = new MockAdapter(axios); axiosMock.onGet("/history/current_history_json").reply(() => { return [200, histories[currentHistory]]; }); axiosMock.onGet("/history/create_new_current").reply(() => { const id = nHistories++; return [200, { id: id }]; }); axiosMock.onGet("/history/set_as_current").reply((config) => { const payload = config.params; currentHistory = payload.id; return [200, histories[payload.id]]; }); axiosMock.onGet(/api\/histories\/./).reply((config) => { const historyId = config.url.charAt(config.url.length - 1); return [200, histories[historyId]]; }); }); afterEach(() => { axiosMock.restore(); }); it("store initialization", async () => { expect(store.getters["history/currentHistoryId"]).toBe(null); await store.dispatch("history/loadCurrentHistory"); expect(store.getters["history/currentHistoryId"]).toBe(0); await store.dispatch("history/loadHistoryById", 1); await store.dispatch("history/loadHistoryById", 2); expect(store.getters["history/currentHistoryId"]).toBe(0); await store.dispatch("history/setCurrentHistory", 1); expect(store.getters["history/currentHistoryId"]).toBe(1); await store.dispatch("history/loadCurrentHistory"); expect(store.getters["history/currentHistoryId"]).toBe(1); expect(store.getters["history/getHistoryById"](2).id).toBe(2); await store.dispatch("history/createNewHistory"); expect(store.getters["history/currentHistoryId"]).toBe(3); }); }); lib/galaxy/version.py +1 −1 Original line number Diff line number Diff line VERSION_MAJOR = "22.05" VERSION_MINOR = "dev0" VERSION_MINOR = "rc1" VERSION = VERSION_MAJOR + (f".{VERSION_MINOR}" if VERSION_MINOR else "") Loading
client/src/components/History/adapters/HistoryPanelProxy.js +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ export class HistoryPanelProxy { } switchToHistory(historyId) { this.model.id = historyId; store.dispatch("history/setCurrentHistoryId", historyId); store.dispatch("history/setCurrentHistory", historyId); } async buildCollection(collectionType, selection, hideSourceItems, fromRulesInput = false) { let selectionContent = null; Loading
client/src/components/providers/UserHistories.js +2 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ export default { "createNewHistory", "updateHistory", "deleteHistory", "setCurrentHistoryId", "setCurrentHistory", "setHistory", "loadHistories", "secureHistory", Loading Loading @@ -73,7 +73,7 @@ export default { setHistory: this.setHistory, // select new history, basically just needs the id setCurrentHistory: (h) => this.setCurrentHistoryId(h.id), setCurrentHistory: (h) => this.setCurrentHistory(h.id), // create new history then select it createNewHistory: this.createNewHistory, Loading
client/src/store/historyStore/historyStore.js +16 −28 Original line number Diff line number Diff line Loading @@ -75,11 +75,9 @@ const getters = { }, }; // Holds promises for in-flight loads const promises = { load: null, byId: new Map(), }; // flags to keep track of loading states const isLoadingHistory = new Map(); let isLoadingHistories = false; const actions = { async copyHistory({ dispatch }, { history, name, copyAll }) { Loading @@ -95,18 +93,18 @@ const actions = { const deletedHistory = await deleteHistoryById(history.id, purge); commit("deleteHistory", deletedHistory); if (getters.firstHistoryId) { return dispatch("setCurrentHistoryId", getters.firstHistoryId); return dispatch("setCurrentHistory", getters.firstHistoryId); } else { return dispatch("createNewHistory"); } }, loadCurrentHistory({ dispatch }) { getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); async loadCurrentHistory({ dispatch }) { return getCurrentHistoryFromServer().then((history) => dispatch("selectHistory", history)); }, loadHistories({ commit }) { if (!promises.load) { if (!isLoadingHistories) { commit("setHistoriesLoading", true); promises.load = getHistoryList() isLoadingHistories = getHistoryList() .then((list) => { commit("setHistories", list); }) Loading @@ -114,31 +112,24 @@ const actions = { console.warn("loadHistories error", err); }) .finally(() => { promises.load = null; isLoadingHistories = false; commit("setHistoriesLoading", false); }); } }, loadHistoryById({ commit, getters, dispatch }, id) { if (!promises.byId.has(id)) { // immediately set if we have something current const existing = getters.getHistoryById(id); if (existing) { commit("setHistory", existing); } // but also check for updates loadHistoryById({ dispatch }, id) { if (!isLoadingHistory.has(id)) { const p = getHistoryById(id) .then((history) => { dispatch("selectHistory", history); dispatch("setHistory", history); }) .catch((err) => { console.warn("loadHistoryById error", id, err); }) .finally(() => { promises.byId.delete(id); isLoadingHistory.delete(id); }); promises.byId.set(id, p); isLoadingHistory.set(id, p); } }, resetHistory({ commit }) { Loading @@ -153,13 +144,10 @@ const actions = { commit("setHistory", history); commit("setCurrentHistoryId", history.id); }, async setCurrentHistoryId({ commit, dispatch, getters }, id) { // Need to do 2 requests because apparently the response from "setHistory" // can't be twisted to be the same as a normal lookup async setCurrentHistory({ dispatch, getters }, id) { if (id !== getters.currentHistoryId) { commit("setCurrentHistoryId", id); const changedHistory = await setCurrentHistoryOnServer(id); dispatch("loadHistoryById", changedHistory.id); dispatch("selectHistory", changedHistory); } }, setHistory({ commit }, history) { Loading
client/src/store/historyStore/historyStore.test.js 0 → 100644 +55 −0 Original line number Diff line number Diff line import MockAdapter from "axios-mock-adapter"; import axios from "axios"; import store from "store/index"; // response resource data let nHistories = 3; let currentHistory = 0; const histories = {}; for (let i = 0; i < nHistories; i++) { histories[i] = { id: i }; } describe("historyStore", () => { let axiosMock; beforeEach(() => { axiosMock = new MockAdapter(axios); axiosMock.onGet("/history/current_history_json").reply(() => { return [200, histories[currentHistory]]; }); axiosMock.onGet("/history/create_new_current").reply(() => { const id = nHistories++; return [200, { id: id }]; }); axiosMock.onGet("/history/set_as_current").reply((config) => { const payload = config.params; currentHistory = payload.id; return [200, histories[payload.id]]; }); axiosMock.onGet(/api\/histories\/./).reply((config) => { const historyId = config.url.charAt(config.url.length - 1); return [200, histories[historyId]]; }); }); afterEach(() => { axiosMock.restore(); }); it("store initialization", async () => { expect(store.getters["history/currentHistoryId"]).toBe(null); await store.dispatch("history/loadCurrentHistory"); expect(store.getters["history/currentHistoryId"]).toBe(0); await store.dispatch("history/loadHistoryById", 1); await store.dispatch("history/loadHistoryById", 2); expect(store.getters["history/currentHistoryId"]).toBe(0); await store.dispatch("history/setCurrentHistory", 1); expect(store.getters["history/currentHistoryId"]).toBe(1); await store.dispatch("history/loadCurrentHistory"); expect(store.getters["history/currentHistoryId"]).toBe(1); expect(store.getters["history/getHistoryById"](2).id).toBe(2); await store.dispatch("history/createNewHistory"); expect(store.getters["history/currentHistoryId"]).toBe(3); }); });
lib/galaxy/version.py +1 −1 Original line number Diff line number Diff line VERSION_MAJOR = "22.05" VERSION_MINOR = "dev0" VERSION_MINOR = "rc1" VERSION = VERSION_MAJOR + (f".{VERSION_MINOR}" if VERSION_MINOR else "")