refactor(editor): Fix eslint errors in Node.vue (no-changelog) (#9628)

This commit is contained in:
Tomi Turtiainen 2024-06-05 18:04:09 +03:00 committed by GitHub
parent 9dbea7393a
commit 0ac86ac76b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,7 +178,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { type CSSProperties, defineComponent } from 'vue';
import { mapStores } from 'pinia'; import { mapStores } from 'pinia';
import xss from 'xss'; import xss from 'xss';
import { useStorage } from '@/composables/useStorage'; import { useStorage } from '@/composables/useStorage';
@ -245,6 +245,12 @@ export default defineComponent({
default: false, default: false,
}, },
}, },
emits: {
run: null,
runWorkflow: null,
removeNode: null,
toggleDisableNode: null,
},
setup(props) { setup(props) {
const workflowsStore = useWorkflowsStore(); const workflowsStore = useWorkflowsStore();
const contextMenu = useContextMenu(); const contextMenu = useContextMenu();
@ -296,7 +302,9 @@ export default defineComponent({
return undefined; return undefined;
}, },
nodeRunData(): ITaskData[] { nodeRunData(): ITaskData[] {
return this.workflowsStore.getWorkflowResultDataByNodeName(this.data?.name || '') || []; if (!this.data) return [];
return this.workflowsStore.getWorkflowResultDataByNodeName(this.data.name) ?? [];
}, },
hasIssues(): boolean { hasIssues(): boolean {
if (this.nodeExecutionStatus && ['crashed', 'error'].includes(this.nodeExecutionStatus)) if (this.nodeExecutionStatus && ['crashed', 'error'].includes(this.nodeExecutionStatus))
@ -324,7 +332,7 @@ export default defineComponent({
const { eventTriggerDescription } = this.nodeType; const { eventTriggerDescription } = this.nodeType;
return this.$locale return this.$locale
.nodeText() .nodeText()
.eventTriggerDescription(nodeName, eventTriggerDescription || ''); .eventTriggerDescription(nodeName, eventTriggerDescription ?? '');
} else { } else {
return this.$locale.baseText('node.waitingForYouToCreateAnEventIn', { return this.$locale.baseText('node.waitingForYouToCreateAnEventIn', {
interpolate: { interpolate: {
@ -365,7 +373,7 @@ export default defineComponent({
); );
}, },
isTriggerNode(): boolean { isTriggerNode(): boolean {
return this.nodeTypesStore.isTriggerNode(this.data?.type || ''); return this.data ? this.nodeTypesStore.isTriggerNode(this.data.type) : false;
}, },
isTriggerNodeTooltipEmpty(): boolean { isTriggerNodeTooltipEmpty(): boolean {
return this.nodeType !== null ? this.nodeType.eventTriggerDescription === '' : false; return this.nodeType !== null ? this.nodeType.eventTriggerDescription === '' : false;
@ -406,9 +414,7 @@ export default defineComponent({
return classes; return classes;
}, },
nodeWrapperStyles() { nodeWrapperStyles() {
const styles: { const styles: CSSProperties = {
[key: string]: string | number;
} = {
left: this.position[0] + 'px', left: this.position[0] + 'px',
top: this.position[1] + 'px', top: this.position[1] + 'px',
}; };
@ -556,7 +562,7 @@ export default defineComponent({
returnStyles['border-width'] = '2px'; returnStyles['border-width'] = '2px';
returnStyles['border-style'] = 'solid'; returnStyles['border-style'] = 'solid';
} }
} else if (this.waiting || this.showPinnedDataInfo) { } else if (!!this.waiting || this.showPinnedDataInfo) {
borderColor = '--color-canvas-node-pinned-border'; borderColor = '--color-canvas-node-pinned-border';
} else if (this.nodeExecutionStatus === 'unknown') { } else if (this.nodeExecutionStatus === 'unknown') {
borderColor = '--color-foreground-xdark'; borderColor = '--color-foreground-xdark';
@ -675,7 +681,7 @@ export default defineComponent({
if (this.nodeRunData) { if (this.nodeRunData) {
setTimeout(() => { setTimeout(() => {
this.$emit('run', { this.$emit('run', {
name: this.data && this.data.name, name: this.data?.name,
data: this.nodeRunData, data: this.nodeRunData,
waiting: !!this.waiting, waiting: !!this.waiting,
}); });