2021-09-11 01:15:36 -07:00
|
|
|
<template>
|
|
|
|
<n8n-input-label
|
|
|
|
:label="parameter.displayName"
|
|
|
|
:tooltipText="parameter.description"
|
|
|
|
:required="parameter.required"
|
2021-10-27 12:55:37 -07:00
|
|
|
:showTooltip="focused"
|
2021-09-11 01:15:36 -07:00
|
|
|
>
|
|
|
|
<parameter-input
|
|
|
|
:parameter="parameter"
|
|
|
|
:value="value"
|
|
|
|
:path="parameter.name"
|
|
|
|
:hideIssues="true"
|
|
|
|
:displayOptions="true"
|
|
|
|
:documentationUrl="documentationUrl"
|
|
|
|
:errorHighlight="showRequiredErrors"
|
2021-10-27 12:55:37 -07:00
|
|
|
@focus="onFocus"
|
2021-09-11 01:15:36 -07:00
|
|
|
@blur="onBlur"
|
|
|
|
@textInput="valueChanged"
|
|
|
|
@valueChanged="valueChanged"
|
|
|
|
inputSize="large"
|
|
|
|
/>
|
|
|
|
<div class="errors" v-if="showRequiredErrors">
|
2021-10-18 20:57:49 -07:00
|
|
|
This field is required. <a v-if="documentationUrl" :href="documentationUrl" target="_blank" @click="onDocumentationUrlClick">Open docs</a>
|
2021-09-11 01:15:36 -07:00
|
|
|
</div>
|
|
|
|
</n8n-input-label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { IUpdateInformation } from '@/Interface';
|
|
|
|
import ParameterInput from './ParameterInput.vue';
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'ParameterInputExpanded',
|
|
|
|
components: {
|
|
|
|
ParameterInput,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
parameter: {
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
},
|
|
|
|
showValidationWarnings: {
|
|
|
|
type: Boolean,
|
|
|
|
},
|
|
|
|
documentationUrl: {
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-10-27 12:55:37 -07:00
|
|
|
focused: false,
|
|
|
|
blurredEver: false,
|
2021-09-11 01:15:36 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
showRequiredErrors(): boolean {
|
2021-10-09 11:42:30 -07:00
|
|
|
if (!this.$props.parameter.required) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-27 12:55:37 -07:00
|
|
|
if (this.blurredEver || this.showValidationWarnings) {
|
2021-10-09 11:42:30 -07:00
|
|
|
if (this.$props.parameter.type === 'string') {
|
|
|
|
return !this.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.$props.parameter.type === 'number') {
|
|
|
|
return typeof this.value !== 'number';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2021-09-11 01:15:36 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2021-10-27 12:55:37 -07:00
|
|
|
onFocus() {
|
|
|
|
this.focused = true;
|
|
|
|
},
|
2021-09-11 01:15:36 -07:00
|
|
|
onBlur() {
|
2021-10-27 12:55:37 -07:00
|
|
|
this.blurredEver = true;
|
|
|
|
this.focused = false;
|
2021-09-11 01:15:36 -07:00
|
|
|
},
|
|
|
|
valueChanged(parameterData: IUpdateInformation) {
|
|
|
|
this.$emit('change', parameterData);
|
|
|
|
},
|
2021-10-18 20:57:49 -07:00
|
|
|
onDocumentationUrlClick (): void {
|
|
|
|
this.$telemetry.track('User clicked credential modal docs link', {
|
|
|
|
docs_link: this.documentationUrl,
|
|
|
|
source: 'field',
|
|
|
|
workflow_id: this.$store.getters.workflowId,
|
|
|
|
});
|
|
|
|
},
|
2021-09-11 01:15:36 -07:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|