Uniform refresh for old and new history panel

Fixes https://github.com/galaxyproject/galaxy/issues/13731
This commit is contained in:
mvdbeek
2022-06-17 16:22:31 +02:00
parent bc830269d8
commit 69498b44f0
7 changed files with 23 additions and 26 deletions
@@ -56,7 +56,8 @@ export class HistoryPanelProxy {
watchHistory();
}
refreshContents() {
// to be removed after disabling legacy history
// to be removed after disabling legacy history, present to provide uniform interface
// with History Panel Backbone View.
}
loadCurrentHistory() {
store.dispatch("history/loadCurrentHistory");
@@ -572,6 +572,7 @@ import { getAppRoot } from "onload/loadConfig";
import { getGalaxyInstance } from "app";
import axios from "axios";
import _l from "utils/localization";
import { refreshContentsWrapper } from "utils/data";
import HotTable from "@handsontable/vue";
import UploadUtils from "mvc/upload/upload-utils";
import JobStatesModel from "mvc/history/job-states-model";
@@ -1313,10 +1314,7 @@ export default {
this.mapping.splice(index, 1);
},
refreshAndWait(response) {
const Galaxy = getGalaxyInstance();
if (Galaxy && Galaxy.currHistoryPanel) {
Galaxy.currHistoryPanel.refreshContents();
}
refreshContentsWrapper();
this.waitOnJob(response);
},
waitOnJob(response) {
@@ -1332,9 +1330,7 @@ export default {
"Unknown error encountered while running your upload job, this could be a server issue or a problem with the upload definition.";
this.doFullJobCheck(jobId);
} else {
const Galaxy = getGalaxyInstance();
const history = Galaxy && Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model;
history.refresh && history.refresh();
refreshContentsWrapper();
this.oncreate();
}
};
+2 -4
View File
@@ -91,6 +91,7 @@
import { getGalaxyInstance } from "app";
import { getToolFormData, updateToolFormData, submitJob } from "./services";
import { allowCachedJobs } from "./utilities";
import { refreshContentsWrapper } from "utils/data";
import ToolCard from "./ToolCard";
import ButtonSpinner from "components/Common/ButtonSpinner";
import CurrentUser from "components/providers/CurrentUser";
@@ -274,7 +275,6 @@ export default {
return;
}
this.showExecuting = true;
const Galaxy = getGalaxyInstance();
const jobDef = {
history_id: historyId,
tool_id: this.formConfig.id,
@@ -296,9 +296,7 @@ export default {
submitJob(jobDef).then(
(jobResponse) => {
this.showExecuting = false;
if (Galaxy.currHistoryPanel) {
Galaxy.currHistoryPanel.refreshContents();
}
refreshContentsWrapper();
if (jobResponse.produces_entry_points) {
this.showEntryPoints = true;
this.entryPoints = jobResponse.jobs;
+2 -2
View File
@@ -120,6 +120,7 @@
import _l from "utils/localization";
import _ from "underscore";
import { getGalaxyInstance } from "app";
import { refreshContentsWrapper } from "utils/data";
import UploadRow from "mvc/upload/collection/collection-row";
import UploadBoxMixin from "./UploadBoxMixin";
import { uploadModelsToPayload } from "./helpers";
@@ -250,8 +251,7 @@ export default {
const outputs = incoming.outputs || incoming.data.outputs || {};
it.set({ percentage: 100, status: "success", outputs });
this._updateStateForSuccess(it);
const Galaxy = getGalaxyInstance();
Galaxy.currHistoryPanel.refreshContents();
refreshContentsWrapper();
},
_eventBuild: function () {
+2 -3
View File
@@ -61,7 +61,7 @@
<script>
import _l from "utils/localization";
import _ from "underscore";
import { getGalaxyInstance } from "app";
import { refreshContentsWrapper } from "utils/data";
import UploadRow from "mvc/upload/composite/composite-row";
import UploadBoxMixin from "./UploadBoxMixin";
import { uploadModelsToPayload } from "./helpers";
@@ -193,11 +193,10 @@ export default {
/** Refresh success state */
_eventSuccess: function (message) {
const Galaxy = getGalaxyInstance();
this.collection.each((it) => {
it.set("status", "success");
});
Galaxy.currHistoryPanel.refreshContents();
refreshContentsWrapper();
},
/** Refresh error state */
@@ -6,11 +6,10 @@ import UploadExtension from "mvc/upload/upload-extension";
import UploadModel from "mvc/upload/upload-model";
import UploadWrapper from "./UploadWrapper";
import { defaultNewFileName, uploadModelsToPayload } from "./helpers";
import { getGalaxyInstance } from "app";
import UploadFtp from "mvc/upload/upload-ftp";
import LazyLimited from "mvc/lazy/lazy-limited";
import { findExtension } from "./utils";
import { filesDialog } from "utils/data";
import { filesDialog, refreshContentsWrapper } from "utils/data";
import { getAppRoot } from "onload";
import { UploadQueue } from "utils/uploadbox";
import axios from "axios";
@@ -195,8 +194,7 @@ export default {
this.counterAnnounce--;
this.counterSuccess++;
this._updateStateForCounters();
const Galaxy = getGalaxyInstance();
Galaxy.currHistoryPanel.refreshContents();
refreshContentsWrapper();
},
/** A new file has been dropped/selected through the uploadbox plugin */
_eventAnnounce: function (index, file) {
+10 -5
View File
@@ -9,6 +9,7 @@ import { uploadModelsToPayload } from "components/Upload/helpers";
import { getGalaxyInstance } from "app";
import { getAppRoot } from "onload/loadConfig";
import { submitUpload } from "utils/uploadbox";
import { rewatchHistory } from "store/historyStore/model/watchHistory";
// This should be moved more centrally (though still hanging off Galaxy for
// external use?), and populated from the store; just using this as a temporary
@@ -85,8 +86,6 @@ function _mountSelectionDialog(clazz, options) {
* TODO: This should live somewhere else.
*/
export function create(options) {
const Galaxy = getGalaxyInstance();
const history_panel = Galaxy.currHistoryPanel;
async function getHistory() {
if (!options.history_id) {
return getCurrentGalaxyHistory();
@@ -97,9 +96,7 @@ export function create(options) {
submitUpload({
url: `${getAppRoot()}api/tools/fetch`,
success: (response) => {
if (history_panel) {
history_panel.refreshContents();
}
refreshContentsWrapper();
if (options.success) {
options.success(response);
}
@@ -111,3 +108,11 @@ export function create(options) {
});
});
}
export function refreshContentsWrapper() {
const Galaxy = getGalaxyInstance();
// Legacy Panel Interface. no-op if using new history
Galaxy?.currHistoryPanel?.refreshContents();
// Will not do anything in legacy interface
rewatchHistory();
}