test(editor): Add first frontend unit-test and update notice component design (#3166)

*  Added basic Vue 2 + Vite.js setup.

* 🚧 Improved typescript support.

*  Added N8nNotice component to design system with stories and unit tests.

*  Migrated design system build to Vite.js.

* ♻️ Updated typescript definitions. Moved some interface types to remove reliance from design system on editor-ui user and validation types.

* ♻️ Changed prop name from type to theme. Updated truncation props.

* ♻️ Moved user response types back. Added n8n-notice component to editor-ui.

* 🐛 Fixed global vitest types.

*  Added this. vue type extension to editor-ui

* ♻️ Removed circular import.

*  Fixed failing n8n-notice tests.

* feat: Added support for notice truncation via typeOptions.

*  Updated warning color variables and notice warning colors.

* 🐛 Fixed n8n-notice parameter input spacing.
This commit is contained in:
Alex Grozav
2022-04-29 16:23:41 +03:00
committed by GitHub
parent 69d6b7827f
commit 0a69a9eb9c
72 changed files with 17738 additions and 21353 deletions

View File

@@ -23,6 +23,8 @@ import {
WorkflowExecuteMode,
} from 'n8n-workflow';
export * from 'n8n-design-system/src/types';
declare module 'jsplumb' {
interface PaintStyle {
stroke?: string;
@@ -477,12 +479,6 @@ export interface IPushDataConsoleMessage {
messages: string[];
}
export interface IVersionNotificationSettings {
enabled: boolean;
endpoint: string;
infoUrl: string;
}
export type IPersonalizationSurveyAnswersV1 = {
codingSkill?: string | null;
companyIndustry?: string[] | null;
@@ -505,6 +501,34 @@ export type IPersonalizationSurveyAnswersV2 = {
otherCompanyIndustryExtended?: string[] | null;
};
export type IRole = 'default' | 'owner' | 'member';
export interface IUserResponse {
id: string;
firstName?: string;
lastName?: string;
email?: string;
globalRole?: {
name: IRole;
id: string;
};
personalizationAnswers?: IPersonalizationSurveyAnswersV1 | IPersonalizationSurveyAnswersV2 | null;
isPending: boolean;
}
export interface IUser extends IUserResponse {
isDefaultUser: boolean;
isPendingUser: boolean;
isOwner: boolean;
fullName?: string;
}
export interface IVersionNotificationSettings {
enabled: boolean;
endpoint: string;
infoUrl: string;
}
export interface IN8nPrompts {
message: string;
title: string;
@@ -888,21 +912,6 @@ export interface IBounds {
export type ILogInStatus = 'LoggedIn' | 'LoggedOut';
export type IRole = 'default' | 'owner' | 'member';
export interface IUserResponse {
id: string;
firstName?: string;
lastName?: string;
email?: string;
globalRole?: {
name: IRole;
id: string;
};
personalizationAnswers?: IPersonalizationSurveyAnswersV1 | IPersonalizationSurveyAnswersV2 | null;
isPending: boolean;
}
export interface IInviteResponse {
user: {
id: string;
@@ -911,59 +920,6 @@ export interface IInviteResponse {
error?: string;
}
export interface IUser extends IUserResponse {
isDefaultUser: boolean;
isPendingUser: boolean;
isOwner: boolean;
fullName?: string;
}
export type Rule = { name: string; config?: any}; // tslint:disable-line:no-any
export type RuleGroup = {
rules: Array<Rule | RuleGroup>;
defaultError?: {messageKey: string, options?: any}; // tslint:disable-line:no-any
};
export type IValidator = {
validate: (value: string | number | boolean | null | undefined, config: any) => false | {messageKey: string, options?: any}; // tslint:disable-line:no-any
};
export type IFormInput = {
name: string;
initialValue?: string | number | boolean | null;
properties: {
label?: string;
type?: 'text' | 'email' | 'password' | 'select' | 'multi-select' | 'info';
maxlength?: number;
required?: boolean;
showRequiredAsterisk?: boolean;
validators?: {
[name: string]: IValidator;
};
validationRules?: Array<Rule | RuleGroup>;
validateOnBlur?: boolean;
infoText?: string;
placeholder?: string;
options?: Array<{label: string; value: string}>;
autocomplete?: 'off' | 'new-password' | 'current-password' | 'given-name' | 'family-name' | 'email'; // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
capitalize?: boolean;
focusInitially?: boolean;
};
shouldDisplay?: (values: {[key: string]: unknown}) => boolean;
};
export type IFormInputs = IFormInput[];
export type IFormBoxConfig = {
title: string;
buttonText?: string;
secondaryButtonText?: string;
inputs: IFormInputs;
redirectLink?: string;
redirectText?: string;
};
export interface ITab {
value: string | number;
label?: string;