* ⚡ Removing authentication parameter from NDV * ⚡ Added auth type selector to credentials modal * 🔨 Extracting reusable logic to util functions * ⚡ Updating credentials position, adding label for radio buttons * ⚡ Using first node credentials for nodes with single auth options and hiding auth selector UI in that case * ⚡ Fixing credentials modal when opened from credentials page * ⚡ Showing all available credentials in NDV credentials dropdown * ⚡ Updating node credentials dropdown component to show credentials description. Disabling `Credentials of type not found` error in node * ⚡ Moving auth related fields from NDV to credentials modal. Added support for multiple auth fileds * ⚡ Moving NDV fields that authentication depends on to credentials modal * ⚡ Keeping old auth/credentials UI in NDV for HTTP Request and Webhook nodes. Pre-populating credential type for HTTP request node when selected from 'app action' menu * 💄 Use old label and field position for nodes that use old credentials UI in NDV * ⚡ Implementing more generic way to find node's auth fileds * 📚 Adding comments on parameter hiding logic * ⚡ Fixing node auth options logic for multiple auth fields * 👕 Fixing lint errors * 💄 Addressing design review comments * ⚡ Not selecting first auth option when opening new credential dialog * ⚡ Using default credentials name and icon if authentication type is not selected * ⚡ Updating credential data when auth type is changed * ⚡ Setting new credentials type for HTTP Request and Webhook nodes * ⚡ Setting nodes with access when changing auth type * 👕 Fixing lint error * ⚡ Updating active node auth type from credentials modal * ⚡ Syncronizing credentials modal and dropdown * 👕 Fixing linter error * ⚡ Handling credential dropdown UI for multiple credentials * 👕 Removing unused imports * ⚡ Handling auth selection when default auth type is the first option * ⚡ Updating credentials change listening logic * ⚡ Resetting credential data when deleting a credential, disabling 'Details' and 'Sharing' tabs if auth type is not selected * 🐛 Skipping credentials type check when showing mixed credentials in the dropdown and switching credentials type * ⚡ Showing credential modal tabs for saved credentials * ⚡ Preventing renaming credentials when no auth type is selected * 🐛 Fixing credentials modal when opened from credentials page * ⚡ Keeping auth radio buttons selected when switching tabs * ✅ Adding initial batch of credentials NDV tests * ⚡ Updating node auth filed value when new credential type is selected * ⚡ Using all available credential types for current node to sync credential dropdown with modal * ⚡ Sorting mixed credentials by date, simplifying credential dropdown option logic * 🔨 Extracting some reusable logic to utils * ⚡ Improving required vs optional credentials detection and using it to show auth radio buttons * 👕 Fixing lint errors * ✅ Adding more credentials tests * ⚡ Filtering credential options based on authentication type * 🔨 Refactoring credentials and auth utils * ⚡ Updated handling of auth options in credentials modal to work with new logic * 🔨 Getting the terminology in line * 📚 Removing leftover comment * ⚡ Updating node auth filed detection logic to account for different edge-cases * ⚡ Adding Wait node as an exception for new UI * ⚡ Updating NDV display when auth type changes * ⚡ Updating default credentials name when auth type changes * ⚡ Hiding auth settings after credentials are saved * ⚡ Always showing credentials modal menu tabs * ⚡ Improving main auth field detection logic so it doesn't account for authentication fields which can have `none` value * ⚡ Restoring accidentally deleted not existing credential issue logic * ⚡ Updating other nodes when deleted credentials have been updated * ⚡ Using filtered auth type list to show or hide radio buttons section in credentials modal * 👕 Addressing lint error * 👌 Addressing PR review feedback * 👕 Fixing lint issues * ⚡ Updating main auth filed detection logic so it checks full dependency path to determine if the field is required or optional * 👌 Addressing the rest of PR feedback * ✅ Updating credential tests * ⚡ Resetting credential data on authentication type change * ⚡ Created AuthTypeSelector component * 👌 Addressing PR comments * ⚡ Not resetting overwritten credential properties when changing auth type * ⚡ Hiding auth selector section if there are no options to show
169 lines
3.8 KiB
Vue
169 lines
3.8 KiB
Vue
<template>
|
|
<div :class="$style.container">
|
|
<n8n-action-toggle
|
|
v-if="shouldShowOptions"
|
|
placement="bottom-end"
|
|
size="small"
|
|
color="foreground-xdark"
|
|
iconSize="small"
|
|
:actions="actions"
|
|
@action="(action) => $emit('optionSelected', action)"
|
|
@visible-change="onMenuToggle"
|
|
/>
|
|
<n8n-radio-buttons
|
|
v-if="parameter.noDataExpression !== true && showExpressionSelector"
|
|
size="small"
|
|
:value="selectedView"
|
|
:disabled="isReadOnly"
|
|
@input="onViewSelected"
|
|
:options="[
|
|
{ label: $locale.baseText('parameterInput.fixed'), value: 'fixed' },
|
|
{ label: $locale.baseText('parameterInput.expression'), value: 'expression' },
|
|
]"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { NodeParameterValueType } from 'n8n-workflow';
|
|
import Vue, { PropType } from 'vue';
|
|
import { isValueExpression, isResourceLocatorValue } from '@/utils';
|
|
import { useNDVStore } from '@/stores/ndv';
|
|
import { mapStores } from 'pinia';
|
|
import { HTML_NODE_TYPE } from '@/constants';
|
|
|
|
export default Vue.extend({
|
|
name: 'parameter-options',
|
|
props: {
|
|
parameter: {
|
|
type: Object,
|
|
},
|
|
isReadOnly: {
|
|
type: Boolean,
|
|
},
|
|
value: {
|
|
type: [Object, String, Number, Boolean, Array] as PropType<NodeParameterValueType>,
|
|
},
|
|
showOptions: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
showExpressionSelector: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
},
|
|
computed: {
|
|
...mapStores(useNDVStore),
|
|
isDefault(): boolean {
|
|
return this.parameter.default === this.value;
|
|
},
|
|
isValueExpression(): boolean {
|
|
return isValueExpression(this.parameter, this.value);
|
|
},
|
|
shouldShowOptions(): boolean {
|
|
if (this.isReadOnly === true) {
|
|
return false;
|
|
}
|
|
|
|
if (this.parameter.type === 'collection' || this.parameter.type === 'credentialsSelect') {
|
|
return false;
|
|
}
|
|
|
|
if (
|
|
this.parameter.typeOptions &&
|
|
this.parameter.typeOptions.editor &&
|
|
this.parameter.typeOptions.editor === 'codeNodeEditor'
|
|
) {
|
|
return false;
|
|
}
|
|
|
|
if (this.showOptions === true) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
},
|
|
selectedView() {
|
|
if (this.isValueExpression) {
|
|
return 'expression';
|
|
}
|
|
|
|
return 'fixed';
|
|
},
|
|
hasRemoteMethod(): boolean {
|
|
return !!this.getArgument('loadOptionsMethod') || !!this.getArgument('loadOptions');
|
|
},
|
|
actions(): Array<{ label: string; value: string; disabled?: boolean }> {
|
|
if (
|
|
this.ndvStore.activeNode?.type === HTML_NODE_TYPE &&
|
|
this.ndvStore.activeNode?.parameters.operation === 'generateHtmlTemplate'
|
|
) {
|
|
return [
|
|
{
|
|
label: 'Format HTML',
|
|
value: 'formatHtml',
|
|
},
|
|
];
|
|
}
|
|
|
|
const actions = [
|
|
{
|
|
label: this.$locale.baseText('parameterInput.resetValue'),
|
|
value: 'resetValue',
|
|
disabled: this.isDefault,
|
|
},
|
|
];
|
|
|
|
if (
|
|
this.hasRemoteMethod ||
|
|
(this.parameter.type === 'resourceLocator' &&
|
|
isResourceLocatorValue(this.value) &&
|
|
this.value.mode === 'list')
|
|
) {
|
|
return [
|
|
{
|
|
label: this.$locale.baseText('parameterInput.refreshList'),
|
|
value: 'refreshOptions',
|
|
},
|
|
...actions,
|
|
];
|
|
}
|
|
|
|
return actions;
|
|
},
|
|
},
|
|
methods: {
|
|
onMenuToggle(visible: boolean) {
|
|
this.$emit('menu-expanded', visible);
|
|
},
|
|
onViewSelected(selected: string) {
|
|
if (selected === 'expression') {
|
|
this.$emit('optionSelected', this.isValueExpression ? 'openExpression' : 'addExpression');
|
|
}
|
|
|
|
if (selected === 'fixed' && this.isValueExpression) {
|
|
this.$emit('optionSelected', 'removeExpression');
|
|
}
|
|
},
|
|
getArgument(argumentName: string): string | number | boolean | undefined {
|
|
if (this.parameter.typeOptions === undefined) {
|
|
return undefined;
|
|
}
|
|
|
|
if (this.parameter.typeOptions[argumentName] === undefined) {
|
|
return undefined;
|
|
}
|
|
|
|
return this.parameter.typeOptions[argumentName];
|
|
},
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.container {
|
|
display: flex;
|
|
}
|
|
</style>
|