Skip to content

Commit

Permalink
refactor(editor): Delete leftover restApi mixin file (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Apr 24, 2023
1 parent feb2ba0 commit a4df8a6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,9 @@ export default mixins(workflowHelpers).extend({
}
try {
await this.workflowsStore.deleteWorkflowAPI(this.currentWorkflowId);
await this.workflowsStore.deleteWorkflow(this.currentWorkflowId);
} catch (error) {
this.$showError(
error,
this.$locale.baseText('mainSidebar.showError.stopExecution.title'),
);
this.$showError(error, this.$locale.baseText('generic.deleteWorkflowError'));
return;
}
this.uiStore.stateIsDirty = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const workflowName = ref('');
onMounted(async () => {
const currentSettings = getCurrentSettings();
try {
const { name } = await workflowStore.fetchAndSetWorkflow(
const { name } = await workflowStore.fetchWorkflow(
currentSettings?.firstSuccessfulWorkflowId ?? '',
);
workflowName.value = name;
Expand Down
8 changes: 2 additions & 6 deletions packages/editor-ui/src/components/WorkflowCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,9 @@ export default mixins(showMessage).extend({
}
try {
await this.workflowsStore.deleteWorkflowAPI(this.data.id);
this.workflowsStore.deleteWorkflow(this.data.id);
await this.workflowsStore.deleteWorkflow(this.data.id);
} catch (error) {
this.$showError(
error,
this.$locale.baseText('mainSidebar.showError.stopExecution.title'),
);
this.$showError(error, this.$locale.baseText('generic.deleteWorkflowError'));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export default mixins(showMessage).extend({
this.workflow.id !== PLACEHOLDER_EMPTY_WORKFLOW_ID &&
!this.workflow.sharedWith?.length // Sharing info already loaded
) {
await this.workflowsStore.fetchAndSetWorkflow(this.workflow.id);
await this.workflowsStore.fetchWorkflow(this.workflow.id);
}
}
Expand Down
225 changes: 0 additions & 225 deletions packages/editor-ui/src/mixins/restApi.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"generic.any": "Any",
"generic.cancel": "Cancel",
"generic.confirm": "Confirm",
"generic.deleteWorkflowError": "Problem deleting workflow",
"generic.filtersApplied": "Filters are currently applied.",
"generic.learnMore": "Learn more",
"generic.reset": "Reset",
Expand Down
22 changes: 9 additions & 13 deletions packages/editor-ui/src/stores/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,12 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
return workflows;
},

async fetchAndSetWorkflow(id: string): Promise<IWorkflowDb> {
// async fetchWorkflow(id: string): Promise<IWorkflowDb> {
// const rootStore = useRootStore();
// return makeRestApiRequest(rootStore.getRestApiContext, 'GET', `/workflows/${id}`);
// },

async fetchWorkflow(id: string): Promise<IWorkflowDb> {
const rootStore = useRootStore();
const workflow = await getWorkflow(rootStore.getRestApiContext, id);
this.addWorkflow(workflow);
Expand Down Expand Up @@ -494,7 +499,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
}, {});
},

deleteWorkflow(id: string): void {
async deleteWorkflow(id: string): Promise<void> {
const rootStore = useRootStore();
await makeRestApiRequest(rootStore.getRestApiContext, 'DELETE', `/workflows/${id}`);
const { [id]: deletedWorkflow, ...workflows } = this.workflowsById;
this.workflowsById = workflows;
},
Expand Down Expand Up @@ -1121,11 +1128,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
return response && unflattenExecutionData(response);
},

async fetchWorkflow(id: string): Promise<IWorkflowDb> {
const rootStore = useRootStore();
return makeRestApiRequest(rootStore.getRestApiContext, 'GET', `/workflows/${id}`);
},

// Creates a new workflow
async createNewWorkflow(sendData: IWorkflowDataUpdate): Promise<IWorkflowDb> {
const rootStore = useRootStore();
Expand All @@ -1137,12 +1139,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
);
},

// Deletes a workflow
async deleteWorkflowAPI(name: string): Promise<void> {
const rootStore = useRootStore();
return makeRestApiRequest(rootStore.getRestApiContext, 'DELETE', `/workflows/${name}`);
},

// Updates an existing workflow
async updateWorkflow(
id: string,
Expand Down

0 comments on commit a4df8a6

Please sign in to comment.