feat(Airtable Node): Overhaul (#6200)

This commit is contained in:
Michael Kret
2023-07-17 19:42:30 +03:00
committed by GitHub
parent fc8ed55c0d
commit b69d20c12e
42 changed files with 3989 additions and 871 deletions

View File

@@ -51,7 +51,16 @@ const emit = defineEmits<{
const ndvStore = useNDVStore();
const fieldsUi = computed<INodeProperties[]>(() => {
function markAsReadOnly(field: ResourceMapperField): boolean {
if (
isMatchingField(field.id, props.paramValue.matchingColumns, props.showMatchingColumnsSelector)
) {
return false;
}
return field.readOnly || false;
}
const fieldsUi = computed<Array<Partial<INodeProperties> & { readOnly?: boolean }>>(() => {
return props.fieldsToMap
.filter((field) => field.display !== false && field.removed !== true)
.map((field) => {
@@ -64,11 +73,12 @@ const fieldsUi = computed<INodeProperties[]>(() => {
required: field.required,
description: getFieldDescription(field),
options: field.options,
readOnly: markAsReadOnly(field),
};
});
});
const orderedFields = computed<INodeProperties[]>(() => {
const orderedFields = computed<Array<Partial<INodeProperties> & { readOnly?: boolean }>>(() => {
// Sort so that matching columns are first
if (props.paramValue.matchingColumns) {
fieldsUi.value.forEach((field, i) => {
@@ -333,7 +343,7 @@ defineExpose({
:value="getParameterValue(field.name)"
:displayOptions="true"
:path="`${props.path}.${field.name}`"
:isReadOnly="refreshInProgress"
:isReadOnly="refreshInProgress || field.readOnly"
:hideIssues="true"
:nodeValues="nodeValues"
:class="$style.parameterInputFull"

View File

@@ -48,7 +48,7 @@ const emit = defineEmits<{
const availableMatchingFields = computed<ResourceMapperField[]>(() => {
return props.fieldsToMap.filter((field) => {
return field.canBeUsedToMatch !== false && field.display !== false;
return (field.canBeUsedToMatch || field.defaultMatch) && field.display !== false;
});
});

View File

@@ -167,7 +167,9 @@ const hasAvailableMatchingColumns = computed<boolean>(() => {
return (
state.paramValue.schema.filter(
(field) =>
field.canBeUsedToMatch !== false && field.display !== false && field.removed !== true,
(field.canBeUsedToMatch || field.defaultMatch) &&
field.display !== false &&
field.removed !== true,
).length > 0
);
}
@@ -178,7 +180,7 @@ const defaultSelectedMatchingColumns = computed<string[]>(() => {
return state.paramValue.schema.length === 1
? [state.paramValue.schema[0].id]
: state.paramValue.schema.reduce((acc, field) => {
if (field.defaultMatch && field.canBeUsedToMatch === true) {
if (field.defaultMatch) {
acc.push(field.id);
}
return acc;