added store listener to update facade current history model

This commit is contained in:
Mason Houtz
2021-01-19 12:14:15 +01:00
committed by mvdbeek
parent 2eb1525098
commit 6de1c75774
@@ -15,6 +15,7 @@ import Backbone from "backbone";
import CurrentHistoryView from "mvc/history/history-view-edit-current";
import { History } from "mvc/history/history-model";
import "./HistoryPanelProxy.scss";
import store from "store";
// bypass polling while using the beta panel, skips contents loading
const FakeHistoryViewModel = CurrentHistoryView.CurrentHistoryView.extend({
@@ -37,6 +38,7 @@ export const HistoryPanelProxy = Backbone.View.extend({
// fake view of the current history
this.historyView = new FakeHistoryViewModel({
fakeHistoryViewModel: true,
className: `fake ${CurrentHistoryView.CurrentHistoryView.prototype.className} middle`,
purgeAllowed: this.allow_user_dataset_purge,
linkTarget: "galaxy_main",
@@ -59,6 +61,14 @@ export const HistoryPanelProxy = Backbone.View.extend({
url: `${Galaxy.user.urlRoot()}/${Galaxy.user.id || "current"}`,
});
});
// Watch the store, change the fake history model when it changs
store.subscribe(({ type, payload: newId }) => {
if (type == "betaHistory/setCurrentHistoryId") {
console.log("setCurrentHistoryId", newId);
Galaxy.currHistoryPanel.setModel(new History({ id: newId }));
}
});
},
render() {
// Hack: For now, remove unused "unified-panel" elements until we can