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

Example how to use config node missing #4

Closed
Weinschenk opened this issue Jun 7, 2021 · 3 comments
Closed

Example how to use config node missing #4

Weinschenk opened this issue Jun 7, 2021 · 3 comments

Comments

@Weinschenk
Copy link

I tried to add a config node to node generated by the templates, but I stuck with the defaults in the index.ts

I got a config-node 'my-config' with two parameters, 'name' and 'vendor', and a regular node my-node.
I added the two parameters to 'my-config/shared/types.ts' like this:
export interface MyConfigOptions { name: string vendor : string }

In the 'my-node/shared/types.ts' I added the 'MyConfigOptions' like this:

... export interface MyNodeOptions { operation: TransformTextOperation, connection: MyConfigOptions; }

So far so good (and hopefully right). Now I want to make it editable in the my-node.html section. Therefore I tried to add to the 'index.ts', in the defaults section an entry with the according type:

... defaults: { operation: { value: TransformTextOperation.UpperCase }, connection: { value: "", type:"my-config"}, name: { value: "" }, }, ...

But value: "" is not correct of course, as is does not contain the name and vendor. I tried to add an according document ( {'name': '', 'vendor': ''} ) and also a new MyNodeOptions (), but both don't work as it request an extension to a node...

Could you please help me out and add an example how to use a config node in combination with a node...

Regards and thanks,
Thomas

@alexk111
Copy link

alexk111 bot commented Jun 7, 2021

👉 Donate ฿   ⚡ Make this issue a priority   💝 Support my open source work

@smashah
Copy link

smashah commented Jun 8, 2021

@Weinschenk hi, I recently used this great template project to build a node-red integration for another one of my projects. I also used config nodes for my integration:

https://github.com/open-wa/node-red-contrib-wa-automate

https://github.com/open-wa/node-red-contrib-wa-automate/tree/master/src/nodes/owa-server

The issue I had with the templated config nodes generated by this project is that there is a typo in the template which results in config node details instantly disappearing.

Check out my PR on how to fix this issue: #3

thanks @alexk111

@Weinschenk
Copy link
Author

@smashah thank you very much. This helped me out, to find the issue. It was, that my node stored the config object instead of the name as String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants