refactor(editor): restrict mapping discoverability tooltip showing only on string input (#4496)

* refactor(editor): restrict mapping discoverability tooltip showing only on string input

* refactor(editor): renaming computed prop because not only string inputs can be mapped, but we want to show tooltips only on string inputs

* fix(editor): removing unused prop from ParameterInputWrapper.vue

* fix(editor): reorganizing and updating props in ParameterInputFull.vue

* fix(editor): proper typings for node related translations

* fix(editor): fix typings for input localisation functions

* fix(editor): simplifying localisation functions

* Revert "fix(editor): simplifying localisation functions"

This reverts commit 3d93ccf0cf4f62b07c49871825f4a518766ca470.

* fix(editor): move nullish coalescing into called function
This commit is contained in:
Csaba Tuncsik
2022-11-03 13:04:53 +01:00
committed by GitHub
parent d944a3884c
commit 78c024b247
4 changed files with 65 additions and 51 deletions

View File

@@ -1,7 +1,7 @@
<template>
<n8n-input-label
:label="hideLabel? '': $locale.nodeText().inputLabelDisplayName(parameter, path)"
:tooltipText="hideLabel? '': $locale.nodeText().inputLabelDescription(parameter, path)"
:label="hideLabel ? '': $locale.nodeText().inputLabelDisplayName(parameter, path)"
:tooltipText="hideLabel ? '': $locale.nodeText().inputLabelDescription(parameter, path)"
:showTooltip="focused"
:showOptions="menuExpanded || focused || forceShowExpression"
:bold="false"
@@ -59,7 +59,7 @@
</template>
<script lang="ts">
import Vue from 'vue';
import Vue, { PropType } from 'vue';
import {
IN8nButton,
@@ -68,15 +68,15 @@ import {
IUpdateInformation,
} from '@/Interface';
import ParameterOptions from './ParameterOptions.vue';
import ParameterOptions from '@/components/ParameterOptions.vue';
import DraggableTarget from '@/components/DraggableTarget.vue';
import mixins from 'vue-typed-mixins';
import { showMessage } from './mixins/showMessage';
import { showMessage } from '@/components/mixins/showMessage';
import { LOCAL_STORAGE_MAPPING_FLAG } from '@/constants';
import { hasExpressionMapping } from './helpers';
import ParameterInputWrapper from './ParameterInputWrapper.vue';
import { hasOnlyListMode } from './ResourceLocator/helpers';
import { INodePropertyMode } from 'n8n-workflow';
import { hasExpressionMapping } from '@/components/helpers';
import ParameterInputWrapper from '@/components/ParameterInputWrapper.vue';
import { hasOnlyListMode } from '@/components/ResourceLocator/helpers';
import { INodeParameters, INodeProperties, INodePropertyMode } from 'n8n-workflow';
import { isResourceLocatorValue } from '@/typeGuards';
import { BaseTextKey } from "@/plugins/i18n";
@@ -98,14 +98,29 @@ export default mixins(
dataMappingTooltipButtons: [] as IN8nButton[],
};
},
props: [
'displayOptions',
'isReadOnly',
'parameter',
'path',
'value',
'hideLabel',
],
props: {
displayOptions: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false,
},
hideLabel: {
type: Boolean,
default: false,
},
parameter: {
type: Object as PropType<INodeProperties>,
},
path: {
type: String,
},
value: {
type: [Number, String, Boolean, Array, Object] as PropType<INodeParameters>,
},
},
created() {
const mappingTooltipDismissHandler = this.onMappingTooltipDismissed.bind(this);
this.dataMappingTooltipButtons = [
@@ -126,6 +141,9 @@ export default mixins(
hint (): string | null {
return this.$locale.nodeText().hint(this.parameter, this.path);
},
isInputTypeString (): boolean {
return this.parameter.type === 'string';
},
isResourceLocator (): boolean {
return this.parameter.type === 'resourceLocator';
},
@@ -142,7 +160,7 @@ export default mixins(
return this.$store.getters['ndv/inputPanelDisplayMode'];
},
showMappingTooltip (): boolean {
return this.focused && !this.isInputDataEmpty && window.localStorage.getItem(LOCAL_STORAGE_MAPPING_FLAG) !== 'true';
return this.focused && this.isInputTypeString && !this.isInputDataEmpty && window.localStorage.getItem(LOCAL_STORAGE_MAPPING_FLAG) !== 'true';
},
},
methods: {