From c0be43bdbed99c6bcceba662866667b8162dcf91 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 26 Feb 2024 16:05:12 +0200 Subject: [PATCH] fix(editor): Fix various typecheck issues (no-changelog) (#8739) --- packages/editor-ui/src/Interface.ts | 21 +++++++----- .../src/components/ExecutionsList.vue | 34 +++++++++---------- .../ExecutionsView/ExecutionCard.vue | 4 +-- .../ExecutionsView/ExecutionsList.vue | 18 +++++----- .../ExecutionsView/ExecutionsSidebar.vue | 6 ++-- .../__tests__/ExecutionPreview.test.ts | 6 ++-- .../src/components/MainHeader/MainHeader.vue | 6 ++-- packages/editor-ui/src/components/Node.vue | 4 +-- .../__tests__/ExecutionsList.test.ts | 6 ++-- .../__tests__/WorkflowPreview.test.ts | 4 +-- .../editor-ui/src/composables/useToast.ts | 22 ++++++++---- .../src/composables/useWorkflowHelpers.ts | 3 +- .../editor-ui/src/mixins/executionsHelpers.ts | 8 ++--- packages/editor-ui/src/stores/ui.store.ts | 5 ++- .../editor-ui/src/stores/workflows.store.ts | 14 ++++---- packages/editor-ui/src/views/NodeView.vue | 4 +-- 16 files changed, 91 insertions(+), 74 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 5f295a8d1..870e4d3df 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -34,7 +34,7 @@ import { type INodeListSearchItems, type NodeParameterValueType, type IDisplayOptions, - type IExecutionsSummary, + type ExecutionSummary, type FeatureFlags, type ExecutionStatus, type ITelemetryTrackProperties, @@ -53,6 +53,7 @@ import type { BulkCommand, Undoable } from '@/models/history'; import type { PartialBy, TupleToUnion } from '@/utils/typeHelpers'; import type { Component } from 'vue'; import type { Scope } from '@n8n/permissions'; +import type { NotificationOptions as ElementNotificationOptions } from 'element-plus'; export * from 'n8n-design-system/types'; @@ -395,7 +396,7 @@ export interface IExecutionShortResponse { export interface IExecutionsListResponse { count: number; - results: IExecutionsSummary[]; + results: ExecutionSummary[]; estimated: boolean; } @@ -1061,8 +1062,8 @@ export interface IUsedCredential { export interface WorkflowsState { activeExecutions: IExecutionsCurrentSummaryExtended[]; activeWorkflows: string[]; - activeWorkflowExecution: IExecutionsSummary | null; - currentWorkflowExecutions: IExecutionsSummary[]; + activeWorkflowExecution: ExecutionSummary | null; + currentWorkflowExecutions: ExecutionSummary[]; activeExecutionId: string | null; executingNode: string[]; executionWaitingForWebhook: boolean; @@ -1189,9 +1190,9 @@ export type ModalState = { httpNodeParameters?: string; }; -export type NewCredentialsModal = ModalState & { +export interface NewCredentialsModal extends ModalState { showAuthSelector?: boolean; -}; +} export type IRunDataDisplayMode = 'table' | 'json' | 'binary' | 'schema' | 'html' | 'ai'; export type NodePanelType = 'input' | 'output'; @@ -1240,6 +1241,10 @@ export interface NDVState { isMappingOnboarded: boolean; } +export interface NotificationOptions extends Partial { + message: string | ElementNotificationOptions['message']; +} + export interface UIState { activeActions: string[]; activeCredentialType: string | null; @@ -1398,8 +1403,8 @@ export interface IUsersState { } export interface IWorkflowsState { - currentWorkflowExecutions: IExecutionsSummary[]; - activeWorkflowExecution: IExecutionsSummary | null; + currentWorkflowExecutions: ExecutionSummary[]; + activeWorkflowExecution: ExecutionSummary | null; finishedExecutionsCount: number; } export interface IWorkflowsMap { diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index b9e6cb633..189e879e1 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -301,7 +301,7 @@ import type { ExecutionFilterType, ExecutionsQueryFilter, } from '@/Interface'; -import type { IExecutionsSummary, ExecutionStatus } from 'n8n-workflow'; +import type { ExecutionSummary, ExecutionStatus } from 'n8n-workflow'; import { range as _range } from 'lodash-es'; import { useUIStore } from '@/stores/ui.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; @@ -342,7 +342,7 @@ export default defineComponent({ data() { return { isMounting: true, - finishedExecutions: [] as IExecutionsSummary[], + finishedExecutions: [] as ExecutionSummary[], finishedExecutionsCount: 0, finishedExecutionsCountEstimated: false, @@ -388,8 +388,8 @@ export default defineComponent({ activeExecutions(): IExecutionsCurrentSummaryExtended[] { return this.workflowsStore.activeExecutions; }, - combinedExecutions(): IExecutionsSummary[] { - const returnData: IExecutionsSummary[] = []; + combinedExecutions(): ExecutionSummary[] { + const returnData: ExecutionSummary[] = []; if (['all', 'running'].includes(this.filter.status)) { returnData.push(...this.activeExecutions); @@ -428,7 +428,7 @@ export default defineComponent({ closeDialog() { this.$emit('closeModal'); }, - displayExecution(execution: IExecutionsSummary) { + displayExecution(execution: ExecutionSummary) { const route = this.$router.resolve({ name: VIEWS.EXECUTION_PREVIEW, params: { name: execution.workflowId, executionId: execution.id }, @@ -529,7 +529,7 @@ export default defineComponent({ this.handleClearSelection(); this.isMounting = false; }, - async handleActionItemClick(commandData: { command: string; execution: IExecutionsSummary }) { + async handleActionItemClick(commandData: { command: string; execution: ExecutionSummary }) { if (['currentlySaved', 'original'].includes(commandData.command)) { let loadWorkflow = false; if (commandData.command === 'currentlySaved') { @@ -747,7 +747,7 @@ export default defineComponent({ this.showError(error, this.i18n.baseText('executionsList.showError.loadWorkflows.title')); } }, - async retryExecution(execution: IExecutionsSummary, loadWorkflow?: boolean) { + async retryExecution(execution: ExecutionSummary, loadWorkflow?: boolean) { this.isDataLoading = true; try { @@ -786,7 +786,7 @@ export default defineComponent({ this.isDataLoading = false; }, - getStatus(execution: IExecutionsSummary): ExecutionStatus { + getStatus(execution: ExecutionSummary): ExecutionStatus { if (execution.status) { return execution.status; } else { @@ -806,10 +806,10 @@ export default defineComponent({ return status; } }, - getRowClass(execution: IExecutionsSummary): string { + getRowClass(execution: ExecutionSummary): string { return [this.$style.execRow, this.$style[this.getStatus(execution)]].join(' '); }, - getStatusText(entry: IExecutionsSummary): string { + getStatusText(entry: ExecutionSummary): string { const status = this.getStatus(entry); let text = ''; @@ -833,7 +833,7 @@ export default defineComponent({ return text; }, - getStatusTextTranslationPath(entry: IExecutionsSummary): string { + getStatusTextTranslationPath(entry: ExecutionSummary): string { const status = this.getStatus(entry); let path = ''; @@ -857,7 +857,7 @@ export default defineComponent({ return path; }, - getStatusTooltipText(entry: IExecutionsSummary): string { + getStatusTooltipText(entry: ExecutionSummary): string { const status = this.getStatus(entry); let text = ''; @@ -894,7 +894,7 @@ export default defineComponent({ this.showError(error, this.i18n.baseText('executionsList.showError.stopExecution.title')); } }, - isExecutionRetriable(execution: IExecutionsSummary): boolean { + isExecutionRetriable(execution: ExecutionSummary): boolean { return ( execution.stoppedAt !== undefined && !execution.finished && @@ -903,7 +903,7 @@ export default defineComponent({ !execution.waitTill ); }, - async deleteExecution(execution: IExecutionsSummary) { + async deleteExecution(execution: ExecutionSummary) { this.isDataLoading = true; try { await this.workflowsStore.deleteExecutions({ ids: [execution.id] }); @@ -921,17 +921,17 @@ export default defineComponent({ } this.isDataLoading = true; }, - isWaitTillIndefinite(execution: IExecutionsSummary): boolean { + isWaitTillIndefinite(execution: ExecutionSummary): boolean { if (!execution.waitTill) { return false; } return new Date(execution.waitTill).toISOString() === WAIT_TIME_UNLIMITED; }, - isRunning(execution: IExecutionsSummary): boolean { + isRunning(execution: ExecutionSummary): boolean { return this.getStatus(execution) === 'running'; }, selectAllVisibleExecutions() { - this.combinedExecutions.forEach((execution: IExecutionsSummary) => { + this.combinedExecutions.forEach((execution: ExecutionSummary) => { this.selectedItems = { ...this.selectedItems, [execution.id]: true }; }); }, diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue index 8d6923956..cccdd3320 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue @@ -83,7 +83,7 @@