refactor(editor): Fix typescript issues in composables and misc files (no-changelog) (#9583)

This commit is contained in:
Elias Meire
2024-06-03 11:34:51 +02:00
committed by GitHub
parent 7be616e583
commit 6268276746
19 changed files with 90 additions and 58 deletions

View File

@@ -35,7 +35,7 @@
active-color="#13ce66"
inactive-color="#8899AA"
data-test-id="workflow-activate-switch"
@update:model-value="onEnabledSwitched($event, destination.id)"
@update:model-value="onEnabledSwitched($event)"
>
</el-switch>
@@ -128,17 +128,19 @@ export default defineComponent({
}
},
async onClick(event: Event) {
const cardActions = this.$refs.cardActions as HTMLDivElement | null;
const target = event.target as HTMLDivElement | null;
if (
this.$refs.cardActions === event.target ||
this.$refs.cardActions?.contains(event.target) ||
event.target?.contains(this.$refs.cardActions)
cardActions === target ||
cardActions?.contains(target) ||
target?.contains(cardActions)
) {
return;
}
this.$emit('edit', this.destination.id);
},
onEnabledSwitched(state: boolean, destinationId: string) {
onEnabledSwitched(state: boolean) {
this.nodeParameters.enabled = state;
void this.saveDestination();
},

View File

@@ -69,7 +69,7 @@
</template>
<script lang="ts">
import { ElCheckbox as Checkbox } from 'element-plus';
import { ElCheckbox as Checkbox, type CheckboxValueType } from 'element-plus';
import { mapStores } from 'pinia';
import type { BaseTextKey } from '@/plugins/i18n';
import { useLogStreamingStore } from '@/stores/logStreaming.store';
@@ -101,12 +101,13 @@ export default {
onInput() {
this.$emit('input');
},
onCheckboxChecked(eventName: string, checked: boolean) {
this.logStreamingStore.setSelectedInGroup(this.destinationId, eventName, checked);
onCheckboxChecked(eventName: string, checked: CheckboxValueType) {
this.logStreamingStore.setSelectedInGroup(this.destinationId, eventName, Boolean(checked));
this.$forceUpdate();
},
anonymizeAuditMessagesChanged(value: boolean) {
this.logStreamingStore.items[this.destinationId].destination.anonymizeAuditMessages = value;
anonymizeAuditMessagesChanged(value: CheckboxValueType) {
this.logStreamingStore.items[this.destinationId].destination.anonymizeAuditMessages =
Boolean(value);
this.$emit('change', { name: 'anonymizeAuditMessages', node: this.destinationId, value });
this.$forceUpdate();
},

View File

@@ -431,11 +431,11 @@ export default defineComponent({
: `$('${escapeMappingString(nodeName)}').item.binary`;
const binaryData = [];
let binaryPropertyData = [];
let binaryPropertyData: IVariableSelectorOption[] = [];
for (const dataPropertyName of Object.keys(outputData.binary!)) {
for (const dataPropertyName of Object.keys(outputData.binary ?? {})) {
binaryPropertyData = [];
for (const propertyName in outputData.binary![dataPropertyName]) {
for (const propertyName in outputData.binary?.[dataPropertyName]) {
if (propertyName === 'data') {
continue;
}
@@ -448,7 +448,7 @@ export default defineComponent({
binaryPropertyData.push({
name: propertyName,
key: `${binaryPropertyPrefix}.${dataPropertyName}.${propertyName}`,
value: outputData.binary![dataPropertyName][propertyName],
value: outputData.binary?.[dataPropertyName][propertyName]?.toString(),
});
}

View File

@@ -144,7 +144,7 @@ function focusFirstInput() {
required
validate-on-blur
:validation-rules="keyValidationRules"
@validate="(value) => onValidate('key', value)"
@validate="(value: boolean) => onValidate('key', value)"
/>
</div>
</td>
@@ -161,7 +161,7 @@ function focusFirstInput() {
:placeholder="i18n.baseText('variables.editing.value.placeholder')"
validate-on-blur
:validation-rules="valueValidationRules"
@validate="(value) => onValidate('value', value)"
@validate="(value: boolean) => onValidate('value', value)"
/>
</div>
</td>

View File

@@ -228,7 +228,8 @@ export default defineComponent({
setTimeout(() => {
this.scrollToLatestMessage();
this.$refs.inputField?.focus();
const inputField = this.$refs.inputField as HTMLInputElement | null;
inputField?.focus();
}, 0);
},
methods: {
@@ -513,10 +514,13 @@ export default defineComponent({
const lastNodeExecuted =
this.workflowsStore.getWorkflowExecution?.data?.resultData.lastNodeExecuted;
const nodeResponseDataArray = get(
this.workflowsStore.getWorkflowExecution?.data?.resultData.runData,
lastNodeExecuted,
) as ITaskData[];
if (!lastNodeExecuted) return;
const nodeResponseDataArray =
get(
this.workflowsStore.getWorkflowExecution?.data?.resultData.runData,
lastNodeExecuted,
) ?? [];
const nodeResponseData = nodeResponseDataArray[nodeResponseDataArray.length - 1];