Skip to content

Commit dbc7c31

Browse files
change Save + Exit activity to just an Exit activity
This activity still allows you to save your changes if you like
1 parent a1b87d8 commit dbc7c31

4 files changed

Lines changed: 22 additions & 54 deletions

File tree

client/src/components/Workflow/Editor/Index.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
@onRefactor="onRefactor"
1616
@onShow="hideModal" />
1717
<MessagesModal :title="messageTitle" :message="messageBody" :error="messageIsError" @onHidden="resetMessage" />
18-
<SaveChangesModal :nav-url.sync="navUrl" :show-modal.sync="showSaveChangesModal" @on-proceed="onNavigate" />
18+
<SaveChangesModal
19+
:append-version="saveChangesAppendVersion"
20+
:nav-url="navUrl"
21+
:show-modal.sync="showSaveChangesModal"
22+
@on-proceed="onNavigate" />
1923
<GModal
2024
:show.sync="showSaveAsModal"
2125
confirm
@@ -624,7 +628,6 @@ export default {
624628
625629
const { specialWorkflowActivities, exitWorkflowActivity, runWorkflowActivity } = useSpecialWorkflowActivities(
626630
computed(() => ({
627-
hasInvalidConnections: hasInvalidConnections.value,
628631
lintData: lintData,
629632
})),
630633
);
@@ -768,6 +771,7 @@ export default {
768771
graphOffset: { left: 0, top: 0, width: 0, height: 0 },
769772
debounceTimer: null,
770773
showSaveChangesModal: false,
774+
saveChangesAppendVersion: false,
771775
navUrl: "",
772776
faArrowLeft,
773777
faArrowRight,
@@ -1008,13 +1012,8 @@ export default {
10081012
}
10091013
},
10101014
async onActivityClicked(activityId) {
1011-
if (activityId === "save-and-exit") {
1012-
await this.saveOrCreate();
1013-
this.$router.push("/workflows/list");
1014-
}
1015-
10161015
if (activityId === "exit") {
1017-
this.$router.push("/workflows/list");
1016+
this.onNavigate("/workflows/list");
10181017
}
10191018
10201019
if (activityId === "workflow-download") {
@@ -1123,6 +1122,7 @@ export default {
11231122
} else if (this.hasChanges && !forceSave && !ignoreChanges) {
11241123
// if there are changes, prompt user to save or discard or cancel
11251124
this.navUrl = url;
1125+
this.saveChangesAppendVersion = appendVersion;
11261126
this.showSaveChangesModal = true;
11271127
} else if (forceSave) {
11281128
// when forceSave is true, save the workflow before navigating

client/src/components/Workflow/Editor/SaveChangesModal.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ interface Props {
1313
showModal: boolean;
1414
/** The URL to navigate to before saving/ignoring changes */
1515
navUrl: string;
16+
/** Whether to append the version to the URL */
17+
appendVersion: boolean;
1618
}
1719
1820
const props = withDefaults(defineProps<Props>(), {
1921
showModal: false,
22+
appendVersion: false,
2023
});
2124
2225
const busy = ref(false);
2326
2427
const emit = defineEmits<{
2528
/** Proceed with or without saving the changes */
2629
(e: "on-proceed", url: string, forceSave: boolean, ignoreChanges: boolean, appendVersion: boolean): void;
27-
/** Update the nav URL prop */
28-
(e: "update:nav-url", url: string): void;
2930
/** Update the show modal boolean prop */
3031
(e: "update:show-modal", showModal: boolean): void;
3132
}>();
@@ -43,18 +44,17 @@ const buttonTitles = {
4344
4445
function closeModal() {
4546
emit("update:show-modal", false);
46-
emit("update:nav-url", "");
4747
}
4848
4949
function dontSave() {
5050
busy.value = true;
51-
emit("on-proceed", props.navUrl, false, true, true);
51+
emit("on-proceed", props.navUrl, false, true, props.appendVersion);
5252
}
5353
5454
function saveChanges() {
5555
busy.value = true;
5656
closeModal();
57-
emit("on-proceed", props.navUrl, true, false, true);
57+
emit("on-proceed", props.navUrl, true, false, props.appendVersion);
5858
}
5959
</script>
6060

client/src/components/Workflow/Editor/modules/activities.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,4 @@ describe("useSpecialWorkflowActivities", () => {
111111
);
112112
});
113113
});
114-
115-
describe("exitWorkflowActivity tooltip", () => {
116-
it("shows save and exit message when connections are valid", () => {
117-
const { exitWorkflowActivity } = setUpBestPractices(false);
118-
expect(exitWorkflowActivity.value.tooltip).toBe("Save this workflow, then exit the workflow editor");
119-
});
120-
121-
it("shows invalid connections warning when hasInvalidConnections is true", () => {
122-
const { exitWorkflowActivity } = setUpBestPractices(true);
123-
expect(exitWorkflowActivity.value.tooltip).toBe(
124-
"Workflow has invalid connections, review and remove invalid connections",
125-
);
126-
});
127-
});
128114
});

client/src/components/Workflow/Editor/modules/activities.ts

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -188,33 +188,14 @@ export function useWorkflowActivities(
188188
click: true,
189189
optional: true,
190190
},
191-
{
192-
description: "Exit the workflow editor and return to the start screen.",
193-
icon: faSignOutAlt,
194-
id: "exit",
195-
title: "Exit",
196-
tooltip: "Exit workflow editor",
197-
visible: false,
198-
click: true,
199-
optional: true,
200-
},
201191
]);
202192
}
203193

204194
interface SpecialActivityOptions {
205-
hasInvalidConnections: boolean;
206195
lintData: LintData;
207196
}
208197

209198
export function useSpecialWorkflowActivities(options: Ref<SpecialActivityOptions>) {
210-
const saveHover = computed(() => {
211-
if (options.value.hasInvalidConnections) {
212-
return "Workflow has invalid connections, review and remove invalid connections";
213-
} else {
214-
return "Save this workflow, then exit the workflow editor";
215-
}
216-
});
217-
218199
/** Indicator for best practices activity
219200
* @returns
220201
* - `number`: count of critical issues remaining
@@ -282,16 +263,17 @@ export function useSpecialWorkflowActivities(options: Ref<SpecialActivityOptions
282263
optional: true,
283264
};
284265

285-
const exitWorkflowActivity = computed<Activity>(() => ({
286-
description: "",
287-
icon: faSave,
288-
id: "save-and-exit",
289-
title: "Save + Exit",
290-
tooltip: saveHover.value,
266+
const exitWorkflowActivity: Activity = {
267+
description:
268+
"Exit the workflow editor and return to your Galaxy. If you have unsaved changes you will be prompted to save or discard them.",
269+
icon: faSignOutAlt,
270+
id: "exit",
271+
title: "Exit",
272+
tooltip: "Exit workflow editor",
291273
visible: false,
292274
click: true,
293-
mutable: false,
294-
}));
275+
optional: true,
276+
};
295277

296278
return {
297279
specialWorkflowActivities,

0 commit comments

Comments
 (0)