refactor(editor): Fix remaining FE type check errors (no-changelog) (#9607)

Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
Ricardo Espinoza
2024-06-10 09:23:06 -04:00
committed by GitHub
parent 1e15f73b0d
commit 22bdb0568e
84 changed files with 438 additions and 318 deletions

View File

@@ -176,12 +176,14 @@ import ParameterInputList from '@/components/ParameterInputList.vue';
import type { IMenuItem, INodeUi, IUpdateInformation } from '@/Interface';
import type {
IDataObject,
INodeCredentials,
NodeParameterValue,
MessageEventBusDestinationOptions,
INodeParameters,
NodeParameterValueType,
} from 'n8n-workflow';
import {
deepCopy,
messageEventBusDestinationTypeNames,
defaultMessageEventBusDestinationOptions,
defaultMessageEventBusDestinationWebhookOptions,
MessageEventBusDestinationTypeNames,
@@ -246,7 +248,7 @@ export default defineComponent({
showRemoveConfirm: false,
typeSelectValue: '',
typeSelectPlaceholder: 'Destination Type',
nodeParameters: deepCopy(defaultMessageEventBusDestinationOptions),
nodeParameters: deepCopy(defaultMessageEventBusDestinationOptions) as INodeParameters,
webhookDescription: webhookModalDescription,
sentryDescription: sentryModalDescription,
syslogDescription: syslogModalDescription,
@@ -261,7 +263,7 @@ export default defineComponent({
...mapStores(useUIStore, useLogStreamingStore, useNDVStore, useWorkflowsStore),
typeSelectOptions(): Array<{ value: string; label: BaseTextKey }> {
const options: Array<{ value: string; label: BaseTextKey }> = [];
for (const t of Object.values(MessageEventBusDestinationTypeNames)) {
for (const t of messageEventBusDestinationTypeNames) {
if (t === MessageEventBusDestinationTypeNames.abstract) {
continue;
}
@@ -325,7 +327,8 @@ export default defineComponent({
if (arg.name === this.destination.id) {
if ('credentials' in arg.properties) {
this.unchanged = false;
this.nodeParameters.credentials = arg.properties.credentials as INodeCredentials;
this.nodeParameters.credentials = arg.properties
.credentials as NodeParameterValueType;
}
}
}
@@ -350,7 +353,7 @@ export default defineComponent({
this.workflowsStore.removeNode(this.node);
this.ndvStore.activeNodeName = options.id ?? 'thisshouldnothappen';
this.workflowsStore.addNode(destinationToFakeINodeUi(options));
this.nodeParameters = options;
this.nodeParameters = options as INodeParameters;
this.logStreamingStore.items[this.destination.id].destination = options;
},
onTypeSelectInput(destinationType: MessageEventBusDestinationTypeNames) {
@@ -448,7 +451,7 @@ export default defineComponent({
if (deleteConfirmed !== MODAL_CONFIRM) {
return;
} else {
this.eventBus.emit('remove', this.destination.id);
this.callEventBus('remove', this.destination.id);
this.uiStore.closeModal(LOG_STREAM_MODAL_KEY);
this.uiStore.stateIsDirty = false;
}
@@ -456,10 +459,12 @@ export default defineComponent({
onModalClose() {
if (!this.hasOnceBeenSaved) {
this.workflowsStore.removeNode(this.node);
this.logStreamingStore.removeDestination(this.nodeParameters.id!);
if (this.nodeParameters.id) {
this.logStreamingStore.removeDestination(this.nodeParameters.id.toString());
}
}
this.ndvStore.activeNodeName = null;
this.eventBus.emit('closing', this.destination.id);
this.callEventBus('closing', this.destination.id);
this.uiStore.stateIsDirty = false;
},
async saveDestination() {
@@ -471,10 +476,12 @@ export default defineComponent({
this.hasOnceBeenSaved = true;
this.testMessageSent = false;
this.unchanged = true;
this.eventBus.emit('destinationWasSaved', this.destination.id);
this.callEventBus('destinationWasSaved', this.destination.id);
this.uiStore.stateIsDirty = false;
const destinationType = (this.nodeParameters.__type ?? 'unknown')
const destinationType = (
this.nodeParameters.__type ? `${this.nodeParameters.__type}` : 'unknown'
)
.replace('$$MessageEventBusDestination', '')
.toLowerCase();
@@ -503,6 +510,11 @@ export default defineComponent({
});
}
},
callEventBus(event: string, data: unknown) {
if (this.eventBus) {
this.eventBus.emit(event, data);
}
},
},
});
</script>