mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Fix workflow activation from the Workflows view (#4549)
🐛 Fixing a bug when activating workflow from workflows view
This commit is contained in:
parent
026fb50512
commit
d2bec63cec
|
@ -319,7 +319,7 @@ export interface IWorkflowDb {
|
||||||
pinData?: IPinData;
|
pinData?: IPinData;
|
||||||
sharedWith?: Array<Partial<IUser>>;
|
sharedWith?: Array<Partial<IUser>>;
|
||||||
ownedBy?: Partial<IUser>;
|
ownedBy?: Partial<IUser>;
|
||||||
hash?: string;
|
hash: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identical to cli.Interfaces.ts
|
// Identical to cli.Interfaces.ts
|
||||||
|
|
|
@ -94,7 +94,7 @@ export default mixins(
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async activeChanged (newActiveState: boolean) {
|
async activeChanged (newActiveState: boolean) {
|
||||||
return this.updateWorkflowActivation(this.workflowId, newActiveState);
|
return await this.updateWorkflowActivation(this.workflowId, newActiveState);
|
||||||
},
|
},
|
||||||
async displayActivationError () {
|
async displayActivationError () {
|
||||||
let errorMessage: string;
|
let errorMessage: string;
|
||||||
|
|
|
@ -100,6 +100,7 @@ export default mixins(
|
||||||
name: '',
|
name: '',
|
||||||
sharedWith: [],
|
sharedWith: [],
|
||||||
ownedBy: {} as IUser,
|
ownedBy: {} as IUser,
|
||||||
|
hash: '',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
readonly: {
|
readonly: {
|
||||||
|
|
|
@ -611,7 +611,7 @@ export default mixins(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const workflow = await this.restApi().updateWorkflow(this.$route.params.name, data);
|
const workflow = await this.restApi().updateWorkflow(this.$route.params.name, data);
|
||||||
this.workflowsStore.setWorkflowHash(workflow.hash || '');
|
this.workflowsStore.setWorkflowHash(workflow.hash);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$showError(
|
this.$showError(
|
||||||
error,
|
error,
|
||||||
|
|
|
@ -681,7 +681,7 @@ export const workflowHelpers = mixins(
|
||||||
data = await this.getWorkflowDataToSave();
|
data = await this.getWorkflowDataToSave();
|
||||||
} else {
|
} else {
|
||||||
const { hash } = await this.restApi().getWorkflow(workflowId);
|
const { hash } = await this.restApi().getWorkflow(workflowId);
|
||||||
data.hash = hash as string;
|
data.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active !== undefined) {
|
if (active !== undefined) {
|
||||||
|
@ -689,7 +689,7 @@ export const workflowHelpers = mixins(
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflow = await this.restApi().updateWorkflow(workflowId, data);
|
const workflow = await this.restApi().updateWorkflow(workflowId, data);
|
||||||
this.workflowsStore.setWorkflowHash(workflow.hash || '');
|
this.workflowsStore.setWorkflowHash(workflow.hash);
|
||||||
|
|
||||||
if (isCurrentWorkflow) {
|
if (isCurrentWorkflow) {
|
||||||
this.workflowsStore.setActive(!!workflow.active);
|
this.workflowsStore.setActive(!!workflow.active);
|
||||||
|
@ -727,7 +727,7 @@ export const workflowHelpers = mixins(
|
||||||
workflowDataRequest.hash = this.workflowsStore.workflowHash;
|
workflowDataRequest.hash = this.workflowsStore.workflowHash;
|
||||||
|
|
||||||
const workflowData = await this.restApi().updateWorkflow(currentWorkflow, workflowDataRequest);
|
const workflowData = await this.restApi().updateWorkflow(currentWorkflow, workflowDataRequest);
|
||||||
this.workflowsStore.setWorkflowHash(workflowData.hash || '');
|
this.workflowsStore.setWorkflowHash(workflowData.hash);
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
this.workflowsStore.setWorkflowName({newName: workflowData.name, setStateDirty: false});
|
this.workflowsStore.setWorkflowName({newName: workflowData.name, setStateDirty: false});
|
||||||
|
@ -794,7 +794,7 @@ export const workflowHelpers = mixins(
|
||||||
const workflowData = await this.restApi().createNewWorkflow(workflowDataRequest);
|
const workflowData = await this.restApi().createNewWorkflow(workflowDataRequest);
|
||||||
|
|
||||||
this.workflowsStore.addWorkflow(workflowData);
|
this.workflowsStore.addWorkflow(workflowData);
|
||||||
this.workflowsStore.setWorkflowHash(workflowData.hash || '');
|
this.workflowsStore.setWorkflowHash(workflowData.hash);
|
||||||
|
|
||||||
if (openInNewWindow) {
|
if (openInNewWindow) {
|
||||||
const routeData = this.$router.resolve({name: VIEWS.WORKFLOW, params: {name: workflowData.id}});
|
const routeData = this.$router.resolve({name: VIEWS.WORKFLOW, params: {name: workflowData.id}});
|
||||||
|
|
|
@ -287,6 +287,10 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.activeWorkflows.push(workflowId);
|
this.activeWorkflows.push(workflowId);
|
||||||
}
|
}
|
||||||
|
if (this.workflowsById[workflowId]) {
|
||||||
|
this.workflowsById[workflowId].active = true;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setWorkflowInactive(workflowId: string): void {
|
setWorkflowInactive(workflowId: string): void {
|
||||||
|
@ -294,6 +298,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.activeWorkflows.splice(index, 1);
|
this.activeWorkflows.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
if (this.workflowsById[workflowId]) {
|
||||||
|
this.workflowsById[workflowId].active = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchActiveWorkflows(): Promise<string[]> {
|
async fetchActiveWorkflows(): Promise<string[]> {
|
||||||
|
|
|
@ -813,7 +813,7 @@ export default mixins(
|
||||||
this.workflowsStore.setWorkflowName({ newName: data.name, setStateDirty: false });
|
this.workflowsStore.setWorkflowName({ newName: data.name, setStateDirty: false });
|
||||||
this.workflowsStore.setWorkflowSettings(data.settings || {});
|
this.workflowsStore.setWorkflowSettings(data.settings || {});
|
||||||
this.workflowsStore.setWorkflowPinData(data.pinData || {});
|
this.workflowsStore.setWorkflowPinData(data.pinData || {});
|
||||||
this.workflowsStore.setWorkflowHash(data.hash || '');
|
this.workflowsStore.setWorkflowHash(data.hash);
|
||||||
|
|
||||||
const tags = (data.tags || []) as ITag[];
|
const tags = (data.tags || []) as ITag[];
|
||||||
const tagIds = tags.map((tag) => tag.id);
|
const tagIds = tags.map((tag) => tag.id);
|
||||||
|
|
Loading…
Reference in a new issue