1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge branch 'dev' into pr_2242

This commit is contained in:
Nick O'Leary 2020-02-25 14:32:33 +00:00
commit a09b3bb6c7
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
481 changed files with 12352 additions and 3181 deletions

View File

@ -28,7 +28,7 @@ To help us understand the issue, please fill-in as much of the following informa
### Please tell us about your environment: ### Please tell us about your environment:
- [ ] Node-RED version: - [ ] Node-RED version:
- [ ] node.js version: - [ ] Node.js version:
- [ ] npm version: - [ ] npm version:
- [ ] Platform/OS: - [ ] Platform/OS:
- [ ] Browser: - [ ] Browser:

View File

@ -33,7 +33,7 @@ To help us understand the issue, please fill-in as much of the following informa
### Please tell us about your environment: ### Please tell us about your environment:
- [ ] Node-RED version: - [ ] Node-RED version:
- [ ] node.js version: - [ ] Node.js version:
- [ ] npm version: - [ ] npm version:
- [ ] Platform/OS: - [ ] Platform/OS:
- [ ] Browser: - [ ] Browser:

View File

@ -9,5 +9,3 @@ matrix:
before_script: before_script:
- npm install -g istanbul coveralls - npm install -g istanbul coveralls
- node_js: "8" - node_js: "8"
allow_failures:
- node_js: "12"

View File

@ -1,3 +1,223 @@
#### 1.0.3: Maintenance Release
Runtime
- Increase timeouts in Subflow tests to minimise false positives
- Update grunt-sass and add node-sass for node12 support
- Fix timings of Delay node tests
- #2340 Update JSONata to 1.7.0
- Bump https-proxy-agent version
- #2332 Fix error handling of nodes with multiple input handlers
- Add script to generate npm publish script
- #2371 Ensure folder is present before write (e.g. flows file not in user folder)
- #2371 Handle windows UNC '\\' paths
- #2366 Handle logging of non-JSON encodable objects
Editor
- #2328 Fix language handling in subflow node
- Use default language if lng param not set in i18n req
- #2326 Fix palette editor search visualization
- #2375 Subflow status not showing i18n version of contained core nodes status
- Fix inverse of 'replace' editor event
- #2376 Fallback to base language files if present
- #2373 Support UI testing on the latest Google Chrome
- #2364 Add tooltip to expand button in markdown editor
- #2363 Support ctrl key to select tabs for Windows
- #2356 Make JSONata help initially shown in expression editor
- #2355 Prohibit line break in type menu of typedInput
Nodes
- Delay: Fix delay to not pass through .reset and .flush props consistently
- #2352 File: Using the a msg per line the last line does not get msg.topic passed
- #2339 HTTP Request: Check auth type on opening
- HTTP Request: add units info
- #2372 MQTT/WS: Improved proxy support for MQTT and WebSocket nodes
- #2370 MQTT: Add clarification that MQTT Out requires payload to send msg
#### 1.0.2: Maintenance Release
Runtime
- Allow node.status() to be passed number/bool types
- Allow node emitted events to have multiple arguments
- #2323 Fixed docstrings to have them match the function signature (name of parameters).
- #2318 NLS: Unify translations of "boolean"
Editor
- Ensure node status is refreshed whenever node is edited
- #2315 #2316 Ensure z property included in full message debug payload
- #2321 Fixed editor.json (JA nls)
- #2313 Fix element to collapse items in visual JSON editor
- #2314 Insert divider in menu by calling RED.menu.addItem('id', null);
Nodes
- Change: Fixup use of node.done
- #2322 Template: Fix invalid JSON data in template node docs
- #2320 File: Fixed a typo in 10-file.html (JA nls)
- #2312 Template: Remove unnecessary comma in help text
- #2319 Inject: Interval of inject node should be 596 hours or less.
#### 1.0.1: Maintenance Release
Runtime
- #2301 Add env vars to enable safe mode and projects
- `NODE_RED_ENABLE_SAFE_MODE`
- `NODE_RED_ENABLE_PROJECTS`
Editor
- #2308 Fix grid setting
- #2306 i18n support in tooltips
- Fix error when setting typedInput to boolean true/false
- #2299 Fix SVG icons in IE11
- #2303 Fix issue where subflow color did not update when not on a flow
Nodes
- #2297 TLS: Allow TLS config node to provide just CA cert
- #2307 Inject: Fix width on inject node property
- #2305 Switch: Let switch node between rule work both ways round
- Range: Add example to range node info and make use of target consistent
- Join: node must clone group message before sending
#### 1.0.0: Milestone Release
Editor
- Add click-on-tooltip to close
- Fix node draggable handling
- Ensure complete node scope property is remapped on import
- Update i18n for project feature
- Fix menu hiding function for flow editor
- Normalise default subflow color references
- Hide header text of very small screens to deploy is visible
- Fix tab access on touch screens
- Update radialMenu to use standard theme colours
- Fix undefined reference loading on mobile
- Allow word breaking of node name with long word
- Enable wrap mode in Markdown editor
- Maximize the size of markdown editor
Nodes
- remove legacy error option from file in mode
- Change MQTT node default 3.1 compatibility mode to false
- Show clear debug shortcut in tooltip
- Fix file-in port labels for all 4 options
- Add extra comment re Mustache escapes to Template info
- Fix typo in complete node
- Allow Function node output input to go to 0
#### 1.0.0-beta.4: Beta Release
Runtime
- Clone the first message passed to node.send in Function node
Editor
- Move flow-status button to footer for consistency
- Fix node hover effect to prevent jumping position
- Filter quick-add properly when splicing a wire
- Mark workspace dirty when deleting link node link Fixes #2274
- Add red-ui-button class to strategy login button
- Fix padding of subflow locale select Closes #2276
- Update info text of complete node & add JP text
- Add class red-ui-button to cancel button
- Add css class to login submit button (#2275)
- Realign subflow output port labels
- Move context sidebar auto-refresh option to individual sections
- Update Japanese message catalogue
- Fix subflow UI for select
- remove padding before label text for SUBFLOW UI row
- Allow SUBFLOW UI label row without variable name
Nodes
- Remove old rc option from exec node for 1.0
- Add python and SQL to template language options
- Fix Switch node display of jsonata_exp type
- Remove sentiment from core nodes
#### 1.0.0-beta.3: Beta Release
Runtime
- [FEATURE] Add Node Done API - make message passing async
- Ensure the subflow stop promise is waiting for before restarting
- Limit the regex for the /nodes/ api end points
- Add error event handler to ssh-keygen child_process Fixes #2255
- Fix default value handling on context array access Fixes #2252
- Remove all ui test dependencies from package.json
- Add req back to audit log events and extend to Projects api
- Ensure 2nd arg to node.error is an object Fixes #2228
- Use a more atomic process for writing context files Fixes #2271
Editor
- [FEATURE] Change core node categories
- [FEATURE] Subflow Instance property UI (#2236)
- [FEATURE] Add visual JSON editor
- [FEATURE] Add Action List dialog
- [FEATURE] Add new shortcut to clear debug message list - ctrl-alt-l
- [FEATURE] Add show-library dialog actions
- [FEATURE] Add shift-cursor handling for moving quick-add dialog
- [FEATURE] Add enable/disable-flow actions
- [FEATURE] Add actions to change deploy type
- [FEATURE] Allow config nodes to be disabled, tidy css and add actions
- [FEATURE] Add default shortcut (ctrl-d) for deploy
- [FEATURE] Initial implementation of redo (un-undo) - ctrl-y
- [FEATURE] add support for specifying subflow template color
- [FEATURE] Use ctrl-click on wire to splice node in place
- [FEATURE] Allow search results to show more than 25 results
- [FEATURE] Allow a node to change if it has an input port Closes #2268
- Revealing node position needs to account for zoom level Fixes #2172
- Fix typedInput option selection Fixes #2174
- Fix palette node id handling so search works Fixes #2173
- Add popover tooltips to debug sidebar,function and template
- Add popovers to context sidebar mini buttons
- Ensure node status icon is shown when value set
- Revert treeList children function signature change
- Restore tray component css for compatibility. Mark as deprecated
- fix function name & string compare function
- Handle empty list of example flows Fixes #2171
- Ensure library list has an item selected when opened
- Ensure tooltip popover doesn't replace normal popover
- Fix clipboard export download button
- Ensure input box has focus on repeated quick add
- Fix width calculation of typedInput
- Remove some hardcoded css colors
- Fix display of node help when clicking in palette Fixes #2194
- Ensure node help is loaded in the right language Fixes #2195
- Do not allow tab focus on clipboard hidden element
- Fix undefined error on typedInput due to valueLabel used before being added
- Fix undo of flow disable state change
- Fix select-all action in main view
- Fix delete-all action on config node sidebar
- Update UI tests for new editor css
- Add insertItemAt doc to editableList
- Ensure focus returns to the right element after dialogs shown
- Set autocomplete to disabled in form input elements
- Update all node icons to SVG
- Handle png/svg fallback for def.icon values. Remove old pngs
- Ignore empty examples directories (don't add to import menu)
- better handle example file at any depth - #2222
- Properly escape node types in palette
- Ensure session expiry timeout doesn't exceed limit
- Use node/tab map to make filterNodes more efficient
- Rearrange contents of subflow template settings tab
- Handle undefined node.\_def in edit stack title.
- fix converting selection to subflow
- Fix inserting new subflow node to existing wire between nodes
- Support displaying falsey node status values Fixes #2246
- Remove tab menu from node property UI for subflow and config nodes
- Mark workspace dirty when shift-click-drag detaches wires Fixes #2260
- Fix subflow category change on palette
Nodes
- Remove pi gpi, twitter, email and feedparser nodes from core
- Fix error handling in Websocket broadcast function Fixes #2182
- Handle websocket item being parseable but not an object better
- stop join tripping up if last message of buffer is blank.
- Add support for env var propety in switch node
- Improve handling of file upload in request node
- Add "has key" rule to switch node + tests
- Optimise generation of switch node edit dialog
- Add keep-alive option to HTTP Request - #2261
#### 1.0.0-beta.2: Beta Release #### 1.0.0-beta.2: Beta Release
Runtime Runtime
@ -46,6 +266,11 @@ Nodes
- Add expand editor button to Template node - Add expand editor button to Template node
- Update catch/status nodes to use selectNodes api and treeList - Update catch/status nodes to use selectNodes api and treeList
#### 0.20.8: Maintenance Release
- Sanitize tab name in edit dialog
- Pass httpServer to runtime even when httpAdmin disabled Fixes #2272
#### 0.20.7: Maintenance Release #### 0.20.7: Maintenance Release
- Update jsonata to 1.6.5 which should fix #2183 - Update jsonata to 1.6.5 which should fix #2183
@ -725,7 +950,7 @@ Nodes
- Initial support of sequence rules for SWITCH node (#1545) - Initial support of sequence rules for SWITCH node (#1545)
- initial support of SORT node (#1500) - initial support of SORT node (#1500)
- Inject node - let once delay be editable (#1541) - Inject node - let once delay be editable (#1541)
- Introduce `nodeMaxMessageBufferLength` setting for msg sequence nodes - Introduce `nodeMessageBufferMaxLength` setting for msg sequence nodes
- Let CSV correct parts if we remove header row. - Let CSV correct parts if we remove header row.
- let default apply if msg.delay not set in override mode. (#1397) - let default apply if msg.delay not set in override mode. (#1397)
- let trigger node be reset by boolean message (#1554) - let trigger node be reset by boolean message (#1554)

View File

@ -26,7 +26,7 @@ relevant nodes, press Ctrl-E and copy the flow data from the Export dialog.
At a minimum, please include: At a minimum, please include:
- Version of Node-RED - either release number if you downloaded a zip, or the first few lines of `git log` if you are cloning the repository directly. - Version of Node-RED - either release number if you downloaded a zip, or the first few lines of `git log` if you are cloning the repository directly.
- Version of node.js - what does `node -v` say? - Version of Node.js - what does `node -v` say?
## Feature requests ## Feature requests

View File

@ -16,6 +16,7 @@
var path = require("path"); var path = require("path");
var fs = require("fs-extra"); var fs = require("fs-extra");
var sass = require("node-sass");
module.exports = function(grunt) { module.exports = function(grunt) {
@ -25,9 +26,13 @@ module.exports = function(grunt) {
nodemonArgs.push(flowFile); nodemonArgs.push(flowFile);
} }
var browserstack = grunt.option('browserstack');
if (browserstack) {
process.env.BROWSERSTACK = true;
}
var nonHeadless = grunt.option('non-headless'); var nonHeadless = grunt.option('non-headless');
if (nonHeadless) { if (nonHeadless) {
process.env.NODE_RED_NON_HEADLESS = 'true'; process.env.NODE_RED_NON_HEADLESS = true;
} }
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
@ -79,20 +84,20 @@ module.exports = function(grunt) {
//"loopfunc": true, // allow functions to be defined in loops //"loopfunc": true, // allow functions to be defined in loops
//"sub": true // don't warn that foo['bar'] should be written as foo.bar //"sub": true // don't warn that foo['bar'] should be written as foo.bar
}, },
all: [ // all: [
'Gruntfile.js', // 'Gruntfile.js',
'red.js', // 'red.js',
'packages/**/*.js' // 'packages/**/*.js'
], // ],
core: { // core: {
files: { // files: {
src: [ // src: [
'Gruntfile.js', // 'Gruntfile.js',
'red.js', // 'red.js',
'packages/**/*.js', // 'packages/**/*.js',
] // ]
} // }
}, // },
nodes: { nodes: {
files: { files: {
src: [ 'nodes/core/*/*.js' ] src: [ 'nodes/core/*/*.js' ]
@ -100,7 +105,7 @@ module.exports = function(grunt) {
}, },
editor: { editor: {
files: { files: {
src: [ 'editor/js/**/*.js' ] src: [ 'packages/node_modules/@node-red/editor-client/src/js/**/*.js' ]
} }
}, },
tests: { tests: {
@ -220,6 +225,7 @@ module.exports = function(grunt) {
sass: { sass: {
build: { build: {
options: { options: {
implementation: sass,
outputStyle: 'compressed' outputStyle: 'compressed'
}, },
files: [{ files: [{
@ -276,7 +282,7 @@ module.exports = function(grunt) {
files: [ files: [
'packages/node_modules/@node-red/editor-client/src/js/**/*.js' 'packages/node_modules/@node-red/editor-client/src/js/**/*.js'
], ],
tasks: ['copy:build','concat','uglify','attachCopyright:js'] tasks: ['copy:build','concat',/*'uglify',*/ 'attachCopyright:js']
}, },
sass: { sass: {
files: [ files: [
@ -496,7 +502,9 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-chmod'); grunt.loadNpmTasks('grunt-chmod');
grunt.loadNpmTasks('grunt-jsonlint'); grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-mocha-istanbul'); grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-webdriver'); if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.loadNpmTasks('grunt-webdriver');
}
grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown'); grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-npm-command'); grunt.loadNpmTasks('grunt-npm-command');
@ -555,12 +563,25 @@ module.exports = function(grunt) {
}); });
grunt.registerTask('verifyUiTestDependencies', function() { grunt.registerTask('verifyUiTestDependencies', function() {
if (!fs.existsSync(path.join("node_modules", "chromedriver"))) { if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.fail.fatal('You need to run "npm install chromedriver@2" before running UI test.'); grunt.fail.fatal('You need to install the UI test dependencies first.\nUse the script in "scripts/install-ui-test-dependencies.sh"');
return false; return false;
} }
}); });
grunt.registerTask('generatePublishScript',
'Generates a script to publish build output to npm',
function () {
const done = this.async();
const generatePublishScript = require("./scripts/generate-publish-script.js");
generatePublishScript().then(function(output) {
grunt.log.writeln(output);
const filePath = path.join(grunt.config.get('paths.dist'),"modules","publish.sh");
grunt.file.write(filePath,output);
done();
});
});
grunt.registerTask('setDevEnv', grunt.registerTask('setDevEnv',
'Sets NODE_ENV=development so non-minified assets are used', 'Sets NODE_ENV=development so non-minified assets are used',
function () { function () {
@ -579,9 +600,15 @@ module.exports = function(grunt) {
'Runs code style check on editor code', 'Runs code style check on editor code',
['jshint:editor']); ['jshint:editor']);
grunt.registerTask('test-ui', if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
'Builds editor content then runs unit tests on editor ui', grunt.registerTask('test-ui',
['verifyUiTestDependencies','build','jshint:editor','webdriver:all']); 'Builds editor content then runs unit tests on editor ui',
['verifyUiTestDependencies']);
} else {
grunt.registerTask('test-ui',
'Builds editor content then runs unit tests on editor ui',
['verifyUiTestDependencies','build','jshint:editor','webdriver:all']);
}
grunt.registerTask('test-nodes', grunt.registerTask('test-nodes',
'Runs unit tests on core nodes', 'Runs unit tests on core nodes',
@ -597,7 +624,7 @@ module.exports = function(grunt) {
grunt.registerTask('release', grunt.registerTask('release',
'Create distribution zip file', 'Create distribution zip file',
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules']); ['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules','generatePublishScript']);
grunt.registerTask('pack-modules', grunt.registerTask('pack-modules',
'Create module pack files for release', 'Create module pack files for release',

View File

@ -5,9 +5,9 @@ http://nodered.org
[![Build Status](https://travis-ci.org/node-red/node-red.svg?branch=master)](https://travis-ci.org/node-red/node-red) [![Build Status](https://travis-ci.org/node-red/node-red.svg?branch=master)](https://travis-ci.org/node-red/node-red)
[![Coverage Status](https://coveralls.io/repos/node-red/node-red/badge.svg?branch=master)](https://coveralls.io/r/node-red/node-red?branch=master) [![Coverage Status](https://coveralls.io/repos/node-red/node-red/badge.svg?branch=master)](https://coveralls.io/r/node-red/node-red?branch=master)
A visual tool for wiring the Internet of Things. Low-code programming for event-driven applications.
![Node-RED: A visual tool for wiring the Internet of Things](http://nodered.org/images/node-red-screenshot.png) ![Node-RED: Low-code programming for event-driven applications](http://nodered.org/images/node-red-screenshot.png)
## Quick Start ## Quick Start
@ -56,7 +56,7 @@ This project adheres to the [Contributor Covenant 1.4](http://contributor-covena
## Authors ## Authors
Node-RED is a project of the [JS Foundation](http://js.foundation). Node-RED is a project of the [OpenJS Foundation](https://openjsf.org).
It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/). It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/).
@ -67,4 +67,4 @@ It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-t
## Copyright and license ## Copyright and license
Copyright JS Foundation and other contributors, http://js.foundation under [the Apache 2.0 license](LICENSE). Copyright JS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).

13
SECURITY.md Normal file
View File

@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.0.0 | :white_check_mark: |
| 0.20.x | :white_check_mark: |
## Reporting a Vulnerability
Please report any potential security issues to `team@nodered.org`. This will notify the core project team who will respond accordingly.

View File

@ -1,7 +1,7 @@
{ {
"name": "node-red", "name": "node-red",
"version": "1.0.0-beta.2", "version": "1.0.3",
"description": "A visual tool for wiring the Internet of Things", "description": "Low-code programming for event-driven applications",
"homepage": "http://nodered.org", "homepage": "http://nodered.org",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
@ -24,7 +24,7 @@
} }
], ],
"dependencies": { "dependencies": {
"ajv": "6.10.0", "ajv": "6.10.2",
"basic-auth": "2.0.1", "basic-auth": "2.0.1",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"body-parser": "1.19.0", "body-parser": "1.19.0",
@ -34,29 +34,29 @@
"cookie": "0.4.0", "cookie": "0.4.0",
"cookie-parser": "1.4.4", "cookie-parser": "1.4.4",
"cors": "2.8.5", "cors": "2.8.5",
"cron": "1.7.1", "cron": "1.7.2",
"denque": "1.4.1", "denque": "1.4.1",
"express": "4.17.1", "express": "4.17.1",
"express-session": "1.16.2", "express-session": "1.17.0",
"fs-extra": "8.1.0", "fs-extra": "8.1.0",
"fs.notify": "0.0.4", "fs.notify": "0.0.4",
"hash-sum": "2.0.0", "hash-sum": "2.0.0",
"https-proxy-agent": "2.2.1", "https-proxy-agent": "2.2.4",
"i18next": "15.1.2", "i18next": "15.1.2",
"iconv-lite": "0.5.0", "iconv-lite": "0.5.0",
"is-utf8": "0.2.1", "is-utf8": "0.2.1",
"js-yaml": "3.13.1", "js-yaml": "3.13.1",
"json-stringify-safe": "5.0.1", "json-stringify-safe": "5.0.1",
"jsonata": "1.6.5", "jsonata": "1.8.0",
"media-typer": "1.1.0", "media-typer": "1.1.0",
"memorystore": "1.6.1", "memorystore": "1.6.1",
"mime": "2.4.4", "mime": "2.4.4",
"mqtt": "2.18.8", "mqtt": "2.18.8",
"multer": "1.4.1", "multer": "1.4.2",
"mustache": "3.0.1", "mustache": "3.0.2",
"node-red-node-rbe": "^0.2.4", "node-red-node-rbe": "^0.2.6",
"node-red-node-sentiment": "^0.1.3", "node-red-node-sentiment": "^0.1.6",
"node-red-node-tail": "^0.0.2", "node-red-node-tail": "^0.1.0",
"nopt": "4.0.1", "nopt": "4.0.1",
"oauth2orize": "1.11.0", "oauth2orize": "1.11.0",
"on-headers": "1.0.2", "on-headers": "1.0.2",
@ -65,11 +65,11 @@
"passport-oauth2-client-password": "0.1.2", "passport-oauth2-client-password": "0.1.2",
"raw-body": "2.4.1", "raw-body": "2.4.1",
"request": "2.88.0", "request": "2.88.0",
"semver": "6.2.0", "semver": "6.3.0",
"uglify-js": "3.6.0", "uglify-js": "3.6.9",
"when": "3.7.8", "when": "3.7.8",
"ws": "6.2.1", "ws": "6.2.1",
"xml2js": "0.4.19" "xml2js": "0.4.22"
}, },
"optionalDependencies": { "optionalDependencies": {
"bcrypt": "3.0.6" "bcrypt": "3.0.6"
@ -79,38 +79,34 @@
"grunt-chmod": "~1.1.1", "grunt-chmod": "~1.1.1",
"grunt-cli": "~1.3.2", "grunt-cli": "~1.3.2",
"grunt-concurrent": "~2.3.1", "grunt-concurrent": "~2.3.1",
"grunt-contrib-clean": "~1.1.0", "grunt-contrib-clean": "~2.0.0",
"grunt-contrib-compress": "~1.4.0", "grunt-contrib-compress": "~1.5.0",
"grunt-contrib-concat": "~1.0.1", "grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0", "grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jshint": "~1.1.0", "grunt-contrib-jshint": "~2.1.0",
"grunt-contrib-uglify": "~3.4.0", "grunt-contrib-uglify": "~4.0.1",
"grunt-contrib-watch": "~1.1.0", "grunt-contrib-watch": "~1.1.0",
"grunt-jsdoc": "^2.2.1", "grunt-jsdoc": "^2.2.1",
"grunt-jsdoc-to-markdown": "^4.0.0", "grunt-jsdoc-to-markdown": "^4.0.0",
"grunt-jsonlint": "~1.1.0", "grunt-jsonlint": "~2.0.0",
"grunt-mkdir": "~1.0.0", "grunt-mkdir": "~1.0.0",
"grunt-mocha-istanbul": "5.0.2", "grunt-mocha-istanbul": "5.0.2",
"grunt-nodemon": "~0.4.2", "grunt-nodemon": "~0.4.2",
"grunt-npm-command": "~0.1.2", "grunt-npm-command": "~0.1.2",
"grunt-sass": "~2.0.0", "grunt-sass": "~3.1.0",
"grunt-simple-mocha": "~0.4.1", "grunt-simple-mocha": "~0.4.1",
"grunt-webdriver": "^2.0.3", "http-proxy": "1.18.0",
"http-proxy": "^1.16.2",
"istanbul": "0.4.5", "istanbul": "0.4.5",
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
"minami": "1.2.3", "minami": "1.2.3",
"mocha": "^5.2.0", "mocha": "^5.2.0",
"mosca": "^2.8.3", "mosca": "^2.8.3",
"node-red-node-test-helper": "^0.2.3",
"node-sass": "^4.13.0",
"should": "^8.4.0", "should": "^8.4.0",
"sinon": "1.17.7", "sinon": "1.17.7",
"stoppable": "^1.1.0", "stoppable": "^1.1.0",
"supertest": "3.4.2", "supertest": "3.4.2"
"wdio-chromedriver-service": "^0.1.5",
"wdio-mocha-framework": "^0.6.4",
"wdio-spec-reporter": "^0.1.5",
"webdriverio": "^4.14.1",
"node-red-node-test-helper": "^0.2.3",
"jsdoc-nr-template": "node-red/jsdoc-nr-template"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"

View File

@ -30,7 +30,8 @@ module.exports = {
scope: req.params.scope, scope: req.params.scope,
id: req.params.id, id: req.params.id,
key: req.params[0], key: req.params[0],
store: req.query['store'] store: req.query['store'],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.context.getValue(opts).then(function(result) { runtimeAPI.context.getValue(opts).then(function(result) {
res.json(result); res.json(result);
@ -45,7 +46,8 @@ module.exports = {
scope: req.params.scope, scope: req.params.scope,
id: req.params.id, id: req.params.id,
key: req.params[0], key: req.params[0],
store: req.query['store'] store: req.query['store'],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.context.delete(opts).then(function(result) { runtimeAPI.context.delete(opts).then(function(result) {
res.status(204).end(); res.status(204).end();

View File

@ -24,7 +24,8 @@ module.exports = {
get: function(req,res) { get: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.getFlow(opts).then(function(result) { runtimeAPI.flows.getFlow(opts).then(function(result) {
return res.json(result); return res.json(result);
@ -35,7 +36,8 @@ module.exports = {
post: function(req,res) { post: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
flow: req.body flow: req.body,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.addFlow(opts).then(function(id) { runtimeAPI.flows.addFlow(opts).then(function(id) {
return res.json({id:id}); return res.json({id:id});
@ -47,7 +49,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
flow: req.body flow: req.body,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.updateFlow(opts).then(function(id) { runtimeAPI.flows.updateFlow(opts).then(function(id) {
return res.json({id:id}); return res.json({id:id});
@ -58,7 +61,8 @@ module.exports = {
delete: function(req,res) { delete: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.deleteFlow(opts).then(function() { runtimeAPI.flows.deleteFlow(opts).then(function() {
res.status(204).end(); res.status(204).end();

View File

@ -27,7 +27,8 @@ module.exports = {
return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"}); return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"});
} }
var opts = { var opts = {
user: req.user user: req.user,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.getFlows(opts).then(function(result) { runtimeAPI.flows.getFlows(opts).then(function(result) {
if (version === "v1") { if (version === "v1") {
@ -46,7 +47,8 @@ module.exports = {
} }
var opts = { var opts = {
user: req.user, user: req.user,
deploymentType: req.get("Node-RED-Deployment-Type")||"full" deploymentType: req.get("Node-RED-Deployment-Type")||"full",
req: apiUtils.getRequestLogObject(req)
} }
if (opts.deploymentType !== 'reload') { if (opts.deploymentType !== 'reload') {

View File

@ -48,13 +48,13 @@ module.exports = {
// Nodes // Nodes
adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll,apiUtil.errorHandler); adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll,apiUtil.errorHandler);
adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post,apiUtil.errorHandler); adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post,apiUtil.errorHandler);
adminApp.get(/\/nodes\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalogs,apiUtil.errorHandler); adminApp.get(/^\/nodes\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalogs,apiUtil.errorHandler);
adminApp.get(/\/nodes\/((@[^\/]+\/)?[^\/]+\/[^\/]+)\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalog,apiUtil.errorHandler); adminApp.get(/^\/nodes\/((@[^\/]+\/)?[^\/]+\/[^\/]+)\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalog,apiUtil.errorHandler);
adminApp.get(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.read"),nodes.getModule,apiUtil.errorHandler); adminApp.get(/^\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.read"),nodes.getModule,apiUtil.errorHandler);
adminApp.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.putModule,apiUtil.errorHandler); adminApp.put(/^\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.putModule,apiUtil.errorHandler);
adminApp.delete(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.delete,apiUtil.errorHandler); adminApp.delete(/^\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.write"),nodes.delete,apiUtil.errorHandler);
adminApp.get(/\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,needsPermission("nodes.read"),nodes.getSet,apiUtil.errorHandler); adminApp.get(/^\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,needsPermission("nodes.read"),nodes.getSet,apiUtil.errorHandler);
adminApp.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,needsPermission("nodes.write"),nodes.putSet,apiUtil.errorHandler); adminApp.put(/^\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,needsPermission("nodes.write"),nodes.putSet,apiUtil.errorHandler);
// Context // Context
adminApp.get("/context/:scope(global)",needsPermission("context.read"),context.get,apiUtil.errorHandler); adminApp.get("/context/:scope(global)",needsPermission("context.read"),context.get,apiUtil.errorHandler);

View File

@ -24,7 +24,8 @@ module.exports = {
}, },
getAll: function(req,res) { getAll: function(req,res) {
var opts = { var opts = {
user: req.user user: req.user,
req: apiUtils.getRequestLogObject(req)
} }
if (req.get("accept") == "application/json") { if (req.get("accept") == "application/json") {
runtimeAPI.nodes.getNodeList(opts).then(function(list) { runtimeAPI.nodes.getNodeList(opts).then(function(list) {
@ -42,7 +43,9 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
module: req.body.module, module: req.body.module,
version: req.body.version version: req.body.version,
url: req.body.url,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.addModule(opts).then(function(info) { runtimeAPI.nodes.addModule(opts).then(function(info) {
res.json(info); res.json(info);
@ -54,7 +57,8 @@ module.exports = {
delete: function(req,res) { delete: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
module: req.params[0] module: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.removeModule(opts).then(function() { runtimeAPI.nodes.removeModule(opts).then(function() {
res.status(204).end(); res.status(204).end();
@ -66,7 +70,8 @@ module.exports = {
getSet: function(req,res) { getSet: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params[0] + "/" + req.params[2] id: req.params[0] + "/" + req.params[2],
req: apiUtils.getRequestLogObject(req)
} }
if (req.get("accept") === "application/json") { if (req.get("accept") === "application/json") {
runtimeAPI.nodes.getNodeInfo(opts).then(function(result) { runtimeAPI.nodes.getNodeInfo(opts).then(function(result) {
@ -87,7 +92,8 @@ module.exports = {
getModule: function(req,res) { getModule: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
module: req.params[0] module: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.getModuleInfo(opts).then(function(result) { runtimeAPI.nodes.getModuleInfo(opts).then(function(result) {
res.send(result); res.send(result);
@ -106,7 +112,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params[0] + "/" + req.params[2], id: req.params[0] + "/" + req.params[2],
enabled: body.enabled enabled: body.enabled,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.setNodeSetState(opts).then(function(result) { runtimeAPI.nodes.setNodeSetState(opts).then(function(result) {
res.send(result); res.send(result);
@ -125,7 +132,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
module: req.params[0], module: req.params[0],
enabled: body.enabled enabled: body.enabled,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.setModuleState(opts).then(function(result) { runtimeAPI.nodes.setModuleState(opts).then(function(result) {
res.send(result); res.send(result);
@ -139,7 +147,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
module: req.params[0], module: req.params[0],
lang: req.query.lng lang: req.query.lng,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) { runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) {
res.json(result); res.json(result);
@ -152,7 +161,8 @@ module.exports = {
getModuleCatalogs: function(req,res) { getModuleCatalogs: function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
lang: req.query.lng lang: req.query.lng,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) { runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) {
res.json(result); res.json(result);
@ -164,7 +174,8 @@ module.exports = {
getIcons: function(req,res) { getIcons: function(req,res) {
var opts = { var opts = {
user: req.user user: req.user,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.nodes.getIconList(opts).then(function(list) { runtimeAPI.nodes.getIconList(opts).then(function(list) {
res.json(list); res.json(list);

View File

@ -88,13 +88,13 @@ module.exports = {
// Locales // Locales
var locales = require("./locales"); var locales = require("./locales");
locales.init(runtimeAPI); locales.init(runtimeAPI);
editorApp.get(/locales\/(.+)\/?$/,locales.get,apiUtil.errorHandler); editorApp.get(/^\/locales\/(.+)\/?$/,locales.get,apiUtil.errorHandler);
// Library // Library
var library = require("./library"); var library = require("./library");
library.init(runtimeAPI); library.init(runtimeAPI);
editorApp.get(/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry); editorApp.get(/^\/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
editorApp.post(/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry); editorApp.post(/^\/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
// Credentials // Credentials

View File

@ -15,7 +15,7 @@
**/ **/
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
//var apiUtil = require('../util'); // var apiUtil = require('../util');
var i18n = require("@node-red/util").i18n; // TODO: separate module var i18n = require("@node-red/util").i18n; // TODO: separate module
@ -41,7 +41,7 @@ module.exports = {
var namespace = req.params[0]; var namespace = req.params[0];
var lngs = req.query.lng; var lngs = req.query.lng;
namespace = namespace.replace(/\.json$/,""); namespace = namespace.replace(/\.json$/,"");
var lang = req.query.lng; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []); var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
var prevLang = i18n.i.language; var prevLang = i18n.i.language;
// Trigger a load from disk of the language if it is not the default // Trigger a load from disk of the language if it is not the default
i18n.i.changeLanguage(lang, function(){ i18n.i.changeLanguage(lang, function(){

View File

@ -22,7 +22,8 @@ var needsPermission = require("../auth").needsPermission;
function listProjects(req,res) { function listProjects(req,res) {
var opts = { var opts = {
user: req.user user: req.user,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.listProjects(opts).then(function(result) { runtimeAPI.projects.listProjects(opts).then(function(result) {
res.json(result); res.json(result);
@ -33,7 +34,8 @@ function listProjects(req,res) {
function getProject(req,res) { function getProject(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getProject(opts).then(function(data) { runtimeAPI.projects.getProject(opts).then(function(data) {
if (data) { if (data) {
@ -49,7 +51,8 @@ function getProjectStatus(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: req.query.remote remote: req.query.remote,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getStatus(opts).then(function(data){ runtimeAPI.projects.getStatus(opts).then(function(data){
if (data) { if (data) {
@ -64,7 +67,8 @@ function getProjectStatus(req,res) {
function getProjectRemotes(req,res) { function getProjectRemotes(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getRemotes(opts).then(function(data) { runtimeAPI.projects.getRemotes(opts).then(function(data) {
res.json(data); res.json(data);
@ -98,7 +102,8 @@ module.exports = {
app.post("/", needsPermission("projects.write"), function(req,res) { app.post("/", needsPermission("projects.write"), function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
project: req.body project: req.body,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.createProject(opts).then(function(result) { runtimeAPI.projects.createProject(opts).then(function(result) {
res.json(result); res.json(result);
@ -112,7 +117,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
project: req.body project: req.body,
req: apiUtils.getRequestLogObject(req)
} }
if (req.body.active) { if (req.body.active) {
@ -150,7 +156,8 @@ module.exports = {
app.delete("/:id", needsPermission("projects.write"), function(req,res) { app.delete("/:id", needsPermission("projects.write"), function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.deleteProject(opts).then(function() { runtimeAPI.projects.deleteProject(opts).then(function() {
res.status(204).end(); res.status(204).end();
@ -168,7 +175,8 @@ module.exports = {
app.get("/:id/files", needsPermission("projects.read"), function(req,res) { app.get("/:id/files", needsPermission("projects.read"), function(req,res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getFiles(opts).then(function(data) { runtimeAPI.projects.getFiles(opts).then(function(data) {
res.json(data); res.json(data);
@ -185,7 +193,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0], path: req.params[0],
tree: req.params.treeish tree: req.params.treeish,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getFile(opts).then(function(data) { runtimeAPI.projects.getFile(opts).then(function(data) {
res.json({content:data}); res.json({content:data});
@ -199,7 +208,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0] path: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.revertFile(opts).then(function() { runtimeAPI.projects.revertFile(opts).then(function() {
@ -214,7 +224,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0] path: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.stageFile(opts).then(function() { runtimeAPI.projects.stageFile(opts).then(function() {
getProjectStatus(req,res); getProjectStatus(req,res);
@ -228,7 +239,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.body.files path: req.body.files,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.stageFile(opts).then(function() { runtimeAPI.projects.stageFile(opts).then(function() {
getProjectStatus(req,res); getProjectStatus(req,res);
@ -242,7 +254,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
message: req.body.message message: req.body.message,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.commit(opts).then(function() { runtimeAPI.projects.commit(opts).then(function() {
getProjectStatus(req,res); getProjectStatus(req,res);
@ -256,7 +269,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0] path: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.unstageFile(opts).then(function() { runtimeAPI.projects.unstageFile(opts).then(function() {
getProjectStatus(req,res); getProjectStatus(req,res);
@ -269,7 +283,8 @@ module.exports = {
app.delete("/:id/stage", needsPermission("projects.write"), function(req, res) { app.delete("/:id/stage", needsPermission("projects.write"), function(req, res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.unstageFile(opts).then(function() { runtimeAPI.projects.unstageFile(opts).then(function() {
getProjectStatus(req,res); getProjectStatus(req,res);
@ -284,7 +299,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0], path: req.params[0],
type: req.params.type type: req.params.type,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getFileDiff(opts).then(function(data) { runtimeAPI.projects.getFileDiff(opts).then(function(data) {
res.json({ res.json({
@ -301,7 +317,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
limit: req.query.limit || 20, limit: req.query.limit || 20,
before: req.query.before before: req.query.before,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getCommits(opts).then(function(data) { runtimeAPI.projects.getCommits(opts).then(function(data) {
res.json(data); res.json(data);
@ -315,7 +332,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
sha: req.params.sha sha: req.params.sha,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getCommit(opts).then(function(data) { runtimeAPI.projects.getCommit(opts).then(function(data) {
res.json({commit:data}); res.json({commit:data});
@ -330,7 +348,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: req.params[0], remote: req.params[0],
track: req.query.u track: req.query.u,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.push(opts).then(function(data) { runtimeAPI.projects.push(opts).then(function(data) {
res.status(204).end(); res.status(204).end();
@ -346,7 +365,8 @@ module.exports = {
id: req.params.id, id: req.params.id,
remote: req.params[0], remote: req.params[0],
track: req.query.setUpstream, track: req.query.setUpstream,
allowUnrelatedHistories: req.query.allowUnrelatedHistories allowUnrelatedHistories: req.query.allowUnrelatedHistories,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.pull(opts).then(function(data) { runtimeAPI.projects.pull(opts).then(function(data) {
res.status(204).end(); res.status(204).end();
@ -359,7 +379,8 @@ module.exports = {
app.delete("/:id/merge", needsPermission("projects.write"), function(req, res) { app.delete("/:id/merge", needsPermission("projects.write"), function(req, res) {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id id: req.params.id,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.abortMerge(opts).then(function() { runtimeAPI.projects.abortMerge(opts).then(function() {
res.status(204).end(); res.status(204).end();
@ -374,7 +395,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
path: req.params[0], path: req.params[0],
resolution: req.body.resolutions resolution: req.body.resolutions,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.resolveMerge(opts).then(function() { runtimeAPI.projects.resolveMerge(opts).then(function() {
res.status(204).end(); res.status(204).end();
@ -388,7 +410,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: false remote: false,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getBranches(opts).then(function(data) { runtimeAPI.projects.getBranches(opts).then(function(data) {
res.json(data); res.json(data);
@ -403,7 +426,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
branch: req.params.branchName, branch: req.params.branchName,
force: !!req.query.force force: !!req.query.force,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.deleteBranch(opts).then(function(data) { runtimeAPI.projects.deleteBranch(opts).then(function(data) {
res.status(204).end(); res.status(204).end();
@ -417,7 +441,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: true remote: true,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getBranches(opts).then(function(data) { runtimeAPI.projects.getBranches(opts).then(function(data) {
res.json(data); res.json(data);
@ -431,7 +456,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
branch: req.params[0] branch: req.params[0],
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.getBranchStatus(opts).then(function(data) { runtimeAPI.projects.getBranchStatus(opts).then(function(data) {
res.json(data); res.json(data);
@ -446,7 +472,8 @@ module.exports = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
branch: req.body.name, branch: req.body.name,
create: req.body.create create: req.body.create,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.setBranch(opts).then(function(data) { runtimeAPI.projects.setBranch(opts).then(function(data) {
res.json(data); res.json(data);
@ -463,7 +490,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: req.body remote: req.body,
req: apiUtils.getRequestLogObject(req)
} }
if (/^https?:\/\/[^/]+@/i.test(req.body.url)) { if (/^https?:\/\/[^/]+@/i.test(req.body.url)) {
res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"}); res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"});
@ -481,7 +509,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: req.params.remoteName remote: req.params.remoteName,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.removeRemote(opts).then(function(data) { runtimeAPI.projects.removeRemote(opts).then(function(data) {
getProjectRemotes(req,res); getProjectRemotes(req,res);
@ -497,7 +526,8 @@ module.exports = {
var opts = { var opts = {
user: req.user, user: req.user,
id: req.params.id, id: req.params.id,
remote: remote remote: remote,
req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.projects.updateRemote(opts).then(function() { runtimeAPI.projects.updateRemote(opts).then(function() {
res.status(204).end(); res.status(204).end();

View File

@ -42,7 +42,7 @@ var editor;
/** /**
* Initialise the module. * Initialise the module.
* @param {Object} settings The runtime settings * @param {Object} settings The runtime settings
* @param {HTTPServer} server An instance of HTTP Server * @param {HTTPServer} _server An instance of HTTP Server
* @param {Storage} storage An instance of Node-RED Storage * @param {Storage} storage An instance of Node-RED Storage
* @param {Runtime} runtimeAPI An instance of Node-RED Runtime * @param {Runtime} runtimeAPI An instance of Node-RED Runtime
* @memberof @node-red/editor-api * @memberof @node-red/editor-api

View File

@ -47,5 +47,12 @@ module.exports = {
code: err.code||"unexpected_error", code: err.code||"unexpected_error",
message: err.message||err.toString() message: err.message||err.toString()
}); });
},
getRequestLogObject: function(req) {
return {
user: req.user,
path: req.path,
ip: (req.headers && req.headers['x-forwarded-for']) || (req.connection && req.connection.remoteAddress) || undefined
}
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@node-red/editor-api", "name": "@node-red/editor-api",
"version": "1.0.0-beta.2", "version": "1.0.3",
"license": "Apache-2.0", "license": "Apache-2.0",
"main": "./lib/index.js", "main": "./lib/index.js",
"repository": { "repository": {
@ -16,17 +16,17 @@
} }
], ],
"dependencies": { "dependencies": {
"@node-red/util": "1.0.0-beta.2", "@node-red/util": "1.0.3",
"@node-red/editor-client": "1.0.0-beta.2", "@node-red/editor-client": "1.0.3",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"body-parser": "1.19.0", "body-parser": "1.19.0",
"clone": "2.1.2", "clone": "2.1.2",
"cors": "2.8.5", "cors": "2.8.5",
"express-session": "1.16.2", "express-session": "1.17.0",
"express": "4.17.1", "express": "4.17.1",
"memorystore": "1.6.1", "memorystore": "1.6.1",
"mime": "2.4.4", "mime": "2.4.4",
"mustache": "3.0.1", "mustache": "3.0.2",
"oauth2orize": "1.11.0", "oauth2orize": "1.11.0",
"passport-http-bearer": "1.0.1", "passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2", "passport-oauth2-client-password": "0.1.2",

View File

@ -26,8 +26,7 @@
"status" : "Status", "status" : "Status",
"enabled" : "Aktiviert", "enabled" : "Aktiviert",
"disabled" : "Inaktiviert", "disabled" : "Inaktiviert",
"info" : "Beschreibung", "info" : "Beschreibung"
"tip" : "Beschreibung akzeptiert Markdown und wird auf der Registerkarte Info angezeigt."
}, },
"menu" : { "menu" : {
"label" : { "label" : {
@ -237,7 +236,6 @@
"deleteSubflow" : "Subflow löschen", "deleteSubflow" : "Subflow löschen",
"info" : "Beschreibung", "info" : "Beschreibung",
"category" : "Kategorie", "category" : "Kategorie",
"format" : "Markdown-Format",
"errors" : { "errors" : {
"noNodesSelected" : "<strong> Subflow kann nicht erstellt werden </strong>: Es wurden keine Nodes ausgewählt.", "noNodesSelected" : "<strong> Subflow kann nicht erstellt werden </strong>: Es wurden keine Nodes ausgewählt.",
"multipleInputsToSelection" : "<strong> Subflow kann nicht erstellt werden </strong>: Mehrere Eingaben zur Auswahl" "multipleInputsToSelection" : "<strong> Subflow kann nicht erstellt werden </strong>: Mehrere Eingaben zur Auswahl"
@ -446,8 +444,8 @@
"none" : "keine", "none" : "keine",
"subflows" : "Subflows", "subflows" : "Subflows",
"flows" : "Flows", "flows" : "Flows",
"filterUnused" : "Nicht verwendet",
"filterAll" : "alle", "filterAll" : "alle",
"filterUnused" : "Nicht verwendet",
"filtered" : "__count__ verdeckt" "filtered" : "__count__ verdeckt"
}, },
"context" : { "context" : {

View File

@ -15,6 +15,17 @@
"next": "Next", "next": "Next",
"clone": "Clone project", "clone": "Clone project",
"cont": "Continue" "cont": "Continue"
},
"type": {
"string": "string",
"number": "number",
"boolean": "boolean",
"array": "array",
"buffer": "buffer",
"object": "object",
"jsonString": "JSON string",
"undefined": "undefined",
"null": "null"
} }
}, },
"workspace": { "workspace": {
@ -310,10 +321,12 @@
"addNewType": "Add new __type__...", "addNewType": "Add new __type__...",
"nodeProperties": "node properties", "nodeProperties": "node properties",
"label": "Label", "label": "Label",
"color": "Color",
"portLabels": "Port labels", "portLabels": "Port labels",
"labelInputs": "Inputs", "labelInputs": "Inputs",
"labelOutputs": "Outputs", "labelOutputs": "Outputs",
"settingIcon": "Icon", "settingIcon": "Icon",
"default": "default",
"noDefaultLabel": "none", "noDefaultLabel": "none",
"defaultLabel": "use default label", "defaultLabel": "use default label",
"searchIcons": "Search icons", "searchIcons": "Search icons",
@ -321,6 +334,40 @@
"description": "Description", "description": "Description",
"show": "Show", "show": "Show",
"hide": "Hide", "hide": "Hide",
"locale": "Select UI Language",
"icon": "Icon",
"inputType": "Input type",
"inputs" : {
"input": "input",
"select": "select",
"checkbox": "checkbox",
"spinner": "spinner",
"none": "none",
"hidden": "hide property"
},
"types": {
"str": "string",
"num": "number",
"bool": "bool",
"json": "JSON",
"bin": "buffer",
"env": "env variable"
},
"menu": {
"input": "input",
"select": "select",
"checkbox": "checkbox",
"spinner": "spinner",
"hidden": "label only"
},
"select": {
"label": "Label",
"value": "Value"
},
"spinner": {
"min": "Minimum",
"max": "Maximum"
},
"errors": { "errors": {
"scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it", "scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it",
"invalidProperties": "Invalid properties:" "invalidProperties": "Invalid properties:"
@ -379,9 +426,13 @@
"addCategory": "Add new...", "addCategory": "Add new...",
"label": { "label": {
"subflows": "subflows", "subflows": "subflows",
"network": "network",
"common": "common",
"input": "input", "input": "input",
"output": "output", "output": "output",
"function": "function", "function": "function",
"sequence": "sequence",
"parser": "parser",
"social": "social", "social": "social",
"storage": "storage", "storage": "storage",
"analysis": "analysis", "analysis": "analysis",
@ -518,8 +569,10 @@
"none": "none", "none": "none",
"subflows": "subflows", "subflows": "subflows",
"flows": "flows", "flows": "flows",
"filterUnused":"unused", "filterAll": "all",
"filterAll":"all", "showAllConfigNodes": "Show all config nodes",
"filterUnused": "unused",
"showAllUnusedConfigNodes": "Show all unused config nodes",
"filtered": "__count__ hidden" "filtered": "__count__ hidden"
}, },
"context": { "context": {
@ -532,7 +585,7 @@
"flow": "Flow", "flow": "Flow",
"global": "Global", "global": "Global",
"deleteConfirm": "Are you sure you want to delete this item?", "deleteConfirm": "Are you sure you want to delete this item?",
"autoRefresh": "Auto-refresh", "autoRefresh": "Refresh on selection change",
"refrsh": "Refresh", "refrsh": "Refresh",
"delete": "Delete" "delete": "Delete"
}, },
@ -549,6 +602,7 @@
"noSummaryAvailable": "No summary available", "noSummaryAvailable": "No summary available",
"editDescription": "Edit project description", "editDescription": "Edit project description",
"editDependencies": "Edit project dependencies", "editDependencies": "Edit project dependencies",
"noDescriptionAvailable": "No description available",
"editReadme": "Edit README.md", "editReadme": "Edit README.md",
"showProjectSettings": "Show project settings", "showProjectSettings": "Show project settings",
"projectSettings": { "projectSettings": {
@ -703,7 +757,8 @@
"bin": "buffer", "bin": "buffer",
"date": "timestamp", "date": "timestamp",
"jsonata": "expression", "jsonata": "expression",
"env": "env variable" "env": "env variable",
"cred": "credential"
} }
}, },
"editableList": { "editableList": {
@ -749,10 +804,14 @@
"copyPath": "Copy path to item", "copyPath": "Copy path to item",
"expandItems": "Expand items", "expandItems": "Expand items",
"collapseItems": "Collapse items", "collapseItems": "Collapse items",
"duplicate": "Duplicate" "duplicate": "Duplicate",
"error": {
"invalidJSON": "Invalid JSON: "
}
}, },
"markdownEditor": { "markdownEditor": {
"title": "Markdown editor", "title": "Markdown editor",
"expand": "Expand",
"format": "Formatted with markdown", "format": "Formatted with markdown",
"heading1": "Heading 1", "heading1": "Heading 1",
"heading2": "Heading 2", "heading2": "Heading 2",
@ -939,15 +998,18 @@
}, },
"editor-tab": { "editor-tab": {
"properties": "Properties", "properties": "Properties",
"envProperties": "Environment Variables",
"description": "Description", "description": "Description",
"appearance": "Appearance", "appearance": "Appearance",
"env": "Environment Variables" "preview": "UI Preview",
"defaultValue": "Default value"
}, },
"languages" : { "languages" : {
"de": "German", "de": "German",
"en-US": "English", "en-US": "English",
"ja": "Japanese", "ja": "Japanese",
"ko": "Korean", "ko": "Korean",
"zh-CN": "Chinese(Simplified)" "zh-CN": "Chinese(Simplified)",
"zh-TW": "Chinese(Traditional)"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"$string": { "$string": {
"args": "arg", "args": "arg[, prettify]",
"desc": "Casts the *arg* parameter to a string using the following casting rules:\n\n - Strings are unchanged\n - Functions are converted to an empty string\n - Numeric infinity and NaN throw an error because they cannot be represented as a JSON number\n - All other values are converted to a JSON string using the `JSON.stringify` function" "desc": "Casts the `arg` parameter to a string using the following casting rules:\n\n - Strings are unchanged\n - Functions are converted to an empty string\n - Numeric infinity and NaN throw an error because they cannot be represented as a JSON number\n - All other values are converted to a JSON string using the `JSON.stringify` function. If `prettify` is true, then \"prettified\" JSON is produced. i.e One line per field and lines will be indented based on the field depth."
}, },
"$length": { "$length": {
"args": "str", "args": "str",
@ -185,7 +185,7 @@
}, },
"$reduce": { "$reduce": {
"args":"array, function [, init]", "args":"array, function [, init]",
"desc":"Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`.\n\nThe optional `init` parameter is used as the initial value in the aggregation." "desc":"Returns an aggregated value derived from applying the `function` parameter successively to each value in `array` in combination with the result of the previous application of the function.\n\nThe function must accept two arguments, and behaves like an infix operator between each value within the `array`. The signature of `function` must be of the form: `myfunc($accumulator, $value[, $index[, $array]])`\n\nThe optional `init` parameter is used as the initial value in the aggregation."
}, },
"$flowContext": { "$flowContext": {
"args": "string[, string]", "args": "string[, string]",
@ -230,6 +230,41 @@
"$parseInteger": { "$parseInteger": {
"args": "string, picture", "args": "string, picture",
"desc": "Parses the contents of the `string` parameter to an integer (as a JSON number) using the format specified by the `picture` string. The `picture` string parameter has the same format as `$formatInteger`." "desc": "Parses the contents of the `string` parameter to an integer (as a JSON number) using the format specified by the `picture` string. The `picture` string parameter has the same format as `$formatInteger`."
},
"$error": {
"args": "[str]",
"desc": "Throws an error with a message. The optional `str` will replace the default message of `$error() function evaluated`"
},
"$assert": {
"args": "arg, str",
"desc": "If `arg` is true the function returns undefined. If `arg` is false an exception is thrown with `str` as the message of the exception."
},
"$single": {
"args": "array, function",
"desc": "Returns the one and only value in the `array` parameter that satisfies the `function` predicate (i.e. the `function` returns Boolean `true` when passed the value). Throws an exception if the number of matching values is not exactly one.\n\nThe function should be supplied in the following signature: `function(value [, index [, array]])` where value is each input of the array, index is the position of that value and the whole array is passed as the third argument"
},
"$encodeUrl": {
"args": "str",
"desc": "Encodes a Uniform Resource Locator (URL) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.\n\nExample: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "Encodes a Uniform Resource Locator (URL) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character. \n\nExample: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrl": {
"args": "str",
"desc": "Decodes a Uniform Resource Locator (URL) component previously created by encodeUrlComponent. \n\nExample: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrlComponent": {
"args": "str",
"desc": "Decodes a Uniform Resource Locator (URL) previously created by encodeUrl. \n\nExample: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
"$distinct": {
"args": "array",
"desc": "Returns an array with duplicate values removed from `array`"
},
"$type": {
"args": "value",
"desc": "Returns the type of `value` as a string. If `value` is undefined, this will return `undefined`"
} }
} }

View File

@ -15,6 +15,17 @@
"next": "進む", "next": "進む",
"clone": "プロジェクトをクローン", "clone": "プロジェクトをクローン",
"cont": "続ける" "cont": "続ける"
},
"type": {
"string": "文字列",
"number": "数値",
"boolean": "真偽値",
"array": "配列",
"buffer": "バッファ",
"object": "オブジェクト",
"jsonString": "JSON文字列",
"undefined": "undefined",
"null": "null"
} }
}, },
"workspace": { "workspace": {
@ -80,7 +91,7 @@
"projects-new": "新規", "projects-new": "新規",
"projects-open": "開く", "projects-open": "開く",
"projects-settings": "設定", "projects-settings": "設定",
"showNodeLabelDefault": "追加したノードのラベルを表示する" "showNodeLabelDefault": "追加したノードのラベルを表示"
} }
}, },
"actions": { "actions": {
@ -310,10 +321,12 @@
"addNewType": "新規に __type__ を追加...", "addNewType": "新規に __type__ を追加...",
"nodeProperties": "プロパティ", "nodeProperties": "プロパティ",
"label": "ラベル", "label": "ラベル",
"color": "色",
"portLabels": "ポートラベル", "portLabels": "ポートラベル",
"labelInputs": "入力", "labelInputs": "入力",
"labelOutputs": "出力", "labelOutputs": "出力",
"settingIcon": "アイコン", "settingIcon": "アイコン",
"default": "デフォルト",
"noDefaultLabel": "なし", "noDefaultLabel": "なし",
"defaultLabel": "既定のラベルを使用", "defaultLabel": "既定のラベルを使用",
"searchIcons": "アイコンを検索", "searchIcons": "アイコンを検索",
@ -321,6 +334,40 @@
"description": "詳細", "description": "詳細",
"show": "表示", "show": "表示",
"hide": "非表示", "hide": "非表示",
"locale": "UI言語の選択",
"icon": "記号",
"inputType": "入力形式",
"inputs": {
"input": "入力",
"select": "メニュー",
"checkbox": "チェックボックス",
"spinner": "スピナー",
"none": "無し",
"hidden": "非表示"
},
"types": {
"str": "文字列",
"num": "数値",
"bool": "真偽",
"json": "JSON",
"bin": "バッファ",
"env": "環境変数"
},
"menu": {
"input": "入力",
"select": "選択",
"checkbox": "チェックボックス",
"spinner": "数値",
"hidden": "ラベルのみ"
},
"select": {
"label": "ラベル",
"value": "値"
},
"spinner": {
"min": "最小値",
"max": "最大値"
},
"errors": { "errors": {
"scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします", "scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします",
"invalidProperties": "プロパティが不正です:" "invalidProperties": "プロパティが不正です:"
@ -351,7 +398,8 @@
"pasteNode": "ノードを貼り付け", "pasteNode": "ノードを貼り付け",
"undoChange": "変更操作を戻す", "undoChange": "変更操作を戻す",
"searchBox": "ノードを検索", "searchBox": "ノードを検索",
"managePalette": "パレットの管理" "managePalette": "パレットの管理",
"actionList": "動作一覧"
}, },
"library": { "library": {
"library": "ライブラリ", "library": "ライブラリ",
@ -378,9 +426,13 @@
"addCategory": "新規追加...", "addCategory": "新規追加...",
"label": { "label": {
"subflows": "サブフロー", "subflows": "サブフロー",
"network": "ネットワーク",
"common": "共通",
"input": "入力", "input": "入力",
"output": "出力", "output": "出力",
"function": "機能", "function": "機能",
"sequence": "シーケンス",
"parser": "パーサ",
"social": "ソーシャル", "social": "ソーシャル",
"storage": "ストレージ", "storage": "ストレージ",
"analysis": "分析", "analysis": "分析",
@ -517,8 +569,10 @@
"none": "なし", "none": "なし",
"subflows": "サブフロー", "subflows": "サブフロー",
"flows": "フロー", "flows": "フロー",
"filterUnused": "未使用",
"filterAll": "全て", "filterAll": "全て",
"showAllConfigNodes": "全設定ノードを表示",
"filterUnused": "未使用",
"showAllUnusedConfigNodes": "未使用の全設定ノードを表示",
"filtered": "__count__ 個が無効" "filtered": "__count__ 個が無効"
}, },
"context": { "context": {
@ -527,11 +581,13 @@
"none": "選択されていません", "none": "選択されていません",
"refresh": "読み込みのため更新してください", "refresh": "読み込みのため更新してください",
"empty": "データが存在しません", "empty": "データが存在しません",
"node": "Node", "node": "ノード",
"flow": "Flow", "flow": "フロー",
"global": "Global", "global": "グローバル",
"deleteConfirm": "データを削除しても良いですか?", "deleteConfirm": "データを削除しても良いですか?",
"autoRefresh": "自動更新" "autoRefresh": "選択対象が変化した場合更新",
"refrsh": "更新",
"delete": "削除"
}, },
"palette": { "palette": {
"name": "パレットの管理", "name": "パレットの管理",
@ -543,9 +599,10 @@
"description": "詳細", "description": "詳細",
"dependencies": "依存関係", "dependencies": "依存関係",
"settings": "設定", "settings": "設定",
"noSummaryAvailable": "サマリが存在しません", "noSummaryAvailable": "要約が存在しません",
"editDescription": "プロジェクトの詳細を編集", "editDescription": "プロジェクトの詳細を編集",
"editDependencies": "プロジェクトの依存関係を編集", "editDependencies": "プロジェクトの依存関係を編集",
"noDescriptionAvailable": "詳細が存在しません",
"editReadme": "README.mdを編集", "editReadme": "README.mdを編集",
"showProjectSettings": "プロジェクト設定を表示", "showProjectSettings": "プロジェクト設定を表示",
"projectSettings": { "projectSettings": {
@ -736,10 +793,23 @@
}, },
"jsonEditor": { "jsonEditor": {
"title": "JSONエディタ", "title": "JSONエディタ",
"format": "JSONフォーマット" "format": "JSONフォーマット",
"rawMode": "JSONを編集",
"uiMode": "ビジュアルエディタ",
"insertAbove": "上に挿入",
"insertBelow": "下に挿入",
"addItem": "要素を追加",
"copyPath": "要素のパスをコピー",
"expandItems": "要素を展開",
"collapseItems": "要素を折り畳む",
"duplicate": "複製",
"error": {
"invalidJSON": "不正なJSON: "
}
}, },
"markdownEditor": { "markdownEditor": {
"title": "マークダウンエディタ", "title": "マークダウンエディタ",
"expand": "拡大",
"format": "マークダウン形式で記述", "format": "マークダウン形式で記述",
"heading1": "見出しレベル1", "heading1": "見出しレベル1",
"heading2": "見出しレベル2", "heading2": "見出しレベル2",
@ -900,7 +970,7 @@
"confirm": "<p>デプロイされていない変更は失われます。</p><p>続けますか?</p>" "confirm": "<p>デプロイされていない変更は失われます。</p><p>続けますか?</p>"
}, },
"send-req": { "send-req": {
"auth-req": "リポジトリ対する認証が必要です", "auth-req": "リポジトリ対する認証が必要です",
"username": "ユーザ名", "username": "ユーザ名",
"password": "パスワード", "password": "パスワード",
"passphrase": "パスフレーズ", "passphrase": "パスフレーズ",
@ -926,15 +996,18 @@
}, },
"editor-tab": { "editor-tab": {
"properties": "プロパティ", "properties": "プロパティ",
"envProperties": "環境変数",
"description": "説明", "description": "説明",
"appearance": "外観", "appearance": "外観",
"env": "環境変数" "preview": "UIプレビュー",
"defaultValue": "デフォルト値"
}, },
"languages" : { "languages": {
"de": "ドイツ語", "de": "ドイツ語",
"en-US": "英語", "en-US": "英語",
"ja": "日本語", "ja": "日本語",
"ko": "韓国語", "ko": "韓国語",
"zh-CN": "中国語(簡体)" "zh-CN": "中国語(簡体)",
"zh-TW": "中国語(繁体)"
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"$string": { "$string": {
"args": "arg", "args": "arg[, prettify]",
"desc": "以下の型変換ルールを用いて、引数 *arg* を文字列へ型変換します。:\n\n - 文字列は変換しません。\n - 関数は空の文字列に変換します。\n - JSONの数値として表現できないため、無限大やNaNはエラーになります。\n - 他の値は `JSON.stringify` 関数を用いて、JSONの文字列へ変換します。" "desc": "以下の型変換ルールを用いて、引数 *arg* を文字列へ型変換します。:\n\n - 文字列は変換しません。\n - 関数は空の文字列に変換します。\n - JSONの数値として表現できないため、無限大やNaNはエラーになります。\n - 他の値は `JSON.stringify` 関数を用いて、JSONの文字列へ変換します。`prettify`が真の場合、JSONを整形出力します。フィールドを1行毎に出力。フィールドのネスト深さによってインデントを行います。"
}, },
"$length": { "$length": {
"args": "str", "args": "str",
@ -185,7 +185,7 @@
}, },
"$reduce": { "$reduce": {
"args": "array, function [, init]", "args": "array, function [, init]",
"desc": "配列の各要素値に関数 `function` を連続的に適用して得られる集約値を返します。 `function` の適用の際には、直前の `function` の適用結果と要素値が引数として与えられます。\n\n関数 `function` は引数を2つ取り、配列の各要素の間に配置する中置演算子のように作用しなくてはなりません。\n\n任意の引数 `init` には、集約時の初期値を設定します。" "desc": "配列の各要素値に関数 `function` を連続的に適用して得られる集約値を返します。 `function` の適用の際には、直前の `function` の適用結果と要素値が引数として与えられます。\n\n関数 `function` は引数を2つ取り、配列の各要素の間に配置する中置演算子のように作用しなくてはなりません。関数`function`のシグネチャは`myfunc($accumulator, $value[, $index[, $array]])`という形式でなければなりません。\n\n任意の引数 `init` には、集約時の初期値を設定します。"
}, },
"$flowContext": { "$flowContext": {
"args": "string", "args": "string",
@ -230,5 +230,41 @@
"$parseInteger": { "$parseInteger": {
"args": "string, picture", "args": "string, picture",
"desc": "`picture`文字列の指定に従って、`string`パラメータを整数(JSON数値)に変換します。`picture`文字列は`$formatInteger`と同じ形式です。" "desc": "`picture`文字列の指定に従って、`string`パラメータを整数(JSON数値)に変換します。`picture`文字列は`$formatInteger`と同じ形式です。"
},
"$error": {
"args": "[str]",
"desc": "メッセージを指定して例外を送出します。メッセージ`str`を省略した場合は`$error() function evaluated`をメッセージとします。"
},
"$assert": {
"args": "arg, str",
"desc": "`arg`が真の場合、undefinedを返します。偽の場合、`str`をメッセージとする例外を送出します。"
},
"$single": {
"args": "array, function",
"desc": "`array`の要素のうち、条件判定関数`function`を満たす(`function`に与えた場合に真偽値`true`を返す)要素が1つのみである場合、それを返します。マッチする要素が1つのみでない場合、例外を送出します。\n\n指定する関数は`function(value [, index [, array]])`というシグネチャでなければなりません。ここで、`value`は`array`の要素値、`index`は要素の添字、第三引数には配列全体を渡します。"
},
"$encodeUrl": {
"args": "str",
"desc": "Uniform Resource Locator (URL)を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "Uniform Resource Locator (URL)要素を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrl": {
"args": "str",
"desc": "encodeUrlComponentで置換したUniform Resource Locator (URL)をデコードします。\n\n例: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrlComponent": {
"args": "str",
"desc": "encodeUrlで置換したUniform Resource Locator (URL)要素をデコードします。 \n\n例: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
"$distinct": {
"args": "array",
"desc": "配列`array`から重複要素を削除した配列を返します。"
},
"$type": {
"args": "value",
"desc": "`value` の型を文字列として返します。もし `value` が未定義の場合、 `undefined` が返されます。"
} }
} }

View File

@ -273,7 +273,6 @@
"deleteSubflow": "서브 플로우 삭제", "deleteSubflow": "서브 플로우 삭제",
"info": "상세내역", "info": "상세내역",
"category": "카테고리", "category": "카테고리",
"format": "Markdown 형식",
"errors": { "errors": {
"noNodesSelected": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 노드가 선택되지 않았습니다", "noNodesSelected": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 노드가 선택되지 않았습니다",
"multipleInputsToSelection": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 복수의 입력이 선택되었습니다" "multipleInputsToSelection": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 복수의 입력이 선택되었습니다"
@ -495,8 +494,8 @@
"none": "없음", "none": "없음",
"subflows": "보조 플로우", "subflows": "보조 플로우",
"flows": "플로우", "flows": "플로우",
"filterUnused": "미사용",
"filterAll": "전체", "filterAll": "전체",
"filterUnused": "미사용",
"filtered": "__count__ 개 숨김" "filtered": "__count__ 개 숨김"
}, },
"context": { "context": {

View File

@ -10,7 +10,22 @@
"load": "读取", "load": "读取",
"save": "保存", "save": "保存",
"import": "导入", "import": "导入",
"export": "导出" "export": "导出",
"back": "后退",
"next": "下一个",
"clone": "克隆项目",
"cont": "继续"
},
"type": {
"string": "字符串",
"number": "数字",
"boolean": "布尔值",
"array": "数组",
"buffer": "buffer",
"object": "对象",
"jsonString": "JSON字符串",
"undefined": "为定义",
"null": "空"
} }
}, },
"workspace": { "workspace": {
@ -19,10 +34,13 @@
"confirmDelete": "确认删除", "confirmDelete": "确认删除",
"delete": "你确定想删除 '__label__'?", "delete": "你确定想删除 '__label__'?",
"dropFlowHere": "把流程放到这里", "dropFlowHere": "把流程放到这里",
"addFlow": "添加流程",
"listFlows": "流程一览",
"status": "状态", "status": "状态",
"enabled": "有效", "enabled": "有效",
"disabled": "无效", "disabled": "无效",
"info": "详细描述" "info": "详细描述",
"selectNodes": "点击节点来选择"
}, },
"menu": { "menu": {
"label": { "label": {
@ -36,11 +54,16 @@
"defaultDir": "默认方向", "defaultDir": "默认方向",
"ltr": "从左到右", "ltr": "从左到右",
"rtl": "从右到左", "rtl": "从右到左",
"auto": "上下文" "auto": "上下文",
"language": "语言",
"browserDefault": "浏览器默认"
}, },
"sidebar": { "sidebar": {
"show": "显示侧边栏" "show": "显示侧边栏"
}, },
"palette": {
"show": "显示控制板"
},
"settings": "设置", "settings": "设置",
"userSettings": "用户设置", "userSettings": "用户设置",
"nodes": "节点", "nodes": "节点",
@ -60,11 +83,23 @@
"keyboardShortcuts": "键盘快捷方式", "keyboardShortcuts": "键盘快捷方式",
"login": "登陆", "login": "登陆",
"logout": "退出", "logout": "退出",
"editPalette":"节点管理", "editPalette": "节点管理",
"other": "其他", "other": "其他",
"showTips": "显示小提示" "showTips": "显示小提示",
"help": "Node-RED网页",
"projects": "项目",
"projects-new": "新建",
"projects-open": "打开",
"projects-settings": "项目设定",
"showNodeLabelDefault": "显示新添加的节点的标签"
} }
}, },
"actions": {
"toggle-navigator": "切换导航器",
"zoom-out": "缩小",
"zoom-reset": "重设缩放",
"zoom-in": "放大"
},
"user": { "user": {
"loggedInAs": "作为__name__登陆", "loggedInAs": "作为__name__登陆",
"username": "账号", "username": "账号",
@ -82,29 +117,73 @@
"warning": "<strong>警告</strong>: __message__", "warning": "<strong>警告</strong>: __message__",
"warnings": { "warnings": {
"undeployedChanges": "节点中存在未部署的更改", "undeployedChanges": "节点中存在未部署的更改",
"nodeActionDisabled": "节点操作已禁用",
"nodeActionDisabledSubflow": "节点动作在子流程中被禁用", "nodeActionDisabledSubflow": "节点动作在子流程中被禁用",
"missing-types": "流程由于缺少节点类型而停止。请检查日志的详细信息", "missing-types": "流程由于缺少节点类型而停止。请检查日志的详细信息",
"restartRequired": "Node-RED必须重新启动以启用升级的模块" "safe-mode": "<p>流程以安全模式停止。</p><p>您可以修改流程并部署更改以重新启动。</p>",
"restartRequired": "Node-RED必须重新启动以启用升级的模块",
"credentials_load_failed": "<p>由于无法解密凭据,因此流程停止。</p><p>流程凭据文件已加密,但是项目的加密密钥丢失或无效。</p>",
"credentials_load_failed_reset": "<p>凭据无法解密</p><p>流凭据文件已加密,但是项目的加密密钥丢失或无效。</p><p>流凭据文件将在下一次部署时重置。任何现有的流凭证将被清除。</p>",
"missing_flow_file": "<p>找不到项目流程文件。</p><p>该项目未配置流程文件。</p>",
"missing_package_file": "<p>找不到项目包文件。</p><p>项目缺少package.json文件。</p>",
"project_empty": "<p>该项目为空。</p><p>是否要创建一组默认的项目文件?<br/>否则,您将必须在编辑器外部手动将文件添加到项目中。</p>",
"project_not_found": "<p>未找到项目'__project__'。</p>",
"git_merge_conflict": "<p>自动合并更改失败。</p><p>修复未合并的冲突,然后提交结果。</p>"
}, },
"error": "<strong>Error</strong>: __message__", "error": "<strong>错误</strong>: __message__",
"errors": { "errors": {
"lostConnection": "丢失与服务器的连接,重新连接...", "lostConnection": "丢失与服务器的连接,重新连接...",
"lostConnectionReconnect": "丢失与服务器的连接__time__秒后重新连接", "lostConnectionReconnect": "丢失与服务器的连接__time__秒后重新连接",
"lostConnectionTry": "现在尝试", "lostConnectionTry": "现在尝试",
"cannotAddSubflowToItself": "无法向其自身添加子流程", "cannotAddSubflowToItself": "无法向其自身添加子流程",
"cannotAddCircularReference": "无法添加子流程 - 循环引用", "cannotAddCircularReference": "无法添加子流程 - 循环引用",
"unsupportedVersion": "您正在使用不受支持的Node.js版本<br/>请升级到最新版本的Node.js LTS" "unsupportedVersion": "您正在使用不受支持的Node.js版本<br/>请升级到最新版本的Node.js LTS",
"failedToAppendNode": "<p>'__module__'加载失败</p><p>__error__</p>"
},
"project": {
"change-branch": "转到本地分支'__project__'",
"merge-abort": "Git合并中止",
"loaded": "项目'__project__'已加载",
"updated": "项目'__project__'已更新",
"pull": "项目'__project__'已重新加载",
"revert": "项目 '__project__'已还原",
"merge-complete": "Git合并完成",
"setupCredentials": "设定证书",
"setupProjectFiles": "设置项目文件",
"no": "不了,谢谢",
"createDefault": "创建默认项目文件",
"mergeConflict": "显示合并冲突"
},
"label": {
"manage-project-dep": "管理项目依赖性",
"setup-cred": "设定证书",
"setup-project": "设置项目文件",
"create-default-package": "创建默认的包文件",
"no-thanks": "不了,谢谢",
"create-default-project": "创建默认项目文件",
"show-merge-conflicts": "显示合并冲突"
} }
}, },
"clipboard": { "clipboard": {
"clipboard": "剪贴板", "clipboard": "剪贴板",
"nodes": "节点", "nodes": "节点",
"node": "__count__节点",
"node_plural": "__count__节点",
"configNode": "__count__配置节点",
"configNode_plural": "__count__配置节点",
"flow": "__count__流程",
"flow_plural": "__count__流程",
"subflow": "__count__子流程",
"subflow_plural": "__count__子流程",
"pasteNodes": "在这里粘贴节点", "pasteNodes": "在这里粘贴节点",
"selectFile": "选择要导入的文件",
"importNodes": "导入节点", "importNodes": "导入节点",
"exportNodes": "导出节点至剪贴板", "exportNodes": "导出节点至剪贴板",
"download": "下载",
"importUnrecognised": "导入了无法识别的类型:", "importUnrecognised": "导入了无法识别的类型:",
"importUnrecognised_plural": "导入了无法识别的类型:", "importUnrecognised_plural": "导入了无法识别的类型:",
"nodesExported": "节点导出到了剪贴板", "nodesExported": "节点导出到了剪贴板",
"nodesImported": "导入:",
"nodeCopied": "已复制__count__个节点", "nodeCopied": "已复制__count__个节点",
"nodeCopied_plural": "已复制__count__个节点", "nodeCopied_plural": "已复制__count__个节点",
"invalidFlow": "无效的流程: __message__", "invalidFlow": "无效的流程: __message__",
@ -114,11 +193,21 @@
"all": "所有流程", "all": "所有流程",
"compact": "紧凑", "compact": "紧凑",
"formatted": "已格式化", "formatted": "已格式化",
"copy": "导出到剪贴板" "copy": "导出到剪贴板",
"export": "到处到库",
"exportAs": "导出为",
"overwrite": "替换",
"exists": "<p><b>\"__file__\"</b>已存在</p><p>是否要替换它?</p>"
}, },
"import": { "import": {
"import": "导入到", "import": "导入到",
"newFlow": "新流程" "newFlow": "新流程",
"errors": {
"notArray": "输入的不是JSON数组",
"itemNotObject": "输入的流无效 - 项目__index__不是节点对象",
"missingId": "输入的流无效-项 __index__ 缺少'id'属性",
"missingType": "输入的流程无效-项__index__缺少'类型'属性"
}
}, },
"copyMessagePath": "已复制路径", "copyMessagePath": "已复制路径",
"copyMessageValue": "已复制数值", "copyMessageValue": "已复制数值",
@ -132,7 +221,10 @@
"modifiedFlowsDesc": "只部署包含已更改节点的流", "modifiedFlowsDesc": "只部署包含已更改节点的流",
"modifiedNodes": "已更改的节点", "modifiedNodes": "已更改的节点",
"modifiedNodesDesc": "只部署已经更改的节点", "modifiedNodesDesc": "只部署已经更改的节点",
"restartFlows": "重启流程",
"restartFlowsDesc": "重新启动当前部署的流程",
"successfulDeploy": "部署成功", "successfulDeploy": "部署成功",
"successfulRestart": "成功重启流程",
"deployFailed": "部署失败: __message__", "deployFailed": "部署失败: __message__",
"unusedConfigNodes": "您有一些未使用的配置节点", "unusedConfigNodes": "您有一些未使用的配置节点",
"unusedConfigNodesLink": "点击此处查看它们", "unusedConfigNodesLink": "点击此处查看它们",
@ -152,16 +244,24 @@
"improperlyConfigured": "工作区包含一些未正确配置的节点:", "improperlyConfigured": "工作区包含一些未正确配置的节点:",
"unknown": "工作区包含一些未知的节点类型:", "unknown": "工作区包含一些未知的节点类型:",
"confirm": "你确定要部署吗?", "confirm": "你确定要部署吗?",
"doNotWarn": "不要再对此发出警告",
"conflict": "服务器正在运行较新的一组流程。", "conflict": "服务器正在运行较新的一组流程。",
"backgroundUpdate": "服务器上的流程已更新。", "backgroundUpdate": "服务器上的流程已更新。",
"conflictChecking": "检查是否可以自动合并更改", "conflictChecking": "检查是否可以自动合并更改",
"conflictAutoMerge": "此更改不包括冲突,可以自动合并", "conflictAutoMerge": "此更改不包括冲突,可以自动合并",
"conflictManualMerge": "这些更改包括了在部署之前必须解决的冲突。" "conflictManualMerge": "这些更改包括了在部署之前必须解决的冲突。",
"plusNMore": "+ __count__更多"
} }
}, },
"eventLog": {
"title": "事件记录日志",
"view": "查看日志"
},
"diff": { "diff": {
"unresolvedCount": "__count__个未解决的冲突", "unresolvedCount": "__count__个未解决的冲突",
"unresolvedCount_plural": "__count__个未解决的冲突", "unresolvedCount_plural": "__count__个未解决的冲突",
"globalNodes": "全局节点",
"flowProperties": "流程属性",
"type": { "type": {
"added": "已添加", "added": "已添加",
"changed": "已更改", "changed": "已更改",
@ -175,9 +275,19 @@
"nodeCount": "__count__个节点", "nodeCount": "__count__个节点",
"nodeCount_plural": "__count__个节点", "nodeCount_plural": "__count__个节点",
"local": "本地", "local": "本地",
"remote": "远程" "remote": "远程",
"reviewChanges": "查看变更",
"noBinaryFileShowed": "无法显示二进制文件内容",
"viewCommitDiff": "查看提交更改",
"compareChanges": "比较变更",
"saveConflict": "保存冲突解决",
"conflictHeader": "已解决<span>__unresolved__</span>中的<span>__resolved__</span>个冲突",
"commonVersionError": "通用版本不包含有效的JSON",
"oldVersionError": "旧版本不包含有效的JSON",
"newVersionError": "新版本不包含有效的JSON"
}, },
"subflow": { "subflow": {
"editSubflowInstance": "编辑子流实例__name__",
"editSubflow": "编辑流程模板: __name__", "editSubflow": "编辑流程模板: __name__",
"edit": "编辑流程模板", "edit": "编辑流程模板",
"subflowInstances": "这个子流程模板有__count__个实例", "subflowInstances": "这个子流程模板有__count__个实例",
@ -185,8 +295,14 @@
"editSubflowProperties": "编辑属性", "editSubflowProperties": "编辑属性",
"input": "输入:", "input": "输入:",
"output": "输出:", "output": "输出:",
"status": "状态节点",
"deleteSubflow": "删除子流程", "deleteSubflow": "删除子流程",
"info": "详细描述", "info": "详细描述",
"category": "类别",
"env": {
"restore": "恢复为默认子流",
"remove": "删除环境变量"
},
"errors": { "errors": {
"noNodesSelected": "<strong>无法创建子流程</strong>: 未选择节点", "noNodesSelected": "<strong>无法创建子流程</strong>: 未选择节点",
"multipleInputsToSelection": "<strong>无法创建子流程</strong>: 多个输入到了选择" "multipleInputsToSelection": "<strong>无法创建子流程</strong>: 多个输入到了选择"
@ -204,18 +320,68 @@
"editConfig": "编辑__type__配置", "editConfig": "编辑__type__配置",
"addNewType": "添加新的__type__节点", "addNewType": "添加新的__type__节点",
"nodeProperties": "节点属性", "nodeProperties": "节点属性",
"label": "标签",
"color": "颜色",
"portLabels": "端口标签", "portLabels": "端口标签",
"labelInputs": "输入", "labelInputs": "输入",
"labelOutputs": "输出", "labelOutputs": "输出",
"settingIcon": "图标",
"default": "默认",
"noDefaultLabel": "无", "noDefaultLabel": "无",
"defaultLabel": "使用默认标签", "defaultLabel": "使用默认标签",
"searchIcons": "搜索图标",
"useDefault": "使用默认",
"description": "描述",
"show": "显示",
"hide": "隐藏",
"locale": "选择界面语言",
"icon": "图标",
"inputType": "输入类型",
"inputs": {
"input": "输入",
"select": "选择",
"checkbox": "复选框",
"spinner": "微调器",
"none": "空",
"hidden": "隐藏属性"
},
"types": {
"str": "字符串",
"num": "数字",
"bool": "布尔",
"json": "JSON",
"bin": "buffer",
"env": "环境变量"
},
"menu": {
"input": "输入",
"select": "选择",
"checkbox": "复选框",
"spinner": "微调器",
"hidden": "仅标签"
},
"select": {
"label": "标签",
"value": "值"
},
"spinner": {
"min": "最小值",
"max": "最大值"
},
"errors": { "errors": {
"scopeChange": "更改范围将使其他流中的节点无法使用" "scopeChange": "更改范围将使其他流中的节点无法使用",
"invalidProperties": "无效的属性:"
} }
}, },
"keyboard": { "keyboard": {
"title": "键盘快捷键", "title": "键盘快捷键",
"keyboard": "键盘",
"filterActions": "筛选动作",
"shortcut": "快捷键",
"scope": "范围",
"unassigned": "未分配", "unassigned": "未分配",
"global": "全局",
"workspace": "工作组",
"selectAll": "选择所有节点", "selectAll": "选择所有节点",
"selectAllConnected": "选择所有连接的节点", "selectAllConnected": "选择所有连接的节点",
"addRemoveNode": "从选择中添加/删除节点", "addRemoveNode": "从选择中添加/删除节点",
@ -226,12 +392,14 @@
"nudgeNode": "移动所选节点(1px)", "nudgeNode": "移动所选节点(1px)",
"moveNode": "移动所选节点(20px)", "moveNode": "移动所选节点(20px)",
"toggleSidebar": "切换侧边栏", "toggleSidebar": "切换侧边栏",
"togglePalette": "切换控制板",
"copyNode": "复制所选节点", "copyNode": "复制所选节点",
"cutNode": "剪切所选节点", "cutNode": "剪切所选节点",
"pasteNode": "粘贴节点", "pasteNode": "粘贴节点",
"undoChange": "撤消上次执行的更改", "undoChange": "撤消上次执行的更改",
"searchBox": "打开搜索框", "searchBox": "打开搜索框",
"managePalette": "管理面板" "managePalette": "管理面板",
"actionList": "动作列表"
}, },
"library": { "library": {
"library": "库", "library": "库",
@ -239,30 +407,42 @@
"saveToLibrary": "保存到库...", "saveToLibrary": "保存到库...",
"typeLibrary": "__type__类型库", "typeLibrary": "__type__类型库",
"unnamedType": "无名__type__", "unnamedType": "无名__type__",
"exportToLibrary": "节点导出到库", "exportedToLibrary": "节点导出到库",
"dialogSaveOverwrite": "一个叫做__libraryName__的__libraryType__已经存在您需要覆盖么", "dialogSaveOverwrite": "一个叫做__libraryName__的__libraryType__已经存在您需要覆盖么",
"invalidFilename": "无效的文件名", "invalidFilename": "无效的文件名",
"savedNodes": "保存的节点", "savedNodes": "保存的节点",
"savedType": "已保存__type__", "savedType": "已保存__type__",
"saveFailed": "保存失败: __message__", "saveFailed": "保存失败: __message__",
"newFolder": "新文件夹",
"types": { "types": {
"local": "本地的",
"examples": "例子" "examples": "例子"
} },
"exportToLibrary": "将节点导出到库"
}, },
"palette": { "palette": {
"noInfo": "无可用信息", "noInfo": "无可用信息",
"filter": "过滤节点", "filter": "过滤节点",
"search": "搜索模块", "search": "搜索模块",
"addCategory": "添加新的...",
"label": { "label": {
"subflows": "子流程", "subflows": "子流程",
"network": "网络",
"common": "共通",
"input": "输入", "input": "输入",
"output": "输出", "output": "输出",
"function": "功能", "function": "功能",
"sequence": "序列",
"parser": "解析",
"social": "社交", "social": "社交",
"storage": "存储", "storage": "存储",
"analysis": "分析", "analysis": "分析",
"advanced": "高级" "advanced": "高级"
}, },
"actions": {
"collapse-all": "收起所有类别",
"expand-all": "展开所有类别"
},
"event": { "event": {
"nodeAdded": "添加到面板中的节点:", "nodeAdded": "添加到面板中的节点:",
"nodeAdded_plural": "添加到面板中的多个节点", "nodeAdded_plural": "添加到面板中的多个节点",
@ -276,6 +456,7 @@
}, },
"editor": { "editor": {
"title": "面板管理", "title": "面板管理",
"palette": "控制板",
"times": { "times": {
"seconds": "秒前", "seconds": "秒前",
"minutes": "分前", "minutes": "分前",
@ -309,6 +490,8 @@
"updated": "已更新", "updated": "已更新",
"install": "安装", "install": "安装",
"installed": "已安装", "installed": "已安装",
"conflict": "冲突",
"conflictTip": "<p>无法安装此模块,因为它包含已安装的<br/>节点类型</p><p>与<code>__module__</code>冲突</p>",
"loading": "加载目录...", "loading": "加载目录...",
"tab-nodes": "节点", "tab-nodes": "节点",
"tab-install": "安装", "tab-install": "安装",
@ -356,6 +539,7 @@
"label": "信息", "label": "信息",
"node": "节点", "node": "节点",
"type": "类型", "type": "类型",
"module": "模组",
"id": "ID", "id": "ID",
"status": "状态", "status": "状态",
"enabled": "启用", "enabled": "启用",
@ -364,17 +548,18 @@
"instances": "实例", "instances": "实例",
"properties": "属性", "properties": "属性",
"info": "信息", "info": "信息",
"desc": "描述",
"blank": "空白", "blank": "空白",
"null": "空", "null": "空",
"showMore": "展开", "showMore": "展开",
"showLess": "收起", "showLess": "收起",
"flow": "流程", "flow": "流程",
"selection":"选择", "selection": "选择",
"nodes":"__count__ 个节点", "nodes": "__count__ 个节点",
"flowDesc": "流程描述", "flowDesc": "流程描述",
"subflowDesc": "子流程描述", "subflowDesc": "子流程描述",
"nodeHelp": "节点帮助", "nodeHelp": "节点帮助",
"none":"无", "none": "无",
"arrayItems": "__count__个项目", "arrayItems": "__count__个项目",
"showTips": "您可以从设置面板启用提示信息" "showTips": "您可以从设置面板启用提示信息"
}, },
@ -385,10 +570,26 @@
"none": "无", "none": "无",
"subflows": "子流程", "subflows": "子流程",
"flows": "流程", "flows": "流程",
"filterUnused": "未使用",
"filterAll": "所有", "filterAll": "所有",
"showAllConfigNodes": "显示所有配置节点",
"filterUnused": "未使用",
"showAllUnusedConfigNodes": "显示所有未使用的配置节点",
"filtered": "__count__ 个隐藏" "filtered": "__count__ 个隐藏"
}, },
"context": {
"name": "上下文数据",
"label": "上下午",
"none": "未选择",
"refresh": "刷新以加载",
"empty": "空",
"node": "节点",
"flow": "流程",
"global": "全局",
"deleteConfirm": "你确定要删除这个项目吗?",
"autoRefresh": "刷新选择更改",
"refrsh": "刷新",
"delete": "删除"
},
"palette": { "palette": {
"name": "节点管理", "name": "节点管理",
"label": "节点" "label": "节点"
@ -399,8 +600,151 @@
"description": "描述", "description": "描述",
"dependencies": "依赖", "dependencies": "依赖",
"settings": "设置", "settings": "设置",
"noSummaryAvailable": "无可用摘要",
"editDescription": "编辑项目描述", "editDescription": "编辑项目描述",
"editDependencies": "编辑项目依赖" "editDependencies": "编辑项目依赖",
"noDescriptionAvailable": "没有可用的描述",
"editReadme": "编辑README.md",
"showProjectSettings": "显示项目设置",
"projectSettings": {
"title": "项目设置",
"edit": "编辑",
"none": "空",
"install": "安装",
"removeFromProject": "从项目中删除",
"addToProject": "添加到项目",
"files": "文件",
"package": "包",
"flow": "流程",
"credentials": "证书",
"packageCreate": "保存更改后将创建文件",
"fileNotExist": "文件不存在",
"selectFile": "选择文件",
"invalidEncryptionKey": "无效的加密密钥",
"encryptionEnabled": "启用加密",
"encryptionDisabled": "加密已禁用",
"setTheEncryptionKey": "设置加密密钥",
"resetTheEncryptionKey": "重置加密密钥",
"changeTheEncryptionKey": "更改加密密钥",
"currentKey": "当前密钥",
"newKey": "新密钥",
"credentialsAlert": "这将删除所有现有凭证",
"versionControl": "版本控制",
"branches": "分支",
"noBranches": "没有分支",
"deleteConfirm": "您确定要删除本地分支'__name__'吗? 这不能被撤消。",
"unmergedConfirm": "本地分支'__name__'具有未合并的更改,这些更改将丢失。你确定要删除吗?",
"deleteUnmergedBranch": "删除未合并的分支",
"gitRemotes": "Git远程仓库",
"addRemote": "添加远程仓库",
"addRemote2": "添加远程仓库",
"remoteName": "远程仓库名",
"nameRule": "只能包含A-Z 0-9 _ -",
"url": "URL",
"urlRule": "https://, ssh:// or file://",
"urlRule2": "网址中不能包含用户名/密码",
"noRemotes": "没有远程仓库",
"deleteRemoteConfrim": "您确定要删除远程仓库'__name__'吗?",
"deleteRemote": "删除远程仓库"
},
"userSettings": {
"committerDetail": "提交者详细信息",
"committerTip": "保留空白以使用系统默认值",
"userName": "用户名",
"email": "电子邮件",
"sshKeys": "SSH密钥",
"sshKeysTip": "允许您创建到远程git存储库的安全连接。",
"add": "添加密钥",
"addSshKey": "添加SSH密钥",
"addSshKeyTip": "生成新的公钥/私钥对",
"name": "名字",
"nameRule": "只能包含A-Z 0-9 _ -",
"passphrase": "密码短语",
"passphraseShort": "密码短语过短",
"optional": "可选的",
"cancel": "取消",
"generate": "生成密钥",
"noSshKeys": "没有SSH密钥",
"copyPublicKey": "将公钥复制到剪贴板",
"delete": "删除密钥",
"gitConfig": "Git配置",
"deleteConfirm": "您确定要删除SSH密钥__name__吗这不能被撤消。"
},
"versionControl": {
"unstagedChanges": "未暂存的变更",
"stagedChanges": "暂存的变更",
"unstageChange": "取消变更的暂存",
"stageChange": "暂存变更",
"unstageAllChange": "取消所有变更的暂存",
"stageAllChange": "暂存所有变更",
"commitChanges": "提交变更",
"resolveConflicts": "解决冲突",
"head": "HEAD",
"staged": "暂存的",
"unstaged": "未暂存的",
"local": "本地的",
"remote": "远程的",
"revert": "您确定要将更改恢复为'__file__'吗?这不能被撤消。",
"revertChanges": "还原变更",
"localChanges": "本地变更",
"none": "None",
"conflictResolve": "解决所有冲突。提交更改以完成合并。",
"localFiles": "本地文件",
"all": "所有的",
"unmergedChanges": "未合并的更改",
"abortMerge": "中止合并",
"commit": "提交",
"changeToCommit": "提交变更",
"commitPlaceholder": "输入您的提交信息",
"cancelCapital": "取消",
"commitCapital": "提交",
"commitHistory": "提交历史",
"branch": "分支:",
"moreCommits": "更多提交",
"changeLocalBranch": "变更本地分支",
"createBranchPlaceholder": "查找或创建分支",
"upstream": "上游",
"localOverwrite": "切换分支会覆盖您现有的本地更改。您必须先提交或撤消那些更改。",
"manageRemoteBranch": "管理远程分支",
"unableToAccess": "无法访问远程存储库",
"retry": "重试",
"setUpstreamBranch": "设置为上游分支",
"createRemoteBranchPlaceholder": "查找或创建远程分支",
"trackedUpstreamBranch": "创建的分支将被设置为跟踪的上游分支。",
"selectUpstreamBranch": "分支将被创建。 在下面选择以将其设置为被跟踪的上游分支。",
"pushFailed": "推送失败,因为远程具有更多的最新提交。请先拉取并合并,然后再尝试推送。",
"push": "推送",
"pull": "拉取",
"unablePull": "<p>无法提取远程更改;您未暂存的本地更改将被覆盖。</p><p>请先提交更改,然后重试。</p>",
"showUnstagedChanges": "显示未暂存的更改",
"connectionFailed": "无法连接到远程存储库:",
"pullUnrelatedHistory": "<p>远程有无关的提交历史</p><p>您确定要将这些更改拉入本地仓库吗?</p>",
"pullChanges": "拉取更改",
"history": "历史",
"projectHistory": "项目历史",
"daysAgo": "__count__天前",
"daysAgo_plural": "__count__天前",
"hoursAgo": "__count__小时前",
"hoursAgo_plural": "__count__小时前",
"minsAgo": "__count__分钟前",
"minsAgo_plural": "__count__分钟前",
"secondsAgo": "秒前",
"notTracking": "您的本地分支当前未跟踪一个远程分支。",
"statusUnmergedChanged": "您的仓库中有未合并的更改。您需要解决冲突并提交结果。",
"repositoryUpToDate": "您的仓库是最新的。",
"commitsAhead": "您的存储库领先远程仓库__count__次提交。您现在可以推送这些提交。",
"commitsAhead_plural": "您的存储库领先远程仓库__count__次提交。您现在可以推送这些提交。",
"commitsBehind": "您的存储库落后远程仓库__count__次提交。您现在可以拉取这些提交。",
"commitsBehind_plural": "您的存储库落后远程仓库__count__次提交。您现在可以拉取这些提交。",
"commitsAheadAndBehind1": "您的存储库落后远程仓库__count__次提交",
"commitsAheadAndBehind1_plural": "您的存储库落后远程仓库__count__次提交",
"commitsAheadAndBehind2": "领先远程仓库__count__次提交。",
"commitsAheadAndBehind2_plural": "领先远程仓库__count__次提交。",
"commitsAheadAndBehind3": "您必须先拉取远程提交,然后才能进行推送。",
"commitsAheadAndBehind3_plural": "您必须先拉取远程提交,然后才能进行推送。",
"refreshCommitHistory": "刷新提交历史",
"refreshChanges": "刷新更改"
}
} }
}, },
"typedInput": { "typedInput": {
@ -408,10 +752,12 @@
"str": "文字列", "str": "文字列",
"num": "数字", "num": "数字",
"re": "正则表达式", "re": "正则表达式",
"bool": "布尔", "bool": "布尔",
"json": "JSON", "json": "JSON",
"bin": "二进制流", "bin": "二进制流",
"date": "时间戳" "date": "时间戳",
"jsonata": "表达式",
"env": "环境变量"
} }
}, },
"editableList": { "editableList": {
@ -423,8 +769,10 @@
}, },
"expressionEditor": { "expressionEditor": {
"functions": "功能", "functions": "功能",
"functionReference": "功能reference",
"insert": "插入", "insert": "插入",
"title": "JSONata表达式编辑器", "title": "JSONata表达式编辑器",
"test": "测试",
"data": "示例消息", "data": "示例消息",
"result": "结果", "result": "结果",
"format": "格式表达方法", "format": "格式表达方法",
@ -438,14 +786,228 @@
"eval": "评估表达式错误:\n __message__" "eval": "评估表达式错误:\n __message__"
} }
}, },
"jsEditor": {
"title": "JavaScript编辑器"
},
"textEditor": {
"title": "文本编辑器"
},
"jsonEditor": { "jsonEditor": {
"title": "JSON编辑器", "title": "JSON编辑器",
"format": "格式化JSON" "format": "格式化JSON",
"rawMode": "编辑 JSON",
"uiMode": "Visual编辑器",
"insertAbove": "在上方插入",
"insertBelow": "在下方插入",
"addItem": "添加项目",
"copyPath": "复制路径到项目",
"expandItems": "展开项目",
"collapseItems": "收合项目",
"duplicate": "重复",
"error": {
"invalidJSON": "无效的JSON: "
}
},
"markdownEditor": {
"title": "Markdown编辑器",
"expand": "展开",
"format": "格式化为markdown",
"heading1": "标题 1",
"heading2": "标题 2",
"heading3": "标题 3",
"bold": "粗体",
"italic": "斜体",
"code": "代码",
"ordered-list": "排序的列表",
"unordered-list": "非排序的列表",
"quote": "引用",
"link": "链接",
"horizontal-rule": "水平线",
"toggle-preview": "切换预览"
}, },
"bufferEditor": { "bufferEditor": {
"title": "缓冲区编辑器", "title": "缓冲区编辑器",
"modeString": "作为UTF-8字符串处理", "modeString": "作为UTF-8字符串处理",
"modeArray": "作为JSON数组处理", "modeArray": "作为JSON数组处理",
"modeDesc": "<h3>缓冲区编辑器</h3><p>缓冲区类型被存储为字节值的JSON数组。编辑器将尝试将输入的数值解析为JSON数组。如果它不是有效的JSON它将被视为UTF-8字符串并被转换为单个字符代码点的数组。</p><p>例如,<code>Hello World</code>的值会被转换为JSON数组<pre>[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]</pre></p>" "modeDesc": "<h3>缓冲区编辑器</h3><p>缓冲区类型被存储为字节值的JSON数组。编辑器将尝试将输入的数值解析为JSON数组。如果它不是有效的JSON它将被视为UTF-8字符串并被转换为单个字符代码点的数组。</p><p>例如,<code>Hello World</code>的值会被转换为JSON数组<pre>[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]</pre></p>"
},
"projects": {
"config-git": "配置Git客户端",
"welcome": {
"hello": "你好! 我们已经将“项目”引入了Node-RED。",
"desc0": "这是一种用于管理流程文件的新方法,并且包括对流程的版本控制。",
"desc1": "首先您可以创建您的第一个项目或从git存储库克隆现有项目。",
"desc2": "如果不确定,可以暂时跳过此步骤。您仍然可以随时通过“项目”菜单创建第一个项目。",
"create": "建立专案",
"clone": "克隆仓库",
"openExistingProject": "打开现有项目",
"not-right-now": "不是现在"
},
"git-config": {
"setup": "设置您的版本控制客户端",
"desc0": "Node-RED使用开源工具Git进行版本控制。它跟踪对项目文件的更改并允许您将其推送到远程存储库。",
"desc1": "提交一组更改时Git会使用用户名和电子邮件地址记录谁进行了更改。用户名可以是您想要的任何名称-不必是您的真实姓名。",
"desc2": "您的Git客户端已经配置了以下详细信息。",
"desc3": "您可以稍后在设置对话框的'Git config'标签下更改这些设置。",
"username": "用户名",
"email": "电子邮件"
},
"project-details": {
"create": "创建你的项目",
"desc0": "项目被维护为Git仓库。与他人一起共享您的流程",
"desc1": "您可以创建多个项目,并通过编辑器在它们之间快速切换。",
"desc2": "首先,您的项目需要一个名称和一个可选的描述。",
"already-exists": "项目已存在",
"must-contain": "只能包含A-Z 0-9 _ -",
"project-name": "项目名",
"desc": "描述",
"opt": "可选的"
},
"clone-project": {
"clone": "克隆一个项目",
"desc0": "如果您已经有一个包含项目的git仓库则可以对其进行克隆以开始使用。",
"already-exists": "项目已存在",
"must-contain": "只能包含A-Z 0-9 _ -",
"project-name": "项目名",
"no-info-in-url": "网址中不要包含用户名/密码",
"git-url": "Git仓库的url",
"protocols": "https://, ssh:// or file://",
"auth-failed": "认证失败",
"username": "用户名",
"passwd": "秘密啊",
"ssh-key": "SSH密钥",
"passphrase": "密码短语",
"ssh-key-desc": "在通过ssh克隆仓库之前必须添加SSH密钥才能访问它。",
"ssh-key-add": "添加一个ssh密钥",
"credential-key": "证书加密密钥",
"cant-get-ssh-key": "错误! 无法获取所选的SSH密钥路径。",
"already-exists2": "已存在",
"git-error": "git错误",
"connection-failed": "连接失败",
"not-git-repo": "不是一个git仓库",
"repo-not-found": "未发现仓库"
},
"default-files": {
"create": "创建您的项目文件",
"desc0": "一个包含您的流程文件Readme文件和package.json文件的项目。",
"desc1": "它可以包含您要在Git仓库中维护的任何其他文件。",
"desc2": "您现有的流程和凭证文件将被复制到项目中。",
"flow-file": "流程文件",
"credentials-file": "证书文件"
},
"encryption-config": {
"setup": "设置证书文件的加密",
"desc0": "您的流程证书文件可以被加密以确保其内容安全。",
"desc1": "如果要将这些证书存储在公共Git存储库中则必须通过提供密钥短语来对它们进行加密。",
"desc2": "您的流程证书文件当前未加密。",
"desc3": "这意味着任何有权访问该文件的人都可以读取其内容,例如密码和访问令牌。",
"desc4": "如果要将这些证书存储在公共Git仓库中则必须通过提供密钥短语来对它们进行加密。",
"desc5": "当前使用设置文件中的credentialSecret属性作为密钥来加密流程证书文件。",
"desc6": "您的流程证书文件当前使用系统生成的密钥加密。您应该为此项目提供一个新的密钥。",
"desc7": "密钥将与项目文件分开存储。您将需要提供在另一个Node-RED实例中使用该项目的密钥。",
"credentials": "证书",
"enable": "启用加密",
"disable": "禁用加密",
"disabled": "禁用的",
"copy": "复制现有密钥",
"use-custom": "使用自定义密钥",
"desc8": "证书文件不会被加密,其内容很容易阅读",
"create-project-files": "创建项目文件",
"create-project": "创建项目",
"already-exists": "已存在",
"git-error": "git错误",
"git-auth-error": "git认证错误"
},
"create-success": {
"success": "您已经成功创建了第一个项目!",
"desc0": "现在您可以像往常一样继续使用Node-RED。",
"desc1": "侧栏中的“信息”标签显示了您当前的活动项目。名称旁边的按钮可用于访问项目设置视图。",
"desc2": "侧栏中的“历史记录”标签可用于查看项目中已更改的文件并提交。它向您显示了提交的完整历史记录,并允许您将更改推送到远程存储库。"
},
"create": {
"projects": "项目",
"already-exists": "项目已存在",
"must-contain": "只能包含A-Z 0-9 _ -",
"no-info-in-url": "网址中不要包含用户名/密码",
"open": "打开项目",
"create": "创建项目",
"clone": "克隆仓库",
"project-name": "项目名",
"desc": "描述",
"opt": "可选的",
"flow-file": "流程文件",
"credentials": "证书",
"enable-encryption": "启用加密",
"disable-encryption": "禁用加密",
"encryption-key": "加密密钥",
"desc0": "用来保护您的凭证的短语",
"desc1": "凭证文件不会被加密,其内容很容易阅读",
"git-url": "Git存储库URL",
"protocols": "https://, ssh:// or file://",
"auth-failed": "验证失败",
"username": "用户名",
"password": "密码",
"ssh-key": "SSH密钥",
"passphrase": "密码短语",
"desc2": "在通过ssh克隆存储库之前必须添加SSH密钥才能访问它。",
"add-ssh-key": "添加一个ssh密钥",
"credentials-encryption-key": "证书加密密钥",
"already-exists-2": "已存在",
"git-error": "git错误",
"con-failed": "连接失败",
"not-git": "不是git仓库",
"no-resource": "找不到存储库",
"cant-get-ssh-key-path": "错误无法获取所选的SSH密钥路径。",
"unexpected_error": "意外的错误"
},
"delete": {
"confirm": "您确定要删除此项目吗?"
},
"create-project-list": {
"search": "搜索您的项目",
"current": "当前的"
},
"require-clean": {
"confirm": "<p>您有未部署的更改,这些更改将丢失。</p><p>您要继续吗?</p>"
},
"send-req": {
"auth-req": "存储库需要认证",
"username": "用户名",
"password": "秘密",
"passphrase": "密码短语",
"retry": "重试",
"update-failed": "无法更新身份验证",
"unhandled": "未处理的错误响应"
},
"create-branch-list": {
"invalid": "无效的分支",
"create": "创建分支",
"current": "当前的"
},
"create-default-file-set": {
"no-active": "没有活动项目就无法创建默认文件集",
"no-empty": "无法在非空项目上创建默认文件集",
"git-error": "git错误"
},
"errors": {
"no-username-email": "您的Git客户端未配置用户名/电子邮件。",
"unexpected": "发生了一个意料之外的问题",
"code": "代码"
}
},
"editor-tab": {
"properties": "属性",
"envProperties": "环境变量",
"description": "描述",
"appearance": "外观",
"preview": "UI预览",
"defaultValue": "默认值"
},
"languages": {
"de": "德语",
"en-US": "英文",
"ja": "日语",
"ko": "韩文",
"zh-CN": "简体中文"
} }
} }

View File

@ -214,5 +214,53 @@
"$toMillis": { "$toMillis": {
"args": "timestamp", "args": "timestamp",
"desc": "将ISO 8601格式的字符串`timestamp`转换为从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。如果该字符串的格式不正确则抛出错误。" "desc": "将ISO 8601格式的字符串`timestamp`转换为从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。如果该字符串的格式不正确则抛出错误。"
},
"$env": {
"args": "arg",
"desc": "返回环境变量的值。\n\n这是Node-RED定义的函数。"
},
"$eval": {
"args": "expr [, context]",
"desc": "使用当前上下文来作为评估依据,分析并评估字符串`expr`其中包含文字JSON或JSONata表达式。"
},
"$formatInteger": {
"args": "number, picture",
"desc": "将“数字”转换为字符串并将其格式化为“图片”字符串指定的整数表示形式。图片字符串参数定义了数字的格式并具有与XPath F&O 3.1 规范中的fnformat-integer相同的语法。"
},
"$parseInteger": {
"args": "string, picture",
"desc": "使用“图片”字符串指定的格式将“字符串”参数的内容解析为整数作为JSON数字。图片字符串参数与$formatInteger格式相同。."
},
"$error": {
"args": "[str]",
"desc": "引发错误并显示一条消息。 可选的`str`将替代$error()函数评估的默认消息。"
},
"$assert": {
"args": "arg, str",
"desc": "如果`arg`为真,则该函数返回。 如果arg为假则抛出带有str的异常作为异常消息。"
},
"$single": {
"args": "array, function",
"desc": "返回满足参数function谓语的array参数中的唯一值 (比如传递值时函数返回布尔值“true”)。如果匹配值的数量不唯一时,则抛出异常。\n\n应在以下签名中提供函数`functionvalue [index [array []]]`其中value是数组的每个输入index是该值的位置整个数组作为第三个参数传递。"
},
"$encodeUrl": {
"args": "str",
"desc": "通过用表示字符的UTF-8编码的一个两个三个或四个转义序列替换某些字符的每个实例对统一资源定位符URL组件进行编码。\n\n示例`$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "通过用表示字符的UTF-8编码的一个两个三个或四个转义序列替换某些字符的每个实例对统一资源定位符URL进行编码。\n\n示例 `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrl": {
"args": "str",
"desc": "解码以前由encodeUrlComponent创建的统一资源定位器URL组件。 \n\n示例 `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrlComponent": {
"args": "str",
"desc": "解码先前由encodeUrl创建的统一资源定位符URL。 \n\n示例 `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
"$distinct": {
"args": "array",
"desc": "返回一个数组,其中重复的值已从`数组`中删除"
} }
} }

View File

@ -0,0 +1,945 @@
{
"common": {
"label": {
"name": "名稱",
"ok": "確認",
"done": "完成",
"cancel": "取消",
"delete": "刪除",
"close": "關閉",
"load": "讀取",
"save": "保存",
"import": "匯入",
"export": "匯出",
"back": "返回",
"next": "下一步",
"clone": "複製專案",
"cont": "Continue"
}
},
"workspace": {
"defaultName": "流程__number__",
"editFlow": "編輯流程: __name__",
"confirmDelete": "確認刪除",
"delete": "確定想要刪除 '__label__'?",
"dropFlowHere": "把流程放到這裡",
"addFlow": "新增流程",
"listFlows": "流程列表",
"status": "狀態",
"enabled": "有效",
"disabled": "無效",
"info": "詳細描述",
"selectNodes": "點擊節點用於選擇",
"tip": "詳細描述支援Markdown羽量級標記語言並將出現在資訊標籤中。"
},
"menu": {
"label": {
"view": {
"view": "顯示",
"grid": "格線",
"showGrid": "顯示格線",
"snapGrid": "對齊格線",
"gridSize": "格線尺寸",
"textDir": "文本方向",
"defaultDir": "默認方向",
"ltr": "從左到右",
"rtl": "從右到左",
"auto": "上下文",
"language": "Language",
"browserDefault": "Browser default"
},
"sidebar": {
"show": "顯示側邊欄"
},
"palette": {
"show": "Show palette"
},
"settings": "設置",
"userSettings": "使用者設置",
"nodes": "節點",
"displayStatus": "顯示節點狀態",
"displayConfig": "修改節點配置",
"import": "匯入",
"export": "匯出",
"search": "搜尋流程",
"searchInput": "搜尋流程",
"subflows": "子流程",
"createSubflow": "新建子流程",
"selectionToSubflow": "將選擇部分更改為子流程",
"flows": "流程",
"add": "增加",
"rename": "重新命名",
"delete": "刪除",
"keyboardShortcuts": "鍵盤快速鍵",
"login": "登入",
"logout": "退出",
"editPalette": "節點管理",
"other": "其他",
"showTips": "顯示小提示",
"help": "Node-RED website",
"projects": "專案",
"projects-new": "新專案",
"projects-open": "開啟專案",
"projects-settings": "專案設定",
"showNodeLabelDefault": "顯示新添加節點的標籤",
"clipboard": "剪貼簿",
"library": "庫",
"examples": "範例"
}
},
"actions": {
"toggle-navigator": "切換導航器",
"zoom-out": "縮小",
"zoom-reset": "重置縮放",
"zoom-in": "放大"
},
"user": {
"loggedInAs": "作為__name__登入",
"username": "帳號",
"password": "密碼",
"login": "登入",
"loginFailed": "登入失敗",
"notAuthorized": "未授權",
"errors": {
"settings": "設置資訊需要登入後才能訪問",
"deploy": "改動需要登入後才能部署",
"notAuthorized": "此操作需要登入後才能執行"
}
},
"notification": {
"warning": "<strong>警告</strong>: __message__",
"warnings": {
"undeployedChanges": "節點中存在未部署的更改",
"nodeActionDisabled": "節點動作在子流程中被禁用",
"nodeActionDisabledSubflow": "子流程中禁用了節點操作",
"missing-types": "流程由於缺少節點類型而停止。請檢查日誌的詳細資訊",
"safe-mode": "<p>流程在安全模式下停止。</p><p>您可以修改流程並部署更改以重新啟動。</p>",
"restartRequired": "Node-RED必須重新啟動以啟用升級的模組",
"credentials_load_failed": "<p>流程由於無法解密證書而停止。</p> <p>流程證書文件已加密,但是項目的加密密鑰丟失或無效。</p>",
"credentials_load_failed_reset": "<p>證書無法解密</p><p>流程證書文件已加密,但是項目的加密密鑰丟失或無效。</p><p>流程證書文件將在下一次部署時重置。任何現有的流程證書將被清除。</p>",
"missing_flow_file": "<p>找不到項目流程文件。</p><p>該項目未配置流程文件。</p>",
"missing_package_file": "<p>找不到項目包文件。</p><p>項目缺少package.json文件。</p>",
"project_empty": "<p>該項目為空。</p><p>是否要創建一組默認的項目文件?<br/>否則,您將不得不在編輯器外部手動將文件添加到項目中。</p>",
"project_not_found": "<p>找不到項目的'__project__'</p>",
"git_merge_conflict": "<p>自動合併更改失敗。</p><p>修復未合併的衝突,然後提交結果。</p>"
},
"error": "<strong>Error</strong>: __message__",
"errors": {
"lostConnection": "丟失與伺服器的連接,重新連接...",
"lostConnectionReconnect": "丟失與伺服器的連接__time__秒後重新連接",
"lostConnectionTry": "現在嘗試",
"cannotAddSubflowToItself": "無法向其自身添加子流程",
"cannotAddCircularReference": "無法添加子流程 - 迴圈引用",
"unsupportedVersion": "您正在使用不受支持的Node.js版本<br/>請升級到最新版本的Node.js LTS",
"failedToAppendNode": "<p>加載'__module__'失敗</p><p>__error__</p>"
},
"project": {
"change-branch": "轉到本地分支'__project__'",
"merge-abort": "Git合併中止",
"loaded": "已加載項目'__project__'",
"updated": "已更新項目'__project__'",
"pull": "已重新加載項目'__project__'",
"revert": "項目“__project__”已還原",
"merge-complete": "Git合併完成",
"setupCredentials": "設定證書",
"setupProjectFiles": "設置項目文件",
"no": "不了,謝謝",
"createDefault": "創建默認項目文件",
"mergeConflict": "顯示合併衝突"
},
"label": {
"manage-project-dep": "管理項目依賴性",
"setup-cred": "設定憑證",
"setup-project": "設置項目文件",
"create-default-package": "創建默認的包文件",
"no-thanks": "不了,謝謝",
"create-default-project": "創建默認項目文件",
"show-merge-conflicts": "顯示合併衝突"
}
},
"clipboard": {
"clipboard": "剪貼簿",
"nodes": "節點",
"node": "__count__ 節點",
"node_plural": "__count__ 多個節點",
"configNode": "__count__ 節點組態",
"configNode_plural": "__count__ 多節點組態",
"flow": "__count__ 流程",
"flow_plural": "__count__ 多流程",
"subflow": "__count__ 子流程",
"subflow_plural": "__count__ 多子流程",
"pasteNodes": "在這裡粘貼節點",
"selectFile": "匯入所選檔案",
"importNodes": "匯入節點",
"exportNodes": "匯出節點至剪貼簿",
"download": "下載",
"importUnrecognised": "匯入了無法識別的類型:",
"importUnrecognised_plural": "匯入了無法識別的類型:",
"nodesExported": "節點匯出到了剪貼簿",
"nodesImported": "已匯入:",
"nodeCopied": "已複製__count__個節點",
"nodeCopied_plural": "已複製__count__個節點",
"invalidFlow": "無效的流程: __message__",
"export": {
"selected": "已選擇的節點",
"current": "現在的節點",
"all": "所有流程",
"compact": "緊湊",
"formatted": "已格式化",
"copy": "匯出到剪貼簿",
"export": "匯出到庫",
"exportAs": "匯出為",
"overwrite": "取代",
"exists": "<p><b>\"__file__\"</b> 已經存在.</p><p>是否要取代?</p>"
},
"import": {
"import": "匯入到",
"newFlow": "新流程",
"errors": {
"notArray": "輸入的不是JSON數組",
"itemNotObject": "輸入的流程無效-項目__index__不是節點對象",
"missingId": "輸入的流程無效-項__index__缺少“ id”屬性",
"missingType": "輸入的流程無效-項__index__缺少“類型”屬性"
}
},
"copyMessagePath": "已複製路徑",
"copyMessageValue": "已複製數值",
"copyMessageValue_truncated": "已複製捨棄的數值",
"selectNodes": "選擇上面的文本並複製到剪貼簿"
},
"deploy": {
"deploy": "部署",
"full": "全面",
"fullDesc": "在工作區中部署所有內容",
"modifiedFlows": "已修改的流程",
"modifiedFlowsDesc": "只部署包含已更改節點的流程",
"modifiedNodes": "已更改的節點",
"modifiedNodesDesc": "只部署已經更改的節點",
"restartFlows": "重新啟動流程",
"restartFlowsDesc": "重新啟動當前部署的流程",
"successfulDeploy": "部署成功",
"successfulRestart": "成功重啟流程",
"deployFailed": "部署失敗: __message__",
"unusedConfigNodes": "您有一些未使用的配置節點",
"unusedConfigNodesLink": "點擊此處查看它們",
"errors": {
"noResponse": "伺服器沒有回應"
},
"confirm": {
"button": {
"ignore": "忽略",
"confirm": "確認部署",
"review": "查看更改",
"cancel": "取消",
"merge": "合併",
"overwrite": "忽略 & 部署"
},
"undeployedChanges": "您有未部署的更改。\n\n離開此頁面將丟失這些更改。",
"improperlyConfigured": "工作區包含一些未正確配置的節點:",
"unknown": "工作區包含一些未知的節點類型:",
"confirm": "你確定要部署嗎?",
"doNotWarn": "不要再對此發出警告",
"conflict": "伺服器正在運行較新的一組流程。",
"backgroundUpdate": "伺服器上的流程已更新。",
"conflictChecking": "檢查是否可以自動合併更改",
"conflictAutoMerge": "此更改不包括衝突,可以自動合併",
"conflictManualMerge": "這些更改包括了在部署之前必須解決的衝突。",
"plusNMore": "+更多的__count__"
}
},
"eventLog": {
"title": "事件日誌",
"view": "查看日誌"
},
"diff": {
"unresolvedCount": "__count__個未解決的衝突",
"unresolvedCount_plural": "__count__個未解決的衝突",
"globalNodes": "全局節點",
"flowProperties": "流程屬性",
"type": {
"added": "已添加",
"changed": "已更改",
"unchanged": "未更改",
"deleted": "已刪除",
"flowDeleted": "已刪除流程",
"flowAdded": "已添加流程",
"movedTo": "移動至__id__",
"movedFrom": "從__id__移動"
},
"nodeCount": "__count__個節點",
"nodeCount_plural": "__count__個節點",
"local": "本地",
"remote": "遠端",
"reviewChanges": "查看變更",
"noBinaryFileShowed": "無法顯示二進製文件內容",
"viewCommitDiff": "查看提交更改",
"compareChanges": "比較變更",
"saveConflict": "保存衝突解決",
"conflictHeader": "已解決<span>__unresolved__</span>中的<span>__resolved__</span>個衝突",
"commonVersionError": "通用版本不包含有效的JSON",
"oldVersionError": "舊版本不包含有效的JSON",
"newVersionError": "新版本不包含有效的JSON"
},
"subflow": {
"editSubflowInstance": "編輯子流程實例__name__",
"editSubflow": "編輯流程範本: __name__",
"edit": "編輯流程範本",
"subflowInstances": "這個子流程範本有__count__個實例",
"subflowInstances_plural": "這個子流程範本有__count__個實例",
"editSubflowProperties": "編輯屬性",
"input": "輸入:",
"output": "輸出:",
"status": "狀態節點",
"deleteSubflow": "刪除子流程",
"info": "詳細描述",
"category": "類別",
"env": {
"restore": "恢復為默認子流程",
"remove": "類別刪除環境變量"
},
"errors": {
"noNodesSelected": "<strong>無法創建子流程</strong>: 未選擇節點",
"multipleInputsToSelection": "<strong>無法創建子流程</strong>: 多個輸入到了選擇"
},
"format": "標記格式"
},
"editor": {
"configEdit": "編輯",
"configAdd": "添加",
"configUpdate": "更新",
"configDelete": "刪除",
"nodesUse": "__count__個節點使用此配置",
"nodesUse_plural": "__count__個節點使用此配置",
"addNewConfig": "添加新的__type__配置",
"editNode": "編輯__type__節點",
"editConfig": "編輯__type__配置",
"addNewType": "添加新的__type__節點",
"nodeProperties": "節點屬性",
"label": "Label",
"portLabels": "埠標籤",
"labelInputs": "輸入",
"labelOutputs": "輸出",
"settingIcon": "Icon",
"noDefaultLabel": "無",
"defaultLabel": "使用默認標籤",
"searchIcons": "搜尋 icons",
"useDefault": "使用默認",
"description": "描述",
"show": "顯示",
"hide": "隱藏",
"errors": {
"scopeChange": "更改範圍將使其他流程中的節點無法使用",
"invalidProperties": "無效的屬性:"
}
},
"keyboard": {
"title": "鍵盤快速鍵",
"keyboard": "鍵盤",
"filterActions": "篩選動作",
"shortcut": "快捷鍵",
"scope": "範圍",
"unassigned": "未分配",
"global": "全局",
"workspace": "工作區",
"selectAll": "選擇所有節點",
"selectAllConnected": "選擇所有連接的節點",
"addRemoveNode": "從選擇中添加/刪除節點",
"editSelected": "編輯選定節點",
"deleteSelected": "刪除選定節點或連結",
"importNode": "匯入節點",
"exportNode": "匯出節點",
"nudgeNode": "移動所選節點(1px)",
"moveNode": "移動所選節點(20px)",
"toggleSidebar": "切換側邊欄",
"togglePalette": "切換調色板",
"copyNode": "複製所選節點",
"cutNode": "剪切所選節點",
"pasteNode": "粘貼節點",
"undoChange": "撤銷上次執行的更改",
"searchBox": "打開搜索框",
"managePalette": "管理面板"
},
"library": {
"library": "庫",
"openLibrary": "打開庫...",
"saveToLibrary": "保存到庫...",
"typeLibrary": "__type__型別程式庫",
"unnamedType": "無名__type__",
"exportedToLibrary": "節點導出到庫",
"dialogSaveOverwrite": "一個叫做__libraryName__的__libraryType__已經存在您需要覆蓋麼",
"invalidFilename": "無效的檔案名",
"savedNodes": "保存的節點",
"savedType": "已保存__type__",
"saveFailed": "保存失敗: __message__",
"types": {
"local": "本地",
"examples": "例子"
},
"exportToLibrary": "將節點匯出到庫",
"filename": "檔案名",
"folder": "資料夾",
"filenamePlaceholder": "文件",
"fullFilenamePlaceholder": "a/b/文件",
"folderPlaceholder": "a/b",
"breadcrumb": "庫"
},
"palette": {
"noInfo": "無可用資訊",
"filter": "過濾節點",
"search": "搜索模組",
"addCategory": "添加新的...",
"label": {
"subflows": "子流程",
"input": "輸入",
"output": "輸出",
"function": "功能",
"social": "社交",
"storage": "存儲",
"analysis": "分析",
"advanced": "高級"
},
"actions": {
"collapse-all": "收起所有類別",
"expand-all": "展開所有類別"
},
"event": {
"nodeAdded": "添加到面板中的節點:",
"nodeAdded_plural": "添加到面板中的多個節點",
"nodeRemoved": "從面板中刪除的節點:",
"nodeRemoved_plural": "從面板中刪除的多個節點:",
"nodeEnabled": "啟用節點:",
"nodeEnabled_plural": "啟用多個節點:",
"nodeDisabled": "禁用節點:",
"nodeDisabled_plural": "禁用多個節點:",
"nodeUpgraded": "節點模組__module__升級到__version__版本"
},
"editor": {
"title": "面板管理",
"palette": "Palette",
"times": {
"seconds": "秒前",
"minutes": "分前",
"minutesV": "__count__分前",
"hoursV": "__count__小時前",
"hoursV_plural": "__count__小時前",
"daysV": "__count__天前",
"daysV_plural": "__count__天前",
"weeksV": "__count__周前",
"weeksV_plural": "__count__周前",
"monthsV": "__count__月前",
"monthsV_plural": "__count__月前",
"yearsV": "__count__年前",
"yearsV_plural": "__count__年前",
"yearMonthsV": "__y__年, __count__月前",
"yearMonthsV_plural": "__y__年, __count__月前",
"yearsMonthsV": "__y__年, __count__月前",
"yearsMonthsV_plural": "__y__年, __count__月前"
},
"nodeCount": "__label__個節點",
"nodeCount_plural": "__label__個節點",
"moduleCount": "__count__個可用模組",
"moduleCount_plural": "__count__個可用模組",
"inuse": "使用中",
"enableall": "全部啟用",
"disableall": "全部禁用",
"enable": "啟用",
"disable": "禁用",
"remove": "移除",
"update": "更新至__version__版本",
"updated": "已更新",
"install": "安裝",
"installed": "已安裝",
"conflict": "conflict",
"conflictTip": "<p>無法安裝此模塊,因為它包含已安裝的<br/>節點類型</p><p>與<code>__module__</code>衝突</p>",
"loading": "載入目錄...",
"tab-nodes": "節點",
"tab-install": "安裝",
"sort": "排序:",
"sortAZ": "a-z順序",
"sortRecent": "日期順序",
"more": "增加__count__個",
"errors": {
"catalogLoadFailed": "無法載入節點目錄。<br>查看瀏覽器控制台瞭解更多資訊",
"installFailed": "無法安裝: __module__<br>__message__<br>查看日誌瞭解更多資訊",
"removeFailed": "無法刪除: __module__<br>__message__<br>查看日誌瞭解更多資訊",
"updateFailed": "無法更新: __module__<br>__message__<br>查看日誌瞭解更多資訊",
"enableFailed": "無法啟用: __module__<br>__message__<br>查看日誌瞭解更多資訊",
"disableFailed": "無法禁用: __module__<br>__message__<br>查看日誌瞭解更多資訊"
},
"confirm": {
"install": {
"body": "在安裝之前請閱讀節點的文檔某些節點的依賴關係不能自動解決可能需要重新啟動Node-RED。",
"title": "安裝節點"
},
"remove": {
"body": "刪除節點將從Node-RED卸載它。節點可能會繼續使用資源直到重新啟動Node-RED。",
"title": "刪除節點"
},
"update": {
"body": "更新節點將需要重新啟動Node-RED來完成更新該過程必須由手動完成。",
"title": "更新節點"
},
"cannotUpdate": {
"body": "此節點的更新可用,但不會安裝在面板管理器可以更新的位置。<br/><br/>請參閱有關如何更新此節點的文檔。"
},
"button": {
"review": "打開節點資訊",
"install": "安裝",
"remove": "刪除",
"update": "更新"
}
}
}
},
"sidebar": {
"info": {
"name": "節點信息",
"tabName": "名稱",
"label": "信息",
"node": "節點",
"type": "類型",
"module": "Module",
"id": "ID",
"status": "狀態",
"enabled": "啟用",
"disabled": "禁用",
"subflow": "子流程",
"instances": "實例",
"properties": "屬性",
"info": "信息",
"desc": "描述",
"blank": "空白",
"null": "空",
"showMore": "展開",
"showLess": "收起",
"flow": "流程",
"selection": "選擇",
"nodes": "__count__ 個節點",
"flowDesc": "流程描述",
"subflowDesc": "子流程描述",
"nodeHelp": "節點幫助",
"none": "無",
"arrayItems": "__count__個項目",
"showTips": "您可以從設置面板啟用提示資訊"
},
"config": {
"name": "配置節點",
"label": "配置",
"global": "所有流程",
"none": "無",
"subflows": "子流程",
"flows": "流程",
"filterUnused": "未使用",
"filterAll": "所有",
"filtered": "__count__ 個隱藏"
},
"context": {
"name": "上下文數據",
"label": "上下文",
"none": "未選擇",
"refresh": "刷新以加載",
"empty": "空",
"node": "節點",
"flow": "流程",
"global": "全局的",
"deleteConfirm": "你確定要刪除這個項目嗎?",
"autoRefresh": "自動刷新"
},
"palette": {
"name": "節點管理",
"label": "節點"
},
"project": {
"label": "項目",
"name": "名稱",
"description": "描述",
"dependencies": "依賴",
"settings": "設置",
"noSummaryAvailable": "無可用摘要",
"editDescription": "編輯專案描述",
"editDependencies": "編輯項目依賴",
"editReadme": "Edit README.md",
"showProjectSettings": "顯示項目設置",
"projectSettings": {
"title": "項目設定",
"edit": "編輯",
"none": "None",
"install": "安裝",
"removeFromProject": "從項目中刪除",
"addToProject": "添加到項目",
"files": "文件",
"package": "包",
"flow": "流程",
"credentials": "證書",
"packageCreate": "保存更改後將創建文件",
"fileNotExist": "文件不存在",
"selectFile": "選擇文件",
"invalidEncryptionKey": "無效的加密密鑰",
"encryptionEnabled": "啟用加密",
"encryptionDisabled": "禁用加密",
"setTheEncryptionKey": "設置加密密鑰",
"resetTheEncryptionKey": "重置加密密鑰",
"changeTheEncryptionKey": "更改加密密鑰",
"currentKey": "當前密鑰",
"newKey": "新密鑰",
"credentialsAlert": "這將刪除所有現有證書",
"versionControl": "版本控制",
"branches": "分支",
"noBranches": "沒有分支",
"deleteConfirm": "您確定要刪除本地分支'__name__'嗎?這不能被撤消。",
"unmergedConfirm": "本地分支'__name__'具有未合併的更改,這些更改將丟失。你確定要刪除嗎?",
"deleteUnmergedBranch": "刪除未合併的分支",
"gitRemotes": "Git遠程倉庫",
"addRemote": "添加遠程倉庫",
"addRemote2": "添加遠程倉庫",
"remoteName": "遠程倉庫名",
"nameRule": "必須僅包含A-Z 0-9 _ -",
"url": "URL",
"urlRule": "https://, ssh:// or file://",
"urlRule2": "網址中不要包含用戶名/密碼",
"noRemotes": "沒有遠程倉庫",
"deleteRemoteConfrim": "確定要刪除遠程倉庫'__name__'嗎?",
"deleteRemote": "刪除遠程倉庫"
},
"userSettings": {
"committerDetail": "提交者詳細信息",
"committerTip": "保留空白以使用系統默認值",
"userName": "用戶名",
"email": "電子郵件",
"sshKeys": "SSH密鑰",
"sshKeysTip": "允許您創建到遠程git存儲庫的安全連接。",
"add": "添加密鑰",
"addSshKey": "添加SSH密鑰",
"addSshKeyTip": "生成新的公鑰/私鑰對",
"name": "名字",
"nameRule": "必須僅包含A-Z 0-9 _ -",
"passphrase": "密碼短語",
"passphraseShort": "密碼短語太短",
"optional": "可選的",
"cancel": "取消",
"generate": "產生密鑰",
"noSshKeys": "沒有SSH密鑰",
"copyPublicKey": "將公鑰複製到剪貼板",
"delete": "刪除密鑰",
"gitConfig": "Git配置",
"deleteConfirm": "您確定要刪除SSH密鑰__name__嗎 這不能被撤消。"
},
"versionControl": {
"unstagedChanges": "未暫存的更改",
"stagedChanges": "已暫存的更改",
"unstageChange": "取消暫存更改",
"stageChange": "暫存更改",
"unstageAllChange": "取消暫存所有更改",
"stageAllChange": "暫存所有更改",
"commitChanges": "提交變更",
"resolveConflicts": "解決衝突",
"head": "HEAD",
"staged": "以暫存",
"unstaged": "未暫存",
"local": "本地的",
"remote": "遠程的",
"revert": "您確定要將更改恢復為'__file__'嗎? 這不能被撤消。",
"revertChanges": "還原變更",
"localChanges": "當地變化",
"none": "None",
"conflictResolve": "解決所有衝突。 提交更改以完成合併。",
"localFiles": "本地文件",
"all": "所有的",
"unmergedChanges": "未合併的更改",
"abortMerge": "合併中止",
"commit": "提交",
"changeToCommit": "提交變更",
"commitPlaceholder": "輸入您的提交信息",
"cancelCapital": "取消",
"commitCapital": "提交",
"commitHistory": "提交歷史",
"branch": "分支:",
"moreCommits": "更多提交",
"changeLocalBranch": "變更當地分支",
"createBranchPlaceholder": "查找或創建分支",
"upstream": "上游的",
"localOverwrite": "您有可通过切换分支覆盖的本地更改。您必须先提交或撤销那些更改。",
"manageRemoteBranch": "管理遠程分支",
"unableToAccess": "無法訪問遠程存儲庫",
"retry": "重試",
"setUpstreamBranch": "設置為上游分支",
"createRemoteBranchPlaceholder": "查找或創建遠程分支",
"trackedUpstreamBranch": "創建的分支將被設置為跟踪的上游分支。",
"selectUpstreamBranch": "分支將被創建。 在下面選擇以將其設置為被跟踪的上游分支。",
"pushFailed": "Push失敗因為遠程具有更多的最新提交。請先進行pull與merge然後再嘗試push。",
"push": "push",
"pull": "pull",
"unablePull": "<p>無法提取遠程更改;您未進行的暫存本地更改將被覆蓋。</p><p>提交更改,然後重試。</p>",
"showUnstagedChanges": "顯示未分階段的更改",
"connectionFailed": "無法連接到遠程存儲庫:",
"pullUnrelatedHistory": "<p>遠程服務器具有不相關的提交歷史記錄。</p><p>您確定要將更改保存到本地存儲庫中嗎?</p>",
"pullChanges": "Pull變更",
"history": "歷史",
"projectHistory": "項目歷史",
"daysAgo": "__count__天前",
"daysAgo_plural": "__count__天前",
"hoursAgo": "__count__小時前",
"hoursAgo_plural": "__count__小時前",
"minsAgo": "__count__分鐘前",
"minsAgo_plural": "__count__分鐘前",
"secondsAgo": "秒前",
"notTracking": "您的本地分支當前未跟踪遠程分支。",
"statusUnmergedChanged": "您的存儲庫中有未合併的更改。您需要解決衝突並提交結果。",
"repositoryUpToDate": "您的存儲庫是最新的。",
"commitsAhead": "您的倉庫領先遠程倉庫__count__次提交。您現在可以push這些提交。",
"commitsAhead_plural": "您的倉庫領先遠程倉庫__count__次提交。您現在可以push這些提交。",
"commitsBehind": "您的倉庫落後遠程倉庫__count__次提交。您現在可以pull這些提交。",
"commitsBehind_plural": "您的倉庫落後遠程倉庫__count__次提交。您現在可以pull這些提交。",
"commitsAheadAndBehind1": "您的倉庫落後遠程倉庫__count__次提交",
"commitsAheadAndBehind1_plural": "您的倉庫落後遠程倉庫__count__次提交",
"commitsAheadAndBehind2": "領先遠程倉庫__count__次提交。",
"commitsAheadAndBehind2_plural": "領先遠程倉庫__count__次提交。",
"commitsAheadAndBehind3": "您必須先pull遠程提交然後再進行push。",
"commitsAheadAndBehind3_plural": "您必須先pull遠程提交然後再進行push。",
"refreshCommitHistory": "刷新提交歷史",
"refreshChanges": "刷新更改"
}
}
},
"typedInput": {
"type": {
"str": "文字列",
"num": "數字",
"re": "規則運算式",
"bool": "布林",
"json": "JSON",
"bin": "二進位流",
"date": "時間戳記",
"jsonata": "expression",
"env": "env variable"
}
},
"editableList": {
"add": "添加"
},
"search": {
"empty": "找不到匹配",
"addNode": "添加一個節點..."
},
"expressionEditor": {
"functions": "功能",
"functionReference": "Function reference",
"insert": "插入",
"title": "JSONata運算式編輯器",
"test": "Test",
"data": "示例消息",
"result": "結果",
"format": "格式表達方法",
"compatMode": "相容模式啟用",
"compatModeDesc": "<h3>JSONata的相容模式</h3><p> 目前的運算式仍然參考<code>msg</code>,所以將以相容性模式進行評估。請更新運算式,使其不使用<code>msg</code>,因為此模式將在將來刪除。</p><p> 當JSONata支持首次添加到Node-RED時它需要運算式引用<code>msg</code>物件。例如<code>msg.payload</code>將用於訪問有效負載。</p><p> 這樣便不再需要運算式直接針對消息進行評估。要訪問有效負載,運算式應該只是<code>payload</code>.</p>",
"noMatch": "無匹配結果",
"errors": {
"invalid-expr": "無效的JSONata運算式:\n __message__",
"invalid-msg": "無效的示例JSON消息:\n __message__",
"context-unsupported": "無法測試上下文函數\n $flowContext 或 $globalContext",
"eval": "評估運算式錯誤:\n __message__"
}
},
"jsEditor": {
"title": "JavaScript 編輯器"
},
"textEditor": {
"title": "Text 編輯器"
},
"jsonEditor": {
"title": "JSON編輯器",
"format": "格式化JSON"
},
"markdownEditor": {
"title": "Markdown 編輯器",
"format": "F使用markdown格式化",
"heading1": "Heading 1",
"heading2": "Heading 2",
"heading3": "Heading 3",
"bold": "粗體",
"italic": "斜體",
"code": "程式碼",
"ordered-list": "編號清單",
"unordered-list": "符號清單",
"quote": "引用",
"link": "連結",
"horizontal-rule": "分隔線",
"toggle-preview": "預覽"
},
"bufferEditor": {
"title": "緩衝區編輯器",
"modeString": "作為UTF-8字串處理",
"modeArray": "作為JSON陣列處理",
"modeDesc": "<h3>緩衝區編輯器</h3><p>緩衝區類型被存儲為位元組值的JSON陣列。編輯器將嘗試將輸入的數值解析為JSON陣列。如果它不是有效的JSON它將被視為UTF-8字串並被轉換為單個字元代碼點的陣列。</p><p>例如,<code>Hello World</code>的值會被轉換為JSON陣列<pre>[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]</pre></p>"
},
"projects": {
"config-git": "配置Git客戶端",
"welcome": {
"hello": "你好! 我們已經將“項目”引入了Node-RED。",
"desc0": "這是一種用於管理流程文件的新方法,並且包括對流程的版本控制。",
"desc1": "首先您可以創建您的第一個項目或從git存儲庫克隆現有項目。",
"desc2": "如果不確定,可以暫時跳過此步驟。 您仍然可以隨時通過“項目”菜單創建第一個項目。",
"create": "創建項目",
"clone": "克隆存儲庫",
"openExistingProject": "打開現有項目",
"not-right-now": "不是現在"
},
"git-config": {
"setup": "設置您的版本控制客戶端",
"desc0": "Node-RED使用開源工具Git進行版本控制。 它跟踪對項目文件的更改,並允許您將其推送到遠程存儲庫。",
"desc1": "提交一組更改時Git會使用用戶名和電子郵件地址記錄誰進行了更改。 用戶名可以是您想要的任何名稱-不必是您的真實姓名。",
"desc2": "您的Git客戶端已經配置了以下詳細信息。",
"desc3": "您可以稍後在設置對話框的“ Git config”標籤下更改這些設置。",
"username": "用戶名",
"email": "電子郵件"
},
"project-details": {
"create": "創建您的項目",
"desc0": "項目被維護為Git存儲庫。 與他人共享您的流程並進行協作更容易。",
"desc1": "您可以創建多個項目,並通過編輯器在它們之間快速切換。",
"desc2": "首先,您的項目需要一個名稱和一個可選的描述。",
"already-exists": "項目已存在",
"must-contain": "必須僅包含A-Z 0-9 _ -",
"project-name": "項目名",
"desc": "描述",
"opt": "可選的"
},
"clone-project": {
"clone": "克隆項目",
"desc0": "如果您已經有一個包含項目的git存儲庫則可以對其進行克隆以開始使用。",
"already-exists": "項目已經存在",
"must-contain": "必須僅包含A-Z 0-9 _ -",
"project-name": "項目名",
"no-info-in-url": "網址中不要包含用戶名/密碼",
"git-url": "Git存儲庫URL",
"protocols": "https://, ssh:// or file://",
"auth-failed": "驗證失敗",
"username": "用戶名",
"passwd": "密碼",
"ssh-key": "SSH密鑰",
"passphrase": "密碼短語",
"ssh-key-desc": "在通過ssh克隆存儲庫之前必須添加SSH密鑰才能訪問它。",
"ssh-key-add": "添加一個ssh密鑰",
"credential-key": "證書加密密鑰",
"cant-get-ssh-key": "錯誤! 無法獲取所選的SSH密鑰路徑。",
"already-exists2": "已存在",
"git-error": "git錯誤",
"connection-failed": "連接失敗",
"not-git-repo": "不是一個git倉庫",
"repo-not-found": "未發現倉庫"
},
"default-files": {
"create": "創建您的項目文件",
"desc0": "一個項目包含您的流程文件自述文件和package.json文件。",
"desc1": "它可以包含您要在Git存儲庫中維護的任何其他文件。",
"desc2": "您現有的流程和證書文件將被複製到項目中。",
"flow-file": "流文件",
"credentials-file": "證書文件"
},
"encryption-config": {
"setup": "設置證書文件的加密",
"desc0": "您的流程證書文件可以被加密以確保其內容安全。",
"desc1": "如果要將這些證書存儲在公共Git存儲庫中則必須通過提供密鑰短語來對它們進行加密。",
"desc2": "您的流程證書文件當前未加密。",
"desc3": "這意味著任何有權訪問該文件的人都可以讀取其內容,例如密碼和訪問令牌。",
"desc4": "如果要將這些證書存儲在公共Git存儲庫中則必須通過提供密鑰短語來對它們進行加密。",
"desc5": "當前使用設置文件中的credentialSecret屬性作為密鑰來加密流憑據文件。",
"desc6": "您的流程證書文件當前使用系統生成的密鑰加密。 您應該為此項目提供一個新的密鑰。",
"desc7": "密鑰將與項目文件分開存儲。 您將需要提供在另一個Node-RED實例中使用該項目的密鑰。",
"credentials": "證書",
"enable": "啟用加密",
"disable": "禁用加密",
"disabled": "禁用的",
"copy": "複製現有密鑰",
"use-custom": "使用自定義密鑰",
"desc8": "憑證文件不會被加密,其內容很容易閱讀",
"create-project-files": "創建項目文件",
"create-project": "創建項目",
"already-exists": "已存在",
"git-error": "git錯誤",
"git-auth-error": "git認證錯誤"
},
"create-success": {
"success": "您已經成功創建了第一個項目!",
"desc0": "現在您可以像往常一樣繼續使用Node-RED。",
"desc1": "側欄中的“信息”標籤顯示了您當前的活動項目。名稱旁邊的按鈕可用於訪問項目設置視圖。",
"desc2": "側欄中的“歷史記錄”標籤可用於查看項目中已更改的文件並提交。 它向您顯示了提交的完整歷史記錄,並允許您將更改推送到遠程存儲庫。"
},
"create": {
"projects": "項目",
"already-exists": "項目已存在",
"must-contain": "必須僅包含A-Z 0-9 _ -",
"no-info-in-url": "網址中不要包含用戶名/密碼",
"open": "打開項目",
"create": "創建項目",
"clone": "克隆倉庫",
"project-name": "項目名",
"desc": "描述",
"opt": "可選的",
"flow-file": "流程文件",
"credentials": "證書",
"enable-encryption": "啟用加密",
"disable-encryption": "禁用加密",
"encryption-key": "加密的密鑰",
"desc0": "用來保護您的憑證的短語",
"desc1": "憑證文件不會被加密,其內容很容易閱讀",
"git-url": "Git倉庫的URL",
"protocols": "https://, ssh:// or file://",
"auth-failed": "驗證失敗",
"username": "用戶名",
"password": "密碼",
"ssh-key": "SSH密鑰",
"passphrase": "密碼短語",
"desc2": "在通過ssh克隆存儲庫之前必須添加SSH密鑰才能訪問它。",
"add-ssh-key": "添加一個ssh密鑰",
"credentials-encryption-key": "憑證加密密鑰",
"already-exists-2": "已存在",
"git-error": "git錯誤",
"con-failed": "連接失敗",
"not-git": "不是git倉庫",
"no-resource": "找不到存儲庫",
"cant-get-ssh-key-path": "錯誤! 無法獲取所選的SSH密鑰路徑。",
"unexpected_error": "意外的錯誤"
},
"delete": {
"confirm": "您確定要刪除此項目嗎?"
},
"create-project-list": {
"search": "搜索您的項目",
"current": "當前的"
},
"require-clean": {
"confirm": "<p>您有未部署的更改,這些更改將丟失。</p><p>您要繼續嗎?</p>"
},
"send-req": {
"auth-req": "存儲庫需要認證",
"username": "用戶名",
"password": "密碼",
"passphrase": "密碼短語",
"retry": "重試",
"update-failed": "無法更新身份驗證",
"unhandled": "未處理的錯誤響應"
},
"create-branch-list": {
"invalid": "無效的分支",
"create": "創建分支",
"current": "當前的"
},
"create-default-file-set": {
"no-active": "沒有活動項目就無法創建默認文件集",
"no-empty": "無法在非空項目上創建默認文件集",
"git-error": "git error"
},
"errors": {
"no-username-email": "您的Git客戶端未配置用戶名/電子郵件。",
"unexpected": "發生了一個意料之外的問題",
"code": "代碼"
}
},
"editor-tab": {
"properties": "屬性",
"description": "描述",
"appearance": "外觀",
"env": "環境變量"
}
}

View File

@ -0,0 +1,23 @@
{
"info": {
"tip0" : "您可以用 {{core:delete-selection}} 刪除選擇的節點或連結。",
"tip1" : "{{core:search}} 可以在流程內搜索節點。",
"tip2": "{{core:toggle-sidebar}} 可以顯示或隱藏邊側欄。",
"tip3": "您可以在 {{core:manage-palette}} 中管理節點的控制台。",
"tip4": "側邊欄中會列出流程中所有的配置節點。您可以通過功能表或者 {{core:show-config-tab}} 來訪問這些節點。",
"tip5": "您可以在設定中選擇顯示或隱藏這些提示。",
"tip6": "您可以用[left] [up] [down] [right]鍵來移動被選中的節點。按住[shift]可以更快地移動節點。",
"tip7": "把節點拖到連接上可以向連接中插入節點。",
"tip8": "您可以用 {{core:show-export-dialog}} 來匯出被選中的節點或標籤頁中的流程。",
"tip9": "您可以將流程的json文字檔拖入編輯方塊或 {{core:show-import-dialog}} 來導入流程。",
"tip10": "按住[shift]後按一下並拖動節點可以將該節點的多個連接一併移動到其他節點的埠。",
"tip11": "{{core:show-info-tab}} 可以顯示「資訊」標籤頁。 {{core:show-debug-tab}} 可以顯示「調試」標籤頁。",
"tip12": "按住[ctrl]的同時點擊工作介面可以在節點的對話欄中快速添加節點。",
"tip13": "按住[ctrl]的同時點擊節點的埠或後續節點可以快速連接多個節點。",
"tip14": "按住[shift]的同時點擊節點會選中所有被連接的節點。",
"tip15": "按住[ctrl]的同時點擊節點可以在選中或取消選中節點。",
"tip16": "{{core:show-previous-tab}} 和 {{core:show-next-tab}} 可以切換標籤頁。",
"tip17": "您可以在節點的屬性配置畫面中通過 {{core:confirm-edit-tray}} 來更改設置,或者用 {{core:cancel-edit-tray}} 來取消更改。",
"tip18": "您可以通過點擊 {{core:edit-selected-node}} 來顯示被選中節點的屬性設置畫面。"
}
}

View File

@ -0,0 +1,218 @@
{
"$string": {
"args": "arg",
"desc": "通過以下的類型轉換規則將參數*arg*轉換成字串:\n\n - 字串不轉換。\n -函數轉換成空的字串。\n - JSON的值無法用數字表示所以用無限大或者NaN非數表示。\n - 用JSON.stringify函數將其他值轉換成JSON字串。"
},
"$length": {
"args": "str",
"desc": "輸出字串str的字數。如果str不是字串拋出錯誤。"
},
"$substring": {
"args": "str, start[, length]",
"desc": "輸出`start`位置後的的首次出現的包括`str`的子字串。 如果`length`被指定,那麼的字串中將只包括前`length`個文字。如果`start`是負數則輸出從`str`末尾開始的`length`個文字"
},
"$substringBefore": {
"args": "str, chars",
"desc": "輸出str中首次出現的chars之前的子字串如果str中不包括chars則輸出str。"
},
"$substringAfter": {
"args": "str, chars",
"desc": "輸出str中首次出現的chars之後的子字串如果str中不包括chars則輸出str。"
},
"$uppercase": {
"args": "str",
"desc": "`將str中的所有字母變為大寫後輸出。"
},
"$lowercase": {
"args": "str",
"desc": "將str中的所有字母變為小寫後輸出。"
},
"$trim": {
"args": "str",
"desc": "將以下步驟應用於`str`來去除所有空白文字並實現標準化。\n\n 將全部tab定位字元、Enter鍵、換行字元用空白代替。\n- 將連續的空白文字變成一個空白文字。\n- 消除開頭和末尾的空白文字。\n\n如果`str`沒有被指定(即在無輸入參數的情況下調用本函數),將上下文的值作為`str`來使用。 如果`str` 不是字串則拋出錯誤。"
},
"$contains": {
"args": "str, pattern",
"desc": "字串`str` 和 `pattern`匹配的話輸出`true`,不匹配的情況下輸出 `false`。 不指定`str`的情況下(比如用一個參數調用本函數時)、將上下文的值作為`str`來使用。參數 `pattern`可以為字串或正則表達。"
},
"$split": {
"args": "str[, separator][, limit]",
"desc": "將參數`str`分解成由子字串組成的陣列。 如果`str`不是字串拋出錯誤。可以省略的參數 `separator`中指定字串`str`的分隔符號。分隔符號可以是文字或規則運算式。在不指定`separator`的情況下、將分隔符號看作空的字串並把`str`拆分成由單個字母組成的陣列。如果`separator`不是字串則拋出錯誤。在可省略的參數`limit`中指定分割後的子字串的最大個數。超出個數的子字串將被捨棄。如果`limit`沒有被指定,`str` 將不考慮子字串的個數而將字串完全分隔。如果`limit`是負數則拋出錯誤。"
},
"$join": {
"args": "array[, separator]",
"desc": "用可以省略的參數 `separator`來把多個字元串連接。如果`array`不是字串則拋出錯誤。 如果沒有指定`separator`,則用空字串來連接字元(即字串之間沒有`separator`)。 如果`separator`不是字元則拋出錯誤。"
},
"$match": {
"args": "str, pattern [, limit]",
"desc": "對字串`str`使用規則運算式`pattern`並輸出與`str`相匹配的部分資訊。"
},
"$replace": {
"args": "str, pattern, replacement [, limit]",
"desc": "在字串`str`中搜索`pattern`並用`replacement`來替換。\n\n可選參數`limit`用來指定替換次數的上限。"
},
"$now": {
"args": "",
"desc": "生成ISO 8601互換格式的時刻並作為字串輸出。"
},
"$base64encode": {
"args": "string",
"desc": "將ASCII格式的字串轉換為Base 64格式。將字串中的文字視作二進位形式的資料處理。包含URI編碼在內的字串文字必須在0x00到0xFF的範圍內否則不會被支持。"
},
"$base64decode": {
"args": "string",
"desc": "用UTF-8內碼表將Base 64形式二進位值轉換為字串。"
},
"$number": {
"args": "arg",
"desc": "用下述的規則將參數 `arg`轉換為數值。:\n\n 數值不做轉換。\n 將字串中合法的JSON數値表示轉換成數値。\n 其他形式的值則拋出錯誤。"
},
"$abs": {
"args": "number",
"desc": "輸出參數`number`的絕對值。"
},
"$floor": {
"args": "number",
"desc": "輸出比`number`的值小的最大整數。"
},
"$ceil": {
"args": "number",
"desc": "輸出比`number`的值大的最小整數。"
},
"$round": {
"args": "number [, precision]",
"desc": "輸出四捨五入後的參數`number`。可省略的參數 `precision`指定四捨五入後小數點下的位數。"
},
"$power": {
"args": "base, exponent",
"desc": "輸出底數`base`的`exponent`次冪。"
},
"$sqrt": {
"args": "number",
"desc": "輸出參數 `number`的平方根。"
},
"$random": {
"args": "",
"desc": "輸出比0大比1小的偽亂數。"
},
"$millis": {
"args": "",
"desc": "返回從UNIX時間 (1970年1月1日 UTC/GMT的午夜開始到現在的毫秒數。在同一個運算式的測試中所有對`$millis()`的調用將會返回相同的值。"
},
"$sum": {
"args": "array",
"desc": "輸出陣列`array`的總和。如果`array`不是數值則拋出錯誤。"
},
"$max": {
"args": "array",
"desc": "輸出陣列`array`的最大值。如果`array`不是數值則拋出錯誤。"
},
"$min": {
"args": "array",
"desc": "輸出陣列`array`的最小值。如果`array`不是數值則拋出錯誤。。"
},
"$average": {
"args": "array",
"desc": "輸出陣列`array`的平均數。如果`array`不是數值則拋出錯誤。。"
},
"$boolean": {
"args": "arg",
"desc": "用下述規則將資料轉換成布林值。:\n\n - 不轉換布林值`Boolean`。\n 將空的字串`string`轉換為`false`\n 將不為空的字串`string`轉換為`true`\n 將為0的數位`number`轉換成`false`\n 將不為0的數位`number`轉換成`true`\n –將`null`轉換成`false`\n –將空的陣列`array`轉換成`false`\n –如果陣列`array`中含有可以轉換成`true`的要素則轉換成`true`\n –如果`array`中沒有可轉換成`true`的要素則轉換成`false`\n 空的物件`object`轉換成`false`\n 非空的物件`object`轉換成`true`\n –將函數`function`轉換成`false`"
},
"$not": {
"args": "arg",
"desc": "輸出做反轉運算後的布林值。首先將`arg`轉換為布林值。"
},
"$exists": {
"args": "arg",
"desc": "如果算式`arg`的值存在則輸出`true`。如果算式的值不存在(比如指向不存在區域的引用)則輸出`false`。"
},
"$count": {
"args": "array",
"desc": "輸出陣列中的元素數。"
},
"$append": {
"args": "array, array",
"desc": "將兩個陣列連接。"
},
"$sort": {
"args": "array [, function]",
"desc": "輸出排序後的陣列`array`。\n\n如果使用了比較函數`function`,則下述兩個參數需要被指定。\n\n`function(left, right)`\n\n該比較函數是為了比較left和right兩個值而被排序演算法調用的。如果使用者希望left的值被置於right的值之後那麼該函數必須輸出布林值`true`來表示位置交換。而在不需要位置交換時函數必須輸出`false`。"
},
"$reverse": {
"args": "array",
"desc": "輸出倒序後的陣列`array`。"
},
"$shuffle": {
"args": "array",
"desc": "輸出隨機排序後的陣列 `array`。"
},
"$zip": {
"args": "array, ...",
"desc": "將陣列中的值按索引順序打包後輸出。"
},
"$keys": {
"args": "object",
"desc": "輸出由物件內的鍵組成的陣列。如果參數是物件的陣列則輸出由所有物件中的鍵去重後組成的佇列。"
},
"$lookup": {
"args": "object, key",
"desc": "輸出對象中與參數`key`對應的值。如果第一個參數`object`是陣列,那麼陣列中所有的物件都將被搜索並輸出這些物件中與參數`key`對應的值。"
},
"$spread": {
"args": "object",
"desc": "將物件中的鍵值對分隔成每個要素中只含有一個鍵值對的陣列。如果參數`object`是陣列,那麼返回值的陣列中包含所有物件中的鍵值對。"
},
"$merge": {
"args": "array&lt;object&gt;",
"desc": "將輸入陣列`objects`中所有的鍵值對合併到一個`object`中並返回。如果輸入陣列的要素中含有重複的鍵,則返回的`object`中將只包含陣列中最後出現要素的值。如果輸入陣列中包括物件以外的元素,則拋出錯誤。"
},
"$sift": {
"args": "object, function",
"desc": "輸出參數`object`中符合`function`的鍵值對。\n\n`function`必須含有下述參數。\n\n`function(value [, key [, object]])`"
},
"$each": {
"args": "object, function",
"desc": "將函數`function`應用於`object`中的所有鍵值對並輸出由所有返回值組成的陣列。"
},
"$map": {
"args": "array, function",
"desc": "將函數`function`應用於陣列`array`中所有的值並輸出由返回值組成的陣列。\n\n`function`中必須含有下述參數。\n\n`function(value [, index [, array]])`"
},
"$filter": {
"args": "array, function",
"desc": "輸出陣列`array`中符合函數`function`條件的值組成的陣列。\n\n`function`必須包括下述參數。\n\n`function(value [, index [, array]])`"
},
"$reduce": {
"args": "array, function [, init]",
"desc": "將`function`依次應用於陣列中的各要素值。 其中,前一個要素值的計算結果將參與到下一次的函數運算中。。\n\n函數`function`接受兩個參數並作為中綴標記法中的操作符。\n\n可省略的參數`init`將作為運算的初始值。"
},
"$flowContext": {
"args": "string",
"desc": "獲取流上下文(流等級的上下文,可以讓所有節點共用)的屬性。"
},
"$globalContext": {
"args": "string",
"desc": "獲取全域上下文的屬性。"
},
"$pad": {
"args": "string, width [, char]",
"desc": "根據需要,向字串`string`的副本中填充文字使該字串的字數達到`width`的絕對值並返回填充文字後的字串。\n\n如果`width`的值為正,則向字串`string`的右側填充文字,如果`width`為負,則向字串`string`的左側填充文字。\n\n可選參數`char`用來指定填充的文字。如果未指定該參數,則填充空白文字。"
},
"$fromMillis": {
"args": "number",
"desc": "將表示從UNIX時間 (1970年1月1日 UTC/GMT的午夜開始到現在的毫秒數的數值轉換成ISO 8601形式時間戳記的字串。"
},
"$formatNumber": {
"args": "number, picture [, options]",
"desc": "將`number`轉換成具有`picture`所指定的數值格式的字串。\n\n此函數的功能與XPath F&O 3.1規格中定義的XPath/XQuery函數的fn:format-number功能相一致。參數`picture`用於指定數值的轉換格式其語法與fn:format-number中的定義一致。\n\n可選的第三參數`options`用來覆蓋預設的局部環境格式如小數點分隔符號。如果指定該參數那麼該參數必須是包含name/value對的物件並且name/value對必須符合XPath F&O 3.1規格中記述的數值格式。"
},
"$formatBase": {
"args": "number [, radix]",
"desc": "將`number`變換為以參數`radix`的值為基數形式的字串。如果不指定`radix`的值則默認基數為10。指定的`radix`值必須在236之間否則拋出錯誤。"
},
"$toMillis": {
"args": "timestamp",
"desc": "將ISO 8601格式的字串`timestamp`轉換為從UNIX時間 (1970年1月1日 UTC/GMT的午夜開始到現在的毫秒數。如果該字串的格式不正確則拋出錯誤。"
}
}

View File

@ -1,6 +1,6 @@
{ {
"name": "@node-red/editor-client", "name": "@node-red/editor-client",
"version": "1.0.0-beta.2", "version": "1.0.3",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,4 +1,4 @@
ace.define("ace/snippets/nrjavascript",[],function(e,t,n){"use strict";t.snippetText=undefined,t.scope="nrjavascript"}); ace.define("ace/snippets/nrjavascript",[],function(e,t,n){"use strict";t.snippetText='# Prototype\nsnippet proto\n ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {\n ${4:// body...}\n };\n# Function\nsnippet fun\n function ${1?:function_name}(${2:argument}) {\n ${3:// body...}\n }\n# Anonymous Function\nregex /((=)\\s*|(:)\\s*|(\\()|\\b)/f/(\\))?/\nsnippet f\n function${M1?: ${1:functionName}}($2) {\n ${0:$TM_SELECTED_TEXT}\n }${M2?;}${M3?,}${M4?)}\n# Immediate function\ntrigger \\(?f\\(\nendTrigger \\)?\nsnippet f(\n (function(${1}) {\n ${0:${TM_SELECTED_TEXT:/* code */}}\n }(${1}));\n# if\nsnippet if\n if (${1:true}) {\n ${0}\n }\n# if ... else\nsnippet ife\n if (${1:true}) {\n ${2}\n } else {\n ${0}\n }\n# tertiary conditional\nsnippet ter\n ${1:/* condition */} ? ${2:a} : ${3:b}\n# switch\nsnippet switch\n switch (${1:expression}) {\n case \'${3:case}\':\n ${4:// code}\n break;\n ${5}\n default:\n ${2:// code}\n }\n# case\nsnippet case\n case \'${1:case}\':\n ${2:// code}\n break;\n ${3}\n\n# while (...) {...}\nsnippet wh\n while (${1:/* condition */}) {\n ${0:/* code */}\n }\n# try\nsnippet try\n try {\n ${0:/* code */}\n } catch (e) {}\n# do...while\nsnippet do\n do {\n ${2:/* code */}\n } while (${1:/* condition */});\n# Object Method\nsnippet :f\nregex /([,{[])|^\\s*/:f/\n ${1:method_name}: function(${2:attribute}) {\n ${0}\n }${3:,}\n# setTimeout function\nsnippet setTimeout\nregex /\\b/st|timeout|setTimeo?u?t?/\n setTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});\n# console.log (Firebug)\nsnippet cl\n console.log(${1});\n# return\nsnippet ret\n return ${1:result}\n# for (property in object ) { ... }\nsnippet fori\n for (var ${1:prop} in ${2:Things}) {\n ${0:$2[$1]}\n }\n# hasOwnProperty\nsnippet has\n hasOwnProperty(${1})\n# docstring\nsnippet /**\n /**\n * ${1:description}\n *\n */\nsnippet @par\nregex /^\\s*\\*\\s*/@(para?m?)?/\n @param {${1:type}} ${2:name} ${3:description}\nsnippet @ret\n @return {${1:type}} ${2:description}\n# JSON.parse\nsnippet jsonp\n JSON.parse(${1:jstr});\n# JSON.stringify\nsnippet jsons\n JSON.stringify(${1:object});\n# self-defining function\nsnippet sdf\n var ${1:function_name} = function(${2:argument}) {\n ${3:// initial code ...}\n\n $1 = function($2) {\n ${4:// main code}\n };\n }\n# \nsnippet for-\n for (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {\n ${0:${2:Things}[${1:i}];}\n }\n# for (...) {...}\nsnippet for\n for (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {\n ${3:$2[$1]}$0\n }\n# for (...) {...} (Improved Native For-Loop)\nsnippet forr\n for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {\n ${3:$2[$1]}$0\n }\n# Node-RED Specific Funcs\nsnippet nodes\n node.send(${1:msg})\nsnippet clone\n RED.util.cloneMessage(${1:msg})\nsnippet nodel\n node.log($1)\nsnippet nodew\n node.warn($1)\nsnippet nodee\n node.error($1)\nsnippet noded\n node.debug($1)\nsnippet done\n node.done($1)\nsnippet flowg\n flow.get($1)\nsnippet flows\n flow.set($1, $2)\nsnippet globalg\n global.get($1)\nsnippet globals\n global.set($1, $2)\n',t.scope="nrjavascript"});
(function() { (function() {
ace.require(["ace/snippets/nrjavascript"], function(m) { ace.require(["ace/snippets/nrjavascript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) { if (typeof module == "object" && typeof exports == "object" && module) {
@ -6,4 +6,3 @@ ace.define("ace/snippets/nrjavascript",[],function(e,t,n){"use strict";t.snippet
} }
}); });
})(); })();

View File

@ -1 +1 @@
<svg width="40" height="60" xmlns="http://www.w3.org/2000/svg"><path d="M18 5v12H7v26h11v12l14-25z" fill="#fff"/></svg> <svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M18 5v12H7v26h11v12l14-25z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 143 B

View File

@ -1 +1 @@
<svg width="40" height="40" xmlns="http://www.w3.org/2000/svg"><path d="M25 16h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1h-7c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zM8 28h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1H8c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zm-.416 11C5.624 39 4 37.375 4 35.416V4.582C4 2.622 5.625 1 7.584 1h24.832C34.376 1 36 2.623 36 4.582v30.834C36 37.376 34.375 39 32.416 39zM32 27H19c0 2.19-1.81 4-4 4H7v4.416c0 .35.235.584.584.584h24.832c.35 0 .584-.235.584-.584v-8.417zm1-2v-6h-8c-2.19 0-4-1.81-4-4h-1c-4.333-.002-8.667.004-13 0v6h8c2.19 0 4 1.81 4 4h13zm0-16V4.582c0-.35-.235-.582-.584-.582H7.584C7.234 4 7 4.233 7 4.582v8.417c4.333.002 8.667.001 13 .001h1c0-2.19 1.81-4 4-4z" color="#000" fill="#333"/></svg> <svg width="40" height="40" viewBox="0, 0, 40, 40" xmlns="http://www.w3.org/2000/svg"><path d="M25 16h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1h-7c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zM8 28h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1H8c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zm-.416 11C5.624 39 4 37.375 4 35.416V4.582C4 2.622 5.625 1 7.584 1h24.832C34.376 1 36 2.623 36 4.582v30.834C36 37.376 34.375 39 32.416 39zM32 27H19c0 2.19-1.81 4-4 4H7v4.416c0 .35.235.584.584.584h24.832c.35 0 .584-.235.584-.584v-8.417zm1-2v-6h-8c-2.19 0-4-1.81-4-4h-1c-4.333-.002-8.667.004-13 0v6h8c2.19 0 4 1.81 4 4h13zm0-16V4.582c0-.35-.235-.582-.584-.582H7.584C7.234 4 7 4.233 7 4.582v8.417c4.333.002 8.667.001 13 .001h1c0-2.19 1.81-4 4-4z" color="#000" fill="#333"/></svg>

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 732 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M14.16 27.38l1.555-.144c.132.731.383 1.261.755 1.591.371.33.848.494 1.429.494.497 0 .931-.114 1.303-.341.377-.228.686-.53.926-.908.24-.383.44-.899.602-1.546a8.122 8.122 0 0 0 .233-2.3 3.732 3.732 0 0 1-1.33 1.258 3.605 3.605 0 0 1-1.815.476c-1.09 0-2.013-.395-2.768-1.186s-1.133-1.834-1.133-3.128c0-1.336.393-2.411 1.178-3.226.79-.815 1.78-1.223 2.966-1.223.856 0 1.638.231 2.345.692.713.462 1.253 1.12 1.618 1.978.372.85.557 2.085.557 3.702 0 1.684-.182 3.026-.548 4.027-.365.994-.91 1.752-1.636 2.274-.719.52-1.563.781-2.534.781-1.03 0-1.872-.284-2.525-.853-.654-.576-1.046-1.381-1.178-2.418zm6.624-5.815c0-.928-.249-1.666-.746-2.21-.492-.546-1.085-.819-1.78-.819-.719 0-1.345.294-1.878.881s-.8 1.348-.8 2.283c0 .839.252 1.522.755 2.05.51.52 1.135.781 1.878.781.75 0 1.363-.26 1.843-.782.485-.527.728-1.255.728-2.184zM4.858 10.466c0-1.558.158-2.81.476-3.757.324-.952.8-1.686 1.429-2.201.635-.516 1.432-.773 2.39-.773.708 0 1.328.143 1.861.431.533.282.974.692 1.321 1.231.348.534.62 1.187.818 1.96.198.767.297 1.803.297 3.11 0 1.545-.16 2.794-.477 3.747-.317.947-.794 1.68-1.429 2.202-.629.515-1.426.773-2.39.773-1.27 0-2.268-.456-2.993-1.366-.869-1.097-1.303-2.882-1.303-5.357zm1.662 0c0 2.163.252 3.604.755 4.323.51.713 1.136 1.07 1.879 1.07.743 0 1.366-.36 1.87-1.079.508-.719.763-2.157.763-4.314 0-2.169-.255-3.61-.764-4.323-.503-.713-1.132-1.07-1.887-1.07-.743 0-1.336.315-1.78.944-.557.803-.836 2.286-.836 4.45z" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M14.16 27.38l1.555-.144c.132.731.383 1.261.755 1.591.371.33.848.494 1.429.494.497 0 .931-.114 1.303-.341.377-.228.686-.53.926-.908.24-.383.44-.899.602-1.546a8.122 8.122 0 0 0 .233-2.3 3.732 3.732 0 0 1-1.33 1.258 3.605 3.605 0 0 1-1.815.476c-1.09 0-2.013-.395-2.768-1.186s-1.133-1.834-1.133-3.128c0-1.336.393-2.411 1.178-3.226.79-.815 1.78-1.223 2.966-1.223.856 0 1.638.231 2.345.692.713.462 1.253 1.12 1.618 1.978.372.85.557 2.085.557 3.702 0 1.684-.182 3.026-.548 4.027-.365.994-.91 1.752-1.636 2.274-.719.52-1.563.781-2.534.781-1.03 0-1.872-.284-2.525-.853-.654-.576-1.046-1.381-1.178-2.418zm6.624-5.815c0-.928-.249-1.666-.746-2.21-.492-.546-1.085-.819-1.78-.819-.719 0-1.345.294-1.878.881s-.8 1.348-.8 2.283c0 .839.252 1.522.755 2.05.51.52 1.135.781 1.878.781.75 0 1.363-.26 1.843-.782.485-.527.728-1.255.728-2.184zM4.858 10.466c0-1.558.158-2.81.476-3.757.324-.952.8-1.686 1.429-2.201.635-.516 1.432-.773 2.39-.773.708 0 1.328.143 1.861.431.533.282.974.692 1.321 1.231.348.534.62 1.187.818 1.96.198.767.297 1.803.297 3.11 0 1.545-.16 2.794-.477 3.747-.317.947-.794 1.68-1.429 2.202-.629.515-1.426.773-2.39.773-1.27 0-2.268-.456-2.993-1.366-.869-1.097-1.303-2.882-1.303-5.357zm1.662 0c0 2.163.252 3.604.755 4.323.51.713 1.136 1.07 1.879 1.07.743 0 1.366-.36 1.87-1.079.508-.719.763-2.157.763-4.314 0-2.169-.255-3.61-.764-4.323-.503-.713-1.132-1.07-1.887-1.07-.743 0-1.336.315-1.78.944-.557.803-.836 2.286-.836 4.45z" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M13.27 29.15l6.733-8.143h-6.235V19.3h8.8v1.559l-6.69 8.09h6.892v1.707h-9.5zm4.909-10.125zM6.577 12.58q0 .827.604 1.304.605.478 1.432.478 1.007 0 1.95-.467 1.59-.774 1.59-2.534V9.824q-.349.222-.9.37-.552.15-1.082.213l-1.155.148q-1.04.138-1.56.435-.88.498-.88 1.59zM11.2 8.721q.657-.085.88-.551.127-.255.127-.732 0-.975-.7-1.41-.689-.445-1.983-.445-1.495 0-2.12.805-.35.446-.456 1.326H5.167q.053-2.1 1.357-2.916 1.315-.827 3.043-.827 2.004 0 3.255.763 1.24.764 1.24 2.375v6.542q0 .297.117.477.127.18.52.18.127 0 .286-.01.159-.021.34-.053v1.41q-.446.127-.68.16-.233.031-.636.031-.986 0-1.43-.7-.234-.37-.33-1.05-.583.764-1.675 1.326t-2.407.562q-1.58 0-2.587-.954-.996-.965-.996-2.407 0-1.58.986-2.45.986-.869 2.587-1.07zm-1.58-4.75z" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M13.27 29.15l6.733-8.143h-6.235V19.3h8.8v1.559l-6.69 8.09h6.892v1.707h-9.5zm4.909-10.125zM6.577 12.58q0 .827.604 1.304.605.478 1.432.478 1.007 0 1.95-.467 1.59-.774 1.59-2.534V9.824q-.349.222-.9.37-.552.15-1.082.213l-1.155.148q-1.04.138-1.56.435-.88.498-.88 1.59zM11.2 8.721q.657-.085.88-.551.127-.255.127-.732 0-.975-.7-1.41-.689-.445-1.983-.445-1.495 0-2.12.805-.35.446-.456 1.326H5.167q.053-2.1 1.357-2.916 1.315-.827 3.043-.827 2.004 0 3.255.763 1.24.764 1.24 2.375v6.542q0 .297.117.477.127.18.52.18.127 0 .286-.01.159-.021.34-.053v1.41q-.446.127-.68.16-.233.031-.636.031-.986 0-1.43-.7-.234-.37-.33-1.05-.583.764-1.675 1.326t-2.407.562q-1.58 0-2.587-.954-.996-.965-.996-2.407 0-1.58.986-2.45.986-.869 2.587-1.07zm-1.58-4.75z" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 846 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M18.8 33.9c3.328 0 4.776-2.603 4.776-7.066s-1.448-7.066-4.776-7.066-4.776 2.603-4.776 7.066S15.473 33.9 18.8 33.9zm0-1.429c-2.192 0-3.073-1.781-3.073-4.522v-2.23c0-2.741.88-4.523 3.073-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.88 4.522-3.073 4.522zm-6.306 1.194v-1.429H8.892V20.002H6.328l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02H3.333v1.429zm11.2-17.7v-1.429h-3.602V2.302h-2.564l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02h-3.915v1.429zM7.5 16.2c3.327 0 4.776-2.603 4.776-7.066S10.828 2.068 7.5 2.068 2.725 4.67 2.725 9.134 4.173 16.2 7.5 16.2zm0-1.429c-2.193 0-3.074-1.781-3.074-4.522V8.02c0-2.741.881-4.523 3.074-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.881 4.522-3.073 4.522z" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M18.8 33.9c3.328 0 4.776-2.603 4.776-7.066s-1.448-7.066-4.776-7.066-4.776 2.603-4.776 7.066S15.473 33.9 18.8 33.9zm0-1.429c-2.192 0-3.073-1.781-3.073-4.522v-2.23c0-2.741.88-4.523 3.073-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.88 4.522-3.073 4.522zm-6.306 1.194v-1.429H8.892V20.002H6.328l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02H3.333v1.429zm11.2-17.7v-1.429h-3.602V2.302h-2.564l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02h-3.915v1.429zM7.5 16.2c3.327 0 4.776-2.603 4.776-7.066S10.828 2.068 7.5 2.068 2.725 4.67 2.725 9.134 4.173 16.2 7.5 16.2zm0-1.429c-2.193 0-3.074-1.781-3.074-4.522V8.02c0-2.741.881-4.523 3.074-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.881 4.522-3.073 4.522z" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 805 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M9.96 21.98a5 5 0 1 1 6.11-7.917zm3.035-13.973c-5.512 0-10 4.488-10 10s4.488 9.998 10 9.998 10-4.486 10-9.998-4.488-10-10-10zm0 1.816c4.53 0 8.182 3.655 8.182 8.184s-3.652 8.182-8.182 8.182-8.181-3.653-8.181-8.182 3.652-8.184 8.181-8.184z" color="#000" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M9.96 21.98a5 5 0 1 1 6.11-7.917zm3.035-13.973c-5.512 0-10 4.488-10 10s4.488 9.998 10 9.998 10-4.486 10-9.998-4.488-10-10-10zm0 1.816c4.53 0 8.182 3.655 8.182 8.184s-3.652 8.182-8.182 8.182-8.181-3.653-8.181-8.182 3.652-8.184 8.181-8.184z" color="#000" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 368 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M14.33 27.19q2.916-.136 4.024-2.131.58-1.024.58-2.37 0-2.132-1.569-3.24-.904-.648-3.035-1.228zM8.55 10.736q0 1.688 1.108 2.643 1.125.955 3.018 1.33V6.695q-2.234.085-3.189 1.364-.937 1.279-.937 2.677zm-3.07.205q0-2.592 1.893-4.672 1.91-2.08 5.337-2.115V1.887h1.62V4.12q3.393.239 5.2 2.012 1.825 1.757 1.91 4.655h-2.984q-.119-1.296-.699-2.233-1.074-1.723-3.427-1.808v8.287q3.956 1.108 5.371 2.08 2.302 1.603 2.302 4.74 0 4.536-2.95 6.446-1.637 1.057-4.723 1.398v3.308h-1.62v-3.308q-4.962-.324-6.735-3.513-.972-1.722-.972-4.655h3.018q.136 2.336.733 3.41 1.057 1.927 3.922 2.166v-9.293q-3.683-.699-5.44-2.336Q5.48 13.84 5.48 10.941z" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M14.33 27.19q2.916-.136 4.024-2.131.58-1.024.58-2.37 0-2.132-1.569-3.24-.904-.648-3.035-1.228zM8.55 10.736q0 1.688 1.108 2.643 1.125.955 3.018 1.33V6.695q-2.234.085-3.189 1.364-.937 1.279-.937 2.677zm-3.07.205q0-2.592 1.893-4.672 1.91-2.08 5.337-2.115V1.887h1.62V4.12q3.393.239 5.2 2.012 1.825 1.757 1.91 4.655h-2.984q-.119-1.296-.699-2.233-1.074-1.723-3.427-1.808v8.287q3.956 1.108 5.371 2.08 2.302 1.603 2.302 4.74 0 4.536-2.95 6.446-1.637 1.057-4.723 1.398v3.308h-1.62v-3.308q-4.962-.324-6.735-3.513-.972-1.722-.972-4.655h3.018q.136 2.336.733 3.41 1.057 1.927 3.922 2.166v-9.293q-3.683-.699-5.44-2.336Q5.48 13.84 5.48 10.941z" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 745 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-337.103 -913.25) scale(1.2585)" fill="#444" stroke-width=".795"><circle cx="284.36" cy="733.68" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><circle cx="284.33" cy="740.74" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><path d="M276.18 727.78l4.396-1.565v18.515c-.711 2.606-2.922 4.394-5.812 5.812l-4.135 1.974-.559-1.192 3.353-1.639c1.459-.724 2.689-1.87 2.869-4.955z" fill-rule="evenodd"/></g></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-337.103 -913.25) scale(1.2585)" fill="#444" stroke-width=".795"><circle cx="284.36" cy="733.68" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><circle cx="284.33" cy="740.74" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><path d="M276.18 727.78l4.396-1.565v18.515c-.711 2.606-2.922 4.394-5.812 5.812l-4.135 1.974-.559-1.192 3.353-1.639c1.459-.724 2.689-1.87 2.869-4.955z" fill-rule="evenodd"/></g></svg>

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 556 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M15 5.225v-1.92h2.24q.608 0 1.216.288.608.256 1.12.8.48.512.8 1.312.32.768.32 1.792v5.824q0 .832.224 1.536t.608 1.216q.352.48.832.768.48.256.992.256v2.176q-.512 0-.992.256t-.832.736q-.384.48-.608 1.184t-.224 1.568v5.792q0 1.024-.32 1.792-.32.8-.8 1.312-.512.544-1.12.8-.608.288-1.216.288H15v-1.92h1.6q.48 0 .768-.256.288-.224.48-.64.16-.384.224-.896.064-.48.064-.96v-5.824q0-1.216.352-2.016.32-.8.768-1.28.448-.512.928-.736.448-.224.736-.256v-.096q-.288-.064-.736-.32-.48-.256-.928-.768t-.768-1.28q-.352-.8-.352-1.92V7.977q0-.512-.064-.992-.064-.512-.224-.896-.192-.384-.48-.608-.288-.256-.768-.256zm-3.648 0v-1.92h-2.24q-.608 0-1.216.288-.608.256-1.12.8-.48.512-.8 1.312-.32.768-.32 1.792v5.824q0 .832-.224 1.536t-.608 1.216q-.352.48-.832.768-.48.256-.992.256v2.176q.512 0 .992.256t.832.736q.384.48.608 1.184t.224 1.568v5.792q0 1.024.32 1.792.32.8.8 1.312.512.544 1.12.8.608.288 1.216.288h2.24v-1.92h-1.6q-.48 0-.768-.256-.288-.224-.48-.64-.16-.384-.224-.896-.064-.48-.064-.96v-5.824q0-1.216-.352-2.016-.32-.8-.768-1.28-.448-.512-.928-.736-.448-.224-.736-.256v-.096q.288-.064.736-.32.48-.256.928-.768t.768-1.28q.352-.8.352-1.92V7.977q0-.512.064-.992.064-.512.224-.896.192-.384.48-.608.288-.256.768-.256z" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M15 5.225v-1.92h2.24q.608 0 1.216.288.608.256 1.12.8.48.512.8 1.312.32.768.32 1.792v5.824q0 .832.224 1.536t.608 1.216q.352.48.832.768.48.256.992.256v2.176q-.512 0-.992.256t-.832.736q-.384.48-.608 1.184t-.224 1.568v5.792q0 1.024-.32 1.792-.32.8-.8 1.312-.512.544-1.12.8-.608.288-1.216.288H15v-1.92h1.6q.48 0 .768-.256.288-.224.48-.64.16-.384.224-.896.064-.48.064-.96v-5.824q0-1.216.352-2.016.32-.8.768-1.28.448-.512.928-.736.448-.224.736-.256v-.096q-.288-.064-.736-.32-.48-.256-.928-.768t-.768-1.28q-.352-.8-.352-1.92V7.977q0-.512-.064-.992-.064-.512-.224-.896-.192-.384-.48-.608-.288-.256-.768-.256zm-3.648 0v-1.92h-2.24q-.608 0-1.216.288-.608.256-1.12.8-.48.512-.8 1.312-.32.768-.32 1.792v5.824q0 .832-.224 1.536t-.608 1.216q-.352.48-.832.768-.48.256-.992.256v2.176q.512 0 .992.256t.832.736q.384.48.608 1.184t.224 1.568v5.792q0 1.024.32 1.792.32.8.8 1.312.512.544 1.12.8.608.288 1.216.288h2.24v-1.92h-1.6q-.48 0-.768-.256-.288-.224-.48-.64-.16-.384-.224-.896-.064-.48-.064-.96v-5.824q0-1.216-.352-2.016-.32-.8-.768-1.28-.448-.512-.928-.736-.448-.224-.736-.256v-.096q.288-.064.736-.32.48-.256.928-.768t.768-1.28q.352-.8.352-1.92V7.977q0-.512.064-.992.064-.512.224-.896.192-.384.48-.608.288-.256.768-.256z" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M2 19h5v5H2zm16.099-3.304v-5.659h-2.654v5.66l-5.309-2.004-.901 2.404L14.543 18l-3.255 4.557 2.254 1.553 3.255-4.808 3.455 4.808 2.054-1.553L19 18l5.46-1.903-1.002-2.404z" color="#000" fill="#444444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M2 19h5v5H2zm16.099-3.304v-5.659h-2.654v5.66l-5.309-2.004-.901 2.404L14.543 18l-3.255 4.557 2.254 1.553 3.255-4.808 3.455 4.808 2.054-1.553L19 18l5.46-1.903-1.002-2.404z" color="#000" fill="#444444"/></svg>

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 302 B

View File

@ -1 +1 @@
<svg width="26" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M11 5v5.77a7.542 7.542 0 0 0-5.234 5.25L1 16c-1.432 1.397-1.232 2.722 0 4l4.75-.078a7.542 7.542 0 0 0 5.22 5.297L11 31c1.316 1.303 2.649 1.363 4 0l.009-5.775A7.542 7.542 0 0 0 20.228 20H25c1.261-1.294 1.404-2.623 0-4l-4.774-.01a7.542 7.542 0 0 0-5.23-5.22L15 5c-1.3-1.273-2.63-1.393-4 0zm2 7.499c3.05 0 5.5 2.45 5.5 5.5s-2.45 5.5-5.5 5.5-5.5-2.45-5.5-5.5 2.45-5.5 5.5-5.5z" color="#000" fill="#444"/></svg> <svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M11 5v5.77a7.542 7.542 0 0 0-5.234 5.25L1 16c-1.432 1.397-1.232 2.722 0 4l4.75-.078a7.542 7.542 0 0 0 5.22 5.297L11 31c1.316 1.303 2.649 1.363 4 0l.009-5.775A7.542 7.542 0 0 0 20.228 20H25c1.261-1.294 1.404-2.623 0-4l-4.774-.01a7.542 7.542 0 0 0-5.23-5.22L15 5c-1.3-1.273-2.63-1.393-4 0zm2 7.499c3.05 0 5.5 2.45 5.5 5.5s-2.45 5.5-5.5 5.5-5.5-2.45-5.5-5.5 2.45-5.5 5.5-5.5z" color="#000" fill="#444"/></svg>

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 502 B

View File

@ -14,7 +14,8 @@
* limitations under the License. * limitations under the License.
**/ **/
RED.history = (function() { RED.history = (function() {
var undo_history = []; var undoHistory = [];
var redoHistory = [];
function undoEvent(ev) { function undoEvent(ev) {
var i; var i;
@ -22,52 +23,81 @@ RED.history = (function() {
var node; var node;
var subflow; var subflow;
var modifiedTabs = {}; var modifiedTabs = {};
var inverseEv;
if (ev) { if (ev) {
if (ev.t == 'multi') { if (ev.t == 'multi') {
inverseEv = {
t: 'multi',
events: []
};
len = ev.events.length; len = ev.events.length;
for (i=len-1;i>=0;i--) { for (i=len-1;i>=0;i--) {
undoEvent(ev.events[i]); var r = undoEvent(ev.events[i]);
inverseEv.events.push(r);
} }
} else if (ev.t == 'replace') { } else if (ev.t == 'replace') {
inverseEv = {
t: 'replace',
config: RED.nodes.createCompleteNodeSet(),
changed: {},
rev: RED.nodes.version()
};
RED.nodes.clear(); RED.nodes.clear();
var imported = RED.nodes.import(ev.config); var imported = RED.nodes.import(ev.config);
imported[0].forEach(function(n) { imported[0].forEach(function(n) {
if (ev.changed[n.id]) { if (ev.changed[n.id]) {
n.changed = true; n.changed = true;
inverseEv.changed[n.id] = true;
} }
}) })
RED.nodes.version(ev.rev); RED.nodes.version(ev.rev);
} else if (ev.t == 'add') { } else if (ev.t == 'add') {
inverseEv = {
t: "delete",
};
if (ev.nodes) { if (ev.nodes) {
inverseEv.nodes = [];
for (i=0;i<ev.nodes.length;i++) { for (i=0;i<ev.nodes.length;i++) {
node = RED.nodes.node(ev.nodes[i]); node = RED.nodes.node(ev.nodes[i]);
if (node.z) { if (node.z) {
modifiedTabs[node.z] = true; modifiedTabs[node.z] = true;
} }
inverseEv.nodes.push(node);
RED.nodes.remove(ev.nodes[i]); RED.nodes.remove(ev.nodes[i]);
} }
} }
if (ev.links) { if (ev.links) {
inverseEv.links = [];
for (i=0;i<ev.links.length;i++) { for (i=0;i<ev.links.length;i++) {
inverseEv.links.push(ev.links[i]);
RED.nodes.removeLink(ev.links[i]); RED.nodes.removeLink(ev.links[i]);
} }
} }
if (ev.workspaces) { if (ev.workspaces) {
inverseEv.workspaces = [];
for (i=0;i<ev.workspaces.length;i++) { for (i=0;i<ev.workspaces.length;i++) {
var workspaceOrder = RED.nodes.getWorkspaceOrder();
ev.workspaces[i]._index = workspaceOrder.indexOf(ev.workspaces[i].id);
inverseEv.workspaces.push(ev.workspaces[i]);
RED.nodes.removeWorkspace(ev.workspaces[i].id); RED.nodes.removeWorkspace(ev.workspaces[i].id);
RED.workspaces.remove(ev.workspaces[i]); RED.workspaces.remove(ev.workspaces[i]);
} }
} }
if (ev.subflows) { if (ev.subflows) {
inverseEv.subflows = [];
for (i=0;i<ev.subflows.length;i++) { for (i=0;i<ev.subflows.length;i++) {
inverseEv.subflows.push(ev.subflows[i]);
RED.nodes.removeSubflow(ev.subflows[i]); RED.nodes.removeSubflow(ev.subflows[i]);
RED.workspaces.remove(ev.subflows[i]); RED.workspaces.remove(ev.subflows[i]);
} }
} }
if (ev.subflow) { if (ev.subflow) {
inverseEv.subflow = {};
if (ev.subflow.instances) { if (ev.subflow.instances) {
inverseEv.subflow.instances = [];
ev.subflow.instances.forEach(function(n) { ev.subflow.instances.forEach(function(n) {
inverseEv.subflow.instances.push(n);
var node = RED.nodes.node(n.id); var node = RED.nodes.node(n.id);
if (node) { if (node) {
node.changed = n.changed; node.changed = n.changed;
@ -83,21 +113,30 @@ RED.history = (function() {
} }
} }
if (ev.removedLinks) { if (ev.removedLinks) {
inverseEv.createdLinks = [];
for (i=0;i<ev.removedLinks.length;i++) { for (i=0;i<ev.removedLinks.length;i++) {
inverseEv.createdLinks.push(ev.removedLinks[i]);
RED.nodes.addLink(ev.removedLinks[i]); RED.nodes.addLink(ev.removedLinks[i]);
} }
} }
} else if (ev.t == "delete") { } else if (ev.t == "delete") {
inverseEv = {
t: "add"
};
if (ev.workspaces) { if (ev.workspaces) {
inverseEv.workspaces = [];
for (i=0;i<ev.workspaces.length;i++) { for (i=0;i<ev.workspaces.length;i++) {
inverseEv.workspaces.push(ev.workspaces[i]);
RED.nodes.addWorkspace(ev.workspaces[i],ev.workspaces[i]._index); RED.nodes.addWorkspace(ev.workspaces[i],ev.workspaces[i]._index);
RED.workspaces.add(ev.workspaces[i],undefined,ev.workspaces[i]._index); RED.workspaces.add(ev.workspaces[i],undefined,ev.workspaces[i]._index);
delete ev.workspaces[i]._index; delete ev.workspaces[i]._index;
} }
} }
if (ev.subflows) { if (ev.subflows) {
inverseEv.subflows = [];
for (i=0;i<ev.subflows.length;i++) { for (i=0;i<ev.subflows.length;i++) {
inverseEv.subflows.push(ev.subflows[i]);
RED.nodes.addSubflow(ev.subflows[i]); RED.nodes.addSubflow(ev.subflows[i]);
} }
} }
@ -126,8 +165,11 @@ RED.history = (function() {
} }
} }
if (ev.subflow) { if (ev.subflow) {
inverseEv.subflow = {};
if (ev.subflow.hasOwnProperty('instances')) { if (ev.subflow.hasOwnProperty('instances')) {
inverseEv.subflow.instances = [];
ev.subflow.instances.forEach(function(n) { ev.subflow.instances.forEach(function(n) {
inverseEv.subflow.instances.push(n);
var node = RED.nodes.node(n.id); var node = RED.nodes.node(n.id);
if (node) { if (node) {
node.changed = n.changed; node.changed = n.changed;
@ -152,14 +194,25 @@ RED.history = (function() {
}); });
} }
if (ev.nodes) { if (ev.nodes) {
inverseEv.nodes = [];
for (i=0;i<ev.nodes.length;i++) { for (i=0;i<ev.nodes.length;i++) {
RED.nodes.add(ev.nodes[i]); RED.nodes.add(ev.nodes[i]);
modifiedTabs[ev.nodes[i].z] = true; modifiedTabs[ev.nodes[i].z] = true;
inverseEv.nodes.push(ev.nodes[i].id);
} }
} }
if (ev.links) { if (ev.links) {
inverseEv.links = [];
for (i=0;i<ev.links.length;i++) { for (i=0;i<ev.links.length;i++) {
RED.nodes.addLink(ev.links[i]); RED.nodes.addLink(ev.links[i]);
inverseEv.links.push(ev.links[i]);
}
}
if (ev.createdLinks) {
inverseEv.removedLinks = [];
for (i=0;i<ev.createdLinks.length;i++) {
inverseEv.removedLinks.push(ev.createdLinks[i]);
RED.nodes.removeLink(ev.createdLinks[i]);
} }
} }
if (ev.changes) { if (ev.changes) {
@ -179,8 +232,14 @@ RED.history = (function() {
} }
} else if (ev.t == "move") { } else if (ev.t == "move") {
inverseEv = {
t: 'move',
nodes: []
};
for (i=0;i<ev.nodes.length;i++) { for (i=0;i<ev.nodes.length;i++) {
var n = ev.nodes[i]; var n = ev.nodes[i];
var rn = {n: n.n, ox: n.n.x, oy: n.n.y, dirty: true, moved: n.moved};
inverseEv.nodes.push(rn);
n.n.x = n.ox; n.n.x = n.ox;
n.n.y = n.oy; n.n.y = n.oy;
n.n.dirty = true; n.n.dirty = true;
@ -188,18 +247,28 @@ RED.history = (function() {
} }
// A move could have caused a link splice // A move could have caused a link splice
if (ev.links) { if (ev.links) {
inverseEv.removedLinks = [];
for (i=0;i<ev.links.length;i++) { for (i=0;i<ev.links.length;i++) {
inverseEv.removedLinks.push(ev.links[i]);
RED.nodes.removeLink(ev.links[i]); RED.nodes.removeLink(ev.links[i]);
} }
} }
if (ev.removedLinks) { if (ev.removedLinks) {
inverseEv.links = [];
for (i=0;i<ev.removedLinks.length;i++) { for (i=0;i<ev.removedLinks.length;i++) {
inverseEv.links.push(ev.removedLinks[i]);
RED.nodes.addLink(ev.removedLinks[i]); RED.nodes.addLink(ev.removedLinks[i]);
} }
} }
} else if (ev.t == "edit") { } else if (ev.t == "edit") {
inverseEv = {
t: "edit",
changes: {}
};
inverseEv.node = ev.node;
for (i in ev.changes) { for (i in ev.changes) {
if (ev.changes.hasOwnProperty(i)) { if (ev.changes.hasOwnProperty(i)) {
inverseEv.changes[i] = ev.node[i];
if (ev.node._def.defaults && ev.node._def.defaults[i] && ev.node._def.defaults[i].type) { if (ev.node._def.defaults && ev.node._def.defaults[i] && ev.node._def.defaults[i].type) {
// This is a config node property // This is a config node property
var currentConfigNode = RED.nodes.node(ev.node[i]); var currentConfigNode = RED.nodes.node(ev.node[i]);
@ -219,22 +288,29 @@ RED.history = (function() {
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled",!!ev.node.disabled); $("#red-ui-workspace").toggleClass("red-ui-workspace-disabled",!!ev.node.disabled);
} }
if (ev.subflow) { if (ev.subflow) {
inverseEv.subflow = {};
if (ev.subflow.hasOwnProperty('inputCount')) { if (ev.subflow.hasOwnProperty('inputCount')) {
inverseEv.subflow.inputCount = ev.node.in.length;
if (ev.node.in.length > ev.subflow.inputCount) { if (ev.node.in.length > ev.subflow.inputCount) {
inverseEv.subflow.inputs = ev.node.in.slice(ev.subflow.inputCount);
ev.node.in.splice(ev.subflow.inputCount); ev.node.in.splice(ev.subflow.inputCount);
} else if (ev.subflow.inputs.length > 0) { } else if (ev.subflow.inputs.length > 0) {
ev.node.in = ev.node.in.concat(ev.subflow.inputs); ev.node.in = ev.node.in.concat(ev.subflow.inputs);
} }
} }
if (ev.subflow.hasOwnProperty('outputCount')) { if (ev.subflow.hasOwnProperty('outputCount')) {
inverseEv.subflow.outputCount = ev.node.out.length;
if (ev.node.out.length > ev.subflow.outputCount) { if (ev.node.out.length > ev.subflow.outputCount) {
inverseEv.subflow.outputs = ev.node.out.slice(ev.subflow.outputCount);
ev.node.out.splice(ev.subflow.outputCount); ev.node.out.splice(ev.subflow.outputCount);
} else if (ev.subflow.outputs.length > 0) { } else if (ev.subflow.outputs.length > 0) {
ev.node.out = ev.node.out.concat(ev.subflow.outputs); ev.node.out = ev.node.out.concat(ev.subflow.outputs);
} }
} }
if (ev.subflow.hasOwnProperty('instances')) { if (ev.subflow.hasOwnProperty('instances')) {
inverseEv.subflow.instances = [];
ev.subflow.instances.forEach(function(n) { ev.subflow.instances.forEach(function(n) {
inverseEv.subflow.instances.push(n);
var node = RED.nodes.node(n.id); var node = RED.nodes.node(n.id);
if (node) { if (node) {
node.changed = n.changed; node.changed = n.changed;
@ -258,9 +334,11 @@ RED.history = (function() {
var outputMap; var outputMap;
if (ev.outputMap) { if (ev.outputMap) {
outputMap = {}; outputMap = {};
inverseEv.outputMap = {};
for (var port in ev.outputMap) { for (var port in ev.outputMap) {
if (ev.outputMap.hasOwnProperty(port) && ev.outputMap[port] !== "-1") { if (ev.outputMap.hasOwnProperty(port) && ev.outputMap[port] !== "-1") {
outputMap[ev.outputMap[port]] = port; outputMap[ev.outputMap[port]] = port;
inverseEv.outputMap[ev.outputMap[port]] = port;
} }
} }
} }
@ -268,39 +346,107 @@ RED.history = (function() {
RED.editor.validateNode(ev.node); RED.editor.validateNode(ev.node);
} }
if (ev.links) { if (ev.links) {
inverseEv.createdLinks = [];
for (i=0;i<ev.links.length;i++) { for (i=0;i<ev.links.length;i++) {
RED.nodes.addLink(ev.links[i]); RED.nodes.addLink(ev.links[i]);
inverseEv.createdLinks.push(ev.links[i]);
}
}
if (ev.createdLinks) {
inverseEv.links = [];
for (i=0;i<ev.createdLinks.length;i++) {
RED.nodes.removeLink(ev.createdLinks[i]);
inverseEv.links.push(ev.createdLinks[i]);
} }
} }
ev.node.dirty = true; ev.node.dirty = true;
ev.node.changed = ev.changed; ev.node.changed = ev.changed;
} else if (ev.t == "createSubflow") { } else if (ev.t == "createSubflow") {
inverseEv = {
t: "deleteSubflow",
activeWorkspace: ev.activeWorkspace,
dirty: RED.nodes.dirty()
};
if (ev.nodes) { if (ev.nodes) {
inverseEv.movedNodes = [];
var z = ev.activeWorkspace;
RED.nodes.filterNodes({z:ev.subflow.subflow.id}).forEach(function(n) { RED.nodes.filterNodes({z:ev.subflow.subflow.id}).forEach(function(n) {
n.x += ev.subflow.offsetX; n.x += ev.subflow.offsetX;
n.y += ev.subflow.offsetY; n.y += ev.subflow.offsetY;
n.z = ev.activeWorkspace;
n.dirty = true; n.dirty = true;
inverseEv.movedNodes.push(n.id);
RED.nodes.moveNodeToTab(n, z);
}); });
inverseEv.subflows = [];
for (i=0;i<ev.nodes.length;i++) { for (i=0;i<ev.nodes.length;i++) {
inverseEv.subflows.push(RED.nodes.node(ev.nodes[i]));
RED.nodes.remove(ev.nodes[i]); RED.nodes.remove(ev.nodes[i]);
} }
} }
if (ev.links) { if (ev.links) {
inverseEv.links = [];
for (i=0;i<ev.links.length;i++) { for (i=0;i<ev.links.length;i++) {
inverseEv.links.push(ev.links[i]);
RED.nodes.removeLink(ev.links[i]); RED.nodes.removeLink(ev.links[i]);
} }
} }
inverseEv.subflow = ev.subflow;
RED.nodes.removeSubflow(ev.subflow.subflow); RED.nodes.removeSubflow(ev.subflow.subflow);
RED.workspaces.remove(ev.subflow.subflow); RED.workspaces.remove(ev.subflow.subflow);
if (ev.removedLinks) { if (ev.removedLinks) {
inverseEv.createdLinks = [];
for (i=0;i<ev.removedLinks.length;i++) { for (i=0;i<ev.removedLinks.length;i++) {
inverseEv.createdLinks.push(ev.removedLinks[i]);
RED.nodes.addLink(ev.removedLinks[i]); RED.nodes.addLink(ev.removedLinks[i]);
} }
} }
} else if (ev.t == "deleteSubflow") {
inverseEv = {
t: "createSubflow",
activeWorkspace: ev.activeWorkspace,
dirty: RED.nodes.dirty(),
};
if (ev.subflow) {
RED.nodes.addSubflow(ev.subflow.subflow);
inverseEv.subflow = ev.subflow;
}
if (ev.subflows) {
inverseEv.nodes = [];
for (i=0;i<ev.subflows.length;i++) {
RED.nodes.add(ev.subflows[i]);
inverseEv.nodes.push(ev.subflows[i].id);
}
}
if (ev.movedNodes) {
ev.movedNodes.forEach(function(nid) {
nn = RED.nodes.node(nid);
nn.x -= ev.subflow.offsetX;
nn.y -= ev.subflow.offsetY;
nn.dirty = true;
RED.nodes.moveNodeToTab(nn, ev.subflow.subflow.id);
});
}
if (ev.links) {
inverseEv.links = [];
for (i=0;i<ev.links.length;i++) {
inverseEv.links.push(ev.links[i]);
RED.nodes.addLink(ev.links[i]);
}
}
if (ev.createdLinks) {
inverseEv.removedLinks = [];
for (i=0;i<ev.createdLinks.length;i++) {
inverseEv.removedLinks.push(ev.createdLinks[i]);
RED.nodes.removeLink(ev.createdLinks[i]);
}
}
} else if (ev.t == "reorder") { } else if (ev.t == "reorder") {
inverseEv = {
t: 'reorder',
order: RED.nodes.getWorkspaceOrder()
};
if (ev.order) { if (ev.order) {
RED.workspaces.order(ev.order); RED.workspaces.order(ev.order);
} }
@ -320,6 +466,8 @@ RED.history = (function() {
RED.workspaces.refresh(); RED.workspaces.refresh();
RED.sidebar.config.refresh(); RED.sidebar.config.refresh();
RED.subflow.refresh(); RED.subflow.refresh();
return inverseEv;
} }
} }
@ -327,28 +475,42 @@ RED.history = (function() {
return { return {
//TODO: this function is a placeholder until there is a 'save' event that can be listened to //TODO: this function is a placeholder until there is a 'save' event that can be listened to
markAllDirty: function() { markAllDirty: function() {
for (var i=0;i<undo_history.length;i++) { for (var i=0;i<undoHistory.length;i++) {
undo_history[i].dirty = true; undoHistory[i].dirty = true;
} }
}, },
list: function() { list: function() {
return undo_history return undoHistory;
}, },
depth: function() { depth: function() {
return undo_history.length; return undoHistory.length;
}, },
push: function(ev) { push: function(ev) {
undo_history.push(ev); undoHistory.push(ev);
redoHistory = [];
}, },
pop: function() { pop: function() {
var ev = undo_history.pop(); var ev = undoHistory.pop();
undoEvent(ev); var rev = undoEvent(ev);
if (rev) {
redoHistory.push(rev);
}
}, },
peek: function() { peek: function() {
return undo_history[undo_history.length-1]; return undoHistory[undoHistory.length-1];
}, },
clear: function() { clear: function() {
undo_history = []; undoHistory = [];
redoHistory = [];
},
redo: function() {
var ev = redoHistory.pop();
if (ev) {
var uev = undoEvent(ev);
if (uev) {
undoHistory.push(uev);
}
}
} }
} }

View File

@ -50,6 +50,19 @@ RED.i18n = (function() {
} }
}, },
lang: function() {
// Gets the active message catalog language. This is based on what
// locale the editor is using and what languages are available.
//
var preferredLangs = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
var knownLangs = RED.settings.theme("languages")||["en-US"];
for (var i=0;i<preferredLangs.length;i++) {
if (knownLangs.indexOf(preferredLangs[i]) > -1) {
return preferredLangs[i]
}
}
return 'end-US'
},
loadNodeCatalog: function(namespace,done) { loadNodeCatalog: function(namespace,done) {
var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage()); var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
var toLoad = languageList.length; var toLoad = languageList.length;

View File

@ -30,7 +30,8 @@
"backspace": "core:delete-config-selection", "backspace": "core:delete-config-selection",
"delete": "core:delete-config-selection", "delete": "core:delete-config-selection",
"ctrl-a": "core:select-all-config-nodes", "ctrl-a": "core:select-all-config-nodes",
"ctrl-z": "core:undo" "ctrl-z": "core:undo",
"ctrl-y": "core:redo"
}, },
"red-ui-workspace": { "red-ui-workspace": {
"backspace": "core:delete-selection", "backspace": "core:delete-selection",
@ -40,8 +41,17 @@
"ctrl-x": "core:cut-selection-to-internal-clipboard", "ctrl-x": "core:cut-selection-to-internal-clipboard",
"ctrl-v": "core:paste-from-internal-clipboard", "ctrl-v": "core:paste-from-internal-clipboard",
"ctrl-z": "core:undo", "ctrl-z": "core:undo",
"ctrl-y": "core:redo",
"ctrl-a": "core:select-all-nodes", "ctrl-a": "core:select-all-nodes",
"shift-?": "core:show-help", "shift-?": "core:show-help",
"w": "core:scroll-view-up",
"d": "core:scroll-view-right",
"s": "core:scroll-view-down",
"a": "core:scroll-view-left",
"shift-w": "core:step-view-up",
"shift-d": "core:step-view-right",
"shift-s": "core:step-view-down",
"shift-a": "core:step-view-left",
"up": "core:move-selection-up", "up": "core:move-selection-up",
"right": "core:move-selection-right", "right": "core:move-selection-right",
"down": "core:move-selection-down", "down": "core:move-selection-down",

View File

@ -301,6 +301,17 @@ RED.nodes = (function() {
return {links:removedLinks,nodes:removedNodes}; return {links:removedLinks,nodes:removedNodes};
} }
function moveNodeToTab(node, z) {
if (nodeTabMap[node.z]) {
delete nodeTabMap[node.z][node.id];
}
if (!nodeTabMap[z]) {
nodeTabMap[z] = {};
}
nodeTabMap[z][node.id] = node;
node.z = z;
}
function removeLink(l) { function removeLink(l) {
var index = links.indexOf(l); var index = links.indexOf(l);
if (index != -1) { if (index != -1) {
@ -324,7 +335,7 @@ RED.nodes = (function() {
} }
function removeWorkspace(id) { function removeWorkspace(id) {
delete workspaces[id]; delete workspaces[id];
delete nodeTabMap[ws.id]; delete nodeTabMap[id];
workspacesOrder.splice(workspacesOrder.indexOf(id),1); workspacesOrder.splice(workspacesOrder.indexOf(id),1);
var removedNodes = []; var removedNodes = [];
@ -381,21 +392,25 @@ RED.nodes = (function() {
category: sf.category || "subflows", category: sf.category || "subflows",
inputs: sf.in.length, inputs: sf.in.length,
outputs: sf.out.length, outputs: sf.out.length,
color: "#da9", color: sf.color || "#DDAA99",
label: function() { return this.name||RED.nodes.subflow(sf.id).name }, label: function() { return this.name||RED.nodes.subflow(sf.id).name },
labelStyle: function() { return this.name?"red-ui-flow-node-label-italic":""; }, labelStyle: function() { return this.name?"red-ui-flow-node-label-italic":""; },
paletteLabel: function() { return RED.nodes.subflow(sf.id).name }, paletteLabel: function() { return RED.nodes.subflow(sf.id).name },
inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null }, inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null },
outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null }, outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null },
oneditprepare: function() {
RED.subflow.buildEditForm("subflow",this);
RED.subflow.buildPropertiesForm(this);
},
oneditresize: function(size) { oneditresize: function(size) {
var rows = $("#dialog-form>div:not(.node-input-env-container-row)"); // var rows = $(".dialog-form>div:not(.node-input-env-container-row)");
var height = size.height; var height = size.height;
for (var i=0; i<rows.size(); i++) { // for (var i=0; i<rows.size(); i++) {
height -= $(rows[i]).outerHeight(true); // height -= $(rows[i]).outerHeight(true);
} // }
var editorRow = $("#dialog-form>div.node-input-env-container-row"); // var editorRow = $("#dialog-form>div.node-input-env-container-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); // height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-env-container").editableList('height',height-80); $("ol.red-ui-editor-subflow-env-list").editableList('height',height);
}, },
set:{ set:{
module: "node-red" module: "node-red"
@ -494,19 +509,33 @@ RED.nodes = (function() {
node[d] = n[d]; node[d] = n[d];
} }
} }
if(exportCreds && n.credentials) { if (exportCreds) {
var credentialSet = {}; var credentialSet = {};
node.credentials = {}; if (/^subflow:/.test(node.type) && n.credentials) {
for (var cred in n._def.credentials) { // A subflow instance node can have arbitrary creds
if (n._def.credentials.hasOwnProperty(cred)) { for (var sfCred in n.credentials) {
if (n._def.credentials[cred].type == 'password') { if (n.credentials.hasOwnProperty(sfCred)) {
if (!n.credentials._ || if (!n.credentials._ ||
n.credentials["has_"+cred] != n.credentials._["has_"+cred] || n.credentials["has_"+sfCred] != n.credentials._["has_"+sfCred] ||
(n.credentials["has_"+cred] && n.credentials[cred])) { (n.credentials["has_"+sfCred] && n.credentials[sfCred])) {
credentialSet[sfCred] = n.credentials[sfCred];
}
}
}
} 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)) {
if (n._def.credentials[cred].type == 'password') {
if (!n.credentials._ ||
n.credentials["has_"+cred] != n.credentials._["has_"+cred] ||
(n.credentials["has_"+cred] && n.credentials[cred])) {
credentialSet[cred] = n.credentials[cred];
}
} else if (n.credentials[cred] != null && (!n.credentials._ || n.credentials[cred] != n.credentials._[cred])) {
credentialSet[cred] = n.credentials[cred]; credentialSet[cred] = n.credentials[cred];
} }
} else if (n.credentials[cred] != null && (!n.credentials._ || n.credentials[cred] != n.credentials._[cred])) {
credentialSet[cred] = n.credentials[cred];
} }
} }
} }
@ -557,7 +586,7 @@ RED.nodes = (function() {
return node; return node;
} }
function convertSubflow(n) { function convertSubflow(n, exportCreds) {
var node = {}; var node = {};
node.id = n.id; node.id = n.id;
node.type = n.type; node.type = n.type;
@ -568,6 +597,25 @@ RED.nodes = (function() {
node.out = []; node.out = [];
node.env = n.env; node.env = n.env;
if (exportCreds) {
var credentialSet = {};
// A subflow node can have arbitrary creds
for (var sfCred in n.credentials) {
if (n.credentials.hasOwnProperty(sfCred)) {
if (!n.credentials._ ||
n.credentials["has_"+sfCred] != n.credentials._["has_"+sfCred] ||
(n.credentials["has_"+sfCred] && n.credentials[sfCred])) {
credentialSet[sfCred] = n.credentials[sfCred];
}
}
}
if (Object.keys(credentialSet).length > 0) {
node.credentials = credentialSet;
}
}
node.color = n.color;
n.in.forEach(function(p) { n.in.forEach(function(p) {
var nIn = {x:p.x,y:p.y,wires:[]}; var nIn = {x:p.x,y:p.y,wires:[]};
var wires = links.filter(function(d) { return d.source === p }); var wires = links.filter(function(d) { return d.source === p });
@ -681,7 +729,7 @@ RED.nodes = (function() {
} }
for (i in subflows) { for (i in subflows) {
if (subflows.hasOwnProperty(i)) { if (subflows.hasOwnProperty(i)) {
nns.push(convertSubflow(subflows[i])); nns.push(convertSubflow(subflows[i], exportCredentials));
} }
} }
for (i in configNodes) { for (i in configNodes) {
@ -833,7 +881,7 @@ RED.nodes = (function() {
var m = /^subflow:(.+)$/.exec(newNodes[i].type); var m = /^subflow:(.+)$/.exec(newNodes[i].type);
if (m) { if (m) {
var subflowId = m[1]; var subflowId = m[1];
var parent = getSubflow(newNodes[i].z || activeWorkspace); var parent = getSubflow(activeWorkspace);
if (parent) { if (parent) {
var err; var err;
if (subflowId === parent.id) { if (subflowId === parent.id) {
@ -1182,6 +1230,7 @@ RED.nodes = (function() {
var nodeTypeArrayReferences = { var nodeTypeArrayReferences = {
"catch":"scope", "catch":"scope",
"status":"scope", "status":"scope",
"complete": "scope",
"link in":"links", "link in":"links",
"link out":"links" "link out":"links"
} }
@ -1283,8 +1332,13 @@ RED.nodes = (function() {
function filterNodes(filter) { function filterNodes(filter) {
var result = []; var result = [];
var searchSet = nodes; var searchSet = nodes;
if (filter.hasOwnProperty("z") && Object.hasOwnProperty("values") && nodeTabMap.hasOwnProperty(filter.z) ) { var doZFilter = false;
searchSet = Object.values(nodeTabMap[filter.z]); if (filter.hasOwnProperty("z")) {
if (Object.hasOwnProperty("values") && nodeTabMap.hasOwnProperty(filter.z) ) {
searchSet = Object.values(nodeTabMap[filter.z]);
} else {
doZFilter = true;
}
} }
for (var n=0;n<searchSet.length;n++) { for (var n=0;n<searchSet.length;n++) {
@ -1292,6 +1346,9 @@ RED.nodes = (function() {
if (filter.hasOwnProperty("type") && node.type !== filter.type) { if (filter.hasOwnProperty("type") && node.type !== filter.type) {
continue; continue;
} }
if (doZFilter && node.z !== filter.z) {
continue;
}
result.push(node); result.push(node);
} }
return result; return result;
@ -1466,6 +1523,8 @@ RED.nodes = (function() {
remove: removeNode, remove: removeNode,
clear: clear, clear: clear,
moveNodeToTab: moveNodeToTab,
addLink: addLink, addLink: addLink,
removeLink: removeLink, removeLink: removeLink,

View File

@ -418,8 +418,6 @@ var RED = (function() {
RED.notify(RED._("palette.event.nodeUpgraded", {module:msg.module,version:msg.version}),"success"); RED.notify(RED._("palette.event.nodeUpgraded", {module:msg.module,version:msg.version}),"success");
RED.nodes.registry.setModulePendingUpdated(msg.module,msg.version); RED.nodes.registry.setModulePendingUpdated(msg.module,msg.version);
} }
// Refresh flow library to ensure any examples are updated
RED.library.loadFlowLibrary();
}); });
RED.comms.subscribe("event-log/#", function(topic,payload) { RED.comms.subscribe("event-log/#", function(topic,payload) {
var id = topic.substring(9); var id = topic.substring(9);
@ -455,8 +453,12 @@ var RED = (function() {
null null
]}); ]});
menuOptions.push(null); menuOptions.push(null);
menuOptions.push({id:"menu-item-import",label:RED._("menu.label.import"),onselect:"core:show-import-dialog"}); if (RED.settings.theme("menu.menu-item-import-library", true)) {
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),onselect:"core:show-export-dialog"}); menuOptions.push({id: "menu-item-import", label: RED._("menu.label.import"), onselect: "core:show-import-dialog"});
}
if (RED.settings.theme("menu.menu-item-export-library", true)) {
menuOptions.push({id: "menu-item-export", label: RED._("menu.label.export"), onselect: "core:show-export-dialog"});
}
menuOptions.push(null); menuOptions.push(null);
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:"core:search"}); menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:"core:search"});
menuOptions.push(null); menuOptions.push(null);
@ -479,7 +481,9 @@ var RED = (function() {
menuOptions.push({id:"menu-item-user-settings",label:RED._("menu.label.settings"),onselect:"core:show-user-settings"}); menuOptions.push({id:"menu-item-user-settings",label:RED._("menu.label.settings"),onselect:"core:show-user-settings"});
menuOptions.push(null); menuOptions.push(null);
menuOptions.push({id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:"core:show-help"}); if (RED.settings.theme("menu.menu-item-keyboard-shortcuts", true)) {
menuOptions.push({id: "menu-item-keyboard-shortcuts", label: RED._("menu.label.keyboardShortcuts"), onselect: "core:show-help"});
}
menuOptions.push({id:"menu-item-help", menuOptions.push({id:"menu-item-help",
label: RED.settings.theme("menu.menu-item-help.label",RED._("menu.label.help")), label: RED.settings.theme("menu.menu-item-help.label",RED._("menu.label.help")),
href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs") href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs")

View File

@ -56,8 +56,9 @@ RED.settings = (function () {
if (key === "auth-tokens") { if (key === "auth-tokens") {
return JSON.parse(localStorage.getItem(key)); return JSON.parse(localStorage.getItem(key));
} else { } else {
var v;
try { try {
var v = RED.utils.getMessageProperty(userSettings,key); v = RED.utils.getMessageProperty(userSettings,key);
if (v === undefined) { if (v === undefined) {
v = defaultIfUndefined; v = defaultIfUndefined;
} }

View File

@ -34,6 +34,8 @@
* - addItem(itemData) * - addItem(itemData)
* - insertItemAt : function(data,index) - add an item at the specified index * - insertItemAt : function(data,index) - add an item at the specified index
* - removeItem(itemData) * - removeItem(itemData)
* - getItemAt(index)
* - indexOf(itemData)
* - width(width) * - width(width)
* - height(height) * - height(height)
* - items() * - items()
@ -186,7 +188,11 @@
} }
}, },
_destroy: function() { _destroy: function() {
this.topContainer.remove(); if (this.topContainer) {
var tc = this.topContainer;
delete this.topContainer;
tc.remove();
}
}, },
_refreshFilter: function() { _refreshFilter: function() {
var that = this; var that = this;
@ -232,6 +238,23 @@
this.uiHeight = desiredHeight; this.uiHeight = desiredHeight;
this._resize(); this._resize();
}, },
getItemAt: function(index) {
var items = this.items();
if (index >= 0 && index < items.length) {
return $(items[index]).data('data');
} else {
return;
}
},
indexOf: function(data) {
var items = this.items();
for (var i=0;i<items.length;i++) {
if ($(items[i]).data('data') === data) {
return i
}
}
return -1
},
insertItemAt: function(data,index) { insertItemAt: function(data,index) {
var that = this; var that = this;
data = data || {}; data = data || {};

View File

@ -224,9 +224,9 @@ RED.menu = (function() {
if (!alreadySet && opt.onselect) { if (!alreadySet && opt.onselect) {
triggerAction(opt.id,state); triggerAction(opt.id,state);
} }
} if (!opt.local && !alreadySet) {
if (!alreadySet) { RED.settings.set(opt.setting||("menu-"+opt.id), state);
RED.settings.set(opt.setting||("menu-"+opt.id), state); }
} }
} }
@ -244,7 +244,7 @@ RED.menu = (function() {
function addItem(id,opt) { function addItem(id,opt) {
var item = createMenuItem(opt); var item = createMenuItem(opt);
if (opt.group) { if (opt !== null && opt.group) {
var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group); var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
if (groupItems.length === 0) { if (groupItems.length === 0) {
item.appendTo("#"+id+"-submenu"); item.appendTo("#"+id+"-submenu");

View File

@ -131,6 +131,11 @@ RED.popover = (function() {
existingPopover.close(true); existingPopover.close(true);
} }
target.data("red-ui-popover",res) target.data("red-ui-popover",res)
if (options.tooltip) {
div.on("mousedown", function(evt) {
closePopup(true);
});
}
if (instant) { if (instant) {
div.show(); div.show();
} else { } else {
@ -253,6 +258,71 @@ RED.popover = (function() {
content: label, content: label,
delay: { show: 750, hide: 50 } delay: { show: 750, hide: 50 }
}); });
},
panel: function(content) {
var panel = $('<div class="red-ui-editor-dialog red-ui-popover-panel"></div>');
panel.css({ display: "none" });
panel.appendTo(document.body);
content.appendTo(panel);
var closeCallback;
function hide() {
$(document).off("mousedown.red-ui-popover-panel-close");
panel.hide();
panel.css({
height: "auto"
});
panel.remove();
}
function show(options) {
var closeCallback = options.onclose;
var target = options.target;
var align = options.align || "left";
var pos = target.offset();
var targetWidth = target.width();
var targetHeight = target.height();
var panelHeight = panel.height();
var panelWidth = panel.width();
var top = (targetHeight+pos.top);
if (top+panelHeight > $(window).height()) {
top -= (top+panelHeight)-$(window).height() + 5;
}
if (top < 0) {
panelHeight.height(panelHeight+top)
top = 0;
}
if (align === "left") {
panel.css({
top: top+"px",
left: (pos.left)+"px",
});
} else if(align === "right") {
panel.css({
top: top+"px",
left: (pos.left-panelWidth)+"px",
});
}
panel.slideDown(100);
$(document).on("mousedown.red-ui-popover-panel-close", function(event) {
if(!$(event.target).closest(panel).length && !$(event.target).closest(".red-ui-editor-dialog").length) {
if (closeCallback) {
closeCallback();
}
hide();
}
// if ($(event.target).closest(target).length) {
// event.preventDefault();
// }
})
}
return {
container: panel,
show:show,
hide:hide
}
} }
} }

View File

@ -19,6 +19,9 @@
RED.tabs = (function() { RED.tabs = (function() {
var defaultTabIcon = "fa fa-lemon-o"; var defaultTabIcon = "fa fa-lemon-o";
var dragActive = false;
var dblClickTime;
var dblClickArmed = false;
function createTabs(options) { function createTabs(options) {
var tabs = {}; var tabs = {};
@ -201,12 +204,21 @@ RED.tabs = (function() {
} }
function onTabClick(evt) { function onTabClick(evt) {
evt.preventDefault(); if (dragActive) {
return
}
if (dblClickTime && Date.now()-dblClickTime < 400) {
dblClickTime = 0;
dblClickArmed = true;
return onTabDblClick.call(this,evt);
}
dblClickTime = Date.now();
var currentTab = ul.find("li.red-ui-tab.active"); var currentTab = ul.find("li.red-ui-tab.active");
var thisTab = $(this).parent(); var thisTab = $(this).parent();
var fireSelectionChanged = false; var fireSelectionChanged = false;
if (options.onselect) { if (options.onselect) {
if (evt.metaKey) { if (evt.metaKey || evt.ctrlKey) {
if (thisTab.hasClass("selected")) { if (thisTab.hasClass("selected")) {
thisTab.removeClass("selected"); thisTab.removeClass("selected");
if (thisTab[0] !== currentTab[0]) { if (thisTab[0] !== currentTab[0]) {
@ -267,7 +279,6 @@ RED.tabs = (function() {
if (fireSelectionChanged) { if (fireSelectionChanged) {
selectionChanged(); selectionChanged();
} }
return false;
} }
function updateScroll() { function updateScroll() {
@ -289,7 +300,6 @@ RED.tabs = (function() {
} }
function onTabDblClick(evt) { function onTabDblClick(evt) {
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation();
if (evt.metaKey || evt.shiftKey) { if (evt.metaKey || evt.shiftKey) {
return; return;
} }
@ -418,7 +428,11 @@ RED.tabs = (function() {
} }
ul.find("li.red-ui-tab a").on("click",onTabClick).on("dblclick",onTabDblClick); ul.find("li.red-ui-tab a")
.on("mouseup",onTabClick)
.on("click", function(evt) {evt.preventDefault(); })
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
setTimeout(function() { setTimeout(function() {
updateTabWidths(); updateTabWidths();
},0); },0);
@ -524,8 +538,9 @@ RED.tabs = (function() {
RED.popover.tooltip($(pinnedLink), tab.name, tab.action); RED.popover.tooltip($(pinnedLink), tab.name, tab.action);
} }
link.on("click",onTabClick); link.on("mouseup",onTabClick);
link.on("dblclick",onTabDblClick); link.on("click", function(evt) { evt.preventDefault(); })
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
if (tab.closeable) { if (tab.closeable) {
@ -560,6 +575,8 @@ RED.tabs = (function() {
axis:"x", axis:"x",
distance: 20, distance: 20,
start: function(event,ui) { start: function(event,ui) {
if (dblClickArmed) { dblClickArmed = false; return false }
dragActive = true;
originalTabOrder = []; originalTabOrder = [];
tabElements = []; tabElements = [];
ul.children().each(function(i) { ul.children().each(function(i) {
@ -615,6 +632,7 @@ RED.tabs = (function() {
} }
}, },
stop: function(event,ui) { stop: function(event,ui) {
dragActive = false;
ul.children().css({position:"relative",left:"",transition:""}); ul.children().css({position:"relative",left:"",transition:""});
if (!li.hasClass('active')) { if (!li.hasClass('active')) {
li.css({zIndex:""}); li.css({zIndex:""});

View File

@ -39,8 +39,8 @@
var baseClass = this.options.baseClass || "red-ui-button"; var baseClass = this.options.baseClass || "red-ui-button";
var enabledIcon = this.options.enabledIcon || "fa-check-square-o"; var enabledIcon = this.options.enabledIcon || "fa-check-square-o";
var disabledIcon = this.options.disabledIcon || "fa-square-o"; var disabledIcon = this.options.disabledIcon || "fa-square-o";
var enabledLabel = this.options.enabledLabel || RED._("editor:workspace.enabled"); var enabledLabel = this.options.hasOwnProperty('enabledLabel') ? this.options.enabledLabel : RED._("editor:workspace.enabled");
var disabledLabel = this.options.disabledLabel || RED._("editor:workspace.disabled"); var disabledLabel = this.options.hasOwnProperty('disabledLabel') ? this.options.disabledLabel : RED._("editor:workspace.disabled");
this.element.css("display","none"); this.element.css("display","none");
this.element.on("focus", function() { this.element.on("focus", function() {

View File

@ -410,7 +410,7 @@
return; return;
} }
if (container.hasClass("expanded")) { if (container.hasClass("expanded")) {
done && done(); if (done) { done() }
return; return;
} }
if (!container.hasClass("built") && (item.deferBuild || typeof item.children === 'function')) { if (!container.hasClass("built") && (item.deferBuild || typeof item.children === 'function')) {
@ -435,7 +435,7 @@
spinner.remove(); spinner.remove();
} }
} }
done && done(); if (done) { done() }
that._trigger("childrenloaded",null,item) that._trigger("childrenloaded",null,item)
} }
if (typeof item.children === 'function') { if (typeof item.children === 'function') {
@ -457,7 +457,7 @@
} else { } else {
item.treeList.childList.slideDown('fast'); item.treeList.childList.slideDown('fast');
} }
done && done(); if (done) { done() }
} }
container.addClass("expanded"); container.addClass("expanded");
} }

View File

@ -81,7 +81,7 @@
} }
}, },
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.svg"}, re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.svg"},
date: {value:"date",label:"timestamp",hasValue:false}, date: {value:"date",label:"timestamp",icon:"fa fa-clock-o",hasValue:false},
jsonata: { jsonata: {
value: "jsonata", value: "jsonata",
label: "expression", label: "expression",
@ -164,6 +164,84 @@
} }
}) })
} }
},
cred:{
value:"cred",
label:"credential",
icon:"fa fa-lock",
inputType: "password",
valueLabel: function(container,value) {
var that = this;
container.css("pointer-events","none");
this.elementDiv.hide();
var buttons = $('<div>').css({
position: "absolute",
right:"6px",
top: "6px",
"pointer-events":"all"
}).appendTo(container);
var eyeButton = $('<button type="button" class="red-ui-button red-ui-button-small"></button>').css({
width:"20px"
}).appendTo(buttons).on("click", function(evt) {
evt.preventDefault();
var currentType = that.input.attr("type");
if (currentType === "text") {
that.input.attr("type","password");
eyeCon.removeClass("fa-eye-slash").addClass("fa-eye");
setTimeout(function() {
that.input.focus();
},50);
} else {
that.input.attr("type","text");
eyeCon.removeClass("fa-eye").addClass("fa-eye-slash");
setTimeout(function() {
that.input.focus();
},50);
}
}).hide();
var eyeCon = $('<i class="fa fa-eye"></i>').css("margin-left","-1px").appendTo(eyeButton);
if (value === "__PWRD__") {
var innerContainer = $('<div><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i></div>').css({
padding:"6px 6px",
borderRadius:"4px"
}).addClass("red-ui-typedInput-value-label-inactive").appendTo(container);
var editButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-pencil"></i></button>').appendTo(buttons).on("click", function(evt) {
evt.preventDefault();
innerContainer.hide();
container.css("background","none");
container.css("pointer-events","none");
that.input.val("");
that.element.val("");
that.elementDiv.show();
editButton.hide();
cancelButton.show();
eyeButton.show();
setTimeout(function() {
that.input.focus();
},50);
});
var cancelButton = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-times"></i></button>').css("margin-left","3px").appendTo(buttons).on("click", function(evt) {
evt.preventDefault();
innerContainer.show();
container.css("background","");
that.input.val("__PWRD__");
that.element.val("__PWRD__");
that.elementDiv.hide();
editButton.show();
cancelButton.hide();
eyeButton.hide();
that.input.attr("type","password");
eyeCon.removeClass("fa-eye-slash").addClass("fa-eye");
}).hide();
} else {
container.css("background","none");
container.css("pointer-events","none");
this.elementDiv.show();
eyeButton.show();
}
}
} }
}; };
var nlsd = false; var nlsd = false;
@ -220,6 +298,8 @@
that.input.attr(d,m); that.input.attr(d,m);
}); });
this.defaultInputType = this.input.attr('type');
this.uiSelect.addClass("red-ui-typedInput-container"); this.uiSelect.addClass("red-ui-typedInput-container");
this.element.attr('type','hidden'); this.element.attr('type','hidden');
@ -298,7 +378,8 @@
that.uiSelect.addClass('red-ui-typedInput-focus'); that.uiSelect.addClass('red-ui-typedInput-focus');
}); });
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"><i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i></button>').appendTo(this.uiSelect); this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);
this.type(this.options.default||this.typeList[0].value); this.type(this.options.default||this.typeList[0].value);
}catch(err) { }catch(err) {
console.log(err.stack); console.log(err.stack);
@ -336,6 +417,17 @@
menu.css({ menu.css({
height: "auto" height: "auto"
}); });
if (menu.opts.multiple) {
var selected = [];
menu.find('input[type="checkbox"]').each(function() {
if ($(this).prop("checked")) {
selected.push($(this).data('value'))
}
})
menu.callback(selected);
}
if (this.elementDiv.is(":visible")) { if (this.elementDiv.is(":visible")) {
this.input.trigger("focus"); this.input.trigger("focus");
} else if (this.optionSelectTrigger.is(":visible")){ } else if (this.optionSelectTrigger.is(":visible")){
@ -344,10 +436,12 @@
this.selectTrigger.trigger("focus"); this.selectTrigger.trigger("focus");
} }
}, },
_createMenu: function(opts,callback) { _createMenu: function(menuOptions,opts,callback) {
var that = this; var that = this;
var menu = $("<div>").addClass("red-ui-typedInput-options"); var menu = $("<div>").addClass("red-ui-typedInput-options red-ui-editor-dialog");
opts.forEach(function(opt) { menu.opts = opts;
menu.callback = callback;
menuOptions.forEach(function(opt) {
if (typeof opt === 'string') { if (typeof opt === 'string') {
opt = {value:opt,label:opt}; opt = {value:opt,label:opt};
} }
@ -369,12 +463,20 @@
if (!opt.icon && !opt.label) { if (!opt.icon && !opt.label) {
op.text(opt.value); op.text(opt.value);
} }
var cb;
if (opts.multiple) {
cb = $('<input type="checkbox">').css("pointer-events","none").data('value',opt.value).prependTo(op).on("mousedown", function(evt) { evt.preventDefault() });
}
op.on("click", function(event) { op.on("click", function(event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
callback(opt.value); if (!opts.multiple) {
that._hideMenu(menu); callback(opt.value);
that._hideMenu(menu);
} else {
cb.prop("checked",!cb.prop("checked"));
}
}); });
}); });
menu.css({ menu.css({
@ -398,9 +500,6 @@
} }
evt.stopPropagation(); evt.stopPropagation();
}) })
return menu; return menu;
}, },
@ -409,11 +508,22 @@
this.disarmClick = false; this.disarmClick = false;
return return
} }
if (menu.opts.multiple) {
var selected = {};
this.value().split(",").forEach(function(f) {
selected[f] = true;
})
menu.find('input[type="checkbox"]').each(function() {
$(this).prop("checked",selected[$(this).data('value')])
})
}
var that = this; var that = this;
var pos = relativeTo.offset(); var pos = relativeTo.offset();
var height = relativeTo.height(); var height = relativeTo.height();
var menuHeight = menu.height(); var menuHeight = menu.height();
var top = (height+pos.top-3); var top = (height+pos.top);
if (top+menuHeight > $(window).height()) { if (top+menuHeight > $(window).height()) {
top -= (top+menuHeight)-$(window).height()+5; top -= (top+menuHeight)-$(window).height()+5;
} }
@ -423,7 +533,7 @@
} }
menu.css({ menu.css({
top: top+"px", top: top+"px",
left: (2+pos.left)+"px", left: (pos.left)+"px",
}); });
menu.slideDown(100); menu.slideDown(100);
this._delay(function() { this._delay(function() {
@ -471,7 +581,7 @@
this._getLabelWidth(this.selectTrigger, function(labelWidth) { this._getLabelWidth(this.selectTrigger, function(labelWidth) {
that.elementDiv.css('left',labelWidth+"px"); that.elementDiv.css('left',labelWidth+"px");
that.valueLabelContainer.css('left',labelWidth+"px"); that.valueLabelContainer.css('left',labelWidth+"px");
if (that.optionExpandButton.is(":visible")) { if (that.optionExpandButton.shown) {
that.elementDiv.css('right',"22px"); that.elementDiv.css('right',"22px");
that.valueLabelContainer.css('right',"22px"); that.valueLabelContainer.css('right',"22px");
} else { } else {
@ -496,7 +606,7 @@
} else { } else {
that.optionSelectLabel.css({'left':'0'}) that.optionSelectLabel.css({'left':'0'})
that.optionSelectTrigger.css({'width':'calc( 100% - '+labelWidth+'px )'}); that.optionSelectTrigger.css({'width':'calc( 100% - '+labelWidth+'px )'});
if (!that.optionExpandButton.is(":visible")) { if (!that.optionExpandButton.shown) {
that.elementDiv.css({'right':0}); that.elementDiv.css({'right':0});
that.input.css({ that.input.css({
'border-top-right-radius': '4px', 'border-top-right-radius': '4px',
@ -511,25 +621,35 @@
_updateOptionSelectLabel: function(o) { _updateOptionSelectLabel: function(o) {
var opt = this.typeMap[this.propertyType]; var opt = this.typeMap[this.propertyType];
this.optionSelectLabel.empty(); this.optionSelectLabel.empty();
if (o.icon) { if (this.typeMap[this.propertyType].valueLabel) {
if (o.icon.indexOf("<") === 0) { if (opt.multiple) {
$(o.icon).prependTo(this.optionSelectLabel); this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o);
} else if (o.icon.indexOf("/") !== -1) {
// url
$('<img>',{src:mapDeprecatedIcon(o.icon),style:"height: 18px;"}).prependTo(this.optionSelectLabel);
} else { } else {
// icon class this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o.value);
$('<i>',{class:"red-ui-typedInput-icon "+o.icon}).prependTo(this.optionSelectLabel); }
} else if (!opt.multiple) {
if (o.icon) {
if (o.icon.indexOf("<") === 0) {
$(o.icon).prependTo(this.optionSelectLabel);
} else if (o.icon.indexOf("/") !== -1) {
// url
$('<img>',{src:mapDeprecatedIcon(o.icon),style:"height: 18px;"}).prependTo(this.optionSelectLabel);
} else {
// icon class
$('<i>',{class:"red-ui-typedInput-icon "+o.icon}).prependTo(this.optionSelectLabel);
}
} else if (o.label) {
this.optionSelectLabel.text(o.label);
} else {
this.optionSelectLabel.text(o.value);
}
if (opt.hasValue) {
this.optionValue = o.value;
this._resize();
this.input.trigger('change',this.propertyType,this.value());
} }
} else if (o.label) {
this.optionSelectLabel.text(o.label);
} else { } else {
this.optionSelectLabel.text(o.value); this.optionSelectLabel.text(o.length+" selected");
}
if (opt.hasValue) {
this.optionValue = o.value;
this._resize();
this.input.trigger('change',this.propertyType,this.value());
} }
}, },
_destroy: function() { _destroy: function() {
@ -558,7 +678,7 @@
if (this.menu) { if (this.menu) {
this.menu.remove(); this.menu.remove();
} }
this.menu = this._createMenu(this.typeList, function(v) { that.type(v) }); this.menu = this._createMenu(this.typeList,{},function(v) { that.type(v) });
if (currentType && !this.typeMap.hasOwnProperty(currentType)) { if (currentType && !this.typeMap.hasOwnProperty(currentType)) {
this.type(this.typeList[0].value); this.type(this.typeList[0].value);
} else { } else {
@ -572,38 +692,51 @@
this._resize(); this._resize();
}, },
value: function(value) { value: function(value) {
var that = this;
var opt = this.typeMap[this.propertyType];
if (!arguments.length) { if (!arguments.length) {
var v = this.input.val(); var v = this.input.val();
if (this.typeMap[this.propertyType].export) { if (opt.export) {
v = this.typeMap[this.propertyType].export(v,this.optionValue) v = opt.export(v,this.optionValue)
} }
return v; return v;
} else { } else {
var selectedOption; var selectedOption = [];
if (this.typeMap[this.propertyType].options) { if (opt.options) {
for (var i=0;i<this.typeMap[this.propertyType].options.length;i++) { var checkValues = [value];
var op = this.typeMap[this.propertyType].options[i]; if (opt.multiple) {
if (typeof op === "string") { selectedOption = [];
if (op === value) { checkValues = value.split(",");
selectedOption = this.activeOptions[op]; }
checkValues.forEach(function(value) {
for (var i=0;i<opt.options.length;i++) {
var op = opt.options[i];
if (typeof op === "string") {
if (op === value || op === ""+value) {
selectedOption.push(that.activeOptions[op]);
break;
}
} else if (op.value === value) {
selectedOption.push(op);
break; break;
} }
} else if (op.value === value) {
selectedOption = op;
break;
} }
} })
if (!selectedOption) {
selectedOption = {value:""}
}
this.input.val(value); this.input.val(value);
this._updateOptionSelectLabel(selectedOption) if (!opt.multiple) {
if (selectedOption.length === 0) {
selectedOption = [{value:""}];
}
this._updateOptionSelectLabel(selectedOption[0])
} else {
this._updateOptionSelectLabel(selectedOption)
}
} else { } else {
this.input.val(value); this.input.val(value);
} if (opt.valueLabel) {
if (this.typeMap[this.propertyType].valueLabel) { this.valueLabelContainer.empty();
this.valueLabelContainer.empty(); opt.valueLabel.call(this,this.valueLabelContainer,value);
this.typeMap[this.propertyType].valueLabel.call(this,this.valueLabelContainer,value); }
} }
this.input.trigger('change',this.type(),value); this.input.trigger('change',this.type(),value);
} }
@ -621,7 +754,7 @@
} }
this.selectLabel.empty(); this.selectLabel.empty();
var image; var image;
if (opt.icon) { if (opt.icon && opt.showLabel !== false) {
if (opt.icon.indexOf("<") === 0) { if (opt.icon.indexOf("<") === 0) {
$(opt.icon).prependTo(this.selectLabel); $(opt.icon).prependTo(this.selectLabel);
} }
@ -634,9 +767,10 @@
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel); $('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
} }
else { else {
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(this.selectLabel); $('<i>',{class:"red-ui-typedInput-icon "+opt.icon,style:"min-width: 13px; margin-right: 4px;"}).prependTo(this.selectLabel);
} }
} else { }
if (opt.hasValue === false || (opt.showLabel !== false && !opt.icon)) {
this.selectLabel.text(opt.label); this.selectLabel.text(opt.label);
} }
if (this.optionMenu) { if (this.optionMenu) {
@ -646,6 +780,7 @@
if (opt.options) { if (opt.options) {
if (this.optionExpandButton) { if (this.optionExpandButton) {
this.optionExpandButton.hide(); this.optionExpandButton.hide();
this.optionExpandButton.shown = false;
} }
if (this.optionSelectTrigger) { if (this.optionSelectTrigger) {
this.optionSelectTrigger.show(); this.optionSelectTrigger.show();
@ -668,36 +803,50 @@
if (!that.activeOptions.hasOwnProperty(that.optionValue)) { if (!that.activeOptions.hasOwnProperty(that.optionValue)) {
that.optionValue = null; that.optionValue = null;
} }
this.optionMenu = this._createMenu(opt.options,function(v){
that._updateOptionSelectLabel(that.activeOptions[v]);
if (!opt.hasValue) {
that.value(that.activeOptions[v].value)
}
});
var op; var op;
if (!opt.hasValue) { if (!opt.hasValue) {
var currentVal = this.input.val();
var validValue = false; var validValue = false;
for (var i=0;i<opt.options.length;i++) { var currentVal = this.input.val();
op = opt.options[i]; if (!opt.multiple) {
if (typeof op === "string" && op === currentVal) { for (var i=0;i<opt.options.length;i++) {
that._updateOptionSelectLabel({value:currentVal}); op = opt.options[i];
validValue = true; if (typeof op === "string" && op === currentVal) {
break; that._updateOptionSelectLabel({value:currentVal});
} else if (op.value === currentVal) { validValue = true;
that._updateOptionSelectLabel(op); break;
validValue = true; } else if (op.value === currentVal) {
break; that._updateOptionSelectLabel(op);
validValue = true;
break;
}
} }
} if (!validValue) {
if (!validValue) { op = opt.options[0];
op = opt.options[0]; if (typeof op === "string") {
if (typeof op === "string") { this.value(op);
this.value(op); that._updateOptionSelectLabel({value:op});
that._updateOptionSelectLabel({value:op}); } else {
} else { this.value(op.value);
this.value(op.value); that._updateOptionSelectLabel(op);
that._updateOptionSelectLabel(op); }
}
} else {
// Check to see if value is a valid csv of
// options.
var currentValues = {};
currentVal.split(",").forEach(function(v) {
if (v) {
currentValues[v] = true;
}
});
for (var i=0;i<opt.options.length;i++) {
op = opt.options[i];
delete currentValues[op.value||op];
}
if (!$.isEmptyObject(currentValues)) {
// Invalid, set to default/empty
this.value((opt.default||[]).join(","));
} }
} }
} else { } else {
@ -733,12 +882,31 @@
this.optionSelectTrigger.hide(); this.optionSelectTrigger.hide();
} }
} }
this.optionMenu = this._createMenu(opt.options,opt,function(v){
if (!opt.multiple) {
that._updateOptionSelectLabel(that.activeOptions[v]);
if (!opt.hasValue) {
that.value(that.activeOptions[v].value)
}
} else {
that._updateOptionSelectLabel(v);
if (!opt.hasValue) {
that.value(v.join(","))
}
}
});
} }
this._trigger("typechange",null,this.propertyType);
this.input.trigger('change',this.propertyType,this.value()); this.input.trigger('change',this.propertyType,this.value());
} else { } else {
if (this.optionSelectTrigger) { if (this.optionSelectTrigger) {
this.optionSelectTrigger.hide(); this.optionSelectTrigger.hide();
} }
if (opt.inputType) {
this.input.attr('type',opt.inputType)
} else {
this.input.attr('type',this.defaultInputType)
}
if (opt.hasValue === false) { if (opt.hasValue === false) {
this.oldValue = this.input.val(); this.oldValue = this.input.val();
this.input.val(""); this.input.val("");
@ -747,8 +915,8 @@
} else if (opt.valueLabel) { } else if (opt.valueLabel) {
this.valueLabelContainer.show(); this.valueLabelContainer.show();
this.valueLabelContainer.empty(); this.valueLabelContainer.empty();
opt.valueLabel.call(this,this.valueLabelContainer,this.input.val());
this.elementDiv.hide(); this.elementDiv.hide();
opt.valueLabel.call(this,this.valueLabelContainer,this.input.val());
} else { } else {
if (this.oldValue !== undefined) { if (this.oldValue !== undefined) {
this.input.val(this.oldValue); this.input.val(this.oldValue);
@ -758,17 +926,44 @@
this.elementDiv.show(); this.elementDiv.show();
} }
if (this.optionExpandButton) { if (this.optionExpandButton) {
if (opt.expand && typeof opt.expand === 'function') { if (opt.expand) {
if (opt.expand.icon) {
this.optionExpandButtonIcon.removeClass().addClass("red-ui-typedInput-icon fa "+opt.expand.icon)
} else {
this.optionExpandButtonIcon.removeClass().addClass("red-ui-typedInput-icon fa fa-ellipsis-h")
}
this.optionExpandButton.shown = true;
this.optionExpandButton.show(); this.optionExpandButton.show();
this.optionExpandButton.off('click'); this.optionExpandButton.off('click');
this.optionExpandButton.on('click',function(evt) { this.optionExpandButton.on('click',function(evt) {
evt.preventDefault(); evt.preventDefault();
opt.expand.call(that); if (typeof opt.expand === 'function') {
opt.expand.call(that);
} else {
var container = $('<div>');
var content = opt.expand.content.call(that,container);
var panel = RED.popover.panel(container);
panel.container.css({
width:that.valueLabelContainer.width()
});
if (opt.expand.minWidth) {
panel.container.css({
minWidth: opt.expand.minWidth+"px"
});
}
panel.show({
target:that.optionExpandButton,
onclose:content.onclose,
align: "right"
});
}
}) })
} else { } else {
this.optionExpandButton.shown = false;
this.optionExpandButton.hide(); this.optionExpandButton.hide();
} }
} }
this._trigger("typechange",null,this.propertyType);
this.input.trigger('change',this.propertyType,this.value()); this.input.trigger('change',this.propertyType,this.value());
} }
if (!image) { if (!image) {

View File

@ -334,8 +334,7 @@ RED.deploy = (function() {
var invalidNodes = []; var invalidNodes = [];
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
hasInvalid = hasInvalid || !node.valid; if (!node.valid && !node.d) {
if (!node.valid) {
invalidNodes.push(getNodeInfo(node)); invalidNodes.push(getNodeInfo(node));
} }
if (node.type === "unknown") { if (node.type === "unknown") {
@ -345,6 +344,7 @@ RED.deploy = (function() {
} }
}); });
hasUnknown = unknownNodes.length > 0; hasUnknown = unknownNodes.length > 0;
hasInvalid = invalidNodes.length > 0;
var unusedConfigNodes = []; var unusedConfigNodes = [];
RED.nodes.eachConfig(function(node) { RED.nodes.eachConfig(function(node) {

View File

@ -401,7 +401,7 @@ RED.diff = (function() {
defaults:{}, defaults:{},
icon:"subflow.svg", icon:"subflow.svg",
category: "subflows", category: "subflows",
color: "#da9" color: "#DDAA99"
}, },
tab:currentConfig.subflows[subflowId] tab:currentConfig.subflows[subflowId]
} }
@ -424,7 +424,7 @@ RED.diff = (function() {
defaults:{}, defaults:{},
icon:"subflow.svg", icon:"subflow.svg",
category: "subflows", category: "subflows",
color: "#da9" color: "#DDAA99"
}, },
tab:newConfig.subflows[subflowId], tab:newConfig.subflows[subflowId],
newTab:newConfig.subflows[subflowId] newTab:newConfig.subflows[subflowId]
@ -445,7 +445,7 @@ RED.diff = (function() {
defaults:{}, defaults:{},
icon:"subflow.svg", icon:"subflow.svg",
category: "subflows", category: "subflows",
color: "#da9" color: "#DDAA99"
}, },
tab:remoteDiff.newConfig.subflows[subflowId], tab:remoteDiff.newConfig.subflows[subflowId],
remoteTab: remoteDiff.newConfig.subflows[subflowId] remoteTab: remoteDiff.newConfig.subflows[subflowId]
@ -551,7 +551,7 @@ RED.diff = (function() {
def = { def = {
icon:"subflow.svg", icon:"subflow.svg",
category: "subflows", category: "subflows",
color: "#da9", color: "#DDAA99",
defaults:{name:{value:""}} defaults:{name:{value:""}}
} }
} else { } else {
@ -1029,9 +1029,9 @@ RED.diff = (function() {
} }
var localSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-local"}).on("click", function(e) { e.stopPropagation();}).appendTo(localDiv); var localSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-local"}).on("click", function(e) { e.stopPropagation();}).appendTo(localDiv);
var localRadio = $('<input>',{class:"red-ui-diff-selectbox-input",id:safeNodeId+"-local",type:'radio',value:"local",name:safeNodeId,class:className+"-local"}).data('node-id',node.id).on("change", changeHandler).appendTo(localSelectDiv); var localRadio = $('<input>',{class:"red-ui-diff-selectbox-input "+className+"-local",id:safeNodeId+"-local",type:'radio',value:"local",name:safeNodeId}).data('node-id',node.id).on("change", changeHandler).appendTo(localSelectDiv);
var remoteSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-remote"}).on("click", function(e) { e.stopPropagation();}).appendTo(remoteDiv); var remoteSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-remote"}).on("click", function(e) { e.stopPropagation();}).appendTo(remoteDiv);
var remoteRadio = $('<input>',{class:"red-ui-diff-selectbox-input",id:safeNodeId+"-remote",type:'radio',value:"remote",name:safeNodeId,class:className+"-remote"}).data('node-id',node.id).on("change", changeHandler).appendTo(remoteSelectDiv); var remoteRadio = $('<input>',{class:"red-ui-diff-selectbox-input "+className+"-remote",id:safeNodeId+"-remote",type:'radio',value:"remote",name:safeNodeId}).data('node-id',node.id).on("change", changeHandler).appendTo(remoteSelectDiv);
if (state === 'local') { if (state === 'local') {
localRadio.prop('checked',true); localRadio.prop('checked',true);
} else if (state === 'remote') { } else if (state === 'remote') {

View File

@ -19,7 +19,6 @@
*/ */
RED.editor = (function() { RED.editor = (function() {
var editStack = []; var editStack = [];
var editing_node = null; var editing_node = null;
var editing_config_node = null; var editing_config_node = null;
@ -203,6 +202,7 @@ RED.editor = (function() {
function updateNodeProperties(node, outputMap) { function updateNodeProperties(node, outputMap) {
node.resize = true; node.resize = true;
node.dirty = true; node.dirty = true;
node.dirtyStatus = true;
var removedLinks = []; var removedLinks = [];
if (node.ports) { if (node.ports) {
if (outputMap) { if (outputMap) {
@ -231,8 +231,12 @@ RED.editor = (function() {
} }
} }
} }
node.inputs = Math.min(1,Math.max(0,parseInt(node.inputs)));
if (isNaN(node.inputs)) {
node.inputs = 0;
}
if (node.inputs === 0) { if (node.inputs === 0) {
removedLinks.concat(RED.nodes.filterLinks({target:node})); removedLinks = removedLinks.concat(RED.nodes.filterLinks({target:node}));
} }
for (var l=0;l<removedLinks.length;l++) { for (var l=0;l<removedLinks.length;l++) {
RED.nodes.removeLink(removedLinks[l]); RED.nodes.removeLink(removedLinks[l]);
@ -486,8 +490,7 @@ RED.editor = (function() {
done(); done();
} }
} }
if (definition.credentials || /^subflow:/.test(definition.type)) {
if (definition.credentials) {
if (node.credentials) { if (node.credentials) {
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix); populateCredentialsInputs(node, definition.credentials, node.credentials, prefix);
completePrepare(); completePrepare();
@ -495,7 +498,9 @@ RED.editor = (function() {
$.getJSON(getCredentialsURL(node.type, node.id), function (data) { $.getJSON(getCredentialsURL(node.type, node.id), function (data) {
node.credentials = data; node.credentials = data;
node.credentials._ = $.extend(true,{},data); node.credentials._ = $.extend(true,{},data);
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix); if (!/^subflow:/.test(definition.type)) {
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix);
}
completePrepare(); completePrepare();
}); });
} }
@ -526,7 +531,7 @@ RED.editor = (function() {
} else if (node.type.indexOf("subflow:")===0) { } else if (node.type.indexOf("subflow:")===0) {
var subflow = RED.nodes.subflow(node.type.substring(8)); var subflow = RED.nodes.subflow(node.type.substring(8));
label = RED._("subflow.editSubflowInstance",{name:RED.utils.sanitize(subflow.name)}) label = RED._("subflow.editSubflowInstance",{name:RED.utils.sanitize(subflow.name)})
} else { } else if (node._def !== undefined) {
if (typeof node._def.paletteLabel !== "undefined") { if (typeof node._def.paletteLabel !== "undefined") {
try { try {
label = RED.utils.sanitize((typeof node._def.paletteLabel === "function" ? node._def.paletteLabel.call(node._def) : node._def.paletteLabel)||""); label = RED.utils.sanitize((typeof node._def.paletteLabel === "function" ? node._def.paletteLabel.call(node._def) : node._def.paletteLabel)||"");
@ -546,148 +551,7 @@ RED.editor = (function() {
return label; return label;
} }
function buildEnvForm(container, node) { function isSameObj(env0, env1) {
var env_container = $('#node-input-env-container');
env_container
.css({
'min-height':'150px',
'min-width':'450px'
})
.editableList({
addItem: function(container, i, opt) {
var row = $('<div/>').appendTo(container);
if (opt.parent) {
$('<div/>', {
class:"uneditable-input",
style: "margin-left: 5px; width: calc(40% - 8px)",
}).appendTo(row).text(opt.name);
} else {
$('<input/>', {
class: "node-input-env-name",
type: "text",
style: "margin-left: 5px; width: calc(40% - 8px)",
placeholder: RED._("common.label.name")
}).attr("autocomplete","disable").appendTo(row).val(opt.name);
}
var valueField = $('<input/>',{
class: "node-input-env-value",
type: "text",
style: "margin-left: 5px; width: calc(60% - 8px)"
}).attr("autocomplete","disable").appendTo(row)
valueField.typedInput({default:'str',
types:['str','num','bool','json','bin','env']
});
valueField.typedInput('type', opt.parent?(opt.type||opt.parent.type):opt.type);
valueField.typedInput('value', opt.parent?((opt.value !== undefined)?opt.value:opt.parent.value):opt.value);
var actionButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove red-ui-button red-ui-button-small"}).appendTo(container);
$('<i/>',{class:"fa "+(opt.parent?"fa-reply":"fa-remove")}).appendTo(actionButton);
container.parent().addClass("red-ui-editableList-item-removable");
if (opt.parent) {
if ((opt.value !== undefined) && (opt.value !== opt.parent.value || opt.type !== opt.parent.type)) {
actionButton.show();
} else {
actionButton.hide();
}
var restoreTip = RED.popover.tooltip(actionButton,RED._("subflow.env.restore"));
valueField.on("change", function(evt) {
var newType = valueField.typedInput('type');
var newValue = valueField.typedInput('value');
if (newType === opt.parent.type && newValue === opt.parent.value) {
actionButton.hide();
} else {
actionButton.show();
}
})
actionButton.on("click", function(evt) {
evt.preventDefault();
restoreTip.close();
valueField.typedInput('type', opt.parent.type);
valueField.typedInput('value', opt.parent.value);
})
} else {
var removeTip = RED.popover.tooltip(actionButton,RED._("subflow.env.remove"));
actionButton.on("click", function(evt) {
evt.preventDefault();
removeTip.close();
container.parent().addClass("red-ui-editableList-item-deleting")
container.fadeOut(300, function() {
env_container.editableList('removeItem',opt);
});
});
}
},
sortable: false,
removable: false
});
var parentEnv = {};
var envList = [];
if (/^subflow:/.test(node.type)) {
var subflowDef = RED.nodes.subflow(node.type.substring(8));
if (subflowDef.env) {
subflowDef.env.forEach(function(env) {
var item = {
name:env.name,
parent: {
type: env.type,
value: env.value
}
}
envList.push(item);
parentEnv[env.name] = item;
})
}
}
if (node.env) {
for (var i = 0; i < node.env.length; i++) {
var env = node.env[i];
if (parentEnv.hasOwnProperty(env.name)) {
parentEnv[env.name].type = env.type;
parentEnv[env.name].value = env.value;
} else {
envList.push({
name: env.name,
type: env.type,
value: env.value
});
}
}
}
envList.forEach(function(env) {
env_container.editableList('addItem', env);
})
}
function exportEnvList(list) {
if (list) {
var env = [];
list.each(function(i) {
var entry = $(this);
var item = entry.data('data');
var name = (item.parent?item.name:entry.find(".node-input-env-name").val()).trim();
if (name !== "") {
var valueInput = entry.find(".node-input-env-value");
var value = valueInput.typedInput("value");
var type = valueInput.typedInput("type");
if (!item.parent || (item.parent.value !== value || item.parent.type !== type)) {
var item = {
name: name,
type: type,
value: value
};
env.push(item);
}
}
});
return env;
}
return null;
}
function isSameEnv(env0, env1) {
return (JSON.stringify(env0) === JSON.stringify(env1)); return (JSON.stringify(env0) === JSON.stringify(env1));
} }
@ -713,17 +577,21 @@ RED.editor = (function() {
$(this).attr("data-i18n",keys.join(";")); $(this).attr("data-i18n",keys.join(";"));
}); });
if ((type === "subflow") || (type === "subflow-template")) { if (type === "subflow-template") {
buildEnvForm(dialogForm, node); // This is the 'edit properties' dialog for a subflow template
// TODO: this needs to happen later in the dialog open sequence
// so that credentials can be loaded prior to building the form
RED.subflow.buildEditForm(type,node);
} }
// Add dummy fields to prevent 'Enter' submitting the form in some // Add dummy fields to prevent 'Enter' submitting the form in some
// cases, and also prevent browser auto-fill of password // cases, and also prevent browser auto-fill of password
// Add in reverse order as they are prepended... // - the elements cannot be hidden otherwise Chrome will ignore them.
$('<input type="password" style="display: none;" />').prependTo(dialogForm); // - the elements need to have id's that imply password/username
$('<input type="text" style="display: none;" />').prependTo(dialogForm); $('<div style="position: absolute; top: -2000px;"><input id="red-ui-trap-password" type="password"/></div>').prependTo(dialogForm);
$('<div style="position: absolute; top: -2000px;"><input id="red-ui-trap-username" type="text"/></div>').prependTo(dialogForm);
dialogForm.on("submit", function(e) { e.preventDefault();}); dialogForm.on("submit", function(e) { e.preventDefault();});
dialogForm.find('input').attr("autocomplete","disable"); dialogForm.find('input').attr("autocomplete","off");
return dialogForm; return dialogForm;
} }
@ -736,10 +604,18 @@ RED.editor = (function() {
var outputsDiv = $("#red-ui-editor-node-label-form-outputs"); var outputsDiv = $("#red-ui-editor-node-label-form-outputs");
var inputCount; var inputCount;
if (node.type === 'subflow') { var formInputs = $("#node-input-inputs").val();
inputCount = node.in.length; if (formInputs === undefined) {
if (node.type === 'subflow') {
inputCount = node.in.length;
} else {
inputCount = node.inputs || node._def.inputs || 0;
}
} else { } else {
inputCount = node.inputs || node._def.inputs || 0; inputCount = Math.min(1,Math.max(0,parseInt(formInputs)));
if (isNaN(inputCount)) {
inputCount = 0;
}
} }
var children = inputsDiv.children(); var children = inputsDiv.children();
@ -857,30 +733,8 @@ RED.editor = (function() {
} }
return result; return result;
} }
function showIconPicker(container, node, iconPath, done) { function showIconPicker(container, backgroundColor, iconPath, faOnly, done) {
var containerPos = container.offset(); var picker = $('<div class="red-ui-icon-picker">');
var pickerBackground = $('<div>').css({
position: "absolute",top:0,bottom:0,left:0,right:0,zIndex:20
}).appendTo("body");
var top = containerPos.top - 30;
if (top+280 > $( window ).height()) {
top = $( window ).height() - 280;
}
var picker = $('<div class="red-ui-icon-picker">').css({
top: top+"px",
left: containerPos.left+"px",
}).appendTo("#red-ui-editor");
var hide = function() {
pickerBackground.remove();
picker.remove();
RED.keyboard.remove("escape");
}
RED.keyboard.add("*","escape",function(){hide()});
pickerBackground.on("mousedown", hide);
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(picker); var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(picker);
searchInput = $('<input type="text">').attr("placeholder",RED._("editor.searchIcons")).appendTo(searchDiv).searchBox({ searchInput = $('<input type="text">').attr("placeholder",RED._("editor.searchIcons")).appendTo(searchDiv).searchBox({
delay: 50, delay: 50,
@ -908,46 +762,160 @@ RED.editor = (function() {
var summary = $('<span>').appendTo(metaRow); var summary = $('<span>').appendTo(metaRow);
var resetButton = $('<button type="button" class="red-ui-button red-ui-button-small">'+RED._("editor.useDefault")+'</button>').appendTo(metaRow).on("click", function(e) { var resetButton = $('<button type="button" class="red-ui-button red-ui-button-small">'+RED._("editor.useDefault")+'</button>').appendTo(metaRow).on("click", function(e) {
e.preventDefault(); e.preventDefault();
hide(); iconPanel.hide();
done(null); done(null);
}); });
var iconSets = RED.nodes.getIconSets(); if (!backgroundColor && faOnly) {
Object.keys(iconSets).forEach(function(moduleName) { iconList.addClass("red-ui-icon-list-dark");
var icons = iconSets[moduleName]; }
if (icons.length > 0) { setTimeout(function() {
// selectIconModule.append($("<option></option>").val(moduleName).text(moduleName)); var iconSets = RED.nodes.getIconSets();
var header = $('<div class="red-ui-icon-list-module"></div>').text(moduleName).appendTo(iconList); Object.keys(iconSets).forEach(function(moduleName) {
$('<i class="fa fa-cube"></i>').prependTo(header); if (faOnly && (moduleName !== "font-awesome")) {
icons.forEach(function(icon) { return;
var iconDiv = $('<div>',{class:"red-ui-icon-list-icon"}).appendTo(iconList); }
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconDiv); var icons = iconSets[moduleName];
var colour = RED.utils.getNodeColor(node.type, node._def); if (icons.length > 0) {
var icon_url = RED.settings.apiRootUrl+"icons/"+moduleName+"/"+icon; // selectIconModule.append($("<option></option>").val(moduleName).text(moduleName));
iconDiv.data('icon',icon_url); var header = $('<div class="red-ui-icon-list-module"></div>').text(moduleName).appendTo(iconList);
nodeDiv.css('backgroundColor',colour); $('<i class="fa fa-cube"></i>').prependTo(header);
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv); icons.forEach(function(icon) {
RED.utils.createIconElement(icon_url, iconContainer, true); var iconDiv = $('<div>',{class:"red-ui-icon-list-icon"}).appendTo(iconList);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconDiv);
var icon_url = RED.settings.apiRootUrl+"icons/"+moduleName+"/"+icon;
iconDiv.data('icon',icon_url);
if (backgroundColor) {
nodeDiv.css({
'backgroundColor': backgroundColor
});
}
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
RED.utils.createIconElement(icon_url, iconContainer, true);
if (iconPath.module === moduleName && iconPath.file === icon) { if (iconPath.module === moduleName && iconPath.file === icon) {
iconDiv.addClass("selected"); iconDiv.addClass("selected");
} }
iconDiv.on("mouseover", function() { iconDiv.on("mouseover", function() {
summary.text(icon); summary.text(icon);
})
iconDiv.on("mouseout", function() {
summary.html("&nbsp;");
})
iconDiv.on("click", function() {
iconPanel.hide();
done(moduleName+"/"+icon);
})
}) })
iconDiv.on("mouseout", function() { }
summary.html("&nbsp;"); });
}) setTimeout(function() {
iconDiv.on("click", function() { spinner.remove();
hide(); },50);
done(moduleName+"/"+icon); },300);
}) var spinner = RED.utils.addSpinnerOverlay(iconList,true);
}) var iconPanel = RED.popover.panel(picker);
} iconPanel.show({
}); target: container
})
picker.slideDown(100); picker.slideDown(100);
searchInput.trigger("focus"); searchInput.trigger("focus");
} }
function createColorPicker(colorRow, color) {
var colorButton = $('<button type="button" class="red-ui-button red-ui-editor-node-appearance-button">').appendTo(colorRow);
$('<i class="fa fa-caret-down"></i>').appendTo(colorButton);
var colorDisp = $('<div>',{class:"red-ui-search-result-node"}).appendTo(colorButton);
var selector = $("<input/>", {
id: "red-ui-editor-node-color",
type: "text",
value: color
}).css({
marginLeft: "10px",
width: "150px",
}).appendTo(colorRow);
selector.on("change", function (e) {
var color = selector.val();
$(".red-ui-editor-node-appearance-button .red-ui-search-result-node").css({
"background-color": color
});
});
selector.trigger("change");
colorButton.on("click", function (e) {
var recommendedColors = [
"#DDAA99",
"#3FADB5", "#87A980", "#A6BBCF",
"#AAAA66", "#C0C0C0", "#C0DEED",
"#C7E9C0", "#D7D7A0", "#D8BFD8",
"#DAC4B4", "#DEB887", "#DEBD5C",
"#E2D96E", "#E6E0F8", "#E7E7AE",
"#E9967A", "#F3B567", "#FDD0A2",
"#FDF0C2", "#FFAAAA", "#FFCC66",
"#FFF0F0", "#FFFFFF"
].map(function(c) {
var r = parseInt(c.substring(1, 3), 16) / 255;
var g = parseInt(c.substring(3, 5), 16) / 255;
var b = parseInt(c.substring(5, 7), 16) / 255;
return {
hex: c,
r: r,
g: g,
b: b,
l: 0.3 * r + 0.59 * g + 0.11 * b
}
});
// Sort by luminosity.
recommendedColors.sort(function (a, b) {
return a.l - b.l;
});
var numColors = recommendedColors.length;
var width = 30;
var height = 30;
var margin = 2;
var perRow = 6;
var picker = $("<div/>", {
class: "red-ui-color-picker"
}).css({
width: ((width+margin+margin)*perRow)+"px",
height: Math.ceil(numColors/perRow)*(height+margin+margin)+"+px"
});
var count = 0;
var row = null;
recommendedColors.forEach(function (col) {
if ((count % perRow) == 0) {
row = $("<div/>").appendTo(picker);
}
var button = $("<button/>", {
}).css({
width: width+"px",
height: height+"px",
margin: margin+"px",
backgroundColor: col.hex,
"border-style": "solid",
"border-width": "1px",
"border-color": col.luma<0.92?col.hex:'#ccc'
}).appendTo(row);
button.on("click", function (e) {
e.preventDefault();
colorPanel.hide();
selector.val(col.hex);
selector.trigger("change");
});
count++;
});
var colorPanel = RED.popover.panel(picker);
colorPanel.show({
target: colorButton
})
});
}
function buildAppearanceForm(container,node) { function buildAppearanceForm(container,node) {
var dialogForm = $('<form class="dialog-form form-horizontal" autocomplete="off"></form>').appendTo(container); var dialogForm = $('<form class="dialog-form form-horizontal" autocomplete="off"></form>').appendTo(container);
@ -1026,13 +994,24 @@ RED.editor = (function() {
} }
$("#node-input-show-label").prop("checked",node.l).trigger("change"); $("#node-input-show-label").prop("checked",node.l).trigger("change");
if (node.type === "subflow") {
// subflow template can select its color
var color = node.color ? node.color : "#DDAA99";
var colorRow = $("<div/>", {
class: "form-row"
}).appendTo(dialogForm);
$("<label/>").text(RED._("editor.color")).appendTo(colorRow);
createColorPicker(colorRow, color);
}
// If a node has icon property in defaults, the icon of the node cannot be modified. (e.g, ui_button node in dashboard) // If a node has icon property in defaults, the icon of the node cannot be modified. (e.g, ui_button node in dashboard)
if ((!node._def.defaults || !node._def.defaults.hasOwnProperty("icon"))) { if ((!node._def.defaults || !node._def.defaults.hasOwnProperty("icon"))) {
var iconRow = $('<div class="form-row"></div>').appendTo(dialogForm); var iconRow = $('<div class="form-row"></div>').appendTo(dialogForm);
$('<label data-i18n="editor.settingIcon">').appendTo(iconRow); $('<label data-i18n="editor.settingIcon">').appendTo(iconRow);
var iconButton = $('<button type="button" class="red-ui-button" id="red-ui-editor-node-icon-button">').appendTo(iconRow); var iconButton = $('<button type="button" class="red-ui-button red-ui-editor-node-appearance-button">').appendTo(iconRow);
$('<i class="fa fa-caret-down"></i>').appendTo(iconButton);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconButton); var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconButton);
var colour = RED.utils.getNodeColor(node.type, node._def); var colour = RED.utils.getNodeColor(node.type, node._def);
var icon_url = RED.utils.getNodeIcon(node._def,node); var icon_url = RED.utils.getNodeIcon(node._def,node);
@ -1043,21 +1022,30 @@ RED.editor = (function() {
iconButton.on("click", function(e) { iconButton.on("click", function(e) {
e.preventDefault(); e.preventDefault();
var iconPath; var iconPath;
var icon = $("#red-ui-editor-node-icon").text()||""; var icon = $("#red-ui-editor-node-icon").val()||"";
if (icon) { if (icon) {
iconPath = RED.utils.separateIconPath(icon); iconPath = RED.utils.separateIconPath(icon);
} else { } else {
iconPath = RED.utils.getDefaultNodeIcon(node._def, node); iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
} }
showIconPicker(iconRow,node,iconPath,function(newIcon) { var backgroundColor = RED.utils.getNodeColor(node.type, node._def);
$("#red-ui-editor-node-icon").text(newIcon||""); if (node.type === "subflow") {
backgroundColor = $("#red-ui-editor-node-color").val();
}
showIconPicker(iconButton,backgroundColor,iconPath,false,function(newIcon) {
$("#red-ui-editor-node-icon").val(newIcon||"");
var icon_url = RED.utils.getNodeIcon(node._def,{type:node.type,icon:newIcon}); var icon_url = RED.utils.getNodeIcon(node._def,{type:node.type,icon:newIcon});
RED.utils.createIconElement(icon_url, iconContainer, true); RED.utils.createIconElement(icon_url, iconContainer, true);
}); });
}); });
$('<div id="red-ui-editor-node-icon">').text(node.icon).appendTo(iconButton);
RED.popover.tooltip(iconButton, function() {
return $("#red-ui-editor-node-icon").val() || RED._("editor.default");
})
$('<input type="hidden" id="red-ui-editor-node-icon">').val(node.icon).appendTo(iconRow);
} }
$('<div class="form-row"><span data-i18n="editor.portLabels"></span></div>').appendTo(dialogForm); $('<div class="form-row"><span data-i18n="editor.portLabels"></span></div>').appendTo(dialogForm);
var inputCount = node.inputs || node._def.inputs || 0; var inputCount = node.inputs || node._def.inputs || 0;
@ -1093,6 +1081,7 @@ RED.editor = (function() {
} }
} }
function updateLabels(editing_node, changes, outputMap) { function updateLabels(editing_node, changes, outputMap) {
var inputLabels = $("#red-ui-editor-node-label-form-inputs").children().find("input"); var inputLabels = $("#red-ui-editor-node-label-form-inputs").children().find("input");
var outputLabels = $("#red-ui-editor-node-label-form-outputs").children().find("input"); var outputLabels = $("#red-ui-editor-node-label-form-outputs").children().find("input");
@ -1336,11 +1325,13 @@ RED.editor = (function() {
newValue = parseInt(newValue); newValue = parseInt(newValue);
} }
} }
if (editing_node._def.defaults[d].type) {
if (newValue == "_ADD_") {
newValue = "";
}
}
if (editing_node[d] != newValue) { if (editing_node[d] != newValue) {
if (editing_node._def.defaults[d].type) { if (editing_node._def.defaults[d].type) {
if (newValue == "_ADD_") {
newValue = "";
}
// Change to a related config node // Change to a related config node
var configNode = RED.nodes.node(editing_node[d]); var configNode = RED.nodes.node(editing_node[d]);
if (configNode) { if (configNode) {
@ -1380,7 +1371,7 @@ RED.editor = (function() {
} }
if (!editing_node._def.defaults || !editing_node._def.defaults.hasOwnProperty("icon")) { if (!editing_node._def.defaults || !editing_node._def.defaults.hasOwnProperty("icon")) {
var icon = $("#red-ui-editor-node-icon").text()||"" var icon = $("#red-ui-editor-node-icon").val()||""
if (!isDefaultIcon) { if (!isDefaultIcon) {
if (icon !== editing_node.icon) { if (icon !== editing_node.icon) {
changes.icon = editing_node.icon; changes.icon = editing_node.icon;
@ -1483,13 +1474,26 @@ RED.editor = (function() {
if (type === "subflow") { if (type === "subflow") {
var old_env = editing_node.env; var old_env = editing_node.env;
var new_env = exportEnvList($("#node-input-env-container").editableList("items")); var new_env = RED.subflow.exportSubflowInstanceEnv(editing_node);
if (!isSameEnv(old_env, new_env)) { if (new_env && new_env.length > 0) {
new_env.forEach(function(prop) {
if (prop.type === "cred") {
editing_node.credentials = editing_node.credentials || {_:{}};
editing_node.credentials[prop.name] = prop.value;
editing_node.credentials['has_'+prop.name] = (prop.value !== "");
if (prop.value !== '__PWRD__') {
changed = true;
}
delete prop.value;
}
});
}
if (!isSameObj(old_env, new_env)) {
editing_node.env = new_env; editing_node.env = new_env;
changes.env = editing_node.env; changes.env = editing_node.env;
changed = true; changed = true;
} }
} }
if (changed) { if (changed) {
var wasChanged = editing_node.changed; var wasChanged = editing_node.changed;
@ -1607,6 +1611,20 @@ RED.editor = (function() {
buildEditForm(nodePropertiesTab.content,"dialog-form",type,ns,node); buildEditForm(nodePropertiesTab.content,"dialog-form",type,ns,node);
editorTabs.addTab(nodePropertiesTab); editorTabs.addTab(nodePropertiesTab);
if (/^subflow:/.test(node.type)) {
var subflowPropertiesTab = {
id: "editor-subflow-envProperties",
label: RED._("editor-tab.envProperties"),
name: RED._("editor-tab.envProperties"),
content: $('<div>', {id:"editor-subflow-envProperties-content",class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
iconClass: "fa fa-list"
};
editorTabs.addTab(subflowPropertiesTab);
// This tab is populated by the oneditprepare function of this
// subflow. That ensures it is done *after* any credentials
// have been loaded for the instance.
}
if (!node._def.defaults || !node._def.defaults.hasOwnProperty('info')) { if (!node._def.defaults || !node._def.defaults.hasOwnProperty('info')) {
var descriptionTab = { var descriptionTab = {
id: "editor-tab-description", id: "editor-tab-description",
@ -1768,7 +1786,8 @@ RED.editor = (function() {
RED.tray.resize(); RED.tray.resize();
} }
}, },
collapsible: true collapsible: true,
menu: false
}); });
var nodePropertiesTab = { var nodePropertiesTab = {
@ -1875,7 +1894,6 @@ RED.editor = (function() {
var configId = editing_config_node.id; var configId = editing_config_node.id;
var configAdding = adding; var configAdding = adding;
var configTypeDef = RED.nodes.getType(configType); var configTypeDef = RED.nodes.getType(configType);
if (configTypeDef.oneditcancel) { if (configTypeDef.oneditcancel) {
// TODO: what to pass as this to call // TODO: what to pass as this to call
if (configTypeDef.oneditcancel) { if (configTypeDef.oneditcancel) {
@ -2212,7 +2230,7 @@ RED.editor = (function() {
if (updateLabels(editing_node, changes, null)) { if (updateLabels(editing_node, changes, null)) {
changed = true; changed = true;
} }
var icon = $("#red-ui-editor-node-icon").text()||""; var icon = $("#red-ui-editor-node-icon").val()||"";
if ((editing_node.icon === undefined && icon !== "node-red/subflow.svg") || if ((editing_node.icon === undefined && icon !== "node-red/subflow.svg") ||
(editing_node.icon !== undefined && editing_node.icon !== icon)) { (editing_node.icon !== undefined && editing_node.icon !== icon)) {
changes.icon = editing_node.icon; changes.icon = editing_node.icon;
@ -2234,6 +2252,44 @@ RED.editor = (function() {
editing_node.category = newCategory; editing_node.category = newCategory;
changed = true; changed = true;
} }
var oldColor = editing_node.color;
var newColor = $("#red-ui-editor-node-color").val();
if (oldColor !== newColor) {
editing_node.color = newColor;
changes.color = newColor;
changed = true;
RED.utils.clearNodeColorCache();
if (editing_node.type === "subflow") {
var nodeDefinition = RED.nodes.getType(
"subflow:" + editing_node.id
);
nodeDefinition["color"] = newColor;
}
}
var old_env = editing_node.env;
var new_env = RED.subflow.exportSubflowTemplateEnv($("#node-input-env-container").editableList("items"));
if (new_env && new_env.length > 0) {
new_env.forEach(function(prop) {
if (prop.type === "cred") {
editing_node.credentials = editing_node.credentials || {_:{}};
editing_node.credentials[prop.name] = prop.value;
editing_node.credentials['has_'+prop.name] = (prop.value !== "");
if (prop.value !== '__PWRD__') {
changed = true;
}
delete prop.value;
}
});
}
if (!isSameObj(old_env, new_env)) {
editing_node.env = new_env;
changes.env = editing_node.env;
changed = true;
}
RED.palette.refresh(); RED.palette.refresh();
if (changed) { if (changed) {
@ -2247,6 +2303,7 @@ RED.editor = (function() {
id:n.id, id:n.id,
changed:n.changed changed:n.changed
}) })
n._def.color = editing_node.color;
n.changed = true; n.changed = true;
n.dirty = true; n.dirty = true;
updateNodeProperties(n); updateNodeProperties(n);
@ -2274,17 +2331,20 @@ RED.editor = (function() {
], ],
resize: function(size) { resize: function(size) {
$(".red-ui-tray-content").height(size.height - 50); $(".red-ui-tray-content").height(size.height - 50);
// var form = $(".red-ui-tray-content form").height(size.height - 50 - 40); var envContainer = $("#node-input-env-container");
var rows = $("#dialog-form>div:not(.node-input-env-container-row)"); if (envContainer.length) {
var height = size.height; // var form = $(".red-ui-tray-content form").height(size.height - 50 - 40);
for (var i=0; i<rows.size(); i++) { var rows = $("#dialog-form>div:not(#subflow-env-tabs-content)");
height -= $(rows[i]).outerHeight(true); var height = size.height;
for (var i=0; i<rows.size(); i++) {
height -= $(rows[i]).outerHeight(true);
}
// var editorRow = $("#dialog-form>div.node-input-env-container-row");
// height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-env-container").editableList('height',height-95);
} }
var editorRow = $("#dialog-form>div.node-input-env-container-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-env-container").editableList('height',height-60);
}, },
open: function(tray) { open: function(tray, done) {
var trayFooter = tray.find(".red-ui-tray-footer"); var trayFooter = tray.find(".red-ui-tray-footer");
var trayFooterLeft = $("<div/>", { var trayFooterLeft = $("<div/>", {
class: "red-ui-tray-footer-left" class: "red-ui-tray-footer-left"
@ -2324,7 +2384,8 @@ RED.editor = (function() {
RED.tray.resize(); RED.tray.resize();
} }
}, },
collapsible: true collapsible: true,
menu: false
}); });
var nodePropertiesTab = { var nodePropertiesTab = {
@ -2334,7 +2395,6 @@ RED.editor = (function() {
content: $('<div>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(), content: $('<div>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
iconClass: "fa fa-cog" iconClass: "fa fa-cog"
}; };
buildEditForm(nodePropertiesTab.content,"dialog-form","subflow-template", undefined, editing_node);
editorTabs.addTab(nodePropertiesTab); editorTabs.addTab(nodePropertiesTab);
var descriptionTab = { var descriptionTab = {
@ -2363,11 +2423,18 @@ RED.editor = (function() {
buildAppearanceForm(appearanceTab.content,editing_node); buildAppearanceForm(appearanceTab.content,editing_node);
editorTabs.addTab(appearanceTab); editorTabs.addTab(appearanceTab);
$("#subflow-input-name").val(subflow.name); $.getJSON(getCredentialsURL("subflow", subflow.id), function (data) {
RED.text.bidi.prepareInput($("#subflow-input-name")); subflow.credentials = data;
subflow.credentials._ = $.extend(true,{},data);
trayBody.i18n(); buildEditForm(nodePropertiesTab.content,"dialog-form","subflow-template", undefined, editing_node);
finishedBuilding = true; $("#subflow-input-name").val(subflow.name);
RED.text.bidi.prepareInput($("#subflow-input-name"));
trayBody.i18n();
finishedBuilding = true;
done();
});
}, },
close: function() { close: function() {
if (RED.view.state() != RED.state.IMPORT_DRAGGING) { if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
@ -2459,7 +2526,7 @@ RED.editor = (function() {
editor.toolbar = customEditTypes['_markdown'].buildToolbar(toolbarRow,editor); editor.toolbar = customEditTypes['_markdown'].buildToolbar(toolbarRow,editor);
if (options.expandable !== false) { if (options.expandable !== false) {
var expandButton = $('<button type="button" class="red-ui-button" style="float: right;"><i class="fa fa-expand"></i></button>').appendTo(editor.toolbar); var expandButton = $('<button type="button" class="red-ui-button" style="float: right;"><i class="fa fa-expand"></i></button>').appendTo(editor.toolbar);
RED.popover.tooltip(expandButton, RED._("markdownEditor.expand"));
expandButton.on("click", function(e) { expandButton.on("click", function(e) {
e.preventDefault(); e.preventDefault();
var value = editor.getValue(); var value = editor.getValue();
@ -2486,6 +2553,7 @@ RED.editor = (function() {
content: RED._("markdownEditor.format"), content: RED._("markdownEditor.format"),
autoClose: 50 autoClose: 50
}); });
session.setUseWrapMode(true);
} }
return editor; return editor;
} }
@ -2518,6 +2586,8 @@ RED.editor = (function() {
validateNode: validateNode, validateNode: validateNode,
updateNodeProperties: updateNodeProperties, // TODO: only exposed for edit-undo updateNodeProperties: updateNodeProperties, // TODO: only exposed for edit-undo
showIconPicker:showIconPicker,
/** /**
* Show a type editor. * Show a type editor.
* @param {string} type - the type to display * @param {string} type - the type to display
@ -2530,7 +2600,7 @@ RED.editor = (function() {
/** /**
* Register a type editor. * Register a type editor.
* @param {string} type - the type name * @param {string} type - the type name
* @param {object} options - the editor definition * @param {object} definition - the editor definition
* @function * @function
* @memberof RED.editor * @memberof RED.editor
*/ */

View File

@ -207,6 +207,7 @@
} }
expressionEditor.getSession().setValue(v||"",-1); expressionEditor.getSession().setValue(v||"",-1);
}); });
funcSelect.change();
var tabs = RED.tabs.create({ var tabs = RED.tabs.create({
element: $("#red-ui-editor-type-expression-tabs"), element: $("#red-ui-editor-type-expression-tabs"),

View File

@ -106,7 +106,7 @@
options.push({id:"red-ui-editor-type-json-menu-duplicate", icon:"fa fa-copy", label:RED._("jsonEditor.duplicate"),onselect:function(){ options.push({id:"red-ui-editor-type-json-menu-duplicate", icon:"fa fa-copy", label:RED._("jsonEditor.duplicate"),onselect:function(){
var newKey = item.key; var newKey = item.key;
if (item.parent.type === 'array') { if (item.parent.type === 'array') {
newKey = parent.children.length; newKey = item.parent.children.length;
} else { } else {
var m = /^(.*?)(-(\d+))?$/.exec(newKey); var m = /^(.*?)(-(\d+))?$/.exec(newKey);
var usedKeys = {}; var usedKeys = {};
@ -141,6 +141,7 @@
}) })
}}); }});
options.push({id:"red-ui-editor-type-json-menu-collapse-children",icon:"fa fa-angle-double-up", label:RED._('jsonEditor.collapseItems'),onselect:function(){ options.push({id:"red-ui-editor-type-json-menu-collapse-children",icon:"fa fa-angle-double-up", label:RED._('jsonEditor.collapseItems'),onselect:function(){
item.treeList.collapse();
item.children.forEach(function(child) { item.children.forEach(function(child) {
child.treeList.collapse(); child.treeList.collapse();
}) })
@ -300,9 +301,9 @@
var val = $('<input type="text" class="red-ui-editor-type-json-editor-value">').css({width:w+"px"}).val(""+valValue).insertAfter(valueLabel).typedInput({ var val = $('<input type="text" class="red-ui-editor-type-json-editor-value">').css({width:w+"px"}).val(""+valValue).insertAfter(valueLabel).typedInput({
types:[ types:[
'str','num','bool', 'str','num','bool',
{value:"null",label:"null",hasValue:false}, {value:"null",label:RED._("common.type.null"),hasValue:false},
{value:"array",label:"array",hasValue:false}, {value:"array",label:RED._("common.type.array"),hasValue:false,icon:"red/images/typedInput/json.png"},
{value:"object",label:"object",hasValue:false} {value:"object",label:RED._("common.type.object"),hasValue:false,icon:"red/images/typedInput/json.png"}
], ],
default: valType default: valType
}); });
@ -326,10 +327,10 @@
item.value = valValue; item.value = valValue;
var valClass; var valClass;
switch(valType) { switch(valType) {
case 'str': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "string"; valClass = "red-ui-debug-msg-type-string"; valValue = '"'+valValue+'"'; break; case 'str': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "string"; valClass = "red-ui-debug-msg-type-string"; valValue = '"'+valValue+'"'; break;
case 'num': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "number"; valClass = "red-ui-debug-msg-type-number"; break; case 'num': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "number"; valClass = "red-ui-debug-msg-type-number"; break;
case 'bool': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "boolean"; valClass = "red-ui-debug-msg-type-other"; item.value = (valValue === "true"); break; case 'bool': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "boolean"; valClass = "red-ui-debug-msg-type-other"; item.value = (valValue === "true"); break;
case 'null': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "null"; valClass = "red-ui-debug-msg-type-null"; item.value = valValue = "null"; break; case 'null': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "null"; valClass = "red-ui-debug-msg-type-null"; item.value = valValue = "null"; break;
case 'object': case 'object':
item.treeList.makeParent(orphanedChildren); item.treeList.makeParent(orphanedChildren);
item.type = "object"; item.type = "object";
@ -484,7 +485,7 @@
} else if (activeTab === "json-raw") { } else if (activeTab === "json-raw") {
result = expressionEditor.getValue(); result = expressionEditor.getValue();
} }
onComplete && onComplete(result); if (onComplete) { onComplete(result) }
RED.tray.close(); RED.tray.close();
} }
} }
@ -576,7 +577,7 @@
} catch(err) { } catch(err) {
rootNode = null; rootNode = null;
list.treeList('data',[{ list.treeList('data',[{
label: "Invalid JSON: "+err.toString() label: RED._("jsonEditor.error.invalidJSON")+err.toString()
}]); }]);
} }
} }

View File

@ -32,13 +32,13 @@
'<button type="button" class="red-ui-button" data-style="bq"><i class="fa fa-quote-left"></i></button>'+ '<button type="button" class="red-ui-button" data-style="bq"><i class="fa fa-quote-left"></i></button>'+
'<button type="button" class="red-ui-button" data-style="hr"><i class="fa fa-minus"></i></button>'+ '<button type="button" class="red-ui-button" data-style="hr"><i class="fa fa-minus"></i></button>'+
'<button type="button" class="red-ui-button" data-style="link"><i class="fa fa-link"></i></button>'+ '<button type="button" class="red-ui-button" data-style="link"><i class="fa fa-link"></i></button>'+
'</span>' '</span>'+
'</div>'; '</div>';
var template = '<script type="text/x-red" data-template-name="_markdown">'+ var template = '<script type="text/x-red" data-template-name="_markdown">'+
'<div id="red-ui-editor-type-markdown-panels">'+ '<div id="red-ui-editor-type-markdown-panels">'+
'<div id="red-ui-editor-type-markdown-panel-editor" class="red-ui-panel">'+ '<div id="red-ui-editor-type-markdown-panel-editor" class="red-ui-panel">'+
'<div style="height: 100%; margin: auto; max-width: 1000px;">'+ '<div style="height: 100%; margin: auto;">'+
'<div id="red-ui-editor-type-markdown-toolbar"></div>'+ '<div id="red-ui-editor-type-markdown-toolbar"></div>'+
'<div class="node-text-editor" style="height: 100%" id="red-ui-editor-type-markdown"></div>'+ '<div class="node-text-editor" style="height: 100%" id="red-ui-editor-type-markdown"></div>'+
'</div>'+ '</div>'+

View File

@ -75,13 +75,16 @@ RED.palette.editor = (function() {
}); });
}) })
} }
function installNodeModule(id,version,callback) { function installNodeModule(id,version,url,callback) {
var requestBody = { var requestBody = {
module: id module: id
}; };
if (version) { if (version) {
requestBody.version = version; requestBody.version = version;
} }
if (url) {
requestBody.url = url;
}
$.ajax({ $.ajax({
url:"nodes", url:"nodes",
type: "POST", type: "POST",
@ -622,7 +625,7 @@ RED.palette.editor = (function() {
if ($(this).hasClass('disabled')) { if ($(this).hasClass('disabled')) {
return; return;
} }
update(entry,loadedIndex[entry.name].version,container,function(err){}); update(entry,loadedIndex[entry.name].version,loadedIndex[entry.name].pkg_url,container,function(err){});
}) })
@ -788,7 +791,7 @@ RED.palette.editor = (function() {
initInstallTab(); initInstallTab();
}) })
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({ packageList = $('<ol>',{style:"position: absolute;top: 79px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
addButton: false, addButton: false,
scrollOnAdd: false, scrollOnAdd: false,
addItem: function(container,i,object) { addItem: function(container,i,object) {
@ -872,7 +875,7 @@ RED.palette.editor = (function() {
$('<div id="red-ui-palette-module-install-shade" class="red-ui-palette-module-shade hide"><div class="red-ui-palette-module-shade-status"></div><img src="red/images/spin.svg" class="red-ui-palette-spinner"/></div>').appendTo(installTab); $('<div id="red-ui-palette-module-install-shade" class="red-ui-palette-module-shade hide"><div class="red-ui-palette-module-shade-status"></div><img src="red/images/spin.svg" class="red-ui-palette-spinner"/></div>').appendTo(installTab);
} }
function update(entry,version,container,done) { function update(entry,version,url,container,done) {
if (RED.settings.theme('palette.editable') === false) { if (RED.settings.theme('palette.editable') === false) {
done(new Error('Palette not editable')); done(new Error('Palette not editable'));
return; return;
@ -898,7 +901,7 @@ RED.palette.editor = (function() {
RED.actions.invoke("core:show-event-log"); RED.actions.invoke("core:show-event-log");
}); });
RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+entry.name+" "+version); RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+entry.name+" "+version);
installNodeModule(entry.name,version,function(xhr) { installNodeModule(entry.name,version,url,function(xhr) {
spinner.remove(); spinner.remove();
if (xhr) { if (xhr) {
if (xhr.responseJSON) { if (xhr.responseJSON) {
@ -1023,7 +1026,7 @@ RED.palette.editor = (function() {
RED.actions.invoke("core:show-event-log"); RED.actions.invoke("core:show-event-log");
}); });
RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+entry.id+" "+entry.version); RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+entry.id+" "+entry.version);
installNodeModule(entry.id,entry.version,function(xhr) { installNodeModule(entry.id,entry.version,entry.pkg_url,function(xhr) {
spinner.remove(); spinner.remove();
if (xhr) { if (xhr) {
if (xhr.responseJSON) { if (xhr.responseJSON) {

View File

@ -17,7 +17,20 @@
RED.palette = (function() { RED.palette = (function() {
var exclusion = ['config','unknown','deprecated']; var exclusion = ['config','unknown','deprecated'];
var coreCategories = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced']; var coreCategories = [
'subflows',
'common',
'function',
'network',
'input',
'output',
'sequence',
'parser',
'storage',
'analysis',
'social',
'advanced'
];
var categoryContainers = {}; var categoryContainers = {};
var sidebarControls; var sidebarControls;
@ -37,6 +50,7 @@ RED.palette = (function() {
var catDiv = $('<div id="red-ui-palette-container-'+category+'" class="red-ui-palette-category hide">'+ var catDiv = $('<div id="red-ui-palette-container-'+category+'" class="red-ui-palette-category hide">'+
'<div id="red-ui-palette-header-'+category+'" class="red-ui-palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+ '<div id="red-ui-palette-header-'+category+'" class="red-ui-palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+
'<div class="red-ui-palette-content" id="red-ui-palette-base-category-'+category+'">'+ '<div class="red-ui-palette-content" id="red-ui-palette-base-category-'+category+'">'+
'<div id="red-ui-palette-'+category+'"></div>'+
'<div id="red-ui-palette-'+category+'-input"></div>'+ '<div id="red-ui-palette-'+category+'-input"></div>'+
'<div id="red-ui-palette-'+category+'-output"></div>'+ '<div id="red-ui-palette-'+category+'-output"></div>'+
'<div id="red-ui-palette-'+category+'-function"></div>'+ '<div id="red-ui-palette-'+category+'-function"></div>'+
@ -78,24 +92,45 @@ RED.palette = (function() {
var lineHeight = 20; var lineHeight = 20;
var portHeight = 10; var portHeight = 10;
el.attr("data-palette-label",label);
label = RED.utils.sanitize(label); label = RED.utils.sanitize(label);
var words = label.split(/[ -]/); var words = label.split(/[ -]/);
var displayLines = []; var displayLines = [];
var currentLine = words[0]; var currentLine = "";
var currentLineWidth = RED.view.calculateTextWidth(currentLine, "red-ui-palette-label", 0); for (var i=0;i<words.length;i++) {
var word = words[i];
for (var i=1;i<words.length;i++) { var sep = (i == 0) ? "" : " ";
var newWidth = RED.view.calculateTextWidth(currentLine+" "+words[i], "red-ui-palette-label", 0); var newWidth = RED.view.calculateTextWidth(currentLine+sep+word, "red-ui-palette-label", 0);
if (newWidth < nodeWidth) { if (newWidth < nodeWidth) {
currentLine += " "+words[i]; currentLine += sep +word;
currentLineWidth = newWidth;
} else { } else {
displayLines.push(currentLine); if (i > 0) {
currentLine = words[i]; displayLines.push(currentLine);
currentLineWidth = RED.view.calculateTextWidth(currentLine, "red-ui-palette-label", 0); }
while (true) {
var wordWidth = RED.view.calculateTextWidth(word, "red-ui-palette-label", 0);
if (wordWidth >= nodeWidth) {
// break word if too wide
for(var j = word.length; j > 0; j--) {
var s = word.substring(0, j);
var width = RED.view.calculateTextWidth(s, "red-ui-palette-label", 0);
if (width < nodeWidth) {
displayLines.push(s);
word = word.substring(j);
break;
}
}
}
else {
currentLine = word;
break;
}
}
} }
} }
displayLines.push(currentLine); displayLines.push(currentLine);
@ -152,20 +187,25 @@ RED.palette = (function() {
function getPaletteNode(type) { function getPaletteNode(type) {
return $(".red-ui-palette-node[data-palette-type='"+type+"']"); return $(".red-ui-palette-node[data-palette-type='"+type+"']");
} }
function escapeCategory(category) {
return category.replace(/[ /.]/g,"_");
}
function addNodeType(nt,def) { function addNodeType(nt,def) {
if (getPaletteNode(nt).length) { if (getPaletteNode(nt).length) {
return; return;
} }
if (exclusion.indexOf(def.category)===-1) { var nodeCategory = def.category;
var originalCategory = def.category; if (exclusion.indexOf(nodeCategory)===-1) {
var category = def.category.replace(/ /g,"_");
var originalCategory = nodeCategory;
var category = escapeCategory(nodeCategory);
var rootCategory = category.split("-")[0]; var rootCategory = category.split("-")[0];
var d = $('<div>',{class:"red-ui-palette-node"}).attr("data-palette-type",nt).data('category',rootCategory); var d = $('<div>',{class:"red-ui-palette-node"}).attr("data-palette-type",nt).data('category',rootCategory);
var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1]; var label = nt;///^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
if (typeof def.paletteLabel !== "undefined") { if (typeof def.paletteLabel !== "undefined") {
try { try {
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||""; label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
@ -175,16 +215,14 @@ RED.palette = (function() {
} }
$('<div/>', { $('<div/>', {
class: "red-ui-palette-label" class: "red-ui-palette-label"+(((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-label-right" : "")
+ (((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-label-right" : "")
}).appendTo(d); }).appendTo(d);
if (def.icon) { if (def.icon) {
var icon_url = RED.utils.getNodeIcon(def); var icon_url = RED.utils.getNodeIcon(def);
var iconContainer = $('<div/>', { var iconContainer = $('<div/>', {
class: "red-ui-palette-icon-container" class: "red-ui-palette-icon-container"+(((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-icon-container-right" : "")
+ (((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-icon-container-right" : "")
}).appendTo(d); }).appendTo(d);
RED.utils.createIconElement(icon_url, iconContainer, true); RED.utils.createIconElement(icon_url, iconContainer, true);
} }
@ -203,7 +241,7 @@ RED.palette = (function() {
d.append(portIn); d.append(portIn);
} }
createCategory(def.category,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id); createCategory(nodeCategory,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
$("#red-ui-palette-"+category).append(d); $("#red-ui-palette-"+category).append(d);
@ -241,7 +279,6 @@ RED.palette = (function() {
RED.sidebar.info.set(helpText,RED._("sidebar.info.nodeHelp")); RED.sidebar.info.set(helpText,RED._("sidebar.info.nodeHelp"));
}); });
var chart = $("#red-ui-workspace-chart"); var chart = $("#red-ui-workspace-chart");
var chartOffset = chart.offset();
var chartSVG = $("#red-ui-workspace-chart>svg").get(0); var chartSVG = $("#red-ui-workspace-chart>svg").get(0);
var activeSpliceLink; var activeSpliceLink;
var mouseX; var mouseX;
@ -262,11 +299,12 @@ RED.palette = (function() {
}, },
stop: function() { d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}}, stop: function() { d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false); if (spliceTimer) { clearTimeout(spliceTimer); spliceTimer = null;}},
drag: function(e,ui) { drag: function(e,ui) {
ui.originalPosition.left = $('#' + e.target.id).offset().left; var paletteNode = getPaletteNode(nt);
ui.originalPosition.left = paletteNode.offset().left;
if (def.inputs > 0 && def.outputs > 0) { if (def.inputs > 0 && def.outputs > 0) {
mouseX = ui.position.left-paletteWidth+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft(); mouseX = ui.position.left - paletteWidth + (ui.helper.width()/2) + chart.scrollLeft();
mouseY = ui.position.top-paletteTop+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop(); mouseY = ui.position.top - paletteTop + (ui.helper.height()/2) + chart.scrollTop();
if (!spliceTimer) { if (!spliceTimer) {
spliceTimer = setTimeout(function() { spliceTimer = setTimeout(function() {
var nodes = []; var nodes = [];
@ -382,14 +420,10 @@ RED.palette = (function() {
var portOutput = paletteNode.find(".red-ui-palette-port-output"); var portOutput = paletteNode.find(".red-ui-palette-port-output");
var paletteLabel = paletteNode.find(".red-ui-palette-label"); var paletteLabel = paletteNode.find(".red-ui-palette-label");
paletteLabel.attr("class","red-ui-palette-label" paletteLabel.attr("class","red-ui-palette-label" + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-label-right" : ""));
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-label-right" : "")
);
var paletteIconContainer = paletteNode.find(".red-ui-palette-icon-container"); var paletteIconContainer = paletteNode.find(".red-ui-palette-icon-container");
paletteIconContainer.attr("class","red-ui-palette-icon-container" paletteIconContainer.attr("class","red-ui-palette-icon-container" + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-icon-container-right" : ""));
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-icon-container-right" : "")
);
if (portInput.length === 0 && sf.in.length > 0) { if (portInput.length === 0 && sf.in.length > 0) {
var portIn = document.createElement("div"); var portIn = document.createElement("div");
@ -412,11 +446,11 @@ RED.palette = (function() {
var currentCategory = paletteNode.data('category'); var currentCategory = paletteNode.data('category');
var newCategory = (sf.category||"subflows"); var newCategory = (sf.category||"subflows");
if (currentCategory !== newCategory) { if (currentCategory !== newCategory) {
var category = newCategory.replace(/ /g,"_"); var category = escapeCategory(newCategory);
createCategory(newCategory,category,category,"node-red"); createCategory(newCategory,category,category,"node-red");
var currentCategoryNode = paletteNode.closest(".red-ui-palette-category"); var currentCategoryNode = paletteNode.closest(".red-ui-palette-category");
var newCategoryNode = $("#palette-"+category); var newCategoryNode = $("#red-ui-palette-"+category);
newCategoryNode.append(paletteNode); newCategoryNode.append(paletteNode);
if (newCategoryNode.find(".red-ui-palette-node").length === 1) { if (newCategoryNode.find(".red-ui-palette-node").length === 1) {
categoryContainers[category].open(); categoryContainers[category].open();
@ -429,17 +463,16 @@ RED.palette = (function() {
currentCategoryNode.find("i").toggleClass("expanded"); currentCategoryNode.find("i").toggleClass("expanded");
} }
} }
} }
paletteNode.css("backgroundColor", sf.color);
}); });
} }
function filterChange(val) { function filterChange(val) {
var re = new RegExp(val.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'),'i'); var re = new RegExp(val.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'),'i');
$("#red-ui-palette-container .red-ui-palette-node").each(function(i,el) { $("#red-ui-palette-container .red-ui-palette-node").each(function(i,el) {
var currentLabel = $(el).find(".red-ui-palette-label").text(); var currentLabel = $(el).attr("data-palette-label");
var type = $(el).attr("data-palette-type"); var type = $(el).attr("data-palette-type");
if (val === "" || re.test(type) || re.test(currentLabel)) { if (val === "" || re.test(type) || re.test(currentLabel)) {
$(this).show(); $(this).show();
@ -535,20 +568,26 @@ RED.palette = (function() {
sidebarControls.stop(false,true); sidebarControls.stop(false,true);
sidebarControls.hide(); sidebarControls.hide();
}) })
var userCategories = [];
var categoryList = coreCategories;
if (RED.settings.paletteCategories) { if (RED.settings.paletteCategories) {
categoryList = RED.settings.paletteCategories; userCategories = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) { } else if (RED.settings.theme('palette.categories')) {
categoryList = RED.settings.theme('palette.categories'); userCategories = RED.settings.theme('palette.categories');
} }
if (!Array.isArray(categoryList)) { if (!Array.isArray(userCategories)) {
categoryList = coreCategories userCategories = [];
} }
categoryList.forEach(function(category){
createCategoryContainer(category, category, "palette.label."+category);
});
var addedCategories = {};
userCategories.forEach(function(category){
addedCategories[category] = true;
createCategoryContainer(category, escapeCategory(category), "palette.label."+escapeCategory(category));
});
coreCategories.forEach(function(category){
if (!addedCategories[category]) {
createCategoryContainer(category, escapeCategory(category), "palette.label."+escapeCategory(category));
}
});
var paletteFooterButtons = $('<span class="button-group"></span>').appendTo("#red-ui-palette .red-ui-component-footer"); var paletteFooterButtons = $('<span class="button-group"></span>').appendTo("#red-ui-palette .red-ui-component-footer");
var paletteCollapseAll = $('<button type="button" class="red-ui-footer-button"><i class="fa fa-angle-double-up"></i></button>').appendTo(paletteFooterButtons); var paletteCollapseAll = $('<button type="button" class="red-ui-footer-button"><i class="fa fa-angle-double-up"></i></button>').appendTo(paletteFooterButtons);
@ -593,7 +632,6 @@ RED.palette = (function() {
setTimeout(function() { $(window).trigger("resize"); } ,200); setTimeout(function() { $(window).trigger("resize"); } ,200);
} }
function getCategories() { function getCategories() {
var categories = []; var categories = [];
$("#red-ui-palette-container .red-ui-palette-category").each(function(i,d) { $("#red-ui-palette-container .red-ui-palette-category").each(function(i,d) {

View File

@ -160,7 +160,7 @@ RED.projects.settings = (function() {
if (activeProject.description) { if (activeProject.description) {
desc = marked(activeProject.description); desc = marked(activeProject.description);
} else { } else {
desc = '<span class="red-ui-help-info-none">'+'No description available'+'</span>'; desc = '<span class="red-ui-help-info-none">' + RED._("sidebar.project.noDescriptionAvailable") + '</span>';
} }
var description = addTargetToExternalLinks($('<span class="red-ui-text-bidi-aware" dir=\"'+RED.text.bidi.resolveBaseTextDir(desc)+'">'+desc+'</span>')).appendTo(container); var description = addTargetToExternalLinks($('<span class="red-ui-text-bidi-aware" dir=\"'+RED.text.bidi.resolveBaseTextDir(desc)+'">'+desc+'</span>')).appendTo(container);
description.find(".red-ui-text-bidi-aware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" ); description.find(".red-ui-text-bidi-aware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
@ -222,7 +222,7 @@ RED.projects.settings = (function() {
if (summary) { if (summary) {
container.text(summary).removeClass('node-info-node'); container.text(summary).removeClass('node-info-node');
} else { } else {
container.text(RED._("sidebar.project.projectSettings.noSummaryAvailable")).addClass('red-ui-help-info-none'); container.text(RED._("sidebar.project.noSummaryAvailable")).addClass('red-ui-help-info-none');
} }
} }

View File

@ -1938,8 +1938,9 @@ RED.projects = (function() {
resultCallbackArgs = data; resultCallbackArgs = data;
} }
}).fail(function(xhr,textStatus,err) { }).fail(function(xhr,textStatus,err) {
var responses;
if (options.responses && options.responses[xhr.status]) { if (options.responses && options.responses[xhr.status]) {
var responses = options.responses[xhr.status]; responses = options.responses[xhr.status];
if (typeof responses === 'function') { if (typeof responses === 'function') {
resultCallback = responses; resultCallback = responses;
resultCallbackArgs = {error:responses.statusText}; resultCallbackArgs = {error:responses.statusText};

View File

@ -336,7 +336,7 @@ RED.sidebar.versionControl = (function() {
var unstagedContent = $('<div class="red-ui-sidebar-vc-change-container"></div>').appendTo(localChanges.content); var unstagedContent = $('<div class="red-ui-sidebar-vc-change-container"></div>').appendTo(localChanges.content);
var header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.localFiles")+'</div>').appendTo(unstagedContent); var header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.localFiles")+'</div>').appendTo(unstagedContent);
stageAllButton = $('<button class="red-ui-button red-ui-button-small" style="float: right"><i class="fa fa-plus"></i> '+RED._("sidebar.project.versionControl.all")+'</button>') stageAllButton = $('<button class="red-ui-button red-ui-button-small" style="position: absolute; right: 5px; top: 5px;"><i class="fa fa-plus"></i> '+RED._("sidebar.project.versionControl.all")+'</button>')
.appendTo(header) .appendTo(header)
.on("click", function(evt) { .on("click", function(evt) {
evt.preventDefault(); evt.preventDefault();
@ -368,7 +368,7 @@ RED.sidebar.versionControl = (function() {
unmergedContent = $('<div class="red-ui-sidebar-vc-change-container"></div>').appendTo(localChanges.content); unmergedContent = $('<div class="red-ui-sidebar-vc-change-container"></div>').appendTo(localChanges.content);
header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.unmergedChanges")+'</div>').appendTo(unmergedContent); header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.unmergedChanges")+'</div>').appendTo(unmergedContent);
bg = $('<div style="float: right"></div>').appendTo(header); bg = $('<div style="position: absolute; right: 5px; top: 5px;"></div>').appendTo(header);
var abortMergeButton = $('<button class="red-ui-button red-ui-button-small" style="margin-right: 5px;">'+RED._("sidebar.project.versionControl.abortMerge")+'</button>') var abortMergeButton = $('<button class="red-ui-button red-ui-button-small" style="margin-right: 5px;">'+RED._("sidebar.project.versionControl.abortMerge")+'</button>')
.appendTo(bg) .appendTo(bg)
.on("click", function(evt) { .on("click", function(evt) {
@ -433,7 +433,7 @@ RED.sidebar.versionControl = (function() {
header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.changeToCommit")+'</div>').appendTo(stagedContent); header = $('<div class="red-ui-sidebar-vc-change-header">'+RED._("sidebar.project.versionControl.changeToCommit")+'</div>').appendTo(stagedContent);
bg = $('<div style="float: right"></div>').appendTo(header); bg = $('<div style="position: absolute; right: 5px; top: 5px;"></div>').appendTo(header);
var showCommitBox = function() { var showCommitBox = function() {
commitMessage.val(""); commitMessage.val("");
submitCommitButton.prop("disabled",true); submitCommitButton.prop("disabled",true);

View File

@ -125,6 +125,14 @@ RED.search = (function() {
for (i=0;i<Math.min(results.length,25);i++) { for (i=0;i<Math.min(results.length,25);i++) {
searchResults.editableList('addItem',results[i]) searchResults.editableList('addItem',results[i])
} }
if (results.length > 25) {
searchResults.editableList('addItem', {
more: {
results: results,
start: 25
}
})
}
} else { } else {
searchResults.editableList('addItem',{}); searchResults.editableList('addItem',{});
} }
@ -186,8 +194,27 @@ RED.search = (function() {
evt.preventDefault(); evt.preventDefault();
} else if (evt.keyCode === 13) { } else if (evt.keyCode === 13) {
// Enter // Enter
if (results.length > 0) { children = searchResults.children();
reveal(results[Math.max(0,selected)].node); if ($(children[selected]).hasClass("red-ui-search-more")) {
var object = $(children[selected]).find(".red-ui-editableList-item-content").data('data');
if (object) {
searchResults.editableList('removeItem',object);
for (i=object.more.start;i<Math.min(results.length,object.more.start+25);i++) {
searchResults.editableList('addItem',results[i])
}
if (results.length > object.more.start+25) {
searchResults.editableList('addItem', {
more: {
results: results,
start: object.more.start+25
}
})
}
}
} else {
if (results.length > 0) {
reveal(results[Math.max(0,selected)].node);
}
} }
} }
} }
@ -199,12 +226,32 @@ RED.search = (function() {
addButton: false, addButton: false,
addItem: function(container,i,object) { addItem: function(container,i,object) {
var node = object.node; var node = object.node;
if (node === undefined) { var div;
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container); if (object.more) {
container.parent().addClass("red-ui-search-more")
div = $('<a>',{href:'#',class:"red-ui-search-result red-ui-search-empty"}).appendTo(container);
div.text(RED._("palette.editor.more",{count:object.more.results.length-object.more.start}));
div.on("click", function(evt) {
evt.preventDefault();
searchResults.editableList('removeItem',object);
for (i=object.more.start;i<Math.min(results.length,object.more.start+25);i++) {
searchResults.editableList('addItem',results[i])
}
if (results.length > object.more.start+25) {
searchResults.editableList('addItem', {
more: {
results: results,
start: object.more.start+25
}
})
}
});
} else if (node === undefined) {
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
} else { } else {
var def = node._def; var def = node._def;
var div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container); div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div); var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(div);
var colour = RED.utils.getNodeColor(node.type,def); var colour = RED.utils.getNodeColor(node.type,def);

File diff suppressed because it is too large Load Diff

View File

@ -346,8 +346,8 @@ RED.sidebar.config = (function() {
refreshConfigNodeList(); refreshConfigNodeList();
} }
}); });
RED.popover.tooltip($('#red-ui-sidebar-config-filter-all'),"Show all config nodes"); RED.popover.tooltip($('#red-ui-sidebar-config-filter-all'), RED._("sidebar.config.showAllUnusedConfigNodes"));
RED.popover.tooltip($('#red-ui-sidebar-config-filter-unused'),"Show all unused config nodes"); RED.popover.tooltip($('#red-ui-sidebar-config-filter-unused'), RED._("sidebar.config.showAllUnusedConfigNodes"));
} }
function show(id) { function show(id) {

View File

@ -21,6 +21,7 @@ RED.sidebar.context = (function() {
var localCache = {}; var localCache = {};
var flowAutoRefresh; var flowAutoRefresh;
var nodeAutoRefresh;
var nodeSection; var nodeSection;
// var subflowSection; // var subflowSection;
var flowSection; var flowSection;
@ -34,18 +35,6 @@ RED.sidebar.context = (function() {
content = $("<div>").css({"position":"relative","height":"100%"}); content = $("<div>").css({"position":"relative","height":"100%"});
content.className = "red-ui-sidebar-context" content.className = "red-ui-sidebar-context"
var header = $('<div class="red-ui-sidebar-header"></div>').appendTo(content);
var autoUpdate = RED.settings.get("editor.context.refresh",false);
flowAutoRefresh = $('<input type="checkbox">').prop("checked",autoUpdate).appendTo(header).toggleButton({
baseClass: "red-ui-sidebar-header-button",
enabledLabel: RED._("sidebar.context.autoRefresh"),
disabledLabel: RED._("sidebar.context.autoRefresh")
}).on("change", function() {
var value = $(this).prop("checked");
RED.settings.set("editor.context.refresh",value);
});
var footerToolbar = $('<div></div>'); var footerToolbar = $('<div></div>');
var stackContainer = $("<div>",{class:"red-ui-sidebar-context-stack"}).appendTo(content); var stackContainer = $("<div>",{class:"red-ui-sidebar-context-stack"}).appendTo(content);
@ -55,10 +44,7 @@ RED.sidebar.context = (function() {
nodeSection = sections.add({ nodeSection = sections.add({
title: RED._("sidebar.context.node"), title: RED._("sidebar.context.node"),
collapsible: true, collapsible: true
// onexpand: function() {
// updateNode(currentNode,true);
// }
}); });
nodeSection.expand(); nodeSection.expand();
nodeSection.content.css({height:"100%"}); nodeSection.content.css({height:"100%"});
@ -66,30 +52,27 @@ RED.sidebar.context = (function() {
var table = $('<table class="red-ui-info-table"></table>').appendTo(nodeSection.content); var table = $('<table class="red-ui-info-table"></table>').appendTo(nodeSection.content);
nodeSection.table = $('<tbody>').appendTo(table); nodeSection.table = $('<tbody>').appendTo(table);
var bg = $('<div style="float: right"></div>').appendTo(nodeSection.header); var bg = $('<div style="float: right"></div>').appendTo(nodeSection.header);
$('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>')
var nodeAutoRefreshSetting = RED.settings.get("editor.context.nodeRefresh",false);
nodeAutoRefresh = $('<input type="checkbox">').prop("checked",nodeAutoRefreshSetting).appendTo(bg).toggleButton({
baseClass: "red-ui-sidebar-header-button red-ui-button-small",
enabledLabel: "",
disabledLabel: ""
}).on("change", function() {
var value = $(this).prop("checked");
RED.settings.set("editor.context.flowRefresh",value);
});
RED.popover.tooltip(nodeAutoRefresh.next(),RED._("sidebar.context.autoRefresh"));
var manualRefreshNode = $('<button class="red-ui-button red-ui-button-small" style="margin-left: 5px"><i class="fa fa-refresh"></i></button>')
.appendTo(bg) .appendTo(bg)
.on("click", function(evt) { .on("click", function(evt) {
evt.stopPropagation(); evt.stopPropagation();
evt.preventDefault(); evt.preventDefault();
updateNode(currentNode, true); updateNode(currentNode, true);
}) })
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh")); RED.popover.tooltip(manualRefreshNode,RED._("sidebar.context.refrsh"));
// subflowSection = sections.add({
// title: "Subflow",
// collapsible: true
// });
// subflowSection.expand();
// subflowSection.content.css({height:"100%"});
// bg = $('<div style="float: right"></div>').appendTo(subflowSection.header);
// $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>')
// .appendTo(bg)
// .on("click", function(evt) {
// evt.stopPropagation();
// evt.preventDefault();
// })
// RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
// subflowSection.container.hide();
flowSection = sections.add({ flowSection = sections.add({
title: RED._("sidebar.context.flow"), title: RED._("sidebar.context.flow"),
@ -101,14 +84,26 @@ RED.sidebar.context = (function() {
var table = $('<table class="red-ui-info-table"></table>').appendTo(flowSection.content); var table = $('<table class="red-ui-info-table"></table>').appendTo(flowSection.content);
flowSection.table = $('<tbody>').appendTo(table); flowSection.table = $('<tbody>').appendTo(table);
bg = $('<div style="float: right"></div>').appendTo(flowSection.header); bg = $('<div style="float: right"></div>').appendTo(flowSection.header);
$('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>')
var flowAutoRefreshSetting = RED.settings.get("editor.context.flowRefresh",false);
flowAutoRefresh = $('<input type="checkbox">').prop("checked",flowAutoRefreshSetting).appendTo(bg).toggleButton({
baseClass: "red-ui-sidebar-header-button red-ui-button-small",
enabledLabel: "",
disabledLabel: ""
}).on("change", function() {
var value = $(this).prop("checked");
RED.settings.set("editor.context.flowRefresh",value);
});
RED.popover.tooltip(flowAutoRefresh.next(),RED._("sidebar.context.autoRefresh"));
var manualRefreshFlow = $('<button class="red-ui-button red-ui-button-small" style="margin-left: 5px"><i class="fa fa-refresh"></i></button>')
.appendTo(bg) .appendTo(bg)
.on("click", function(evt) { .on("click", function(evt) {
evt.stopPropagation(); evt.stopPropagation();
evt.preventDefault(); evt.preventDefault();
updateFlow(currentFlow, true); updateFlow(currentFlow, true);
}) })
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh")); RED.popover.tooltip(manualRefreshFlow,RED._("sidebar.context.refrsh"));
globalSection = sections.add({ globalSection = sections.add({
title: RED._("sidebar.context.global"), title: RED._("sidebar.context.global"),
@ -144,28 +139,6 @@ RED.sidebar.context = (function() {
action: "core:show-context-tab" action: "core:show-context-tab"
}); });
// var toggleLiveButton = $("#sidebar-context-toggle-live");
// toggleLiveButton.on("click", function(evt) {
// evt.preventDefault();
// if ($(this).hasClass("selected")) {
// $(this).removeClass("selected");
// $(this).find("i").removeClass("fa-pause");
// $(this).find("i").addClass("fa-play");
// } else {
// $(this).addClass("selected");
// $(this).find("i").removeClass("fa-play");
// $(this).find("i").addClass("fa-pause");
// }
// });
// RED.popover.tooltip(toggleLiveButton, function() {
// if (toggleLiveButton.hasClass("selected")) {
// return "Pause live updates"
// } else {
// return "Start live updates"
// }
// });
RED.events.on("view:selection-changed", function(event) { RED.events.on("view:selection-changed", function(event) {
var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0]; var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0];
updateNode(selectedNode); updateNode(selectedNode);
@ -174,29 +147,18 @@ RED.sidebar.context = (function() {
RED.events.on("workspace:change", function(event) { RED.events.on("workspace:change", function(event) {
updateFlow(RED.nodes.workspace(event.workspace)); updateFlow(RED.nodes.workspace(event.workspace));
}) })
if (autoUpdate) {
updateEntry(globalSection,"context/global","global");
} else {
$(globalSection.table).empty();
$('<tr class="red-ui-help-info-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.refresh"></td></tr>').appendTo(globalSection.table).i18n();
globalSection.timestamp.html("&nbsp;");
}
$(globalSection.table).empty();
$('<tr class="red-ui-help-info-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.refresh"></td></tr>').appendTo(globalSection.table).i18n();
globalSection.timestamp.html("&nbsp;");
} }
function updateNode(node,force) { function updateNode(node,force) {
currentNode = node; currentNode = node;
if (force) { if (force || nodeAutoRefresh.prop("checked")) {
if (node) { if (node) {
updateEntry(nodeSection,"context/node/"+node.id,node.id); updateEntry(nodeSection,"context/node/"+node.id,node.id);
// if (/^subflow:/.test(node.type)) {
// subflowSection.container.show();
// updateEntry(subflowSection,"context/flow/"+node.id,node.id);
// } else {
// subflowSection.container.hide();
// }
} else { } else {
// subflowSection.container.hide();
updateEntry(nodeSection) updateEntry(nodeSection)
} }
} else { } else {

View File

@ -140,7 +140,7 @@ RED.sidebar.info = (function() {
var activeProject = RED.projects.getActiveProject(); var activeProject = RED.projects.getActiveProject();
if (activeProject) { if (activeProject) {
propRow = $('<tr class="red-ui-help-info-row"><td>Project</td><td></td></tr>').appendTo(tableBody); propRow = $('<tr class="red-ui-help-info-row"><td>'+ RED._("sidebar.project.name") + '</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).text(activeProject.name||""); $(propRow.children()[1]).text(activeProject.name||"");
$('<tr class="red-ui-help-property-expand blank"><td colspan="2"></td></tr>').appendTo(tableBody); $('<tr class="red-ui-help-property-expand blank"><td colspan="2"></td></tr>').appendTo(tableBody);
var editProjectButton = $('<button class="red-ui-button red-ui-button-small" style="position:absolute;right:2px;"><i class="fa fa-ellipsis-h"></i></button>') var editProjectButton = $('<button class="red-ui-button red-ui-button-small" style="position:absolute;right:2px;"><i class="fa fa-ellipsis-h"></i></button>')

View File

@ -27,15 +27,7 @@ RED.touch.radialMenu = (function() {
function createRadial(obj,pos,options) { function createRadial(obj,pos,options) {
isActive = true; isActive = true;
try { try {
touchMenu = d3.select("body").append("div") touchMenu = d3.select("body").append("div").classed("red-ui-editor-radial-menu",true)
.style({
position:"absolute",
top: 0,
left:0,
bottom:0,
right:0,
"z-index": 1000
})
.on('touchstart',function() { .on('touchstart',function() {
hide(); hide();
d3.event.preventDefault(); d3.event.preventDefault();
@ -43,43 +35,27 @@ RED.touch.radialMenu = (function() {
var menu = touchMenu.append("div") var menu = touchMenu.append("div")
.style({ .style({
position: "absolute", top: (pos[1]-80)+"px",
top: (pos[1]-80)+"px", left:(pos[0]-80)+"px",
left:(pos[0]-80)+"px",
"border-radius": "80px",
width: "160px",
height: "160px",
background: "rgba(255,255,255,0.6)",
border: "1px solid #666"
}); });
var menuOpts = []; var menuOpts = [];
var createMenuOpt = function(x,y,opt) { var createMenuOpt = function(x,y,opt) {
opt.el = menu.append("div") opt.el = menu.append("div").classed("red-ui-editor-radial-menu-opt",true)
.style({ .style({
position: "absolute",
top: (y+80-25)+"px", top: (y+80-25)+"px",
left:(x+80-25)+"px", left:(x+80-25)+"px"
"border-radius": "20px", })
width: "50px", .classed("red-ui-editor-radial-menu-opt-disabled",!!opt.disabled)
height: "50px",
background: "#fff",
border: "2px solid #666",
"text-align": "center",
"line-height":"50px"
});
opt.el.html(opt.name); opt.el.html(opt.name);
if (opt.disabled) {
opt.el.style({"border-color":"#ccc",color:"#ccc"});
}
opt.x = x; opt.x = x;
opt.y = y; opt.y = y;
menuOpts.push(opt); menuOpts.push(opt);
opt.el.on('touchstart',function() { opt.el.on('touchstart',function() {
opt.el.style("background","#999"); opt.el.classed("red-ui-editor-radial-menu-opt-active",true)
d3.event.preventDefault(); d3.event.preventDefault();
d3.event.stopPropagation(); d3.event.stopPropagation();
}); });

View File

@ -118,8 +118,8 @@ RED.userSettings = (function() {
},{ },{
title: "menu.label.view.grid", title: "menu.label.view.grid",
options: [ options: [
{setting:"view-show-grid",oldSetting:"menu-menu-item-view-show-grid",label:"menu.label.view.showGrid",toggle:true,onchange:"core:toggle-show-grid"}, {setting:"view-show-grid",oldSetting:"menu-menu-item-view-show-grid",label:"menu.label.view.showGrid", default: true, toggle:true,onchange:"core:toggle-show-grid"},
{setting:"view-snap-grid",oldSetting:"menu-menu-item-view-snap-grid",label:"menu.label.view.snapGrid",toggle:true,onchange:"core:toggle-snap-grid"}, {setting:"view-snap-grid",oldSetting:"menu-menu-item-view-snap-grid",label:"menu.label.view.snapGrid", default: true, toggle:true,onchange:"core:toggle-snap-grid"},
{setting:"view-grid-size",label:"menu.label.view.gridSize",type:"number",default: 20, onchange:RED.view.gridSize} {setting:"view-grid-size",label:"menu.label.view.gridSize",type:"number",default: 20, onchange:RED.view.gridSize}
] ]
}, },

View File

@ -912,6 +912,10 @@ RED.utils = (function() {
} }
var nodeColorCache = {}; var nodeColorCache = {};
function clearNodeColorCache() {
nodeColorCache = {};
}
function getNodeColor(type, def) { function getNodeColor(type, def) {
var result = def.color; var result = def.color;
var paletteTheme = RED.settings.theme('palette.theme') || []; var paletteTheme = RED.settings.theme('palette.theme') || [];
@ -1044,6 +1048,7 @@ RED.utils = (function() {
getNodeIcon: getNodeIcon, getNodeIcon: getNodeIcon,
getNodeLabel: getNodeLabel, getNodeLabel: getNodeLabel,
getNodeColor: getNodeColor, getNodeColor: getNodeColor,
clearNodeColorCache: clearNodeColorCache,
addSpinnerOverlay: addSpinnerOverlay, addSpinnerOverlay: addSpinnerOverlay,
decodeObject: decodeObject, decodeObject: decodeObject,
parseContextKey: parseContextKey, parseContextKey: parseContextKey,

View File

@ -105,6 +105,8 @@ RED.view.tools = (function() {
} }
} }
RED.view.redraw(); RED.view.redraw();
} else {
RED.view.scroll(dx*10,dy*10);
} }
} }
@ -112,6 +114,16 @@ RED.view.tools = (function() {
init: function() { init: function() {
RED.actions.add("core:align-selection-to-grid", alignToGrid); RED.actions.add("core:align-selection-to-grid", alignToGrid);
RED.actions.add("core:scroll-view-up", function() { RED.view.scroll(0,-RED.view.gridSize());});
RED.actions.add("core:scroll-view-right", function() { RED.view.scroll(RED.view.gridSize(),0);});
RED.actions.add("core:scroll-view-down", function() { RED.view.scroll(0,RED.view.gridSize());});
RED.actions.add("core:scroll-view-left", function() { RED.view.scroll(-RED.view.gridSize(),0);});
RED.actions.add("core:step-view-up", function() { RED.view.scroll(0,-5*RED.view.gridSize());});
RED.actions.add("core:step-view-right", function() { RED.view.scroll(5*RED.view.gridSize(),0);});
RED.actions.add("core:step-view-down", function() { RED.view.scroll(0,5*RED.view.gridSize());});
RED.actions.add("core:step-view-left", function() { RED.view.scroll(-5*RED.view.gridSize(),0);});
RED.actions.add("core:move-selection-up", function() { moveSelection(0,-1);}); RED.actions.add("core:move-selection-up", function() { moveSelection(0,-1);});
RED.actions.add("core:move-selection-right", function() { moveSelection(1,0);}); RED.actions.add("core:move-selection-right", function() { moveSelection(1,0);});
RED.actions.add("core:move-selection-down", function() { moveSelection(0,1);}); RED.actions.add("core:move-selection-down", function() { moveSelection(0,1);});

View File

@ -291,6 +291,7 @@ RED.view = (function() {
} }
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
n.dirty = true; n.dirty = true;
n.dirtyStatus = true;
}); });
updateSelection(); updateSelection();
updateActiveNodes(); updateActiveNodes();
@ -358,7 +359,7 @@ RED.view = (function() {
var spliceLink = $(ui.helper).data("splice"); var spliceLink = $(ui.helper).data("splice");
if (spliceLink) { if (spliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp // TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
RED.nodes.removeLink(spliceLink); RED.nodes.removeLink(spliceLink);
var link1 = { var link1 = {
source:spliceLink.source, source:spliceLink.source,
@ -406,6 +407,7 @@ RED.view = (function() {
RED.actions.add("core:delete-selection",deleteSelection); RED.actions.add("core:delete-selection",deleteSelection);
RED.actions.add("core:edit-selected-node",editSelection); RED.actions.add("core:edit-selected-node",editSelection);
RED.actions.add("core:undo",RED.history.pop); RED.actions.add("core:undo",RED.history.pop);
RED.actions.add("core:redo",RED.history.redo);
RED.actions.add("core:select-all-nodes",selectAll); RED.actions.add("core:select-all-nodes",selectAll);
RED.actions.add("core:zoom-in",zoomIn); RED.actions.add("core:zoom-in",zoomIn);
RED.actions.add("core:zoom-out",zoomOut); RED.actions.add("core:zoom-out",zoomOut);
@ -694,280 +696,8 @@ RED.view = (function() {
} }
if (mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) { if (mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) {
if (d3.event.metaKey || d3.event.ctrlKey) { if (d3.event.metaKey || d3.event.ctrlKey) {
point = d3.mouse(this);
var ox = point[0];
var oy = point[1];
if (RED.settings.get("editor").view['view-snap-grid']) {
// eventLayer.append("circle").attr("cx",point[0]).attr("cy",point[1]).attr("r","2").attr('fill','red')
point[0] = Math.round(point[0] / gridSize) * gridSize;
point[1] = Math.round(point[1] / gridSize) * gridSize;
// eventLayer.append("circle").attr("cx",point[0]).attr("cy",point[1]).attr("r","2").attr('fill','blue')
}
d3.event.stopPropagation(); d3.event.stopPropagation();
var mainPos = $("#red-ui-main-container").position(); showQuickAddDialog(d3.mouse(this));
if (mouse_mode !== RED.state.QUICK_JOINING) {
mouse_mode = RED.state.QUICK_JOINING;
$(window).on('keyup',disableQuickJoinEventHandler);
}
quickAddActive = true;
if (ghostNode) {
ghostNode.remove();
}
ghostNode = eventLayer.append("g").attr('transform','translate('+(point[0] - node_width/2)+','+(point[1] - node_height/2)+')');
ghostNode.append("rect")
.attr("class","red-ui-flow-node-placeholder")
.attr("rx", 5)
.attr("ry", 5)
.attr("width",node_width)
.attr("height",node_height)
.attr("fill","none")
// var ghostLink = ghostNode.append("svg:path")
// .attr("class","red-ui-flow-link-link")
// .attr("d","M 0 "+(node_height/2)+" H "+(gridSize * -2))
// .attr("opacity",0);
var filter = undefined;
if (drag_lines.length > 0) {
if (drag_lines[0].virtualLink) {
filter = {type:drag_lines[0].node.type === 'link in'?'link out':'link in'}
} else if (drag_lines[0].portType === PORT_TYPE_OUTPUT) {
filter = {input:true}
} else {
filter = {output:true}
}
quickAddLink = {
node: drag_lines[0].node,
port: drag_lines[0].port,
portType: drag_lines[0].portType,
}
if (drag_lines[0].virtualLink) {
quickAddLink.virtualLink = true;
}
hideDragLines();
}
var rebuildQuickAddLink = function() {
if (!quickAddLink) {
return;
}
if (!quickAddLink.el) {
quickAddLink.el = dragGroupLayer.append("svg:path").attr("class", "red-ui-flow-drag-line");
}
var numOutputs = (quickAddLink.portType === PORT_TYPE_OUTPUT)?(quickAddLink.node.outputs || 1):1;
var sourcePort = quickAddLink.port;
var portY = -((numOutputs-1)/2)*13 +13*sourcePort;
var sc = (quickAddLink.portType === PORT_TYPE_OUTPUT)?1:-1;
quickAddLink.el.attr("d",generateLinkPath(quickAddLink.node.x+sc*quickAddLink.node.w/2,quickAddLink.node.y+portY,point[0]-sc*node_width/2,point[1],sc));
}
if (quickAddLink) {
rebuildQuickAddLink();
}
var lastAddedX;
var lastAddedWidth;
RED.typeSearch.show({
x:d3.event.clientX-mainPos.left-node_width/2 - (ox-point[0]),
y:d3.event.clientY-mainPos.top+ node_height/2 + 5 - (oy-point[1]),
filter: filter,
move: function(dx,dy) {
if (ghostNode) {
var pos = d3.transform(ghostNode.attr("transform")).translate;
ghostNode.attr("transform","translate("+(pos[0]+dx)+","+(pos[1]+dy)+")")
point[0] += dx;
point[1] += dy;
rebuildQuickAddLink();
}
},
cancel: function() {
if (quickAddLink) {
if (quickAddLink.el) {
quickAddLink.el.remove();
}
quickAddLink = null;
}
quickAddActive = false;
if (ghostNode) {
ghostNode.remove();
}
resetMouseVars();
updateSelection();
hideDragLines();
redraw();
},
add: function(type,keepAdding) {
var result = addNode(type);
if (!result) {
return;
}
if (keepAdding) {
mouse_mode = RED.state.QUICK_JOINING;
}
var nn = result.node;
var historyEvent = result.historyEvent;
nn.x = point[0];
nn.y = point[1];
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
nn.l = showLabel;
}
if (quickAddLink) {
var drag_line = quickAddLink;
var src = null,dst,src_port;
if (drag_line.portType === PORT_TYPE_OUTPUT && (nn.inputs > 0 || drag_line.virtualLink) ) {
src = drag_line.node;
src_port = drag_line.port;
dst = nn;
} else if (drag_line.portType === PORT_TYPE_INPUT && (nn.outputs > 0 || drag_line.virtualLink)) {
src = nn;
dst = drag_line.node;
src_port = 0;
}
if (src !== null) {
// Joining link nodes via virual wires. Need to update
// the src and dst links property
if (drag_line.virtualLink) {
historyEvent = {
t:'multi',
events: [historyEvent]
}
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
src.links.push(dst.id);
dst.links.push(src.id);
src.dirty = true;
dst.dirty = true;
historyEvent.events.push({
t:'edit',
node: src,
dirty: RED.nodes.dirty(),
changed: src.changed,
changes: {
links:oldSrcLinks
}
});
historyEvent.events.push({
t:'edit',
node: dst,
dirty: RED.nodes.dirty(),
changed: dst.changed,
changes: {
links:oldDstLinks
}
});
src.changed = true;
dst.changed = true;
} else {
var link = {source: src, sourcePort:src_port, target: dst};
RED.nodes.addLink(link);
historyEvent.links = [link];
}
if (!keepAdding) {
quickAddLink.el.remove();
quickAddLink = null;
if (mouse_mode === RED.state.QUICK_JOINING) {
if (drag_line.portType === PORT_TYPE_OUTPUT && nn.outputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
} else if (!quickAddLink && drag_line.portType === PORT_TYPE_INPUT && nn.inputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
} else {
resetMouseVars();
}
}
} else {
quickAddLink.node = nn;
quickAddLink.port = 0;
}
} else {
hideDragLines();
resetMouseVars();
}
} else {
if (!keepAdding) {
if (mouse_mode === RED.state.QUICK_JOINING) {
if (nn.outputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
} else if (nn.inputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
} else {
resetMouseVars();
}
}
} else {
if (nn.outputs > 0) {
quickAddLink = {
node: nn,
port: 0,
portType: PORT_TYPE_OUTPUT
}
} else if (nn.inputs > 0) {
quickAddLink = {
node: nn,
port: 0,
portType: PORT_TYPE_INPUT
}
} else {
resetMouseVars();
}
}
}
RED.history.push(historyEvent);
RED.nodes.add(nn);
RED.editor.validateNode(nn);
RED.nodes.dirty(true);
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
moving_set.push({n:nn});
updateActiveNodes();
updateSelection();
redraw();
// At this point the newly added node will have a real width,
// so check if the position needs nudging
if (lastAddedX !== undefined) {
var lastNodeRHEdge = lastAddedX + lastAddedWidth/2;
var thisNodeLHEdge = nn.x - nn.w/2;
var gap = thisNodeLHEdge - lastNodeRHEdge;
if (gap != gridSize *2) {
nn.x = nn.x + gridSize * 2 - gap;
nn.dirty = true;
nn.x = Math.ceil(nn.x / gridSize) * gridSize;
redraw();
}
}
if (keepAdding) {
if (lastAddedX === undefined) {
// ghostLink.attr("opacity",1);
setTimeout(function() {
RED.typeSearch.refresh({filter:{input:true}});
},100);
}
lastAddedX = nn.x;
lastAddedWidth = nn.w;
point[0] = nn.x + nn.w/2 + node_width/2 + gridSize * 2;
ghostNode.attr('transform','translate('+(point[0] - node_width/2)+','+(point[1] - node_height/2)+')');
rebuildQuickAddLink();
} else {
quickAddActive = false;
ghostNode.remove();
}
}
});
updateActiveNodes();
updateSelection();
redraw();
} }
} }
if (mouse_mode === 0 && !(d3.event.metaKey || d3.event.ctrlKey)) { if (mouse_mode === 0 && !(d3.event.metaKey || d3.event.ctrlKey)) {
@ -988,6 +718,303 @@ RED.view = (function() {
} }
} }
function showQuickAddDialog(point,spliceLink) {
var ox = point[0];
var oy = point[1];
if (RED.settings.get("editor").view['view-snap-grid']) {
// eventLayer.append("circle").attr("cx",point[0]).attr("cy",point[1]).attr("r","2").attr('fill','red')
point[0] = Math.round(point[0] / gridSize) * gridSize;
point[1] = Math.round(point[1] / gridSize) * gridSize;
// eventLayer.append("circle").attr("cx",point[0]).attr("cy",point[1]).attr("r","2").attr('fill','blue')
}
var mainPos = $("#red-ui-main-container").position();
if (mouse_mode !== RED.state.QUICK_JOINING) {
mouse_mode = RED.state.QUICK_JOINING;
$(window).on('keyup',disableQuickJoinEventHandler);
}
quickAddActive = true;
if (ghostNode) {
ghostNode.remove();
}
ghostNode = eventLayer.append("g").attr('transform','translate('+(point[0] - node_width/2)+','+(point[1] - node_height/2)+')');
ghostNode.append("rect")
.attr("class","red-ui-flow-node-placeholder")
.attr("rx", 5)
.attr("ry", 5)
.attr("width",node_width)
.attr("height",node_height)
.attr("fill","none")
// var ghostLink = ghostNode.append("svg:path")
// .attr("class","red-ui-flow-link-link")
// .attr("d","M 0 "+(node_height/2)+" H "+(gridSize * -2))
// .attr("opacity",0);
var filter;
if (drag_lines.length > 0) {
if (drag_lines[0].virtualLink) {
filter = {type:drag_lines[0].node.type === 'link in'?'link out':'link in'}
} else if (drag_lines[0].portType === PORT_TYPE_OUTPUT) {
filter = {input:true}
} else {
filter = {output:true}
}
quickAddLink = {
node: drag_lines[0].node,
port: drag_lines[0].port,
portType: drag_lines[0].portType,
}
if (drag_lines[0].virtualLink) {
quickAddLink.virtualLink = true;
}
hideDragLines();
}
if (spliceLink) {
filter = {input:true, output:true}
}
var rebuildQuickAddLink = function() {
if (!quickAddLink) {
return;
}
if (!quickAddLink.el) {
quickAddLink.el = dragGroupLayer.append("svg:path").attr("class", "red-ui-flow-drag-line");
}
var numOutputs = (quickAddLink.portType === PORT_TYPE_OUTPUT)?(quickAddLink.node.outputs || 1):1;
var sourcePort = quickAddLink.port;
var portY = -((numOutputs-1)/2)*13 +13*sourcePort;
var sc = (quickAddLink.portType === PORT_TYPE_OUTPUT)?1:-1;
quickAddLink.el.attr("d",generateLinkPath(quickAddLink.node.x+sc*quickAddLink.node.w/2,quickAddLink.node.y+portY,point[0]-sc*node_width/2,point[1],sc));
}
if (quickAddLink) {
rebuildQuickAddLink();
}
var lastAddedX;
var lastAddedWidth;
RED.typeSearch.show({
x:d3.event.clientX-mainPos.left-node_width/2 - (ox-point[0]),
y:d3.event.clientY-mainPos.top+ node_height/2 + 5 - (oy-point[1]),
filter: filter,
move: function(dx,dy) {
if (ghostNode) {
var pos = d3.transform(ghostNode.attr("transform")).translate;
ghostNode.attr("transform","translate("+(pos[0]+dx)+","+(pos[1]+dy)+")")
point[0] += dx;
point[1] += dy;
rebuildQuickAddLink();
}
},
cancel: function() {
if (quickAddLink) {
if (quickAddLink.el) {
quickAddLink.el.remove();
}
quickAddLink = null;
}
quickAddActive = false;
if (ghostNode) {
ghostNode.remove();
}
resetMouseVars();
updateSelection();
hideDragLines();
redraw();
},
add: function(type,keepAdding) {
var result = addNode(type);
if (!result) {
return;
}
if (keepAdding) {
mouse_mode = RED.state.QUICK_JOINING;
}
var nn = result.node;
var historyEvent = result.historyEvent;
nn.x = point[0];
nn.y = point[1];
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {
nn.l = showLabel;
}
if (quickAddLink) {
var drag_line = quickAddLink;
var src = null,dst,src_port;
if (drag_line.portType === PORT_TYPE_OUTPUT && (nn.inputs > 0 || drag_line.virtualLink) ) {
src = drag_line.node;
src_port = drag_line.port;
dst = nn;
} else if (drag_line.portType === PORT_TYPE_INPUT && (nn.outputs > 0 || drag_line.virtualLink)) {
src = nn;
dst = drag_line.node;
src_port = 0;
}
if (src !== null) {
// Joining link nodes via virual wires. Need to update
// the src and dst links property
if (drag_line.virtualLink) {
historyEvent = {
t:'multi',
events: [historyEvent]
}
var oldSrcLinks = $.extend(true,{},{v:src.links}).v
var oldDstLinks = $.extend(true,{},{v:dst.links}).v
src.links.push(dst.id);
dst.links.push(src.id);
src.dirty = true;
dst.dirty = true;
historyEvent.events.push({
t:'edit',
node: src,
dirty: RED.nodes.dirty(),
changed: src.changed,
changes: {
links:oldSrcLinks
}
});
historyEvent.events.push({
t:'edit',
node: dst,
dirty: RED.nodes.dirty(),
changed: dst.changed,
changes: {
links:oldDstLinks
}
});
src.changed = true;
dst.changed = true;
} else {
var link = {source: src, sourcePort:src_port, target: dst};
RED.nodes.addLink(link);
historyEvent.links = [link];
}
if (!keepAdding) {
quickAddLink.el.remove();
quickAddLink = null;
if (mouse_mode === RED.state.QUICK_JOINING) {
if (drag_line.portType === PORT_TYPE_OUTPUT && nn.outputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
} else if (!quickAddLink && drag_line.portType === PORT_TYPE_INPUT && nn.inputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
} else {
resetMouseVars();
}
}
} else {
quickAddLink.node = nn;
quickAddLink.port = 0;
}
} else {
hideDragLines();
resetMouseVars();
}
} else {
if (!keepAdding) {
if (mouse_mode === RED.state.QUICK_JOINING) {
if (nn.outputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_OUTPUT}]);
} else if (nn.inputs > 0) {
showDragLines([{node:nn,port:0,portType:PORT_TYPE_INPUT}]);
} else {
resetMouseVars();
}
}
} else {
if (nn.outputs > 0) {
quickAddLink = {
node: nn,
port: 0,
portType: PORT_TYPE_OUTPUT
}
} else if (nn.inputs > 0) {
quickAddLink = {
node: nn,
port: 0,
portType: PORT_TYPE_INPUT
}
} else {
resetMouseVars();
}
}
}
if (spliceLink) {
resetMouseVars();
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
RED.nodes.removeLink(spliceLink);
var link1 = {
source:spliceLink.source,
sourcePort:spliceLink.sourcePort,
target: nn
};
var link2 = {
source:nn,
sourcePort:0,
target: spliceLink.target
};
RED.nodes.addLink(link1);
RED.nodes.addLink(link2);
historyEvent.links = (historyEvent.links || []).concat([link1,link2]);
historyEvent.removedLinks = [spliceLink];
}
RED.history.push(historyEvent);
RED.nodes.add(nn);
RED.editor.validateNode(nn);
RED.nodes.dirty(true);
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
moving_set.push({n:nn});
updateActiveNodes();
updateSelection();
redraw();
// At this point the newly added node will have a real width,
// so check if the position needs nudging
if (lastAddedX !== undefined) {
var lastNodeRHEdge = lastAddedX + lastAddedWidth/2;
var thisNodeLHEdge = nn.x - nn.w/2;
var gap = thisNodeLHEdge - lastNodeRHEdge;
if (gap != gridSize *2) {
nn.x = nn.x + gridSize * 2 - gap;
nn.dirty = true;
nn.x = Math.ceil(nn.x / gridSize) * gridSize;
redraw();
}
}
if (keepAdding) {
if (lastAddedX === undefined) {
// ghostLink.attr("opacity",1);
setTimeout(function() {
RED.typeSearch.refresh({filter:{input:true}});
},100);
}
lastAddedX = nn.x;
lastAddedWidth = nn.w;
point[0] = nn.x + nn.w/2 + node_width/2 + gridSize * 2;
ghostNode.attr('transform','translate('+(point[0] - node_width/2)+','+(point[1] - node_height/2)+')');
rebuildQuickAddLink();
} else {
quickAddActive = false;
ghostNode.remove();
}
}
});
updateActiveNodes();
updateSelection();
redraw();
}
function canvasMouseMove() { function canvasMouseMove() {
var i; var i;
var node; var node;
@ -1134,8 +1161,8 @@ RED.view = (function() {
if (moving_set.length === 1) { if (moving_set.length === 1) {
node = moving_set[0]; node = moving_set[0];
spliceActive = node.n.hasOwnProperty("_def") && spliceActive = node.n.hasOwnProperty("_def") &&
node.n._def.inputs > 0 && ((node.n.hasOwnProperty("inputs") && node.n.inputs > 0) || (!node.n.hasOwnProperty("inputs") && node.n._def.inputs > 0)) &&
node.n._def.outputs > 0 && ((node.n.hasOwnProperty("outputs") && node.n.outputs > 0) || (!node.n.hasOwnProperty("outputs") && node.n._def.outputs > 0)) &&
RED.nodes.filterLinks({ source: node.n }).length === 0 && RED.nodes.filterLinks({ source: node.n }).length === 0 &&
RED.nodes.filterLinks({ target: node.n }).length === 0; RED.nodes.filterLinks({ target: node.n }).length === 0;
} }
@ -1268,12 +1295,15 @@ RED.view = (function() {
removedLinks.push(drag_lines[i].link) removedLinks.push(drag_lines[i].link)
} }
} }
historyEvent = { if (removedLinks.length > 0) {
t:"delete", historyEvent = {
links: removedLinks, t:"delete",
dirty:RED.nodes.dirty() links: removedLinks,
}; dirty:RED.nodes.dirty()
RED.history.push(historyEvent); };
RED.history.push(historyEvent);
RED.nodes.dirty(true);
}
hideDragLines(); hideDragLines();
} }
if (lasso) { if (lasso) {
@ -1465,6 +1495,7 @@ RED.view = (function() {
var lastSelection = null; var lastSelection = null;
function updateSelection() { function updateSelection() {
var selection = {}; var selection = {};
var activeWorkspace = RED.workspaces.active();
var workspaceSelection = RED.workspaces.selection(); var workspaceSelection = RED.workspaces.selection();
if (workspaceSelection.length === 0) { if (workspaceSelection.length === 0) {
@ -1474,7 +1505,6 @@ RED.view = (function() {
if (selected_link != null) { if (selected_link != null) {
selection.link = selected_link; selection.link = selected_link;
} }
var activeWorkspace = RED.workspaces.active();
activeLinks = RED.nodes.filterLinks({ activeLinks = RED.nodes.filterLinks({
source:{z:activeWorkspace}, source:{z:activeWorkspace},
target:{z:activeWorkspace} target:{z:activeWorkspace}
@ -1592,7 +1622,7 @@ RED.view = (function() {
var workspaceSelection = RED.workspaces.selection(); var workspaceSelection = RED.workspaces.selection();
if (workspaceSelection.length > 0) { if (workspaceSelection.length > 0) {
var workspaceCount = 0; var workspaceCount = 0;
workspaceSelection.forEach(function(ws) { if (ws.type === 'tab') workspaceCount++ }); workspaceSelection.forEach(function(ws) { if (ws.type === 'tab') { workspaceCount++ } });
if (workspaceCount === RED.workspaces.count()) { if (workspaceCount === RED.workspaces.count()) {
// Cannot delete all workspaces // Cannot delete all workspaces
return; return;
@ -1633,7 +1663,7 @@ RED.view = (function() {
var removedLinks = []; var removedLinks = [];
var removedSubflowOutputs = []; var removedSubflowOutputs = [];
var removedSubflowInputs = []; var removedSubflowInputs = [];
var removedSubflowStatus = undefined; var removedSubflowStatus;
var subflowInstances = []; var subflowInstances = [];
var startDirty = RED.nodes.dirty(); var startDirty = RED.nodes.dirty();
@ -1721,7 +1751,7 @@ RED.view = (function() {
], ],
dirty:RED.nodes.dirty() dirty:RED.nodes.dirty()
} }
RED.nodes.dirty(true);
selected_link.source.changed = true; selected_link.source.changed = true;
selected_link.target.changed = true; selected_link.target.changed = true;
selected_link.target.links.splice(sourceIdIndex,1); selected_link.target.links.splice(sourceIdIndex,1);
@ -2509,16 +2539,18 @@ RED.view = (function() {
var img = new Image(); var img = new Image();
img.src = iconUrl; img.src = iconUrl;
img.onload = function() { img.onload = function() {
var largestEdge = Math.max(img.width,img.height); if (!iconUrl.match(/\.svg$/)) {
var scaleFactor = 1; var largestEdge = Math.max(img.width,img.height);
if (largestEdge > 30) { var scaleFactor = 1;
scaleFactor = 30/largestEdge; if (largestEdge > 30) {
scaleFactor = 30/largestEdge;
}
var width = img.width * scaleFactor;
var height = img.height * scaleFactor;
icon.attr("width",width);
icon.attr("height",height);
icon.attr("x",15-width/2);
} }
var width = img.width * scaleFactor;
var height = img.height * scaleFactor;
icon.attr("width",width);
icon.attr("height",height);
icon.attr("x",15-width/2);
icon.attr("xlink:href",iconUrl); icon.attr("xlink:href",iconUrl);
icon.style("display",null); icon.style("display",null);
//if ("right" == d._def.align) { //if ("right" == d._def.align) {
@ -2580,8 +2612,8 @@ RED.view = (function() {
.on("mouseover",function(d){portMouseOver(d3.select(this),d,PORT_TYPE_INPUT,0);}) .on("mouseover",function(d){portMouseOver(d3.select(this),d,PORT_TYPE_INPUT,0);})
.on("mouseout",function(d){portMouseOut(d3.select(this),d,PORT_TYPE_INPUT,0);}); .on("mouseout",function(d){portMouseOut(d3.select(this),d,PORT_TYPE_INPUT,0);});
outGroup.append("svg:text").attr("class","red-ui-flow-port-label").attr("x",20).attr("y",8).style("font-size","10px").text("output"); outGroup.append("svg:text").attr("class","red-ui-flow-port-label").attr("x",20).attr("y",12).style("font-size","10px").text("output");
outGroup.append("svg:text").attr("class","red-ui-flow-port-label red-ui-flow-port-index").attr("x",20).attr("y",24).text(function(d,i){ return i+1}); outGroup.append("svg:text").attr("class","red-ui-flow-port-label red-ui-flow-port-index").attr("x",20).attr("y",28).text(function(d,i){ return i+1});
var subflowInputs = nodeLayer.selectAll(".red-ui-flow-subflow-port-input").data(activeSubflow.in,function(d,i){ return d.id;}); var subflowInputs = nodeLayer.selectAll(".red-ui-flow-subflow-port-input").data(activeSubflow.in,function(d,i){ return d.id;});
subflowInputs.exit().remove(); subflowInputs.exit().remove();
@ -3082,7 +3114,7 @@ RED.view = (function() {
//thisNode.selectAll(".red-ui-flow-node-icon-shade-border-right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)}); //thisNode.selectAll(".red-ui-flow-node-icon-shade-border-right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)});
var inputPorts = thisNode.selectAll(".red-ui-flow-port-input"); var inputPorts = thisNode.selectAll(".red-ui-flow-port-input");
if (isLink && showAllLinkPorts === -1 && !activeLinkNodes[d.id] && d.inputs === 0 && !inputPorts.empty()) { if ((!isLink || (showAllLinkPorts === -1 && !activeLinkNodes[d.id])) && d.inputs === 0 && !inputPorts.empty()) {
inputPorts.remove(); inputPorts.remove();
} else if (((isLink && (showAllLinkPorts===PORT_TYPE_INPUT||activeLinkNodes[d.id]))|| d.inputs === 1) && inputPorts.empty()) { } else if (((isLink && (showAllLinkPorts===PORT_TYPE_INPUT||activeLinkNodes[d.id]))|| d.inputs === 1) && inputPorts.empty()) {
var inputGroup = thisNode.append("g").attr("class","red-ui-flow-port-input"); var inputGroup = thisNode.append("g").attr("class","red-ui-flow-port-input");
@ -3252,7 +3284,7 @@ RED.view = (function() {
var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill; var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill;
thisNode.selectAll(".red-ui-flow-node-status").style("display","inline").attr("class","red-ui-flow-node-status "+statusClass); thisNode.selectAll(".red-ui-flow-node-status").style("display","inline").attr("class","red-ui-flow-node-status "+statusClass);
} }
if (d.status.text) { if (d.status.hasOwnProperty('text')) {
thisNode.selectAll(".red-ui-flow-node-status-label").text(d.status.text); thisNode.selectAll(".red-ui-flow-node-status-label").text(d.status.text);
} else { } else {
thisNode.selectAll(".red-ui-flow-node-status-label").text(""); thisNode.selectAll(".red-ui-flow-node-status-label").text("");
@ -3290,6 +3322,10 @@ RED.view = (function() {
redraw(); redraw();
focusView(); focusView();
d3.event.stopPropagation(); d3.event.stopPropagation();
if (d3.event.metaKey || d3.event.ctrlKey) {
l.classed("red-ui-flow-link-splice",true);
showQuickAddDialog(d3.mouse(this), selected_link);
}
}) })
.on("touchstart",function(d) { .on("touchstart",function(d) {
if (mouse_mode === RED.state.SELECTING_NODE) { if (mouse_mode === RED.state.SELECTING_NODE) {
@ -3896,6 +3932,10 @@ RED.view = (function() {
type: "compact", type: "compact",
buttons: buttons buttons: buttons
}) })
},
scroll: function(x,y) {
chart.scrollLeft(chart.scrollLeft()+x);
chart.scrollTop(chart.scrollTop()+y)
} }
}; };
})(); })();

View File

@ -70,7 +70,7 @@ RED.workspaces = (function() {
RED.view.state(RED.state.EDITING); RED.view.state(RED.state.EDITING);
var tabflowEditor; var tabflowEditor;
var trayOptions = { var trayOptions = {
title: RED._("workspace.editFlow",{name:workspace.label}), title: RED._("workspace.editFlow",{name:RED.utils.sanitize(workspace.label)}),
buttons: [ buttons: [
{ {
id: "node-dialog-delete", id: "node-dialog-delete",
@ -157,17 +157,27 @@ RED.workspaces = (function() {
tabflowEditor.resize(); tabflowEditor.resize();
}, },
open: function(tray) { open: function(tray) {
var trayFooter = tray.find(".red-ui-tray-footer");
var trayBody = tray.find('.red-ui-tray-body'); var trayBody = tray.find('.red-ui-tray-body');
var trayFooterLeft = $('<div class="red-ui-tray-footer-left"></div>').appendTo(trayFooter)
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody); var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
$('<div class="form-row">'+ $('<div class="form-row">'+
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+ '<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
'<input type="text" id="node-input-name">'+ '<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">'+
'</div>').appendTo(dialogForm); '</div>').appendTo(dialogForm);
$('<div class="form-row">'+
'<label for="node-input-disabled" data-i18n="editor:workspace.status"></label>'+ if (!workspace.hasOwnProperty("disabled")) {
'<input type="checkbox" id="node-input-disabled"/>'+ workspace.disabled = false;
'</div>').appendTo(dialogForm); }
$('<input id="node-input-disabled" type="checkbox">').prop("checked",workspace.disabled).appendTo(trayFooterLeft).toggleButton({
enabledIcon: "fa-circle-thin",
disabledIcon: "fa-ban",
invertState: true
})
var row = $('<div class="form-row node-text-editor-row">'+ var row = $('<div class="form-row node-text-editor-row">'+
'<label for="node-input-info" data-i18n="editor:workspace.info" style="width:300px;"></label>'+ '<label for="node-input-info" data-i18n="editor:workspace.info" style="width:300px;"></label>'+
@ -196,16 +206,7 @@ RED.workspaces = (function() {
}) })
}); });
if (workspace.hasOwnProperty("disabled")) {
$("#node-input-disabled").prop("checked",workspace.disabled);
} else {
workspace.disabled = false;
}
$("#node-input-disabled").toggleButton({
enabledIcon: "fa-circle-thin",
disabledIcon: "fa-ban",
invertState: true
})
$('<input type="text" style="display: none;" />').prependTo(dialogForm); $('<input type="text" style="display: none;" />').prependTo(dialogForm);
dialogForm.on("submit", function(e) { e.preventDefault();}); dialogForm.on("submit", function(e) { e.preventDefault();});

View File

@ -73,8 +73,8 @@ RED.user = (function() {
row.appendTo("#node-dialog-login-fields"); row.appendTo("#node-dialog-login-fields");
} }
$('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">'+RED._("user.loginFailed")+'</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+ $('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">'+RED._("user.loginFailed")+'</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+
(opts.cancelable?'<a href="#" id="node-dialog-login-cancel" style="margin-right: 20px;" tabIndex="'+(i+1)+'">'+RED._("common.label.cancel")+'</a>':'')+ (opts.cancelable?'<a href="#" id="node-dialog-login-cancel" class="red-ui-button" style="margin-right: 20px;" tabIndex="'+(i+1)+'">'+RED._("common.label.cancel")+'</a>':'')+
'<input type="submit" id="node-dialog-login-submit" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("user.login")+'"></div>').appendTo("#node-dialog-login-fields"); '<input type="submit" id="node-dialog-login-submit" class="red-ui-button" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("user.login")+'"></div>').appendTo("#node-dialog-login-fields");
$("#node-dialog-login-submit").button(); $("#node-dialog-login-submit").button();
@ -119,7 +119,7 @@ RED.user = (function() {
var field = data.prompts[i]; var field = data.prompts[i];
var row = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields"); var row = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields");
var loginButton = $('<a href="#"></a>',{style: "padding: 10px"}).appendTo(row).on("click", function() { var loginButton = $('<a href="#" class="red-ui-button"></a>',{style: "padding: 10px"}).appendTo(row).on("click", function() {
document.location = field.url; document.location = field.url;
}); });
if (field.image) { if (field.image) {

View File

@ -52,6 +52,10 @@
@include component-shadow; @include component-shadow;
border-color: $popover-background; border-color: $popover-background;
} }
textarea.ace_text-input {
overflow: hidden;
padding: 0px 1px !important;
}
#red-ui-event-log-editor { #red-ui-event-log-editor {
.ace_scroller { .ace_scroller {

View File

@ -60,10 +60,12 @@
.red-ui-icon-picker { .red-ui-icon-picker {
a { a {
text-decoration: none; text-decoration: none;
color: $primary-text-color;
} }
a:hover, a:hover,
a:focus { a:focus {
text-decoration: none; text-decoration: none;
color: $primary-text-color;
} }
p { p {

View File

@ -160,6 +160,7 @@
.red-ui-debug-msg-element { .red-ui-debug-msg-element {
color: $debug-message-text-color; color: $debug-message-text-color;
line-height: 1.3em; line-height: 1.3em;
overflow-wrap: break-word;
} }
.red-ui-debug-msg-object-key { .red-ui-debug-msg-object-key {
color: $debug-message-text-color-object-key; color: $debug-message-text-color-object-key;

View File

@ -79,6 +79,9 @@
} }
a { a {
img {
max-width: 14px;
}
.fa { .fa {
width: 20px; width: 20px;
margin-left: -25px; margin-left: -25px;

View File

@ -190,6 +190,10 @@ button.red-ui-tray-resize-button {
border-color: $form-input-border-error-color !important; border-color: $form-input-border-error-color !important;
} }
.input-updated {
border-color: $node-selected-color !important;
}
.form-row { .form-row {
clear: both; clear: both;
color: $form-text-color; color: $form-text-color;
@ -388,28 +392,26 @@ button.red-ui-button-small
} }
} }
button.red-ui-button.red-ui-editor-node-appearance-button {
#red-ui-editor-node-icon-button {
position: relative; position: relative;
padding-left: 30px; height: 35px !important;
width: calc(100% - 150px); text-align: left;
padding: 0 6px 0 3px;
>i {
width: 15px;
vertical-align: middle;
padding-left: 2px;
}
.red-ui-search-result-node { .red-ui-search-result-node {
position: absolute; vertical-align: middle;
top: 2px; float: none;
left: 2px; position: relative;
top: -1px;
} }
} }
#red-ui-editor-node-icon {
margin-left: 10px;
width: calc(100% - 163px);
}
.red-ui-icon-picker { .red-ui-icon-picker {
position: absolute;
border: 1px solid $primary-border-color;
box-shadow: 0 1px 6px -3px black;
background: $secondary-background;
z-Index: 21;
display: none;
select { select {
box-sizing: border-box; box-sizing: border-box;
margin: 3px; margin: 3px;
@ -421,6 +423,16 @@ button.red-ui-button-small
height: 200px; height: 200px;
overflow-y: scroll; overflow-y: scroll;
line-height: 0px; line-height: 0px;
position: relative;
&.red-ui-icon-list-dark {
.red-ui-palette-icon-fa {
color: $secondary-text-color;
}
.red-ui-palette-icon-container {
background: $secondary-background;
border-radius: 4px;
}
}
} }
.red-ui-icon-list-icon { .red-ui-icon-list-icon {
display: inline-block; display: inline-block;
@ -428,6 +440,7 @@ button.red-ui-button-small
padding: 4px; padding: 4px;
cursor: pointer; cursor: pointer;
border-radius: 4px; border-radius: 4px;
&:hover { &:hover {
background: $list-item-background-hover; background: $list-item-background-hover;
} }
@ -579,3 +592,407 @@ button.red-ui-button-small
button.red-ui-toggleButton.toggle { button.red-ui-toggleButton.toggle {
text-align: left; text-align: left;
} }
.red-ui-editor-subflow-env-ui-row {
margin-right: 3px;
>div {
display: grid;
grid-template-columns: 16px 40px 35% auto;
}
>div:first-child {
font-size: 0.9em;
color: $tertiary-text-color;
margin: 3px 0 -4px;
>div {
padding-left: 3px;
}
}
>div:last-child {
>div {
height: 40px;
line-height: 30px;
display: inline-block;
box-sizing: border-box;
// border-left: 2px dashed $secondary-border-color;
// border-bottom: 2px dashed $secondary-border-color;
// border: 1px dashed $secondary-border-color;
border-right: none;
&:not(:first-child) {
padding: 3px;
}
// &:last-child {
// border-right: 1px dashed $secondary-border-color;
// }
.placeholder-input {
position: relative;
padding: 0 3px;
line-height: 24px;
opacity: 0.8
}
.red-ui-typedInput-value-label,.red-ui-typedInput-option-label {
select,.placeholder-input {
margin: 3px;
height: 26px;
width: calc(100% - 10px);
padding-left: 3px;
}
.placeholder-input {
span:first-child {
display:inline-block;
height: 100%;
width: 20px;
text-align:center;
border-right: 1px solid $secondary-border-color;
background: $tertiary-background;
}
}
input[type="checkbox"] {
margin-left: 8px;
margin-top: 0;
height: 100%;
}
}
}
>div:nth-child(1) {
border: none;
padding: 2px;
.red-ui-editableList-item-handle {
position:relative;
top: 0px;
color: $tertiary-text-color;
}
}
>div:nth-child(2) {
margin: 4px;
height: 32px;
border: 1px dashed $secondary-border-color;
text-align: center;
a {
display: block;
width: 100%;
height: 100%;
line-height: 32px;
&:hover {
background: $secondary-background-hover;
}
i {
height: 100%;
vertical-align: middle;
}
}
}
>div:nth-child(3) {
position: relative;
input {
width: 100%;
}
}
}
}
span.red-ui-editor-subflow-env-lang-icon {
position: absolute;
display: inline-block;
background: $secondary-background;
opacity: 0.8;
width: 20px;
line-height: 32px;
height: 32px;
text-align: center;
top: 4px;
right: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
// .red-ui-editor-subflow-ui-grid {
// width: 100%;
// .red-ui-editableList-container {
// border: none;
// border-radius: 0;
// }
// .red-ui-editableList-container li {
// border: none;
// padding: 0;
// &:not(:first-child) .red-ui-editableList-item-content >div:first-child >div {
// border-top: none;
// }
// &.ui-sortable-helper {
// border: 2px dashed $secondary-border-color;
// .red-ui-editableList-item-content {
// >div {
// border: none;
// opacity: 0.7
// }
//
// }
// }
// }
//
// .red-ui-editableList-item-content {
// >div>div {
// display: inline-block;
// box-sizing: border-box;
// border-left: 1px dashed $secondary-border-color;
// border-bottom: 1px dashed $secondary-border-color;
// }
// >div:first-child {
// font-size: 0.9em;
// display: grid;
// grid-template-columns: 25px auto 20px;
// >div {
// border-top: 1px dashed $secondary-border-color;
// padding: 1px;
// }
// >div:nth-child(3) {
// border-top: none;
// border-bottom: none;
// // width: 20px;
// }
// }
// >div:last-child {
// display: grid;
// grid-template-columns: 25px 140px auto 20px;
// >div {
// height: 48px;
// line-height: 30px;
// // display: inline-block;
// // height: 48px;
// // line-height: 30px;
// // box-sizing: border-box;
// //
// // border-left: 2px dashed $secondary-border-color;
// border-top: none;
// // border-bottom: 2px dashed $secondary-border-color;
// &:not(:first-child) {
// padding: 6px 3px;
// }
// .placeholder-input {
// position: relative;
// padding: 0 3px;
// line-height: 24px;
// opacity: 0.8
// }
// .red-ui-typedInput-value-label,.red-ui-typedInput-option-label {
// select,.placeholder-input {
// margin: 3px;
// height: 26px;
// width: calc(100% - 10px);
// padding-left: 3px;
// }
// input[type="checkbox"] {
// margin-left: 8px;
// margin-top: 0;
// height: 100%;
// }
// }
// }
// >div:nth-child(1) {
// text-align: center;
// a {
// display: block;
// width: 100%;
// height: 100%;
// line-height: 45px;
// &:hover {
// background: $secondary-background-hover;
// }
// }
// }
// >div:nth-child(2) {
// input {
// width: 100%;
// }
// // width: 140px;
// }
// >div:nth-child(3) {
// position: relative;
// .options-button {
// position: absolute;
// top: calc(50% - 10px);
// margin-right: 2px;
// right: 2px;
// }
// }
// >div:nth-child(4) {
// border-top: none;
// border-bottom: none;
// // width: 20px;
// }
//
// }
// }
// }
.red-ui-editor-subflow-ui-edit-panel {
padding-bottom: 3px;
background: $primary-background;
.red-ui-editableList-border {
border: none;
border-radius: 0;
border-bottom: 1px solid $secondary-border-color;
}
.red-ui-editableList-container {
}
.red-ui-editableList-addButton {
margin-left: 2px;
}
.red-ui-editableList-header {
background: $primary-background;
display: grid;
grid-template-columns: 50% 50%;
color: $secondary-text-color;
div:first-child {
padding-left: 23px;
}
div:last-child {
padding-left: 3px;
}
}
.red-ui-editableList-container {
padding: 0 1px;
li {
background: $secondary-background;
// border-bottom: none;
padding: 0;
.red-ui-editableList-item-content {
display: grid;
grid-template-columns: 50% 50%;
>div {
position:relative;
}
}
input {
margin-bottom: 0;
border:none;
width: 100%;
border-right: 1px solid $secondary-border-color;
border-radius: 0;
&:focus {
box-shadow: 0 0 0 1px inset $form-input-focus-color;
}
&:first-child {
border-left: 1px solid $secondary-border-color;
}
}
button.red-ui-typedInput-type-select, button.red-ui-typedInput-option-expand, button.red-ui-typedInput-option-trigger {
border-radius: 0;
height: 34px;
}
.red-ui-typedInput-container {
border-radius: 0;
border: none;
input.red-ui-typedInput-input {
height: 34px;
border-right: none;
}
}
.red-ui-editor-subflow-env-lang-icon {
top: 1px;
right: 1px;
border-top-right-radius:0;
border-bottom-right-radius:0;
}
.red-ui-editableList-item-remove {
right: 3px;
}
}
}
}
.node-input-env-locales-row {
position: relative;
top: -20px;
float: right;
select {
padding: 2px;
width: 160px;
height: auto;
min-width: 20px;
line-height: 18px;
font-size: 10px;
}
}
.node-input-env-container-row {
min-width: 470px;
position: relative;
.red-ui-editableList-item-content {
label {
margin-bottom: 0;
line-height: 32px;
span {
display: inline-block;
width: 20px;
text-align: center;
}
}
>div:first-child {
display: grid;
padding-left: 5px;
grid-template-columns: 40% auto 37px;
> :first-child {
width: calc(100% - 5px);
}
input {
width: calc(100% - 5px);
}
}
&.red-ui-editor-subflow-env-editable {
>div:first-child {
padding-left: 0;
grid-template-columns: 24px 40% auto 37px;
> a:first-child {
text-align: center;
line-height: 32px;
i.fa-angle-right {
transition: all 0.2s linear;
}
&.expanded {
i.fa-angle-right {
transform: rotate(90deg);
}
}
}
}
}
}
.red-ui-editableList-border .red-ui-editableList-header {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
background: $tertiary-background;
padding: 0;
>div {
display: grid;
grid-template-columns: 24px 40% auto 37px;
>div {
display: inline-block;
}
}
}
.red-ui-editableList-container {
padding: 0;
.red-ui-editableList-item-handle {
top: 25px;
}
.red-ui-editableList-item-remove {
top: 25px;
right: 5px;
}
}
}
#subflow-input-ui {
// .form-row {
// display: grid;
// grid-template-columns: 120px auto;
// label span {
// display: inline-block;
// width: 20px;
// text-align: center;
// }
// }
}

View File

@ -145,8 +145,8 @@ g.red-ui-flow-node-selected {
border-color: $node-selected-color !important; border-color: $node-selected-color !important;
border-style: dashed !important; border-style: dashed !important;
stroke: $node-selected-color; stroke: $node-selected-color;
stroke-width: 2; stroke-width: 3;
stroke-dasharray: 8, 3; stroke-dasharray: 8, 4;
} }
.red-ui-flow-subflow .red-ui-flow-node { .red-ui-flow-subflow .red-ui-flow-node {

View File

@ -150,7 +150,8 @@
input[type="tel"], input[type="tel"],
input[type="color"], input[type="color"],
div[contenteditable="true"], div[contenteditable="true"],
.uneditable-input { .uneditable-input,
.placeholder-input {
box-sizing: border-box; box-sizing: border-box;
display: inline-block; display: inline-block;
height: 34px; height: 34px;
@ -190,7 +191,8 @@
input[type="tel"], input[type="tel"],
input[type="color"], input[type="color"],
div[contenteditable="true"], div[contenteditable="true"],
.uneditable-input { .uneditable-input,
.placeholder-input {
background-color: $form-input-background; background-color: $form-input-background;
border: 1px solid $form-input-border-color; border: 1px solid $form-input-border-color;
} }

View File

@ -36,6 +36,7 @@
font-size: 30px; font-size: 30px;
line-height: 30px; line-height: 30px;
text-decoration: none; text-decoration: none;
white-space: nowrap;
span { span {
vertical-align: middle; vertical-align: middle;
@ -192,6 +193,7 @@
color: $header-menu-color; color: $header-menu-color;
padding: 3px 40px; padding: 3px 40px;
img { img {
max-width: 100%;
margin-right: 10px; margin-right: 10px;
padding: 4px; padding: 4px;
border: 3px solid transparent; border: 3px solid transparent;
@ -271,3 +273,9 @@
vertical-align: middle; vertical-align: middle;
} }
} }
@media only screen and (max-width: 450px) {
span.red-ui-header-logo > span {
display: none;
}
}

View File

@ -119,10 +119,10 @@
} }
.red-ui-palette-node { .red-ui-palette-node {
display: inline-block; // display: inline-block;
cursor: move; cursor: move;
background: $secondary-background; background: $secondary-background;
margin: 5px auto; margin: 10px auto;
height: 25px; height: 25px;
border-radius: 5px; border-radius: 5px;
border: 1px solid $node-border; border: 1px solid $node-border;
@ -131,23 +131,16 @@
width: 120px; width: 120px;
background-size: contain; background-size: contain;
position: relative; position: relative;
&:first-child { &:not(.red-ui-palette-node-config):first-child {
margin-top: 10px; margin-top: 15px;
} }
&:last-child { &:not(.red-ui-palette-node-config):last-child {
margin-bottom: 10px; margin-bottom: 15px;
} }
} }
.red-ui-palette-node:hover { .red-ui-palette-node:hover {
margin: 4px auto; border-color: transparent;
border-color: $node-selected-color; box-shadow: 0 0 0 2px $node-selected-color;
border-width: 2px;
&:first-child {
margin-top: 9px;
}
&:last-child {
margin-bottom: 9px;
}
} }
.red-ui-palette-port { .red-ui-palette-port {
position: absolute; position: absolute;

View File

@ -162,3 +162,15 @@
background: none; background: none;
color: $tertiary-text-color; color: $tertiary-text-color;
} }
.red-ui-popover-panel {
@include component-shadow;
font-family: $primary-font;
font-size: $primary-font-size;
position: absolute;
box-sizing: border-box;
border: 1px solid $primary-border-color;
background: $secondary-background;
z-index: 2000;
}

View File

@ -0,0 +1,54 @@
/**
* 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.
**/
.red-ui-editor-radial-menu {
font-size: $primary-font-size;
font-family: $primary-font;
position: absolute;
top: 0;
left:0;
bottom:0;
right:0;
z-index: 1000;
& > div {
position: absolute;
border-radius: 80px;
width: 160px;
height: 160px;
background: $shadow;
border: 1px solid $primary-border-color;
}
}
.red-ui-editor-radial-menu-opt {
position: absolute;
border-radius: 20px;
width: 50px;
height: 50px;
background: $secondary-background;
border: 2px solid $primary-border-color;
text-align: center;
line-height:50px
}
.red-ui-editor-radial-menu-opt-disabled {
border-color: $tertiary-border-color;
color: $tertiary-border-color;
}
.red-ui-editor-radial-menu-opt-active {
background: $secondary-background-hover;
}

View File

@ -65,3 +65,5 @@
@import "keyboard"; @import "keyboard";
@import "debug"; @import "debug";
@import "radialMenu";

View File

@ -35,15 +35,8 @@ ul.red-ui-sidebar-node-config-list {
overflow: hidden; overflow: hidden;
&.selected { &.selected {
margin: 4px auto; border-color: transparent;
border-color: $node-selected-color; box-shadow: 0 0 0 2px $node-selected-color;
border-width: 2px;
&:first-child {
margin-top: 9px;
}
&:last-child {
margin-bottom: 9px;
}
} }
} }
.red-ui-palette-label { .red-ui-palette-label {

View File

@ -16,7 +16,7 @@
.red-ui-sidebar-context-stack { .red-ui-sidebar-context-stack {
position: absolute; position: absolute;
top: 42px; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
@ -27,9 +27,22 @@
display: none; display: none;
} }
} }
.red-ui-info-table {
table-layout: fixed;
}
table.red-ui-info-table tr:not(.blank) td:first-child {
width: 30%;
}
table.red-ui-info-table tr:not(.blank) td:last-child {
vertical-align: top;
}
} }
.red-ui-sidebar-context-property { .red-ui-sidebar-context-property {
overflow-wrap: break-word;
position: relative; position: relative;
.red-ui-debug-msg-tools { .red-ui-debug-msg-tools {
right: 0px; right: 0px;

View File

@ -56,118 +56,9 @@
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
.red-ui-typedInput-value-label-inactive {
} background: $secondary-background-disabled;
button.red-ui-typedInput-type-select, color: $secondary-text-color-disabled;
button.red-ui-typedInput-option-expand,
button.red-ui-typedInput-option-trigger
{
text-align: left;
border: none;
position: absolute;
box-sizing: border-box;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
padding: 0 1px 0 5px;
display:inline-block;
background: $form-button-background;
height: 32px;
line-height: 32px;
vertical-align: middle;
color: $form-text-color;
i.red-ui-typedInput-icon {
margin-left: 1px;
margin-right: 2px;
vertical-align: middle;
}
&.disabled {
cursor: default;
i.red-ui-typedInput-icon {
color: $secondary-text-color-disabled;
}
}
.red-ui-typedInput-type-label,.red-ui-typedInput-option-label {
display: inline-block;
height: 100%;
padding: 0 1px 0 5px;
img {
max-width: none;
}
}
&:not(.disabled):hover {
text-decoration: none;
background: $workspace-button-background-hover;
}
&:focus {
text-decoration: none;
outline: none;
box-shadow: inset 0 0 0 1px $form-input-focus-color;
}
&:not(.disabled):active {
background: $workspace-button-background-active;
text-decoration: none;
}
&.red-ui-typedInput-full-width {
width: 100%;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
&:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
button.red-ui-typedInput-option-expand {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0;
}
button.red-ui-typedInput-option-trigger {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
padding: 0 0 0 0;
position:absolute;
right: 0;
.red-ui-typedInput-option-label {
background:$form-button-background;
color: $form-text-color;
position:absolute;
left:0;
right:23px;
top: 0;
padding: 0 5px 0 8px;
i.red-ui-typedInput-icon {
margin-right: 4px;
}
}
.red-ui-typedInput-option-caret {
top: 0;
position: absolute;
right: 0;
bottom: 0;
width: 17px;
padding-left: 6px;
&:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
&:focus {
box-shadow: none;
}
&:focus .red-ui-typedInput-option-caret {
box-shadow: inset 0 0 0 1px $form-input-focus-color;
} }
} }
} }
@ -180,7 +71,9 @@
max-height: 350px; max-height: 350px;
overflow-y: auto; overflow-y: auto;
border: 1px solid $primary-border-color; border: 1px solid $primary-border-color;
box-sizing: border-box;
background: $secondary-background; background: $secondary-background;
white-space: nowrap;
z-index: 2000; z-index: 2000;
a { a {
padding: 6px 18px 6px 6px; padding: 6px 18px 6px 6px;
@ -200,8 +93,124 @@
text-decoration: none; text-decoration: none;
background: $workspace-button-background-active; background: $workspace-button-background-active;
} }
input[type="checkbox"] {
margin-right: 6px;
}
} }
.red-ui-typedInput-icon { .red-ui-typedInput-icon {
margin-right: 4px; margin-right: 6px;
}
}
button.red-ui-typedInput-type-select,
button.red-ui-typedInput-option-expand,
button.red-ui-typedInput-option-trigger
{
text-align: left;
border: none;
position: absolute;
box-sizing: border-box;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
padding: 0 1px 0 5px;
display:inline-block;
background: $form-button-background;
height: 32px;
line-height: 30px;
min-width: 23px;
vertical-align: middle;
color: $form-text-color;
i.red-ui-typedInput-icon {
margin-left: 1px;
margin-right: 2px;
vertical-align: middle;
}
&.disabled {
cursor: default;
> i.red-ui-typedInput-icon {
color: $secondary-text-color-disabled;
}
}
.red-ui-typedInput-type-label,.red-ui-typedInput-option-label {
display: inline-block;
vertical-align: middle;
height: 100%;
padding: 0 1px 0 5px;
img {
max-width: none;
}
}
&:not(.disabled):hover {
text-decoration: none;
background: $workspace-button-background-hover;
}
&:focus {
text-decoration: none;
outline: none;
box-shadow: inset 0 0 0 1px $form-input-focus-color;
}
&:not(.disabled):active {
background: $workspace-button-background-active;
text-decoration: none;
}
&.red-ui-typedInput-full-width {
width: 100%;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
&:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
button.red-ui-typedInput-option-expand {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
right: 0;
}
button.red-ui-typedInput-option-trigger {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
padding: 0 0 0 0;
position:absolute;
right: 0;
.red-ui-typedInput-option-label {
background:$form-button-background;
color: $form-text-color;
position:absolute;
left:0;
right:23px;
top: 0;
padding: 0 5px 0 8px;
i.red-ui-typedInput-icon {
margin-right: 4px;
}
}
.red-ui-typedInput-option-caret {
top: 0;
position: absolute;
right: 0;
bottom: 0;
width: 17px;
padding-left: 5px;
&:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
&:focus {
box-shadow: none;
}
&:focus .red-ui-typedInput-option-caret {
box-shadow: inset 0 0 0 1px $form-input-focus-color;
} }
} }

View File

@ -109,6 +109,7 @@
{ {
'$abs':{ args:[ 'number' ]}, '$abs':{ args:[ 'number' ]},
'$append':{ args:[ 'array1', 'array2' ]}, '$append':{ args:[ 'array1', 'array2' ]},
'$assert':{ args: [ 'arg', 'str' ]},
'$average':{ args:[ 'array' ]}, '$average':{ args:[ 'array' ]},
'$base64decode':{ args:[ ]}, '$base64decode':{ args:[ ]},
'$base64encode':{ args:[ ]}, '$base64encode':{ args:[ ]},
@ -116,8 +117,14 @@
'$ceil':{ args:[ 'number' ]}, '$ceil':{ args:[ 'number' ]},
'$contains':{ args:[ 'str', 'pattern' ]}, '$contains':{ args:[ 'str', 'pattern' ]},
'$count':{ args:[ 'array' ]}, '$count':{ args:[ 'array' ]},
'$decodeUrl':{ args:[ 'str' ]},
'$decodeUrlComponent':{ args:[ 'str' ]},
'$distinct':{ args:[ 'array' ]},
'$each':{ args:[ 'object', 'function' ]}, '$each':{ args:[ 'object', 'function' ]},
'$encodeUrl':{ args: ['str'] },
'$encodeUrlComponent':{ args:[ 'str' ]},
'$env': { args:[ 'arg' ]}, '$env': { args:[ 'arg' ]},
'$error':{ args:[ 'str' ]},
'$eval': { args: ['expr', 'context']}, '$eval': { args: ['expr', 'context']},
'$exists':{ args:[ 'arg' ]}, '$exists':{ args:[ 'arg' ]},
'$filter':{ args:[ 'array', 'function' ]}, '$filter':{ args:[ 'array', 'function' ]},
@ -151,18 +158,20 @@
'$reverse':{ args:[ 'array' ]}, '$reverse':{ args:[ 'array' ]},
'$round':{ args:[ 'number', 'precision' ]}, '$round':{ args:[ 'number', 'precision' ]},
'$shuffle':{ args:[ 'array' ]}, '$shuffle':{ args:[ 'array' ]},
'$sift':{ args:[ 'object', 'function' ]}, '$sift':{ args: ['object', 'function'] },
'$single':{ args: ['array', 'function'] },
'$sort':{ args:[ 'array', 'function' ]}, '$sort':{ args:[ 'array', 'function' ]},
'$split':{ args:[ 'str', 'separator', 'limit' ]}, '$split':{ args:[ 'str', 'separator', 'limit' ]},
'$spread':{ args:[ 'object' ]}, '$spread':{ args:[ 'object' ]},
'$sqrt':{ args:[ 'number' ]}, '$sqrt':{ args:[ 'number' ]},
'$string':{ args:[ 'arg' ]}, '$string':{ args:[ 'arg', 'prettify' ]},
'$substring':{ args:[ 'str', 'start', 'length' ]}, '$substring':{ args:[ 'str', 'start', 'length' ]},
'$substringAfter':{ args:[ 'str', 'chars' ]}, '$substringAfter':{ args:[ 'str', 'chars' ]},
'$substringBefore':{ args:[ 'str', 'chars' ]}, '$substringBefore':{ args:[ 'str', 'chars' ]},
'$sum':{ args:[ 'array' ]}, '$sum':{ args:[ 'array' ]},
'$toMillis':{args:['timestamp']}, // <------------- '$toMillis':{args:['timestamp']}, // <-------------
'$trim':{ args:[ 'str' ]}, '$trim':{ args:[ 'str' ]},
'$type':{ args:['value']},
'$uppercase':{ args:[ 'str' ]}, '$uppercase':{ args:[ 'str' ]},
'$zip':{ args:[ 'array1' ]} '$zip':{ args:[ 'array1' ]}
} }

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
@ -20,7 +21,6 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<head>
<title>{{ page.title }}</title> <title>{{ page.title }}</title>
<link rel="icon" type="image/png" href="{{ page.favicon }}"> <link rel="icon" type="image/png" href="{{ page.favicon }}">
<link rel="mask-icon" href="{{ page.tabicon }}" color="#8f0000"> <link rel="mask-icon" href="{{ page.tabicon }}" color="#8f0000">

View File

@ -30,16 +30,16 @@
<!-- (with the 'node-input-' prefix). --> <!-- (with the 'node-input-' prefix). -->
<!-- The available icon classes are defined Font Awesome Icons (FA Icons) --> <!-- The available icon classes are defined Font Awesome Icons (FA Icons) -->
<div class="form-row"> <div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label> <label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
<input type="text" id="node-input-topic" placeholder="Topic"> <input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topic">
</div> </div>
<br/> <br/>
<!-- By convention, most nodes have a 'name' property. The following div --> <!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. Should always be the last option --> <!-- provides the necessary field. Should always be the last option -->
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" placeholder="Name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
</script> </script>

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
--> -->
<script type="text/x-red" data-template-name="inject"> <script type="text/html" data-template-name="inject">
<div class="form-row"> <div class="form-row">
<label for="node-input-payload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label> <label for="node-input-payload"><i class="fa fa-envelope"></i> <span data-i18n="common.label.payload"></span></label>
<input type="text" id="node-input-payload" style="width:70%"> <input type="text" id="node-input-payload" style="width:70%">
@ -138,11 +138,11 @@
width: 100px; width: 100px;
} }
.inject-time-days input { .inject-time-days input {
width: auto; width: auto !important;
vertical-align: baseline; vertical-align: baseline !important;
} }
.inject-time-times { .inject-time-times {
width: 90px; width: 90px !important;
} }
#inject-time-time { #inject-time-time {
width: 75px; width: 75px;
@ -156,7 +156,7 @@
<script type="text/javascript"> <script type="text/javascript">
RED.nodes.registerType('inject',{ RED.nodes.registerType('inject',{
category: 'input', category: 'common',
color:"#a6bbcf", color:"#a6bbcf",
defaults: { defaults: {
name: {value:""}, name: {value:""},

Some files were not shown because too many files have changed in this diff Show More