Merge branch 'dev' into tooltip-input-validation
|
@ -32,7 +32,7 @@ jobs:
|
|||
node-version: '16'
|
||||
- run: node ./node-red/.github/scripts/update-node-red-docker.js
|
||||
- name: Create Docker Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.NR_REPO_TOKEN }}
|
||||
committer: GitHub <noreply@github.com>
|
||||
|
@ -48,7 +48,7 @@ jobs:
|
|||
This PR was auto-generated by a GitHub Action. Any questions, speak to @knolleary
|
||||
- run: node ./node-red/.github/scripts/update-node-red-website.js
|
||||
- name: Create Website Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.NR_REPO_TOKEN }}
|
||||
committer: GitHub <noreply@github.com>
|
||||
|
|
|
@ -12,12 +12,11 @@ permissions:
|
|||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
checks: write # for coverallsapp/github-action to create new checks
|
||||
contents: read # for actions/checkout to fetch code
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16, 18, 20]
|
||||
node-version: [18, 20, 22]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
|
@ -29,8 +28,3 @@ jobs:
|
|||
- name: Run tests
|
||||
run: |
|
||||
npm run test
|
||||
# - name: Publish to coveralls.io
|
||||
# if: ${{ matrix.node-version == 16 }}
|
||||
# uses: coverallsapp/github-action@v1.1.2
|
||||
# with:
|
||||
# github-token: ${{ github.token }}
|
||||
|
|
170
CHANGELOG.md
|
@ -1,3 +1,173 @@
|
|||
#### 4.0.0-beta.3: Beta Release
|
||||
|
||||
Editor
|
||||
|
||||
- Improve background-deploy notification handling (#4692) @knolleary
|
||||
- Hide workspace tab on middle mouse click (#4657) @Steve-Mcl
|
||||
- multiplayer: Add user presence indicators (#4666) @knolleary
|
||||
- Enable updating dependency node of package.json in project feature (#4676) @kazuhitoyokoi
|
||||
- Add French translations for 4.0.0-beta.2 (#4681) @GogoVega
|
||||
- Add Japanese translations for 4.0.0-beta.2 (#4674) @kazuhitoyokoi
|
||||
- Fix saving of conf-type properties in module packaged subflows (#4658) @knolleary
|
||||
- Add npm install timeout notification (#4662) @hardillb
|
||||
- Fix undo of subflow env property edits (#4667) @knolleary
|
||||
- Fix three error typos in monaco.js (#4660) @JoshuaCWebDeveloper
|
||||
- docs: Add closing paragraph tag (#4664) @ZJvandeWeg
|
||||
- Avoid login loops when autoLogin enabled but login fails (#4684) @knolleary
|
||||
|
||||
Runtime
|
||||
|
||||
- Allow blank strings to be used for env var property substitutions (#4672) @knolleary
|
||||
- Use rfdc for cloning pure JSON values (#4679) @knolleary
|
||||
- fix: remove outdated Node 11+ check (#4314) @Rotzbua
|
||||
- feat(ci): add new nodejs v22 (#4694) @Rotzbua
|
||||
- fix(node): increase required node >=18.5 (#4690) @Rotzbua
|
||||
- fix(dns): remove outdated node check (#4689) @Rotzbua
|
||||
- fix(polyfill): remove import module polyfill (#4688) @Rotzbua
|
||||
- Fix typo (#4686) @Rotzbua
|
||||
|
||||
Nodes
|
||||
|
||||
- Pass full error object in Function node and copy over cause property (#4685) @knolleary
|
||||
- Replacing vm.createScript in favour of vm.Script (#4534) @patlux
|
||||
|
||||
#### 4.0.0-beta.2: Beta Release
|
||||
|
||||
Editor
|
||||
|
||||
- Introduce multiplayer feature (#4629) @knolleary
|
||||
- Separate the "add new config-node" option into a new (+) button (#4627) @GogoVega
|
||||
- Retain Palette categories collapsed and filter to localStorage (#4634) @knolleary
|
||||
- Ensure palette filter reapplies and clear up unknown categories (#4637) @knolleary
|
||||
- Add support for plugin (only) modules to the palette manager (#4620) @knolleary
|
||||
- Update monaco to latest and node types to 18 LTS (#4615) @Steve-Mcl
|
||||
|
||||
Runtime
|
||||
|
||||
- Fix handling of subflow config-node select type in sf module (#4643) @knolleary
|
||||
- Comms API updates (#4628) @knolleary
|
||||
- Add French translations for 4.0.0-beta.1 (#4621) @GogoVega
|
||||
- Add Japanese translations for 4.0.0-beta.1 (#4612) @kazuhitoyokoi
|
||||
|
||||
Nodes
|
||||
- Fix change node handling of replacing with boolean (#4639) @knolleary
|
||||
|
||||
#### 4.0.0-beta.1: Beta Release
|
||||
|
||||
Editor
|
||||
|
||||
- Click on id in debug panel highlights node or flow (#4439) @ralphwetzel
|
||||
- Support config selection in a subflow env var (#4587) @Steve-Mcl
|
||||
- Add timestamp formatting options to TypedInput (#4468) @knolleary
|
||||
- Allow RED.view.select to select links (#4553) @lgrkvst
|
||||
- Add auto-complete to flow/global/env typedInput types (#4480) @knolleary
|
||||
- Improve the appearance of the Node-RED primary header (#4598) @joepavitt
|
||||
|
||||
Runtime
|
||||
|
||||
- let settings.httpNodeAuth accept single middleware or array of middlewares (#4572) @kevinGodell
|
||||
- Upgrade to JSONata 2.x (#4590) @knolleary
|
||||
- Bump minimum version to node 18 (#4571) @knolleary
|
||||
- npm: Remove production flag on npm invocation (#4347) @ZJvandeWeg
|
||||
- Timer testing fix (#4367) @hlovdal
|
||||
- Bump to 4.0.0-dev (#4322) @knolleary
|
||||
|
||||
Nodes
|
||||
|
||||
- TCP node - when resetting, if no payload, stay disconnected @dceejay
|
||||
- HTML node: add option for collecting attributes and content (#4513) @gorenje
|
||||
- let split node specify property to split on, and join auto join correctly (#4386) @dceejay
|
||||
- Add RFC4180 compliant mode to CSV node (#4540) @Steve-Mcl
|
||||
- Fix change node to return boolean if asked (#4525) @dceejay
|
||||
- Let msg.reset reset Tcp request node connection when in stay connected mode (#4406) @dceejay
|
||||
- Let debug node status msg length be settable via settings (#4402) @dceejay
|
||||
- Feat: Add ability to set headers for WebSocket client (#4436) @marcus-j-davies
|
||||
|
||||
#### 3.1.9: Maintenance Release
|
||||
|
||||
- Prevent subflow being added to itself (#4654) @knolleary
|
||||
- Fix use of spawn on windows with cmd files (#4652) @knolleary
|
||||
- Guard refresh of unknown subflow (#4640) @knolleary
|
||||
- Fix subflow module sending messages to debug sidebar (#4642) @knolleary
|
||||
|
||||
#### 3.1.8: Maintenance Release
|
||||
|
||||
- Add validation and error handling on subflow instance properties (#4632) @knolleary
|
||||
- Hide import/export context menu if disabled in theme (#4633) @knolleary
|
||||
- Show change indicator on subflow tabs (#4631) @knolleary
|
||||
- Bump dependencies (#4630) @knolleary
|
||||
- Reset workspace index when clearing nodes (#4619) @knolleary
|
||||
- Remove typo in global config (#4613) @kazuhitoyokoi
|
||||
|
||||
#### 3.1.7: Maintenance Release
|
||||
|
||||
- Add Japanese translation for v3.1.6 (#4603) @kazuhitoyokoi
|
||||
- Update jsonata version (#4593) @hardillb
|
||||
|
||||
#### 3.1.6: Maintenance Release
|
||||
|
||||
Editor
|
||||
|
||||
- Do not flag env var in num typedInput as error (#4582) @knolleary
|
||||
- Fix example flow name in import dialog (#4578) @kazuhitoyokoi
|
||||
- Fix missing node icons in workspace (#4570) @knolleary
|
||||
|
||||
Runtime
|
||||
|
||||
- Handle undefined env vars (#4581) @knolleary
|
||||
- fix: Removed offending MD5 crypto hash and replaced with SHA1 and SHA256 … (#4568) @JaysonHurst
|
||||
- chore: remove never use import code (#4580) @giscafer
|
||||
|
||||
Nodes
|
||||
|
||||
- fix: template node zh-CN translation (#4575) @giscafer
|
||||
|
||||
#### 3.1.5: Maintenance Release
|
||||
|
||||
Runtime
|
||||
|
||||
- Fix require of dns module (#4562) @knolleary
|
||||
- Ensure global creds object is initialised when adding first cred (#4561) @knolleary
|
||||
|
||||
#### 3.1.4: Maintenance Release
|
||||
|
||||
Editor
|
||||
|
||||
- Highlight errors in config node sidebar (#4529) @knolleary
|
||||
- Improve feedback in import dialog to show conflicted nodes (#4550) @knolleary
|
||||
- Modify node users info in config editor footer (#4528) @knolleary
|
||||
- Handle modified-nodes deploy after replacing unknown config node (#4556) @knolleary
|
||||
- Handle undefined default export when importing module (#4539) @knolleary
|
||||
- Fix icon scaling for non .svg icons (#4491) @ralphwetzel
|
||||
- (convertNode) Do not create the credentials object if there is nothing to export (#4544) @GogoVega
|
||||
- Ensure subflow instance node has g property set (#4538) @knolleary
|
||||
- Handle importing flow with existing subflow and instance node (#4546) @knolleary
|
||||
- Update index.mst (#4483) @gorenje
|
||||
- Include top level property name when copying path from context (#4527) @knolleary
|
||||
- Add handling to disable items on context menu (#4500) @kazuhitoyokoi
|
||||
- Focus Quick Add dialog from context menu (#4516) @kazuhitoyokoi
|
||||
- Fix subflow ports in Quick Add dialog (#4518) @kazuhitoyokoi
|
||||
- Fix location of subflow ports in palette (#4502) @kazuhitoyokoi
|
||||
- Client/Editor Events: fix off-in-on pattern emulating once (#4484) @gorenje
|
||||
- Restore caching busting functionality without using explict version number (#4512) @knolleary
|
||||
- Do not translate the list of available languages (#4531) @GogoVega
|
||||
- Add French translation of v3.1.3 changes (#4477) @GogoVega
|
||||
- i18n(es-ES) Spanish Spain translation (#4495) @joebordes
|
||||
- Add missing validation messages (#4487) @GogoVega
|
||||
- Add Japanese translations for v3.1.3 (#4498) @kazuhitoyokoi
|
||||
- Replace `rename` by `edit` for the menu flow label (#4506) @GogoVega
|
||||
- Update editor.json fix typo in German translation (#4552) @guidoffm
|
||||
|
||||
Runtime
|
||||
|
||||
- Bump the github-actions group with 1 update (#4554) @app/dependabot
|
||||
- Clone objects types when getting env values (#4519) @knolleary
|
||||
- Ensure global-config credential env vars are merged on deploy (#4526) @knolleary
|
||||
|
||||
Nodes
|
||||
|
||||
- 21-httprequest.js remove unused code, because of broken use of toLowercase (#4522) @gorenje
|
||||
|
||||
#### 3.1.3: Maintenance Release
|
||||
|
||||
Editor
|
||||
|
|
|
@ -143,6 +143,7 @@ module.exports = function(grunt) {
|
|||
"packages/node_modules/@node-red/editor-client/src/js/user.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/comms.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/runtime.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/multiplayer.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/text/bidi.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/text/format.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/state.js",
|
||||
|
|
15
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-red",
|
||||
"version": "4.0.0-dev",
|
||||
"version": "4.0.0-beta.3-1",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "https://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -41,7 +41,7 @@
|
|||
"cors": "2.8.5",
|
||||
"cronosjs": "1.7.1",
|
||||
"denque": "2.1.0",
|
||||
"express": "4.18.2",
|
||||
"express": "4.19.2",
|
||||
"express-session": "1.17.3",
|
||||
"form-data": "4.0.0",
|
||||
"fs-extra": "11.1.1",
|
||||
|
@ -54,7 +54,7 @@
|
|||
"is-utf8": "0.2.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonata": "1.8.6",
|
||||
"jsonata": "2.0.4",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"media-typer": "1.1.0",
|
||||
"memorystore": "1.6.7",
|
||||
|
@ -64,7 +64,7 @@
|
|||
"mqtt": "4.3.7",
|
||||
"multer": "1.4.5-lts.1",
|
||||
"mustache": "4.2.0",
|
||||
"node-red-admin": "^3.1.1",
|
||||
"node-red-admin": "^3.1.3",
|
||||
"node-watch": "0.7.4",
|
||||
"nopt": "5.0.0",
|
||||
"oauth2orize": "1.11.1",
|
||||
|
@ -73,8 +73,9 @@
|
|||
"passport-http-bearer": "1.0.1",
|
||||
"passport-oauth2-client-password": "0.1.2",
|
||||
"raw-body": "2.5.2",
|
||||
"rfdc": "^1.3.1",
|
||||
"semver": "7.5.4",
|
||||
"tar": "6.1.13",
|
||||
"tar": "6.2.1",
|
||||
"tough-cookie": "4.1.3",
|
||||
"uglify-js": "3.17.4",
|
||||
"uuid": "9.0.0",
|
||||
|
@ -112,7 +113,7 @@
|
|||
"mermaid": "^10.4.0",
|
||||
"minami": "1.2.3",
|
||||
"mocha": "9.2.2",
|
||||
"node-red-node-test-helper": "^0.3.2",
|
||||
"node-red-node-test-helper": "^0.3.3",
|
||||
"nodemon": "2.0.20",
|
||||
"proxy": "^1.0.2",
|
||||
"sass": "1.62.1",
|
||||
|
@ -122,6 +123,6 @@
|
|||
"supertest": "6.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
"node": ">=18.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ module.exports = {
|
|||
store: req.query['store'],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
if (req.query['keysOnly'] !== undefined) {
|
||||
opts.keysOnly = true
|
||||
}
|
||||
runtimeAPI.context.getValue(opts).then(function(result) {
|
||||
res.json(result);
|
||||
}).catch(function(err) {
|
||||
|
|
|
@ -91,6 +91,7 @@ module.exports = {
|
|||
// Plugins
|
||||
adminApp.get("/plugins", needsPermission("plugins.read"), plugins.getAll, apiUtil.errorHandler);
|
||||
adminApp.get("/plugins/messages", needsPermission("plugins.read"), plugins.getCatalogs, apiUtil.errorHandler);
|
||||
adminApp.get(/^\/plugins\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,needsPermission("plugins.read"),plugins.getConfig,apiUtil.errorHandler);
|
||||
|
||||
adminApp.get("/diagnostics", needsPermission("diagnostics.read"), diagnostics.getReport, apiUtil.errorHandler);
|
||||
|
||||
|
|
|
@ -40,5 +40,31 @@ module.exports = {
|
|||
console.log(err.stack);
|
||||
apiUtils.rejectHandler(req,res,err);
|
||||
})
|
||||
},
|
||||
getConfig: function(req, res) {
|
||||
|
||||
let opts = {
|
||||
user: req.user,
|
||||
module: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
|
||||
if (req.get("accept") === "application/json") {
|
||||
runtimeAPI.nodes.getNodeInfo(opts.module).then(function(result) {
|
||||
res.send(result);
|
||||
}).catch(function(err) {
|
||||
apiUtils.rejectHandler(req,res,err);
|
||||
})
|
||||
} else {
|
||||
opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
|
||||
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
|
||||
opts.lang = "en-US";
|
||||
}
|
||||
runtimeAPI.plugins.getPluginConfig(opts).then(function(result) {
|
||||
return res.send(result);
|
||||
}).catch(function(err) {
|
||||
apiUtils.rejectHandler(req,res,err);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var apiUtils = require("../util");
|
||||
var runtimeAPI;
|
||||
var settings;
|
||||
var theme = require("../editor/theme");
|
||||
|
|
|
@ -205,9 +205,10 @@ function genericStrategy(adminApp,strategy) {
|
|||
passport.use(new strategy.strategy(options, verify));
|
||||
|
||||
adminApp.get('/auth/strategy',
|
||||
passport.authenticate(strategy.name, {session:false,
|
||||
passport.authenticate(strategy.name, {
|
||||
session:false,
|
||||
failureMessage: true,
|
||||
failureRedirect: settings.httpAdminRoot
|
||||
failureRedirect: settings.httpAdminRoot + '?session_message=Login Failed'
|
||||
}),
|
||||
completeGenerateStrategyAuth,
|
||||
handleStrategyError
|
||||
|
@ -221,7 +222,7 @@ function genericStrategy(adminApp,strategy) {
|
|||
passport.authenticate(strategy.name, {
|
||||
session:false,
|
||||
failureMessage: true,
|
||||
failureRedirect: settings.httpAdminRoot
|
||||
failureRedirect: settings.httpAdminRoot + '?session_message=Login Failed'
|
||||
}),
|
||||
completeGenerateStrategyAuth,
|
||||
handleStrategyError
|
||||
|
|
|
@ -18,7 +18,6 @@ var BearerStrategy = require('passport-http-bearer').Strategy;
|
|||
var ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy;
|
||||
|
||||
var passport = require("passport");
|
||||
var crypto = require("crypto");
|
||||
var util = require("util");
|
||||
|
||||
var Tokens = require("./tokens");
|
||||
|
|
|
@ -77,6 +77,53 @@ function CommsConnection(ws, user) {
|
|||
log.trace("comms.close "+self.session);
|
||||
removeActiveConnection(self);
|
||||
});
|
||||
|
||||
const handleAuthPacket = function(msg) {
|
||||
Tokens.get(msg.auth).then(function(client) {
|
||||
if (client) {
|
||||
Users.get(client.user).then(function(user) {
|
||||
if (user) {
|
||||
self.user = user;
|
||||
log.audit({event: "comms.auth",user:self.user});
|
||||
completeConnection(msg, client.scope,msg.auth,true);
|
||||
} else {
|
||||
log.audit({event: "comms.auth.fail"});
|
||||
completeConnection(msg, null,null,false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Users.tokens(msg.auth).then(function(user) {
|
||||
if (user) {
|
||||
self.user = user;
|
||||
log.audit({event: "comms.auth",user:self.user});
|
||||
completeConnection(msg, user.permissions,msg.auth,true);
|
||||
} else {
|
||||
log.audit({event: "comms.auth.fail"});
|
||||
completeConnection(msg, null,null,false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
const completeConnection = function(msg, userScope, session, sendAck) {
|
||||
try {
|
||||
if (!userScope || !Permissions.hasPermission(userScope,"status.read")) {
|
||||
ws.send(JSON.stringify({auth:"fail"}));
|
||||
ws.close();
|
||||
} else {
|
||||
pendingAuth = false;
|
||||
addActiveConnection(self);
|
||||
self.token = msg.auth;
|
||||
if (sendAck) {
|
||||
ws.send(JSON.stringify({auth:"ok"}));
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
console.log(err.stack);
|
||||
// Just in case the socket closes before we attempt
|
||||
// to send anything.
|
||||
}
|
||||
}
|
||||
ws.on('message', function(data,flags) {
|
||||
var msg = null;
|
||||
try {
|
||||
|
@ -86,68 +133,34 @@ function CommsConnection(ws, user) {
|
|||
return;
|
||||
}
|
||||
if (!pendingAuth) {
|
||||
if (msg.subscribe) {
|
||||
if (msg.auth) {
|
||||
handleAuthPacket(msg)
|
||||
} else if (msg.subscribe) {
|
||||
self.subscribe(msg.subscribe);
|
||||
// handleRemoteSubscription(ws,msg.subscribe);
|
||||
} else if (msg.topic) {
|
||||
runtimeAPI.comms.receive({
|
||||
user: self.user,
|
||||
client: self,
|
||||
topic: msg.topic,
|
||||
data: msg.data
|
||||
})
|
||||
}
|
||||
} else {
|
||||
var completeConnection = function(userScope,session,sendAck) {
|
||||
try {
|
||||
if (!userScope || !Permissions.hasPermission(userScope,"status.read")) {
|
||||
ws.send(JSON.stringify({auth:"fail"}));
|
||||
ws.close();
|
||||
} else {
|
||||
pendingAuth = false;
|
||||
addActiveConnection(self);
|
||||
self.token = msg.auth;
|
||||
if (sendAck) {
|
||||
ws.send(JSON.stringify({auth:"ok"}));
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
console.log(err.stack);
|
||||
// Just in case the socket closes before we attempt
|
||||
// to send anything.
|
||||
}
|
||||
}
|
||||
if (msg.auth) {
|
||||
Tokens.get(msg.auth).then(function(client) {
|
||||
if (client) {
|
||||
Users.get(client.user).then(function(user) {
|
||||
if (user) {
|
||||
self.user = user;
|
||||
log.audit({event: "comms.auth",user:self.user});
|
||||
completeConnection(client.scope,msg.auth,true);
|
||||
} else {
|
||||
log.audit({event: "comms.auth.fail"});
|
||||
completeConnection(null,null,false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Users.tokens(msg.auth).then(function(user) {
|
||||
if (user) {
|
||||
self.user = user;
|
||||
log.audit({event: "comms.auth",user:self.user});
|
||||
completeConnection(user.permissions,msg.auth,true);
|
||||
} else {
|
||||
log.audit({event: "comms.auth.fail"});
|
||||
completeConnection(null,null,false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
handleAuthPacket(msg)
|
||||
} else {
|
||||
if (anonymousUser) {
|
||||
log.audit({event: "comms.auth",user:anonymousUser});
|
||||
self.user = anonymousUser;
|
||||
completeConnection(anonymousUser.permissions,null,false);
|
||||
completeConnection(msg, anonymousUser.permissions, null, false);
|
||||
//TODO: duplicated code - pull non-auth message handling out
|
||||
if (msg.subscribe) {
|
||||
self.subscribe(msg.subscribe);
|
||||
}
|
||||
} else {
|
||||
log.audit({event: "comms.auth.fail"});
|
||||
completeConnection(null,null,false);
|
||||
completeConnection(msg, null,null,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,9 @@
|
|||
* limitations under the License.
|
||||
**/
|
||||
|
||||
var express = require("express");
|
||||
var path = require('path');
|
||||
|
||||
var comms = require("./comms");
|
||||
var library = require("./library");
|
||||
var info = require("./settings");
|
||||
|
||||
var auth = require("../auth");
|
||||
|
@ -51,7 +49,7 @@ module.exports = {
|
|||
|
||||
var ui = require("./ui");
|
||||
|
||||
ui.init(runtimeAPI);
|
||||
ui.init(settings, runtimeAPI);
|
||||
|
||||
const editorApp = apiUtil.createExpressApp(settings)
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
**/
|
||||
|
||||
var apiUtils = require("../util");
|
||||
var fs = require('fs');
|
||||
var fspath = require('path');
|
||||
|
||||
var runtimeAPI;
|
||||
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
// var apiUtil = require('../util');
|
||||
|
||||
var i18n = require("@node-red/util").i18n; // TODO: separate module
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
**/
|
||||
|
||||
var apiUtils = require("../util");
|
||||
var express = require("express");
|
||||
var runtimeAPI;
|
||||
var settings;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* limitations under the License.
|
||||
**/
|
||||
|
||||
var express = require("express");
|
||||
var util = require("util");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
|
@ -234,6 +233,10 @@ module.exports = {
|
|||
themeSettings.projects = theme.projects;
|
||||
}
|
||||
|
||||
if (theme.hasOwnProperty("multiplayer")) {
|
||||
themeSettings.multiplayer = theme.multiplayer;
|
||||
}
|
||||
|
||||
if (theme.hasOwnProperty("keymap")) {
|
||||
themeSettings.keymap = theme.keymap;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
const crypto = require('crypto')
|
||||
var express = require('express');
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
@ -24,13 +25,16 @@ var apiUtils = require("../util");
|
|||
var theme = require("./theme");
|
||||
|
||||
var runtimeAPI;
|
||||
let settings;
|
||||
var editorClientDir = path.dirname(require.resolve("@node-red/editor-client"));
|
||||
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.svg");
|
||||
var editorTemplatePath = path.join(editorClientDir,"templates","index.mst");
|
||||
var editorTemplate;
|
||||
let cacheBuster
|
||||
|
||||
module.exports = {
|
||||
init: function(_runtimeAPI) {
|
||||
init: function(_settings, _runtimeAPI) {
|
||||
settings = _settings;
|
||||
runtimeAPI = _runtimeAPI;
|
||||
editorTemplate = fs.readFileSync(editorTemplatePath,"utf8");
|
||||
Mustache.parse(editorTemplate);
|
||||
|
@ -91,6 +95,12 @@ module.exports = {
|
|||
},
|
||||
|
||||
editor: async function(req,res) {
|
||||
if (!cacheBuster) {
|
||||
// settings.instanceId is set asynchronously to the editor-api
|
||||
// being initiaised. So we defer calculating the cacheBuster hash
|
||||
// until the first load of the editor
|
||||
cacheBuster = crypto.createHash('sha1').update(`${settings.version || 'version'}-${settings.instanceId || 'instanceId'}`).digest("hex").substring(0,12)
|
||||
}
|
||||
|
||||
let sessionMessages;
|
||||
if (req.session && req.session.messages) {
|
||||
|
@ -99,6 +109,7 @@ module.exports = {
|
|||
}
|
||||
res.send(Mustache.render(editorTemplate,{
|
||||
sessionMessages,
|
||||
cacheBuster,
|
||||
...await theme.context()
|
||||
}));
|
||||
},
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
* @namespace @node-red/editor-api
|
||||
*/
|
||||
|
||||
var express = require("express");
|
||||
var bodyParser = require("body-parser");
|
||||
var util = require('util');
|
||||
var passport = require('passport');
|
||||
var cors = require('cors');
|
||||
|
||||
var auth = require("./auth");
|
||||
var apiUtil = require("./util");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@node-red/editor-api",
|
||||
"version": "4.0.0-dev",
|
||||
"version": "4.0.0-beta.3-1",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
|
@ -16,14 +16,14 @@
|
|||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "4.0.0-dev",
|
||||
"@node-red/editor-client": "4.0.0-dev",
|
||||
"@node-red/util": "4.0.0-beta.3-1",
|
||||
"@node-red/editor-client": "4.0.0-beta.3-1",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.20.2",
|
||||
"clone": "2.1.2",
|
||||
"cors": "2.8.5",
|
||||
"express-session": "1.17.3",
|
||||
"express": "4.18.2",
|
||||
"express": "4.19.2",
|
||||
"memorystore": "1.6.7",
|
||||
"mime": "3.0.0",
|
||||
"multer": "1.4.5-lts.1",
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
"selectionToSubflow": "Auswahl in Subflow umwandeln",
|
||||
"flows": "Flow",
|
||||
"add": "Hinzufügen",
|
||||
"rename": "Umbenennen",
|
||||
"delete": "Löschen",
|
||||
"keyboardShortcuts": "Tastenkürzel",
|
||||
"login": "Anmelden",
|
||||
|
@ -591,6 +590,8 @@
|
|||
},
|
||||
"nodeCount": "__label__ Node",
|
||||
"nodeCount_plural": "__label__ Nodes",
|
||||
"pluginCount": "__count__ Plugin",
|
||||
"pluginCount_plural": "__count__ Plugins",
|
||||
"moduleCount": "__count__ Modul verfügbar",
|
||||
"moduleCount_plural": "__count__ Module verfügbar",
|
||||
"inuse": "In Gebrauch",
|
||||
|
@ -1076,7 +1077,7 @@
|
|||
"git-auth-error": "Git-Authentifizierungsfehler"
|
||||
},
|
||||
"create-success": {
|
||||
"success": "Sie haben Ihr erstes Projekt erfolgreich erstduellt!",
|
||||
"success": "Sie haben Ihr erstes Projekt erfolgreich erstellt!",
|
||||
"desc0": "Sie können jetzt Node-RED wie bisher verwenden.",
|
||||
"desc1": "Im Tab 'Info' in der Seitenleiste wird angezeigt, welches das aktuelle Projekt ist. Über die Schaltfläche rechts neben dem Projektnamen gelangt man zu 'Projekteinstellungen'.",
|
||||
"desc2": "Im Tab 'Commit-Historie' in der Seitenleiste werden alle Dateien angezeigt, die sich in Ihrem Projekt geändert haben, und um sie ins lokale Repository zu übertragen (commit). Es zeigt Ihnen eine vollständige Historie Ihrer Commits an und ermöglicht es Ihnen, Ihre Commits in ein (remote) Server-Repository zu schieben (push)."
|
||||
|
@ -1172,17 +1173,6 @@
|
|||
"diagnostics": {
|
||||
"title": "System-Informationen"
|
||||
},
|
||||
"languages": {
|
||||
"de": "Deutsch",
|
||||
"en-US": "Englisch",
|
||||
"fr": "Französisch",
|
||||
"ja": "Japanisch",
|
||||
"ko": "Koreanisch",
|
||||
"pt-BR":"Portugiesisch",
|
||||
"ru": "Russisch",
|
||||
"zh-CN": "Chinesisch (Vereinfacht)",
|
||||
"zh-TW": "Chinesisch (Traditionell)"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "Ungültige JSON-Daten: __error__",
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
"selectionToSubflow": "Selection to Subflow",
|
||||
"flows": "Flows",
|
||||
"add": "Add",
|
||||
"rename": "Rename",
|
||||
"delete": "Delete",
|
||||
"keyboardShortcuts": "Keyboard shortcuts",
|
||||
"login": "Login",
|
||||
|
@ -304,7 +303,8 @@
|
|||
"missingType": "Input not a valid flow - item __index__ missing 'type' property"
|
||||
},
|
||||
"conflictNotification1": "Some of the nodes you are importing already exist in your workspace.",
|
||||
"conflictNotification2": "Select which nodes to import and whether to replace the existing nodes, or to import a copy of them."
|
||||
"conflictNotification2": "Select which nodes to import and whether to replace the existing nodes, or to import a copy of them.",
|
||||
"alreadyExists": "This node already exists"
|
||||
},
|
||||
"copyMessagePath": "Path copied",
|
||||
"copyMessageValue": "Value copied",
|
||||
|
@ -372,6 +372,7 @@
|
|||
"deleted": "deleted",
|
||||
"flowDeleted": "flow deleted",
|
||||
"flowAdded": "flow added",
|
||||
"moved": "moved",
|
||||
"movedTo": "moved to __id__",
|
||||
"movedFrom": "moved from __id__"
|
||||
},
|
||||
|
@ -614,6 +615,8 @@
|
|||
},
|
||||
"nodeCount": "__label__ node",
|
||||
"nodeCount_plural": "__label__ nodes",
|
||||
"pluginCount": "__count__ plugin",
|
||||
"pluginCount_plural": "__count__ plugins",
|
||||
"moduleCount": "__count__ module available",
|
||||
"moduleCount_plural": "__count__ modules available",
|
||||
"inuse": "in use",
|
||||
|
@ -641,6 +644,7 @@
|
|||
"errors": {
|
||||
"catalogLoadFailed": "<p>Failed to load node catalogue.</p><p>Check the browser console for more information</p>",
|
||||
"installFailed": "<p>Failed to install: __module__</p><p>__message__</p><p>Check the log for more information</p>",
|
||||
"installTimeout": "<p>Install continuing the background.</p><p>Nodes will appear in palette when complete. Check the log for more information.</p>",
|
||||
"removeFailed": "<p>Failed to remove: __module__</p><p>__message__</p><p>Check the log for more information</p>",
|
||||
"updateFailed": "<p>Failed to update: __module__</p><p>__message__</p><p>Check the log for more information</p>",
|
||||
"enableFailed": "<p>Failed to enable: __module__</p><p>__message__</p><p>Check the log for more information</p>",
|
||||
|
@ -655,6 +659,9 @@
|
|||
"body": "<p>Removing '__module__'</p><p>Removing the node will uninstall it from Node-RED. The node may continue to use resources until Node-RED is restarted.</p>",
|
||||
"title": "Remove nodes"
|
||||
},
|
||||
"removePlugin": {
|
||||
"body": "<p>Removed plugin __module__. Please reload the editor to clear left-overs.</p>"
|
||||
},
|
||||
"update": {
|
||||
"body": "<p>Updating '__module__'</p><p>Updating the node will require a restart of Node-RED to complete the update. This must be done manually.</p>",
|
||||
"title": "Update nodes"
|
||||
|
@ -666,7 +673,8 @@
|
|||
"review": "Open node information",
|
||||
"install": "Install",
|
||||
"remove": "Remove",
|
||||
"update": "Update"
|
||||
"update": "Update",
|
||||
"understood": "Understood"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -708,7 +716,7 @@
|
|||
"triggerAction": "Trigger action",
|
||||
"find": "Find in workspace",
|
||||
"copyItemUrl": "Copy item url",
|
||||
"copyURL2Clipboard": "Copied url to clipboard",
|
||||
"copyURL2Clipboard": "Copied url to clipboard",
|
||||
"showFlow": "Show",
|
||||
"hideFlow": "Hide"
|
||||
},
|
||||
|
@ -924,7 +932,14 @@
|
|||
"date": "timestamp",
|
||||
"jsonata": "expression",
|
||||
"env": "env variable",
|
||||
"cred": "credential"
|
||||
"cred": "credential",
|
||||
"conf-types": "config node"
|
||||
},
|
||||
"date": {
|
||||
"format": {
|
||||
"timestamp": "milliseconds since epoch",
|
||||
"object": "JavaScript Date Object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editableList": {
|
||||
|
@ -1207,15 +1222,16 @@
|
|||
"title": "System Info"
|
||||
},
|
||||
"languages": {
|
||||
"de": "German",
|
||||
"de": "Deutsch",
|
||||
"en-US": "English",
|
||||
"fr": "French",
|
||||
"ja": "Japanese",
|
||||
"es-ES": "Español (España)",
|
||||
"fr": "Français",
|
||||
"ja": "日本語",
|
||||
"ko": "Korean",
|
||||
"pt-BR":"Portuguese",
|
||||
"ru": "Russian",
|
||||
"zh-CN": "Chinese(Simplified)",
|
||||
"zh-TW": "Chinese(Traditional)"
|
||||
"pt-BR": "Português (Brasil)",
|
||||
"ru": "Русский",
|
||||
"zh-CN": "简体中文",
|
||||
"zh-TW": "繁體中文"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
|
@ -1223,6 +1239,7 @@
|
|||
"invalid-expr": "Invalid JSONata expression: __error__",
|
||||
"invalid-prop": "Invalid property expression",
|
||||
"invalid-num": "Invalid number",
|
||||
"invalid-num-prop": "__prop__: invalid number",
|
||||
"invalid-regexp": "Invalid input pattern",
|
||||
"invalid-regex-prop": "__prop__: invalid input pattern",
|
||||
"missing-required-prop": "__prop__: property value missing",
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"info": {
|
||||
"tip0": "Puedes eliminar los nodos o enlaces seleccionados con {{core:delete-selection}}",
|
||||
"tip1": "Busca nodos con {{core:search}}",
|
||||
"tip2": "{{core:toggle-sidebar}} alternará la vista de esta barra lateral",
|
||||
"tip3": "Puedes gestionar tu paleta de nodos con {{core:manage-palette}}",
|
||||
"tip4": "Tus nodos de configuración de flujo aparecen en el panel de la barra lateral. Se puede acceder desde el menú o con {{core:show-config-tab}}",
|
||||
"tip5": "Activa o desactiva estos consejos desde la opción en la configuración",
|
||||
"tip6": "Mueve los nodos seleccionados usando las teclas [izquierda] [arriba] [abajo] y [derecha]. Mantén pulsada [Mayús] para desplazarlos más",
|
||||
"tip7": "Arrastrar un nodo a un cable lo insertará en el enlace",
|
||||
"tip8": "Exporta los nodos seleccionados, o la pestaña actual con {{core:show-export-dialog}}",
|
||||
"tip9": "Importa un flujo arrastrando su JSON al editor, o con {{core:show-import-dialog}}",
|
||||
"tip10": "[shift][clic] y arrastrar en un puerto de nodo para mover todos los cables conectados o sólo el seleccionado",
|
||||
"tip11": "Mostrar la pestaña Información con {{core:show-info-tab}} o la pestaña Depuración con {{core:show-debug-tab}}",
|
||||
"tip12": "[ctrl] [clic] en el área de trabajo para abrir el diálogo de adición rápida",
|
||||
"tip13": "Mantén pulsada [ctrl] cuando [haces clic] en un puerto de nodo para habilitar el enlazado rápido",
|
||||
"tip14": "Mantén pulsada [shift] cuando [haces clic] en un nodo para seleccionar también todos sus nodos conectados",
|
||||
"tip15": "Mantén pulsada [ctrl] cuando [haces clic] en un nodo para añadirlo o eliminarlo de la selección actual",
|
||||
"tip16": "Cambia de pestaña de flujo con {{core:show-previous-tab}} y {{core:show-next-tab}}",
|
||||
"tip17": "Puedes confirmar tus cambios en la bandeja de edición de nodos con {{core:confirm-edit-tray}} o cancelarlos con {{core:cancel-edit-tray}}",
|
||||
"tip18": "Al pulsar {{core:edit-selected-node}} se editará el primer nodo de la selección actual"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,278 @@
|
|||
{
|
||||
"$string": {
|
||||
"args": "arg[, prettify]",
|
||||
"desc": "Convierte el parámetro `arg` a una cadena usando las siguientes reglas de conversión:\n\n - Las cadenas no cambian\n - Las funciones se convierten en una cadena vacía\n - El infinito numérico y NaN arrojan un error porque no se pueden representar como un número JSON\n: todos los demás valores se convierten a una cadena JSON usando la función `JSON.stringify`. Si `prettify` es verdadero, entonces se produce JSON \"prettified\". es decir, una línea por campo y las líneas se indentarán según la profundidad del campo."
|
||||
},
|
||||
"$length": {
|
||||
"args": "str",
|
||||
"desc": "Devuelve el número de caracteres de la cadena `str`. Se genera un error si `str` no es una cadena."
|
||||
},
|
||||
"$substring": {
|
||||
"args": "str, start[, length]",
|
||||
"desc": "Devuelve una cadena que contiene los caracteres del primer parámetro `str` comenzando en la posición `start` (desplazamiento cero). Si se especifica 'longitud', la subcadena contendrá el máximo de caracteres de 'longitud'. Si 'inicio' es negativo, indica el número de caracteres desde el final de 'cadena'."
|
||||
},
|
||||
"$substringBefore": {
|
||||
"args": "str, chars",
|
||||
"desc": "Devuelve la subcadena antes de la primera aparición de la secuencia de caracteres `chars` en `str`. Si `str` no contiene `caracteres`, entonces devuelve `str`."
|
||||
},
|
||||
"$substringAfter": {
|
||||
"args": "str, chars",
|
||||
"desc": "Devuelve la subcadena después de la primera aparición de la secuencia de caracteres `chars` en `str`. Si `str` no contiene `caracteres`, entonces devuelve `str`."
|
||||
},
|
||||
"$uppercase": {
|
||||
"args": "str",
|
||||
"desc": "Devuelve una cadena con todos los caracteres de `str` convertidos a mayúsculas."
|
||||
},
|
||||
"$lowercase": {
|
||||
"args": "str",
|
||||
"desc": "Devuelve una cadena con todos los caracteres de `str` convertidos a minúsculas."
|
||||
},
|
||||
"$trim": {
|
||||
"args": "str",
|
||||
"desc": "Normaliza y recorta todos los caracteres de espacio en blanco en `str` aplicando los siguientes pasos:\n\n - Todas las tabulaciones, retornos de carro y avances de línea se reemplazan con espacios.\n- Las secuencias contiguas de espacios se reducen a un solo espacio.\n- Se eliminan los espacios iniciales y finales.\n\n Si no se especifica `str` (es decir, esta función se invoca sin argumentos), entonces el valor de contexto se utiliza como el valor de `str`. Se genera un error si `str` no es una cadena."
|
||||
},
|
||||
"$contains": {
|
||||
"args": "str, pattern",
|
||||
"desc": "Devuelve 'verdadero' si 'cadena' coincide con 'patrón', de lo contrario, devuelve 'falso'. Si no se especifica `str` (es decir, esta función se invoca con un argumento), entonces el valor del contexto se utiliza como valor de `str`. El parámetro `patrón` puede ser una cadena o una expresión regular."
|
||||
},
|
||||
"$split": {
|
||||
"args": "str[, separator][, limit]",
|
||||
"desc": "Divide el parámetro `str` en una matriz de subcadenas. Es un error si `str` no es una cadena. El parámetro opcional `separador` especifica los caracteres dentro de la `cadena` sobre los cuales se debe dividir como una cadena o una expresión regular. Si no se especifica 'separador', se supone que la cadena está vacía y 'cadena' se dividirá en una matriz de caracteres individuales. Es un error si el 'separador' no es una cadena. El parámetro opcional 'límite' es un número que especifica el número máximo de subcadenas que se incluirán en la matriz resultante. Cualquier subcadena adicional se descarta. Si no se especifica `límite`, entonces `str` se divide completamente sin límite para el tamaño de la matriz resultante. Es un error si 'límite' no es un número positivo."
|
||||
},
|
||||
"$join": {
|
||||
"args": "array[, separator]",
|
||||
"desc": "Une una matriz de cadenas de componentes en una única cadena concatenada con cada cadena de componentes separada por el parámetro 'separador' opcional. Es un error si la 'matriz' de entrada contiene un elemento que no es una cadena. Si no se especifica 'separador', se supone que es una cadena vacía, es decir, que no hay 'separador' entre las cadenas componentes. Es un error si el 'separador' no es una cadena."
|
||||
},
|
||||
"$match": {
|
||||
"args": "str, pattern [, limit]",
|
||||
"desc": "Aplica la cadena `str` a la expresión regular `pattern` y devuelve una matriz de objetos, cada objeto contiene información sobre cada aparición de una coincidencia dentro de `str`."
|
||||
},
|
||||
"$replace": {
|
||||
"args": "str, pattern, replacement [, limit]",
|
||||
"desc": "Encuentra apariciones de `patrón` dentro de `str` y las reemplaza con `reemplazo`.\n\nEl parámetro opcional `límite` es el número máximo de reemplazos."
|
||||
},
|
||||
"$now": {
|
||||
"args": "$[picture [, timezone]]",
|
||||
"desc": "Genera una marca de tiempo en formato compatible con ISO 8601 y la devuelve como una cadena. Si se proporcionan los parámetros opcionales `picture` y `zona horaria`, entonces la marca de tiempo actual se formatea como se describe en la función `$fromMillis()`"
|
||||
},
|
||||
"$base64encode": {
|
||||
"args": "string",
|
||||
"desc": "Convierte una cadena ASCII a una representación base 64. Cada carácter de la cadena se trata como un byte de datos binarios. Esto requiere que todos los caracteres de la cadena estén en el rango de 0x00 a 0xFF, que incluye todos los caracteres de las cadenas codificadas con URI. No se admiten caracteres Unicode fuera de ese rango."
|
||||
},
|
||||
"$base64decode": {
|
||||
"args": "string",
|
||||
"desc": "Convierte bytes codificados en base 64 en una cadena, utilizando una página de códigos Unicode UTF-8."
|
||||
},
|
||||
"$number": {
|
||||
"args": "arg",
|
||||
"desc": "Convierte el parámetro `arg` a un número usando las siguientes reglas de conversión:\n\n - Los números no cambian\n - Las cadenas que contienen una secuencia de caracteres que representan un número JSON legal se convierten a ese número\n - Todos los demás valores provocar que se arroje un error."
|
||||
},
|
||||
"$abs": {
|
||||
"args": "number",
|
||||
"desc": "Devuelve el valor absoluto del parámetro 'número'."
|
||||
},
|
||||
"$floor": {
|
||||
"args": "number",
|
||||
"desc": "Devuelve el valor de 'número' redondeado hacia abajo al entero más cercano que sea menor o igual a 'número'."
|
||||
},
|
||||
"$ceil": {
|
||||
"args": "number",
|
||||
"desc": "Devuelve el valor de 'número' redondeado al número entero más cercano que sea mayor o igual a 'número'."
|
||||
},
|
||||
"$round": {
|
||||
"args": "number [, precision]",
|
||||
"desc": "Devuelve el valor del parámetro 'número' redondeado al número de decimales especificado por el parámetro opcional 'precisión'."
|
||||
},
|
||||
"$power": {
|
||||
"args": "base, exponent",
|
||||
"desc": "Devuelve el valor de 'base' elevado a la potencia de 'exponente'."
|
||||
},
|
||||
"$sqrt": {
|
||||
"args": "number",
|
||||
"desc": "Devuelve la raíz cuadrada del valor del parámetro 'número'."
|
||||
},
|
||||
"$random": {
|
||||
"args": "",
|
||||
"desc": "Devuelve un número pseudoaleatorio mayor o igual a cero y menor que uno."
|
||||
},
|
||||
"$millis": {
|
||||
"args": "",
|
||||
"desc": "Devuelve el número de milisegundos desde la época Unix (1 de enero de 1970 UTC) como un número. Todas las invocaciones de `$millis()` dentro de una evaluación de una expresión devolverán el mismo valor."
|
||||
},
|
||||
"$sum": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve la suma aritmética de una 'matriz' de números. Es un error si la 'matriz' de entrada contiene un elemento que no es un número."
|
||||
},
|
||||
"$max": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve el número máximo en una 'matriz' de números. Es un error si la 'matriz' de entrada contiene un elemento que no es un número."
|
||||
},
|
||||
"$min": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve el número mínimo en una 'matriz' de números. Es un error si la 'matriz' de entrada contiene un elemento que no es un número."
|
||||
},
|
||||
"$average": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve el valor medio de una 'matriz' de números. Es un error si la 'matriz' de entrada contiene un elemento que no es un número."
|
||||
},
|
||||
"$boolean": {
|
||||
"args": "arg",
|
||||
"desc": "Convierte el argumento a un booleano usando las siguientes reglas:\n\n - `Booleano`: sin cambios\n - `cadena`: vacía: `falso`\n - `cadena`: no vacía: `verdadero`\n - `número`: `0`: `falso`\n - `número`: distinto de cero: `verdadero`\n - `nulo`: `falso`\n - `matriz`: vacía: `falso`\n - `array`: contiene un miembro que se convierte en `true`: `true`\n - `array`: todos los miembros se convierten en `false`: `false`\n - `object`: vacío: `false`\n - `objeto`: no vacío: `verdadero`\n - `función`: `falso`"
|
||||
},
|
||||
"$not": {
|
||||
"args": "arg",
|
||||
"desc": "Devuelve booleano NEGADO del argumento. `arg` se convierte antes en un booleano"
|
||||
},
|
||||
"$exists": {
|
||||
"args": "arg",
|
||||
"desc": "Devuelve booleano 'verdadero' si la expresión 'arg' se evalúa como un valor, o 'falso' si la expresión no coincide con nada (por ejemplo, una ruta a una referencia de campo inexistente)."
|
||||
},
|
||||
"$count": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve el número de elementos de la matriz."
|
||||
},
|
||||
"$append": {
|
||||
"args": "array, array",
|
||||
"desc": "Agrega dos matrices"
|
||||
},
|
||||
"$sort": {
|
||||
"args": "array [, function]",
|
||||
"desc": "Devuelve una matriz que contiene todos los valores en el parámetro `array`, pero ordenados.\n\nSi se proporciona una `función` de comparador, entonces debe ser una función que toma dos parámetros:\n\n`function(left , derecha)`\n\nEsta función es invocada por el algoritmo de clasificación para comparar dos valores `izquierda` y `derecha`. Si el valor de `izquierda` debe colocarse después del valor de `derecha` en el orden de clasificación deseado, entonces la función debe devolver un valor booleano 'verdadero' para indicar un intercambio. De lo contrario debe devolver 'falso'."
|
||||
},
|
||||
"$reverse": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve una matriz que contiene todos los valores del parámetro `matriz`, pero en orden inverso."
|
||||
},
|
||||
"$shuffle": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve una matriz que contiene todos los valores del parámetro `array`, pero mezclados en orden aleatorio."
|
||||
},
|
||||
"$zip": {
|
||||
"args": "array, ...",
|
||||
"desc": "Devuelve una matriz convolucionada (comprimida) que contiene matrices agrupadas de valores de los argumentos `matriz1`... `matrizN` del índice 0, 1, 2...."
|
||||
},
|
||||
"$keys": {
|
||||
"args": "object",
|
||||
"desc": "Devuelve una matriz que contiene las claves del objeto. Si el argumento es una matriz de objetos, entonces la matriz devuelta contiene una lista deduplicada de todas las claves de todos los objetos."
|
||||
},
|
||||
"$lookup": {
|
||||
"args": "object, key",
|
||||
"desc": "Devuelve el valor asociado con la clave en el objeto. Si el primer argumento es una matriz de objetos, entonces se buscan todos los objetos de la matriz y se devuelven los valores asociados con todas las apariciones de la clave."
|
||||
},
|
||||
"$spread": {
|
||||
"args": "object",
|
||||
"desc": "Divide un objeto que contiene pares clave/valor en una matriz de objetos, cada uno de los cuales tiene un único par clave/valor del objeto de entrada. Si el parámetro es una matriz de objetos, entonces la matriz resultante contiene un objeto para cada par clave/valor en cada objeto de la matriz proporcionada."
|
||||
},
|
||||
"$merge": {
|
||||
"args": "array<object>",
|
||||
"desc": "Fusiona una matriz de objetos en un único objeto que contiene todos los pares clave/valor de cada uno de los objetos en la matriz de entrada. Si alguno de los objetos de entrada contiene la misma clave, entonces el objeto devuelto contendrá el valor del último en la matriz. Es un error si la matriz de entrada contiene un elemento que no es un objeto."
|
||||
},
|
||||
"$sift": {
|
||||
"args": "object, function",
|
||||
"desc": "Devuelve un objeto que contiene solo los pares clave/valor del parámetro `objeto` que satisfacen el predicado `función` pasado como segundo parámetro.\n\nLa `función` que se proporciona como segundo parámetro debe tener la siguiente firma:\n\n`función(valor [, clave [, objeto]])`"
|
||||
},
|
||||
"$each": {
|
||||
"args": "object, function",
|
||||
"desc": "Devuelve una matriz que contiene los valores devueltos por la función cuando se aplica a cada par clave/valor en el objeto."
|
||||
},
|
||||
"$map": {
|
||||
"args": "array, function",
|
||||
"desc": "Devuelve una matriz que contiene los resultados de aplicar el parámetro `función` a cada valor en el parámetro `matriz`.\n\nLa `función` que se proporciona como segundo parámetro debe tener la siguiente firma:\n\n`función( valor [, índice [, matriz]])`"
|
||||
},
|
||||
"$filter": {
|
||||
"args": "array, function",
|
||||
"desc": "Devuelve una matriz que contiene solo los valores en el parámetro `matriz` que satisfacen el predicado `función`.\n\nLa `función` que se proporciona como segundo parámetro debe tener la siguiente firma:\n\n`función(valor [ , índice [, matriz]])`"
|
||||
},
|
||||
"$reduce": {
|
||||
"args": "array, function [, init]",
|
||||
"desc": "Devuelve un valor agregado derivado de aplicar el parámetro `función` sucesivamente a cada valor en `matriz` en combinación con el resultado de la aplicación anterior de la función.\n\nLa función debe aceptar dos argumentos y se comporta como un operador infijo entre cada valor dentro de la matriz. La firma de la `función` debe tener la forma: `myfunc($accumulator, $value[, $index[, $array]])`\n\nEl parámetro opcional `init` se utiliza como valor inicial en la agregación."
|
||||
},
|
||||
"$flowContext": {
|
||||
"args": "string[, string]",
|
||||
"desc": "Recupera una propiedad de contexto de flujo.\n\nEsta es una función definida por Node-RED."
|
||||
},
|
||||
"$globalContext": {
|
||||
"args": "string[, string]",
|
||||
"desc": "Recupera una propiedad de contexto global.\n\nEsta es una función definida por Node-RED."
|
||||
},
|
||||
"$pad": {
|
||||
"args": "string, width [, char]",
|
||||
"desc": "Devuelve una copia de la `cadena` con relleno adicional, si es necesario, de modo que su número total de caracteres sea al menos el valor absoluto del parámetro `ancho`.\n\nSi `ancho` es un número positivo, entonces la cadena está acolchado hacia la derecha; si es negativo, se rellena hacia la izquierda.\n\nEl argumento opcional `char` especifica los caracteres de relleno que se utilizarán. Si no se especifica, el valor predeterminado es el carácter de espacio."
|
||||
},
|
||||
"$fromMillis": {
|
||||
"args": "number, [, picture [, timezone]]",
|
||||
"desc": "Convierte el `número` que representa milisegundos desde la época Unix (1 de enero de 1970 UTC) en una representación de cadena formateada según la plantilla en picture.\n\nSi se omite el parámetro opcional `picture`, entonces la marca de tiempo es formateado en el formato ISO 8601.\n\nSi se proporciona la cadena opcional `picture`, entonces la marca de tiempo se formatea de acuerdo con la representación especificada en esa cadena. El comportamiento de esta función es consistente con la versión de dos argumentos de la función XPath/XQuery `format-dateTime` tal como se define en la especificación XPath F&O 3.1. El parámetro de plantilla define cómo se formatea la marca de tiempo y tiene la misma sintaxis que `format-dateTime`.\n\nSi se proporciona la cadena opcional `timezone`, entonces la marca de tiempo formateada estará en esa zona horaria. La cadena `timezone` debe tener el formato '±HHMM', donde ± es el signo más o menos y HHMM es el desplazamiento en horas y minutos desde UTC. Desplazamiento positivo para zonas horarias al este de UTC, desplazamiento negativo para zonas horarias al oeste de UTC."
|
||||
},
|
||||
"$formatNumber": {
|
||||
"args": "number, picture [, options]",
|
||||
"desc": "Convierte el `número` en una cadena y lo formatea en una representación decimal según lo especificado en la cadena `picture`.\n\n El comportamiento de esta función es coherente con la función XPath/XQuery `fn:format-number` tal como se define en la especificación XPath F&O 3.1. El parámetro de cadena `picture` define cómo se formatea el número y tiene la misma sintaxis que `fn:formato-número`.\n\nEl tercer argumento opcional `opciones` se utiliza para anular los caracteres de formato específicos de la configuración regional predeterminada, como el decimal. separador. Si se proporciona, este argumento debe ser un objeto que contenga pares de nombre/valor especificados en la sección de formato decimal de la especificación XPath F&O 3.1."
|
||||
},
|
||||
"$formatBase": {
|
||||
"args": "number [, radix]",
|
||||
"desc": "Convierte el número en una cadena y lo formatea como un número entero representado en la base numérica especificada por el argumento `radix`. Si no se especifica `radix`, el valor predeterminado es la base 10. `radix` puede estar entre 2 y 36; de lo contrario, se genera un error."
|
||||
},
|
||||
"$toMillis": {
|
||||
"args": "timestamp",
|
||||
"desc": "Convierte una cadena de `marca de tiempo` en el formato ISO 8601 al número de milisegundos desde la época Unix (1 de enero de 1970 UTC) como un número. Se genera un error si la cadena no tiene el formato correcto."
|
||||
},
|
||||
"$env": {
|
||||
"args": "arg",
|
||||
"desc": "Devuelve el valor de una variable de entorno.\n\nEsta es una función definida por Node-RED."
|
||||
},
|
||||
"$eval": {
|
||||
"args": "expr [, context]",
|
||||
"desc": "Analiza y evalúa la cadena `expr` que contiene JSON literal o una expresión JSONata utilizando el contexto actual como contexto para la evaluación."
|
||||
},
|
||||
"$formatInteger": {
|
||||
"args": "number, picture",
|
||||
"desc": "Convierte el número en una cadena y lo formatea en una representación entera como lo especifica la cadena `picture`. El parámetro de define cómo se formatea el número y tiene la misma sintaxis que `fn:format-integer` de la especificación XPath F&O 3.1."
|
||||
},
|
||||
"$parseInteger": {
|
||||
"args": "string, picture",
|
||||
"desc": "Analiza el contenido del parámetro cadena en un número entero (como un número JSON) utilizando el formato especificado por la cadena `picture`. El parámetro tiene el mismo formato que `$formatInteger`."
|
||||
},
|
||||
"$error": {
|
||||
"args": "[str]",
|
||||
"desc": "Lanza un error con un mensaje. El parámetro `str` opcional reemplazará el mensaje predeterminado de `$error() función evaluada`"
|
||||
},
|
||||
"$assert": {
|
||||
"args": "arg, str",
|
||||
"desc": "Si `arg` es `verdadero`, la función devuelve indefinido. Si `arg` es `falso`, se lanza una excepción con `str` como mensaje de excepción."
|
||||
},
|
||||
"$single": {
|
||||
"args": "array, function",
|
||||
"desc": "Devuelve el único valor en el parámetro `array` que satisface el predicado de `función` (es decir, la `función` devuelve booleano `verdadero` cuando se pasa el valor). Lanza una excepción si el número de valores coincidentes no es exactamente uno.\n\nLa función debe proporcionarse con la siguiente firma: `función(valor [, índice [, matriz]])` donde el valor es cada entrada de la matriz. El índice es la posición de ese valor y toda la matriz se pasa como tercer argumento."
|
||||
},
|
||||
"$encodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "Codifica un componente de URL reemplazando cada instancia de ciertos caracteres por una, dos, tres o cuatro secuencias de escape que representan la codificación UTF-8 del carácter.\n\nEjemplo: `$encodeUrlComponent(\"?x=prueba\")` => `\"%3Fx%3Dprueba\"`"
|
||||
},
|
||||
"$encodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "Codifica una URL reemplazando cada instancia de ciertos caracteres por una, dos, tres o cuatro secuencias de escape que representan la codificación UTF-8 del carácter.\n\nEjemplo: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
|
||||
},
|
||||
"$decodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "Decodifica un componente de URL creado previamente por encodeUrlComponent.\n\nEjemplo: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
|
||||
},
|
||||
"$decodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "Decodifica una URL creado previamente por encodeUrl.\n\nEjemplo: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
|
||||
},
|
||||
"$distinct": {
|
||||
"args": "array",
|
||||
"desc": "Devuelve una matriz con valores duplicados eliminados de `matriz`"
|
||||
},
|
||||
"$type": {
|
||||
"args": "value",
|
||||
"desc": "Devuelve el tipo de `valor` como una cadena. Si `valor` no está definido, esto devolverá indefinido."
|
||||
},
|
||||
"$moment": {
|
||||
"args": "[str]",
|
||||
"desc": "Obtiene un objeto de fecha usando la biblioteca Moment."
|
||||
},
|
||||
"$clone": {
|
||||
"args": "value",
|
||||
"desc": "Clona un objeto de forma segura."
|
||||
}
|
||||
}
|
|
@ -122,7 +122,6 @@
|
|||
"selectionToSubflow": "Convertir en sous-flux",
|
||||
"flows": "Flux",
|
||||
"add": "Ajouter",
|
||||
"rename": "Renommer",
|
||||
"delete": "Supprimer",
|
||||
"keyboardShortcuts": "Raccourcis clavier",
|
||||
"login": "Se connecter",
|
||||
|
@ -130,6 +129,11 @@
|
|||
"editPalette": "Gérer la palette",
|
||||
"other": "Autre",
|
||||
"showTips": "Afficher les astuces",
|
||||
"showNodeHelp": "Afficher l'aide du noeud",
|
||||
"enableSelectedNodes": "Activer les noeuds sélectionnés",
|
||||
"disableSelectedNodes": "Désactiver les noeuds sélectionnés",
|
||||
"showSelectedNodeLabels": "Afficher les étiquettes des noeuds sélectionnés",
|
||||
"hideSelectedNodeLabels": "Masquer les étiquettes des noeuds sélectionnés",
|
||||
"showWelcomeTours": "Afficher les visites guidées pour les nouvelles versions",
|
||||
"help": "Site web de Node-RED",
|
||||
"projects": "Projets",
|
||||
|
@ -299,7 +303,8 @@
|
|||
"missingType": "L'entrée n'est pas un flux valide - l'élément '__index__' n'a pas de propriété 'type'"
|
||||
},
|
||||
"conflictNotification1": "Certains des noeuds que vous avez importés existent déjà dans votre espace de travail.",
|
||||
"conflictNotification2": "Sélectionnez les noeuds à importer et choisissez s'il faut remplacer les noeuds existants ou en importer une copie."
|
||||
"conflictNotification2": "Sélectionnez les noeuds à importer et choisissez s'il faut remplacer les noeuds existants ou en importer une copie.",
|
||||
"alreadyExists": "Ce noeud existe déjà"
|
||||
},
|
||||
"copyMessagePath": "Chemin copié",
|
||||
"copyMessageValue": "Valeur copiée",
|
||||
|
@ -511,7 +516,7 @@
|
|||
"selectAllConnected": "Sélectionner tous les éléments connectés",
|
||||
"addRemoveNode": "Ajouter/supprimer un noeud de la sélection",
|
||||
"editSelected": "Modifier le noeud sélectionné",
|
||||
"deleteSelected": "Supprimer les noeuds ou le lien sélectionné(s)",
|
||||
"deleteSelected": "Supprimer la sélection",
|
||||
"deleteReconnect": "Supprimer et reconnecter",
|
||||
"importNode": "Importer les noeuds",
|
||||
"exportNode": "Exporter les noeuds",
|
||||
|
@ -609,6 +614,8 @@
|
|||
},
|
||||
"nodeCount": "__label__ noeud",
|
||||
"nodeCount_plural": "__label__ noeuds",
|
||||
"pluginCount": "__count__ plugin",
|
||||
"pluginCount_plural": "__count__ plugins",
|
||||
"moduleCount": "__count__ module disponible",
|
||||
"moduleCount_plural": "__count__ modules disponibles",
|
||||
"inuse": "En cours d'utilisation",
|
||||
|
@ -636,6 +643,7 @@
|
|||
"errors": {
|
||||
"catalogLoadFailed": "<p>Échec du chargement du catalogue de noeuds.</p><p>Vérifier la console du navigateur pour plus d'informations</p>",
|
||||
"installFailed": "<p>Échec lors de l'installation : __module__</p><p>__message__</p><p>Consulter le journal pour plus d'informations</p>",
|
||||
"installTimeout": "<p>L'installation continue en arrière-plan.</p><p>Les noeuds apparaîtront dans la palette une fois l'installation terminée. Consulter le journal pour plus d'informations.</p>",
|
||||
"removeFailed": "<p>Échec lors de la suppression : __module__</p><p>__message__</p><p>Consulter le journal pour plus d'informations</p>",
|
||||
"updateFailed": "<p>Échec lors de la mise à jour : __module__</p><p>__message__</p><p>Consulter le journal pour plus d'informations</p>",
|
||||
"enableFailed": "<p>Échec lors de l'activation : __module__</p><p>__message__</p><p>Consulter le journal pour plus d'informations</p>",
|
||||
|
@ -647,9 +655,12 @@
|
|||
"title": "Installer les noeuds"
|
||||
},
|
||||
"remove": {
|
||||
"body": "<p>Suppression de '__module__'</p><p>La suppression du noeud le désinstallera de Node-RED. Le noeud peut continuer à utiliser des ressources jusqu'au redémarrage de Node-RED.</p>",
|
||||
"body": "<p>Suppression de '__module__'</p><p>La suppression du noeud le désinstallera de Node-RED. Le noeud peut continuer à utiliser ses ressources jusqu'au redémarrage de Node-RED.</p>",
|
||||
"title": "Supprimer les noeuds"
|
||||
},
|
||||
"removePlugin": {
|
||||
"body": "<p>Suppression du plugin '__module__'. Veuillez recharger l'éditeur afin d'appliquer les changements.</p>"
|
||||
},
|
||||
"update": {
|
||||
"body": "<p>Mise à jour de '__module__'</p><p>La mise à jour du noeud nécessitera un redémarrage de Node-RED pour terminer la mise à jour. Cela doit être fait manuellement.</p>",
|
||||
"title": "Mettre à jour les noeuds"
|
||||
|
@ -661,7 +672,8 @@
|
|||
"review": "Ouvrir la documentation",
|
||||
"install": "Installer",
|
||||
"remove": "Supprimer",
|
||||
"update": "Mettre à jour"
|
||||
"update": "Mettre à jour",
|
||||
"understood": "Compris"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -829,7 +841,7 @@
|
|||
"copyPublicKey": "Copier la clé publique dans le presse-papiers",
|
||||
"delete": "Supprimer une clé",
|
||||
"gitConfig": "Configuration Git",
|
||||
"deleteConfirm": "Êtes-vous sûr de vouloir supprimer la clé SSH __nom__ ? Ça ne peut pas être annulé."
|
||||
"deleteConfirm": "Êtes-vous sûr de vouloir supprimer la clé SSH __name__ ? Ça ne peut pas être annulé."
|
||||
},
|
||||
"versionControl": {
|
||||
"unstagedChanges": "Abandon des changements",
|
||||
|
@ -919,7 +931,14 @@
|
|||
"date": "horodatage",
|
||||
"jsonata": "expression",
|
||||
"env": "variable d'environnement",
|
||||
"cred": "identifiant"
|
||||
"cred": "identifiant",
|
||||
"conf-types": "noeud de configuration"
|
||||
},
|
||||
"date": {
|
||||
"format": {
|
||||
"timestamp": "millisecondes depuis l'époque",
|
||||
"object": "Objet de date JavaScript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editableList": {
|
||||
|
@ -1201,23 +1220,13 @@
|
|||
"diagnostics": {
|
||||
"title": "Information système"
|
||||
},
|
||||
"languages": {
|
||||
"de": "Allemand",
|
||||
"en-US": "Anglais",
|
||||
"fr": "Français",
|
||||
"ja": "Japonais",
|
||||
"ko": "Coréen",
|
||||
"pt-BR": "Portugais brésilien",
|
||||
"ru": "Russe",
|
||||
"zh-CN": "Chinois (Simplifié)",
|
||||
"zh-TW": "Chinois (Traditionnel)"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "Données JSON invalides : __error__",
|
||||
"invalid-expr": "Expression JSONata invalide : __error__",
|
||||
"invalid-prop": "Expression de propriété invalide",
|
||||
"invalid-num": "Numéro invalide",
|
||||
"invalid-num-prop": "__prop__: numéro invalide",
|
||||
"invalid-regexp": "Modèle d'entrée non valide",
|
||||
"invalid-regex-prop": "__prop__: modèle d'entrée non valide",
|
||||
"missing-required-prop": "__prop__: valeur de la propriété manquante",
|
||||
|
@ -1227,6 +1236,7 @@
|
|||
}
|
||||
},
|
||||
"contextMenu": {
|
||||
"showActionList": "Afficher la liste des actions",
|
||||
"insert": "Insérer",
|
||||
"node": "Noeud",
|
||||
"junction": "Jonction",
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
"selectionToSubflow": "選択部分をサブフロー化",
|
||||
"flows": "フロー",
|
||||
"add": "フローを新規追加",
|
||||
"rename": "フロー名を変更",
|
||||
"delete": "フローを削除",
|
||||
"keyboardShortcuts": "ショートカットキーの説明",
|
||||
"login": "ログイン",
|
||||
|
@ -130,6 +129,11 @@
|
|||
"editPalette": "パレットの管理",
|
||||
"other": "その他",
|
||||
"showTips": "ヒントを表示",
|
||||
"showNodeHelp": "ノードのヘルプを表示",
|
||||
"enableSelectedNodes": "選択したノードを有効化",
|
||||
"disableSelectedNodes": "選択したノードを無効化",
|
||||
"showSelectedNodeLabels": "選択したノードのラベル表示",
|
||||
"hideSelectedNodeLabels": "選択したノードのラベル非表示",
|
||||
"showWelcomeTours": "新バージョンのガイドツアーを表示",
|
||||
"help": "Node-REDウェブサイト",
|
||||
"projects": "プロジェクト",
|
||||
|
@ -299,7 +303,8 @@
|
|||
"missingType": "不正なフロー - __index__ 番目の要素に'type'プロパティがありません"
|
||||
},
|
||||
"conflictNotification1": "読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。",
|
||||
"conflictNotification2": "読み込むノードを選択し、また既存のノードを置き換えるか、もしくはそれらのコピーを読み込むかも選択してください。"
|
||||
"conflictNotification2": "読み込むノードを選択し、また既存のノードを置き換えるか、もしくはそれらのコピーを読み込むかも選択してください。",
|
||||
"alreadyExists": "本ノードは既に存在"
|
||||
},
|
||||
"copyMessagePath": "パスをコピーしました",
|
||||
"copyMessageValue": "値をコピーしました",
|
||||
|
@ -511,7 +516,7 @@
|
|||
"selectAllConnected": "接続されたノードを選択",
|
||||
"addRemoveNode": "ノードの選択、選択解除",
|
||||
"editSelected": "選択したノードを編集",
|
||||
"deleteSelected": "選択したノードや接続を削除",
|
||||
"deleteSelected": "選択部分を削除",
|
||||
"deleteReconnect": "削除と再接続",
|
||||
"importNode": "フローの読み込み",
|
||||
"exportNode": "フローの書き出し",
|
||||
|
@ -609,6 +614,8 @@
|
|||
},
|
||||
"nodeCount": "__label__ 個のノード",
|
||||
"nodeCount_plural": "__label__ 個のノード",
|
||||
"pluginCount": "__count__ 個のプラグイン",
|
||||
"pluginCount_plural": "__count__ 個のプラグイン",
|
||||
"moduleCount": "__count__ 個のモジュール",
|
||||
"moduleCount_plural": "__count__ 個のモジュール",
|
||||
"inuse": "使用中",
|
||||
|
@ -636,6 +643,7 @@
|
|||
"errors": {
|
||||
"catalogLoadFailed": "<p>ノードのカタログの読み込みに失敗しました。</p><p>詳細はブラウザのコンソールを確認してください。</p>",
|
||||
"installFailed": "<p>追加処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
|
||||
"installTimeout": "<p>バックグラウンドでインストールが継続されます。</p><p>完了した時にノードが表示されます。詳細はログを確認してください。</p>",
|
||||
"removeFailed": "<p>削除処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
|
||||
"updateFailed": "<p>更新処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
|
||||
"enableFailed": "<p>有効化処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
|
||||
|
@ -650,6 +658,9 @@
|
|||
"body": "<p>__module__ を削除します。</p><p>Node-REDからノードを削除します。ノードはNode-REDが再起動されるまで、リソースを使い続ける可能性があります。</p>",
|
||||
"title": "ノードを削除"
|
||||
},
|
||||
"removePlugin": {
|
||||
"body": "<p>プラグイン __module__ を削除しました。ブラウザを再読み込みして残った表示を消してください。</p>"
|
||||
},
|
||||
"update": {
|
||||
"body": "<p>__module__ を更新します。</p><p>更新を完了するには手動でNode-REDを再起動する必要があります。</p>",
|
||||
"title": "ノードの更新"
|
||||
|
@ -661,7 +672,8 @@
|
|||
"review": "ノードの情報を参照",
|
||||
"install": "追加",
|
||||
"remove": "削除",
|
||||
"update": "更新"
|
||||
"update": "更新",
|
||||
"understood": "了解"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -919,7 +931,14 @@
|
|||
"date": "日時",
|
||||
"jsonata": "JSONata式",
|
||||
"env": "環境変数",
|
||||
"cred": "認証情報"
|
||||
"cred": "認証情報",
|
||||
"conf-types": "設定ノード"
|
||||
},
|
||||
"date": {
|
||||
"format": {
|
||||
"timestamp": "エポックからの経過ミリ秒",
|
||||
"object": "JavaScript日付オブジェクト"
|
||||
}
|
||||
}
|
||||
},
|
||||
"editableList": {
|
||||
|
@ -1201,22 +1220,13 @@
|
|||
"diagnostics": {
|
||||
"title": "システム情報"
|
||||
},
|
||||
"languages": {
|
||||
"de": "ドイツ語",
|
||||
"en-US": "英語",
|
||||
"fr": "フランス語",
|
||||
"ja": "日本語",
|
||||
"ko": "韓国語",
|
||||
"pt-BR": "ポルトガル語",
|
||||
"ru": "ロシア語",
|
||||
"zh-CN": "中国語(簡体)",
|
||||
"zh-TW": "中国語(繁体)"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "JSONデータが不正: __error__",
|
||||
"invalid-expr": "不正なJSONata式: __error__",
|
||||
"invalid-prop": "プロパティ式が不正",
|
||||
"invalid-num": "数値が不正",
|
||||
"invalid-num-prop": "__prop__: 数値が不正",
|
||||
"invalid-regexp": "入力パターンが不正",
|
||||
"invalid-regex-prop": "__prop__: 入力パターンが不正",
|
||||
"missing-required-prop": "__prop__: プロパティが未設定",
|
||||
|
@ -1226,6 +1236,7 @@
|
|||
}
|
||||
},
|
||||
"contextMenu": {
|
||||
"showActionList": "動作一覧を表示",
|
||||
"insert": "挿入",
|
||||
"node": "ノード",
|
||||
"junction": "分岐点",
|
||||
|
@ -1233,7 +1244,7 @@
|
|||
},
|
||||
"env-var": {
|
||||
"environment": "環境変数",
|
||||
"header": "大域環境変数",
|
||||
"header": "グローバル環境変数",
|
||||
"revert": "破棄"
|
||||
},
|
||||
"action-list": {
|
||||
|
@ -1385,7 +1396,7 @@
|
|||
"copy-item-edit-url": "要素の編集URLをコピー",
|
||||
"move-flow-to-start": "フローを先頭に移動",
|
||||
"move-flow-to-end": "フローを末尾に移動",
|
||||
"show-global-env": "大域環境変数を表示",
|
||||
"show-global-env": "グローバル環境変数を表示",
|
||||
"lock-flow": "フローを固定",
|
||||
"unlock-flow": "フローの固定を解除",
|
||||
"show-node-help": "ノードのヘルプを表示"
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
"selectionToSubflow": "서브 플로우 선택",
|
||||
"flows": "플로우",
|
||||
"add": "추가",
|
||||
"rename": "이름변경",
|
||||
"delete": "삭제",
|
||||
"keyboardShortcuts": "단축키",
|
||||
"login": "로그인",
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
"selectionToSubflow": "Seleção para subfluxo",
|
||||
"flows": "Fluxos",
|
||||
"add": "Adicionar",
|
||||
"rename": "Renomear",
|
||||
"delete": "Apagar",
|
||||
"keyboardShortcuts": "Atalhos do teclado",
|
||||
"login": "Ingressar",
|
||||
|
@ -1173,21 +1172,12 @@
|
|||
"diagnostics": {
|
||||
"title": "informações do Sistema"
|
||||
},
|
||||
"languages": {
|
||||
"de": "Alemão",
|
||||
"en-US": "Inglês",
|
||||
"ja": "Japonês",
|
||||
"ko": "Coreano",
|
||||
"pt-BR": "Português(Brasil)",
|
||||
"ru": "Russo",
|
||||
"zh-CN": "Chinês(Simplificado)",
|
||||
"zh-TW": "Chinês(Tradicional)"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "Dados JSON inválidos: __error__",
|
||||
"invalid-prop": "Expressão de propriedade inválida",
|
||||
"invalid-num": "Número inválido",
|
||||
"invalid-num-prop": "__prop__: número inválido",
|
||||
"invalid-regexp": "Padrão de entrada inválido",
|
||||
"invalid-regex-prop": "__prop__: Padrão de entrada inválido",
|
||||
"missing-required-prop": "__prop__: valor de propriedade ausente",
|
||||
|
|
|
@ -95,7 +95,6 @@
|
|||
"selectionToSubflow": "Выделение в подпоток",
|
||||
"flows": "Потоки",
|
||||
"add": "Добавить",
|
||||
"rename": "Переименовать",
|
||||
"delete": "Удалить",
|
||||
"keyboardShortcuts": "Сочетания клавиш",
|
||||
"login": "Войти",
|
||||
|
@ -1129,16 +1128,5 @@
|
|||
"appearance": "Внешний вид",
|
||||
"preview": "Предпросмотр редактора",
|
||||
"defaultValue": "Значение по умолчанию"
|
||||
},
|
||||
"languages" : {
|
||||
"de": "Немецкий",
|
||||
"en-US": "Английский",
|
||||
"fr": "Французский",
|
||||
"ja": "Японский",
|
||||
"ko": "Корейский",
|
||||
"pt-BR":"португальский",
|
||||
"ru": "Русский",
|
||||
"zh-CN": "Китайский (упрощенный)",
|
||||
"zh-TW": "Китайский (традиционный)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
"selectionToSubflow": "将选择部分更改为子流程",
|
||||
"flows": "流程",
|
||||
"add": "增加",
|
||||
"rename": "重命名",
|
||||
"delete": "删除",
|
||||
"keyboardShortcuts": "键盘快捷方式",
|
||||
"login": "登录",
|
||||
|
@ -1204,23 +1203,13 @@
|
|||
"diagnostics": {
|
||||
"title": "系统信息"
|
||||
},
|
||||
"languages": {
|
||||
"de": "德语",
|
||||
"en-US": "英文",
|
||||
"fr": "法语",
|
||||
"ja": "日语",
|
||||
"ko": "韩文",
|
||||
"pt-BR":"葡萄牙语",
|
||||
"ru":"俄語",
|
||||
"zh-CN": "简体中文",
|
||||
"zh-TW": "繁体中文"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "无效的 JSON 数据: __error__",
|
||||
"invalid-expr": "无效的 JSONata 表达式: __error__",
|
||||
"invalid-prop": "无效的属性表达式",
|
||||
"invalid-num": "无效的数字",
|
||||
"invalid-num-prop": "__prop__: 无效的数字",
|
||||
"invalid-regexp": "输入格式无效",
|
||||
"invalid-regex-prop": "__prop__: 输入格式无效",
|
||||
"missing-required-prop": "__prop__: 缺少属性值",
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
"selectionToSubflow": "將選擇部分更改為子流程",
|
||||
"flows": "流程",
|
||||
"add": "增加",
|
||||
"rename": "重新命名",
|
||||
"delete": "刪除",
|
||||
"keyboardShortcuts": "鍵盤快速鍵",
|
||||
"login": "登入",
|
||||
|
@ -1204,17 +1203,6 @@
|
|||
"diagnostics": {
|
||||
"title": "系统信息"
|
||||
},
|
||||
"languages": {
|
||||
"de": "德語",
|
||||
"en-US": "英語",
|
||||
"fr": "法語",
|
||||
"ja": "日語",
|
||||
"ko": "韓語",
|
||||
"pt-BR":"葡萄牙语",
|
||||
"ru":"俄語",
|
||||
"zh-CN": "簡體中文",
|
||||
"zh-TW": "繁體中文"
|
||||
},
|
||||
"validator": {
|
||||
"errors": {
|
||||
"invalid-json": "無效的 JSON 數據: __error__",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "4.0.0-dev",
|
||||
"version": "4.0.0-beta.3-1",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -26,6 +26,15 @@ RED.comms = (function() {
|
|||
var reconnectAttempts = 0;
|
||||
var active = false;
|
||||
|
||||
RED.events.on('login', function(username) {
|
||||
// User has logged in
|
||||
// Need to upgrade the connection to be authenticated
|
||||
if (ws && ws.readyState == 1) {
|
||||
const auth_tokens = RED.settings.get("auth-tokens");
|
||||
ws.send(JSON.stringify({auth:auth_tokens.access_token}))
|
||||
}
|
||||
})
|
||||
|
||||
function connectWS() {
|
||||
active = true;
|
||||
var wspath;
|
||||
|
@ -56,6 +65,7 @@ RED.comms = (function() {
|
|||
ws.send(JSON.stringify({subscribe:t}));
|
||||
}
|
||||
}
|
||||
emit('connect')
|
||||
}
|
||||
|
||||
ws = new WebSocket(wspath);
|
||||
|
@ -180,9 +190,53 @@ RED.comms = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
function send(topic, msg) {
|
||||
if (ws && ws.readyState == 1) {
|
||||
ws.send(JSON.stringify({
|
||||
topic,
|
||||
data: msg
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
const eventHandlers = {};
|
||||
function on(evt,func) {
|
||||
eventHandlers[evt] = eventHandlers[evt]||[];
|
||||
eventHandlers[evt].push(func);
|
||||
}
|
||||
function off(evt,func) {
|
||||
const handler = eventHandlers[evt];
|
||||
if (handler) {
|
||||
for (let i=0;i<handler.length;i++) {
|
||||
if (handler[i] === func) {
|
||||
handler.splice(i,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function emit() {
|
||||
const evt = arguments[0]
|
||||
const args = Array.prototype.slice.call(arguments,1);
|
||||
if (eventHandlers[evt]) {
|
||||
let cpyHandlers = [...eventHandlers[evt]];
|
||||
for (let i=0;i<cpyHandlers.length;i++) {
|
||||
try {
|
||||
cpyHandlers[i].apply(null, args);
|
||||
} catch(err) {
|
||||
console.warn("RED.comms.emit error: ["+evt+"] "+(err.toString()));
|
||||
console.warn(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
connect: connectWS,
|
||||
subscribe: subscribe,
|
||||
unsubscribe:unsubscribe
|
||||
unsubscribe:unsubscribe,
|
||||
on,
|
||||
off,
|
||||
send
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -39,15 +39,16 @@
|
|||
console.warn(evt,args);
|
||||
}
|
||||
if (handlers[evt]) {
|
||||
for (var i=0;i<handlers[evt].length;i++) {
|
||||
let cpyHandlers = [...handlers[evt]];
|
||||
|
||||
for (var i=0;i<cpyHandlers.length;i++) {
|
||||
try {
|
||||
handlers[evt][i].apply(null, args);
|
||||
cpyHandlers[i].apply(null, args);
|
||||
} catch(err) {
|
||||
console.warn("RED.events.emit error: ["+evt+"] "+(err.toString()));
|
||||
console.warn(err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
|
|
@ -29,7 +29,14 @@ RED.history = (function() {
|
|||
}
|
||||
return RED.nodes.junction(id);
|
||||
}
|
||||
|
||||
function ensureUnlocked(id, flowsToLock) {
|
||||
const flow = id && (RED.nodes.workspace(id) || RED.nodes.subflow(id) || null);
|
||||
const isLocked = flow ? flow.locked : false;
|
||||
if (flow && isLocked) {
|
||||
flow.locked = false;
|
||||
flowsToLock.add(flow)
|
||||
}
|
||||
}
|
||||
function undoEvent(ev) {
|
||||
var i;
|
||||
var len;
|
||||
|
@ -59,18 +66,46 @@ RED.history = (function() {
|
|||
t: 'replace',
|
||||
config: RED.nodes.createCompleteNodeSet(),
|
||||
changed: {},
|
||||
rev: RED.nodes.version()
|
||||
moved: {},
|
||||
complete: true,
|
||||
rev: RED.nodes.version(),
|
||||
dirty: RED.nodes.dirty()
|
||||
};
|
||||
var selectedTab = RED.workspaces.active();
|
||||
inverseEv.config.forEach(n => {
|
||||
const node = RED.nodes.node(n.id)
|
||||
if (node) {
|
||||
inverseEv.changed[n.id] = node.changed
|
||||
inverseEv.moved[n.id] = node.moved
|
||||
}
|
||||
})
|
||||
RED.nodes.clear();
|
||||
var imported = RED.nodes.import(ev.config);
|
||||
// Clear all change flags from the import
|
||||
RED.nodes.dirty(false);
|
||||
|
||||
const flowsToLock = new Set()
|
||||
|
||||
imported.nodes.forEach(function(n) {
|
||||
if (ev.changed[n.id]) {
|
||||
ensureUnlocked(n.z, flowsToLock)
|
||||
n.changed = true;
|
||||
inverseEv.changed[n.id] = true;
|
||||
}
|
||||
if (ev.moved[n.id]) {
|
||||
ensureUnlocked(n.z, flowsToLock)
|
||||
n.moved = true;
|
||||
}
|
||||
})
|
||||
flowsToLock.forEach(flow => {
|
||||
flow.locked = true
|
||||
})
|
||||
|
||||
RED.nodes.version(ev.rev);
|
||||
RED.view.redraw(true);
|
||||
RED.palette.refresh();
|
||||
RED.workspaces.refresh();
|
||||
RED.workspaces.show(selectedTab, true);
|
||||
RED.sidebar.config.refresh();
|
||||
} else {
|
||||
var importMap = {};
|
||||
ev.config.forEach(function(n) {
|
||||
|
|
|
@ -0,0 +1,490 @@
|
|||
RED.multiplayer = (function () {
|
||||
|
||||
// activeSessionId - used to identify sessions across websocket reconnects
|
||||
let activeSessionId
|
||||
|
||||
let headerWidget
|
||||
// Map of session id to { session:'', user:{}, location:{}}
|
||||
let sessions = {}
|
||||
// Map of username to { user:{}, sessions:[] }
|
||||
let users = {}
|
||||
|
||||
function addUserSession (session) {
|
||||
if (sessions[session.session]) {
|
||||
// This is an existing connection that has been authenticated
|
||||
const existingSession = sessions[session.session]
|
||||
if (existingSession.user.username !== session.user.username) {
|
||||
removeUserHeaderButton(users[existingSession.user.username])
|
||||
}
|
||||
}
|
||||
sessions[session.session] = session
|
||||
const user = users[session.user.username] = users[session.user.username] || {
|
||||
user: session.user,
|
||||
sessions: []
|
||||
}
|
||||
if (session.user.profileColor === undefined) {
|
||||
session.user.profileColor = (1 + Math.floor(Math.random() * 5))
|
||||
}
|
||||
session.location = session.location || {}
|
||||
user.sessions.push(session)
|
||||
|
||||
if (session.session === activeSessionId) {
|
||||
// This is the current user session - do not add a extra button for them
|
||||
} else {
|
||||
if (user.sessions.length === 1) {
|
||||
if (user.button) {
|
||||
clearTimeout(user.inactiveTimeout)
|
||||
clearTimeout(user.removeTimeout)
|
||||
user.button.removeClass('inactive')
|
||||
} else {
|
||||
addUserHeaderButton(user)
|
||||
}
|
||||
}
|
||||
sessions[session.session].location = session.location
|
||||
updateUserLocation(session.session)
|
||||
}
|
||||
}
|
||||
|
||||
function removeUserSession (sessionId, isDisconnected) {
|
||||
removeUserLocation(sessionId)
|
||||
const session = sessions[sessionId]
|
||||
delete sessions[sessionId]
|
||||
const user = users[session.user.username]
|
||||
const i = user.sessions.indexOf(session)
|
||||
user.sessions.splice(i, 1)
|
||||
if (isDisconnected) {
|
||||
removeUserHeaderButton(user)
|
||||
} else {
|
||||
if (user.sessions.length === 0) {
|
||||
// Give the user 5s to reconnect before marking inactive
|
||||
user.inactiveTimeout = setTimeout(() => {
|
||||
user.button.addClass('inactive')
|
||||
// Give the user further 20 seconds to reconnect before removing them
|
||||
// from the user toolbar entirely
|
||||
user.removeTimeout = setTimeout(() => {
|
||||
removeUserHeaderButton(user)
|
||||
}, 20000)
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addUserHeaderButton (user) {
|
||||
user.button = $('<li class="red-ui-multiplayer-user"><button type="button" class="red-ui-multiplayer-user-icon"></button></li>')
|
||||
.attr('data-username', user.user.username)
|
||||
.prependTo("#red-ui-multiplayer-user-list");
|
||||
var button = user.button.find("button")
|
||||
RED.popover.tooltip(button, user.user.username)
|
||||
button.on('click', function () {
|
||||
const location = user.sessions[0].location
|
||||
revealUser(location)
|
||||
})
|
||||
|
||||
const userProfile = RED.user.generateUserIcon(user.user)
|
||||
userProfile.appendTo(button)
|
||||
}
|
||||
|
||||
function removeUserHeaderButton (user) {
|
||||
user.button.remove()
|
||||
delete user.button
|
||||
}
|
||||
|
||||
function getLocation () {
|
||||
const location = {
|
||||
workspace: RED.workspaces.active()
|
||||
}
|
||||
const editStack = RED.editor.getEditStack()
|
||||
for (let i = editStack.length - 1; i >= 0; i--) {
|
||||
if (editStack[i].id) {
|
||||
location.node = editStack[i].id
|
||||
break
|
||||
}
|
||||
}
|
||||
return location
|
||||
}
|
||||
function publishLocation () {
|
||||
const location = getLocation()
|
||||
if (location.workspace !== 0) {
|
||||
log('send', 'multiplayer/location', location)
|
||||
RED.comms.send('multiplayer/location', location)
|
||||
}
|
||||
}
|
||||
|
||||
function revealUser(location, skipWorkspace) {
|
||||
if (location.node) {
|
||||
// Need to check if this is a known node, so we can fall back to revealing
|
||||
// the workspace instead
|
||||
const node = RED.nodes.node(location.node)
|
||||
if (node) {
|
||||
RED.view.reveal(location.node)
|
||||
} else if (!skipWorkspace && location.workspace) {
|
||||
RED.view.reveal(location.workspace)
|
||||
}
|
||||
} else if (!skipWorkspace && location.workspace) {
|
||||
RED.view.reveal(location.workspace)
|
||||
}
|
||||
}
|
||||
|
||||
const workspaceTrays = {}
|
||||
function getWorkspaceTray(workspaceId) {
|
||||
// console.log('get tray for',workspaceId)
|
||||
if (!workspaceTrays[workspaceId]) {
|
||||
const tray = $('<div class="red-ui-multiplayer-users-tray"></div>')
|
||||
const users = []
|
||||
const userIcons = {}
|
||||
|
||||
const userCountIcon = $(`<div class="red-ui-multiplayer-user-location"><span class="red-ui-user-profile red-ui-multiplayer-user-count"><span></span></span></div>`)
|
||||
const userCountSpan = userCountIcon.find('span span')
|
||||
userCountIcon.hide()
|
||||
userCountSpan.text('')
|
||||
userCountIcon.appendTo(tray)
|
||||
const userCountTooltip = RED.popover.tooltip(userCountIcon, function () {
|
||||
const content = $('<div>')
|
||||
users.forEach(sessionId => {
|
||||
$('<div>').append($('<a href="#">').text(sessions[sessionId].user.username).on('click', function (evt) {
|
||||
evt.preventDefault()
|
||||
revealUser(sessions[sessionId].location, true)
|
||||
userCountTooltip.close()
|
||||
})).appendTo(content)
|
||||
})
|
||||
return content
|
||||
},
|
||||
null,
|
||||
true
|
||||
)
|
||||
|
||||
const updateUserCount = function () {
|
||||
const maxShown = 2
|
||||
const children = tray.children()
|
||||
children.each(function (index, element) {
|
||||
const i = users.length - index
|
||||
if (i > maxShown) {
|
||||
$(this).hide()
|
||||
} else if (i >= 0) {
|
||||
$(this).show()
|
||||
}
|
||||
})
|
||||
if (users.length < maxShown + 1) {
|
||||
userCountIcon.hide()
|
||||
} else {
|
||||
userCountSpan.text('+'+(users.length - maxShown))
|
||||
userCountIcon.show()
|
||||
}
|
||||
}
|
||||
workspaceTrays[workspaceId] = {
|
||||
attached: false,
|
||||
tray,
|
||||
users,
|
||||
userIcons,
|
||||
addUser: function (sessionId) {
|
||||
if (users.indexOf(sessionId) === -1) {
|
||||
// console.log(`addUser ws:${workspaceId} session:${sessionId}`)
|
||||
users.push(sessionId)
|
||||
const userLocationId = `red-ui-multiplayer-user-location-${sessionId}`
|
||||
const userLocationIcon = $(`<div class="red-ui-multiplayer-user-location" id="${userLocationId}"></div>`)
|
||||
RED.user.generateUserIcon(sessions[sessionId].user).appendTo(userLocationIcon)
|
||||
userLocationIcon.prependTo(tray)
|
||||
RED.popover.tooltip(userLocationIcon, sessions[sessionId].user.username)
|
||||
userIcons[sessionId] = userLocationIcon
|
||||
updateUserCount()
|
||||
}
|
||||
},
|
||||
removeUser: function (sessionId) {
|
||||
// console.log(`removeUser ws:${workspaceId} session:${sessionId}`)
|
||||
const userLocationId = `red-ui-multiplayer-user-location-${sessionId}`
|
||||
const index = users.indexOf(sessionId)
|
||||
if (index > -1) {
|
||||
users.splice(index, 1)
|
||||
userIcons[sessionId].remove()
|
||||
delete userIcons[sessionId]
|
||||
}
|
||||
updateUserCount()
|
||||
},
|
||||
updateUserCount
|
||||
}
|
||||
}
|
||||
const trayDef = workspaceTrays[workspaceId]
|
||||
if (!trayDef.attached) {
|
||||
const workspaceTab = $(`#red-ui-tab-${workspaceId}`)
|
||||
if (workspaceTab.length > 0) {
|
||||
trayDef.attached = true
|
||||
trayDef.tray.appendTo(workspaceTab)
|
||||
trayDef.users.forEach(sessionId => {
|
||||
trayDef.userIcons[sessionId].on('click', function (evt) {
|
||||
revealUser(sessions[sessionId].location, true)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
return workspaceTrays[workspaceId]
|
||||
}
|
||||
function attachWorkspaceTrays () {
|
||||
let viewTouched = false
|
||||
for (let sessionId of Object.keys(sessions)) {
|
||||
const location = sessions[sessionId].location
|
||||
if (location) {
|
||||
if (location.workspace) {
|
||||
getWorkspaceTray(location.workspace).updateUserCount()
|
||||
}
|
||||
if (location.node) {
|
||||
addUserToNode(sessionId, location.node)
|
||||
viewTouched = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (viewTouched) {
|
||||
RED.view.redraw()
|
||||
}
|
||||
}
|
||||
|
||||
function addUserToNode(sessionId, nodeId) {
|
||||
const node = RED.nodes.node(nodeId)
|
||||
if (node) {
|
||||
if (!node._multiplayer) {
|
||||
node._multiplayer = {
|
||||
users: [sessionId]
|
||||
}
|
||||
node._multiplayer_refresh = true
|
||||
} else {
|
||||
if (node._multiplayer.users.indexOf(sessionId) === -1) {
|
||||
node._multiplayer.users.push(sessionId)
|
||||
node._multiplayer_refresh = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function removeUserFromNode(sessionId, nodeId) {
|
||||
const node = RED.nodes.node(nodeId)
|
||||
if (node && node._multiplayer) {
|
||||
const i = node._multiplayer.users.indexOf(sessionId)
|
||||
if (i > -1) {
|
||||
node._multiplayer.users.splice(i, 1)
|
||||
}
|
||||
if (node._multiplayer.users.length === 0) {
|
||||
delete node._multiplayer
|
||||
} else {
|
||||
node._multiplayer_refresh = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function removeUserLocation (sessionId) {
|
||||
updateUserLocation(sessionId, {})
|
||||
}
|
||||
function updateUserLocation (sessionId, location) {
|
||||
let viewTouched = false
|
||||
const oldLocation = sessions[sessionId].location
|
||||
if (location) {
|
||||
if (oldLocation.workspace !== location.workspace) {
|
||||
// console.log('removing', sessionId, oldLocation.workspace)
|
||||
workspaceTrays[oldLocation.workspace]?.removeUser(sessionId)
|
||||
}
|
||||
if (oldLocation.node !== location.node) {
|
||||
removeUserFromNode(sessionId, oldLocation.node)
|
||||
viewTouched = true
|
||||
}
|
||||
sessions[sessionId].location = location
|
||||
} else {
|
||||
location = sessions[sessionId].location
|
||||
}
|
||||
// console.log(`updateUserLocation sessionId:${sessionId} oldWS:${oldLocation?.workspace} newWS:${location.workspace}`)
|
||||
if (location.workspace) {
|
||||
getWorkspaceTray(location.workspace).addUser(sessionId)
|
||||
}
|
||||
if (location.node) {
|
||||
addUserToNode(sessionId, location.node)
|
||||
viewTouched = true
|
||||
}
|
||||
if (viewTouched) {
|
||||
RED.view.redraw()
|
||||
}
|
||||
}
|
||||
|
||||
// function refreshUserLocations () {
|
||||
// for (const session of Object.keys(sessions)) {
|
||||
// if (session !== activeSessionId) {
|
||||
// updateUserLocation(session)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
|
||||
function createAnnotationUser(user) {
|
||||
|
||||
const group = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
const badge = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
const radius = 20
|
||||
badge.setAttribute("cx",radius/2);
|
||||
badge.setAttribute("cy",radius/2);
|
||||
badge.setAttribute("r",radius/2);
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background")
|
||||
group.appendChild(badge)
|
||||
if (user && user.profileColor !== undefined) {
|
||||
badge.setAttribute("class", "red-ui-multiplayer-annotation-background red-ui-user-profile-color-" + user.profileColor)
|
||||
}
|
||||
if (user && user.image) {
|
||||
const image = document.createElementNS("http://www.w3.org/2000/svg","image");
|
||||
image.setAttribute("width", radius)
|
||||
image.setAttribute("height", radius)
|
||||
image.setAttribute("href", user.image)
|
||||
image.setAttribute("clip-path", "circle("+Math.floor(radius/2)+")")
|
||||
group.appendChild(image)
|
||||
} else if (user && user.anonymous) {
|
||||
const anonIconHead = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
anonIconHead.setAttribute("cx", radius/2)
|
||||
anonIconHead.setAttribute("cy", radius/2 - 2)
|
||||
anonIconHead.setAttribute("r", 2.4)
|
||||
anonIconHead.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
group.appendChild(anonIconHead)
|
||||
const anonIconBody = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
anonIconBody.setAttribute("class","red-ui-multiplayer-annotation-anon-label");
|
||||
// anonIconBody.setAttribute("d",`M ${radius/2 - 4} ${radius/2 + 1} h 8 v4 h -8 z`);
|
||||
anonIconBody.setAttribute("d",`M ${radius/2} ${radius/2 + 5} h -2.5 c -2 1 -2 -5 0.5 -4.5 c 2 1 2 1 4 0 c 2.5 -0.5 2.5 5.5 0 4.5 z`);
|
||||
group.appendChild(anonIconBody)
|
||||
} else {
|
||||
const labelText = user.username ? user.username.substring(0,2) : user
|
||||
const label = document.createElementNS("http://www.w3.org/2000/svg","text");
|
||||
if (user.username) {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label");
|
||||
label.textContent = user.username.substring(0,2)
|
||||
} else {
|
||||
label.setAttribute("class","red-ui-multiplayer-annotation-label red-ui-multiplayer-user-count")
|
||||
label.textContent = user
|
||||
}
|
||||
label.setAttribute("text-anchor", "middle")
|
||||
label.setAttribute("x",radius/2);
|
||||
label.setAttribute("y",radius/2 + 3);
|
||||
group.appendChild(label)
|
||||
}
|
||||
const border = document.createElementNS("http://www.w3.org/2000/svg","circle");
|
||||
border.setAttribute("cx",radius/2);
|
||||
border.setAttribute("cy",radius/2);
|
||||
border.setAttribute("r",radius/2);
|
||||
border.setAttribute("class", "red-ui-multiplayer-annotation-border")
|
||||
group.appendChild(border)
|
||||
|
||||
|
||||
|
||||
return group
|
||||
}
|
||||
|
||||
RED.view.annotations.register("red-ui-multiplayer",{
|
||||
type: 'badge',
|
||||
align: 'left',
|
||||
class: "red-ui-multiplayer-annotation",
|
||||
show: "_multiplayer",
|
||||
refresh: "_multiplayer_refresh",
|
||||
element: function(node) {
|
||||
const containerGroup = document.createElementNS("http://www.w3.org/2000/svg","g");
|
||||
containerGroup.setAttribute("transform","translate(0,-4)")
|
||||
if (node._multiplayer) {
|
||||
let y = 0
|
||||
for (let i = Math.min(1, node._multiplayer.users.length - 1); i >= 0; i--) {
|
||||
const user = sessions[node._multiplayer.users[i]].user
|
||||
const group = createAnnotationUser(user)
|
||||
group.setAttribute("transform","translate("+y+",0)")
|
||||
y += 15
|
||||
containerGroup.appendChild(group)
|
||||
}
|
||||
if (node._multiplayer.users.length > 2) {
|
||||
const group = createAnnotationUser('+'+(node._multiplayer.users.length - 2))
|
||||
group.setAttribute("transform","translate("+y+",0)")
|
||||
y += 12
|
||||
containerGroup.appendChild(group)
|
||||
}
|
||||
|
||||
}
|
||||
return containerGroup;
|
||||
},
|
||||
tooltip: node => { return node._multiplayer.users.map(u => sessions[u].user.username).join('\n') }
|
||||
});
|
||||
|
||||
|
||||
// activeSessionId = RED.settings.getLocal('multiplayer:sessionId')
|
||||
// if (!activeSessionId) {
|
||||
activeSessionId = RED.nodes.id()
|
||||
// RED.settings.setLocal('multiplayer:sessionId', activeSessionId)
|
||||
// log('Session ID (new)', activeSessionId)
|
||||
// } else {
|
||||
log('Session ID', activeSessionId)
|
||||
// }
|
||||
|
||||
headerWidget = $('<li><ul id="red-ui-multiplayer-user-list"></ul></li>').prependTo('.red-ui-header-toolbar')
|
||||
|
||||
RED.comms.on('connect', () => {
|
||||
const location = getLocation()
|
||||
const connectInfo = {
|
||||
session: activeSessionId
|
||||
}
|
||||
if (location.workspace !== 0) {
|
||||
connectInfo.location = location
|
||||
}
|
||||
RED.comms.send('multiplayer/connect', connectInfo)
|
||||
})
|
||||
RED.comms.subscribe('multiplayer/#', (topic, msg) => {
|
||||
log('recv', topic, msg)
|
||||
if (topic === 'multiplayer/init') {
|
||||
// We have just reconnected, runtime has sent state to
|
||||
// initialise the world
|
||||
sessions = {}
|
||||
users = {}
|
||||
$('#red-ui-multiplayer-user-list').empty()
|
||||
|
||||
msg.sessions.forEach(session => {
|
||||
addUserSession(session)
|
||||
})
|
||||
} else if (topic === 'multiplayer/connection-added') {
|
||||
addUserSession(msg)
|
||||
} else if (topic === 'multiplayer/connection-removed') {
|
||||
removeUserSession(msg.session, msg.disconnected)
|
||||
} else if (topic === 'multiplayer/location') {
|
||||
const session = msg.session
|
||||
delete msg.session
|
||||
updateUserLocation(session, msg)
|
||||
}
|
||||
})
|
||||
|
||||
RED.events.on('workspace:change', (event) => {
|
||||
getWorkspaceTray(event.workspace)
|
||||
publishLocation()
|
||||
})
|
||||
RED.events.on('editor:open', () => {
|
||||
publishLocation()
|
||||
})
|
||||
RED.events.on('editor:close', () => {
|
||||
publishLocation()
|
||||
})
|
||||
RED.events.on('editor:change', () => {
|
||||
publishLocation()
|
||||
})
|
||||
RED.events.on('login', () => {
|
||||
publishLocation()
|
||||
})
|
||||
RED.events.on('flows:loaded', () => {
|
||||
attachWorkspaceTrays()
|
||||
})
|
||||
RED.events.on('workspace:close', (event) => {
|
||||
// A subflow tab has been closed. Need to mark its tray as detached
|
||||
if (workspaceTrays[event.workspace]) {
|
||||
workspaceTrays[event.workspace].attached = false
|
||||
}
|
||||
})
|
||||
RED.events.on('logout', () => {
|
||||
const disconnectInfo = {
|
||||
session: activeSessionId
|
||||
}
|
||||
RED.comms.send('multiplayer/disconnect', disconnectInfo)
|
||||
RED.settings.removeLocal('multiplayer:sessionId')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function log() {
|
||||
if (RED.multiplayer.DEBUG) {
|
||||
console.log('[multiplayer]', ...arguments)
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -91,6 +91,31 @@ RED.nodes = (function() {
|
|||
getNodeTypes: function() {
|
||||
return Object.keys(nodeDefinitions);
|
||||
},
|
||||
/**
|
||||
* Get an array of node definitions
|
||||
* @param {Object} options - options object
|
||||
* @param {boolean} [options.configOnly] - if true, only return config nodes
|
||||
* @param {function} [options.filter] - a filter function to apply to the list of nodes
|
||||
* @returns array of node definitions
|
||||
*/
|
||||
getNodeDefinitions: function(options) {
|
||||
const result = []
|
||||
const configOnly = (options && options.configOnly)
|
||||
const filter = (options && options.filter)
|
||||
const keys = Object.keys(nodeDefinitions)
|
||||
for (const key of keys) {
|
||||
const def = nodeDefinitions[key]
|
||||
if(!def) { continue }
|
||||
if (configOnly && def.category !== "config") {
|
||||
continue
|
||||
}
|
||||
if (filter && !filter(nodeDefinitions[key])) {
|
||||
continue
|
||||
}
|
||||
result.push(nodeDefinitions[key])
|
||||
}
|
||||
return result
|
||||
},
|
||||
setNodeList: function(list) {
|
||||
nodeList = [];
|
||||
for(var i=0;i<list.length;i++) {
|
||||
|
@ -124,6 +149,8 @@ RED.nodes = (function() {
|
|||
},
|
||||
removeNodeSet: function(id) {
|
||||
var ns = nodeSets[id];
|
||||
if (!ns) { return {} }
|
||||
|
||||
for (var j=0;j<ns.types.length;j++) {
|
||||
delete typeToId[ns.types[j]];
|
||||
}
|
||||
|
@ -547,12 +574,16 @@ RED.nodes = (function() {
|
|||
* @param {String} z tab id
|
||||
*/
|
||||
checkTabState: function (z) {
|
||||
const ws = workspaces[z]
|
||||
const ws = workspaces[z] || subflows[z]
|
||||
if (ws) {
|
||||
const contentsChanged = tabDirtyMap[z].size > 0 || tabDeletedNodesMap[z].size > 0
|
||||
if (Boolean(ws.contentsChanged) !== contentsChanged) {
|
||||
ws.contentsChanged = contentsChanged
|
||||
RED.events.emit("flows:change", ws);
|
||||
if (ws.type === 'tab') {
|
||||
RED.events.emit("flows:change", ws);
|
||||
} else {
|
||||
RED.events.emit("subflows:change", ws);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1025,7 +1056,22 @@ RED.nodes = (function() {
|
|||
RED.nodes.registerType("subflow:"+sf.id, {
|
||||
defaults:{
|
||||
name:{value:""},
|
||||
env:{value:[]}
|
||||
env:{value:[], validate: function(value) {
|
||||
const errors = []
|
||||
if (value) {
|
||||
value.forEach(env => {
|
||||
const r = RED.utils.validateTypedProperty(env.value, env.type)
|
||||
if (r !== true) {
|
||||
errors.push(env.name+': '+r)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (errors.length === 0) {
|
||||
return true
|
||||
} else {
|
||||
return errors
|
||||
}
|
||||
}}
|
||||
},
|
||||
icon: function() { return sf.icon||"subflow.svg" },
|
||||
category: sf.category || "subflows",
|
||||
|
@ -1228,7 +1274,6 @@ RED.nodes = (function() {
|
|||
}
|
||||
}
|
||||
} else if (n.credentials) {
|
||||
node.credentials = {};
|
||||
// All other nodes have a well-defined list of possible credentials
|
||||
for (var cred in n._def.credentials) {
|
||||
if (n._def.credentials.hasOwnProperty(cred)) {
|
||||
|
@ -2217,7 +2262,7 @@ RED.nodes = (function() {
|
|||
set: registry.getNodeSet("node-red/unknown")
|
||||
}
|
||||
} else {
|
||||
if (createNewIds || options.importMap[n.id] === "copy") {
|
||||
if (subflow_denylist[parentId] || createNewIds || options.importMap[n.id] === "copy") {
|
||||
parentId = subflow.id;
|
||||
node.type = "subflow:"+parentId;
|
||||
node._def = registry.getNodeType(node.type);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
RED.plugins = (function() {
|
||||
var plugins = {};
|
||||
var pluginsByType = {};
|
||||
var moduleList = {};
|
||||
|
||||
function registerPlugin(id,definition) {
|
||||
plugins[id] = definition;
|
||||
|
@ -38,9 +39,43 @@ RED.plugins = (function() {
|
|||
function getPluginsByType(type) {
|
||||
return pluginsByType[type] || [];
|
||||
}
|
||||
|
||||
function setPluginList(list) {
|
||||
for(let i=0;i<list.length;i++) {
|
||||
let p = list[i];
|
||||
addPlugin(p);
|
||||
}
|
||||
}
|
||||
|
||||
function addPlugin(p) {
|
||||
|
||||
moduleList[p.module] = moduleList[p.module] || {
|
||||
name:p.module,
|
||||
version:p.version,
|
||||
local:p.local,
|
||||
sets:{},
|
||||
plugin: true,
|
||||
id: p.id
|
||||
};
|
||||
if (p.pending_version) {
|
||||
moduleList[p.module].pending_version = p.pending_version;
|
||||
}
|
||||
moduleList[p.module].sets[p.name] = p;
|
||||
|
||||
RED.events.emit("registry:plugin-module-added",p.module);
|
||||
}
|
||||
|
||||
function getModule(module) {
|
||||
return moduleList[module];
|
||||
}
|
||||
|
||||
return {
|
||||
registerPlugin: registerPlugin,
|
||||
getPlugin: getPlugin,
|
||||
getPluginsByType: getPluginsByType
|
||||
getPluginsByType: getPluginsByType,
|
||||
|
||||
setPluginList: setPluginList,
|
||||
addPlugin: addPlugin,
|
||||
getModule: getModule
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -25,6 +25,7 @@ var RED = (function() {
|
|||
cache: false,
|
||||
url: 'plugins',
|
||||
success: function(data) {
|
||||
RED.plugins.setPluginList(data);
|
||||
loader.reportProgress(RED._("event.loadPlugins"), 13)
|
||||
RED.i18n.loadPluginCatalogs(function() {
|
||||
loadPlugins(function() {
|
||||
|
@ -297,6 +298,7 @@ var RED = (function() {
|
|||
RED.workspaces.show(workspaces[0]);
|
||||
}
|
||||
}
|
||||
RED.events.emit('flows:loaded')
|
||||
} catch(err) {
|
||||
console.warn(err);
|
||||
RED.notify(
|
||||
|
@ -534,6 +536,41 @@ var RED = (function() {
|
|||
RED.view.redrawStatus(node);
|
||||
}
|
||||
});
|
||||
RED.comms.subscribe("notification/plugin/#",function(topic,msg) {
|
||||
if (topic == "notification/plugin/added") {
|
||||
RED.settings.refreshSettings(function(err, data) {
|
||||
let addedPlugins = [];
|
||||
msg.forEach(function(m) {
|
||||
let id = m.id;
|
||||
RED.plugins.addPlugin(m);
|
||||
|
||||
m.plugins.forEach((p) => {
|
||||
addedPlugins.push(p.id);
|
||||
})
|
||||
|
||||
RED.i18n.loadNodeCatalog(id, function() {
|
||||
var lang = localStorage.getItem("editor-language")||RED.i18n.detectLanguage();
|
||||
$.ajax({
|
||||
headers: {
|
||||
"Accept":"text/html",
|
||||
"Accept-Language": lang
|
||||
},
|
||||
cache: false,
|
||||
url: 'plugins/'+id,
|
||||
success: function(data) {
|
||||
appendPluginConfig(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
if (addedPlugins.length) {
|
||||
let pluginList = "<ul><li>"+addedPlugins.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
|
||||
// ToDo: Adapt notification (node -> plugin)
|
||||
RED.notify(RED._("palette.event.nodeAdded", {count:addedPlugins.length})+pluginList,"success");
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
let pendingNodeRemovedNotifications = []
|
||||
let pendingNodeRemovedTimeout
|
||||
|
@ -722,7 +759,7 @@ var RED = (function() {
|
|||
menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:"core:show-config-tab"});
|
||||
menuOptions.push({id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
|
||||
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:"core:add-flow"},
|
||||
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:"core:edit-flow"},
|
||||
{id:"menu-item-workspace-edit",label:RED._("menu.label.edit"),onselect:"core:edit-flow"},
|
||||
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:"core:remove-flow"}
|
||||
]});
|
||||
menuOptions.push({id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
|
||||
|
@ -803,6 +840,10 @@ var RED = (function() {
|
|||
|
||||
RED.nodes.init();
|
||||
RED.runtime.init()
|
||||
|
||||
if (RED.settings.theme("multiplayer.enabled",false)) {
|
||||
RED.multiplayer.init()
|
||||
}
|
||||
RED.comms.connect();
|
||||
|
||||
$("#red-ui-main-container").show();
|
||||
|
|
|
@ -819,7 +819,7 @@ RED.clipboard = (function() {
|
|||
flow.forEach(function(node) {
|
||||
if (node.type === "tab") {
|
||||
flows[node.id] = {
|
||||
element: getFlowLabel(node,false),
|
||||
element: getFlowLabel(node),
|
||||
deferBuild: type !== "flow",
|
||||
expanded: type === "flow",
|
||||
children: []
|
||||
|
@ -1000,7 +1000,6 @@ RED.clipboard = (function() {
|
|||
try {
|
||||
RED.view.importNodes(newNodes, importOptions);
|
||||
} catch(error) {
|
||||
console.log(error.importConfig)
|
||||
// Thrown for import_conflict
|
||||
confirmImport(error.importConfig, newNodes, importOptions);
|
||||
}
|
||||
|
@ -1170,9 +1169,9 @@ RED.clipboard = (function() {
|
|||
function getNodeElement(n, isConflicted, isSelected, parent) {
|
||||
var element;
|
||||
if (n.type === "tab") {
|
||||
element = getFlowLabel(n, isSelected);
|
||||
element = getFlowLabel(n, isConflicted);
|
||||
} else {
|
||||
element = getNodeLabel(n, isConflicted, isSelected);
|
||||
element = getNodeLabel(n, isConflicted, isSelected, parent);
|
||||
}
|
||||
var controls = $('<div>',{class:"red-ui-clipboard-dialog-import-conflicts-controls"}).appendTo(element);
|
||||
controls.on("click", function(evt) { evt.stopPropagation(); });
|
||||
|
@ -1222,14 +1221,14 @@ RED.clipboard = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
function getFlowLabel(n) {
|
||||
function getFlowLabel(n, isConflicted) {
|
||||
n = JSON.parse(JSON.stringify(n));
|
||||
n._def = RED.nodes.getType(n.type) || {};
|
||||
if (n._def) {
|
||||
n._ = n._def._;
|
||||
}
|
||||
|
||||
var div = $('<div>',{class:"red-ui-info-outline-item red-ui-info-outline-item-flow"});
|
||||
var div = $('<div>',{class:"red-ui-info-outline-item red-ui-info-outline-item-flow red-ui-node-list-item"});
|
||||
var contentDiv = $('<div>',{class:"red-ui-search-result-description red-ui-info-outline-item-label"}).appendTo(div);
|
||||
var label = (typeof n === "string")? n : n.label;
|
||||
var newlineIndex = label.indexOf("\\n");
|
||||
|
@ -1237,11 +1236,17 @@ RED.clipboard = (function() {
|
|||
label = label.substring(0,newlineIndex)+"...";
|
||||
}
|
||||
contentDiv.text(label);
|
||||
|
||||
if (!!isConflicted) {
|
||||
const conflictIcon = $('<span style="padding: 0 10px;"><i class="fa fa-exclamation-circle"></span>').appendTo(div)
|
||||
RED.popover.tooltip(conflictIcon, RED._('clipboard.import.alreadyExists'))
|
||||
}
|
||||
|
||||
// A conflicted flow should not be imported by default.
|
||||
return div;
|
||||
}
|
||||
|
||||
function getNodeLabel(n, isConflicted) {
|
||||
function getNodeLabel(n, isConflicted, isSelected, parent) {
|
||||
n = JSON.parse(JSON.stringify(n));
|
||||
n._def = RED.nodes.getType(n.type) || {};
|
||||
if (n._def) {
|
||||
|
@ -1249,6 +1254,11 @@ RED.clipboard = (function() {
|
|||
}
|
||||
var div = $('<div>',{class:"red-ui-node-list-item"});
|
||||
RED.utils.createNodeIcon(n,true).appendTo(div);
|
||||
|
||||
if (!parent && !!isConflicted) {
|
||||
const conflictIcon = $('<span style="padding: 0 10px;"><i class="fa fa-exclamation-circle"></span>').appendTo(div)
|
||||
RED.popover.tooltip(conflictIcon, RED._('clipboard.import.alreadyExists'))
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,12 +174,24 @@
|
|||
this.uiContainer.width(m[1]);
|
||||
}
|
||||
if (this.options.sortable) {
|
||||
var isCanceled = false; // Flag to track if an item has been canceled from being dropped into a different list
|
||||
var noDrop = false; // Flag to track if an item is being dragged into a different list
|
||||
var handle = (typeof this.options.sortable === 'string')?
|
||||
this.options.sortable :
|
||||
".red-ui-editableList-item-handle";
|
||||
var sortOptions = {
|
||||
axis: "y",
|
||||
update: function( event, ui ) {
|
||||
// dont trigger update if the item is being canceled
|
||||
const targetList = $(event.target);
|
||||
const draggedItem = ui.item;
|
||||
const draggedItemParent = draggedItem.parent();
|
||||
if (!targetList.is(draggedItemParent) && draggedItem.hasClass("red-ui-editableList-item-constrained")) {
|
||||
noDrop = true;
|
||||
}
|
||||
if (isCanceled || noDrop) {
|
||||
return;
|
||||
}
|
||||
if (that.options.sortItems) {
|
||||
that.options.sortItems(that.items());
|
||||
}
|
||||
|
@ -189,8 +201,32 @@
|
|||
tolerance: "pointer",
|
||||
forcePlaceholderSize:true,
|
||||
placeholder: "red-ui-editabelList-item-placeholder",
|
||||
start: function(e, ui){
|
||||
ui.placeholder.height(ui.item.height()-4);
|
||||
start: function (event, ui) {
|
||||
isCanceled = false;
|
||||
ui.placeholder.height(ui.item.height() - 4);
|
||||
ui.item.css('cursor', 'grabbing'); // TODO: this doesn't seem to work, use a class instead?
|
||||
},
|
||||
stop: function (event, ui) {
|
||||
ui.item.css('cursor', 'auto');
|
||||
},
|
||||
receive: function (event, ui) {
|
||||
if (ui.item.hasClass("red-ui-editableList-item-constrained")) {
|
||||
isCanceled = true;
|
||||
$(ui.sender).sortable('cancel');
|
||||
}
|
||||
},
|
||||
over: function (event, ui) {
|
||||
// if the dragged item is constrained, prevent it from being dropped into a different list
|
||||
const targetList = $(event.target);
|
||||
const draggedItem = ui.item;
|
||||
const draggedItemParent = draggedItem.parent();
|
||||
if (!targetList.is(draggedItemParent) && draggedItem.hasClass("red-ui-editableList-item-constrained")) {
|
||||
noDrop = true;
|
||||
draggedItem.css('cursor', 'no-drop'); // TODO: this doesn't seem to work, use a class instead?
|
||||
} else {
|
||||
noDrop = false;
|
||||
draggedItem.css('cursor', 'grabbing'); // TODO: this doesn't seem to work, use a class instead?
|
||||
}
|
||||
}
|
||||
};
|
||||
if (this.options.connectWith) {
|
||||
|
|
|
@ -212,7 +212,7 @@ RED.popover = (function() {
|
|||
closePopup(true);
|
||||
});
|
||||
}
|
||||
if (trigger === 'hover' && options.interactive) {
|
||||
if (/*trigger === 'hover' && */options.interactive) {
|
||||
div.on('mouseenter', function(e) {
|
||||
clearTimeout(timer);
|
||||
active = true;
|
||||
|
@ -446,9 +446,12 @@ RED.popover = (function() {
|
|||
|
||||
return {
|
||||
create: createPopover,
|
||||
tooltip: function(target,content, action) {
|
||||
tooltip: function(target,content, action, interactive) {
|
||||
var label = function() {
|
||||
var label = content;
|
||||
if (typeof content === 'function') {
|
||||
label = content()
|
||||
}
|
||||
if (action) {
|
||||
var shortcut = RED.keyboard.getShortcut(action);
|
||||
if (shortcut && shortcut.key) {
|
||||
|
@ -464,6 +467,7 @@ RED.popover = (function() {
|
|||
size: "small",
|
||||
direction: "bottom",
|
||||
content: label,
|
||||
interactive,
|
||||
delay: { show: 750, hide: 50 }
|
||||
});
|
||||
popover.getContent = function () {
|
||||
|
|
|
@ -365,7 +365,10 @@ RED.tabs = (function() {
|
|||
|
||||
var thisTabA = thisTab.find("a");
|
||||
if (options.onclick) {
|
||||
options.onclick(tabs[thisTabA.attr('href').slice(1)]);
|
||||
options.onclick(tabs[thisTabA.attr('href').slice(1)], evt);
|
||||
if (evt.isDefaultPrevented() && evt.isPropagationStopped()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
activateTab(thisTabA);
|
||||
if (fireSelectionChanged) {
|
||||
|
@ -548,6 +551,8 @@ RED.tabs = (function() {
|
|||
ul.find("li.red-ui-tab a")
|
||||
.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||
.on("mouseup",onTabClick)
|
||||
// prevent browser-default middle-click behaviour
|
||||
.on("auxclick", function(evt) { evt.preventDefault() })
|
||||
.on("click", function(evt) {evt.preventDefault(); })
|
||||
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
|
||||
|
||||
|
@ -816,6 +821,8 @@ RED.tabs = (function() {
|
|||
}
|
||||
link.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
|
||||
link.on("mouseup",onTabClick);
|
||||
// prevent browser-default middle-click behaviour
|
||||
link.on("auxclick", function(evt) { evt.preventDefault() })
|
||||
link.on("click", function(evt) { evt.preventDefault(); })
|
||||
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
|
||||
|
||||
|
|
|
@ -54,25 +54,26 @@
|
|||
return icon;
|
||||
}
|
||||
|
||||
var autoComplete = function(options) {
|
||||
function getMatch(value, searchValue) {
|
||||
const idx = value.toLowerCase().indexOf(searchValue.toLowerCase());
|
||||
const len = idx > -1 ? searchValue.length : 0;
|
||||
return {
|
||||
index: idx,
|
||||
found: idx > -1,
|
||||
pre: value.substring(0,idx),
|
||||
match: value.substring(idx,idx+len),
|
||||
post: value.substring(idx+len),
|
||||
}
|
||||
}
|
||||
function generateSpans(match) {
|
||||
const els = [];
|
||||
if(match.pre) { els.push($('<span/>').text(match.pre)); }
|
||||
if(match.match) { els.push($('<span/>',{style:"font-weight: bold; color: var(--red-ui-text-color-link);"}).text(match.match)); }
|
||||
if(match.post) { els.push($('<span/>').text(match.post)); }
|
||||
return els;
|
||||
function getMatch(value, searchValue) {
|
||||
const idx = value.toLowerCase().indexOf(searchValue.toLowerCase());
|
||||
const len = idx > -1 ? searchValue.length : 0;
|
||||
return {
|
||||
index: idx,
|
||||
found: idx > -1,
|
||||
pre: value.substring(0,idx),
|
||||
match: value.substring(idx,idx+len),
|
||||
post: value.substring(idx+len),
|
||||
}
|
||||
}
|
||||
function generateSpans(match) {
|
||||
const els = [];
|
||||
if(match.pre) { els.push($('<span/>').text(match.pre)); }
|
||||
if(match.match) { els.push($('<span/>',{style:"font-weight: bold; color: var(--red-ui-text-color-link);"}).text(match.match)); }
|
||||
if(match.post) { els.push($('<span/>').text(match.post)); }
|
||||
return els;
|
||||
}
|
||||
|
||||
const msgAutoComplete = function(options) {
|
||||
return function(val) {
|
||||
var matches = [];
|
||||
options.forEach(opt => {
|
||||
|
@ -102,6 +103,197 @@
|
|||
}
|
||||
}
|
||||
|
||||
function getEnvVars (obj, envVars = {}) {
|
||||
contextKnownKeys.env = contextKnownKeys.env || {}
|
||||
if (contextKnownKeys.env[obj.id]) {
|
||||
return contextKnownKeys.env[obj.id]
|
||||
}
|
||||
let parent
|
||||
if (obj.type === 'tab' || obj.type === 'subflow') {
|
||||
RED.nodes.eachConfig(function (conf) {
|
||||
if (conf.type === "global-config") {
|
||||
parent = conf;
|
||||
}
|
||||
})
|
||||
} else if (obj.g) {
|
||||
parent = RED.nodes.group(obj.g)
|
||||
} else if (obj.z) {
|
||||
parent = RED.nodes.workspace(obj.z) || RED.nodes.subflow(obj.z)
|
||||
}
|
||||
if (parent) {
|
||||
getEnvVars(parent, envVars)
|
||||
}
|
||||
if (obj.env) {
|
||||
obj.env.forEach(env => {
|
||||
envVars[env.name] = obj
|
||||
})
|
||||
}
|
||||
contextKnownKeys.env[obj.id] = envVars
|
||||
return envVars
|
||||
}
|
||||
|
||||
const envAutoComplete = function (val) {
|
||||
const editStack = RED.editor.getEditStack()
|
||||
if (editStack.length === 0) {
|
||||
done([])
|
||||
return
|
||||
}
|
||||
const editingNode = editStack.pop()
|
||||
if (!editingNode) {
|
||||
return []
|
||||
}
|
||||
const envVarsMap = getEnvVars(editingNode)
|
||||
const envVars = Object.keys(envVarsMap)
|
||||
const matches = []
|
||||
const i = val.lastIndexOf('${')
|
||||
let searchKey = val
|
||||
let isSubkey = false
|
||||
if (i > -1) {
|
||||
if (val.lastIndexOf('}') < i) {
|
||||
searchKey = val.substring(i+2)
|
||||
isSubkey = true
|
||||
}
|
||||
}
|
||||
envVars.forEach(v => {
|
||||
let valMatch = getMatch(v, searchKey);
|
||||
if (valMatch.found) {
|
||||
const optSrc = envVarsMap[v]
|
||||
const element = $('<div>',{style: "display: flex"});
|
||||
const valEl = $('<div/>',{style:"font-family: var(--red-ui-monospace-font); white-space:nowrap; overflow: hidden; flex-grow:1"});
|
||||
valEl.append(generateSpans(valMatch))
|
||||
valEl.appendTo(element)
|
||||
|
||||
if (optSrc) {
|
||||
const optEl = $('<div>').css({ "font-size": "0.8em" });
|
||||
let label
|
||||
if (optSrc.type === 'global-config') {
|
||||
label = RED._('sidebar.context.global')
|
||||
} else if (optSrc.type === 'group') {
|
||||
label = RED.utils.getNodeLabel(optSrc) || (RED._('sidebar.info.group') + ': '+optSrc.id)
|
||||
} else {
|
||||
label = RED.utils.getNodeLabel(optSrc) || optSrc.id
|
||||
}
|
||||
|
||||
optEl.append(generateSpans({ match: label }));
|
||||
optEl.appendTo(element);
|
||||
}
|
||||
matches.push({
|
||||
value: isSubkey ? val + v + '}' : v,
|
||||
label: element,
|
||||
i: valMatch.index
|
||||
});
|
||||
}
|
||||
})
|
||||
matches.sort(function(A,B){return A.i-B.i})
|
||||
return matches
|
||||
}
|
||||
|
||||
let contextKnownKeys = {}
|
||||
let contextCache = {}
|
||||
if (RED.events) {
|
||||
RED.events.on("editor:close", function () {
|
||||
contextCache = {}
|
||||
contextKnownKeys = {}
|
||||
});
|
||||
}
|
||||
|
||||
const contextAutoComplete = function() {
|
||||
const that = this
|
||||
const getContextKeysFromRuntime = function(scope, store, searchKey, done) {
|
||||
contextKnownKeys[scope] = contextKnownKeys[scope] || {}
|
||||
contextKnownKeys[scope][store] = contextKnownKeys[scope][store] || new Set()
|
||||
if (searchKey.length > 0) {
|
||||
try {
|
||||
RED.utils.normalisePropertyExpression(searchKey)
|
||||
} catch (err) {
|
||||
// Not a valid context key, so don't try looking up
|
||||
done()
|
||||
return
|
||||
}
|
||||
}
|
||||
const url = `context/${scope}/${encodeURIComponent(searchKey)}?store=${store}&keysOnly`
|
||||
if (contextCache[url]) {
|
||||
// console.log('CACHED', url)
|
||||
done()
|
||||
} else {
|
||||
// console.log('GET', url)
|
||||
$.getJSON(url, function(data) {
|
||||
// console.log(data)
|
||||
contextCache[url] = true
|
||||
const result = data[store] || {}
|
||||
const keys = result.keys || []
|
||||
const keyPrefix = searchKey + (searchKey.length > 0 ? '.' : '')
|
||||
keys.forEach(key => {
|
||||
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(key)) {
|
||||
contextKnownKeys[scope][store].add(keyPrefix + key)
|
||||
} else {
|
||||
contextKnownKeys[scope][store].add(searchKey + "[\""+key.replace(/"/,"\\\"")+"\"]")
|
||||
}
|
||||
})
|
||||
done()
|
||||
})
|
||||
}
|
||||
}
|
||||
const getContextKeys = function(key, done) {
|
||||
const keyParts = key.split('.')
|
||||
const partialKey = keyParts.pop()
|
||||
let scope = that.propertyType
|
||||
if (scope === 'flow') {
|
||||
// Get the flow id of the node we're editing
|
||||
const editStack = RED.editor.getEditStack()
|
||||
if (editStack.length === 0) {
|
||||
done([])
|
||||
return
|
||||
}
|
||||
const editingNode = editStack.pop()
|
||||
if (editingNode.z) {
|
||||
scope = `${scope}/${editingNode.z}`
|
||||
} else {
|
||||
done([])
|
||||
return
|
||||
}
|
||||
}
|
||||
const store = (contextStoreOptions.length === 1) ? contextStoreOptions[0].value : that.optionValue
|
||||
const searchKey = keyParts.join('.')
|
||||
|
||||
getContextKeysFromRuntime(scope, store, searchKey, function() {
|
||||
if (contextKnownKeys[scope][store].has(key) || key.endsWith(']')) {
|
||||
getContextKeysFromRuntime(scope, store, key, function() {
|
||||
done(contextKnownKeys[scope][store])
|
||||
})
|
||||
}
|
||||
done(contextKnownKeys[scope][store])
|
||||
})
|
||||
}
|
||||
|
||||
return function(val, done) {
|
||||
getContextKeys(val, function (keys) {
|
||||
const matches = []
|
||||
keys.forEach(v => {
|
||||
let optVal = v
|
||||
let valMatch = getMatch(optVal, val);
|
||||
if (!valMatch.found && val.length > 0 && val.endsWith('.')) {
|
||||
// Search key ends in '.' - but doesn't match. Check again
|
||||
// with [" at the end instead so we match bracket notation
|
||||
valMatch = getMatch(optVal, val.substring(0, val.length - 1) + '["')
|
||||
}
|
||||
if (valMatch.found) {
|
||||
const element = $('<div>',{style: "display: flex"});
|
||||
const valEl = $('<div/>',{style:"font-family: var(--red-ui-monospace-font); white-space:nowrap; overflow: hidden; flex-grow:1"});
|
||||
valEl.append(generateSpans(valMatch))
|
||||
valEl.appendTo(element)
|
||||
matches.push({
|
||||
value: optVal,
|
||||
label: element,
|
||||
});
|
||||
}
|
||||
})
|
||||
matches.sort(function(a, b) { return a.value.localeCompare(b.value) });
|
||||
done(matches);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// This is a hand-generated list of completions for the core nodes (based on the node help html).
|
||||
var msgCompletions = [
|
||||
{ value: "payload" },
|
||||
|
@ -166,14 +358,14 @@
|
|||
{ value: "_session", source: ["websocket out","tcp out"] },
|
||||
]
|
||||
var allOptions = {
|
||||
msg: { value: "msg", label: "msg.", validate: RED.utils.validatePropertyExpression, autoComplete: autoComplete(msgCompletions) },
|
||||
flow: {
|
||||
value: "flow", label: "flow.", hasValue: true,
|
||||
msg: { value: "msg", label: "msg.", validate: RED.utils.validatePropertyExpression, autoComplete: msgAutoComplete(msgCompletions) },
|
||||
flow: { value: "flow", label: "flow.", hasValue: true,
|
||||
options: [],
|
||||
validate: RED.utils.validatePropertyExpression,
|
||||
parse: contextParse,
|
||||
export: contextExport,
|
||||
valueLabel: contextLabel
|
||||
valueLabel: contextLabel,
|
||||
autoComplete: contextAutoComplete
|
||||
},
|
||||
global: {
|
||||
value: "global", label: "global.", hasValue: true,
|
||||
|
@ -181,7 +373,8 @@
|
|||
validate: RED.utils.validatePropertyExpression,
|
||||
parse: contextParse,
|
||||
export: contextExport,
|
||||
valueLabel: contextLabel
|
||||
valueLabel: contextLabel,
|
||||
autoComplete: contextAutoComplete
|
||||
},
|
||||
str: { value: "str", label: "string", icon: "red/images/typedInput/az.svg" },
|
||||
num: { value: "num", label: "number", icon: "red/images/typedInput/09.svg", validate: function (v, o) {
|
||||
|
@ -218,7 +411,25 @@
|
|||
}
|
||||
},
|
||||
re: { value: "re", label: "regular expression", icon: "red/images/typedInput/re.svg" },
|
||||
date: { value: "date", label: "timestamp", icon: "fa fa-clock-o", hasValue: false },
|
||||
date: {
|
||||
value: "date",
|
||||
label: "timestamp",
|
||||
icon: "fa fa-clock-o",
|
||||
options: [
|
||||
{
|
||||
label: 'milliseconds since epoch',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: 'YYYY-MM-DDTHH:mm:ss.sssZ',
|
||||
value: 'iso'
|
||||
},
|
||||
{
|
||||
label: 'JavaScript Date Object',
|
||||
value: 'object'
|
||||
}
|
||||
]
|
||||
},
|
||||
jsonata: {
|
||||
value: "jsonata",
|
||||
label: "expression",
|
||||
|
@ -257,7 +468,8 @@
|
|||
env: {
|
||||
value: "env",
|
||||
label: "env variable",
|
||||
icon: "red/images/typedInput/env.svg"
|
||||
icon: "red/images/typedInput/env.svg",
|
||||
autoComplete: envAutoComplete
|
||||
},
|
||||
node: {
|
||||
value: "node",
|
||||
|
@ -389,18 +601,75 @@
|
|||
eyeButton.show();
|
||||
}
|
||||
}
|
||||
},
|
||||
'conf-types': {
|
||||
value: "conf-types",
|
||||
label: "config",
|
||||
icon: "fa fa-cog",
|
||||
// hasValue: false,
|
||||
valueLabel: function (container, value) {
|
||||
// get the selected option (for access to the "name" and "module" properties)
|
||||
const _options = this._optionsCache || this.typeList.find(opt => opt.value === value)?.options || []
|
||||
const selectedOption = _options.find(opt => opt.value === value) || {
|
||||
title: '',
|
||||
name: '',
|
||||
module: ''
|
||||
}
|
||||
container.attr("title", selectedOption.title) // set tooltip to the full path/id of the module/node
|
||||
container.text(selectedOption.name) // apply the "name" of the selected option
|
||||
// set "line-height" such as to make the "name" appear further up, giving room for the "module" to be displayed below the value
|
||||
container.css("line-height", "1.4em")
|
||||
// add the module name in smaller, lighter font below the value
|
||||
$('<div></div>').text(selectedOption.module).css({
|
||||
// "font-family": "var(--red-ui-monospace-font)",
|
||||
color: "var(--red-ui-tertiary-text-color)",
|
||||
"font-size": "0.8em",
|
||||
"line-height": "1em",
|
||||
opacity: 0.8
|
||||
}).appendTo(container);
|
||||
},
|
||||
// hasValue: false,
|
||||
options: function () {
|
||||
if (this._optionsCache) {
|
||||
return this._optionsCache
|
||||
}
|
||||
const configNodes = RED.nodes.registry.getNodeDefinitions({configOnly: true, filter: (def) => def.type !== "global-config"}).map((def) => {
|
||||
// create a container with with 2 rows (row 1 for the name, row 2 for the module name in smaller, lighter font)
|
||||
const container = $('<div style="display: flex; flex-direction: column; justify-content: space-between; row-gap: 1px;">')
|
||||
const row1Name = $('<div>').text(def.type)
|
||||
const row2Module = $('<div style="font-size: 0.8em; color: var(--red-ui-tertiary-text-color);">').text(def.set.module)
|
||||
container.append(row1Name, row2Module)
|
||||
|
||||
return {
|
||||
value: def.type,
|
||||
name: def.type,
|
||||
enabled: def.set.enabled ?? true,
|
||||
local: def.set.local,
|
||||
title: def.set.id, // tooltip e.g. "node-red-contrib-foo/bar"
|
||||
module: def.set.module,
|
||||
icon: container[0].outerHTML.trim(), // the typeInput will interpret this as html text and render it in the anchor
|
||||
}
|
||||
})
|
||||
this._optionsCache = configNodes
|
||||
return configNodes
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// For a type with options, check value is a valid selection
|
||||
// If !opt.multiple, returns the valid option object
|
||||
// if opt.multiple, returns an array of valid option objects
|
||||
// If not valid, returns null;
|
||||
|
||||
function isOptionValueValid(opt, currentVal) {
|
||||
let _options = opt.options
|
||||
if (typeof _options === "function") {
|
||||
_options = _options.call(this)
|
||||
}
|
||||
if (!opt.multiple) {
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
for (var i=0;i<_options.length;i++) {
|
||||
op = _options[i];
|
||||
if (typeof op === "string" && op === currentVal) {
|
||||
return {value:currentVal}
|
||||
} else if (op.value === currentVal) {
|
||||
|
@ -417,8 +686,8 @@
|
|||
currentValues[v] = true;
|
||||
}
|
||||
});
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
for (var i=0;i<_options.length;i++) {
|
||||
op = _options[i];
|
||||
var val = typeof op === "string" ? op : op.value;
|
||||
if (currentValues.hasOwnProperty(val)) {
|
||||
delete currentValues[val];
|
||||
|
@ -433,6 +702,7 @@
|
|||
}
|
||||
|
||||
var nlsd = false;
|
||||
let contextStoreOptions;
|
||||
|
||||
$.widget( "nodered.typedInput", {
|
||||
_create: function() {
|
||||
|
@ -444,7 +714,7 @@
|
|||
}
|
||||
}
|
||||
var contextStores = RED.settings.context.stores;
|
||||
var contextOptions = contextStores.map(function(store) {
|
||||
contextStoreOptions = contextStores.map(function(store) {
|
||||
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database"></i>'}
|
||||
}).sort(function(A,B) {
|
||||
if (A.value === RED.settings.context.default) {
|
||||
|
@ -455,13 +725,17 @@
|
|||
return A.value.localeCompare(B.value);
|
||||
}
|
||||
})
|
||||
if (contextOptions.length < 2) {
|
||||
if (contextStoreOptions.length < 2) {
|
||||
allOptions.flow.options = [];
|
||||
allOptions.global.options = [];
|
||||
} else {
|
||||
allOptions.flow.options = contextOptions;
|
||||
allOptions.global.options = contextOptions;
|
||||
allOptions.flow.options = contextStoreOptions;
|
||||
allOptions.global.options = contextStoreOptions;
|
||||
}
|
||||
// Translate timestamp options
|
||||
allOptions.date.options.forEach(opt => {
|
||||
opt.label = RED._("typedInput.date.format." + (opt.value || 'timestamp'), {defaultValue: opt.label})
|
||||
})
|
||||
}
|
||||
nlsd = true;
|
||||
var that = this;
|
||||
|
@ -550,7 +824,7 @@
|
|||
that.element.trigger('paste',evt);
|
||||
});
|
||||
this.input.on('keydown', function(evt) {
|
||||
if (that.typeMap[that.propertyType].autoComplete) {
|
||||
if (that.typeMap[that.propertyType].autoComplete || that.input.hasClass('red-ui-autoComplete')) {
|
||||
return
|
||||
}
|
||||
if (evt.keyCode >= 37 && evt.keyCode <= 40) {
|
||||
|
@ -844,7 +1118,9 @@
|
|||
if (this.optionMenu) {
|
||||
this.optionMenu.remove();
|
||||
}
|
||||
this.menu.remove();
|
||||
if (this.menu) {
|
||||
this.menu.remove();
|
||||
}
|
||||
this.uiSelect.remove();
|
||||
},
|
||||
types: function(types) {
|
||||
|
@ -877,7 +1153,7 @@
|
|||
this.menu = this._createMenu(this.typeList,{},function(v) { that.type(v) });
|
||||
if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
|
||||
if (!firstCall) {
|
||||
this.type(this.typeList[0].value);
|
||||
this.type(this.typeList[0]?.value || ""); // permit empty typeList
|
||||
}
|
||||
} else {
|
||||
this.propertyType = null;
|
||||
|
@ -914,6 +1190,11 @@
|
|||
var selectedOption = [];
|
||||
var valueToCheck = value;
|
||||
if (opt.options) {
|
||||
let _options = opt.options
|
||||
if (typeof opt.options === "function") {
|
||||
_options = opt.options.call(this)
|
||||
}
|
||||
|
||||
if (opt.hasValue && opt.parse) {
|
||||
var parts = opt.parse(value);
|
||||
if (this.options.debug) { console.log(this.identifier,"new parse",parts) }
|
||||
|
@ -927,8 +1208,8 @@
|
|||
checkValues = valueToCheck.split(",");
|
||||
}
|
||||
checkValues.forEach(function(valueToCheck) {
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
var op = opt.options[i];
|
||||
for (var i=0;i<_options.length;i++) {
|
||||
var op = _options[i];
|
||||
if (typeof op === "string") {
|
||||
if (op === valueToCheck || op === ""+valueToCheck) {
|
||||
selectedOption.push(that.activeOptions[op]);
|
||||
|
@ -963,7 +1244,7 @@
|
|||
},
|
||||
type: function(type) {
|
||||
if (!arguments.length) {
|
||||
return this.propertyType;
|
||||
return this.propertyType || this.options?.default || '';
|
||||
} else {
|
||||
var that = this;
|
||||
if (this.options.debug) { console.log(this.identifier,"----- SET TYPE -----",type) }
|
||||
|
@ -973,6 +1254,9 @@
|
|||
// If previousType is !null, then this is a change of the type, rather than the initialisation
|
||||
var previousType = this.typeMap[this.propertyType];
|
||||
previousValue = this.input.val();
|
||||
if (this.input.hasClass('red-ui-autoComplete')) {
|
||||
this.input.autoComplete("destroy");
|
||||
}
|
||||
|
||||
if (previousType && this.typeChanged) {
|
||||
if (this.options.debug) { console.log(this.identifier,"typeChanged",{previousType,previousValue}) }
|
||||
|
@ -1019,7 +1303,9 @@
|
|||
this.input.val(this.oldValues.hasOwnProperty("_")?this.oldValues["_"]:(opt.default||""))
|
||||
}
|
||||
if (previousType.autoComplete) {
|
||||
this.input.autoComplete("destroy");
|
||||
if (this.input.hasClass('red-ui-autoComplete')) {
|
||||
this.input.autoComplete("destroy");
|
||||
}
|
||||
}
|
||||
}
|
||||
this.propertyType = type;
|
||||
|
@ -1059,6 +1345,10 @@
|
|||
this.optionMenu = null;
|
||||
}
|
||||
if (opt.options) {
|
||||
let _options = opt.options
|
||||
if (typeof _options === "function") {
|
||||
_options = opt.options.call(this);
|
||||
}
|
||||
if (this.optionExpandButton) {
|
||||
this.optionExpandButton.hide();
|
||||
this.optionExpandButton.shown = false;
|
||||
|
@ -1075,7 +1365,7 @@
|
|||
this.valueLabelContainer.hide();
|
||||
}
|
||||
this.activeOptions = {};
|
||||
opt.options.forEach(function(o) {
|
||||
_options.forEach(function(o) {
|
||||
if (typeof o === 'string') {
|
||||
that.activeOptions[o] = {label:o,value:o};
|
||||
} else {
|
||||
|
@ -1095,7 +1385,7 @@
|
|||
if (validValues) {
|
||||
that._updateOptionSelectLabel(validValues)
|
||||
} else {
|
||||
op = opt.options[0];
|
||||
op = _options[0] || {value:""}; // permit zero options
|
||||
if (typeof op === "string") {
|
||||
this.value(op);
|
||||
that._updateOptionSelectLabel({value:op});
|
||||
|
@ -1114,7 +1404,7 @@
|
|||
that._updateOptionSelectLabel(validValues);
|
||||
}
|
||||
} else {
|
||||
var selectedOption = this.optionValue||opt.options[0];
|
||||
var selectedOption = this.optionValue||_options[0];
|
||||
if (opt.parse) {
|
||||
var selectedOptionObj = typeof selectedOption === "string"?{value:selectedOption}:selectedOption
|
||||
var parts = opt.parse(this.input.val(),selectedOptionObj);
|
||||
|
@ -1147,8 +1437,18 @@
|
|||
} else {
|
||||
this.optionSelectTrigger.hide();
|
||||
}
|
||||
if (opt.autoComplete) {
|
||||
let searchFunction = opt.autoComplete
|
||||
if (searchFunction.length === 0) {
|
||||
searchFunction = opt.autoComplete.call(this)
|
||||
}
|
||||
this.input.autoComplete({
|
||||
search: searchFunction,
|
||||
minLength: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
this.optionMenu = this._createMenu(opt.options,opt,function(v){
|
||||
this.optionMenu = this._createMenu(_options,opt,function(v){
|
||||
if (!opt.multiple) {
|
||||
that._updateOptionSelectLabel(that.activeOptions[v]);
|
||||
if (!opt.hasValue) {
|
||||
|
@ -1189,8 +1489,12 @@
|
|||
this.valueLabelContainer.hide();
|
||||
this.elementDiv.show();
|
||||
if (opt.autoComplete) {
|
||||
let searchFunction = opt.autoComplete
|
||||
if (searchFunction.length === 0) {
|
||||
searchFunction = opt.autoComplete.call(this)
|
||||
}
|
||||
this.input.autoComplete({
|
||||
search: opt.autoComplete,
|
||||
search: searchFunction,
|
||||
minLength: 0
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,8 +30,26 @@ RED.contextMenu = (function () {
|
|||
const isGroup = hasSelection && selection.nodes.length === 1 && selection.nodes[0].type === 'group'
|
||||
const canEdit = !RED.workspaces.isLocked()
|
||||
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
||||
const isAllGroups = hasSelection && selection.nodes.filter(n => n.type !== 'group').length === 0
|
||||
const hasGroup = hasSelection && selection.nodes.filter(n => n.type === 'group' ).length > 0
|
||||
let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
|
||||
if (hasSelection) {
|
||||
selection.nodes.forEach(n => {
|
||||
if (n.type === 'group') {
|
||||
hasGroup = true;
|
||||
} else {
|
||||
isAllGroups = false;
|
||||
}
|
||||
if (n.d) {
|
||||
hasDisabledNode = true;
|
||||
} else {
|
||||
hasEnabledNode = true;
|
||||
}
|
||||
if (n.l === undefined || n.l) {
|
||||
hasLabeledNode = true;
|
||||
} else {
|
||||
hasUnlabeledNode = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
const offset = $("#red-ui-workspace-chart").offset()
|
||||
|
||||
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
||||
|
@ -55,7 +73,7 @@ RED.contextMenu = (function () {
|
|||
onselect: function () {
|
||||
RED.view.showQuickAddDialog({
|
||||
position: [addX, addY],
|
||||
touchTrigger: true,
|
||||
touchTrigger: 'ontouchstart' in window,
|
||||
splice: isSingleLink ? selection.links[0] : undefined,
|
||||
// spliceMultiple: isMultipleLinks
|
||||
})
|
||||
|
@ -100,10 +118,16 @@ RED.contextMenu = (function () {
|
|||
onselect: 'core:split-wire-with-link-nodes',
|
||||
disabled: !canEdit || !hasLinks
|
||||
},
|
||||
null,
|
||||
{ onselect: 'core:show-import-dialog', label: RED._('common.label.import')},
|
||||
{ onselect: 'core:show-examples-import-dialog', label: RED._('menu.label.importExample') }
|
||||
null
|
||||
)
|
||||
if (RED.settings.theme("menu.menu-item-import-library", true)) {
|
||||
insertOptions.push(
|
||||
{ onselect: 'core:show-import-dialog', label: RED._('common.label.import')},
|
||||
{ onselect: 'core:show-examples-import-dialog', label: RED._('menu.label.importExample') }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if (hasSelection && canEdit) {
|
||||
const nodeOptions = []
|
||||
if (!hasMultipleSelection && !isGroup) {
|
||||
|
@ -113,11 +137,11 @@ RED.contextMenu = (function () {
|
|||
)
|
||||
}
|
||||
nodeOptions.push(
|
||||
{ onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes') },
|
||||
{ onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes') },
|
||||
{ onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes'), disabled: !hasDisabledNode },
|
||||
{ onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes'), disabled: !hasEnabledNode },
|
||||
null,
|
||||
{ onselect: 'core:show-selected-node-labels', label: RED._('menu.label.showSelectedNodeLabels') },
|
||||
{ onselect: 'core:hide-selected-node-labels', label: RED._('menu.label.hideSelectedNodeLabels') }
|
||||
{ onselect: 'core:show-selected-node-labels', label: RED._('menu.label.showSelectedNodeLabels'), disabled: !hasUnlabeledNode },
|
||||
{ onselect: 'core:hide-selected-node-labels', label: RED._('menu.label.hideSelectedNodeLabels'), disabled: !hasLabeledNode }
|
||||
)
|
||||
menuItems.push({
|
||||
label: RED._('sidebar.info.node'),
|
||||
|
@ -176,8 +200,14 @@ RED.contextMenu = (function () {
|
|||
{ onselect: 'core:paste-from-internal-clipboard', label: RED._("keyboard.pasteNode"), disabled: !canEdit || !RED.view.clipboard() },
|
||||
{ onselect: 'core:delete-selection', label: RED._('keyboard.deleteSelected'), disabled: !canEdit || !canDelete },
|
||||
{ onselect: 'core:delete-selection-and-reconnect', label: RED._('keyboard.deleteReconnect'), disabled: !canEdit || !canDelete },
|
||||
{ onselect: 'core:show-export-dialog', label: RED._("menu.label.export") },
|
||||
{ onselect: 'core:select-all-nodes', label: RED._("keyboard.selectAll") },
|
||||
)
|
||||
if (RED.settings.theme("menu.menu-item-export-library", true)) {
|
||||
menuItems.push(
|
||||
{ onselect: 'core:show-export-dialog', label: RED._("menu.label.export") }
|
||||
)
|
||||
}
|
||||
menuItems.push(
|
||||
{ onselect: 'core:select-all-nodes', label: RED._("keyboard.selectAll") }
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ RED.deploy = (function() {
|
|||
|
||||
var currentDiff = null;
|
||||
|
||||
var activeBackgroundDeployNotification;
|
||||
|
||||
function changeDeploymentType(type) {
|
||||
deploymentType = type;
|
||||
$("#red-ui-header-button-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
|
@ -61,7 +63,7 @@ RED.deploy = (function() {
|
|||
'<img src="red/images/spin.svg"/>'+
|
||||
'</span>'+
|
||||
'</a>'+
|
||||
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
||||
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i><i class="fa fa-lock"></i></a>'+
|
||||
'</span></li>').prependTo(".red-ui-header-toolbar");
|
||||
const mainMenuItems = [
|
||||
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.svg",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
|
||||
|
@ -112,53 +114,80 @@ RED.deploy = (function() {
|
|||
RED.actions.add("core:set-deploy-type-to-modified-nodes",function() { RED.menu.setSelected("deploymenu-item-node",true); });
|
||||
}
|
||||
|
||||
|
||||
window.addEventListener('beforeunload', function (event) {
|
||||
if (RED.nodes.dirty()) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation()
|
||||
event.returnValue = RED._("deploy.confirm.undeployedChanges");
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
RED.events.on('workspace:dirty',function(state) {
|
||||
if (RED.settings.user?.permissions === 'read') {
|
||||
return
|
||||
}
|
||||
if (state.dirty) {
|
||||
window.onbeforeunload = function() {
|
||||
return RED._("deploy.confirm.undeployedChanges");
|
||||
}
|
||||
// window.onbeforeunload = function() {
|
||||
// return
|
||||
// }
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
} else {
|
||||
window.onbeforeunload = null;
|
||||
// window.onbeforeunload = null;
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
var activeNotifyMessage;
|
||||
RED.comms.subscribe("notification/runtime-deploy",function(topic,msg) {
|
||||
if (!activeNotifyMessage) {
|
||||
var currentRev = RED.nodes.version();
|
||||
if (currentRev === null || deployInflight || currentRev === msg.revision) {
|
||||
return;
|
||||
}
|
||||
var message = $('<p>').text(RED._('deploy.confirm.backgroundUpdate'));
|
||||
activeNotifyMessage = RED.notify(message,{
|
||||
modal: true,
|
||||
fixed: true,
|
||||
buttons: [
|
||||
{
|
||||
text: RED._('deploy.confirm.button.ignore'),
|
||||
click: function() {
|
||||
activeNotifyMessage.close();
|
||||
activeNotifyMessage = null;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._('deploy.confirm.button.review'),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
activeNotifyMessage.close();
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
resolveConflict(nns,false);
|
||||
activeNotifyMessage = null;
|
||||
}
|
||||
var currentRev = RED.nodes.version();
|
||||
if (currentRev === null || deployInflight || currentRev === msg.revision) {
|
||||
return;
|
||||
}
|
||||
if (activeBackgroundDeployNotification?.hidden && !activeBackgroundDeployNotification?.closed) {
|
||||
activeBackgroundDeployNotification.showNotification()
|
||||
return
|
||||
}
|
||||
const message = $('<p>').text(RED._('deploy.confirm.backgroundUpdate'));
|
||||
const options = {
|
||||
id: 'background-update',
|
||||
type: 'compact',
|
||||
modal: false,
|
||||
fixed: true,
|
||||
timeout: 10000,
|
||||
buttons: [
|
||||
{
|
||||
text: RED._('deploy.confirm.button.review'),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
activeBackgroundDeployNotification.hideNotification();
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
resolveConflict(nns,false);
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
]
|
||||
}
|
||||
if (!activeBackgroundDeployNotification || activeBackgroundDeployNotification.closed) {
|
||||
activeBackgroundDeployNotification = RED.notify(message, options)
|
||||
} else {
|
||||
activeBackgroundDeployNotification.update(message, options)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
updateLockedState()
|
||||
RED.events.on('login', updateLockedState)
|
||||
}
|
||||
|
||||
function updateLockedState() {
|
||||
if (RED.settings.user?.permissions === 'read') {
|
||||
$(".red-ui-deploy-button-group").addClass("readOnly");
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
} else {
|
||||
$(".red-ui-deploy-button-group").removeClass("readOnly");
|
||||
if (RED.nodes.dirty()) {
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNodeInfo(node) {
|
||||
|
@ -213,7 +242,11 @@ RED.deploy = (function() {
|
|||
class: "primary disabled",
|
||||
click: function() {
|
||||
if (!$("#red-ui-deploy-dialog-confirm-deploy-review").hasClass('disabled')) {
|
||||
RED.diff.showRemoteDiff();
|
||||
RED.diff.showRemoteDiff(null, {
|
||||
onmerge: function () {
|
||||
activeBackgroundDeployNotification.close()
|
||||
}
|
||||
});
|
||||
conflictNotification.close();
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +259,7 @@ RED.deploy = (function() {
|
|||
if (!$("#red-ui-deploy-dialog-confirm-deploy-merge").hasClass('disabled')) {
|
||||
RED.diff.mergeDiff(currentDiff);
|
||||
conflictNotification.close();
|
||||
activeBackgroundDeployNotification.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,6 +272,7 @@ RED.deploy = (function() {
|
|||
click: function() {
|
||||
save(true,activeDeploy);
|
||||
conflictNotification.close();
|
||||
activeBackgroundDeployNotification.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -248,21 +283,17 @@ RED.deploy = (function() {
|
|||
buttons: buttons
|
||||
});
|
||||
|
||||
var now = Date.now();
|
||||
RED.diff.getRemoteDiff(function(diff) {
|
||||
var ellapsed = Math.max(1000 - (Date.now()-now), 0);
|
||||
currentDiff = diff;
|
||||
setTimeout(function() {
|
||||
conflictCheck.hide();
|
||||
var d = Object.keys(diff.conflicts);
|
||||
if (d.length === 0) {
|
||||
conflictAutoMerge.show();
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||
} else {
|
||||
conflictManualMerge.show();
|
||||
}
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-review").removeClass('disabled')
|
||||
},ellapsed);
|
||||
conflictCheck.hide();
|
||||
var d = Object.keys(diff.conflicts);
|
||||
if (d.length === 0) {
|
||||
conflictAutoMerge.show();
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||
} else {
|
||||
conflictManualMerge.show();
|
||||
}
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-review").removeClass('disabled')
|
||||
})
|
||||
}
|
||||
function cropList(list) {
|
||||
|
@ -612,7 +643,10 @@ RED.deploy = (function() {
|
|||
}
|
||||
});
|
||||
RED.nodes.eachSubflow(function (subflow) {
|
||||
subflow.changed = false;
|
||||
if (subflow.changed) {
|
||||
subflow.changed = false;
|
||||
RED.events.emit("subflows:change", subflow);
|
||||
}
|
||||
});
|
||||
RED.nodes.eachWorkspace(function (ws) {
|
||||
if (ws.changed || ws.added) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
RED.diff = (function() {
|
||||
|
||||
var currentDiff = {};
|
||||
var diffVisible = false;
|
||||
var diffList;
|
||||
|
@ -62,12 +61,14 @@ RED.diff = (function() {
|
|||
addedCount:0,
|
||||
deletedCount:0,
|
||||
changedCount:0,
|
||||
movedCount:0,
|
||||
unchangedCount: 0
|
||||
},
|
||||
remote: {
|
||||
addedCount:0,
|
||||
deletedCount:0,
|
||||
changedCount:0,
|
||||
movedCount:0,
|
||||
unchangedCount: 0
|
||||
},
|
||||
conflicts: 0
|
||||
|
@ -138,7 +139,7 @@ RED.diff = (function() {
|
|||
$(this).parent().toggleClass('collapsed');
|
||||
});
|
||||
|
||||
createNodePropertiesTable(def,tab,localTabNode,remoteTabNode,conflicts).appendTo(div);
|
||||
createNodePropertiesTable(def,tab,localTabNode,remoteTabNode).appendTo(div);
|
||||
selectState = "";
|
||||
if (conflicts[tab.id]) {
|
||||
flowStats.conflicts++;
|
||||
|
@ -208,19 +209,26 @@ RED.diff = (function() {
|
|||
var localStats = $('<span>',{class:"red-ui-diff-list-flow-stats"}).appendTo(localCell);
|
||||
$('<span class="red-ui-diff-status"></span>').text(RED._('diff.nodeCount',{count:localNodeCount})).appendTo(localStats);
|
||||
|
||||
if (flowStats.conflicts + flowStats.local.addedCount + flowStats.local.changedCount + flowStats.local.deletedCount > 0) {
|
||||
if (flowStats.conflicts + flowStats.local.addedCount + flowStats.local.changedCount + flowStats.local.movedCount + flowStats.local.deletedCount > 0) {
|
||||
$('<span class="red-ui-diff-status"> [ </span>').appendTo(localStats);
|
||||
if (flowStats.conflicts > 0) {
|
||||
$('<span class="red-ui-diff-status-conflict"><span class="red-ui-diff-status"><i class="fa fa-exclamation"></i> '+flowStats.conflicts+'</span></span>').appendTo(localStats);
|
||||
}
|
||||
if (flowStats.local.addedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-added"><span class="red-ui-diff-status"><i class="fa fa-plus-square"></i> '+flowStats.local.addedCount+'</span></span>').appendTo(localStats);
|
||||
const cell = $('<span class="red-ui-diff-status-added"><span class="red-ui-diff-status"><i class="fa fa-plus-square"></i> '+flowStats.local.addedCount+'</span></span>').appendTo(localStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.added'))
|
||||
}
|
||||
if (flowStats.local.changedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-changed"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.local.changedCount+'</span></span>').appendTo(localStats);
|
||||
const cell = $('<span class="red-ui-diff-status-changed"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.local.changedCount+'</span></span>').appendTo(localStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.changed'))
|
||||
}
|
||||
if (flowStats.local.movedCount > 0) {
|
||||
const cell = $('<span class="red-ui-diff-status-moved"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.local.movedCount+'</span></span>').appendTo(localStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.moved'))
|
||||
}
|
||||
if (flowStats.local.deletedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-deleted"><span class="red-ui-diff-status"><i class="fa fa-minus-square"></i> '+flowStats.local.deletedCount+'</span></span>').appendTo(localStats);
|
||||
const cell = $('<span class="red-ui-diff-status-deleted"><span class="red-ui-diff-status"><i class="fa fa-minus-square"></i> '+flowStats.local.deletedCount+'</span></span>').appendTo(localStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.deleted'))
|
||||
}
|
||||
$('<span class="red-ui-diff-status"> ] </span>').appendTo(localStats);
|
||||
}
|
||||
|
@ -246,19 +254,26 @@ RED.diff = (function() {
|
|||
}
|
||||
var remoteStats = $('<span>',{class:"red-ui-diff-list-flow-stats"}).appendTo(remoteCell);
|
||||
$('<span class="red-ui-diff-status"></span>').text(RED._('diff.nodeCount',{count:remoteNodeCount})).appendTo(remoteStats);
|
||||
if (flowStats.conflicts + flowStats.remote.addedCount + flowStats.remote.changedCount + flowStats.remote.deletedCount > 0) {
|
||||
if (flowStats.conflicts + flowStats.remote.addedCount + flowStats.remote.changedCount + flowStats.remote.movedCount + flowStats.remote.deletedCount > 0) {
|
||||
$('<span class="red-ui-diff-status"> [ </span>').appendTo(remoteStats);
|
||||
if (flowStats.conflicts > 0) {
|
||||
$('<span class="red-ui-diff-status-conflict"><span class="red-ui-diff-status"><i class="fa fa-exclamation"></i> '+flowStats.conflicts+'</span></span>').appendTo(remoteStats);
|
||||
}
|
||||
if (flowStats.remote.addedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-added"><span class="red-ui-diff-status"><i class="fa fa-plus-square"></i> '+flowStats.remote.addedCount+'</span></span>').appendTo(remoteStats);
|
||||
const cell = $('<span class="red-ui-diff-status-added"><span class="red-ui-diff-status"><i class="fa fa-plus-square"></i> '+flowStats.remote.addedCount+'</span></span>').appendTo(remoteStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.added'))
|
||||
}
|
||||
if (flowStats.remote.changedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-changed"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.remote.changedCount+'</span></span>').appendTo(remoteStats);
|
||||
const cell = $('<span class="red-ui-diff-status-changed"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.remote.changedCount+'</span></span>').appendTo(remoteStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.changed'))
|
||||
}
|
||||
if (flowStats.remote.movedCount > 0) {
|
||||
const cell = $('<span class="red-ui-diff-status-moved"><span class="red-ui-diff-status"><i class="fa fa-square"></i> '+flowStats.remote.movedCount+'</span></span>').appendTo(remoteStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.moved'))
|
||||
}
|
||||
if (flowStats.remote.deletedCount > 0) {
|
||||
$('<span class="red-ui-diff-status-deleted"><span class="red-ui-diff-status"><i class="fa fa-minus-square"></i> '+flowStats.remote.deletedCount+'</span></span>').appendTo(remoteStats);
|
||||
const cell = $('<span class="red-ui-diff-status-deleted"><span class="red-ui-diff-status"><i class="fa fa-minus-square"></i> '+flowStats.remote.deletedCount+'</span></span>').appendTo(remoteStats);
|
||||
RED.popover.tooltip(cell, RED._('diff.type.deleted'))
|
||||
}
|
||||
$('<span class="red-ui-diff-status"> ] </span>').appendTo(remoteStats);
|
||||
}
|
||||
|
@ -293,7 +308,7 @@ RED.diff = (function() {
|
|||
if (options.mode === "merge") {
|
||||
diffPanel.addClass("red-ui-diff-panel-merge");
|
||||
}
|
||||
var diffList = createDiffTable(diffPanel, diff);
|
||||
var diffList = createDiffTable(diffPanel, diff, options);
|
||||
|
||||
var localDiff = diff.localDiff;
|
||||
var remoteDiff = diff.remoteDiff;
|
||||
|
@ -516,7 +531,6 @@ RED.diff = (function() {
|
|||
|
||||
var hasChanges = false; // exists in original and local/remote but with changes
|
||||
var unChanged = true; // existing in original,local,remote unchanged
|
||||
var localChanged = false;
|
||||
|
||||
if (localDiff.added[node.id]) {
|
||||
stats.local.addedCount++;
|
||||
|
@ -535,12 +549,20 @@ RED.diff = (function() {
|
|||
unChanged = false;
|
||||
}
|
||||
if (localDiff.changed[node.id]) {
|
||||
stats.local.changedCount++;
|
||||
if (localDiff.positionChanged[node.id]) {
|
||||
stats.local.movedCount++
|
||||
} else {
|
||||
stats.local.changedCount++;
|
||||
}
|
||||
hasChanges = true;
|
||||
unChanged = false;
|
||||
}
|
||||
if (remoteDiff && remoteDiff.changed[node.id]) {
|
||||
stats.remote.changedCount++;
|
||||
if (remoteDiff.positionChanged[node.id]) {
|
||||
stats.remote.movedCount++
|
||||
} else {
|
||||
stats.remote.changedCount++;
|
||||
}
|
||||
hasChanges = true;
|
||||
unChanged = false;
|
||||
}
|
||||
|
@ -605,27 +627,32 @@ RED.diff = (function() {
|
|||
localNodeDiv.addClass("red-ui-diff-status-moved");
|
||||
var localMovedMessage = "";
|
||||
if (node.z === localN.z) {
|
||||
localMovedMessage = RED._("diff.type.movedFrom",{id:(localDiff.currentConfig.all[node.id].z||'global')});
|
||||
const movedFromNodeTab = localDiff.currentConfig.all[localDiff.currentConfig.all[node.id].z]
|
||||
const movedFromLabel = `'${movedFromNodeTab ? (movedFromNodeTab.label || movedFromNodeTab.id) : 'global'}'`
|
||||
localMovedMessage = RED._("diff.type.movedFrom",{id: movedFromLabel});
|
||||
} else {
|
||||
localMovedMessage = RED._("diff.type.movedTo",{id:(localN.z||'global')});
|
||||
const movedToNodeTab = localDiff.newConfig.all[localN.z]
|
||||
const movedToLabel = `'${movedToNodeTab ? (movedToNodeTab.label || movedToNodeTab.id) : 'global'}'`
|
||||
localMovedMessage = RED._("diff.type.movedTo",{id:movedToLabel});
|
||||
}
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-caret-square-o-right"></i> '+localMovedMessage+'</span>').appendTo(localNodeDiv);
|
||||
}
|
||||
localChanged = true;
|
||||
} else if (localDiff.deleted[node.z]) {
|
||||
localNodeDiv.addClass("red-ui-diff-empty");
|
||||
localChanged = true;
|
||||
} else if (localDiff.deleted[node.id]) {
|
||||
localNodeDiv.addClass("red-ui-diff-status-deleted");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-minus-square"></i> <span data-i18n="diff.type.deleted"></span></span>').appendTo(localNodeDiv);
|
||||
localChanged = true;
|
||||
} else if (localDiff.changed[node.id]) {
|
||||
if (localDiff.newConfig.all[node.id].z !== node.z) {
|
||||
localNodeDiv.addClass("red-ui-diff-empty");
|
||||
} else {
|
||||
localNodeDiv.addClass("red-ui-diff-status-changed");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.changed"></span></span>').appendTo(localNodeDiv);
|
||||
localChanged = true;
|
||||
if (localDiff.positionChanged[node.id]) {
|
||||
localNodeDiv.addClass("red-ui-diff-status-moved");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.moved"></span></span>').appendTo(localNodeDiv);
|
||||
} else {
|
||||
localNodeDiv.addClass("red-ui-diff-status-changed");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.changed"></span></span>').appendTo(localNodeDiv);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (localDiff.newConfig.all[node.id].z !== node.z) {
|
||||
|
@ -646,9 +673,13 @@ RED.diff = (function() {
|
|||
remoteNodeDiv.addClass("red-ui-diff-status-moved");
|
||||
var remoteMovedMessage = "";
|
||||
if (node.z === remoteN.z) {
|
||||
remoteMovedMessage = RED._("diff.type.movedFrom",{id:(remoteDiff.currentConfig.all[node.id].z||'global')});
|
||||
const movedFromNodeTab = remoteDiff.currentConfig.all[remoteDiff.currentConfig.all[node.id].z]
|
||||
const movedFromLabel = `'${movedFromNodeTab ? (movedFromNodeTab.label || movedFromNodeTab.id) : 'global'}'`
|
||||
remoteMovedMessage = RED._("diff.type.movedFrom",{id:movedFromLabel});
|
||||
} else {
|
||||
remoteMovedMessage = RED._("diff.type.movedTo",{id:(remoteN.z||'global')});
|
||||
const movedToNodeTab = remoteDiff.newConfig.all[remoteN.z]
|
||||
const movedToLabel = `'${movedToNodeTab ? (movedToNodeTab.label || movedToNodeTab.id) : 'global'}'`
|
||||
remoteMovedMessage = RED._("diff.type.movedTo",{id:movedToLabel});
|
||||
}
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-caret-square-o-right"></i> '+remoteMovedMessage+'</span>').appendTo(remoteNodeDiv);
|
||||
}
|
||||
|
@ -661,8 +692,13 @@ RED.diff = (function() {
|
|||
if (remoteDiff.newConfig.all[node.id].z !== node.z) {
|
||||
remoteNodeDiv.addClass("red-ui-diff-empty");
|
||||
} else {
|
||||
remoteNodeDiv.addClass("red-ui-diff-status-changed");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.changed"></span></span>').appendTo(remoteNodeDiv);
|
||||
if (remoteDiff.positionChanged[node.id]) {
|
||||
remoteNodeDiv.addClass("red-ui-diff-status-moved");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.moved"></span></span>').appendTo(remoteNodeDiv);
|
||||
} else {
|
||||
remoteNodeDiv.addClass("red-ui-diff-status-changed");
|
||||
$('<span class="red-ui-diff-status"><i class="fa fa-square"></i> <span data-i18n="diff.type.changed"></span></span>').appendTo(remoteNodeDiv);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (remoteDiff.newConfig.all[node.id].z !== node.z) {
|
||||
|
@ -788,7 +824,7 @@ RED.diff = (function() {
|
|||
$("<td>",{class:"red-ui-diff-list-cell-label"}).text("position").appendTo(row);
|
||||
localCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row);
|
||||
if (localNode) {
|
||||
localCell.addClass("red-ui-diff-status-"+(localChanged?"changed":"unchanged"));
|
||||
localCell.addClass("red-ui-diff-status-"+(localChanged?"moved":"unchanged"));
|
||||
$('<span class="red-ui-diff-status">'+(localChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(localCell);
|
||||
element = $('<span class="red-ui-diff-list-element"></span>').appendTo(localCell);
|
||||
var localPosition = {x:localNode.x,y:localNode.y};
|
||||
|
@ -813,7 +849,7 @@ RED.diff = (function() {
|
|||
|
||||
if (remoteNode !== undefined) {
|
||||
remoteCell = $("<td>",{class:"red-ui-diff-list-cell red-ui-diff-list-node-remote"}).appendTo(row);
|
||||
remoteCell.addClass("red-ui-diff-status-"+(remoteChanged?"changed":"unchanged"));
|
||||
remoteCell.addClass("red-ui-diff-status-"+(remoteChanged?"moved":"unchanged"));
|
||||
if (remoteNode) {
|
||||
$('<span class="red-ui-diff-status">'+(remoteChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(remoteCell);
|
||||
element = $('<span class="red-ui-diff-list-element"></span>').appendTo(remoteCell);
|
||||
|
@ -1099,11 +1135,11 @@ RED.diff = (function() {
|
|||
// var diff = generateDiff(originalFlow,nns);
|
||||
// showDiff(diff);
|
||||
// }
|
||||
function showRemoteDiff(diff) {
|
||||
if (diff === undefined) {
|
||||
getRemoteDiff(showRemoteDiff);
|
||||
function showRemoteDiff(diff, options = {}) {
|
||||
if (!diff) {
|
||||
getRemoteDiff((remoteDiff) => showRemoteDiff(remoteDiff, options));
|
||||
} else {
|
||||
showDiff(diff,{mode:'merge'});
|
||||
showDiff(diff,{...options, mode:'merge'});
|
||||
}
|
||||
}
|
||||
function parseNodes(nodeList) {
|
||||
|
@ -1144,23 +1180,53 @@ RED.diff = (function() {
|
|||
}
|
||||
}
|
||||
function generateDiff(currentNodes,newNodes) {
|
||||
var currentConfig = parseNodes(currentNodes);
|
||||
var newConfig = parseNodes(newNodes);
|
||||
var added = {};
|
||||
var deleted = {};
|
||||
var changed = {};
|
||||
var moved = {};
|
||||
const currentConfig = parseNodes(currentNodes);
|
||||
const newConfig = parseNodes(newNodes);
|
||||
const added = {};
|
||||
const deleted = {};
|
||||
const changed = {};
|
||||
const positionChanged = {};
|
||||
const moved = {};
|
||||
|
||||
Object.keys(currentConfig.all).forEach(function(id) {
|
||||
var node = RED.nodes.workspace(id)||RED.nodes.subflow(id)||RED.nodes.node(id);
|
||||
const node = RED.nodes.workspace(id)||RED.nodes.subflow(id)||RED.nodes.node(id);
|
||||
if (!newConfig.all.hasOwnProperty(id)) {
|
||||
deleted[id] = true;
|
||||
} else if (JSON.stringify(currentConfig.all[id]) !== JSON.stringify(newConfig.all[id])) {
|
||||
return
|
||||
}
|
||||
const currentConfigJSON = JSON.stringify(currentConfig.all[id])
|
||||
const newConfigJSON = JSON.stringify(newConfig.all[id])
|
||||
|
||||
if (currentConfigJSON !== newConfigJSON) {
|
||||
changed[id] = true;
|
||||
|
||||
if (currentConfig.all[id].z !== newConfig.all[id].z) {
|
||||
moved[id] = true;
|
||||
} else if (
|
||||
currentConfig.all[id].x !== newConfig.all[id].x ||
|
||||
currentConfig.all[id].y !== newConfig.all[id].y ||
|
||||
currentConfig.all[id].w !== newConfig.all[id].w ||
|
||||
currentConfig.all[id].h !== newConfig.all[id].h
|
||||
) {
|
||||
// This node's position on its parent has changed. We want to
|
||||
// check if this is the *only* change for this given node
|
||||
const currentNodeClone = JSON.parse(currentConfigJSON)
|
||||
const newNodeClone = JSON.parse(newConfigJSON)
|
||||
|
||||
delete currentNodeClone.x
|
||||
delete currentNodeClone.y
|
||||
delete currentNodeClone.w
|
||||
delete currentNodeClone.h
|
||||
delete newNodeClone.x
|
||||
delete newNodeClone.y
|
||||
delete newNodeClone.w
|
||||
delete newNodeClone.h
|
||||
|
||||
if (JSON.stringify(currentNodeClone) === JSON.stringify(newNodeClone)) {
|
||||
// Only the position has changed - everything else is the same
|
||||
positionChanged[id] = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
Object.keys(newConfig.all).forEach(function(id) {
|
||||
|
@ -1169,13 +1235,14 @@ RED.diff = (function() {
|
|||
}
|
||||
});
|
||||
|
||||
var diff = {
|
||||
currentConfig: currentConfig,
|
||||
newConfig: newConfig,
|
||||
added: added,
|
||||
deleted: deleted,
|
||||
changed: changed,
|
||||
moved: moved
|
||||
const diff = {
|
||||
currentConfig,
|
||||
newConfig,
|
||||
added,
|
||||
deleted,
|
||||
changed,
|
||||
positionChanged,
|
||||
moved
|
||||
};
|
||||
return diff;
|
||||
}
|
||||
|
@ -1240,12 +1307,14 @@ RED.diff = (function() {
|
|||
return diff;
|
||||
}
|
||||
|
||||
function showDiff(diff,options) {
|
||||
function showDiff(diff, options) {
|
||||
if (diffVisible) {
|
||||
return;
|
||||
}
|
||||
options = options || {};
|
||||
var mode = options.mode || 'merge';
|
||||
|
||||
options.hidePositionChanges = true
|
||||
|
||||
var localDiff = diff.localDiff;
|
||||
var remoteDiff = diff.remoteDiff;
|
||||
|
@ -1315,6 +1384,9 @@ RED.diff = (function() {
|
|||
if (!$("#red-ui-diff-view-diff-merge").hasClass('disabled')) {
|
||||
refreshConflictHeader(diff);
|
||||
mergeDiff(diff);
|
||||
if (options.onmerge) {
|
||||
options.onmerge()
|
||||
}
|
||||
RED.tray.close();
|
||||
}
|
||||
}
|
||||
|
@ -1345,6 +1417,7 @@ RED.diff = (function() {
|
|||
var newConfig = [];
|
||||
var node;
|
||||
var nodeChangedStates = {};
|
||||
var nodeMovedStates = {};
|
||||
var localChangedStates = {};
|
||||
for (id in localDiff.newConfig.all) {
|
||||
if (localDiff.newConfig.all.hasOwnProperty(id)) {
|
||||
|
@ -1352,12 +1425,14 @@ RED.diff = (function() {
|
|||
if (resolutions[id] === 'local') {
|
||||
if (node) {
|
||||
nodeChangedStates[id] = node.changed;
|
||||
nodeMovedStates[id] = node.moved;
|
||||
}
|
||||
newConfig.push(localDiff.newConfig.all[id]);
|
||||
} else if (resolutions[id] === 'remote') {
|
||||
if (!remoteDiff.deleted[id] && remoteDiff.newConfig.all.hasOwnProperty(id)) {
|
||||
if (node) {
|
||||
nodeChangedStates[id] = node.changed;
|
||||
nodeMovedStates[id] = node.moved;
|
||||
}
|
||||
localChangedStates[id] = 1;
|
||||
newConfig.push(remoteDiff.newConfig.all[id]);
|
||||
|
@ -1381,8 +1456,9 @@ RED.diff = (function() {
|
|||
}
|
||||
return {
|
||||
config: newConfig,
|
||||
nodeChangedStates: nodeChangedStates,
|
||||
localChangedStates: localChangedStates
|
||||
nodeChangedStates,
|
||||
nodeMovedStates,
|
||||
localChangedStates
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1393,6 +1469,7 @@ RED.diff = (function() {
|
|||
|
||||
var newConfig = appliedDiff.config;
|
||||
var nodeChangedStates = appliedDiff.nodeChangedStates;
|
||||
var nodeMovedStates = appliedDiff.nodeMovedStates;
|
||||
var localChangedStates = appliedDiff.localChangedStates;
|
||||
|
||||
var isDirty = RED.nodes.dirty();
|
||||
|
@ -1401,33 +1478,56 @@ RED.diff = (function() {
|
|||
t:"replace",
|
||||
config: RED.nodes.createCompleteNodeSet(),
|
||||
changed: nodeChangedStates,
|
||||
moved: nodeMovedStates,
|
||||
complete: true,
|
||||
dirty: isDirty,
|
||||
rev: RED.nodes.version()
|
||||
}
|
||||
|
||||
RED.history.push(historyEvent);
|
||||
|
||||
var originalFlow = RED.nodes.originalFlow();
|
||||
// originalFlow is what the editor things it loaded
|
||||
// - add any newly added nodes from remote diff as they are now part of the record
|
||||
for (var id in diff.remoteDiff.added) {
|
||||
if (diff.remoteDiff.added.hasOwnProperty(id)) {
|
||||
if (diff.remoteDiff.newConfig.all.hasOwnProperty(id)) {
|
||||
originalFlow.push(JSON.parse(JSON.stringify(diff.remoteDiff.newConfig.all[id])));
|
||||
}
|
||||
}
|
||||
}
|
||||
// var originalFlow = RED.nodes.originalFlow();
|
||||
// // originalFlow is what the editor thinks it loaded
|
||||
// // - add any newly added nodes from remote diff as they are now part of the record
|
||||
// for (var id in diff.remoteDiff.added) {
|
||||
// if (diff.remoteDiff.added.hasOwnProperty(id)) {
|
||||
// if (diff.remoteDiff.newConfig.all.hasOwnProperty(id)) {
|
||||
// originalFlow.push(JSON.parse(JSON.stringify(diff.remoteDiff.newConfig.all[id])));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
RED.nodes.clear();
|
||||
var imported = RED.nodes.import(newConfig);
|
||||
|
||||
// Restore the original flow so subsequent merge resolutions can properly
|
||||
// identify new-vs-old
|
||||
RED.nodes.originalFlow(originalFlow);
|
||||
// // Restore the original flow so subsequent merge resolutions can properly
|
||||
// // identify new-vs-old
|
||||
// RED.nodes.originalFlow(originalFlow);
|
||||
|
||||
// Clear all change flags from the import
|
||||
RED.nodes.dirty(false);
|
||||
|
||||
const flowsToLock = new Set()
|
||||
function ensureUnlocked(id) {
|
||||
const flow = id && (RED.nodes.workspace(id) || RED.nodes.subflow(id) || null);
|
||||
const isLocked = flow ? flow.locked : false;
|
||||
if (flow && isLocked) {
|
||||
flow.locked = false;
|
||||
flowsToLock.add(flow)
|
||||
}
|
||||
}
|
||||
imported.nodes.forEach(function(n) {
|
||||
if (nodeChangedStates[n.id] || localChangedStates[n.id]) {
|
||||
if (nodeChangedStates[n.id]) {
|
||||
ensureUnlocked(n.z)
|
||||
n.changed = true;
|
||||
}
|
||||
if (nodeMovedStates[n.id]) {
|
||||
ensureUnlocked(n.z)
|
||||
n.moved = true;
|
||||
}
|
||||
})
|
||||
flowsToLock.forEach(flow => {
|
||||
flow.locked = true
|
||||
})
|
||||
|
||||
RED.nodes.version(diff.remoteDiff.rev);
|
||||
|
|
|
@ -334,48 +334,108 @@ RED.editor = (function() {
|
|||
|
||||
/**
|
||||
* Create a config-node select box for this property
|
||||
* @param node - the node being edited
|
||||
* @param property - the name of the field
|
||||
* @param type - the type of the config-node
|
||||
* @param {Object} node - the node being edited
|
||||
* @param {String} property - the name of the node property
|
||||
* @param {String} type - the type of the config-node
|
||||
* @param {"node-config-input"|"node-input"|"node-input-subflow-env"} prefix - the prefix to use in the input element ids
|
||||
* @param {Function} [filter] - a function to filter the list of config nodes
|
||||
* @param {Object} [env] - the environment variable object (only used for subflow env vars)
|
||||
*/
|
||||
function prepareConfigNodeSelect(node,property,type,prefix,filter) {
|
||||
var input = $("#"+prefix+"-"+property);
|
||||
if (input.length === 0 ) {
|
||||
function prepareConfigNodeSelect(node, property, type, prefix, filter, env) {
|
||||
let nodeValue
|
||||
if (prefix === 'node-input-subflow-env') {
|
||||
nodeValue = env?.value
|
||||
} else {
|
||||
nodeValue = node[property]
|
||||
}
|
||||
|
||||
const addBtnId = `${prefix}-btn-${property}-add`;
|
||||
const editBtnId = `${prefix}-btn-${property}-edit`;
|
||||
const selectId = prefix + '-' + property;
|
||||
const input = $(`#${selectId}`);
|
||||
if (input.length === 0) {
|
||||
return;
|
||||
}
|
||||
var newWidth = input.width();
|
||||
var attrStyle = input.attr('style');
|
||||
var m;
|
||||
const attrStyle = input.attr('style');
|
||||
let newWidth;
|
||||
let m;
|
||||
if ((m = /(^|\s|;)width\s*:\s*([^;]+)/i.exec(attrStyle)) !== null) {
|
||||
newWidth = m[2].trim();
|
||||
} else {
|
||||
newWidth = "70%";
|
||||
}
|
||||
var outerWrap = $("<div></div>").css({
|
||||
const outerWrap = $("<div></div>").css({
|
||||
width: newWidth,
|
||||
display:'inline-flex'
|
||||
display: 'inline-flex'
|
||||
});
|
||||
var select = $('<select id="'+prefix+'-'+property+'"></select>').appendTo(outerWrap);
|
||||
const select = $('<select id="' + selectId + '"></select>').appendTo(outerWrap);
|
||||
input.replaceWith(outerWrap);
|
||||
// set the style attr directly - using width() on FF causes a value of 114%...
|
||||
select.css({
|
||||
'flex-grow': 1
|
||||
});
|
||||
updateConfigNodeSelect(property,type,node[property],prefix,filter);
|
||||
$('<a id="'+prefix+'-lookup-'+property+'" class="red-ui-button"><i class="fa fa-pencil"></i></a>')
|
||||
.css({"margin-left":"10px"})
|
||||
|
||||
updateConfigNodeSelect(property, type, nodeValue, prefix, filter);
|
||||
|
||||
// create the edit button
|
||||
const editButton = $('<a id="' + editBtnId + '" class="red-ui-button"><i class="fa fa-pencil"></i></a>')
|
||||
.css({ "margin-left": "10px" })
|
||||
.appendTo(outerWrap);
|
||||
$('#'+prefix+'-lookup-'+property).on("click", function(e) {
|
||||
showEditConfigNodeDialog(property,type,select.find(":selected").val(),prefix,node);
|
||||
|
||||
RED.popover.tooltip(editButton, RED._('editor.editConfig', { type }));
|
||||
|
||||
// create the add button
|
||||
const addButton = $('<a id="' + addBtnId + '" class="red-ui-button"><i class="fa fa-plus"></i></a>')
|
||||
.css({ "margin-left": "10px" })
|
||||
.appendTo(outerWrap);
|
||||
RED.popover.tooltip(addButton, RED._('editor.addNewConfig', { type }));
|
||||
|
||||
const disableButton = function(button, disabled) {
|
||||
$(button).prop("disabled", !!disabled)
|
||||
$(button).toggleClass("disabled", !!disabled)
|
||||
};
|
||||
|
||||
// add the click handler
|
||||
addButton.on("click", function (e) {
|
||||
if (addButton.prop("disabled")) { return }
|
||||
showEditConfigNodeDialog(property, type, "_ADD_", prefix, node);
|
||||
e.preventDefault();
|
||||
});
|
||||
editButton.on("click", function (e) {
|
||||
const selectedOpt = select.find(":selected")
|
||||
if (selectedOpt.data('env')) { return } // don't show the dialog for env vars items (MVP. Future enhancement: lookup the env, if present, show the associated edit dialog)
|
||||
if (editButton.prop("disabled")) { return }
|
||||
showEditConfigNodeDialog(property, type, selectedOpt.val(), prefix, node);
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// dont permit the user to click the button if the selected option is an env var
|
||||
select.on("change", function () {
|
||||
const selectedOpt = select.find(":selected");
|
||||
const optionsLength = select.find("option").length;
|
||||
if (selectedOpt?.data('env')) {
|
||||
disableButton(addButton, true);
|
||||
disableButton(editButton, true);
|
||||
// disable the edit button if no options available
|
||||
} else if (optionsLength === 1 && selectedOpt.val() === "_ADD_") {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, true);
|
||||
} else if (selectedOpt.val() === "") {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, true);
|
||||
} else {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, false);
|
||||
}
|
||||
});
|
||||
|
||||
var label = "";
|
||||
var configNode = RED.nodes.node(node[property]);
|
||||
var node_def = RED.nodes.getType(type);
|
||||
var configNode = RED.nodes.node(nodeValue);
|
||||
|
||||
if (configNode) {
|
||||
label = RED.utils.getNodeLabel(configNode,configNode.id);
|
||||
label = RED.utils.getNodeLabel(configNode, configNode.id);
|
||||
}
|
||||
|
||||
input.val(label);
|
||||
}
|
||||
|
||||
|
@ -776,12 +836,9 @@ RED.editor = (function() {
|
|||
}
|
||||
|
||||
function defaultConfigNodeSort(A,B) {
|
||||
if (A.__label__ < B.__label__) {
|
||||
return -1;
|
||||
} else if (A.__label__ > B.__label__) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
// sort case insensitive so that `[env] node-name` items are at the top and
|
||||
// not mixed inbetween the the lower and upper case items
|
||||
return (A.__label__ || '').localeCompare((B.__label__ || ''), undefined, {sensitivity: 'base'})
|
||||
}
|
||||
|
||||
function updateConfigNodeSelect(name,type,value,prefix,filter) {
|
||||
|
@ -796,7 +853,7 @@ RED.editor = (function() {
|
|||
}
|
||||
$("#"+prefix+"-"+name).val(value);
|
||||
} else {
|
||||
|
||||
let inclSubflowEnvvars = false
|
||||
var select = $("#"+prefix+"-"+name);
|
||||
var node_def = RED.nodes.getType(type);
|
||||
select.children().remove();
|
||||
|
@ -804,6 +861,7 @@ RED.editor = (function() {
|
|||
var activeWorkspace = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (!activeWorkspace) {
|
||||
activeWorkspace = RED.nodes.subflow(RED.workspaces.active());
|
||||
inclSubflowEnvvars = true
|
||||
}
|
||||
|
||||
var configNodes = [];
|
||||
|
@ -819,6 +877,31 @@ RED.editor = (function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// as includeSubflowEnvvars is true, this is a subflow.
|
||||
// include any 'conf-types' env vars as a list of avaiable configs
|
||||
// in the config dropdown as `[env] node-name`
|
||||
if (inclSubflowEnvvars && activeWorkspace.env) {
|
||||
const parentEnv = activeWorkspace.env.filter(env => env.ui?.type === 'conf-types' && env.type === type)
|
||||
if (parentEnv && parentEnv.length > 0) {
|
||||
const locale = RED.i18n.lang()
|
||||
for (let i = 0; i < parentEnv.length; i++) {
|
||||
const tenv = parentEnv[i]
|
||||
const ui = tenv.ui || {}
|
||||
const labels = ui.label || {}
|
||||
const labelText = RED.editor.envVarList.lookupLabel(labels, labels["en-US"] || tenv.name, locale)
|
||||
const config = {
|
||||
env: tenv,
|
||||
id: '${' + parentEnv[0].name + '}',
|
||||
type: type,
|
||||
label: labelText,
|
||||
__label__: `[env] ${labelText}`
|
||||
}
|
||||
configNodes.push(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var configSortFn = defaultConfigNodeSort;
|
||||
if (typeof node_def.sort == "function") {
|
||||
configSortFn = node_def.sort;
|
||||
|
@ -830,7 +913,10 @@ RED.editor = (function() {
|
|||
}
|
||||
|
||||
configNodes.forEach(function(cn) {
|
||||
$('<option value="'+cn.id+'"'+(value==cn.id?" selected":"")+'></option>').text(RED.text.bidi.enforceTextDirectionWithUCC(cn.__label__)).appendTo(select);
|
||||
const option = $('<option value="'+cn.id+'"'+(value==cn.id?" selected":"")+'></option>').text(RED.text.bidi.enforceTextDirectionWithUCC(cn.__label__)).appendTo(select);
|
||||
if (cn.env) {
|
||||
option.data('env', cn.env) // set a data attribute to indicate this is an env var (to inhibit the edit button)
|
||||
}
|
||||
delete cn.__label__;
|
||||
});
|
||||
|
||||
|
@ -843,7 +929,12 @@ RED.editor = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
select.append('<option value="_ADD_"'+(value===""?" selected":"")+'>'+RED._("editor.addNewType", {type:label})+'</option>');
|
||||
if (!configNodes.length) {
|
||||
select.append('<option value="_ADD_" selected>' + RED._("editor.addNewType", { type: label }) + '</option>');
|
||||
} else {
|
||||
select.append('<option value="">' + RED._("editor.inputs.none") + '</option>');
|
||||
}
|
||||
|
||||
window.setTimeout(function() { select.trigger("change");},50);
|
||||
}
|
||||
}
|
||||
|
@ -1239,7 +1330,11 @@ RED.editor = (function() {
|
|||
})
|
||||
|
||||
if (node_def.hasUsers !== false) {
|
||||
$('<span><i class="fa fa-info-circle"></i> <span id="red-ui-editor-config-user-count"></span></span>').css("margin-left", "10px").appendTo(trayFooterLeft);
|
||||
// $('<span><i class="fa fa-info-circle"></i> <span id="red-ui-editor-config-user-count"></span></span>').css("margin-left", "10px").appendTo(trayFooterLeft);
|
||||
$('<button type="button" class="red-ui-button"><i class="fa fa-user"></i><span id="red-ui-editor-config-user-count"></span></button>').on('click', function() {
|
||||
RED.sidebar.info.outliner.search('uses:'+editing_config_node.id)
|
||||
RED.sidebar.info.show()
|
||||
}).appendTo(trayFooterLeft);
|
||||
}
|
||||
trayFooter.append('<span class="red-ui-tray-footer-right"><span id="red-ui-editor-config-scope-warning" data-i18n="[title]editor.errors.scopeChange"><i class="fa fa-warning"></i></span><select id="red-ui-editor-config-scope"></select></span>');
|
||||
|
||||
|
@ -1297,7 +1392,8 @@ RED.editor = (function() {
|
|||
});
|
||||
}
|
||||
if (node_def.hasUsers !== false) {
|
||||
$("#red-ui-editor-config-user-count").text(RED._("editor.nodesUse", {count:editing_config_node.users.length})).parent().show();
|
||||
$("#red-ui-editor-config-user-count").text(editing_config_node.users.length).parent().show();
|
||||
RED.popover.tooltip($("#red-ui-editor-config-user-count").parent(), function() { return RED._('editor.nodesUse',{count:editing_config_node.users.length})});
|
||||
}
|
||||
trayBody.i18n();
|
||||
trayFooter.i18n();
|
||||
|
@ -1486,9 +1582,16 @@ RED.editor = (function() {
|
|||
}
|
||||
RED.tray.close(function() {
|
||||
var filter = null;
|
||||
if (editContext && typeof editContext._def.defaults[configProperty].filter === 'function') {
|
||||
filter = function(n) {
|
||||
return editContext._def.defaults[configProperty].filter.call(editContext,n);
|
||||
// when editing a config via subflow edit panel, the `configProperty` will not
|
||||
// necessarily be a property of the editContext._def.defaults object
|
||||
// Also, when editing via dashboard sidebar, editContext can be null
|
||||
// so we need to guard both scenarios
|
||||
if (editContext?._def) {
|
||||
const isSubflow = (editContext._def.type === 'subflow' || /subflow:.*/.test(editContext._def.type))
|
||||
if (editContext && !isSubflow && typeof editContext._def.defaults?.[configProperty]?.filter === 'function') {
|
||||
filter = function(n) {
|
||||
return editContext._def.defaults[configProperty].filter.call(editContext,n);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateConfigNodeSelect(configProperty,configType,editing_config_node.id,prefix,filter);
|
||||
|
@ -1549,7 +1652,7 @@ RED.editor = (function() {
|
|||
RED.history.push(historyEvent);
|
||||
RED.tray.close(function() {
|
||||
var filter = null;
|
||||
if (editContext && typeof editContext._def.defaults[configProperty].filter === 'function') {
|
||||
if (editContext && typeof editContext._def.defaults[configProperty]?.filter === 'function') {
|
||||
filter = function(n) {
|
||||
return editContext._def.defaults[configProperty].filter.call(editContext,n);
|
||||
}
|
||||
|
@ -1626,8 +1729,8 @@ RED.editor = (function() {
|
|||
}
|
||||
|
||||
if (!isSameObj(old_env, new_env)) {
|
||||
editing_node.env = new_env;
|
||||
editState.changes.env = editing_node.env;
|
||||
editing_node.env = new_env;
|
||||
editState.changed = true;
|
||||
}
|
||||
|
||||
|
@ -2090,6 +2193,7 @@ RED.editor = (function() {
|
|||
}
|
||||
},
|
||||
editBuffer: function(options) { showTypeEditor("_buffer", options) },
|
||||
getEditStack: function () { return [...editStack] },
|
||||
buildEditForm: buildEditForm,
|
||||
validateNode: validateNode,
|
||||
updateNodeProperties: updateNodeProperties,
|
||||
|
@ -2134,6 +2238,7 @@ RED.editor = (function() {
|
|||
filteredEditPanes[type] = filter
|
||||
}
|
||||
editPanes[type] = definition;
|
||||
}
|
||||
},
|
||||
prepareConfigNodeSelect: prepareConfigNodeSelect,
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -514,7 +514,7 @@ RED.editor.codeEditor.monaco = (function() {
|
|||
_monaco.languages.json.jsonDefaults.setDiagnosticsOptions(diagnosticOptions);
|
||||
if(modeConfiguration) { _monaco.languages.json.jsonDefaults.setModeConfiguration(modeConfiguration); }
|
||||
} catch (error) {
|
||||
console.warn("monaco - Error setting up json options", err)
|
||||
console.warn("monaco - Error setting up json options", error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ RED.editor.codeEditor.monaco = (function() {
|
|||
if(htmlDefaults) { _monaco.languages.html.htmlDefaults.setOptions(htmlDefaults); }
|
||||
if(handlebarDefaults) { _monaco.languages.html.handlebarDefaults.setOptions(handlebarDefaults); }
|
||||
} catch (error) {
|
||||
console.warn("monaco - Error setting up html options", err)
|
||||
console.warn("monaco - Error setting up html options", error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ RED.editor.codeEditor.monaco = (function() {
|
|||
if(lessDefaults_modeConfiguration) { _monaco.languages.css.cssDefaults.setDiagnosticsOptions(lessDefaults_modeConfiguration); }
|
||||
if(scssDefaults_modeConfiguration) { _monaco.languages.css.cssDefaults.setDiagnosticsOptions(scssDefaults_modeConfiguration); }
|
||||
} catch (error) {
|
||||
console.warn("monaco - Error setting up CSS/SCSS/LESS options", err)
|
||||
console.warn("monaco - Error setting up CSS/SCSS/LESS options", error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ RED.editor.codeEditor.monaco = (function() {
|
|||
createMonacoCompletionItem("set (flow context)", 'flow.set("${1:name}", ${1:value});','Set a value in flow context',range),
|
||||
createMonacoCompletionItem("get (global context)", 'global.get("${1:name}");','Get a value from global context',range),
|
||||
createMonacoCompletionItem("set (global context)", 'global.set("${1:name}", ${1:value});','Set a value in global context',range),
|
||||
createMonacoCompletionItem("get (env)", 'env.get("${1|NR_NODE_ID,NR_NODE_NAME,NR_NODE_PATH,NR_GROUP_ID,NR_GROUP_NAME,NR_FLOW_ID,NR_FLOW_NAME|}");','Get env variable value',range),
|
||||
createMonacoCompletionItem("get (env)", 'env.get("${1|NR_NODE_ID,NR_NODE_NAME,NR_NODE_PATH,NR_GROUP_ID,NR_GROUP_NAME,NR_FLOW_ID,NR_FLOW_NAME,NR_SUBFLOW_NAME,NR_SUBFLOW_ID,NR_SUBFLOW_PATH|}");','Get env variable value',range),
|
||||
createMonacoCompletionItem("cloneMessage (RED.util)", 'RED.util.cloneMessage(${1:msg});',
|
||||
["```typescript",
|
||||
"RED.util.cloneMessage<T extends registry.NodeMessage>(msg: T): T",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
RED.editor.envVarList = (function() {
|
||||
|
||||
var currentLocale = 'en-US';
|
||||
var DEFAULT_ENV_TYPE_LIST = ['str','num','bool','json','bin','env'];
|
||||
var DEFAULT_ENV_TYPE_LIST_INC_CRED = ['str','num','bool','json','bin','env','cred','jsonata'];
|
||||
const DEFAULT_ENV_TYPE_LIST = ['str','num','bool','json','bin','env'];
|
||||
const DEFAULT_ENV_TYPE_LIST_INC_CONFTYPES = ['str','num','bool','json','bin','env','conf-types'];
|
||||
const DEFAULT_ENV_TYPE_LIST_INC_CRED = ['str','num','bool','json','bin','env','cred','jsonata'];
|
||||
|
||||
/**
|
||||
* Create env var edit interface
|
||||
|
@ -10,8 +11,8 @@ RED.editor.envVarList = (function() {
|
|||
* @param node - subflow node
|
||||
*/
|
||||
function buildPropertiesList(envContainer, node) {
|
||||
|
||||
var isTemplateNode = (node.type === "subflow");
|
||||
if(RED.editor.envVarList.debug) { console.log('envVarList: buildPropertiesList', envContainer, node) }
|
||||
const isTemplateNode = (node.type === "subflow");
|
||||
|
||||
envContainer
|
||||
.css({
|
||||
|
@ -83,7 +84,14 @@ RED.editor.envVarList = (function() {
|
|||
// if `opt.ui` does not exist, then apply defaults. If these
|
||||
// defaults do not change then they will get stripped off
|
||||
// before saving.
|
||||
if (opt.type === 'cred') {
|
||||
if (opt.type === 'conf-types') {
|
||||
opt.ui = opt.ui || {
|
||||
icon: "fa fa-cog",
|
||||
type: "conf-types",
|
||||
opts: {opts:[]}
|
||||
}
|
||||
opt.ui.type = "conf-types";
|
||||
} else if (opt.type === 'cred') {
|
||||
opt.ui = opt.ui || {
|
||||
icon: "",
|
||||
type: "cred"
|
||||
|
@ -119,7 +127,7 @@ RED.editor.envVarList = (function() {
|
|||
}
|
||||
});
|
||||
|
||||
buildEnvEditRow(uiRow, opt.ui, nameField, valueField);
|
||||
buildEnvEditRow(uiRow, opt, nameField, valueField);
|
||||
nameField.trigger('change');
|
||||
}
|
||||
},
|
||||
|
@ -181,21 +189,23 @@ RED.editor.envVarList = (function() {
|
|||
* @param nameField - name field of env var
|
||||
* @param valueField - value field of env var
|
||||
*/
|
||||
function buildEnvEditRow(container, ui, nameField, valueField) {
|
||||
function buildEnvEditRow(container, opt, nameField, valueField) {
|
||||
const ui = opt.ui
|
||||
if(RED.editor.envVarList.debug) { console.log('envVarList: buildEnvEditRow', container, ui, nameField, valueField) }
|
||||
container.addClass("red-ui-editor-subflow-env-ui-row")
|
||||
var topRow = $('<div></div>').appendTo(container);
|
||||
$('<div></div>').appendTo(topRow);
|
||||
$('<div>').text(RED._("editor.icon")).appendTo(topRow);
|
||||
$('<div>').text(RED._("editor.label")).appendTo(topRow);
|
||||
$('<div>').text(RED._("editor.inputType")).appendTo(topRow);
|
||||
$('<div class="red-env-ui-input-type-col">').text(RED._("editor.inputType")).appendTo(topRow);
|
||||
|
||||
var row = $('<div></div>').appendTo(container);
|
||||
$('<div><i class="red-ui-editableList-item-handle fa fa-bars"></i></div>').appendTo(row);
|
||||
var typeOptions = {
|
||||
'input': {types:DEFAULT_ENV_TYPE_LIST},
|
||||
'select': {opts:[]},
|
||||
'spinner': {},
|
||||
'cred': {}
|
||||
'input': {types:DEFAULT_ENV_TYPE_LIST_INC_CONFTYPES},
|
||||
'select': {opts:[]},
|
||||
'spinner': {},
|
||||
'cred': {}
|
||||
};
|
||||
if (ui.opts) {
|
||||
typeOptions[ui.type] = ui.opts;
|
||||
|
@ -260,15 +270,16 @@ RED.editor.envVarList = (function() {
|
|||
labelInput.attr("placeholder",$(this).val())
|
||||
});
|
||||
|
||||
var inputCell = $('<div></div>').appendTo(row);
|
||||
var inputCellInput = $('<input type="text">').css("width","100%").appendTo(inputCell);
|
||||
var inputCell = $('<div class="red-env-ui-input-type-col"></div>').appendTo(row);
|
||||
var uiInputTypeInput = $('<input type="text">').css("width","100%").appendTo(inputCell);
|
||||
if (ui.type === "input") {
|
||||
inputCellInput.val(ui.opts.types.join(","));
|
||||
uiInputTypeInput.val(ui.opts.types.join(","));
|
||||
}
|
||||
var checkbox;
|
||||
var selectBox;
|
||||
|
||||
inputCellInput.typedInput({
|
||||
// the options presented in the UI section for an "input" type selection
|
||||
uiInputTypeInput.typedInput({
|
||||
types: [
|
||||
{
|
||||
value:"input",
|
||||
|
@ -429,7 +440,7 @@ RED.editor.envVarList = (function() {
|
|||
}
|
||||
});
|
||||
ui.opts.opts = vals;
|
||||
inputCellInput.typedInput('value',Date.now())
|
||||
uiInputTypeInput.typedInput('value',Date.now())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -496,12 +507,13 @@ RED.editor.envVarList = (function() {
|
|||
} else {
|
||||
delete ui.opts.max;
|
||||
}
|
||||
inputCellInput.typedInput('value',Date.now())
|
||||
uiInputTypeInput.typedInput('value',Date.now())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'conf-types',
|
||||
{
|
||||
value:"none",
|
||||
label:RED._("editor.inputs.none"), icon:"fa fa-times",hasValue:false
|
||||
|
@ -519,14 +531,20 @@ RED.editor.envVarList = (function() {
|
|||
// In the case of 'input' type, the typedInput uses the multiple-option
|
||||
// mode. Its value needs to be set to a comma-separately list of the
|
||||
// selected options.
|
||||
inputCellInput.typedInput('value',ui.opts.types.join(","))
|
||||
uiInputTypeInput.typedInput('value',ui.opts.types.join(","))
|
||||
} else if (ui.type === 'conf-types') {
|
||||
// In the case of 'conf-types' type, the typedInput will be populated
|
||||
// with a list of all config nodes types installed.
|
||||
// Restore the value to the last selected type
|
||||
uiInputTypeInput.typedInput('value', opt.type)
|
||||
} else {
|
||||
// No other type cares about `value`, but doing this will
|
||||
// force a refresh of the label now that `ui.opts` has
|
||||
// been updated.
|
||||
inputCellInput.typedInput('value',Date.now())
|
||||
uiInputTypeInput.typedInput('value',Date.now())
|
||||
}
|
||||
|
||||
if(RED.editor.envVarList.debug) { console.log('envVarList: inputCellInput on:typedinputtypechange. ui.type = ' + ui.type) }
|
||||
switch (ui.type) {
|
||||
case 'input':
|
||||
valueField.typedInput('types',ui.opts.types);
|
||||
|
@ -544,7 +562,7 @@ RED.editor.envVarList = (function() {
|
|||
valueField.typedInput('types',['cred']);
|
||||
break;
|
||||
default:
|
||||
valueField.typedInput('types',DEFAULT_ENV_TYPE_LIST)
|
||||
valueField.typedInput('types', DEFAULT_ENV_TYPE_LIST);
|
||||
}
|
||||
if (ui.type === 'checkbox') {
|
||||
valueField.typedInput('type','bool');
|
||||
|
@ -556,8 +574,46 @@ RED.editor.envVarList = (function() {
|
|||
}
|
||||
|
||||
}).on("change", function(evt,type) {
|
||||
if (ui.type === 'input') {
|
||||
var types = inputCellInput.typedInput('value');
|
||||
const selectedType = $(this).typedInput('type') // the UI typedInput type
|
||||
if(RED.editor.envVarList.debug) { console.log('envVarList: inputCellInput on:change. selectedType = ' + selectedType) }
|
||||
if (selectedType === 'conf-types') {
|
||||
const selectedConfigType = $(this).typedInput('value') || opt.type
|
||||
let activeWorkspace = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (!activeWorkspace) {
|
||||
activeWorkspace = RED.nodes.subflow(RED.workspaces.active());
|
||||
}
|
||||
|
||||
// get a list of all config nodes matching the selectedValue
|
||||
const configNodes = [];
|
||||
RED.nodes.eachConfig(function(config) {
|
||||
if (config.type == selectedConfigType && (!config.z || config.z === activeWorkspace.id)) {
|
||||
const modulePath = config._def?.set?.id || ''
|
||||
let label = RED.utils.getNodeLabel(config, config.id) || config.id;
|
||||
label += config.d ? ' ['+RED._('workspace.disabled')+']' : '';
|
||||
const _config = {
|
||||
_type: selectedConfigType,
|
||||
value: config.id,
|
||||
label: label,
|
||||
title: modulePath ? modulePath + ' - ' + label : label,
|
||||
enabled: config.d !== true,
|
||||
disabled: config.d === true,
|
||||
}
|
||||
configNodes.push(_config);
|
||||
}
|
||||
});
|
||||
const tiTypes = {
|
||||
value: selectedConfigType,
|
||||
label: "config",
|
||||
icon: "fa fa-cog",
|
||||
options: configNodes,
|
||||
}
|
||||
valueField.typedInput('types', [tiTypes]);
|
||||
valueField.typedInput('type', selectedConfigType);
|
||||
valueField.typedInput('value', opt.value);
|
||||
|
||||
|
||||
} else if (ui.type === 'input') {
|
||||
var types = uiInputTypeInput.typedInput('value');
|
||||
ui.opts.types = (types === "") ? ["str"] : types.split(",");
|
||||
valueField.typedInput('types',ui.opts.types);
|
||||
}
|
||||
|
@ -569,7 +625,7 @@ RED.editor.envVarList = (function() {
|
|||
})
|
||||
// Set the input to the right type. This will trigger the 'typedinputtypechange'
|
||||
// event handler (just above ^^) to update the value if needed
|
||||
inputCellInput.typedInput('type',ui.type)
|
||||
uiInputTypeInput.typedInput('type',ui.type)
|
||||
}
|
||||
|
||||
function setLocale(l, list) {
|
||||
|
|
|
@ -71,7 +71,7 @@ RED.envVar = (function() {
|
|||
};
|
||||
if (item.name.trim() !== "") {
|
||||
new_env.push(item);
|
||||
if ((item.type === "cred") && (item.value !== "__PWRD__")) {
|
||||
if (item.type === "cred") {
|
||||
credentials.map[item.name] = item.value;
|
||||
credentials.map["has_"+item.name] = (item.value !== "");
|
||||
item.value = "__PWRD__";
|
||||
|
@ -153,10 +153,6 @@ RED.envVar = (function() {
|
|||
}
|
||||
|
||||
function init(done) {
|
||||
if (!RED.user.hasPermission("settings.write")) {
|
||||
RED.notify(RED._("user.errors.settings"),"error");
|
||||
return;
|
||||
}
|
||||
RED.userSettings.add({
|
||||
id:'envvar',
|
||||
title: RED._("env-var.environment"),
|
||||
|
|
|
@ -221,12 +221,12 @@ RED.notifications = (function() {
|
|||
if (newType) {
|
||||
n.className = "red-ui-notification red-ui-notification-"+newType;
|
||||
}
|
||||
|
||||
newTimeout = newOptions.hasOwnProperty('timeout')?newOptions.timeout:timeout
|
||||
if (!fixed || newOptions.fixed === false) {
|
||||
newTimeout = (newOptions.hasOwnProperty('timeout')?newOptions.timeout:timeout)||5000;
|
||||
newTimeout = newTimeout || 5000
|
||||
}
|
||||
if (newOptions.buttons) {
|
||||
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn)
|
||||
var buttonSet = $('<div class="ui-dialog-buttonset"></div>').appendTo(nn)
|
||||
newOptions.buttons.forEach(function(buttonDef) {
|
||||
var b = $('<button>').text(buttonDef.text).on("click", buttonDef.click).appendTo(buttonSet);
|
||||
if (buttonDef.id) {
|
||||
|
@ -272,6 +272,15 @@ RED.notifications = (function() {
|
|||
};
|
||||
})());
|
||||
n.timeoutid = window.setTimeout(n.close,timeout||5000);
|
||||
} else if (timeout) {
|
||||
$(n).on("click.red-ui-notification-close", (function() {
|
||||
var nn = n;
|
||||
return function() {
|
||||
nn.hideNotification();
|
||||
window.clearTimeout(nn.timeoutid);
|
||||
};
|
||||
})());
|
||||
n.timeoutid = window.setTimeout(n.hideNotification,timeout||5000);
|
||||
}
|
||||
currentNotifications.push(n);
|
||||
if (options.id) {
|
||||
|
|
|
@ -133,7 +133,7 @@ RED.palette.editor = (function() {
|
|||
}).done(function(data,textStatus,xhr) {
|
||||
callback();
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
callback(xhr);
|
||||
callback(xhr,textStatus,err);
|
||||
});
|
||||
}
|
||||
function removeNodeModule(id,callback) {
|
||||
|
@ -248,86 +248,106 @@ RED.palette.editor = (function() {
|
|||
var moduleInfo = nodeEntries[module].info;
|
||||
var nodeEntry = nodeEntries[module].elements;
|
||||
if (nodeEntry) {
|
||||
var activeTypeCount = 0;
|
||||
var typeCount = 0;
|
||||
var errorCount = 0;
|
||||
nodeEntry.errorList.empty();
|
||||
nodeEntries[module].totalUseCount = 0;
|
||||
nodeEntries[module].setUseCount = {};
|
||||
if (moduleInfo.plugin) {
|
||||
nodeEntry.enableButton.hide();
|
||||
nodeEntry.removeButton.show();
|
||||
|
||||
for (var setName in moduleInfo.sets) {
|
||||
if (moduleInfo.sets.hasOwnProperty(setName)) {
|
||||
var inUseCount = 0;
|
||||
var set = moduleInfo.sets[setName];
|
||||
var setElements = nodeEntry.sets[setName];
|
||||
if (set.err) {
|
||||
errorCount++;
|
||||
var errMessage = set.err;
|
||||
if (set.err.message) {
|
||||
errMessage = set.err.message;
|
||||
} else if (set.err.code) {
|
||||
errMessage = set.err.code;
|
||||
let pluginCount = 0;
|
||||
for (let setName in moduleInfo.sets) {
|
||||
if (moduleInfo.sets.hasOwnProperty(setName)) {
|
||||
let set = moduleInfo.sets[setName];
|
||||
if (set.plugins) {
|
||||
pluginCount += set.plugins.length;
|
||||
}
|
||||
$("<li>").text(errMessage).appendTo(nodeEntry.errorList);
|
||||
}
|
||||
if (set.enabled) {
|
||||
activeTypeCount += set.types.length;
|
||||
}
|
||||
typeCount += set.types.length;
|
||||
for (var i=0;i<moduleInfo.sets[setName].types.length;i++) {
|
||||
var t = moduleInfo.sets[setName].types[i];
|
||||
inUseCount += (typesInUse[t]||0);
|
||||
var swatch = setElements.swatches[t];
|
||||
}
|
||||
|
||||
nodeEntry.setCount.text(RED._('palette.editor.pluginCount',{count:pluginCount,label:pluginCount}));
|
||||
|
||||
} else {
|
||||
var activeTypeCount = 0;
|
||||
var typeCount = 0;
|
||||
var errorCount = 0;
|
||||
nodeEntry.errorList.empty();
|
||||
nodeEntries[module].totalUseCount = 0;
|
||||
nodeEntries[module].setUseCount = {};
|
||||
|
||||
for (var setName in moduleInfo.sets) {
|
||||
if (moduleInfo.sets.hasOwnProperty(setName)) {
|
||||
var inUseCount = 0;
|
||||
const set = moduleInfo.sets[setName];
|
||||
const setElements = nodeEntry.sets[setName]
|
||||
|
||||
if (set.err) {
|
||||
errorCount++;
|
||||
var errMessage = set.err;
|
||||
if (set.err.message) {
|
||||
errMessage = set.err.message;
|
||||
} else if (set.err.code) {
|
||||
errMessage = set.err.code;
|
||||
}
|
||||
$("<li>").text(errMessage).appendTo(nodeEntry.errorList);
|
||||
}
|
||||
if (set.enabled) {
|
||||
var def = RED.nodes.getType(t);
|
||||
if (def && def.color) {
|
||||
swatch.css({background:RED.utils.getNodeColor(t,def)});
|
||||
swatch.css({border: "1px solid "+getContrastingBorder(swatch.css('backgroundColor'))})
|
||||
activeTypeCount += set.types.length;
|
||||
}
|
||||
typeCount += set.types.length;
|
||||
for (var i=0;i<moduleInfo.sets[setName].types.length;i++) {
|
||||
var t = moduleInfo.sets[setName].types[i];
|
||||
inUseCount += (typesInUse[t]||0);
|
||||
if (setElements && set.enabled) {
|
||||
var def = RED.nodes.getType(t);
|
||||
if (def && def.color) {
|
||||
setElements.swatches[t].css({background:RED.utils.getNodeColor(t,def)});
|
||||
setElements.swatches[t].css({border: "1px solid "+getContrastingBorder(setElements.swatches[t].css('backgroundColor'))})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nodeEntries[module].setUseCount[setName] = inUseCount;
|
||||
nodeEntries[module].totalUseCount += inUseCount;
|
||||
nodeEntries[module].setUseCount[setName] = inUseCount;
|
||||
nodeEntries[module].totalUseCount += inUseCount;
|
||||
|
||||
if (inUseCount > 0) {
|
||||
setElements.enableButton.text(RED._('palette.editor.inuse'));
|
||||
setElements.enableButton.addClass('disabled');
|
||||
} else {
|
||||
setElements.enableButton.removeClass('disabled');
|
||||
if (set.enabled) {
|
||||
setElements.enableButton.text(RED._('palette.editor.disable'));
|
||||
} else {
|
||||
setElements.enableButton.text(RED._('palette.editor.enable'));
|
||||
if (setElements) {
|
||||
if (inUseCount > 0) {
|
||||
setElements.enableButton.text(RED._('palette.editor.inuse'));
|
||||
setElements.enableButton.addClass('disabled');
|
||||
} else {
|
||||
setElements.enableButton.removeClass('disabled');
|
||||
if (set.enabled) {
|
||||
setElements.enableButton.text(RED._('palette.editor.disable'));
|
||||
} else {
|
||||
setElements.enableButton.text(RED._('palette.editor.enable'));
|
||||
}
|
||||
}
|
||||
setElements.setRow.toggleClass("red-ui-palette-module-set-disabled",!set.enabled);
|
||||
}
|
||||
}
|
||||
setElements.setRow.toggleClass("red-ui-palette-module-set-disabled",!set.enabled);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorCount === 0) {
|
||||
nodeEntry.errorRow.hide()
|
||||
} else {
|
||||
nodeEntry.errorRow.show();
|
||||
}
|
||||
|
||||
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
|
||||
nodeEntry.setCount.text(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
|
||||
|
||||
if (nodeEntries[module].totalUseCount > 0) {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.inuse'));
|
||||
nodeEntry.enableButton.addClass('disabled');
|
||||
nodeEntry.removeButton.hide();
|
||||
} else {
|
||||
nodeEntry.enableButton.removeClass('disabled');
|
||||
if (moduleInfo.local) {
|
||||
nodeEntry.removeButton.css('display', 'inline-block');
|
||||
}
|
||||
if (activeTypeCount === 0) {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.enableall'));
|
||||
if (errorCount === 0) {
|
||||
nodeEntry.errorRow.hide()
|
||||
} else {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.disableall'));
|
||||
nodeEntry.errorRow.show();
|
||||
}
|
||||
|
||||
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
|
||||
nodeEntry.setCount.text(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
|
||||
|
||||
if (nodeEntries[module].totalUseCount > 0) {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.inuse'));
|
||||
nodeEntry.enableButton.addClass('disabled');
|
||||
nodeEntry.removeButton.hide();
|
||||
} else {
|
||||
nodeEntry.enableButton.removeClass('disabled');
|
||||
if (moduleInfo.local) {
|
||||
nodeEntry.removeButton.css('display', 'inline-block');
|
||||
}
|
||||
if (activeTypeCount === 0) {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.enableall'));
|
||||
} else {
|
||||
nodeEntry.enableButton.text(RED._('palette.editor.disableall'));
|
||||
}
|
||||
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
||||
}
|
||||
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
||||
}
|
||||
}
|
||||
if (moduleInfo.pending_version) {
|
||||
|
@ -678,6 +698,33 @@ RED.palette.editor = (function() {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
RED.events.on("registry:plugin-module-added", function(module) {
|
||||
|
||||
if (!nodeEntries.hasOwnProperty(module)) {
|
||||
nodeEntries[module] = {info:RED.plugins.getModule(module)};
|
||||
var index = [module];
|
||||
for (var s in nodeEntries[module].info.sets) {
|
||||
if (nodeEntries[module].info.sets.hasOwnProperty(s)) {
|
||||
index.push(s);
|
||||
index = index.concat(nodeEntries[module].info.sets[s].types)
|
||||
}
|
||||
}
|
||||
nodeEntries[module].index = index.join(",").toLowerCase();
|
||||
nodeList.editableList('addItem', nodeEntries[module]);
|
||||
} else {
|
||||
_refreshNodeModule(module);
|
||||
}
|
||||
|
||||
for (var i=0;i<filteredList.length;i++) {
|
||||
if (filteredList[i].info.id === module) {
|
||||
var installButton = filteredList[i].elements.installButton;
|
||||
installButton.addClass('disabled');
|
||||
installButton.text(RED._('palette.editor.installed'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var settingsPane;
|
||||
|
@ -804,6 +851,7 @@ RED.palette.editor = (function() {
|
|||
errorRow: errorRow,
|
||||
errorList: errorList,
|
||||
setCount: setCount,
|
||||
setButton: setButton,
|
||||
container: container,
|
||||
shade: shade,
|
||||
versionSpan: versionSpan,
|
||||
|
@ -814,49 +862,88 @@ RED.palette.editor = (function() {
|
|||
if (container.hasClass('expanded')) {
|
||||
container.removeClass('expanded');
|
||||
contentRow.slideUp();
|
||||
setTimeout(() => {
|
||||
contentRow.empty()
|
||||
}, 200)
|
||||
object.elements.sets = {}
|
||||
} else {
|
||||
container.addClass('expanded');
|
||||
populateSetList()
|
||||
contentRow.slideDown();
|
||||
}
|
||||
})
|
||||
|
||||
var setList = Object.keys(entry.sets)
|
||||
setList.sort(function(A,B) {
|
||||
return A.toLowerCase().localeCompare(B.toLowerCase());
|
||||
});
|
||||
setList.forEach(function(setName) {
|
||||
var set = entry.sets[setName];
|
||||
var setRow = $('<div>',{class:"red-ui-palette-module-set"}).appendTo(contentRow);
|
||||
var buttonGroup = $('<div>',{class:"red-ui-palette-module-set-button-group"}).appendTo(setRow);
|
||||
var typeSwatches = {};
|
||||
set.types.forEach(function(t) {
|
||||
var typeDiv = $('<div>',{class:"red-ui-palette-module-type"}).appendTo(setRow);
|
||||
typeSwatches[t] = $('<span>',{class:"red-ui-palette-module-type-swatch"}).appendTo(typeDiv);
|
||||
$('<span>',{class:"red-ui-palette-module-type-node"}).text(t).appendTo(typeDiv);
|
||||
})
|
||||
var enableButton = $('<a href="#" class="red-ui-button red-ui-button-small"></a>').appendTo(buttonGroup);
|
||||
enableButton.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if (object.setUseCount[setName] === 0) {
|
||||
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
||||
shade.show();
|
||||
var newState = !currentSet.enabled
|
||||
changeNodeState(set.id,newState,shade,function(xhr){
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.'+(newState?'enable':'disable')+'Failed',{module: id,message:xhr.responseJSON.message}));
|
||||
const populateSetList = function () {
|
||||
var setList = Object.keys(entry.sets)
|
||||
setList.sort(function(A,B) {
|
||||
return A.toLowerCase().localeCompare(B.toLowerCase());
|
||||
});
|
||||
setList.forEach(function(setName) {
|
||||
var set = entry.sets[setName];
|
||||
var setRow = $('<div>',{class:"red-ui-palette-module-set"}).appendTo(contentRow);
|
||||
var buttonGroup = $('<div>',{class:"red-ui-palette-module-set-button-group"}).appendTo(setRow);
|
||||
var typeSwatches = {};
|
||||
let enableButton;
|
||||
if (set.types) {
|
||||
set.types.forEach(function(t) {
|
||||
var typeDiv = $('<div>',{class:"red-ui-palette-module-type"}).appendTo(setRow);
|
||||
typeSwatches[t] = $('<span>',{class:"red-ui-palette-module-type-swatch"}).appendTo(typeDiv);
|
||||
if (set.enabled) {
|
||||
var def = RED.nodes.getType(t);
|
||||
if (def && def.color) {
|
||||
typeSwatches[t].css({background:RED.utils.getNodeColor(t,def)});
|
||||
typeSwatches[t].css({border: "1px solid "+getContrastingBorder(typeSwatches[t].css('backgroundColor'))})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
$('<span>',{class:"red-ui-palette-module-type-node"}).text(t).appendTo(typeDiv);
|
||||
})
|
||||
enableButton = $('<a href="#" class="red-ui-button red-ui-button-small"></a>').appendTo(buttonGroup);
|
||||
enableButton.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if (object.setUseCount[setName] === 0) {
|
||||
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
||||
shade.show();
|
||||
var newState = !currentSet.enabled
|
||||
changeNodeState(set.id,newState,shade,function(xhr){
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.'+(newState?'enable':'disable')+'Failed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
object.elements.sets[set.name] = {
|
||||
setRow: setRow,
|
||||
enableButton: enableButton,
|
||||
swatches: typeSwatches
|
||||
};
|
||||
});
|
||||
if (object.setUseCount[setName] > 0) {
|
||||
enableButton.text(RED._('palette.editor.inuse'));
|
||||
enableButton.addClass('disabled');
|
||||
} else {
|
||||
enableButton.removeClass('disabled');
|
||||
if (set.enabled) {
|
||||
enableButton.text(RED._('palette.editor.disable'));
|
||||
} else {
|
||||
enableButton.text(RED._('palette.editor.enable'));
|
||||
}
|
||||
}
|
||||
setRow.toggleClass("red-ui-palette-module-set-disabled",!set.enabled);
|
||||
|
||||
|
||||
}
|
||||
if (set.plugins) {
|
||||
set.plugins.forEach(function(p) {
|
||||
var typeDiv = $('<div>',{class:"red-ui-palette-module-type"}).appendTo(setRow);
|
||||
// typeSwatches[p.id] = $('<span>',{class:"red-ui-palette-module-type-swatch"}).appendTo(typeDiv);
|
||||
$('<span><i class="fa fa-puzzle-piece" aria-hidden="true"></i> </span>',{class:"red-ui-palette-module-type-swatch"}).appendTo(typeDiv);
|
||||
$('<span>',{class:"red-ui-palette-module-type-node"}).text(p.id).appendTo(typeDiv);
|
||||
})
|
||||
}
|
||||
|
||||
object.elements.sets[set.name] = {
|
||||
setRow: setRow,
|
||||
enableButton: enableButton,
|
||||
swatches: typeSwatches
|
||||
};
|
||||
});
|
||||
}
|
||||
enableButton.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if (object.totalUseCount === 0) {
|
||||
|
@ -1226,7 +1313,55 @@ RED.palette.editor = (function() {
|
|||
}
|
||||
}
|
||||
]
|
||||
}); }
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// dedicated list management for plugins
|
||||
if (entry.plugin) {
|
||||
|
||||
let e = nodeEntries[entry.name];
|
||||
if (e) {
|
||||
nodeList.editableList('removeItem', e);
|
||||
delete nodeEntries[entry.name];
|
||||
}
|
||||
|
||||
// We assume that a plugin that implements onremove
|
||||
// cleans the editor accordingly of its left-overs.
|
||||
let found_onremove = true;
|
||||
|
||||
let keys = Object.keys(entry.sets);
|
||||
keys.forEach((key) => {
|
||||
let set = entry.sets[key];
|
||||
for (let i=0; i<set.plugins?.length; i++) {
|
||||
let plgn = RED.plugins.getPlugin(set.plugins[i].id);
|
||||
if (plgn && plgn.onremove && typeof plgn.onremove === 'function') {
|
||||
plgn.onremove();
|
||||
} else {
|
||||
if (plgn && plgn.onadd && typeof plgn.onadd === 'function') {
|
||||
// if there's no 'onadd', there shouldn't be any left-overs
|
||||
found_onremove = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!found_onremove) {
|
||||
let removeNotify = RED.notify(RED._("palette.editor.confirm.removePlugin.body",{module:entry.name}),{
|
||||
modal: true,
|
||||
fixed: true,
|
||||
type: 'warning',
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.understood"),
|
||||
class:"primary",
|
||||
click: function(e) {
|
||||
removeNotify.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
notification.close();
|
||||
|
@ -1270,9 +1405,28 @@ RED.palette.editor = (function() {
|
|||
RED.actions.invoke("core:show-event-log");
|
||||
});
|
||||
RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+entry.id+" "+entry.version);
|
||||
installNodeModule(entry.id,entry.version,entry.pkg_url,function(xhr) {
|
||||
installNodeModule(entry.id,entry.version,entry.pkg_url,function(xhr, textStatus,err) {
|
||||
spinner.remove();
|
||||
if (xhr) {
|
||||
if (err && xhr.status === 504) {
|
||||
var notification = RED.notify(RED._("palette.editor.errors.installTimeout"), {
|
||||
modal: true,
|
||||
fixed: true,
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("common.label.close"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
}
|
||||
},{
|
||||
text: RED._("eventLog.view"),
|
||||
click: function() {
|
||||
notification.close();
|
||||
RED.actions.invoke("core:show-event-log");
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
} else if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
var notification = RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}),{
|
||||
type: 'error',
|
||||
|
|
|
@ -35,6 +35,10 @@ RED.palette = (function() {
|
|||
var categoryContainers = {};
|
||||
var sidebarControls;
|
||||
|
||||
let paletteState = { filter: "", collapsed: [] };
|
||||
|
||||
let filterRefreshTimeout
|
||||
|
||||
function createCategory(originalCategory,rootCategory,category,ns) {
|
||||
if ($("#red-ui-palette-base-category-"+rootCategory).length === 0) {
|
||||
createCategoryContainer(originalCategory,rootCategory, ns+":palette.label."+rootCategory);
|
||||
|
@ -60,20 +64,57 @@ RED.palette = (function() {
|
|||
catDiv.data('label',label);
|
||||
categoryContainers[category] = {
|
||||
container: catDiv,
|
||||
close: function() {
|
||||
hide: function (instant) {
|
||||
if (instant) {
|
||||
catDiv.hide()
|
||||
} else {
|
||||
catDiv.slideUp()
|
||||
}
|
||||
},
|
||||
show: function () {
|
||||
catDiv.show()
|
||||
},
|
||||
isOpen: function () {
|
||||
return !!catDiv.hasClass("red-ui-palette-open")
|
||||
},
|
||||
getNodeCount: function (visibleOnly) {
|
||||
const nodes = catDiv.find(".red-ui-palette-node")
|
||||
if (visibleOnly) {
|
||||
return nodes.filter(function() { return $(this).css('display') !== 'none'}).length
|
||||
} else {
|
||||
return nodes.length
|
||||
}
|
||||
},
|
||||
close: function(instant, skipSaveState) {
|
||||
catDiv.removeClass("red-ui-palette-open");
|
||||
catDiv.addClass("red-ui-palette-closed");
|
||||
$("#red-ui-palette-base-category-"+category).slideUp();
|
||||
if (instant) {
|
||||
$("#red-ui-palette-base-category-"+category).hide();
|
||||
} else {
|
||||
$("#red-ui-palette-base-category-"+category).slideUp();
|
||||
}
|
||||
$("#red-ui-palette-header-"+category+" i").removeClass("expanded");
|
||||
if (!skipSaveState) {
|
||||
if (!paletteState.collapsed.includes(category)) {
|
||||
paletteState.collapsed.push(category);
|
||||
savePaletteState();
|
||||
}
|
||||
}
|
||||
},
|
||||
open: function() {
|
||||
open: function(skipSaveState) {
|
||||
catDiv.addClass("red-ui-palette-open");
|
||||
catDiv.removeClass("red-ui-palette-closed");
|
||||
$("#red-ui-palette-base-category-"+category).slideDown();
|
||||
$("#red-ui-palette-header-"+category+" i").addClass("expanded");
|
||||
if (!skipSaveState) {
|
||||
if (paletteState.collapsed.includes(category)) {
|
||||
paletteState.collapsed.splice(paletteState.collapsed.indexOf(category), 1);
|
||||
savePaletteState();
|
||||
}
|
||||
}
|
||||
},
|
||||
toggle: function() {
|
||||
if (catDiv.hasClass("red-ui-palette-open")) {
|
||||
if (categoryContainers[category].isOpen()) {
|
||||
categoryContainers[category].close();
|
||||
} else {
|
||||
categoryContainers[category].open();
|
||||
|
@ -415,8 +456,16 @@ RED.palette = (function() {
|
|||
|
||||
var categoryNode = $("#red-ui-palette-container-"+rootCategory);
|
||||
if (categoryNode.find(".red-ui-palette-node").length === 1) {
|
||||
categoryContainers[rootCategory].open();
|
||||
if (!paletteState?.collapsed?.includes(rootCategory)) {
|
||||
categoryContainers[rootCategory].open();
|
||||
} else {
|
||||
categoryContainers[rootCategory].close(true);
|
||||
}
|
||||
}
|
||||
clearTimeout(filterRefreshTimeout)
|
||||
filterRefreshTimeout = setTimeout(() => {
|
||||
refreshFilter()
|
||||
}, 200)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -484,7 +533,7 @@ RED.palette = (function() {
|
|||
var currentLabel = paletteNode.attr("data-palette-label");
|
||||
var currentInfo = paletteNode.attr("data-palette-info");
|
||||
|
||||
if (currentLabel !== sf.name || currentInfo !== sf.info) {
|
||||
if (currentLabel !== sf.name || currentInfo !== sf.info || sf.in.length > 0 || sf.out.length > 0) {
|
||||
paletteNode.attr("data-palette-info",sf.info);
|
||||
setLabel(sf.type+":"+sf.id,paletteNode,sf.name,RED.utils.renderMarkdown(sf.info||""));
|
||||
}
|
||||
|
@ -516,7 +565,8 @@ RED.palette = (function() {
|
|||
paletteNode.css("backgroundColor", sf.color);
|
||||
}
|
||||
|
||||
function filterChange(val) {
|
||||
function refreshFilter() {
|
||||
const val = $("#red-ui-palette-search input").val()
|
||||
var re = new RegExp(val.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'),'i');
|
||||
$("#red-ui-palette-container .red-ui-palette-node").each(function(i,el) {
|
||||
var currentLabel = $(el).attr("data-palette-label");
|
||||
|
@ -528,16 +578,26 @@ RED.palette = (function() {
|
|||
}
|
||||
});
|
||||
|
||||
for (var category in categoryContainers) {
|
||||
for (let category in categoryContainers) {
|
||||
if (categoryContainers.hasOwnProperty(category)) {
|
||||
if (categoryContainers[category].container
|
||||
.find(".red-ui-palette-node")
|
||||
.filter(function() { return $(this).css('display') !== 'none'}).length === 0) {
|
||||
categoryContainers[category].close();
|
||||
categoryContainers[category].container.slideUp();
|
||||
const categorySection = categoryContainers[category]
|
||||
if (categorySection.getNodeCount(true) === 0) {
|
||||
categorySection.hide()
|
||||
} else {
|
||||
categoryContainers[category].open();
|
||||
categoryContainers[category].container.show();
|
||||
categorySection.show()
|
||||
if (val) {
|
||||
// There is a filter being applied and it has matched
|
||||
// something in this category - show the contents
|
||||
categorySection.open(true)
|
||||
} else {
|
||||
// No filter. Only show the category if it isn't in lastState
|
||||
if (!paletteState.collapsed.includes(category)) {
|
||||
categorySection.open(true)
|
||||
} else if (categorySection.isOpen()) {
|
||||
// This section should be collapsed but isn't - so make it so
|
||||
categorySection.close(true, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -553,6 +613,9 @@ RED.palette = (function() {
|
|||
|
||||
$("#red-ui-palette > .red-ui-palette-spinner").show();
|
||||
|
||||
RED.events.on('logout', function () {
|
||||
RED.settings.removeLocal('palette-state')
|
||||
})
|
||||
|
||||
RED.events.on('registry:node-type-added', function(nodeType) {
|
||||
var def = RED.nodes.getType(nodeType);
|
||||
|
@ -596,14 +659,14 @@ RED.palette = (function() {
|
|||
|
||||
RED.events.on("subflows:change",refreshSubflow);
|
||||
|
||||
|
||||
|
||||
$("#red-ui-palette-search input").searchBox({
|
||||
delay: 100,
|
||||
change: function() {
|
||||
filterChange($(this).val());
|
||||
refreshFilter();
|
||||
paletteState.filter = $(this).val();
|
||||
savePaletteState();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
sidebarControls = $('<div class="red-ui-sidebar-control-left"><i class="fa fa-chevron-left"></i></div>').appendTo($("#red-ui-palette"));
|
||||
RED.popover.tooltip(sidebarControls,RED._("keyboard.togglePalette"),"core:toggle-palette");
|
||||
|
@ -669,7 +732,23 @@ RED.palette = (function() {
|
|||
togglePalette(state);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
paletteState = JSON.parse(RED.settings.getLocal("palette-state") || '{"filter":"", "collapsed": []}');
|
||||
if (paletteState.filter) {
|
||||
// Apply the category filter
|
||||
$("#red-ui-palette-search input").searchBox("value", paletteState.filter);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Unexpected error loading palette state from localStorage: ", error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
// Lazily tidy up any categories that haven't been reloaded
|
||||
paletteState.collapsed = paletteState.collapsed.filter(category => !!categoryContainers[category])
|
||||
savePaletteState()
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
function togglePalette(state) {
|
||||
if (!state) {
|
||||
$("#red-ui-main-container").addClass("red-ui-palette-closed");
|
||||
|
@ -689,6 +768,15 @@ RED.palette = (function() {
|
|||
})
|
||||
return categories;
|
||||
}
|
||||
|
||||
function savePaletteState() {
|
||||
try {
|
||||
RED.settings.setLocal("palette-state", JSON.stringify(paletteState));
|
||||
} catch (error) {
|
||||
console.error("Unexpected error saving palette state to localStorage: ", error);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
add:addNodeType,
|
||||
|
|
|
@ -287,7 +287,7 @@ RED.projects.settings = (function() {
|
|||
var notInstalledCount = 0;
|
||||
|
||||
for (var m in modulesInUse) {
|
||||
if (modulesInUse.hasOwnProperty(m)) {
|
||||
if (modulesInUse.hasOwnProperty(m) && !activeProject.dependencies.hasOwnProperty(m)) {
|
||||
depsList.editableList('addItem',{
|
||||
id: modulesInUse[m].module,
|
||||
version: modulesInUse[m].version,
|
||||
|
@ -307,8 +307,8 @@ RED.projects.settings = (function() {
|
|||
|
||||
if (activeProject.dependencies) {
|
||||
for (var m in activeProject.dependencies) {
|
||||
if (activeProject.dependencies.hasOwnProperty(m) && !modulesInUse.hasOwnProperty(m)) {
|
||||
var installed = !!RED.nodes.registry.getModule(m);
|
||||
if (activeProject.dependencies.hasOwnProperty(m)) {
|
||||
var installed = !!RED.nodes.registry.getModule(m) && activeProject.dependencies[m] === modulesInUse[m].version;
|
||||
depsList.editableList('addItem',{
|
||||
id: m,
|
||||
version: activeProject.dependencies[m], //RED.nodes.registry.getModule(module).version,
|
||||
|
|
|
@ -909,17 +909,19 @@ RED.subflow = (function() {
|
|||
|
||||
|
||||
/**
|
||||
* Create interface for controlling env var UI definition
|
||||
* Build the edit dialog for a subflow template (creating/modifying a subflow template)
|
||||
* @param {Object} uiContainer - the jQuery container for the environment variable list
|
||||
* @param {Object} node - the subflow template node
|
||||
*/
|
||||
function buildEnvControl(envList,node) {
|
||||
function buildEnvControl(uiContainer,node) {
|
||||
var tabs = RED.tabs.create({
|
||||
id: "subflow-env-tabs",
|
||||
onchange: function(tab) {
|
||||
if (tab.id === "subflow-env-tab-preview") {
|
||||
var inputContainer = $("#subflow-input-ui");
|
||||
var list = envList.editableList("items");
|
||||
var list = uiContainer.editableList("items");
|
||||
var exportedEnv = exportEnvList(list, true);
|
||||
buildEnvUI(inputContainer, exportedEnv,node);
|
||||
buildEnvUI(inputContainer, exportedEnv, node);
|
||||
}
|
||||
$("#subflow-env-tabs-content").children().hide();
|
||||
$("#" + tab.id).show();
|
||||
|
@ -957,12 +959,33 @@ RED.subflow = (function() {
|
|||
RED.editor.envVarList.setLocale(locale);
|
||||
}
|
||||
|
||||
|
||||
function buildEnvUIRow(row, tenv, ui, node) {
|
||||
/**
|
||||
* Build a UI row for a subflow instance environment variable
|
||||
* Also used to build the UI row for subflow template preview
|
||||
* @param {JQuery} row - A form row element
|
||||
* @param {Object} tenv - A template environment variable
|
||||
* @param {String} tenv.name - The name of the environment variable
|
||||
* @param {String} tenv.type - The type of the environment variable
|
||||
* @param {String} tenv.value - The value set for this environment variable
|
||||
* @param {Object} tenv.parent - The parent environment variable
|
||||
* @param {String} tenv.parent.value - The value set for the parent environment variable
|
||||
* @param {String} tenv.parent.type - The type of the parent environment variable
|
||||
* @param {Object} tenv.ui - The UI configuration for the environment variable
|
||||
* @param {String} tenv.ui.icon - The icon for the environment variable
|
||||
* @param {Object} tenv.ui.label - The label for the environment variable
|
||||
* @param {String} tenv.ui.type - The type of the UI control for the environment variable
|
||||
* @param {Object} node - The subflow instance node
|
||||
*/
|
||||
function buildEnvUIRow(row, tenv, node) {
|
||||
if(RED.subflow.debug) { console.log("buildEnvUIRow", tenv) }
|
||||
const ui = tenv.ui || {}
|
||||
ui.label = ui.label||{};
|
||||
if ((tenv.type === "cred" || (tenv.parent && tenv.parent.type === "cred")) && !ui.type) {
|
||||
ui.type = "cred";
|
||||
ui.opts = {};
|
||||
} else if (tenv.type === "conf-types") {
|
||||
ui.type = "conf-types"
|
||||
ui.opts = { types: ['conf-types'] }
|
||||
} else if (!ui.type) {
|
||||
ui.type = "input";
|
||||
ui.opts = { types: RED.editor.envVarList.DEFAULT_ENV_TYPE_LIST }
|
||||
|
@ -1006,9 +1029,10 @@ RED.subflow = (function() {
|
|||
if (tenv.hasOwnProperty('type')) {
|
||||
val.type = tenv.type;
|
||||
}
|
||||
const elId = getSubflowEnvPropertyName(tenv.name)
|
||||
switch(ui.type) {
|
||||
case "input":
|
||||
input = $('<input type="text">').css('width','70%').appendTo(row);
|
||||
input = $('<input type="text">').css('width','70%').attr('id', elId).appendTo(row);
|
||||
if (ui.opts.types && ui.opts.types.length > 0) {
|
||||
var inputType = val.type;
|
||||
if (ui.opts.types.indexOf(inputType) === -1) {
|
||||
|
@ -1035,7 +1059,7 @@ RED.subflow = (function() {
|
|||
}
|
||||
break;
|
||||
case "select":
|
||||
input = $('<select>').css('width','70%').appendTo(row);
|
||||
input = $('<select>').css('width','70%').attr('id', elId).appendTo(row);
|
||||
if (ui.opts.opts) {
|
||||
ui.opts.opts.forEach(function(o) {
|
||||
$('<option>').val(o.v).text(RED.editor.envVarList.lookupLabel(o.l, o.l['en-US']||o.v, locale)).appendTo(input);
|
||||
|
@ -1046,7 +1070,7 @@ RED.subflow = (function() {
|
|||
case "checkbox":
|
||||
label.css("cursor","default");
|
||||
var cblabel = $('<label>').css('width','70%').appendTo(row);
|
||||
input = $('<input type="checkbox">').css({
|
||||
input = $('<input type="checkbox">').attr('id', elId).css({
|
||||
marginTop: 0,
|
||||
width: 'auto',
|
||||
height: '34px'
|
||||
|
@ -1064,7 +1088,7 @@ RED.subflow = (function() {
|
|||
input.prop("checked",boolVal);
|
||||
break;
|
||||
case "spinner":
|
||||
input = $('<input>').css('width','70%').appendTo(row);
|
||||
input = $('<input>').css('width','70%').attr('id', elId).appendTo(row);
|
||||
var spinnerOpts = {};
|
||||
if (ui.opts.hasOwnProperty('min')) {
|
||||
spinnerOpts.min = ui.opts.min;
|
||||
|
@ -1093,18 +1117,25 @@ RED.subflow = (function() {
|
|||
default: 'cred'
|
||||
})
|
||||
break;
|
||||
}
|
||||
if (input) {
|
||||
input.attr('id',getSubflowEnvPropertyName(tenv.name))
|
||||
case "conf-types":
|
||||
// let clsId = 'config-node-input-' + val.type + '-' + val.value + '-' + Math.floor(Math.random() * 100000);
|
||||
// clsId = clsId.replace(/\W/g, '-');
|
||||
// input = $('<input>').css('width','70%').addClass(clsId).attr('id', elId).appendTo(row);
|
||||
input = $('<input>').css('width','70%').attr('id', elId).appendTo(row);
|
||||
const _type = tenv.parent?.type || tenv.type;
|
||||
RED.editor.prepareConfigNodeSelect(node, tenv.name, _type, 'node-input-subflow-env', null, tenv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create environment variable input UI
|
||||
* Build the edit form for a subflow instance
|
||||
* Also used to build the preview form in the subflow template edit dialog
|
||||
* @param uiContainer - container for UI
|
||||
* @param envList - env var definitions of template
|
||||
*/
|
||||
function buildEnvUI(uiContainer, envList, node) {
|
||||
if(RED.subflow.debug) { console.log("buildEnvUI",envList) }
|
||||
uiContainer.empty();
|
||||
for (var i = 0; i < envList.length; i++) {
|
||||
var tenv = envList[i];
|
||||
|
@ -1112,7 +1143,7 @@ RED.subflow = (function() {
|
|||
continue;
|
||||
}
|
||||
var row = $("<div/>", { class: "form-row" }).appendTo(uiContainer);
|
||||
buildEnvUIRow(row,tenv, tenv.ui || {}, node);
|
||||
buildEnvUIRow(row, tenv, node);
|
||||
}
|
||||
}
|
||||
// buildEnvUI
|
||||
|
@ -1185,6 +1216,9 @@ RED.subflow = (function() {
|
|||
delete ui.opts
|
||||
}
|
||||
break;
|
||||
case "conf-types":
|
||||
delete ui.opts;
|
||||
break;
|
||||
default:
|
||||
delete ui.opts;
|
||||
}
|
||||
|
@ -1207,8 +1241,9 @@ RED.subflow = (function() {
|
|||
if (/^subflow:/.test(node.type)) {
|
||||
var subflowDef = RED.nodes.subflow(node.type.substring(8));
|
||||
if (subflowDef.env) {
|
||||
subflowDef.env.forEach(function(env) {
|
||||
subflowDef.env.forEach(function(env, i) {
|
||||
var item = {
|
||||
index: i,
|
||||
name:env.name,
|
||||
parent: {
|
||||
type: env.type,
|
||||
|
@ -1245,14 +1280,20 @@ RED.subflow = (function() {
|
|||
var nodePropValue = nodeProp;
|
||||
if (prop.ui && prop.ui.type === "cred") {
|
||||
nodePropType = "cred";
|
||||
} else if (prop.ui && prop.ui.type === "conf-types") {
|
||||
nodePropType = prop.value.type
|
||||
} else {
|
||||
switch(typeof nodeProp) {
|
||||
case "string": nodePropType = "str"; break;
|
||||
case "number": nodePropType = "num"; break;
|
||||
case "boolean": nodePropType = "bool"; nodePropValue = nodeProp?"true":"false"; break;
|
||||
default:
|
||||
nodePropType = nodeProp.type;
|
||||
nodePropValue = nodeProp.value;
|
||||
if (nodeProp) {
|
||||
nodePropType = nodeProp.type;
|
||||
nodePropValue = nodeProp.value;
|
||||
} else {
|
||||
nodePropType = 'str'
|
||||
}
|
||||
}
|
||||
}
|
||||
var item = {
|
||||
|
@ -1273,6 +1314,7 @@ RED.subflow = (function() {
|
|||
}
|
||||
|
||||
function exportSubflowInstanceEnv(node) {
|
||||
if(RED.subflow.debug) { console.log("exportSubflowInstanceEnv",node) }
|
||||
var env = [];
|
||||
// First, get the values for the SubflowTemplate defined properties
|
||||
// - these are the ones with custom UI elements
|
||||
|
@ -1319,6 +1361,9 @@ RED.subflow = (function() {
|
|||
item.type = 'bool';
|
||||
item.value = ""+input.prop("checked");
|
||||
break;
|
||||
case "conf-types":
|
||||
item.value = input.val()
|
||||
item.type = "conf-type"
|
||||
}
|
||||
if (ui.type === "cred" || item.type !== data.parent.type || item.value !== data.parent.value) {
|
||||
env.push(item);
|
||||
|
@ -1332,8 +1377,15 @@ RED.subflow = (function() {
|
|||
return 'node-input-subflow-env-'+name.replace(/[^a-z0-9-_]/ig,"_");
|
||||
}
|
||||
|
||||
// Called by subflow.oneditprepare for both instances and templates
|
||||
|
||||
/**
|
||||
* Build the subflow edit form
|
||||
* Called by subflow.oneditprepare for both instances and templates
|
||||
* @param {"subflow"|"subflow-template"} type - the type of subflow being edited
|
||||
* @param {Object} node - the node being edited
|
||||
*/
|
||||
function buildEditForm(type,node) {
|
||||
if(RED.subflow.debug) { console.log("buildEditForm",type,node) }
|
||||
if (type === "subflow-template") {
|
||||
// This is the tabbed UI that offers the env list - with UI options
|
||||
// plus the preview tab
|
||||
|
|
|
@ -158,6 +158,7 @@ RED.sidebar.config = (function() {
|
|||
entry.data('node',node.id);
|
||||
nodeDiv.data('node',node.id);
|
||||
var label = $('<div class="red-ui-palette-label"></div>').text(labelText).appendTo(nodeDiv);
|
||||
|
||||
if (node.d) {
|
||||
nodeDiv.addClass("red-ui-palette-node-config-disabled");
|
||||
$('<i class="fa fa-ban"></i>').prependTo(label);
|
||||
|
@ -179,6 +180,20 @@ RED.sidebar.config = (function() {
|
|||
nodeDiv.addClass("red-ui-palette-node-config-unused");
|
||||
}
|
||||
}
|
||||
|
||||
if (!node.valid) {
|
||||
nodeDiv.addClass("red-ui-palette-node-config-invalid")
|
||||
const nodeDivAnnotations = $('<svg class="red-ui-palette-node-annotations red-ui-flow-node-error" width="10" height="10"></svg>').appendTo(nodeDiv)
|
||||
const errorBadge = document.createElementNS("http://www.w3.org/2000/svg","path");
|
||||
errorBadge.setAttribute("d","M 0,9 l 10,0 -5,-8 z");
|
||||
nodeDivAnnotations.append($(errorBadge))
|
||||
RED.popover.tooltip(nodeDivAnnotations, function () {
|
||||
if (node.validationErrors && node.validationErrors.length > 0) {
|
||||
return RED._("editor.errors.invalidProperties")+"<br> - "+node.validationErrors.join("<br> - ")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
nodeDiv.on('click',function(e) {
|
||||
e.stopPropagation();
|
||||
RED.view.select(false);
|
||||
|
|
|
@ -232,7 +232,7 @@ RED.sidebar.context = (function() {
|
|||
typeHint: data.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools,
|
||||
path: ""
|
||||
path: k
|
||||
}).appendTo(propRow.children()[1]);
|
||||
}
|
||||
})
|
||||
|
@ -278,7 +278,7 @@ RED.sidebar.context = (function() {
|
|||
typeHint: data.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools,
|
||||
path: ""
|
||||
path: k
|
||||
}).appendTo(propRow.children()[1]);
|
||||
}
|
||||
});
|
||||
|
@ -299,7 +299,7 @@ RED.sidebar.context = (function() {
|
|||
typeHint: v.format,
|
||||
sourceId: id+"."+k,
|
||||
tools: tools,
|
||||
path: ""
|
||||
path: k
|
||||
}).appendTo(propRow.children()[1]);
|
||||
if (contextStores.length > 1) {
|
||||
$("<span>",{class:"red-ui-sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
|
||||
|
|
|
@ -158,8 +158,10 @@ RED.sidebar.help = (function() {
|
|||
|
||||
function refreshSubflow(sf) {
|
||||
var item = treeList.treeList('get',"node-type:subflow:"+sf.id);
|
||||
item.subflowLabel = sf._def.label().toLowerCase();
|
||||
item.treeList.replaceElement(getNodeLabel({_def:sf._def,type:sf._def.label()}));
|
||||
if (item) {
|
||||
item.subflowLabel = sf._def.label().toLowerCase();
|
||||
item.treeList.replaceElement(getNodeLabel({_def:sf._def,type:sf._def.label()}));
|
||||
}
|
||||
}
|
||||
|
||||
function hideTOC() {
|
||||
|
|
|
@ -435,10 +435,15 @@ RED.tourGuide = (function() {
|
|||
|
||||
function listTour() {
|
||||
return [
|
||||
{
|
||||
id: "4_0",
|
||||
label: "4.0",
|
||||
path: "./tours/welcome.js"
|
||||
},
|
||||
{
|
||||
id: "3_1",
|
||||
label: "3.1",
|
||||
path: "./tours/welcome.js"
|
||||
path: "./tours/3.1/welcome.js"
|
||||
},
|
||||
{
|
||||
id: "3_0",
|
||||
|
|
|
@ -264,6 +264,7 @@
|
|||
setTimeout(function() {
|
||||
oldTray.tray.detach();
|
||||
showTray(options);
|
||||
RED.events.emit('editor:change')
|
||||
},250)
|
||||
} else {
|
||||
if (stack.length > 0) {
|
||||
|
@ -333,6 +334,7 @@
|
|||
RED.view.focus();
|
||||
} else {
|
||||
stack[stack.length-1].tray.css("z-index", "auto");
|
||||
RED.events.emit('editor:change')
|
||||
}
|
||||
},250)
|
||||
}
|
||||
|
|
|
@ -186,8 +186,15 @@ RED.typeSearch = (function() {
|
|||
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
|
||||
RED.utils.createIconElement(icon_url, iconContainer, false);
|
||||
|
||||
|
||||
if (!/^_action_:/.test(object.type) && object.type !== "junction") {
|
||||
if (/^subflow:/.test(object.type)) {
|
||||
var sf = RED.nodes.subflow(object.type.substring(8));
|
||||
if (sf.in.length > 0) {
|
||||
$('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
|
||||
}
|
||||
if (sf.out.length > 0) {
|
||||
$('<div/>',{class:"red-ui-search-result-node-port red-ui-search-result-node-output"}).appendTo(nodeDiv);
|
||||
}
|
||||
} else if (!/^_action_:/.test(object.type) && object.type !== "junction") {
|
||||
if (def.inputs > 0) {
|
||||
$('<div/>',{class:"red-ui-search-result-node-port"}).appendTo(nodeDiv);
|
||||
}
|
||||
|
|
|
@ -483,6 +483,16 @@ RED.utils = (function() {
|
|||
$('<span class="red-ui-debug-msg-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e);
|
||||
}
|
||||
|
||||
let n = RED.nodes.node(obj) ?? RED.nodes.workspace(obj);
|
||||
if (n) {
|
||||
if (options.nodeSelector && "function" == typeof options.nodeSelector) {
|
||||
e.css('cursor', 'pointer').on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
options.nodeSelector(n.id);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
} else if (typeof obj === 'number') {
|
||||
e = $('<span class="red-ui-debug-msg-type-number"></span>').appendTo(entryObj);
|
||||
|
||||
|
@ -589,6 +599,7 @@ RED.utils = (function() {
|
|||
exposeApi: exposeApi,
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
nodeSelector: options.nodeSelector,
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
|
@ -619,6 +630,7 @@ RED.utils = (function() {
|
|||
exposeApi: exposeApi,
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
nodeSelector: options.nodeSelector,
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
|
@ -675,6 +687,7 @@ RED.utils = (function() {
|
|||
exposeApi: exposeApi,
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
nodeSelector: options.nodeSelector,
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
|
@ -920,6 +933,10 @@ RED.utils = (function() {
|
|||
* @returns true if valid, String if invalid
|
||||
*/
|
||||
function validateTypedProperty(propertyValue, propertyType, opt) {
|
||||
if (propertyValue && /^\${[^}]+}$/.test(propertyValue)) {
|
||||
// Allow ${ENV_VAR} value
|
||||
return true
|
||||
}
|
||||
let error;
|
||||
if (propertyType === 'json') {
|
||||
try {
|
||||
|
|
|
@ -9,14 +9,27 @@ RED.view.annotations = (function() {
|
|||
addAnnotation(evt.node.__pendingAnnotation__,evt);
|
||||
delete evt.node.__pendingAnnotation__;
|
||||
}
|
||||
var badgeDX = 0;
|
||||
var controlDX = 0;
|
||||
for (var i=0,l=evt.el.__annotations__.length;i<l;i++) {
|
||||
var annotation = evt.el.__annotations__[i];
|
||||
let badgeRDX = 0;
|
||||
let badgeLDX = 0;
|
||||
|
||||
for (let i=0,l=evt.el.__annotations__.length;i<l;i++) {
|
||||
const annotation = evt.el.__annotations__[i];
|
||||
if (annotations.hasOwnProperty(annotation.id)) {
|
||||
var opts = annotations[annotation.id];
|
||||
var showAnnotation = true;
|
||||
var isBadge = opts.type === 'badge';
|
||||
const opts = annotations[annotation.id];
|
||||
let showAnnotation = true;
|
||||
const isBadge = opts.type === 'badge';
|
||||
if (opts.refresh !== undefined) {
|
||||
let refreshAnnotation = false
|
||||
if (typeof opts.refresh === "string") {
|
||||
refreshAnnotation = !!evt.node[opts.refresh]
|
||||
delete evt.node[opts.refresh]
|
||||
} else if (typeof opts.refresh === "function") {
|
||||
refreshAnnotation = opts.refresh(evnt.node)
|
||||
}
|
||||
if (refreshAnnotation) {
|
||||
refreshAnnotationElement(annotation.id, annotation.node, annotation.element)
|
||||
}
|
||||
}
|
||||
if (opts.show !== undefined) {
|
||||
if (typeof opts.show === "string") {
|
||||
showAnnotation = !!evt.node[opts.show]
|
||||
|
@ -29,17 +42,24 @@ RED.view.annotations = (function() {
|
|||
}
|
||||
if (isBadge) {
|
||||
if (showAnnotation) {
|
||||
var rect = annotation.element.getBoundingClientRect();
|
||||
badgeDX += rect.width;
|
||||
annotation.element.setAttribute("transform", "translate("+(evt.node.w-3-badgeDX)+", -8)");
|
||||
badgeDX += 4;
|
||||
}
|
||||
} else {
|
||||
if (showAnnotation) {
|
||||
var rect = annotation.element.getBoundingClientRect();
|
||||
annotation.element.setAttribute("transform", "translate("+(3+controlDX)+", -12)");
|
||||
controlDX += rect.width + 4;
|
||||
const rect = annotation.element.getBoundingClientRect();
|
||||
let annotationX
|
||||
if (!opts.align || opts.align === 'right') {
|
||||
annotationX = evt.node.w - 3 - badgeRDX - rect.width
|
||||
badgeRDX += rect.width + 4;
|
||||
|
||||
} else if (opts.align === 'left') {
|
||||
annotationX = 3 + badgeLDX
|
||||
badgeLDX += rect.width + 4;
|
||||
}
|
||||
annotation.element.setAttribute("transform", "translate("+annotationX+", -8)");
|
||||
}
|
||||
// } else {
|
||||
// if (showAnnotation) {
|
||||
// var rect = annotation.element.getBoundingClientRect();
|
||||
// annotation.element.setAttribute("transform", "translate("+(3+controlDX)+", -12)");
|
||||
// controlDX += rect.width + 4;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
annotation.element.parentNode.removeChild(annotation.element);
|
||||
|
@ -95,15 +115,25 @@ RED.view.annotations = (function() {
|
|||
annotationGroup.setAttribute("class",opts.class || "");
|
||||
evt.el.__annotations__.push({
|
||||
id:id,
|
||||
node: evt.node,
|
||||
element: annotationGroup
|
||||
});
|
||||
var annotation = opts.element(evt.node);
|
||||
refreshAnnotationElement(id, evt.node, annotationGroup)
|
||||
evt.el.appendChild(annotationGroup);
|
||||
}
|
||||
|
||||
function refreshAnnotationElement(id, node, annotationGroup) {
|
||||
const opts = annotations[id];
|
||||
const annotation = opts.element(node);
|
||||
if (opts.tooltip) {
|
||||
annotation.addEventListener("mouseenter", getAnnotationMouseEnter(annotation,evt.node,opts.tooltip));
|
||||
annotation.addEventListener("mouseenter", getAnnotationMouseEnter(annotation, node, opts.tooltip));
|
||||
annotation.addEventListener("mouseleave", annotationMouseLeave);
|
||||
}
|
||||
if (annotationGroup.hasChildNodes()) {
|
||||
annotationGroup.removeChild(annotationGroup.firstChild)
|
||||
}
|
||||
annotationGroup.appendChild(annotation);
|
||||
evt.el.appendChild(annotationGroup);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -646,120 +646,128 @@ RED.view = (function() {
|
|||
}
|
||||
d3.event = event;
|
||||
var selected_tool = $(ui.draggable[0]).attr("data-palette-type");
|
||||
var result = createNode(selected_tool);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
var historyEvent = result.historyEvent;
|
||||
var nn = RED.nodes.add(result.node);
|
||||
|
||||
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
|
||||
if (showLabel !== undefined && (nn._def.hasOwnProperty("showLabel")?nn._def.showLabel:true) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||
nn.l = showLabel;
|
||||
}
|
||||
|
||||
var helperOffset = d3.touches(ui.helper.get(0))[0]||d3.mouse(ui.helper.get(0));
|
||||
var helperWidth = ui.helper.width();
|
||||
var helperHeight = ui.helper.height();
|
||||
var mousePos = d3.touches(this)[0]||d3.mouse(this);
|
||||
|
||||
try {
|
||||
var isLink = (nn.type === "link in" || nn.type === "link out")
|
||||
var hideLabel = nn.hasOwnProperty('l')?!nn.l : isLink;
|
||||
|
||||
var label = RED.utils.getNodeLabel(nn, nn.type);
|
||||
var labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
if (hideLabel) {
|
||||
nn.w = node_height;
|
||||
nn.h = Math.max(node_height,(nn.outputs || 0) * 15);
|
||||
} else {
|
||||
nn.w = Math.max(node_width,20*(Math.ceil((labelParts.width+50+(nn._def.inputs>0?7:0))/20)) );
|
||||
nn.h = Math.max(6+24*labelParts.lines.length,(nn.outputs || 0) * 15, 30);
|
||||
var result = createNode(selected_tool);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
} catch(err) {
|
||||
}
|
||||
var historyEvent = result.historyEvent;
|
||||
var nn = RED.nodes.add(result.node);
|
||||
|
||||
mousePos[1] += this.scrollTop + ((helperHeight/2)-helperOffset[1]);
|
||||
mousePos[0] += this.scrollLeft + ((helperWidth/2)-helperOffset[0]);
|
||||
mousePos[1] /= scaleFactor;
|
||||
mousePos[0] /= scaleFactor;
|
||||
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
|
||||
if (showLabel !== undefined && (nn._def.hasOwnProperty("showLabel")?nn._def.showLabel:true) && !nn._def.defaults.hasOwnProperty("l")) {
|
||||
nn.l = showLabel;
|
||||
}
|
||||
|
||||
nn.x = mousePos[0];
|
||||
nn.y = mousePos[1];
|
||||
var helperOffset = d3.touches(ui.helper.get(0))[0]||d3.mouse(ui.helper.get(0));
|
||||
var helperWidth = ui.helper.width();
|
||||
var helperHeight = ui.helper.height();
|
||||
var mousePos = d3.touches(this)[0]||d3.mouse(this);
|
||||
|
||||
var minX = nn.w/2 -5;
|
||||
if (nn.x < minX) {
|
||||
nn.x = minX;
|
||||
}
|
||||
var minY = nn.h/2 -5;
|
||||
if (nn.y < minY) {
|
||||
nn.y = minY;
|
||||
}
|
||||
var maxX = space_width -nn.w/2 +5;
|
||||
if (nn.x > maxX) {
|
||||
nn.x = maxX;
|
||||
}
|
||||
var maxY = space_height -nn.h +5;
|
||||
if (nn.y > maxY) {
|
||||
nn.y = maxY;
|
||||
}
|
||||
try {
|
||||
var isLink = (nn.type === "link in" || nn.type === "link out")
|
||||
var hideLabel = nn.hasOwnProperty('l')?!nn.l : isLink;
|
||||
|
||||
if (snapGrid) {
|
||||
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
|
||||
nn.x -= gridOffset.x;
|
||||
nn.y -= gridOffset.y;
|
||||
}
|
||||
var label = RED.utils.getNodeLabel(nn, nn.type);
|
||||
var labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
if (hideLabel) {
|
||||
nn.w = node_height;
|
||||
nn.h = Math.max(node_height,(nn.outputs || 0) * 15);
|
||||
} else {
|
||||
nn.w = Math.max(node_width,20*(Math.ceil((labelParts.width+50+(nn._def.inputs>0?7:0))/20)) );
|
||||
nn.h = Math.max(6+24*labelParts.lines.length,(nn.outputs || 0) * 15, 30);
|
||||
}
|
||||
} catch(err) {
|
||||
}
|
||||
|
||||
var linkToSplice = $(ui.helper).data("splice");
|
||||
if (linkToSplice) {
|
||||
spliceLink(linkToSplice, nn, historyEvent)
|
||||
}
|
||||
mousePos[1] += this.scrollTop + ((helperHeight/2)-helperOffset[1]);
|
||||
mousePos[0] += this.scrollLeft + ((helperWidth/2)-helperOffset[0]);
|
||||
mousePos[1] /= scaleFactor;
|
||||
mousePos[0] /= scaleFactor;
|
||||
|
||||
nn.x = mousePos[0];
|
||||
nn.y = mousePos[1];
|
||||
|
||||
var minX = nn.w/2 -5;
|
||||
if (nn.x < minX) {
|
||||
nn.x = minX;
|
||||
}
|
||||
var minY = nn.h/2 -5;
|
||||
if (nn.y < minY) {
|
||||
nn.y = minY;
|
||||
}
|
||||
var maxX = space_width -nn.w/2 +5;
|
||||
if (nn.x > maxX) {
|
||||
nn.x = maxX;
|
||||
}
|
||||
var maxY = space_height -nn.h +5;
|
||||
if (nn.y > maxY) {
|
||||
nn.y = maxY;
|
||||
}
|
||||
|
||||
if (snapGrid) {
|
||||
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
|
||||
nn.x -= gridOffset.x;
|
||||
nn.y -= gridOffset.y;
|
||||
}
|
||||
|
||||
var linkToSplice = $(ui.helper).data("splice");
|
||||
if (linkToSplice) {
|
||||
spliceLink(linkToSplice, nn, historyEvent)
|
||||
}
|
||||
|
||||
var group = $(ui.helper).data("group");
|
||||
if (group) {
|
||||
var oldX = group.x;
|
||||
var oldY = group.y;
|
||||
RED.group.addToGroup(group, nn);
|
||||
var moveEvent = null;
|
||||
if ((group.x !== oldX) ||
|
||||
(group.y !== oldY)) {
|
||||
moveEvent = {
|
||||
t: "move",
|
||||
nodes: [{n: group,
|
||||
ox: oldX, oy: oldY,
|
||||
dx: group.x -oldX,
|
||||
dy: group.y -oldY}],
|
||||
dirty: true
|
||||
};
|
||||
}
|
||||
historyEvent = {
|
||||
t: 'multi',
|
||||
events: [historyEvent],
|
||||
|
||||
var group = $(ui.helper).data("group");
|
||||
if (group) {
|
||||
var oldX = group.x;
|
||||
var oldY = group.y;
|
||||
RED.group.addToGroup(group, nn);
|
||||
var moveEvent = null;
|
||||
if ((group.x !== oldX) ||
|
||||
(group.y !== oldY)) {
|
||||
moveEvent = {
|
||||
t: "move",
|
||||
nodes: [{n: group,
|
||||
ox: oldX, oy: oldY,
|
||||
dx: group.x -oldX,
|
||||
dy: group.y -oldY}],
|
||||
dirty: true
|
||||
};
|
||||
if (moveEvent) {
|
||||
historyEvent.events.push(moveEvent)
|
||||
}
|
||||
historyEvent.events.push({
|
||||
t: "addToGroup",
|
||||
group: group,
|
||||
nodes: nn
|
||||
})
|
||||
}
|
||||
historyEvent = {
|
||||
t: 'multi',
|
||||
events: [historyEvent],
|
||||
|
||||
};
|
||||
if (moveEvent) {
|
||||
historyEvent.events.push(moveEvent)
|
||||
RED.history.push(historyEvent);
|
||||
RED.editor.validateNode(nn);
|
||||
RED.nodes.dirty(true);
|
||||
// auto select dropped node - so info shows (if visible)
|
||||
clearSelection();
|
||||
nn.selected = true;
|
||||
movingSet.add(nn);
|
||||
updateActiveNodes();
|
||||
updateSelection();
|
||||
redraw();
|
||||
|
||||
if (nn._def.autoedit) {
|
||||
RED.editor.edit(nn);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code != "NODE_RED") {
|
||||
RED.notify(RED._("notification.error",{message:error.toString()}),"error");
|
||||
} else {
|
||||
RED.notify(RED._("notification.error",{message:error.message}),"error");
|
||||
}
|
||||
historyEvent.events.push({
|
||||
t: "addToGroup",
|
||||
group: group,
|
||||
nodes: nn
|
||||
})
|
||||
}
|
||||
|
||||
RED.history.push(historyEvent);
|
||||
RED.editor.validateNode(nn);
|
||||
RED.nodes.dirty(true);
|
||||
// auto select dropped node - so info shows (if visible)
|
||||
clearSelection();
|
||||
nn.selected = true;
|
||||
movingSet.add(nn);
|
||||
updateActiveNodes();
|
||||
updateSelection();
|
||||
redraw();
|
||||
|
||||
if (nn._def.autoedit) {
|
||||
RED.editor.edit(nn);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -4155,10 +4163,15 @@ RED.view = (function() {
|
|||
scaleFactor = 30/largestEdge;
|
||||
}
|
||||
var width = img.width * scaleFactor;
|
||||
if (width > 20) {
|
||||
scaleFactor *= 20/width;
|
||||
width = 20;
|
||||
}
|
||||
var height = img.height * scaleFactor;
|
||||
icon.attr("width",width);
|
||||
icon.attr("height",height);
|
||||
icon.attr("x",15-width/2);
|
||||
icon.attr("y",(30-height)/2);
|
||||
}
|
||||
icon.attr("xlink:href",iconUrl);
|
||||
icon.style("display",null);
|
||||
|
@ -6058,14 +6071,19 @@ RED.view = (function() {
|
|||
function createNode(type, x, y, z) {
|
||||
const wasDirty = RED.nodes.dirty()
|
||||
var m = /^subflow:(.+)$/.exec(type);
|
||||
var activeSubflow = z ? RED.nodes.subflow(z) : null;
|
||||
var activeSubflow = (z || RED.workspaces.active()) ? RED.nodes.subflow(z || RED.workspaces.active()) : null;
|
||||
|
||||
if (activeSubflow && m) {
|
||||
var subflowId = m[1];
|
||||
let err
|
||||
if (subflowId === activeSubflow.id) {
|
||||
throw new Error(RED._("notification.error", { message: RED._("notification.errors.cannotAddSubflowToItself") }))
|
||||
err = new Error(RED._("notification.errors.cannotAddSubflowToItself"))
|
||||
} else if (RED.nodes.subflowContains(m[1], activeSubflow.id)) {
|
||||
err = new Error(RED._("notification.errors.cannotAddCircularReference"))
|
||||
}
|
||||
if (RED.nodes.subflowContains(m[1], activeSubflow.id)) {
|
||||
throw new Error(RED._("notification.error", { message: RED._("notification.errors.cannotAddCircularReference") }))
|
||||
if (err) {
|
||||
err.code = 'NODE_RED'
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6247,6 +6265,10 @@ RED.view = (function() {
|
|||
}
|
||||
})
|
||||
}
|
||||
if (selection.links) {
|
||||
selectedLinks.clear();
|
||||
selection.links.forEach(selectedLinks.add);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateSelection();
|
||||
|
|
|
@ -359,11 +359,17 @@ RED.workspaces = (function() {
|
|||
RED.sidebar.config.refresh();
|
||||
RED.view.focus();
|
||||
},
|
||||
onclick: function(tab) {
|
||||
if (tab.id !== activeWorkspace) {
|
||||
addToViewStack(activeWorkspace);
|
||||
onclick: function(tab, evt) {
|
||||
if(evt.which === 2) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
RED.actions.invoke("core:hide-flow", tab)
|
||||
} else {
|
||||
if (tab.id !== activeWorkspace) {
|
||||
addToViewStack(activeWorkspace);
|
||||
}
|
||||
RED.view.focus();
|
||||
}
|
||||
RED.view.focus();
|
||||
},
|
||||
ondblclick: function(tab) {
|
||||
if (tab.type != "subflow") {
|
||||
|
@ -401,6 +407,7 @@ RED.workspaces = (function() {
|
|||
if (tab.type === "tab") {
|
||||
workspaceTabCount--;
|
||||
} else {
|
||||
RED.events.emit("workspace:close",{workspace: tab.id})
|
||||
hideStack.push(tab.id);
|
||||
}
|
||||
RED.menu.setDisabled("menu-item-workspace-delete",activeWorkspace === 0 || workspaceTabCount <= 1);
|
||||
|
@ -491,6 +498,11 @@ RED.workspaces = (function() {
|
|||
createWorkspaceTabs();
|
||||
RED.events.on("sidebar:resize",workspace_tabs.resize);
|
||||
|
||||
RED.events.on("workspace:clear", () => {
|
||||
// Reset the index used to generate new flow names
|
||||
workspaceIndex = 0
|
||||
})
|
||||
|
||||
RED.actions.add("core:show-next-tab",function() {
|
||||
var oldActive = activeWorkspace;
|
||||
workspace_tabs.nextTab();
|
||||
|
@ -657,6 +669,9 @@ RED.workspaces = (function() {
|
|||
RED.events.on("flows:change", (ws) => {
|
||||
$("#red-ui-tab-"+(ws.id.replace(".","-"))).toggleClass('red-ui-workspace-changed',!!(ws.contentsChanged || ws.changed || ws.added));
|
||||
})
|
||||
RED.events.on("subflows:change", (ws) => {
|
||||
$("#red-ui-tab-"+(ws.id.replace(".","-"))).toggleClass('red-ui-workspace-changed',!!(ws.contentsChanged || ws.changed || ws.added));
|
||||
})
|
||||
|
||||
hideWorkspace();
|
||||
}
|
||||
|
|
|
@ -187,6 +187,7 @@ RED.user = (function() {
|
|||
}
|
||||
|
||||
function logout() {
|
||||
RED.events.emit('logout')
|
||||
var tokens = RED.settings.get("auth-tokens");
|
||||
var token = tokens?tokens.access_token:"";
|
||||
$.ajax({
|
||||
|
@ -211,6 +212,8 @@ RED.user = (function() {
|
|||
|
||||
function updateUserMenu() {
|
||||
$("#red-ui-header-button-user-submenu li").remove();
|
||||
const userMenu = $("#red-ui-header-button-user")
|
||||
userMenu.empty()
|
||||
if (RED.settings.user.anonymous) {
|
||||
RED.menu.addItem("red-ui-header-button-user",{
|
||||
id:"usermenu-item-login",
|
||||
|
@ -238,7 +241,8 @@ RED.user = (function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
const userIcon = generateUserIcon(RED.settings.user)
|
||||
userIcon.appendTo(userMenu);
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
@ -247,14 +251,6 @@ RED.user = (function() {
|
|||
|
||||
var userMenu = $('<li><a id="red-ui-header-button-user" class="button hide" href="#"></a></li>')
|
||||
.prependTo(".red-ui-header-toolbar");
|
||||
if (RED.settings.user.image) {
|
||||
$('<span class="user-profile"></span>').css({
|
||||
backgroundImage: "url("+RED.settings.user.image+")",
|
||||
}).appendTo(userMenu.find("a"));
|
||||
} else {
|
||||
$('<i class="fa fa-user"></i>').appendTo(userMenu.find("a"));
|
||||
}
|
||||
|
||||
RED.menu.init({id:"red-ui-header-button-user",
|
||||
options: []
|
||||
});
|
||||
|
@ -317,12 +313,30 @@ RED.user = (function() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function generateUserIcon(user) {
|
||||
const userIcon = $('<span class="red-ui-user-profile"></span>')
|
||||
if (user.image) {
|
||||
userIcon.addClass('has_profile_image')
|
||||
userIcon.css({
|
||||
backgroundImage: "url("+user.image+")",
|
||||
})
|
||||
} else if (user.anonymous) {
|
||||
$('<i class="fa fa-user"></i>').appendTo(userIcon);
|
||||
} else {
|
||||
$('<span>').text(user.username.substring(0,2)).appendTo(userIcon);
|
||||
}
|
||||
if (user.profileColor !== undefined) {
|
||||
userIcon.addClass('red-ui-user-profile-color-' + user.profileColor)
|
||||
}
|
||||
return userIcon
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
login: login,
|
||||
logout: logout,
|
||||
hasPermission: hasPermission
|
||||
hasPermission: hasPermission,
|
||||
generateUserIcon
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
@ -16,8 +16,20 @@
|
|||
RED.validators = {
|
||||
number: function(blankAllowed,mopt){
|
||||
return function(v, opt) {
|
||||
if ((blankAllowed&&(v===''||v===undefined)) || (v!=='' && !isNaN(v))) {
|
||||
return true;
|
||||
if (blankAllowed && (v === '' || v === undefined)) {
|
||||
return true
|
||||
}
|
||||
if (v !== '') {
|
||||
if (/^NaN$|^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$|^[+-]?(0b|0B)[01]+$|^[+-]?(0o|0O)[0-7]+$|^[+-]?(0x|0X)[0-9a-fA-F]+$/.test(v)) {
|
||||
return true
|
||||
}
|
||||
if (/^\${[^}]+}$/.test(v)) {
|
||||
// Allow ${ENV_VAR} value
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (!isNaN(v)) {
|
||||
return true
|
||||
}
|
||||
if (opt && opt.label) {
|
||||
return RED._("validator.errors.invalid-num-prop", {
|
||||
|
|
|
@ -38,7 +38,7 @@ body {
|
|||
}
|
||||
#red-ui-main-container {
|
||||
position: absolute;
|
||||
top:40px; left:0; bottom: 0; right:0;
|
||||
top: var(--red-ui-header-height); left:0; bottom: 0; right:0;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,8 @@ $deploy-button-background-disabled-hover: #555;
|
|||
|
||||
$header-background: #000;
|
||||
$header-button-background-active: #121212;
|
||||
$header-menu-color: #C7C7C7;
|
||||
$header-accent: #d41313;
|
||||
$header-menu-color: #eee;
|
||||
$header-menu-color-disabled: #666;
|
||||
$header-menu-heading-color: #fff;
|
||||
$header-menu-sublabel-color: #aeaeae;
|
||||
|
@ -313,6 +314,16 @@ $spinner-color: #999;
|
|||
|
||||
$tab-icon-color: #dedede;
|
||||
|
||||
// Anonymous User Colors
|
||||
|
||||
$user-profile-colors: (
|
||||
1: #822e81,
|
||||
2: #955e42,
|
||||
3: #9c914f,
|
||||
4: #748e54,
|
||||
5: #06bcc1
|
||||
);
|
||||
|
||||
// Deprecated
|
||||
$text-color-green: $text-color-success;
|
||||
$info-text-code-color: $text-color-code;
|
||||
|
|
|
@ -23,16 +23,20 @@
|
|||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
height: var(--red-ui-header-height);
|
||||
background: var(--red-ui-header-background);
|
||||
box-sizing: border-box;
|
||||
padding: 0px 0px 0px 20px;
|
||||
color: var(--red-ui-header-menu-color);
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid var(--red-ui-header-accent);
|
||||
padding-top: 2px;
|
||||
|
||||
span.red-ui-header-logo {
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
text-decoration: none;
|
||||
|
@ -42,7 +46,7 @@
|
|||
vertical-align: middle;
|
||||
font-size: 16px !important;
|
||||
&:not(:first-child) {
|
||||
margin-left: 5px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
img {
|
||||
|
@ -59,25 +63,29 @@
|
|||
}
|
||||
|
||||
.red-ui-header-toolbar {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
float: right;
|
||||
|
||||
> li {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
align-items: stretch;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
height: 100%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
text-align: center;
|
||||
line-height: 40px;
|
||||
display: inline-block;
|
||||
font-size: 20px;
|
||||
padding: 0px 12px;
|
||||
text-decoration: none;
|
||||
|
@ -178,6 +186,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
.red-ui-deploy-button-group.readOnly {
|
||||
.fa-caret-down { display: none; }
|
||||
.fa-lock { display: inline-block; }
|
||||
}
|
||||
.red-ui-deploy-button-group:not(.readOnly) {
|
||||
.fa-caret-down { display: inline-block; }
|
||||
.fa-lock { display: none; }
|
||||
}
|
||||
.red-ui-deploy-button-group.readOnly {
|
||||
a {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.open .button {
|
||||
background: var(--red-ui-header-button-background-active);
|
||||
border-color: var(--red-ui-header-button-background-active);
|
||||
|
@ -266,18 +288,44 @@
|
|||
#usermenu-item-username > .red-ui-menu-label {
|
||||
color: var(--red-ui-header-menu-heading-color);
|
||||
}
|
||||
}
|
||||
|
||||
#red-ui-header-button-user .user-profile {
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
display: inline-block;
|
||||
width: 40px;
|
||||
height: 35px;
|
||||
vertical-align: middle;
|
||||
|
||||
.red-ui-user-profile {
|
||||
background-color: var(--red-ui-header-background);
|
||||
border: 2px solid var(--red-ui-header-menu-color);
|
||||
border-radius: 30px;
|
||||
overflow: hidden;
|
||||
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
vertical-align: middle;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
font-size: 20px;
|
||||
|
||||
&.red-ui-user-profile-color-1 {
|
||||
background-color: var(--red-ui-user-profile-colors-1);
|
||||
}
|
||||
&.red-ui-user-profile-color-2 {
|
||||
background-color: var(--red-ui-user-profile-colors-2);
|
||||
}
|
||||
&.red-ui-user-profile-color-3 {
|
||||
background-color: var(--red-ui-user-profile-colors-3);
|
||||
}
|
||||
&.red-ui-user-profile-color-4 {
|
||||
background-color: var(--red-ui-user-profile-colors-4);
|
||||
}
|
||||
&.red-ui-user-profile-color-5 {
|
||||
background-color: var(--red-ui-user-profile-colors-5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 450px) {
|
||||
span.red-ui-header-logo > span {
|
||||
display: none;
|
||||
|
|
|
@ -194,10 +194,6 @@
|
|||
}
|
||||
}
|
||||
.red-ui-clipboard-dialog-import-conflicts-controls {
|
||||
position: absolute;
|
||||
top:0;
|
||||
bottom: 0;
|
||||
right: 0px;
|
||||
text-align: center;
|
||||
color: var(--red-ui-form-text-color);
|
||||
.form-row & label {
|
||||
|
@ -218,9 +214,21 @@
|
|||
margin: 0;
|
||||
}
|
||||
}
|
||||
#red-ui-clipboard-dialog-import-conflicts-list .disabled .red-ui-info-outline-item {
|
||||
opacity: 0.4;
|
||||
#red-ui-clipboard-dialog-import-conflicts-list .disabled {
|
||||
.red-ui-info-outline-item,
|
||||
.red-ui-node-list-item {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
#red-ui-clipboard-dialog-import-conflicts-list .red-ui-node-list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
& > :first-child {
|
||||
flex-grow: 1
|
||||
}
|
||||
}
|
||||
|
||||
.form-row label.red-ui-clipboard-dialog-import-conflicts-gutter {
|
||||
box-sizing: border-box;
|
||||
width: 22px;
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
#red-ui-multiplayer-user-list {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0 5px;
|
||||
li {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.red-ui-multiplayer-user-icon {
|
||||
background: none;
|
||||
border: none;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
text-decoration: none;
|
||||
color: var(--red-ui-header-menu-color);
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
vertical-align: middle;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.red-ui-multiplayer-user.inactive & {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.red-ui-user-profile {
|
||||
width: 20px;
|
||||
border-radius: 20px;
|
||||
height: 20px;
|
||||
font-size: 12px
|
||||
}
|
||||
}
|
||||
.red-ui-multiplayer-users-tray {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 20px;
|
||||
line-height: normal;
|
||||
cursor: pointer;
|
||||
// &:hover {
|
||||
// .red-ui-multiplayer-user-location {
|
||||
// margin-left: 1px;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
$multiplayer-user-icon-background: var(--red-ui-primary-background);
|
||||
$multiplayer-user-icon-border: var(--red-ui-view-background);
|
||||
$multiplayer-user-icon-text-color: var(--red-ui-header-menu-color);
|
||||
$multiplayer-user-icon-count-text-color: var(--red-ui-primary-color);
|
||||
$multiplayer-user-icon-shadow: 0px 0px 4px var(--red-ui-shadow);
|
||||
.red-ui-multiplayer-user-location {
|
||||
display: inline-block;
|
||||
margin-left: -6px;
|
||||
transition: margin-left 0.2s;
|
||||
.red-ui-user-profile {
|
||||
border: 1px solid $multiplayer-user-icon-border;
|
||||
color: $multiplayer-user-icon-text-color;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 18px;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
box-shadow: $multiplayer-user-icon-shadow;
|
||||
&.red-ui-multiplayer-user-count {
|
||||
color: $multiplayer-user-icon-count-text-color;
|
||||
background-color: $multiplayer-user-icon-background;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-multiplayer-annotation {
|
||||
.red-ui-multiplayer-annotation-background {
|
||||
filter: drop-shadow($multiplayer-user-icon-shadow);
|
||||
fill: $multiplayer-user-icon-background;
|
||||
&.red-ui-user-profile-color-1 {
|
||||
fill: var(--red-ui-user-profile-colors-1);
|
||||
}
|
||||
&.red-ui-user-profile-color-2 {
|
||||
fill: var(--red-ui-user-profile-colors-2);
|
||||
}
|
||||
&.red-ui-user-profile-color-3 {
|
||||
fill: var(--red-ui-user-profile-colors-3);
|
||||
}
|
||||
&.red-ui-user-profile-color-4 {
|
||||
fill: var(--red-ui-user-profile-colors-4);
|
||||
}
|
||||
&.red-ui-user-profile-color-5 {
|
||||
fill: var(--red-ui-user-profile-colors-5);
|
||||
}
|
||||
}
|
||||
.red-ui-multiplayer-annotation-border {
|
||||
stroke: $multiplayer-user-icon-border;
|
||||
stroke-width: 1px;
|
||||
fill: none;
|
||||
}
|
||||
.red-ui-multiplayer-annotation-anon-label {
|
||||
fill: $multiplayer-user-icon-text-color;
|
||||
stroke: none;
|
||||
}
|
||||
text {
|
||||
user-select: none;
|
||||
fill: $multiplayer-user-icon-text-color;
|
||||
stroke: none;
|
||||
font-size: 10px;
|
||||
&.red-ui-multiplayer-user-count {
|
||||
fill: $multiplayer-user-icon-count-text-color;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
$header-height: 48px;
|
|
@ -15,4 +15,5 @@
|
|||
**/
|
||||
|
||||
@import "colors";
|
||||
@import "sizes";
|
||||
@import "variables";
|
|
@ -15,6 +15,7 @@
|
|||
**/
|
||||
|
||||
@import "colors";
|
||||
@import "sizes";
|
||||
@import "variables";
|
||||
@import "mixins";
|
||||
|
||||
|
@ -72,3 +73,5 @@
|
|||
@import "radialMenu";
|
||||
|
||||
@import "tourGuide";
|
||||
|
||||
@import "multiplayer";
|
||||
|
|
|
@ -36,7 +36,7 @@ ul.red-ui-sidebar-node-config-list {
|
|||
text-align: center;
|
||||
}
|
||||
.red-ui-palette-node {
|
||||
overflow: hidden;
|
||||
// overflow: hidden;
|
||||
cursor: default;
|
||||
&.selected {
|
||||
border-color: transparent;
|
||||
|
@ -113,6 +113,15 @@ ul.red-ui-sidebar-node-config-list li.red-ui-palette-node-config-type {
|
|||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.red-ui-palette-node-config-invalid {
|
||||
border-color: var(--red-ui-form-input-border-error-color)
|
||||
}
|
||||
.red-ui-palette-node-annotations {
|
||||
position: absolute;
|
||||
left: calc(100% - 15px);
|
||||
top: -8px;
|
||||
display: block;
|
||||
}
|
||||
.red-ui-sidebar-node-config-filter-info {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
--red-ui-shadow: #{$shadow};
|
||||
|
||||
// Header Height
|
||||
--red-ui-header-height: #{$header-height};
|
||||
|
||||
// Main body text
|
||||
--red-ui-primary-text-color: #{$primary-text-color};
|
||||
// UI control label text
|
||||
|
@ -240,6 +243,7 @@
|
|||
|
||||
|
||||
--red-ui-header-background: #{$header-background};
|
||||
--red-ui-header-accent: #{$header-accent};
|
||||
--red-ui-header-button-background-active: #{$header-button-background-active};
|
||||
--red-ui-header-menu-color: #{$header-menu-color};
|
||||
--red-ui-header-menu-color-disabled: #{$header-menu-color-disabled};
|
||||
|
@ -295,4 +299,7 @@
|
|||
|
||||
--red-ui-tab-icon-color: #{$tab-icon-color};
|
||||
|
||||
@each $current-color in 1 2 3 4 5 {
|
||||
--red-ui-user-profile-colors-#{"" + $current-color}: #{map-get($user-profile-colors, $current-color)};
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
@ -0,0 +1,231 @@
|
|||
export default {
|
||||
version: "3.1.0",
|
||||
steps: [
|
||||
{
|
||||
titleIcon: "fa fa-map-o",
|
||||
title: {
|
||||
"en-US": "Welcome to Node-RED 3.1!",
|
||||
"ja": "Node-RED 3.1へようこそ!",
|
||||
"fr": "Bienvenue dans Node-RED 3.1!"
|
||||
},
|
||||
description: {
|
||||
"en-US": "<p>Let's take a moment to discover the new features in this release.</p>",
|
||||
"ja": "<p>本リリースの新機能を見つけてみましょう。</p>",
|
||||
"fr": "<p>Prenons un moment pour découvrir les nouvelles fonctionnalités de cette version.</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "New ways to work with groups",
|
||||
"ja": "グループの新たな操作方法",
|
||||
"fr": "De nouvelles façons de travailler avec les groupes"
|
||||
},
|
||||
description: {
|
||||
"en-US": `<p>We have changed how you interact with groups in the editor.</p>
|
||||
<ul>
|
||||
<li>They don't get in the way when clicking on a node</li>
|
||||
<li>They can be reordered using the Moving Forwards and Move Backwards actions</li>
|
||||
<li>Multiple nodes can be dragged into a group in one go</li>
|
||||
<li>Holding <code>Alt</code> when dragging a node will *remove* it from its group</li>
|
||||
</ul>`,
|
||||
"ja": `<p>エディタ上のグループの操作が変更されました。</p>
|
||||
<ul>
|
||||
<li>グループ内のノードをクリックする時に、グループが邪魔をすることが無くなりました。</li>
|
||||
<li>「前面へ移動」と「背面へ移動」の動作を用いて、複数のグループの表示順序を変えることができます。</li>
|
||||
<li>グループ内へ一度に複数のノードをドラッグできるようになりました。</li>
|
||||
<li><code>Alt</code> を押したまま、グループ内のノードをドラッグすると、そのグループから *除く* ことができます。</li>
|
||||
</ul>`,
|
||||
"fr": `<p>Nous avons modifié la façon dont vous interagissez avec les groupes dans l'éditeur.</p>
|
||||
<ul>
|
||||
<li>Ils ne gênent plus lorsque vous cliquez sur un noeud</li>
|
||||
<li>Ils peuvent être réorganisés à l'aide des actions Avancer et Reculer</li>
|
||||
<li>Plusieurs noeuds peuvent être glissés dans un groupe en une seule fois</li>
|
||||
<li>Maintenir <code>Alt</code> lors du déplacement d'un noeud le *supprimera* de son groupe</li>
|
||||
</ul>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Change notification on tabs",
|
||||
"ja": "タブ上の変更通知",
|
||||
"fr": "Notification de changement sur les onglets"
|
||||
},
|
||||
image: '3.1/images/tab-changes.png',
|
||||
description: {
|
||||
"en-US": `<p>When a tab contains undeployed changes it now shows the
|
||||
same style of change icon used by nodes.</p>
|
||||
<p>This will make it much easier to track down changes when you're
|
||||
working across multiple flows.</p>`,
|
||||
"ja": `<p>タブ内にデプロイされていない変更が存在する時は、ノードと同じスタイルで変更の印が表示されるようになりました。</p>
|
||||
<p>これによって複数のフローを編集している時に、変更を見つけるのが簡単になりました。</p>`,
|
||||
"fr": `<p>Lorsqu'un onglet contient des modifications non déployées, il affiche désormais le
|
||||
même style d'icône de changement utilisé par les noeuds.</p>
|
||||
<p>Cela facilitera grandement le suivi des modifications lorsque vous
|
||||
travaillez sur plusieurs flux.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "A bigger canvas to work with",
|
||||
"ja": "より広くなった作業キャンバス",
|
||||
"fr": "Un canevas plus grand pour travailler"
|
||||
},
|
||||
description: {
|
||||
"en-US": `<p>The default canvas size has been increased so you can fit more
|
||||
into one flow.</p>
|
||||
<p>We still recommend using tools such as subflows and Link Nodes to help
|
||||
keep things organised, but now you have more room to work in.</p>`,
|
||||
"ja": `<p>標準のキャンバスが広くなったため、1つのフローに沢山のものを含めることができるようになりました。</p>
|
||||
<p>引き続き、サブフローやリンクノードなどの方法を用いて整理することをお勧めしますが、作業できる場所が増えました。</p>`,
|
||||
"fr": `<p>La taille par défaut du canevas a été augmentée pour que vous puissiez en mettre plus
|
||||
sur un seul flux.</p>
|
||||
<p>Nous recommandons toujours d'utiliser des outils tels que les sous-flux et les noeuds de lien pour vous aider
|
||||
à garder les choses organisées, mais vous avez maintenant plus d'espace pour travailler.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Finding help",
|
||||
"ja": "ヘルプを見つける",
|
||||
"fr": "Trouver de l'aide"
|
||||
},
|
||||
image: '3.1/images/node-help.png',
|
||||
description: {
|
||||
"en-US": `<p>All node edit dialogs now include a link to that node's help
|
||||
in the footer.</p>
|
||||
<p>Clicking it will open up the Help sidebar showing the help for that node.</p>`,
|
||||
"ja": `<p>全てのノードの編集ダイアログの下に、ノードのヘルプへのリンクが追加されました。</p>
|
||||
<p>これをクリックすると、ノードのヘルプサイドバーが表示されます。</p>`,
|
||||
"fr": `<p>Toutes les boîtes de dialogue d'édition de noeud incluent désormais un lien vers l'aide de ce noeud
|
||||
dans le pied de page.</p>
|
||||
<p>Cliquer dessus ouvrira la barre latérale d'aide affichant l'aide pour ce noeud.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Improved Context Menu",
|
||||
"ja": "コンテキストメニューの改善",
|
||||
"fr": "Menu contextuel amélioré"
|
||||
},
|
||||
image: '3.1/images/context-menu.png',
|
||||
description: {
|
||||
"en-US": `<p>The editor's context menu has been expanded to make lots more of
|
||||
the built-in actions available.</p>
|
||||
<p>Adding nodes, working with groups and plenty
|
||||
of other useful tools are now just a click away.</p>
|
||||
<p>The flow tab bar also has its own context menu to make working
|
||||
with your flows much easier.</p>`,
|
||||
"ja": `<p>より多くの組み込み動作を利用できるように、エディタのコンテキストメニューが拡張されました。</p>
|
||||
<p>ノードの追加、グループの操作、その他の便利なツールをクリックするだけで実行できるようになりました。</p>
|
||||
<p>フローのタブバーには、フローの操作をより簡単にする独自のコンテキストメニューもあります。</p>`,
|
||||
"fr": `<p>Le menu contextuel de l'éditeur a été étendu pour faire beaucoup plus d'actions intégrées disponibles.</p>
|
||||
<p>Ajouter des noeuds, travailler avec des groupes et beaucoup d'autres outils utiles sont désormais à portée de clic.</p>
|
||||
<p>La barre d'onglets de flux possède également son propre menu contextuel pour faciliter l'utilisation de vos flux.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Hiding Flows",
|
||||
"ja": "フローを非表示",
|
||||
"fr": "Masquage de flux"
|
||||
},
|
||||
image: '3.1/images/hiding-flows.png',
|
||||
description: {
|
||||
"en-US": `<p>Hiding flows is now done through the flow context menu.</p>
|
||||
<p>The 'hide' button in previous releases has been removed from the tabs
|
||||
as they were being clicked accidentally too often.</p>`,
|
||||
"ja": `<p>フローを非表示にする機能は、フローのコンテキストメニューから実行するようになりました。</p>
|
||||
<p>これまでのリリースでタブに存在していた「非表示」ボタンは、よく誤ってクリックされていたため、削除されました。</p>`,
|
||||
"fr": `<p>Le masquage des flux s'effectue désormais via le menu contextuel du flux.</p>
|
||||
<p>Le bouton "Masquer" des versions précédentes a été supprimé des onglets
|
||||
car il était cliqué accidentellement trop souvent.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Locking Flows",
|
||||
"ja": "フローを固定",
|
||||
"fr": "Verrouillage de flux"
|
||||
},
|
||||
image: '3.1/images/locking-flows.png',
|
||||
description: {
|
||||
"en-US": `<p>Flows can now be locked to prevent accidental changes being made.</p>
|
||||
<p>When locked you cannot modify the nodes in any way.</p>
|
||||
<p>The flow context menu provides the options to lock and unlock flows,
|
||||
as well as in the Info sidebar explorer.</p>`,
|
||||
"ja": `<p>誤ってフローに変更が加えられてしまうのを防ぐために、フローを固定できるようになりました。</p>
|
||||
<p>固定されている時は、ノードを修正することはできません。</p>
|
||||
<p>フローのコンテキストメニューと、情報サイドバーのエクスプローラには、フローの固定や解除をするためのオプションが用意されています。</p>`,
|
||||
"fr": `<p>Les flux peuvent désormais être verrouillés pour éviter toute modification accidentelle.</p>
|
||||
<p>Lorsqu'il est verrouillé, vous ne pouvez en aucun cas modifier les noeuds.</p>
|
||||
<p>Le menu contextuel du flux fournit les options pour verrouiller et déverrouiller les flux,
|
||||
ainsi que dans l'explorateur de la barre latérale d'informations.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Adding Images to node/flow descriptions",
|
||||
"ja": "ノードやフローの説明へ画像を追加",
|
||||
"fr": "Ajout d'images aux descriptions de noeud/flux"
|
||||
},
|
||||
// image: 'images/debug-path-tooltip.png',
|
||||
description: {
|
||||
"en-US": `<p>You can now add images to a node's or flows's description.</p>
|
||||
<p>Simply drag the image into the text editor and it will get added inline.</p>
|
||||
<p>When the description is shown in the Info sidebar, the image will be displayed.</p>`,
|
||||
"ja": `<p>ノードまたはフローの説明に、画像を追加できるようになりました。</p>
|
||||
<p>画像をテキストエディタにドラッグするだけで、行内に埋め込まれます。</p>
|
||||
<p>情報サイドバーの説明を開くと、その画像が表示されます。</p>`,
|
||||
"fr": `<p>Vous pouvez désormais ajouter des images à la description d'un noeud ou d'un flux.</p>
|
||||
<p>Faites simplement glisser l'image dans l'éditeur de texte et elle sera ajoutée en ligne.</p>
|
||||
<p>Lorsque la description s'affiche dans la barre latérale d'informations, l'image s'affiche.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Adding Mermaid Diagrams",
|
||||
"ja": "Mermaid図を追加",
|
||||
"fr": "Ajout de diagrammes Mermaid"
|
||||
},
|
||||
image: '3.1/images/mermaid.png',
|
||||
description: {
|
||||
"en-US": `<p>You can also add <a href="https://github.com/mermaid-js/mermaid">Mermaid</a> diagrams directly into your node or flow descriptions.</p>
|
||||
<p>This gives you much richer options for documenting your flows.</p>`,
|
||||
"ja": `<p>ノードやフローの説明に、<a href="https://github.com/mermaid-js/mermaid">Mermaid</a>図を直接追加することもできます。</p>
|
||||
<p>これによって、フローを説明する文書作成の選択肢がより多くなります。</p>`,
|
||||
"fr": `<p>Vous pouvez également ajouter des diagrammes <a href="https://github.com/mermaid-js/mermaid">Mermaid</a> directement dans vos descriptions de noeud ou de flux.</p>
|
||||
<p>Cela vous offre des options beaucoup plus riches pour documenter vos flux.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Managing Global Environment Variables",
|
||||
"ja": "グローバル環境変数の管理",
|
||||
"fr": "Gestion des variables d'environnement globales"
|
||||
},
|
||||
image: '3.1/images/global-env-vars.png',
|
||||
description: {
|
||||
"en-US": `<p>You can set environment variables that apply to all nodes and flows in the new
|
||||
'Global Environment Variables' section of User Settings.</p>`,
|
||||
"ja": `<p>ユーザ設定に新しく追加された「グローバル環境変数」のセクションで、全てのノードとフローに適用される環境変数を登録できます。</p>`,
|
||||
"fr": `<p>Vous pouvez définir des variables d'environnement qui s'appliquent à tous les noeuds et flux dans la nouvelle
|
||||
section "Global Environment Variables" des paramètres utilisateur.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Node Updates",
|
||||
"ja": "ノードの更新",
|
||||
"fr": "Mises à jour des noeuds"
|
||||
},
|
||||
// image: "images/",
|
||||
description: {
|
||||
"en-US": `<p>The core nodes have received lots of minor fixes, documentation updates and
|
||||
small enhancements. Check the full changelog in the Help sidebar for a full list.</p>`,
|
||||
"ja": `<p>コアノードにマイナーな修正、ドキュメント更新、小規模な拡張が数多く追加されています。全ての一覧は、ヘルプサイドバーの全ての更新履歴を確認してください。</p>`,
|
||||
"fr": `<p>Les noeuds principaux ont reçu de nombreux correctifs mineurs, mises à jour de la documentation et
|
||||
petites améliorations. Consulter le journal des modifications complet dans la barre latérale d'aide.</p>`
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-auto-complete.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-background-deploy.png
vendored
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-config-select.png
vendored
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-diff-update.png
vendored
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-multiplayer-location.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-multiplayer.png
vendored
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-plugins.png
vendored
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-sf-config.png
vendored
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
packages/node_modules/@node-red/editor-client/src/tours/images/nr4-timestamp-formatting.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
|
@ -1,12 +1,12 @@
|
|||
export default {
|
||||
version: "3.1.0",
|
||||
version: "4.0.0-beta.3",
|
||||
steps: [
|
||||
{
|
||||
titleIcon: "fa fa-map-o",
|
||||
title: {
|
||||
"en-US": "Welcome to Node-RED 3.1!",
|
||||
"ja": "Node-RED 3.1へようこそ!",
|
||||
"fr": "Bienvenue dans Node-RED 3.1!"
|
||||
"en-US": "Welcome to Node-RED 4.0 Beta 3!",
|
||||
"ja": "Node-RED 4.0 Beta 3へようこそ!",
|
||||
"fr": "Bienvenue dans Node-RED 4.0 Beta 3!"
|
||||
},
|
||||
description: {
|
||||
"en-US": "<p>Let's take a moment to discover the new features in this release.</p>",
|
||||
|
@ -16,202 +16,189 @@ export default {
|
|||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "New ways to work with groups",
|
||||
"ja": "グループの新たな操作方法",
|
||||
"fr": "De nouvelles façons de travailler avec les groupes"
|
||||
"en-US": "Multiplayer Mode",
|
||||
"ja": "複数ユーザ同時利用モード",
|
||||
"fr": "Mode Multi-utilisateur"
|
||||
},
|
||||
image: 'images/nr4-multiplayer-location.png',
|
||||
description: {
|
||||
"en-US": `<p>Multiplayer mode was introduced in the previous beta. With this release it
|
||||
now shows where in the editor other users are.</p>
|
||||
<p>As with the last beta, check the release post for details on how to enable this feature in your settings file.</p>`,
|
||||
// "ja": ``,
|
||||
"fr": `<p>Le mode multi-utilisateur a été introduit dans la version bêta précédente. Avec cette nouvelle version, vous
|
||||
pourrez désormais savoir où ces utilisateurs se trouvent dans l'éditeur.</p>
|
||||
<p>Comme pour la dernière version bêta, consultez la note de publication pour plus de détails sur la façon d'activer
|
||||
cette fonctionnalité dans votre fichier de paramètres.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Better background deploy handling",
|
||||
// "ja": "",
|
||||
"fr": "Meilleure gestion du déploiement en arrière-plan"
|
||||
},
|
||||
image: 'images/nr4-background-deploy.png',
|
||||
description: {
|
||||
"en-US": `<p>If another user deploys changes whilst you are editing, we now use a more discrete notification
|
||||
that doesn't stop you continuing your work - especially if they are being very productive and deploying lots
|
||||
of changes.</p>`,
|
||||
// "ja": ``,
|
||||
"fr": `<p>Si un autre utilisateur déploie des modifications pendant que vous êtes en train de modifier, vous recevrez
|
||||
une notification plus discrète qu'auparavant qui ne vous empêche pas de continuer votre travail.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Improved flow diffs",
|
||||
// "ja": "",
|
||||
"fr": "Amélioration des différences de flux"
|
||||
},
|
||||
image: 'images/nr4-diff-update.png',
|
||||
description: {
|
||||
"en-US": `<p>When viewing changes made to a flow, Node-RED now distinguishes between nodes that have had configuration
|
||||
changes and those that have only been moved.<p>
|
||||
<p>When faced with a long list of changes to look at, this makes it much easier to focus on more sigificant items.</p>`,
|
||||
// "ja": ``,
|
||||
"fr": `<p>Lors de l'affichage des modifications apportées à un flux, Node-RED fait désormais la distinction entre les
|
||||
noeuds qui ont changé de configuration et ceux qui ont seulement été déplacés.<p>
|
||||
<p>Face à une longue liste de changements à examiner, il est beaucoup plus facile de se concentrer sur les éléments les
|
||||
plus importants.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "That's it for Beta 3!",
|
||||
"ja": "ベータ2については以上です!",
|
||||
"fr": "C'est tout pour la bêta 3 !"
|
||||
},
|
||||
description: {
|
||||
"en-US": `<p>We have changed how you interact with groups in the editor.</p>
|
||||
"en-US": `<p>Keep clicking through to see what was added in previous beta releases</p>`,
|
||||
"ja": `<p>クリックを続けてベータ1で追加された内容を確認してください。</p>`,
|
||||
"fr": `<p>Continuez à cliquer pour voir ce qui a été ajouté dans la version bêta 1</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Better Configuration Node UX",
|
||||
"ja": "設定ノードのUXが向上",
|
||||
"fr": "Meilleure expérience utilisateur du noeud de configuration"
|
||||
},
|
||||
image: 'images/nr4-config-select.png',
|
||||
description: {
|
||||
"en-US": `<p>The Configuration node selection UI has had a small update to have a dedicated 'add' button
|
||||
next to the select box.</p>
|
||||
<p>It's a small change, but should make it easier to work with your config nodes.</p>`,
|
||||
"ja": `<p>設定ノードを選択するUIが修正され、選択ボックスの隣に専用の「追加」ボタンが追加されました。</p>
|
||||
<p>微修正ですが設定ノードの操作が容易になります。</p>`,
|
||||
"fr": `<p>L'interface utilisateur de la sélection du noeud de configuration a fait l'objet d'une petite
|
||||
mise à jour afin de disposer d'un bouton « Ajouter » à côté de la zone de sélection.</p>
|
||||
<p>C'est un petit changement, mais cela devrait faciliter le travail avec vos noeuds de configuration.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Remembering palette state",
|
||||
"ja": "パレットの状態を維持",
|
||||
"fr": "Mémorisation de l'état de la palette"
|
||||
},
|
||||
description: {
|
||||
"en-US": `<p>The palette now remembers what categories you have hidden between reloads - as well as any
|
||||
filter you have applied.</p>`,
|
||||
"ja": `<p>パレット上で非表示にしたカテゴリや適用したフィルタが、リロードしても記憶されるようになりました。</p>`,
|
||||
"fr": `<p>La palette se souvient désormais des catégories que vous avez masquées entre les rechargements,
|
||||
ainsi que le filtre que vous avez appliqué.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Plugins shown in the Palette Manager",
|
||||
"ja": "パレット管理にプラグインを表示",
|
||||
"fr": "Affichage des Plugins dans le gestionnaire de palettes"
|
||||
},
|
||||
image: 'images/nr4-plugins.png',
|
||||
description: {
|
||||
"en-US": `<p>The palette manager now shows any plugin modules you have installed, such as
|
||||
<code>node-red-debugger</code>. Previously they would only be shown if the plugins include
|
||||
nodes for the palette.</p>`,
|
||||
"ja": `<p>パレットの管理に <code>node-red-debugger</code> の様なインストールしたプラグインが表示されます。以前はプラグインにパレット向けのノードが含まれている時のみ表示されていました。</p>`,
|
||||
"fr": `<p>Le gestionnaire de palettes affiche désormais tous les plugins que vous avez installés,
|
||||
tels que <code>node-red-debugger</code>. Auparavant, ils n'étaient affichés que s'ils contenaient
|
||||
des noeuds pour la palette.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Timestamp formatting options",
|
||||
"ja": "タイムスタンプの形式の項目",
|
||||
"fr": "Options de formatage de l'horodatage"
|
||||
},
|
||||
image: 'images/nr4-timestamp-formatting.png',
|
||||
description: {
|
||||
"en-US": `<p>Nodes that let you set a timestamp now have options on what format that timestamp should be in.</p>
|
||||
<p>We're keeping it simple to begin with by providing three options:<p>
|
||||
<ul>
|
||||
<li>They don't get in the way when clicking on a node</li>
|
||||
<li>They can be reordered using the Moving Forwards and Move Backwards actions</li>
|
||||
<li>Multiple nodes can be dragged into a group in one go</li>
|
||||
<li>Holding <code>Alt</code> when dragging a node will *remove* it from its group</li>
|
||||
<li>Milliseconds since epoch - this is existing behaviour of the timestamp option</li>
|
||||
<li>ISO 8601 - a common format used by many systems</li>
|
||||
<li>JavaScript Date Object</li>
|
||||
</ul>`,
|
||||
"ja": `<p>エディタ上のグループの操作が変更されました。</p>
|
||||
"ja": `<p>タイムスタンプを設定するノードに、タイムスタンプの形式を指定できる項目が追加されました。</p>
|
||||
<p>次の3つの項目を追加したことで、簡単に選択できるようになりました:<p>
|
||||
<ul>
|
||||
<li>グループ内のノードをクリックする時に、グループが邪魔をすることが無くなりました。</li>
|
||||
<li>「前面へ移動」と「背面へ移動」の動作を用いて、複数のグループの表示順序を変えることができます。</li>
|
||||
<li>グループ内へ一度に複数のノードをドラッグできるようになりました。</li>
|
||||
<li><code>Alt</code> を押したまま、グループ内のノードをドラッグすると、そのグループから *除く* ことができます。</li>
|
||||
<li>エポックからのミリ秒 - 従来動作と同じになるタイムスタンプの項目</li>
|
||||
<li>ISO 8601 - 多くのシステムで使用されている共通の形式</li>
|
||||
<li>JavaScript日付オブジェクト</li>
|
||||
</ul>`,
|
||||
"fr": `<p>Nous avons modifié la façon dont vous interagissez avec les groupes dans l'éditeur.</p>
|
||||
"fr": `<p>Les noeuds qui vous permettent de définir un horodatage disposent désormais d'options sur le format dans lequel cet horodatage peut être défini.</p>
|
||||
<p>Nous gardons les choses simples en proposant trois options :<p>
|
||||
<ul>
|
||||
<li>Ils ne gênent plus lorsque vous cliquez sur un noeud</li>
|
||||
<li>Ils peuvent être réorganisés à l'aide des actions Avancer et Reculer</li>
|
||||
<li>Plusieurs noeuds peuvent être glissés dans un groupe en une seule fois</li>
|
||||
<li>Maintenir <code>Alt</code> lors du déplacement d'un noeud le *supprimera* de son groupe</li>
|
||||
<li>Millisecondes depuis l'époque : il s'agit du comportement existant de l'option d'horodatage</li>
|
||||
<li>ISO 8601 : un format commun utilisé par de nombreux systèmes</li>
|
||||
<li>Objet Date JavaScript</li>
|
||||
</ul>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Change notification on tabs",
|
||||
"ja": "タブ上の変更通知",
|
||||
"fr": "Notification de changement sur les onglets"
|
||||
"en-US": "Auto-complete of flow/global and env types",
|
||||
"ja": "フロー/グローバル、環境変数の型の自動補完",
|
||||
"fr": "Saisie automatique des types de flux/global et env"
|
||||
},
|
||||
image: 'images/tab-changes.png',
|
||||
image: 'images/nr4-auto-complete.png',
|
||||
description: {
|
||||
"en-US": `<p>When a tab contains undeployed changes it now shows the
|
||||
same style of change icon used by nodes.</p>
|
||||
<p>This will make it much easier to track down changes when you're
|
||||
working across multiple flows.</p>`,
|
||||
"ja": `<p>タブ内にデプロイされていない変更が存在する時は、ノードと同じスタイルで変更の印が表示されるようになりました。</p>
|
||||
<p>これによって複数のフローを編集している時に、変更を見つけるのが簡単になりました。</p>`,
|
||||
"fr": `<p>Lorsqu'un onglet contient des modifications non déployées, il affiche désormais le
|
||||
même style d'icône de changement utilisé par les noeuds.</p>
|
||||
<p>Cela facilitera grandement le suivi des modifications lorsque vous
|
||||
travaillez sur plusieurs flux.</p>`
|
||||
"en-US": `<p>The <code>flow</code>/<code>global</code> context inputs and the <code>env</code> input
|
||||
now all include auto-complete suggestions based on the live state of your flows.</p>
|
||||
`,
|
||||
"ja": `<p><code>flow</code>/<code>global</code>コンテキストや<code>env</code>の入力を、現在のフローの状態をもとに自動補完で提案するようになりました。</p>
|
||||
`,
|
||||
"fr": `<p>Les entrées contextuelles <code>flow</code>/<code>global</code> et l'entrée <code>env</code>
|
||||
incluent désormais des suggestions de saisie semi-automatique basées sur l'état actuel de vos flux.</p>
|
||||
`,
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "A bigger canvas to work with",
|
||||
"ja": "より広くなった作業キャンバス",
|
||||
"fr": "Un canevas plus grand pour travailler"
|
||||
"en-US": "Config node customisation in Subflows",
|
||||
"ja": "サブフローでの設定ノードのカスタマイズ",
|
||||
"fr": "Personnalisation du noeud de configuration dans les sous-flux"
|
||||
},
|
||||
image: 'images/nr4-sf-config.png',
|
||||
description: {
|
||||
"en-US": `<p>The default canvas size has been increased so you can fit more
|
||||
into one flow.</p>
|
||||
<p>We still recommend using tools such as subflows and Link Nodes to help
|
||||
keep things organised, but now you have more room to work in.</p>`,
|
||||
"ja": `<p>標準のキャンバスが広くなったため、1つのフローに沢山のものを含めることができるようになりました。</p>
|
||||
<p>引き続き、サブフローやリンクノードなどの方法を用いて整理することをお勧めしますが、作業できる場所が増えました。</p>`,
|
||||
"fr": `<p>La taille par défaut du canevas a été augmentée pour que vous puissiez en mettre plus
|
||||
sur un seul flux.</p>
|
||||
<p>Nous recommandons toujours d'utiliser des outils tels que les sous-flux et les noeuds de lien pour vous aider
|
||||
à garder les choses organisées, mais vous avez maintenant plus d'espace pour travailler.</p>`
|
||||
"en-US": `<p>Subflows can now be customised to allow each instance to use a different
|
||||
config node of a selected type.</p>
|
||||
<p>For example, each instance of a subflow that connects to an MQTT Broker and does some post-processing
|
||||
of the messages received can be pointed at a different broker.</p>
|
||||
`,
|
||||
"ja": `<p>サブフローをカスタマイズして、選択した型の異なる設定ノードを各インスタンスが使用できるようになりました。</p>
|
||||
<p>例えば、MQTTブローカへ接続し、メッセージ受信と後処理を行うサブフローの各インスタンスに異なるブローカを指定することも可能です。</p>
|
||||
`,
|
||||
"fr": `<p>Les sous-flux peuvent désormais être personnalisés pour permettre à chaque instance d'utiliser un
|
||||
noeud de configuration d'un type sélectionné.</p>
|
||||
<p>Par exemple, chaque instance d'un sous-flux qui se connecte à un courtier MQTT et effectue un post-traitement
|
||||
des messages reçus peut être pointée vers un autre courtier.</p>
|
||||
`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Finding help",
|
||||
"ja": "ヘルプを見つける",
|
||||
"fr": "Trouver de l'aide"
|
||||
},
|
||||
image: 'images/node-help.png',
|
||||
description: {
|
||||
"en-US": `<p>All node edit dialogs now include a link to that node's help
|
||||
in the footer.</p>
|
||||
<p>Clicking it will open up the Help sidebar showing the help for that node.</p>`,
|
||||
"ja": `<p>全てのノードの編集ダイアログの下に、ノードのヘルプへのリンクが追加されました。</p>
|
||||
<p>これをクリックすると、ノードのヘルプサイドバーが表示されます。</p>`,
|
||||
"fr": `<p>Toutes les boîtes de dialogue d'édition de noeud incluent désormais un lien vers l'aide de ce noeud
|
||||
dans le pied de page.</p>
|
||||
<p>Cliquer dessus ouvrira la barre latérale d'aide affichant l'aide pour ce noeud.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Improved Context Menu",
|
||||
"ja": "コンテキストメニューの改善",
|
||||
"fr": "Menu contextuel amélioré"
|
||||
},
|
||||
image: 'images/context-menu.png',
|
||||
description: {
|
||||
"en-US": `<p>The editor's context menu has been expanded to make lots more of
|
||||
the built-in actions available.</p>
|
||||
<p>Adding nodes, working with groups and plenty
|
||||
of other useful tools are now just a click away.</p>
|
||||
<p>The flow tab bar also has its own context menu to make working
|
||||
with your flows much easier.</p>`,
|
||||
"ja": `<p>より多くの組み込み動作を利用できるように、エディタのコンテキストメニューが拡張されました。</p>
|
||||
<p>ノードの追加、グループの操作、その他の便利なツールをクリックするだけで実行できるようになりました。</p>
|
||||
<p>フローのタブバーには、フローの操作をより簡単にする独自のコンテキストメニューもあります。</p>`,
|
||||
"fr": `<p>Le menu contextuel de l'éditeur a été étendu pour faire beaucoup plus d'actions intégrées disponibles.</p>
|
||||
<p>Ajouter des noeuds, travailler avec des groupes et beaucoup d'autres outils utiles sont désormais à portée de clic.</p>
|
||||
<p>La barre d'onglets de flux possède également son propre menu contextuel pour faciliter l'utilisation de vos flux.</p>`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Hiding Flows",
|
||||
"ja": "フローを非表示",
|
||||
"fr": "Masquage de flux"
|
||||
},
|
||||
image: 'images/hiding-flows.png',
|
||||
description: {
|
||||
"en-US": `<p>Hiding flows is now done through the flow context menu.</p>
|
||||
<p>The 'hide' button in previous releases has been removed from the tabs
|
||||
as they were being clicked accidentally too often.</p>`,
|
||||
"ja": `<p>フローを非表示にする機能は、フローのコンテキストメニューから実行するようになりました。</p>
|
||||
<p>これまでのリリースでタブに存在していた「非表示」ボタンは、よく誤ってクリックされていたため、削除されました。</p>`,
|
||||
"fr": `<p>Le masquage des flux s'effectue désormais via le menu contextuel du flux.</p>
|
||||
<p>Le bouton "Masquer" des versions précédentes a été supprimé des onglets
|
||||
car il était cliqué accidentellement trop souvent.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Locking Flows",
|
||||
"ja": "フローを固定",
|
||||
"fr": "Verrouillage de flux"
|
||||
},
|
||||
image: 'images/locking-flows.png',
|
||||
description: {
|
||||
"en-US": `<p>Flows can now be locked to prevent accidental changes being made.</p>
|
||||
<p>When locked you cannot modify the nodes in any way.</p>
|
||||
<p>The flow context menu provides the options to lock and unlock flows,
|
||||
as well as in the Info sidebar explorer.</p>`,
|
||||
"ja": `<p>誤ってフローに変更が加えられてしまうのを防ぐために、フローを固定できるようになりました。</p>
|
||||
<p>固定されている時は、ノードを修正することはできません。</p>
|
||||
<p>フローのコンテキストメニューと、情報サイドバーのエクスプローラには、フローの固定や解除をするためのオプションが用意されています。</p>`,
|
||||
"fr": `<p>Les flux peuvent désormais être verrouillés pour éviter toute modification accidentelle.</p>
|
||||
<p>Lorsqu'il est verrouillé, vous ne pouvez en aucun cas modifier les noeuds.</p>
|
||||
<p>Le menu contextuel du flux fournit les options pour verrouiller et déverrouiller les flux,
|
||||
ainsi que dans l'explorateur de la barre latérale d'informations.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Adding Images to node/flow descriptions",
|
||||
"ja": "ノードやフローの説明へ画像を追加",
|
||||
"fr": "Ajout d'images aux descriptions de noeud/flux"
|
||||
},
|
||||
// image: 'images/debug-path-tooltip.png',
|
||||
description: {
|
||||
"en-US": `<p>You can now add images to a node's or flows's description.</p>
|
||||
<p>Simply drag the image into the text editor and it will get added inline.</p>
|
||||
<p>When the description is shown in the Info sidebar, the image will be displayed.</p>`,
|
||||
"ja": `<p>ノードまたはフローの説明に、画像を追加できるようになりました。</p>
|
||||
<p>画像をテキストエディタにドラッグするだけで、行内に埋め込まれます。</p>
|
||||
<p>情報サイドバーの説明を開くと、その画像が表示されます。</p>`,
|
||||
"fr": `<p>Vous pouvez désormais ajouter des images à la description d'un noeud ou d'un flux.</p>
|
||||
<p>Faites simplement glisser l'image dans l'éditeur de texte et elle sera ajoutée en ligne.</p>
|
||||
<p>Lorsque la description s'affiche dans la barre latérale d'informations, l'image s'affiche.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Adding Mermaid Diagrams",
|
||||
"ja": "Mermaid図を追加",
|
||||
"fr": "Ajout de diagrammes Mermaid"
|
||||
},
|
||||
image: 'images/mermaid.png',
|
||||
description: {
|
||||
"en-US": `<p>You can also add <a href="https://github.com/mermaid-js/mermaid">Mermaid</a> diagrams directly into your node or flow descriptions.</p>
|
||||
<p>This gives you much richer options for documenting your flows.</p>`,
|
||||
"ja": `<p>ノードやフローの説明に、<a href="https://github.com/mermaid-js/mermaid">Mermaid</a>図を直接追加することもできます。</p>
|
||||
<p>これによって、フローを説明する文書作成の選択肢がより多くなります。</p>`,
|
||||
"fr": `<p>Vous pouvez également ajouter des diagrammes <a href="https://github.com/mermaid-js/mermaid">Mermaid</a> directement dans vos descriptions de noeud ou de flux.</p>
|
||||
<p>Cela vous offre des options beaucoup plus riches pour documenter vos flux.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Managing Global Environment Variables",
|
||||
"ja": "グローバル環境変数の管理",
|
||||
"fr": "Gestion des variables d'environnement globales"
|
||||
},
|
||||
image: 'images/global-env-vars.png',
|
||||
description: {
|
||||
"en-US": `<p>You can set environment variables that apply to all nodes and flows in the new
|
||||
'Global Environment Variables' section of User Settings.</p>`,
|
||||
"ja": `<p>ユーザ設定に新しく追加された「大域環境変数」のセクションで、全てのノードとフローに適用される環境変数を登録できます。</p>`,
|
||||
"fr": `<p>Vous pouvez définir des variables d'environnement qui s'appliquent à tous les noeuds et flux dans la nouvelle
|
||||
section "Global Environment Variables" des paramètres utilisateur.</p>`
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "Node Updates",
|
||||
|
@ -221,10 +208,28 @@ export default {
|
|||
// image: "images/",
|
||||
description: {
|
||||
"en-US": `<p>The core nodes have received lots of minor fixes, documentation updates and
|
||||
small enhancements. Check the full changelog in the Help sidebar for a full list.</p>`,
|
||||
"ja": `<p>コアノードにマイナーな修正、ドキュメント更新、小規模な拡張が数多く追加されています。全ての一覧は、ヘルプサイドバーの全ての更新履歴を確認してください。</p>`,
|
||||
"fr": `<p>Les noeuds principaux ont reçu de nombreux correctifs mineurs, mises à jour de la documentation et
|
||||
petites améliorations. Consulter le journal des modifications complet dans la barre latérale d'aide.</p>`
|
||||
small enhancements. Check the full changelog in the Help sidebar for a full list.</p>
|
||||
<ul>
|
||||
<li>A fully RFC4180 compliant CSV mode</li>
|
||||
<li>Customisable headers on the WebSocket node</li>
|
||||
<li>Split node now can operate on any message property</li>
|
||||
<li>and lots more...</li>
|
||||
</ul>`,
|
||||
"ja": `<p>コアノードには沢山の軽微な修正、ドキュメント更新、小さな機能拡張が入っています。全リストはヘルプサイドバーにある変更履歴を参照してください。</p>
|
||||
<ul>
|
||||
<li>RFC4180に完全に準拠したCSVモード</li>
|
||||
<li>WebSocketノードのカスタマイズ可能なヘッダ</li>
|
||||
<li>Splitノードは、メッセージプロパティで操作できるようになりました</li>
|
||||
<li>他にも沢山あります...</li>
|
||||
</ul>`,
|
||||
"fr": `<p>Les noeuds principaux ont reçu de nombreux correctifs mineurs ainsi que des améliorations. La documentation a été mise à jour.
|
||||
Consultez le journal des modifications dans la barre latérale d'aide pour une liste complète. Ci-dessous, les changements les plus importants :</p>
|
||||
<ul>
|
||||
<li>Un mode CSV entièrement conforme à la norme RFC4180</li>
|
||||
<li>En-têtes personnalisables pour le noeud WebSocket</li>
|
||||
<li>Le noeud Split peut désormais fonctionner sur n'importe quelle propriété de message</li>
|
||||
<li>Et bien plus encore...</li>
|
||||
</ul>`
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
|
||||
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
||||
|
||||
interface NodeMessage {
|
||||
topic?: string;
|
||||
payload?: any;
|
||||
_msgid?: string;
|
||||
/** `_msgid` is generated internally. It not something you typically need to set or modify. */ _msgid?: string;
|
||||
[other: string]: any; //permit other properties
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,15 @@ declare const promisify:typeof import('util').promisify
|
|||
/**
|
||||
* @typedef NodeStatus
|
||||
* @type {object}
|
||||
* @property {string} [fill] The fill property can be: red, green, yellow, blue or grey.
|
||||
* @property {string} [shape] The shape property can be: ring or dot.
|
||||
* @property {string} [text] The text to display
|
||||
* @property {'red'|'green'|'yellow'|'blue'|'grey'|string} [fill] - The fill property can be: red, green, yellow, blue or grey.
|
||||
* @property {'ring'|'dot'|string} [shape] The shape property can be: ring or dot.
|
||||
* @property {string|boolean|number} [text] The text to display
|
||||
*/
|
||||
interface NodeStatus {
|
||||
/** The fill property can be: red, green, yellow, blue or grey */
|
||||
fill?: string,
|
||||
fill?: 'red'|'green'|'yellow'|'blue'|'grey'|string,
|
||||
/** The shape property can be: ring or dot */
|
||||
shape?: string,
|
||||
shape?: 'ring'|'dot'|string,
|
||||
/** The text to display */
|
||||
text?: string|boolean|number
|
||||
}
|
||||
|
@ -37,25 +37,24 @@ declare class node {
|
|||
* Send 1 or more messages asynchronously
|
||||
* @param {object | object[]} msg The msg object
|
||||
* @param {Boolean} [clone=true] Flag to indicate the `msg` should be cloned. Default = `true`
|
||||
* @see node-red documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
|
||||
* @see Node-RED documentation [writing-functions: sending messages asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)
|
||||
*/
|
||||
static send(msg:object|object[], clone?:Boolean): void;
|
||||
static send(msg:NodeMessage|NodeMessage[], clone?:Boolean): void;
|
||||
/** Inform runtime this instance has completed its operation */
|
||||
static done();
|
||||
/** Send an error to the console and debug side bar. Include `msg` in the 2nd parameter to trigger the catch node. */
|
||||
static error(err:string|Error, msg?:object);
|
||||
static error(err:string|Error, msg?:NodeMessage);
|
||||
/** Log a warn message to the console and debug sidebar */
|
||||
static warn(warning:string|object);
|
||||
/** Log an info message to the console (not sent to sidebar)' */
|
||||
static log(info:string|object);
|
||||
/** Sets the status icon and text underneath the node.
|
||||
* @param {NodeStatus} status - The status object `{fill, shape, text}`
|
||||
* @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
|
||||
* @see Node-RED documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
|
||||
*/
|
||||
static status(status:NodeStatus);
|
||||
/** Sets the status text underneath the node.
|
||||
* @param {string} status - The status to display
|
||||
* @see node-red documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
|
||||
* @see Node-RED documentation [writing-functions: adding-status](https://nodered.org/docs/user-guide/writing-functions#adding-status)
|
||||
*/
|
||||
static status(status:string|boolean|number);
|
||||
/** the id of this node */
|
||||
|
@ -264,9 +263,12 @@ declare class global {
|
|||
/** Get an array of the keys in the context store */
|
||||
static keys(store: string, callback: Function);
|
||||
}
|
||||
|
||||
// (string & {}) is a workaround for offering string type completion without enforcing it. See https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
|
||||
type NR_ENV_NAME_STRING = 'NR_NODE_ID'|'NR_NODE_NAME'|'NR_NODE_PATH'|'NR_GROUP_ID'|'NR_GROUP_NAME'|'NR_FLOW_ID'|'NR_FLOW_NAME'|'NR_SUBFLOW_ID'|'NR_SUBFLOW_NAME'|'NR_SUBFLOW_PATH' | (string & {})
|
||||
declare class env {
|
||||
/**
|
||||
* Get an environment variable value
|
||||
* Get an environment variable value defined in the OS, or in the global/flow/subflow/group environment variables.
|
||||
*
|
||||
* Predefined node-red variables...
|
||||
* * `NR_NODE_ID` - the ID of the node
|
||||
|
@ -276,9 +278,16 @@ declare class env {
|
|||
* * `NR_GROUP_NAME` - the Name of the containing group
|
||||
* * `NR_FLOW_ID` - the ID of the flow the node is on
|
||||
* * `NR_FLOW_NAME` - the Name of the flow the node is on
|
||||
* @param name Name of the environment variable to get
|
||||
* * `NR_SUBFLOW_ID` - the ID of the subflow the node is in
|
||||
* * `NR_SUBFLOW_NAME` - the Name of the subflow the node is in
|
||||
* * `NR_SUBFLOW_PATH` - the Path of the subflow the node is in
|
||||
* @param name - The name of the environment variable
|
||||
* @example
|
||||
* ```const flowName = env.get("NR_FLOW_NAME");```
|
||||
* ```const flowName = env.get("NR_FLOW_NAME") // get the name of the flow```
|
||||
* @example
|
||||
* ```const systemHomeDir = env.get("HOME") // get the user's home directory```
|
||||
* @example
|
||||
* ```const systemHomeDir = env.get("LABEL1") // get the value of a global/flow/subflow/group defined variable named "LABEL1"```
|
||||
*/
|
||||
static get(name:string) :any;
|
||||
static get(name:NR_ENV_NAME_STRING) :any;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ declare namespace RED {
|
|||
*/
|
||||
function compareObjects(obj1: any, obj2: any): boolean;
|
||||
/**
|
||||
* Generates a psuedo-unique-random id.
|
||||
* Generates a pseudo-unique-random id.
|
||||
* @return {string} a random-ish id
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
|
||||
/* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
|
||||
|
||||
/**
|
||||
* The `assert` module provides a set of assertion functions for verifying
|
||||
* invariants.
|
||||
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
|
||||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
|
||||
*/
|
||||
declare module 'assert' {
|
||||
/**
|
||||
|
@ -290,8 +290,8 @@ declare module 'assert' {
|
|||
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
||||
*
|
||||
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
||||
* using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
|
||||
* and treated as being identical in case both sides are `NaN`.
|
||||
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
||||
* and treated as being identical if both sides are `NaN`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'assert';
|
||||
|
@ -323,9 +323,8 @@ declare module 'assert' {
|
|||
*
|
||||
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
||||
*
|
||||
* Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
|
||||
* being identical in case both
|
||||
* sides are `NaN`.
|
||||
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
||||
* specially handled and treated as being identical if both sides are `NaN`.
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'assert';
|
||||
|
@ -415,7 +414,7 @@ declare module 'assert' {
|
|||
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||
/**
|
||||
* Tests strict equality between the `actual` and `expected` parameters as
|
||||
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
||||
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'assert/strict';
|
||||
|
@ -453,7 +452,7 @@ declare module 'assert' {
|
|||
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||
/**
|
||||
* Tests strict inequality between the `actual` and `expected` parameters as
|
||||
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
||||
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
||||
*
|
||||
* ```js
|
||||
* import assert from 'assert/strict';
|
||||
|
|