fix(editor): Fix type errors in components/executions/workflow (#9448)

This commit is contained in:
Milorad FIlipović 2024-05-17 15:14:59 +02:00 committed by GitHub
parent 003a4ea620
commit 9c768a0443
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 42 additions and 24 deletions

View file

@ -12,7 +12,7 @@
<router-link <router-link
:class="$style.executionLink" :class="$style.executionLink"
:to="{ :to="{
name: VIEWS.EXECUTION_PREVIEW, name: executionPreviewViewName,
params: { name: currentWorkflow, executionId: execution.id }, params: { name: currentWorkflow, executionId: execution.id },
}" }"
:data-test-execution-status="executionUIDetails.name" :data-test-execution-status="executionUIDetails.name"
@ -115,7 +115,6 @@ export default defineComponent({
return { return {
executionHelpers, executionHelpers,
VIEWS,
}; };
}, },
computed: { computed: {
@ -144,6 +143,9 @@ export default defineComponent({
isRetriable(): boolean { isRetriable(): boolean {
return this.executionHelpers.isExecutionRetriable(this.execution); return this.executionHelpers.isExecutionRetriable(this.execution);
}, },
executionPreviewViewName() {
return VIEWS.EXECUTION_PREVIEW;
},
}, },
methods: { methods: {
onRetryMenuItemSelect(action: string): void { onRetryMenuItemSelect(action: string): void {

View file

@ -84,17 +84,6 @@ export default defineComponent({
} as IWorkflowSaveSettings, } as IWorkflowSaveSettings,
}; };
}, },
watch: {
workflowSettings(newSettings: IWorkflowSettings) {
this.updateSettings(newSettings);
},
},
mounted() {
this.defaultValues.saveFailedExecutions = this.settingsStore.saveDataErrorExecution;
this.defaultValues.saveSuccessfulExecutions = this.settingsStore.saveDataSuccessExecution;
this.defaultValues.saveManualExecutions = this.settingsStore.saveManualExecutions;
this.updateSettings(this.workflowSettings);
},
computed: { computed: {
...mapStores(useRootStore, useSettingsStore, useUIStore, useWorkflowsStore), ...mapStores(useRootStore, useSettingsStore, useUIStore, useWorkflowsStore),
accordionItems(): object[] { accordionItems(): object[] {
@ -182,6 +171,17 @@ export default defineComponent({
return this.workflowsStore.workflowTags; return this.workflowsStore.workflowTags;
}, },
}, },
watch: {
workflowSettings(newSettings: IWorkflowSettings) {
this.updateSettings(newSettings);
},
},
mounted() {
this.defaultValues.saveFailedExecutions = this.settingsStore.saveDataErrorExecution;
this.defaultValues.saveSuccessfulExecutions = this.settingsStore.saveDataSuccessExecution;
this.defaultValues.saveManualExecutions = this.settingsStore.saveManualExecutions;
this.updateSettings(this.workflowSettings);
},
methods: { methods: {
updateSettings(workflowSettings: IWorkflowSettings): void { updateSettings(workflowSettings: IWorkflowSettings): void {
this.workflowSaveSettings.saveFailedExecutions = this.workflowSaveSettings.saveFailedExecutions =
@ -209,15 +209,19 @@ export default defineComponent({
this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY); this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY);
} }
}, },
openWorkflowSettings(event: MouseEvent): void { openWorkflowSettings(): void {
this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY); this.uiStore.openModal(WORKFLOW_SETTINGS_MODAL_KEY);
}, },
async onSaveWorkflowClick(event: MouseEvent): void { async onSaveWorkflowClick(): Promise<void> {
let currentId = undefined; let currentId: string | undefined = undefined;
if (this.currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID) { if (this.currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID) {
currentId = this.currentWorkflowId; currentId = this.currentWorkflowId;
} else if (this.$route.params.name && this.$route.params.name !== 'new') { } else if (this.$route.params.name && this.$route.params.name !== 'new') {
currentId = this.$route.params.name; const routeName = this.$route.params.name;
currentId = Array.isArray(routeName) ? routeName[0] : routeName;
}
if (!currentId) {
return;
} }
const saved = await this.workflowHelpers.saveCurrentWorkflow({ const saved = await this.workflowHelpers.saveCurrentWorkflow({
id: currentId, id: currentId,

View file

@ -45,7 +45,7 @@ export default defineComponent({
}, },
}, },
methods: { methods: {
onSetupFirstStep(event: MouseEvent): void { onSetupFirstStep(): void {
this.uiStore.addFirstStepOnLoad = true; this.uiStore.addFirstStepOnLoad = true;
const workflowRoute = this.getWorkflowRoute(); const workflowRoute = this.getWorkflowRoute();
void this.$router.push(workflowRoute); void this.$router.push(workflowRoute);

View file

@ -129,7 +129,7 @@ export default defineComponent({
setup() { setup() {
const externalHooks = useExternalHooks(); const externalHooks = useExternalHooks();
const router = useRouter(); const router = useRouter();
const workflowHelpers = useWorkflowHelpers(router); const workflowHelpers = useWorkflowHelpers({ router });
const { callDebounced } = useDebounce(); const { callDebounced } = useDebounce();
return { return {

View file

@ -10,7 +10,7 @@
{{ $locale.baseText('executionsList.stopExecution') }} {{ $locale.baseText('executionsList.stopExecution') }}
</n8n-button> </n8n-button>
</div> </div>
<div v-else :class="$style.previewContainer"> <div v-else-if="executionUIDetails" :class="$style.previewContainer">
<div <div
v-if="execution" v-if="execution"
:class="$style.executionDetails" :class="$style.executionDetails"
@ -67,7 +67,7 @@
<router-link <router-link
:class="$style.executionLink" :class="$style.executionLink"
:to="{ :to="{
name: VIEWS.EXECUTION_PREVIEW, name: executionPreviewViewName,
params: { params: {
workflowId: execution.workflowId, workflowId: execution.workflowId,
executionId: execution.retryOf, executionId: execution.retryOf,
@ -82,7 +82,7 @@
<n8n-button size="medium" :type="debugButtonData.type" :class="$style.debugLink"> <n8n-button size="medium" :type="debugButtonData.type" :class="$style.debugLink">
<router-link <router-link
:to="{ :to="{
name: VIEWS.EXECUTION_DEBUG, name: executionDebugViewName,
params: { params: {
name: execution.workflowId, name: execution.workflowId,
executionId: execution.id, executionId: execution.id,
@ -173,7 +173,6 @@ export default defineComponent({
const executionHelpers = useExecutionHelpers(); const executionHelpers = useExecutionHelpers();
return { return {
VIEWS,
executionHelpers, executionHelpers,
...useMessage(), ...useMessage(),
...useExecutionDebugging(), ...useExecutionDebugging(),
@ -204,6 +203,12 @@ export default defineComponent({
isRetriable(): boolean { isRetriable(): boolean {
return !!this.execution && this.executionHelpers.isExecutionRetriable(this.execution); return !!this.execution && this.executionHelpers.isExecutionRetriable(this.execution);
}, },
executionDebugViewName() {
return VIEWS.EXECUTION_DEBUG;
},
executionPreviewViewName() {
return VIEWS.EXECUTION_PREVIEW;
},
}, },
methods: { methods: {
async onDeleteExecution(): Promise<void> { async onDeleteExecution(): Promise<void> {

View file

@ -106,9 +106,16 @@ export default defineComponent({
default: null, default: null,
}, },
}, },
emits: {
retryExecution: null,
loadMore: null,
refresh: null,
filterUpdated: null,
reloadExecutions: null,
'update:autoRefresh': null,
},
data() { data() {
return { return {
VIEWS,
filter: {} as ExecutionFilterType, filter: {} as ExecutionFilterType,
}; };
}, },