separated beta toggle features

This commit is contained in:
Mason Houtz
2021-01-19 12:14:15 +01:00
committed by mvdbeek
parent 13ff4155a7
commit 2eb1525098
6 changed files with 27 additions and 13 deletions
@@ -35,7 +35,7 @@
key="use-legacy-history"
title="Return to legacy history panel"
icon="fas fa-exchange-alt"
@click="useLegacyHistoryPanel"
@click="switchToLegacyHistoryPanel"
/>
</PriorityMenu>
</div>
@@ -48,6 +48,7 @@ import HistorySelector from "./HistorySelector";
import { createNewHistory } from "./model/queries";
import { wipeDatabase, clearHistoryDateStore } from "./caching";
import { legacyNavigationMixin } from "components/plugins";
import { switchToLegacyHistoryPanel } from "./adapters/betaToggle";
export default {
mixins: [legacyNavigationMixin],
@@ -72,10 +73,7 @@ export default {
methods: {
...mapActions("betaHistory", ["storeHistory"]),
useLegacyHistoryPanel() {
sessionStorage.removeItem("useBetaHistory");
location.reload();
},
switchToLegacyHistoryPanel,
// create new server, store in vuex, switch to it
async createHistory() {
@@ -0,0 +1,13 @@
export const isBetaHistoryOpen = () => {
return sessionStorage.getItem("useBetaHistory");
};
export const switchToLegacyHistoryPanel = () => {
sessionStorage.removeItem("useBetaHistory");
location.reload();
};
export const switchToBetaHistoryPanel = () => {
sessionStorage.setItem("useBetaHistory", 1);
location.reload(false);
};
+2 -2
View File
@@ -46,6 +46,7 @@ import RulesInput from "./RulesInput";
import LoadingSpan from "components/LoadingSpan";
import { mapState } from "vuex";
import { BModal, BTabs, BTab } from "bootstrap-vue";
import { isBetaHistoryOpen } from "components/History/adapters/betaToggle";
const UploadModal = {
components: {
@@ -336,8 +337,7 @@ const UploadModal = {
};
// Beta history patch
const useBetaHistory = sessionStorage.getItem("useBetaHistory");
if (useBetaHistory) {
if (isBetaHistoryOpen()) {
UploadModal.computed.currentHistoryId = function () {
return this.$store.getters["betaHistory/currentHistoryId"];
};
+2 -2
View File
@@ -6,14 +6,14 @@ import Page from "layout/page";
// Vue adapter emulates current features of backbone history panel
import { HistoryPanelProxy } from "components/History";
import { isBetaHistoryOpen } from "components/History/adapters/betaToggle";
addInitialization((Galaxy, { options = {} }) => {
console.log("Analysis custom page setup");
// Handle beta history panel
// Need to mock Galaxy.currHistoryPanel
const useBeta = sessionStorage.getItem("useBetaHistory");
const HistoryPanel = useBeta ? HistoryPanelProxy : MvcHistoryPanel;
const HistoryPanel = isBetaHistoryOpen() ? HistoryPanelProxy : MvcHistoryPanel;
const pageOptions = Object.assign({}, options, {
config: Object.assign({}, options.config, {
+2 -2
View File
@@ -6,6 +6,7 @@ import _l from "utils/localization";
import PopupMenu from "mvc/ui/popup-menu";
import historyCopyDialog from "mvc/history/copy-dialog";
import Webhooks from "mvc/webhooks";
import { switchToBetaHistoryPanel } from "../../components/History/adapters/betaToggle";
// ============================================================================
var menu = [
@@ -165,8 +166,7 @@ var menu = [
html: _l("Use Beta History Panel"),
anon: false,
func: function () {
sessionStorage.setItem("useBetaHistory", 1);
window.location.reload(false);
switchToBetaHistoryPanel();
},
},
];
+5 -2
View File
@@ -13,6 +13,7 @@ import { waitForInit } from "utils/observable/waitForInit";
import { syncUserToGalaxy } from "store/userStore/syncUserToGalaxy";
import { syncConfigToGalaxy } from "store/configStore/syncConfigToGalaxy";
import { syncCurrentHistoryToGalaxy } from "components/History/model/syncCurrentHistoryToGalaxy";
import { isBetaHistoryOpen } from "components/History/adapters/betaToggle";
export const syncVuextoGalaxy = (store) => {
const globalGalaxy$ = defer(() => {
@@ -25,6 +26,8 @@ export const syncVuextoGalaxy = (store) => {
// configuration
syncConfigToGalaxy(globalGalaxy$, store);
// Current History object (from legacy history panel)
syncCurrentHistoryToGalaxy(globalGalaxy$, store);
// Update Vuex with legacy galaxy history changes only when beta panel is closed.
if (!isBetaHistoryOpen()) {
syncCurrentHistoryToGalaxy(globalGalaxy$, store);
}
};