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

Allow a node to declare what settings should be made available to the editor. #1185

Merged
merged 2 commits into from Mar 8, 2017
Merged

Allow a node to declare what settings should be made available to the editor. #1185

merged 2 commits into from Mar 8, 2017

Conversation

Kazuki-Nakanishi
Copy link
Member

Implement register/exportNodeSettings.
This implementation is the enhancement derived from the trello note below.
https://trello.com/c/jmFK6hAb/87-allow-a-node-to-declare-what-settings-should-be-made-available-to-the-editor

For example, change registerType of the core node "21-httprequest.js" to as follows.

    RED.nodes.registerType("http request",HTTPRequest,{
        credentials: {
            user: {type:"text"},
            password: {type: "password"}
        },
        settings: {
            httpRequestColour: {
                value: "red",
                exportable: true
            }
        }
    });

Then access to http://localhost:1880/settings, and you'll see the node setting.

@coveralls
Copy link

coveralls commented Mar 7, 2017

Coverage Status

Coverage decreased (-3.5%) to 84.211% when pulling 22b4ac6 on Kazuki-Nakanishi:nodeSettings into fca77a8 on node-red:nodeSettings.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-3.5%) to 84.211% when pulling 22b4ac6 on Kazuki-Nakanishi:nodeSettings into fca77a8 on node-red:nodeSettings.

@@ -328,6 +328,11 @@ function evaluateNodeProperty(value, type, node, msg) {
return value;
}

function normaliseRegisterTypeName(name) {
Copy link
Member

Choose a reason for hiding this comment

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

I suggest the function should be callednormaliseNodeTypeName.

The current approach to remove characters is a good start, but I think it should honour camel-case: 'http-request' should become 'httpRequest', not 'httprequest' as it would with the current implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you very much for pointing it out. I fixed both of them and push the code.

@coveralls
Copy link

coveralls commented Mar 8, 2017

Coverage Status

Coverage decreased (-3.4%) to 84.243% when pulling 4b16f5f on Kazuki-Nakanishi:nodeSettings into fca77a8 on node-red:nodeSettings.

@knolleary knolleary merged commit 34089ae into node-red:nodeSettings Mar 8, 2017
@Kazuki-Nakanishi Kazuki-Nakanishi deleted the nodeSettings branch March 8, 2017 15:05
dschrecking pushed a commit to SEDARI/neros that referenced this pull request Aug 11, 2017
… editor. (node-red#1185)

* Implement register/exportNodeSettings.

* Change normaliseRegisterTypeName to normaliseNodeTypeName. Force it to name in a camel case.
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

Successfully merging this pull request may close these issues.

None yet

3 participants