From 46b6a9c75df66c50fc53a8530e24be001dc2f48a Mon Sep 17 00:00:00 2001 From: Kazuki-Nakanishi Date: Wed, 22 Mar 2017 23:52:33 +0900 Subject: [PATCH] Add a use case. Fix the URL of settings API. --- Design:-Node-settings.md | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Design:-Node-settings.md b/Design:-Node-settings.md index f6a6104..d27f122 100644 --- a/Design:-Node-settings.md +++ b/Design:-Node-settings.md @@ -1,6 +1,6 @@ /settings API returns only the following built-in fields by default. -http://nodered.jp/docs/api/admin/methods/get/settings/ +http://nodered.org/docs/api/admin/methods/get/settings/ A node can add their own settings to be output with the above settings API. @@ -47,3 +47,43 @@ The node settings in settings.js are not shown in the following cases. * The setting is not defined in any node. * A node setting sets false to exportable. * A node is disabled. + +## Use Cases +### Change node color +Currently, node color is fixed in each node. Using node settings, user can change a node color as they like. + +1. Add settings object to registerType definition in nodes/core/io/21-httprequest.js as follows. +``` + RED.nodes.registerType("http request",HTTPRequest,{ + credentials: { + user: {type:"text"}, + password: {type: "password"} + }, + settings: { + httpRequestColor: { + value: "rgb(231, 231, 174)", + exportable: true + } + } + }); +``` + +2. Change registerType definition in nodes/core/io/21-httprequest.html as follows. +``` +