mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
Use standard bootstrap modal for copyIntoWorkflow; yagni w/ utilities -- keep action with component. Separation wasn't remotely clean anyway, with it taking the component instance as the first argument to operate on.
This commit is contained in:
@@ -180,7 +180,7 @@ import { getDatatypesMapper } from "components/Datatypes";
|
||||
import { fromSimple } from "./modules/model";
|
||||
import { getModule, getVersions, saveWorkflow, loadWorkflow } from "./modules/services";
|
||||
import { getUntypedWorkflowParameters } from "./modules/parameters";
|
||||
import { getStateUpgradeMessages, copyIntoWorkflow, saveAs } from "./modules/utilities";
|
||||
import { getStateUpgradeMessages, saveAs } from "./modules/utilities";
|
||||
import WorkflowCanvas from "./modules/canvas";
|
||||
import WorkflowOptions from "./Options";
|
||||
import FormDefault from "./Forms/FormDefault";
|
||||
@@ -456,12 +456,30 @@ export default {
|
||||
onInsertWorkflow(workflow_id, workflow_name) {
|
||||
this._insertStep(workflow_id, workflow_name, "subworkflow");
|
||||
},
|
||||
onInsertWorkflowSteps(workflow_id, step_count) {
|
||||
copyIntoWorkflow(id = null) {
|
||||
// Load workflow definition
|
||||
this.onWorkflowMessage("Importing workflow", "progress");
|
||||
loadWorkflow(this, id, null, true).then((data) => {
|
||||
// Determine if any parameters were 'upgraded' and provide message
|
||||
const insertedStateMessages = getStateUpgradeMessages(data);
|
||||
this.onInsertedStateMessages(insertedStateMessages);
|
||||
});
|
||||
},
|
||||
async onInsertWorkflowSteps(workflow_id, step_count) {
|
||||
if (!this.isCanvas) {
|
||||
this.isCanvas = true;
|
||||
return;
|
||||
}
|
||||
copyIntoWorkflow(this, workflow_id, step_count);
|
||||
if (step_count < 4) {
|
||||
this.copyIntoWorkflow(workflow_id);
|
||||
} else {
|
||||
const confirmed = await this.$bvModal.msgBoxConfirm(
|
||||
`Warning this will add ${step_count} new steps into your current workflow. You may want to consider using a subworkflow instead.`
|
||||
);
|
||||
if (confirmed) {
|
||||
this.copyIntoWorkflow(workflow_id);
|
||||
}
|
||||
}
|
||||
},
|
||||
onDownload() {
|
||||
window.location = `${getAppRoot()}api/workflows/${this.id}/download?format=json-download`;
|
||||
|
||||
@@ -1,36 +1,10 @@
|
||||
import _ from "underscore";
|
||||
import $ from "jquery";
|
||||
import { getAppRoot } from "onload/loadConfig";
|
||||
import { loadWorkflow } from "./services";
|
||||
import { toSimple } from "./model";
|
||||
import { show_modal } from "layout/modal";
|
||||
import WorkflowIcons from "components/Workflow/icons";
|
||||
|
||||
export function copyIntoWorkflow(workflow, id = null, stepCount = null) {
|
||||
const _copy_into_workflow_ajax = () => {
|
||||
// Load workflow definition
|
||||
workflow.onWorkflowMessage("Importing workflow", "progress");
|
||||
loadWorkflow(workflow, id, null, true).then((data) => {
|
||||
// Determine if any parameters were 'upgraded' and provide message
|
||||
const insertedStateMessages = getStateUpgradeMessages(data);
|
||||
workflow.onInsertedStateMessages(insertedStateMessages);
|
||||
});
|
||||
};
|
||||
if (stepCount < 10) {
|
||||
// If it's less than 10 steps, just do it.
|
||||
_copy_into_workflow_ajax();
|
||||
} else {
|
||||
// but don't ruin the workflow if it's a ton of steps.
|
||||
if (
|
||||
window.confirm(
|
||||
`Warning this will add ${stepCount} new steps into your current workflow. You may want to consider using a subworkflow instead.`
|
||||
)
|
||||
) {
|
||||
_copy_into_workflow_ajax();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getStateUpgradeMessages(data) {
|
||||
// Determine if any parameters were 'upgraded' and provide message
|
||||
const messages = [];
|
||||
|
||||
Reference in New Issue
Block a user