fix(editor): Fix various typecheck issues (no-changelog) (#8739)

This commit is contained in:
Alex Grozav
2024-02-26 16:05:12 +02:00
committed by GitHub
parent 09524304e6
commit c0be43bdbe
16 changed files with 91 additions and 74 deletions

View File

@@ -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 };
});
},

View File

@@ -83,7 +83,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import type { IExecutionsSummary } from '@/Interface';
import type { ExecutionSummary } from '@/Interface';
import type { IExecutionUIData } from '@/mixins/executionsHelpers';
import { executionHelpers } from '@/mixins/executionsHelpers';
import { VIEWS } from '@/constants';
@@ -97,7 +97,7 @@ export default defineComponent({
mixins: [executionHelpers],
props: {
execution: {
type: Object as () => IExecutionsSummary,
type: Object as () => ExecutionSummary,
required: true,
},
highlight: {

View File

@@ -44,7 +44,7 @@ import type {
IWorkflowDb,
} from '@/Interface';
import type {
IExecutionsSummary,
ExecutionSummary,
IConnection,
IConnections,
IDataObject,
@@ -100,7 +100,7 @@ export default defineComponent({
loading: false,
loadingMore: false,
filter: {} as ExecutionFilterType,
temporaryExecution: null as IExecutionsSummary | null,
temporaryExecution: null as ExecutionSummary | null,
autoRefresh: false,
autoRefreshTimeout: undefined as undefined | NodeJS.Timer,
};
@@ -284,7 +284,7 @@ export default defineComponent({
this.loading = true;
try {
const executionIndex = this.executions.findIndex(
(execution: IExecutionsSummary) => execution.id === this.$route.params.executionId,
(execution: ExecutionSummary) => execution.id === this.$route.params.executionId,
);
const nextExecution =
this.executions[executionIndex + 1] ||
@@ -388,8 +388,8 @@ export default defineComponent({
},
async loadAutoRefresh(): Promise<void> {
// Most of the auto-refresh logic is taken from the `ExecutionsList` component
const fetchedExecutions: IExecutionsSummary[] = await this.loadExecutions();
let existingExecutions: IExecutionsSummary[] = [...this.executions];
const fetchedExecutions: ExecutionSummary[] = await this.loadExecutions();
let existingExecutions: ExecutionSummary[] = [...this.executions];
const alreadyPresentExecutionIds = existingExecutions.map((exec) => parseInt(exec.id, 10));
let lastId = 0;
const gaps = [] as number[];
@@ -465,7 +465,7 @@ export default defineComponent({
}
}
},
async loadExecutions(): Promise<IExecutionsSummary[]> {
async loadExecutions(): Promise<ExecutionSummary[]> {
if (!this.currentWorkflow) {
return [];
}
@@ -536,7 +536,7 @@ export default defineComponent({
);
return;
} else {
this.temporaryExecution = existingExecution as IExecutionsSummary;
this.temporaryExecution = existingExecution as ExecutionSummary;
}
}
// stop if the execution wasn't found in the first 1000 lookups
@@ -716,7 +716,7 @@ export default defineComponent({
async loadActiveWorkflows(): Promise<void> {
await this.workflowsStore.fetchActiveWorkflows();
},
async onRetryExecution(payload: { execution: IExecutionsSummary; command: string }) {
async onRetryExecution(payload: { execution: ExecutionSummary; command: string }) {
const loadWorkflow = payload.command === 'current-workflow';
this.showMessage({
@@ -733,7 +733,7 @@ export default defineComponent({
retry_type: loadWorkflow ? 'current' : 'original',
});
},
async retryExecution(execution: IExecutionsSummary, loadWorkflow?: boolean) {
async retryExecution(execution: ExecutionSummary, loadWorkflow?: boolean) {
try {
const retrySuccessful = await this.workflowsStore.retryExecution(
execution.id,

View File

@@ -64,7 +64,7 @@ import ExecutionCard from '@/components/ExecutionsView/ExecutionCard.vue';
import ExecutionsInfoAccordion from '@/components/ExecutionsView/ExecutionsInfoAccordion.vue';
import ExecutionFilter from '@/components/ExecutionFilter.vue';
import { VIEWS } from '@/constants';
import type { IExecutionsSummary } from 'n8n-workflow';
import type { ExecutionSummary } from 'n8n-workflow';
import type { Route } from 'vue-router';
import { defineComponent } from 'vue';
import type { PropType } from 'vue';
@@ -88,7 +88,7 @@ export default defineComponent({
default: false,
},
executions: {
type: Array as PropType<IExecutionsSummary[]>,
type: Array as PropType<ExecutionSummary[]>,
required: true,
},
loading: {
@@ -100,7 +100,7 @@ export default defineComponent({
default: false,
},
temporaryExecution: {
type: Object as PropType<IExecutionsSummary>,
type: Object as PropType<ExecutionSummary>,
default: null,
},
},

View File

@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
import { faker } from '@faker-js/faker';
import { createRouter, createWebHistory } from 'vue-router';
import { createPinia, PiniaVuePlugin, setActivePinia } from 'pinia';
import type { IExecutionsSummary } from 'n8n-workflow';
import type { ExecutionSummary } from 'n8n-workflow';
import { useSettingsStore } from '@/stores/settings.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import ExecutionPreview from '@/components/ExecutionsView/ExecutionPreview.vue';
@@ -48,7 +48,7 @@ const generateUndefinedNullOrString = () => {
}
};
const executionDataFactory = (): IExecutionsSummary => ({
const executionDataFactory = (): ExecutionSummary => ({
id: faker.string.uuid(),
finished: faker.datatype.boolean(),
mode: faker.helpers.arrayElement(['manual', 'trigger']),
@@ -65,7 +65,7 @@ const executionDataFactory = (): IExecutionsSummary => ({
describe('ExecutionPreview.vue', () => {
let workflowsStore: ReturnType<typeof useWorkflowsStore>;
let settingsStore: ReturnType<typeof useSettingsStore>;
const executionData: IExecutionsSummary = executionDataFactory();
const executionData: ExecutionSummary = executionDataFactory();
beforeEach(() => {
pinia = createPinia();

View File

@@ -18,7 +18,7 @@
import { defineComponent } from 'vue';
import type { Route, RouteLocationRaw } from 'vue-router';
import { mapStores } from 'pinia';
import type { IExecutionsSummary } from 'n8n-workflow';
import type { ExecutionSummary } from 'n8n-workflow';
import { pushConnection } from '@/mixins/pushConnection';
import WorkflowDetails from '@/components/MainHeader/WorkflowDetails.vue';
import TabBar from '@/components/MainHeader/TabBar.vue';
@@ -79,8 +79,8 @@ export default defineComponent({
(this.$route.meta.nodeView || this.$route.meta.keepWorkflowAlive === true)
);
},
activeExecution(): IExecutionsSummary {
return this.workflowsStore.activeWorkflowExecution as IExecutionsSummary;
activeExecution(): ExecutionSummary {
return this.workflowsStore.activeWorkflowExecution as ExecutionSummary;
},
readOnly(): boolean {
return this.sourceControlStore.preferences.branchReadOnly;

View File

@@ -191,7 +191,7 @@ import {
import { nodeBase } from '@/mixins/nodeBase';
import type {
ConnectionTypes,
IExecutionsSummary,
ExecutionSummary,
INodeInputConfiguration,
INodeOutputConfiguration,
INodeTypeDescription,
@@ -494,7 +494,7 @@ export default defineComponent({
return this.data.name;
},
waiting(): string | undefined {
const workflowExecution = this.workflowsStore.getWorkflowExecution as IExecutionsSummary;
const workflowExecution = this.workflowsStore.getWorkflowExecution as ExecutionSummary;
if (workflowExecution?.waitTill) {
const lastNodeExecuted = get(workflowExecution, 'data.resultData.lastNodeExecuted');

View File

@@ -6,7 +6,7 @@ import { faker } from '@faker-js/faker';
import { STORES, VIEWS } from '@/constants';
import ExecutionsList from '@/components/ExecutionsList.vue';
import type { IWorkflowDb } from '@/Interface';
import type { IExecutionsSummary } from 'n8n-workflow';
import type { ExecutionSummary } from 'n8n-workflow';
import { retry, SETTINGS_STORE_DEFAULT_STATE, waitAllPromises } from '@/__tests__/utils';
import { useWorkflowsStore } from '@/stores/workflows.store';
import type { RenderOptions } from '@/__tests__/render';
@@ -48,7 +48,7 @@ const workflowDataFactory = (): IWorkflowDb => ({
versionId: faker.number.int().toString(),
});
const executionDataFactory = (): IExecutionsSummary => ({
const executionDataFactory = (): ExecutionSummary => ({
id: faker.string.uuid(),
finished: faker.datatype.boolean(),
mode: faker.helpers.arrayElement(['manual', 'trigger']),
@@ -89,7 +89,7 @@ describe('ExecutionsList.vue', () => {
let workflowsData: IWorkflowDb[];
let executionsData: Array<{
count: number;
results: IExecutionsSummary[];
results: ExecutionSummary[];
estimated: boolean;
}>;

View File

@@ -1,7 +1,7 @@
import { vi } from 'vitest';
import { createPinia, setActivePinia } from 'pinia';
import { waitFor } from '@testing-library/vue';
import type { IExecutionsSummary } from 'n8n-workflow';
import type { ExecutionSummary } from 'n8n-workflow';
import { createComponentRenderer } from '@/__tests__/render';
import type { INodeUi, IWorkflowDb } from '@/Interface';
import WorkflowPreview from '@/components/WorkflowPreview.vue';
@@ -152,7 +152,7 @@ describe('WorkflowPreview', () => {
it('should call also iframe postMessage with "setActiveExecution" if active execution is set', async () => {
vi.spyOn(workflowsStore, 'activeWorkflowExecution', 'get').mockReturnValue({
id: 'abc',
} as IExecutionsSummary);
} as ExecutionSummary);
const executionId = '123';
renderComponent({