Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(editor): Migrate FixedCollectionParameter to composition API #11555

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ShireenMissi
Copy link
Contributor

@ShireenMissi ShireenMissi commented Nov 5, 2024

Summary

This PR migrates FixedCollectionParameter to composition API

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Nov 5, 2024
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 154 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...tor-ui/src/components/FixedCollectionParameter.vue 0.00% 154 Missing ⚠️

📢 Thoughts on this report? Let us know!

this.mutableValues = deepCopy(this.values);
const locale = useI18n();

const props = defineProps<{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use withDefaults here to set the same default values as before. Just to be sure the component behaves exactly the same as before.

parameter: INodeProperties;
path: string;
values: Record<string, INodeParameters[]>;
isReadOnly: boolean | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

values and isReadOnly should be optional (they don't have required=true in defineComponent)

return !!props.parameter.typeOptions?.multipleValues;
});
const parameterOptions = computed(() => {
if (multipleValues && isINodePropertyCollectionList(props.parameter.options)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multipleValues.value

}>();

const emit = defineEmits<{
valueChanged: [value?: any];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify a type for value. From usage I think it should be something like

type ValueChangedEvent = { path: string; value: NodeParameterValueType; type?: 'optionsOrderChanged'; }

} else {
newValue = newParameterValue;
}
let newValue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible set a type for newValue, maybe NodeParameterValueType

newValue = newParameterValue;
}
let newValue;
if (multipleValues) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multipleValues.value

return props.parameter.options;
}

return (props.parameter.options as INodePropertyCollection[]).filter((option) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this type cast is avoidable by doing props.parameter.options ?? [], would be safer too 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants