feat: Ado 1296 spike credential setup in templates (#7786)

- Add a 'Setup template credentials' view to setup the credentials of a
template before it is created
This commit is contained in:
Tomi Turtiainen
2023-11-27 16:30:28 +02:00
committed by GitHub
parent 27e048c201
commit aae45b043b
25 changed files with 1423 additions and 20 deletions

View File

@@ -45,6 +45,7 @@ import type {
INodeExecutionData,
INodeProperties,
NodeConnectionType,
INodeCredentialsDetails,
} from 'n8n-workflow';
import type { BulkCommand, Undoable } from '@/models/history';
import type { PartialBy, TupleToUnion } from '@/utils/typeHelpers';
@@ -248,10 +249,22 @@ export interface IWorkflowToShare extends IWorkflowDataUpdate {
};
}
export interface IWorkflowTemplateNode
extends Pick<INodeUi, 'name' | 'type' | 'position' | 'parameters' | 'typeVersion' | 'webhookId'> {
// The credentials in a template workflow have a different type than in a regular workflow
credentials?: IWorkflowTemplateNodeCredentials;
}
export interface IWorkflowTemplateNodeCredentials {
[key: string]: string | INodeCredentialsDetails;
}
export interface IWorkflowTemplate {
id: number;
name: string;
workflow: Pick<IWorkflowData, 'nodes' | 'connections' | 'settings' | 'pinData'>;
workflow: Pick<IWorkflowData, 'connections' | 'settings' | 'pinData'> & {
nodes: IWorkflowTemplateNode[];
};
}
export interface INewWorkflowData {
@@ -790,6 +803,9 @@ export interface ITemplatesCollectionResponse extends ITemplatesCollectionExtend
workflows: ITemplatesWorkflow[];
}
/**
* A template without the actual workflow definition
*/
export interface ITemplatesWorkflow {
id: number;
createdAt: string;
@@ -807,6 +823,9 @@ export interface ITemplatesWorkflowResponse extends ITemplatesWorkflow, IWorkflo
categories: ITemplatesCategory[];
}
/**
* A template with also the full workflow definition
*/
export interface ITemplatesWorkflowFull extends ITemplatesWorkflowResponse {
full: true;
}
@@ -1302,7 +1321,7 @@ export interface INodeTypesState {
export interface ITemplateState {
categories: { [id: string]: ITemplatesCategory };
collections: { [id: string]: ITemplatesCollection };
workflows: { [id: string]: ITemplatesWorkflow };
workflows: { [id: string]: ITemplatesWorkflow | ITemplatesWorkflowFull };
workflowSearches: {
[search: string]: {
workflowIds: string[];