Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(editor): Delete leftover restApi mixin file (no-changelog) #6074

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,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 @@ -234,13 +234,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 @@ -450,7 +450,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
224 changes: 0 additions & 224 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
17 changes: 4 additions & 13 deletions packages/editor-ui/src/stores/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
return workflows;
},

async fetchAndSetWorkflow(id: string): Promise<IWorkflowDb> {
async fetchWorkflow(id: string): Promise<IWorkflowDb> {
const rootStore = useRootStore();
const workflow = await getWorkflow(rootStore.getRestApiContext, id);
this.addWorkflow(workflow);
Expand Down Expand Up @@ -492,7 +492,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 @@ -1119,11 +1121,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 @@ -1135,12 +1132,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