Compare commits

..

2 Commits

Author SHA1 Message Date
Dave Conway-Jones
7518987083 Add subflows to context sidebar 2019-06-19 09:51:48 +01:00
Dave Conway-Jones
5a7592a953 Add name to node and flow context view labels
slight adjust spacing for context view
2019-06-18 21:14:14 +01:00
448 changed files with 4253 additions and 6069 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:
- [ ] Node-RED version:
- [ ] Node.js version:
- [ ] node.js version:
- [ ] npm version:
- [ ] Platform/OS:
- [ ] 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:
- [ ] Node-RED version:
- [ ] Node.js version:
- [ ] node.js version:
- [ ] npm version:
- [ ] Platform/OS:
- [ ] Browser:

View File

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

View File

@@ -1,143 +1,3 @@
#### 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
Runtime
@@ -186,29 +46,8 @@ Nodes
- Add expand editor button to Template node
- 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
- Update jsonata to 1.6.5 which should fix #2183
- Ensure the subflow stop promise is waiting for before restarting
- Properly escape node types in palette
#### 0.20.6: Maintenance Release
- Revealing node position needs to account for zoom level Fixes #2172
- stop join tripping up if last message of buffer is blank.
- Improve handling of file upload in request node
- Handle subflow internal node wired to a non-existant node Fixes #2202
- Do not save subflow env vars with blank names
- Don't allow a link node virtual wire to connect to normal port
- Clear HTTP Request node authType when auth disabled Fixes #2215
- Fix parsing of content-type header Fixes #2216
- Fix join node reset issue with merging objects
- Copy data-i18n attribute on TypedInput Fixes #2211
#### 0.20.5: Maintenance Release
@@ -870,7 +709,7 @@ Nodes
- Initial support of sequence rules for SWITCH node (#1545)
- initial support of SORT node (#1500)
- Inject node - let once delay be editable (#1541)
- Introduce `nodeMessageBufferMaxLength` setting for msg sequence nodes
- Introduce `nodeMaxMessageBufferLength` setting for msg sequence nodes
- Let CSV correct parts if we remove header row.
- let default apply if msg.delay not set in override mode. (#1397)
- 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:
- 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

View File

@@ -276,7 +276,7 @@ module.exports = function(grunt) {
files: [
'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: {
files: [
@@ -496,9 +496,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-chmod');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-mocha-istanbul');
if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.loadNpmTasks('grunt-webdriver');
}
grunt.loadNpmTasks('grunt-webdriver');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-npm-command');
@@ -557,8 +555,8 @@ module.exports = function(grunt) {
});
grunt.registerTask('verifyUiTestDependencies', function() {
if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.fail.fatal('You need to install the UI test dependencies first.\nUse the script in "scripts/install-ui-test-dependencies.sh"');
if (!fs.existsSync(path.join("node_modules", "chromedriver"))) {
grunt.fail.fatal('You need to run "npm install chromedriver@2" before running UI test.');
return false;
}
});
@@ -581,15 +579,9 @@ module.exports = function(grunt) {
'Runs code style check on editor code',
['jshint:editor']);
if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.registerTask('test-ui',
'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-ui',
'Builds editor content then runs unit tests on editor ui',
['verifyUiTestDependencies','build','jshint:editor','webdriver:all']);
grunt.registerTask('test-nodes',
'Runs unit tests on core nodes',

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)
[![Coverage Status](https://coveralls.io/repos/node-red/node-red/badge.svg?branch=master)](https://coveralls.io/r/node-red/node-red?branch=master)
Low-code programming for event-driven applications.
A visual tool for wiring the Internet of Things.
![Node-RED: Low-code programming for event-driven applications](http://nodered.org/images/node-red-screenshot.png)
![Node-RED: A visual tool for wiring the Internet of Things](http://nodered.org/images/node-red-screenshot.png)
## Quick Start
@@ -56,7 +56,7 @@ This project adheres to the [Contributor Covenant 1.4](http://contributor-covena
## Authors
Node-RED is a project of the [OpenJS Foundation](https://openjsf.org).
Node-RED is a project of the [JS Foundation](http://js.foundation).
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 JS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).
Copyright JS Foundation and other contributors, http://js.foundation under [the Apache 2.0 license](LICENSE).

View File

@@ -1,13 +0,0 @@
# 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",
"version": "1.0.0",
"description": "Low-code programming for event-driven applications",
"version": "1.0.0-beta.2",
"description": "A visual tool for wiring the Internet of Things",
"homepage": "http://nodered.org",
"license": "Apache-2.0",
"repository": {
@@ -24,7 +24,7 @@
}
],
"dependencies": {
"ajv": "6.10.2",
"ajv": "6.10.0",
"basic-auth": "2.0.1",
"bcryptjs": "2.4.3",
"body-parser": "1.19.0",
@@ -36,37 +36,39 @@
"cors": "2.8.5",
"cron": "1.7.1",
"denque": "1.4.1",
"express": "4.17.1",
"express-session": "1.16.2",
"fs-extra": "8.1.0",
"express": "4.17.0",
"express-session": "1.16.1",
"fs-extra": "8.0.1",
"fs.notify": "0.0.4",
"hash-sum": "2.0.0",
"https-proxy-agent": "2.2.2",
"hash-sum": "1.0.2",
"https-proxy-agent": "2.2.1",
"i18next": "15.1.2",
"iconv-lite": "0.5.0",
"iconv-lite": "0.4.24",
"is-utf8": "0.2.1",
"js-yaml": "3.13.1",
"json-stringify-safe": "5.0.1",
"jsonata": "1.6.5",
"media-typer": "1.1.0",
"jsonata": "1.6.4",
"memorystore": "1.6.1",
"mime": "2.4.4",
"mime": "2.4.3",
"mqtt": "2.18.8",
"multer": "1.4.2",
"mustache": "3.0.2",
"node-red-node-rbe": "^0.2.5",
"node-red-node-sentiment": "^0.1.4",
"node-red-node-tail": "^0.0.3",
"multer": "1.4.1",
"mustache": "3.0.1",
"node-red-node-email": "^1.4.0",
"node-red-node-feedparser": "^0.1.14",
"node-red-node-rbe": "^0.2.4",
"node-red-node-sentiment": "^0.1.3",
"node-red-node-tail": "^0.0.2",
"node-red-node-twitter": "^1.1.4",
"nopt": "4.0.1",
"oauth2orize": "1.11.0",
"on-headers": "1.0.2",
"passport": "0.4.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"raw-body": "2.4.1",
"raw-body": "2.4.0",
"request": "2.88.0",
"semver": "6.3.0",
"uglify-js": "3.6.0",
"semver": "6.0.0",
"uglify-js": "3.5.15",
"when": "3.7.8",
"ws": "6.2.1",
"xml2js": "0.4.19"
@@ -75,26 +77,27 @@
"bcrypt": "3.0.6"
},
"devDependencies": {
"grunt": "~1.0.4",
"grunt": "~1.0.3",
"grunt-chmod": "~1.1.1",
"grunt-cli": "~1.3.2",
"grunt-concurrent": "~2.3.1",
"grunt-contrib-clean": "~2.0.0",
"grunt-contrib-compress": "~1.5.0",
"grunt-contrib-clean": "~1.1.0",
"grunt-contrib-compress": "~1.4.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jshint": "~2.1.0",
"grunt-contrib-uglify": "~4.0.1",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-uglify": "~3.4.0",
"grunt-contrib-watch": "~1.1.0",
"grunt-jsdoc": "^2.2.1",
"grunt-jsdoc-to-markdown": "^4.0.0",
"grunt-jsonlint": "~2.0.0",
"grunt-jsonlint": "~1.1.0",
"grunt-mkdir": "~1.0.0",
"grunt-mocha-istanbul": "5.0.2",
"grunt-nodemon": "~0.4.2",
"grunt-npm-command": "~0.1.2",
"grunt-sass": "~2.0.0",
"grunt-simple-mocha": "~0.4.1",
"grunt-webdriver": "^2.0.3",
"http-proxy": "^1.16.2",
"istanbul": "0.4.5",
"minami": "1.2.3",
@@ -104,7 +107,11 @@
"sinon": "1.17.7",
"stoppable": "^1.1.0",
"supertest": "3.4.2",
"node-red-node-test-helper": "^0.2.3",
"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.2",
"jsdoc-nr-template": "node-red/jsdoc-nr-template"
},
"engines": {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ function expireSessions() {
}
if (nextExpiry < Number.MAX_SAFE_INTEGER) {
// Allow 5 seconds grace
expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(nextExpiry - Date.now()) + 5000))
expiryTimeout = setTimeout(expireSessions,(nextExpiry - Date.now()) + 5000)
}
if (modified) {
return storage.saveSessions(sessions);
@@ -129,7 +129,7 @@ module.exports = {
sessions[accessToken] = session;
if (!expiryTimeout) {
expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(accessTokenExpiresAt - Date.now()) + 5000))
expiryTimeout = setTimeout(expireSessions,(accessTokenExpiresAt - Date.now()) + 5000)
}
return storage.saveSessions(sessions).then(function() {

View File

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

View File

@@ -28,7 +28,7 @@ var defaultContext = {
},
header: {
title: "Node-RED",
image: "red/images/node-red.svg"
image: "red/images/node-red.png"
},
asset: {
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js",

View File

@@ -25,7 +25,7 @@ var theme = require("./theme");
var runtimeAPI;
var editorClientDir = path.dirname(require.resolve("@node-red/editor-client"));
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.svg");
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.png");
var editorTemplatePath = path.join(editorClientDir,"templates","index.mst");
var editorTemplate;

View File

@@ -47,12 +47,5 @@ module.exports = {
code: err.code||"unexpected_error",
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",
"version": "1.0.0",
"version": "1.0.0-beta.2",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,17 +16,17 @@
}
],
"dependencies": {
"@node-red/util": "1.0.0",
"@node-red/editor-client": "1.0.0",
"@node-red/util": "1.0.0-beta.2",
"@node-red/editor-client": "1.0.0-beta.2",
"bcryptjs": "2.4.3",
"body-parser": "1.19.0",
"clone": "2.1.2",
"cors": "2.8.5",
"express-session": "1.16.2",
"express": "4.17.1",
"express-session": "1.16.1",
"express": "4.17.0",
"memorystore": "1.6.1",
"mime": "2.4.4",
"mustache": "3.0.2",
"mime": "2.4.3",
"mustache": "3.0.1",
"oauth2orize": "1.11.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
@@ -35,6 +35,6 @@
"ws": "6.2.1"
},
"optionalDependencies": {
"bcrypt": "3.0.6"
"bcrypt": "3.0.5"
}
}

View File

@@ -26,7 +26,8 @@
"status" : "Status",
"enabled" : "Aktiviert",
"disabled" : "Inaktiviert",
"info" : "Beschreibung"
"info" : "Beschreibung",
"tip" : "Beschreibung akzeptiert Markdown und wird auf der Registerkarte Info angezeigt."
},
"menu" : {
"label" : {
@@ -236,6 +237,7 @@
"deleteSubflow" : "Subflow löschen",
"info" : "Beschreibung",
"category" : "Kategorie",
"format" : "Markdown-Format",
"errors" : {
"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"

View File

@@ -310,7 +310,6 @@
"addNewType": "Add new __type__...",
"nodeProperties": "node properties",
"label": "Label",
"color": "Color",
"portLabels": "Port labels",
"labelInputs": "Inputs",
"labelOutputs": "Outputs",
@@ -322,40 +321,6 @@
"description": "Description",
"show": "Show",
"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": {
"scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it",
"invalidProperties": "Invalid properties:"
@@ -414,13 +379,9 @@
"addCategory": "Add new...",
"label": {
"subflows": "subflows",
"network": "network",
"common": "common",
"input": "input",
"output": "output",
"function": "function",
"sequence": "sequence",
"parser": "parser",
"social": "social",
"storage": "storage",
"analysis": "analysis",
@@ -568,10 +529,11 @@
"refresh": "refresh to load",
"empty": "empty",
"node": "Node",
"subflow": "Subflow",
"flow": "Flow",
"global": "Global",
"deleteConfirm": "Are you sure you want to delete this item?",
"autoRefresh": "Refresh on selection change",
"autoRefresh": "Auto-refresh",
"refrsh": "Refresh",
"delete": "Delete"
},
@@ -588,7 +550,6 @@
"noSummaryAvailable": "No summary available",
"editDescription": "Edit project description",
"editDependencies": "Edit project dependencies",
"noDescriptionAvailable": "No description available",
"editReadme": "Edit README.md",
"showProjectSettings": "Show project settings",
"projectSettings": {
@@ -979,11 +940,9 @@
},
"editor-tab": {
"properties": "Properties",
"envProperties": "Environment Variables",
"description": "Description",
"appearance": "Appearance",
"preview": "UI Preview",
"defaultValue": "Default value"
"env": "Environment Variables"
},
"languages" : {
"de": "German",

View File

@@ -80,7 +80,7 @@
"projects-new": "新規",
"projects-open": "開く",
"projects-settings": "設定",
"showNodeLabelDefault": "追加したノードのラベルを表示"
"showNodeLabelDefault": "追加したノードのラベルを表示する"
}
},
"actions": {
@@ -310,7 +310,6 @@
"addNewType": "新規に __type__ を追加...",
"nodeProperties": "プロパティ",
"label": "ラベル",
"color": "色",
"portLabels": "ポートラベル",
"labelInputs": "入力",
"labelOutputs": "出力",
@@ -322,40 +321,6 @@
"description": "詳細",
"show": "表示",
"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": {
"scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします",
"invalidProperties": "プロパティが不正です:"
@@ -386,8 +351,7 @@
"pasteNode": "ノードを貼り付け",
"undoChange": "変更操作を戻す",
"searchBox": "ノードを検索",
"managePalette": "パレットの管理",
"actionList": "動作一覧"
"managePalette": "パレットの管理"
},
"library": {
"library": "ライブラリ",
@@ -414,13 +378,9 @@
"addCategory": "新規追加...",
"label": {
"subflows": "サブフロー",
"network": "ネットワーク",
"common": "共通",
"input": "入力",
"output": "出力",
"function": "機能",
"sequence": "シーケンス",
"parser": "パーサ",
"social": "ソーシャル",
"storage": "ストレージ",
"analysis": "分析",
@@ -567,13 +527,11 @@
"none": "選択されていません",
"refresh": "読み込みのため更新してください",
"empty": "データが存在しません",
"node": "ノード",
"flow": "フロー",
"global": "グローバル",
"node": "Node",
"flow": "Flow",
"global": "Global",
"deleteConfirm": "データを削除しても良いですか?",
"autoRefresh": "選択対象が変化した場合更新",
"refrsh": "更新",
"delete": "削除"
"autoRefresh": "自動更新"
},
"palette": {
"name": "パレットの管理",
@@ -585,10 +543,9 @@
"description": "詳細",
"dependencies": "依存関係",
"settings": "設定",
"noSummaryAvailable": "要約が存在しません",
"noSummaryAvailable": "サマリが存在しません",
"editDescription": "プロジェクトの詳細を編集",
"editDependencies": "プロジェクトの依存関係を編集",
"noDescriptionAvailable": "詳細が存在しません",
"editReadme": "README.mdを編集",
"showProjectSettings": "プロジェクト設定を表示",
"projectSettings": {
@@ -779,16 +736,7 @@
},
"jsonEditor": {
"title": "JSONエディタ",
"format": "JSONフォーマット",
"rawMode": "JSONを編集",
"uiMode": "ビジュアルエディタ",
"insertAbove": "上に挿入",
"insertBelow": "下に挿入",
"addItem": "要素を追加",
"copyPath": "要素のパスをコピー",
"expandItems": "要素を展開",
"collapseItems": "要素を折り畳む",
"duplicate": "複製"
"format": "JSONフォーマット"
},
"markdownEditor": {
"title": "マークダウンエディタ",
@@ -978,13 +926,11 @@
},
"editor-tab": {
"properties": "プロパティ",
"envProperties": "環境変数",
"description": "説明",
"appearance": "外観",
"preview": "UIプレビュー",
"defaultValue": "デフォルト値"
"env": "環境変数"
},
"languages": {
"languages" : {
"de": "ドイツ語",
"en-US": "英語",
"ja": "日本語",

View File

@@ -273,6 +273,7 @@
"deleteSubflow": "서브 플로우 삭제",
"info": "상세내역",
"category": "카테고리",
"format": "Markdown 형식",
"errors": {
"noNodesSelected": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 노드가 선택되지 않았습니다",
"multipleInputsToSelection": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 복수의 입력이 선택되었습니다"

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

View File

@@ -1 +0,0 @@
<svg width="27" height="18" xmlns="http://www.w3.org/2000/svg"><g color="#000"><path fill="#fff" d="M0 5.002h10v5H0zM17 .002h10v5H17z"/><path d="M17 13.002h10v5H17z"/></g><path d="M9.5 7.502h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

View File

@@ -1 +0,0 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 .002h32v32H0z"/><g color="#000"><path fill="#fff" d="M2 13.002h10v5H2zM19 8.002h10v5H19z"/><path d="M19 21.002h10v5H19z"/></g><path d="M11.5 15.502h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

View File

@@ -1 +0,0 @@
<svg width="27" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" color="#000"><path d="M0 5h10v5H0zM17 0h10v5H17zM17 13h10v5H17z"/></g><path d="M9.5 7.5h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

View File

@@ -1 +0,0 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 0h32v32H0z"/><g fill="#fff" color="#000"><path d="M2 13h10v5H2zM19 8h10v5H19zM19 21h10v5H19z"/></g><path d="M11.5 15.5h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

View File

@@ -1 +0,0 @@
<svg width="27" height="18" xmlns="http://www.w3.org/2000/svg"><path color="#000" d="M0 5.002h10v5H0zM17 13.002h10v5H17z"/><path d="M9.5 7.502h2l4-5h2" fill="none" stroke="#000" stroke-width="1.5"/><path color="#000" fill="#fff" d="M17 .002h10v5H17z"/></svg>

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

View File

@@ -1 +0,0 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 .002h32v32H0z"/><path color="#000" d="M2 13.002h10v5H2zM19 21.002h10v5H19z"/><path d="M11.5 15.502h2l4-5h2" fill="none" stroke="#000" stroke-width="1.5"/><path color="#000" fill="#fff" d="M19 8.002h10v5H19z"/></svg>

Before

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

View File

@@ -1 +0,0 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><g color="#000"><path fill="#8c101c" d="M0 .006h32v32H0z"/><path d="M11.81 25.429a10.02 10.02 0 0 0 4.19.914c5.562 0 10.107-4.545 10.107-10.106S21.562 6.131 16 6.131 5.895 10.676 5.895 16.237h3.368c0-3.74 2.997-6.737 6.738-6.737s6.737 2.996 6.737 6.737-2.996 6.738-6.737 6.738a6.775 6.775 0 0 1-2.533-.486l1.43-3.48-6.947 1.317 2.13 8.485z" fill="#fff" style="isolation:auto;mix-blend-mode:normal;text-decoration-color:#000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/></g></svg>

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

View File

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

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

View File

@@ -1 +0,0 @@
<svg width="46.994" height="18.006" xmlns="http://www.w3.org/2000/svg"><g stroke="#d6d6d6"><g fill="#9e3131" stroke-linejoin="round" stroke-width="3.847" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"><rect x="249.04" y="435.92" width="50.294" height="22.953" ry="6.608"/><rect x="345.63" y="416.93" width="50.294" height="22.953" ry="6.608"/><rect x="376.71" y="459.01" width="50.294" height="22.953" ry="6.608"/></g><path d="M301.04 447.43c24.406.184 7.107-18.84 42.708-19.03M374.82 470.48c-46.966.538-28.989-22.664-73.619-22.944" fill="none" stroke-width="5.771" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"/></g></svg>

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 944 B

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 479 B

View File

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

View File

@@ -50,19 +50,6 @@ 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) {
var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
var toLoad = languageList.length;

View File

@@ -8,7 +8,6 @@
"ctrl-0": "core:zoom-reset",
"ctrl-enter": "core:confirm-edit-tray",
"ctrl-escape": "core:cancel-edit-tray",
"ctrl-d": "core:deploy-flows",
"ctrl-g i": "core:show-info-tab",
"ctrl-g d": "core:show-debug-tab",
"ctrl-g c": "core:show-config-tab",
@@ -30,8 +29,7 @@
"backspace": "core:delete-config-selection",
"delete": "core:delete-config-selection",
"ctrl-a": "core:select-all-config-nodes",
"ctrl-z": "core:undo",
"ctrl-y": "core:redo"
"ctrl-z": "core:undo"
},
"red-ui-workspace": {
"backspace": "core:delete-selection",
@@ -41,7 +39,6 @@
"ctrl-x": "core:cut-selection-to-internal-clipboard",
"ctrl-v": "core:paste-from-internal-clipboard",
"ctrl-z": "core:undo",
"ctrl-y": "core:redo",
"ctrl-a": "core:select-all-nodes",
"shift-?": "core:show-help",
"up": "core:move-selection-up",

View File

@@ -17,8 +17,6 @@ RED.nodes = (function() {
var node_defs = {};
var nodes = [];
var nodeTabMap = {};
var configNodes = {};
var links = [];
var defaultWorkspace;
@@ -215,11 +213,6 @@ RED.nodes = (function() {
n.i = nextId+1;
}
nodes.push(n);
if (nodeTabMap[n.z]) {
nodeTabMap[n.z][n.id] = n;
} else {
console.warn("Node added to unknown tab/subflow:",n);
}
}
RED.events.emit('nodes:add',n);
}
@@ -253,9 +246,6 @@ RED.nodes = (function() {
node = getNode(id);
if (node) {
nodes.splice(nodes.indexOf(node),1);
if (nodeTabMap[node.z]) {
delete nodeTabMap[node.z][node.id];
}
removedLinks = links.filter(function(l) { return (l.source === node) || (l.target === node); });
removedLinks.forEach(function(l) {links.splice(links.indexOf(l), 1); });
var updatedConfigNode = false;
@@ -301,17 +291,6 @@ RED.nodes = (function() {
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) {
var index = links.indexOf(l);
if (index != -1) {
@@ -321,8 +300,6 @@ RED.nodes = (function() {
function addWorkspace(ws,targetIndex) {
workspaces[ws.id] = ws;
nodeTabMap[ws.id] = {};
ws._def = RED.nodes.getType('tab');
if (targetIndex === undefined) {
workspacesOrder.push(ws.id);
@@ -335,7 +312,6 @@ RED.nodes = (function() {
}
function removeWorkspace(id) {
delete workspaces[id];
delete nodeTabMap[id];
workspacesOrder.splice(workspacesOrder.indexOf(id),1);
var removedNodes = [];
@@ -381,32 +357,30 @@ RED.nodes = (function() {
sf.name = subflowName;
}
subflows[sf.id] = sf;
nodeTabMap[sf.id] = {};
RED.nodes.registerType("subflow:"+sf.id, {
defaults:{
name:{value:""},
env:{value:[]}
},
icon: function() { return sf.icon||"subflow.svg" },
icon: function() { return sf.icon||"subflow.png" },
category: sf.category || "subflows",
inputs: sf.in.length,
outputs: sf.out.length,
color: sf.color || "#DDAA99",
color: "#da9",
label: function() { return this.name||RED.nodes.subflow(sf.id).name },
labelStyle: function() { return this.name?"red-ui-flow-node-label-italic":""; },
paletteLabel: function() { return RED.nodes.subflow(sf.id).name },
inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null },
outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null },
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;
// 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")));
$("ol.red-ui-editor-subflow-env-list").editableList('height',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-80);
},
set:{
module: "node-red"
@@ -419,7 +393,6 @@ RED.nodes = (function() {
}
function removeSubflow(sf) {
delete subflows[sf.id];
delete nodeTabMap[sf.id];
registry.removeNodeType("subflow:"+sf.id);
}
@@ -578,7 +551,6 @@ RED.nodes = (function() {
node.in = [];
node.out = [];
node.env = n.env;
node.color = n.color;
n.in.forEach(function(p) {
var nIn = {x:p.x,y:p.y,wires:[]};
@@ -611,7 +583,7 @@ RED.nodes = (function() {
node.outputLabels = n.outputLabels.slice();
}
if (n.icon) {
if (n.icon !== "node-red/subflow.svg") {
if (n.icon !== "node-red/subflow.png") {
node.icon = n.icon;
}
}
@@ -1194,7 +1166,6 @@ RED.nodes = (function() {
var nodeTypeArrayReferences = {
"catch":"scope",
"status":"scope",
"complete": "scope",
"link in":"links",
"link out":"links"
}
@@ -1295,22 +1266,13 @@ RED.nodes = (function() {
// TODO: supports filter.z|type
function filterNodes(filter) {
var result = [];
var searchSet = nodes;
var doZFilter = false;
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++) {
var node = searchSet[n];
if (filter.hasOwnProperty("type") && node.type !== filter.type) {
for (var n=0;n<nodes.length;n++) {
var node = nodes[n];
if (filter.hasOwnProperty("z") && node.z !== filter.z) {
continue;
}
if (doZFilter && node.z !== filter.z) {
if (filter.hasOwnProperty("type") && node.type !== filter.type) {
continue;
}
result.push(node);
@@ -1377,7 +1339,6 @@ RED.nodes = (function() {
function clear() {
nodes = [];
links = [];
nodeTabMap = {};
configNodes = {};
workspacesOrder = [];
var subflowIds = Object.keys(subflows);
@@ -1487,8 +1448,6 @@ RED.nodes = (function() {
remove: removeNode,
clear: clear,
moveNodeToTab: moveNodeToTab,
addLink: addLink,
removeLink: removeLink,

View File

@@ -455,12 +455,8 @@ var RED = (function() {
null
]});
menuOptions.push(null);
if (RED.settings.theme("menu.menu-item-import-library", true)) {
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({id:"menu-item-import",label:RED._("menu.label.import"),onselect:"core:show-import-dialog"});
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),onselect:"core:show-export-dialog"});
menuOptions.push(null);
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:"core:search"});
menuOptions.push(null);
@@ -483,9 +479,7 @@ var RED = (function() {
menuOptions.push({id:"menu-item-user-settings",label:RED._("menu.label.settings"),onselect:"core:show-user-settings"});
menuOptions.push(null);
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-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:"core:show-help"});
menuOptions.push({id:"menu-item-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")

View File

@@ -23,7 +23,6 @@ RED.actionList = (function() {
var visible = false;
var filterTerm = "";
var filterTerms = [];
var previousActiveElement;
function ensureSelectedIsVisible() {
@@ -47,14 +46,9 @@ RED.actionList = (function() {
var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog);
searchInput = $('<input type="text" data-i18n="[placeholder]keyboard.filterActions">').appendTo(searchDiv).searchBox({
change: function() {
filterTerm = $(this).val().trim();
filterTerms = filterTerm.split(" ");
filterTerm = $(this).val();
searchResults.editableList('filter');
searchResults.find("li.selected").removeClass("selected");
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
}
}
});
@@ -67,6 +61,7 @@ RED.actionList = (function() {
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
RED.a = children[0];
}
} else {
var nextChild = selectedChild.nextAll(":visible").first();
@@ -120,17 +115,8 @@ RED.actionList = (function() {
},
scrollOnAdd: false,
filter: function(item) {
if (filterTerm !== "") {
var pos=0;
for (var i=0;i<filterTerms.length;i++) {
var j = item._label.indexOf(filterTerms[i],pos);
if (j > -1) {
pos = j;
} else {
return false;
}
}
return true;
if (filterTerm !== "" && item.label.toLowerCase().indexOf(filterTerm) === -1) {
return false;
}
return true;
}
@@ -170,17 +156,12 @@ RED.actionList = (function() {
});
actions.forEach(function(action) {
action.label = action.id.replace(/:/,": ").replace(/-/g," ").replace(/(^| )./g,function() { return arguments[0].toUpperCase()});
action._label = action.label.toLowerCase();
searchResults.editableList('addItem',action)
})
RED.events.emit("actionList:open");
visible = true;
}
searchInput.trigger("focus");
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
}
}
function hide() {

View File

@@ -34,8 +34,6 @@
* - addItem(itemData)
* - insertItemAt : function(data,index) - add an item at the specified index
* - removeItem(itemData)
* - getItemAt(index)
* - indexOf(itemData)
* - width(width)
* - height(height)
* - items()
@@ -188,11 +186,7 @@
}
},
_destroy: function() {
if (this.topContainer) {
var tc = this.topContainer;
delete this.topContainer;
tc.remove();
}
this.topContainer.remove();
},
_refreshFilter: function() {
var that = this;
@@ -238,23 +232,6 @@
this.uiHeight = desiredHeight;
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) {
var that = this;
data = data || {};

View File

@@ -71,7 +71,7 @@ RED.menu = (function() {
}
if (opt.icon !== undefined) {
if (/\.(png|svg)/.test(opt.icon)) {
if (/\.png/.test(opt.icon)) {
linkContent += '<img src="'+opt.icon+'"/> ';
} else {
linkContent += '<i class="'+(opt.icon?opt.icon:'" style="display: inline-block;"')+'"></i> ';
@@ -224,9 +224,9 @@ RED.menu = (function() {
if (!alreadySet && opt.onselect) {
triggerAction(opt.id,state);
}
if (!opt.local && !alreadySet) {
RED.settings.set(opt.setting||("menu-"+opt.id), state);
}
}
if (!alreadySet) {
RED.settings.set(opt.setting||("menu-"+opt.id), state);
}
}

View File

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

View File

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

View File

@@ -32,12 +32,6 @@
return v;
}
}
var mapDeprecatedIcon = function(icon) {
if (/^red\/images\/typedInput\/.+\.png$/.test(icon)) {
icon = icon.replace(/.png$/,".svg");
}
return icon;
}
var allOptions = {
msg: {value:"msg",label:"msg.",validate:RED.utils.validatePropertyExpression},
flow: {value:"flow",label:"flow.",hasValue:true,
@@ -52,13 +46,13 @@
parse: contextParse,
export: contextExport
},
str: {value:"str",label:"string",icon:"red/images/typedInput/az.svg"},
num: {value:"num",label:"number",icon:"red/images/typedInput/09.svg",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.svg",options:["true","false"]},
str: {value:"str",label:"string",icon:"red/images/typedInput/az.png"},
num: {value:"num",label:"number",icon:"red/images/typedInput/09.png",validate:/^[+-]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$/},
bool: {value:"bool",label:"boolean",icon:"red/images/typedInput/bool.png",options:["true","false"]},
json: {
value:"json",
label:"JSON",
icon:"red/images/typedInput/json.svg",
icon:"red/images/typedInput/json.png",
validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}},
expand: function() {
var that = this;
@@ -80,12 +74,12 @@
})
}
},
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.svg"},
date: {value:"date",label:"timestamp",icon:"fa fa-clock-o",hasValue:false},
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
date: {value:"date",label:"timestamp",hasValue:false},
jsonata: {
value: "jsonata",
label: "expression",
icon: "red/images/typedInput/expr.svg",
icon: "red/images/typedInput/expr.png",
validate: function(v) { try{jsonata(v);return true;}catch(e){return false;}},
expand:function() {
var that = this;
@@ -100,7 +94,7 @@
bin: {
value: "bin",
label: "buffer",
icon: "red/images/typedInput/bin.svg",
icon: "red/images/typedInput/bin.png",
expand: function() {
var that = this;
RED.editor.editBuffer({
@@ -114,12 +108,12 @@
env: {
value: "env",
label: "env variable",
icon: "red/images/typedInput/env.svg"
icon: "red/images/typedInput/env.png"
},
node: {
value: "node",
label: "node",
icon: "red/images/typedInput/target.svg",
icon: "red/images/typedInput/target.png",
valueLabel: function(container,value) {
var node = RED.nodes.node(value);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).css({
@@ -215,7 +209,7 @@
that.input.css("margin"+d,0);
});
["type","placeholder","autocomplete","data-i18n"].forEach(function(d) {
["type","placeholder","autocomplete"].forEach(function(d) {
var m = that.element.attr(d);
that.input.attr(d,m);
});
@@ -298,8 +292,7 @@
that.uiSelect.addClass('red-ui-typedInput-focus');
});
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.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.type(this.options.default||this.typeList[0].value);
}catch(err) {
console.log(err.stack);
@@ -337,17 +330,6 @@
menu.css({
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")) {
this.input.trigger("focus");
} else if (this.optionSelectTrigger.is(":visible")){
@@ -356,12 +338,10 @@
this.selectTrigger.trigger("focus");
}
},
_createMenu: function(menuOptions,opts,callback) {
_createMenu: function(opts,callback) {
var that = this;
var menu = $("<div>").addClass("red-ui-typedInput-options red-ui-editor-dialog");
menu.opts = opts;
menu.callback = callback;
menuOptions.forEach(function(opt) {
var menu = $("<div>").addClass("red-ui-typedInput-options");
opts.forEach(function(opt) {
if (typeof opt === 'string') {
opt = {value:opt,label:opt};
}
@@ -373,7 +353,7 @@
if (opt.icon.indexOf("<") === 0) {
$(opt.icon).prependTo(op);
} else if (opt.icon.indexOf("/") !== -1) {
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px; height: 18px;"}).prependTo(op);
$('<img>',{src:opt.icon,style:"margin-right: 4px; height: 18px;"}).prependTo(op);
} else {
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(op);
}
@@ -383,20 +363,12 @@
if (!opt.icon && !opt.label) {
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) {
event.preventDefault();
event.stopPropagation();
if (!opts.multiple) {
callback(opt.value);
that._hideMenu(menu);
} else {
cb.prop("checked",!cb.prop("checked"));
}
callback(opt.value);
that._hideMenu(menu);
});
});
menu.css({
@@ -420,6 +392,9 @@
}
evt.stopPropagation();
})
return menu;
},
@@ -428,22 +403,11 @@
this.disarmClick = false;
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 pos = relativeTo.offset();
var height = relativeTo.height();
var menuHeight = menu.height();
var top = (height+pos.top);
var top = (height+pos.top-3);
if (top+menuHeight > $(window).height()) {
top -= (top+menuHeight)-$(window).height()+5;
}
@@ -453,7 +417,7 @@
}
menu.css({
top: top+"px",
left: (pos.left)+"px",
left: (2+pos.left)+"px",
});
menu.slideDown(100);
this._delay(function() {
@@ -469,27 +433,21 @@
})
});
},
_getLabelWidth: function(label, done) {
_getLabelWidth: function(label) {
var labelWidth = label.outerWidth();
if (labelWidth === 0) {
var wrapper = $('<div class="red-ui-editor"></div>').css({
var container = $('<div class="red-ui-typedInput-container"></div>').css({
position:"absolute",
"white-space": "nowrap",
top:-2000
top:0
}).appendTo(document.body);
var container = $('<div class="red-ui-typedInput-container"></div>').appendTo(wrapper);
var newTrigger = label.clone().appendTo(container);
setTimeout(function() {
labelWidth = newTrigger.outerWidth();
wrapper.remove();
done(labelWidth);
},50)
} else {
done(labelWidth);
labelWidth = newTrigger.outerWidth();
container.remove();
}
return labelWidth;
},
_resize: function() {
var that = this;
if (this.uiWidth !== null) {
this.uiSelect.width(this.uiWidth);
}
@@ -498,78 +456,71 @@
this.selectTrigger.addClass("red-ui-typedInput-full-width");
} else {
this.selectTrigger.removeClass("red-ui-typedInput-full-width");
this._getLabelWidth(this.selectTrigger, function(labelWidth) {
that.elementDiv.css('left',labelWidth+"px");
that.valueLabelContainer.css('left',labelWidth+"px");
if (that.optionExpandButton.shown) {
that.elementDiv.css('right',"22px");
that.valueLabelContainer.css('right',"22px");
} else {
that.elementDiv.css('right','0');
that.valueLabelContainer.css('right','0');
that.input.css({
'border-top-right-radius': '4px',
'border-bottom-right-radius': '4px'
var labelWidth = this._getLabelWidth(this.selectTrigger);
this.elementDiv.css('left',labelWidth+"px");
this.valueLabelContainer.css('left',labelWidth+"px");
if (this.optionExpandButton.is(":visible")) {
this.elementDiv.css('right',"22px");
this.valueLabelContainer.css('right',"22px");
} else {
this.elementDiv.css('right','0');
this.valueLabelContainer.css('right','0');
this.input.css({
'border-top-right-radius': '4px',
'border-bottom-right-radius': '4px'
});
}
// if (this.optionSelectTrigger) {
// this.optionSelectTrigger.css({'left':(labelWidth)+"px",'width':'calc( 100% - '+labelWidth+'px )'});
// }
if (this.optionSelectTrigger) {
if (type && type.options && type.hasValue === true) {
this.optionSelectLabel.css({'left':'auto'})
var lw = this._getLabelWidth(this.optionSelectLabel);
this.optionSelectTrigger.css({'width':(23+lw)+"px"});
this.elementDiv.css('right',(23+lw)+"px");
this.input.css({
'border-top-right-radius': 0,
'border-bottom-right-radius': 0
});
}
if (that.optionSelectTrigger) {
if (type && type.options && type.hasValue === true) {
that.optionSelectLabel.css({'left':'auto'})
that._getLabelWidth(that.optionSelectLabel, function(lw) {
that.optionSelectTrigger.css({'width':(23+lw)+"px"});
that.elementDiv.css('right',(23+lw)+"px");
that.input.css({
'border-top-right-radius': 0,
'border-bottom-right-radius': 0
});
} else {
this.optionSelectLabel.css({'left':'0'})
this.optionSelectTrigger.css({'width':'calc( 100% - '+labelWidth+'px )'});
if (!this.optionExpandButton.is(":visible")) {
this.elementDiv.css({'right':0});
this.input.css({
'border-top-right-radius': '4px',
'border-bottom-right-radius': '4px'
});
} else {
that.optionSelectLabel.css({'left':'0'})
that.optionSelectTrigger.css({'width':'calc( 100% - '+labelWidth+'px )'});
if (!that.optionExpandButton.shown) {
that.elementDiv.css({'right':0});
that.input.css({
'border-top-right-radius': '4px',
'border-bottom-right-radius': '4px'
});
}
}
}
});
}
}
},
_updateOptionSelectLabel: function(o) {
var opt = this.typeMap[this.propertyType];
this.optionSelectLabel.empty();
if (this.typeMap[this.propertyType].valueLabel) {
if (opt.multiple) {
this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o);
if (o.icon) {
if (o.icon.indexOf("<") === 0) {
$(o.icon).prependTo(this.optionSelectLabel);
} else if (o.icon.indexOf("/") !== -1) {
// url
$('<img>',{src:o.icon,style:"height: 18px;"}).prependTo(this.optionSelectLabel);
} else {
this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o.value);
}
} 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());
// 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.length+" selected");
this.optionSelectLabel.text(o.value);
}
if (opt.hasValue) {
this.optionValue = o.value;
this._resize();
this.input.trigger('change',this.propertyType,this.value());
}
},
_destroy: function() {
@@ -598,7 +549,7 @@
if (this.menu) {
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)) {
this.type(this.typeList[0].value);
} else {
@@ -612,51 +563,38 @@
this._resize();
},
value: function(value) {
var that = this;
var opt = this.typeMap[this.propertyType];
if (!arguments.length) {
var v = this.input.val();
if (opt.export) {
v = opt.export(v,this.optionValue)
if (this.typeMap[this.propertyType].export) {
v = this.typeMap[this.propertyType].export(v,this.optionValue)
}
return v;
} else {
var selectedOption = [];
if (opt.options) {
var checkValues = [value];
if (opt.multiple) {
selectedOption = [];
checkValues = value.split(",");
}
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) {
selectedOption.push(that.activeOptions[op]);
break;
}
} else if (op.value === value) {
selectedOption.push(op);
var selectedOption;
if (this.typeMap[this.propertyType].options) {
for (var i=0;i<this.typeMap[this.propertyType].options.length;i++) {
var op = this.typeMap[this.propertyType].options[i];
if (typeof op === "string") {
if (op === value) {
selectedOption = this.activeOptions[op];
break;
}
} else if (op.value === value) {
selectedOption = op;
break;
}
})
this.input.val(value);
if (!opt.multiple) {
if (!selectedOption.length === 0) {
selectedOption = [{value:""}];
}
this._updateOptionSelectLabel(selectedOption[0])
} else {
this._updateOptionSelectLabel(selectedOption)
}
if (!selectedOption) {
selectedOption = {value:""}
}
this.input.val(value);
this._updateOptionSelectLabel(selectedOption)
} else {
this.input.val(value);
if (opt.valueLabel) {
this.valueLabelContainer.empty();
opt.valueLabel.call(this,this.valueLabelContainer,value);
}
}
if (this.typeMap[this.propertyType].valueLabel) {
this.valueLabelContainer.empty();
this.typeMap[this.propertyType].valueLabel.call(this,this.valueLabelContainer,value);
}
this.input.trigger('change',this.type(),value);
}
@@ -674,23 +612,20 @@
}
this.selectLabel.empty();
var image;
if (opt.icon && opt.showLabel !== false) {
if (opt.icon) {
if (opt.icon.indexOf("<") === 0) {
$(opt.icon).prependTo(this.selectLabel);
}
else if (opt.icon.indexOf("/") !== -1) {
image = new Image();
image.onload = function() { that._resize(); }
image.onerror = function() { that._resize(); }
image.name = opt.icon;
image.src = mapDeprecatedIcon(opt.icon);
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
image.src = opt.icon;
$('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
}
else {
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(this.selectLabel);
}
}
if (opt.hasValue === false || (opt.showLabel !== false && !opt.icon)) {
} else {
this.selectLabel.text(opt.label);
}
if (this.optionMenu) {
@@ -700,7 +635,6 @@
if (opt.options) {
if (this.optionExpandButton) {
this.optionExpandButton.hide();
this.optionExpandButton.shown = false;
}
if (this.optionSelectTrigger) {
this.optionSelectTrigger.show();
@@ -723,50 +657,36 @@
if (!that.activeOptions.hasOwnProperty(that.optionValue)) {
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;
if (!opt.hasValue) {
var validValue = false;
var currentVal = this.input.val();
if (!opt.multiple) {
for (var i=0;i<opt.options.length;i++) {
op = opt.options[i];
if (typeof op === "string" && op === currentVal) {
that._updateOptionSelectLabel({value:currentVal});
validValue = true;
break;
} else if (op.value === currentVal) {
that._updateOptionSelectLabel(op);
validValue = true;
break;
}
var validValue = false;
for (var i=0;i<opt.options.length;i++) {
op = opt.options[i];
if (typeof op === "string" && op === currentVal) {
that._updateOptionSelectLabel({value:currentVal});
validValue = true;
break;
} else if (op.value === currentVal) {
that._updateOptionSelectLabel(op);
validValue = true;
break;
}
if (!validValue) {
op = opt.options[0];
if (typeof op === "string") {
this.value(op);
that._updateOptionSelectLabel({value:op});
} else {
this.value(op.value);
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(","));
}
if (!validValue) {
op = opt.options[0];
if (typeof op === "string") {
this.value(op);
that._updateOptionSelectLabel({value:op});
} else {
this.value(op.value);
that._updateOptionSelectLabel(op);
}
}
} else {
@@ -802,21 +722,7 @@
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());
} else {
if (this.optionSelectTrigger) {
@@ -841,47 +747,23 @@
this.elementDiv.show();
}
if (this.optionExpandButton) {
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;
if (opt.expand && typeof opt.expand === 'function') {
this.optionExpandButton.show();
this.optionExpandButton.off('click');
this.optionExpandButton.on('click',function(evt) {
evt.preventDefault();
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"
});
}
opt.expand.call(that);
})
} else {
this.optionExpandButton.shown = false;
this.optionExpandButton.hide();
}
}
this._trigger("typechange",null,this.propertyType);
this.input.trigger('change',this.propertyType,this.value());
}
if (!image) {
if (image) {
image.onload = function() { that._resize(); }
image.onerror = function() { that._resize(); }
} else {
this._resize();
}
}

View File

@@ -17,9 +17,9 @@
RED.deploy = (function() {
var deploymentTypes = {
"full":{img:"red/images/deploy-full-o.svg"},
"nodes":{img:"red/images/deploy-nodes-o.svg"},
"flows":{img:"red/images/deploy-flows-o.svg"}
"full":{img:"red/images/deploy-full-o.png"},
"nodes":{img:"red/images/deploy-nodes-o.png"},
"flows":{img:"red/images/deploy-flows-o.png"}
}
var ignoreDeployWarnings = {
@@ -44,7 +44,7 @@ RED.deploy = (function() {
* type: "default" - Button with drop-down options - no further customisation available
* type: "simple" - Button without dropdown. Customisations:
* label: the text to display - default: "Deploy"
* icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.svg"
* icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.png"
*/
function init(options) {
options = options || {};
@@ -54,7 +54,7 @@ RED.deploy = (function() {
$('<li><span class="red-ui-deploy-button-group button-group">'+
'<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+
'<span class="red-ui-deploy-button-content">'+
'<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.svg"> '+
'<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.png"> '+
'<span>'+RED._("deploy.deploy")+'</span>'+
'</span>'+
'<span class="red-ui-deploy-button-spinner hide">'+
@@ -65,17 +65,17 @@ RED.deploy = (function() {
'</span></li>').prependTo(".red-ui-header-toolbar");
RED.menu.init({id:"red-ui-header-button-deploy-options",
options: [
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.svg",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
{id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.svg",label:RED._("deploy.modifiedFlows"),sublabel:RED._("deploy.modifiedFlowsDesc"), onselect:function(s) {if(s){changeDeploymentType("flows")}}},
{id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.svg",label:RED._("deploy.modifiedNodes"),sublabel:RED._("deploy.modifiedNodesDesc"),onselect:function(s) { if(s){changeDeploymentType("nodes")}}},
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.png",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
{id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.png",label:RED._("deploy.modifiedFlows"),sublabel:RED._("deploy.modifiedFlowsDesc"), onselect:function(s) {if(s){changeDeploymentType("flows")}}},
{id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.png",label:RED._("deploy.modifiedNodes"),sublabel:RED._("deploy.modifiedNodesDesc"),onselect:function(s) { if(s){changeDeploymentType("nodes")}}},
null,
{id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"},
{id:"deploymenu-item-reload", icon:"red/images/deploy-reload.png",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"},
]
});
} else if (type == "simple") {
var label = options.label || RED._("deploy.deploy");
var icon = 'red/images/deploy-full-o.svg';
var icon = 'red/images/deploy-full-o.png';
if (options.hasOwnProperty('icon')) {
icon = options.icon;
}

View File

@@ -399,9 +399,9 @@ RED.diff = (function() {
diff: localDiff,
def: {
defaults:{},
icon:"subflow.svg",
icon:"subflow.png",
category: "subflows",
color: "#DDAA99"
color: "#da9"
},
tab:currentConfig.subflows[subflowId]
}
@@ -422,9 +422,9 @@ RED.diff = (function() {
diff: localDiff,
def: {
defaults:{},
icon:"subflow.svg",
icon:"subflow.png",
category: "subflows",
color: "#DDAA99"
color: "#da9"
},
tab:newConfig.subflows[subflowId],
newTab:newConfig.subflows[subflowId]
@@ -443,9 +443,9 @@ RED.diff = (function() {
remoteDiff: remoteDiff,
def: {
defaults:{},
icon:"subflow.svg",
icon:"subflow.png",
category: "subflows",
color: "#DDAA99"
color: "#da9"
},
tab:remoteDiff.newConfig.subflows[subflowId],
remoteTab: remoteDiff.newConfig.subflows[subflowId]
@@ -549,9 +549,9 @@ RED.diff = (function() {
if (def === undefined) {
if (/^subflow:/.test(node.type)) {
def = {
icon:"subflow.svg",
icon:"subflow.png",
category: "subflows",
color: "#DDAA99",
color: "#da9",
defaults:{name:{value:""}}
}
} else {

View File

@@ -19,6 +19,7 @@
*/
RED.editor = (function() {
var editStack = [];
var editing_node = null;
var editing_config_node = null;
@@ -230,12 +231,8 @@ 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) {
removedLinks = removedLinks.concat(RED.nodes.filterLinks({target:node}));
removedLinks.concat(RED.nodes.filterLinks({target:node}));
}
for (var l=0;l<removedLinks.length;l++) {
RED.nodes.removeLink(removedLinks[l]);
@@ -529,7 +526,7 @@ RED.editor = (function() {
} else if (node.type.indexOf("subflow:")===0) {
var subflow = RED.nodes.subflow(node.type.substring(8));
label = RED._("subflow.editSubflowInstance",{name:RED.utils.sanitize(subflow.name)})
} else if (node._def !== undefined) {
} else {
if (typeof node._def.paletteLabel !== "undefined") {
try {
label = RED.utils.sanitize((typeof node._def.paletteLabel === "function" ? node._def.paletteLabel.call(node._def) : node._def.paletteLabel)||"");
@@ -549,7 +546,148 @@ RED.editor = (function() {
return label;
}
function isSameObj(env0, env1) {
function buildEnvForm(container, node) {
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));
}
@@ -575,8 +713,8 @@ RED.editor = (function() {
$(this).attr("data-i18n",keys.join(";"));
});
if (type === "subflow-template" || type === "subflow") {
RED.subflow.buildEditForm(dialogForm,type,node);
if ((type === "subflow") || (type === "subflow-template")) {
buildEnvForm(dialogForm, node);
}
// Add dummy fields to prevent 'Enter' submitting the form in some
@@ -598,18 +736,10 @@ RED.editor = (function() {
var outputsDiv = $("#red-ui-editor-node-label-form-outputs");
var inputCount;
var formInputs = $("#node-input-inputs").val();
if (formInputs === undefined) {
if (node.type === 'subflow') {
inputCount = node.in.length;
} else {
inputCount = node.inputs || node._def.inputs || 0;
}
if (node.type === 'subflow') {
inputCount = node.in.length;
} else {
inputCount = Math.min(1,Math.max(0,parseInt(formInputs)));
if (isNaN(inputCount)) {
inputCount = 0;
}
inputCount = node.inputs || node._def.inputs || 0;
}
var children = inputsDiv.children();
@@ -727,8 +857,30 @@ RED.editor = (function() {
}
return result;
}
function showIconPicker(container, backgroundColor, iconPath, faOnly, done) {
var picker = $('<div class="red-ui-icon-picker">');
function showIconPicker(container, node, iconPath, done) {
var containerPos = container.offset();
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);
searchInput = $('<input type="text">').attr("placeholder",RED._("editor.searchIcons")).appendTo(searchDiv).searchBox({
delay: 50,
@@ -756,224 +908,53 @@ RED.editor = (function() {
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) {
e.preventDefault();
iconPanel.hide();
hide();
done(null);
});
if (!backgroundColor && faOnly) {
iconList.addClass("red-ui-icon-list-dark");
}
setTimeout(function() {
var iconSets = RED.nodes.getIconSets();
Object.keys(iconSets).forEach(function(moduleName) {
if (faOnly && (moduleName !== "font-awesome")) {
return;
}
var icons = iconSets[moduleName];
if (icons.length > 0) {
// selectIconModule.append($("<option></option>").val(moduleName).text(moduleName));
var header = $('<div class="red-ui-icon-list-module"></div>').text(moduleName).appendTo(iconList);
$('<i class="fa fa-cube"></i>').prependTo(header);
icons.forEach(function(icon) {
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);
var iconSets = RED.nodes.getIconSets();
Object.keys(iconSets).forEach(function(moduleName) {
var icons = iconSets[moduleName];
if (icons.length > 0) {
// selectIconModule.append($("<option></option>").val(moduleName).text(moduleName));
var header = $('<div class="red-ui-icon-list-module"></div>').text(moduleName).appendTo(iconList);
$('<i class="fa fa-cube"></i>').prependTo(header);
icons.forEach(function(icon) {
var iconDiv = $('<div>',{class:"red-ui-icon-list-icon"}).appendTo(iconList);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconDiv);
var colour = RED.utils.getNodeColor(node.type, node._def);
var icon_url = RED.settings.apiRootUrl+"icons/"+moduleName+"/"+icon;
iconDiv.data('icon',icon_url);
nodeDiv.css('backgroundColor',colour);
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) {
iconDiv.addClass("selected");
}
iconDiv.on("mouseover", function() {
summary.text(icon);
})
iconDiv.on("mouseout", function() {
summary.html("&nbsp;");
})
iconDiv.on("click", function() {
iconPanel.hide();
done(moduleName+"/"+icon);
})
if (iconPath.module === moduleName && iconPath.file === icon) {
iconDiv.addClass("selected");
}
iconDiv.on("mouseover", function() {
summary.text(icon);
})
}
});
setTimeout(function() {
spinner.remove();
},50);
},300);
var spinner = RED.utils.addSpinnerOverlay(iconList,true);
var iconPanel = RED.popover.panel(picker);
iconPanel.show({
target: container
})
iconDiv.on("mouseout", function() {
summary.html("&nbsp;");
})
iconDiv.on("click", function() {
hide();
done(moduleName+"/"+icon);
})
})
}
});
picker.slideDown(100);
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) {
var dialogForm = $('<form class="dialog-form form-horizontal" autocomplete="off"></form>').appendTo(container);
var i,row;
if (node.type === "subflow") {
var categoryRow = $("<div/>", {
class: "form-row"
}).appendTo(dialogForm);
$("<label/>", {
for: "subflow-appearance-input-category",
"data-i18n": "editor:subflow.category"
}).appendTo(categoryRow);
var categorySelector = $("<select/>", {
id: "subflow-appearance-input-category"
}).css({
width: "250px"
}).appendTo(categoryRow);
$("<input/>", {
type: "text",
id: "subflow-appearance-input-custom-category"
}).css({
display: "none",
"margin-left": "10px",
width: "calc(100% - 250px)"
}).appendTo(categoryRow);
var categories = RED.palette.getCategories();
categories.sort(function(A,B) {
return A.label.localeCompare(B.label);
})
categories.forEach(function(cat) {
categorySelector.append($("<option/>").val(cat.id).text(cat.label));
})
categorySelector.append($("<option/>").attr('disabled',true).text("---"));
categorySelector.append($("<option/>").val("_custom_").text(RED._("palette.addCategory")));
$("#subflow-appearance-input-category").on("change", function() {
var val = $(this).val();
if (val === "_custom_") {
$("#subflow-appearance-input-category").width(120);
$("#subflow-appearance-input-custom-category").show();
} else {
$("#subflow-appearance-input-category").width(250);
$("#subflow-appearance-input-custom-category").hide();
}
})
$("#subflow-appearance-input-category").val(node.category||"subflows");
var userCount = 0;
var subflowType = "subflow:"+node.id;
RED.nodes.eachNode(function(n) {
if (n.type === subflowType) {
userCount++;
}
});
$("#red-ui-editor-subflow-user-count")
.text(RED._("subflow.subflowInstances", {count:userCount})).show();
}
$('<div class="form-row">'+
'<label for="node-input-show-label-btn" data-i18n="editor.label"></label>'+
'<span style="margin-right: 2px;"/>'+
'<input type="checkbox" id="node-input-show-label"/>'+
'</div>').appendTo(dialogForm);
@@ -988,24 +969,13 @@ RED.editor = (function() {
}
$("#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 ((!node._def.defaults || !node._def.defaults.hasOwnProperty("icon"))) {
var iconRow = $('<div class="form-row"></div>').appendTo(dialogForm);
$('<label data-i18n="editor.settingIcon">').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 iconButton = $('<button type="button" class="red-ui-button" id="red-ui-editor-node-icon-button">').appendTo(iconRow);
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).appendTo(iconButton);
var colour = RED.utils.getNodeColor(node.type, node._def);
var icon_url = RED.utils.getNodeIcon(node._def,node);
@@ -1016,30 +986,21 @@ RED.editor = (function() {
iconButton.on("click", function(e) {
e.preventDefault();
var iconPath;
var icon = $("#red-ui-editor-node-icon").val()||"";
var icon = $("#red-ui-editor-node-icon").text()||"";
if (icon) {
iconPath = RED.utils.separateIconPath(icon);
} else {
iconPath = RED.utils.getDefaultNodeIcon(node._def, node);
}
var backgroundColor = RED.utils.getNodeColor(node.type, node._def);
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||"");
showIconPicker(iconRow,node,iconPath,function(newIcon) {
$("#red-ui-editor-node-icon").text(newIcon||"");
var icon_url = RED.utils.getNodeIcon(node._def,{type:node.type,icon:newIcon});
RED.utils.createIconElement(icon_url, iconContainer, true);
});
});
RED.popover.tooltip(iconButton, function() {
return $("#red-ui-editor-node-icon").val()||"default";
})
$('<input type="hidden" id="red-ui-editor-node-icon">').val(node.icon).appendTo(iconRow);
$('<div id="red-ui-editor-node-icon">').text(node.icon).appendTo(iconButton);
}
$('<div class="form-row"><span data-i18n="editor.portLabels"></span></div>').appendTo(dialogForm);
var inputCount = node.inputs || node._def.inputs || 0;
@@ -1075,7 +1036,6 @@ RED.editor = (function() {
}
}
function updateLabels(editing_node, changes, outputMap) {
var inputLabels = $("#red-ui-editor-node-label-form-inputs").children().find("input");
var outputLabels = $("#red-ui-editor-node-label-form-outputs").children().find("input");
@@ -1363,7 +1323,7 @@ RED.editor = (function() {
}
if (!editing_node._def.defaults || !editing_node._def.defaults.hasOwnProperty("icon")) {
var icon = $("#red-ui-editor-node-icon").val()||""
var icon = $("#red-ui-editor-node-icon").text()||""
if (!isDefaultIcon) {
if (icon !== editing_node.icon) {
changes.icon = editing_node.icon;
@@ -1466,13 +1426,13 @@ RED.editor = (function() {
if (type === "subflow") {
var old_env = editing_node.env;
var new_env = RED.subflow.exportSubflowInstanceEnv(editing_node);
if (!isSameObj(old_env, new_env)) {
var new_env = exportEnvList($("#node-input-env-container").editableList("items"));
if (!isSameEnv(old_env, new_env)) {
editing_node.env = new_env;
changes.env = editing_node.env;
changed = true;
}
}
}
if (changed) {
var wasChanged = editing_node.changed;
@@ -1590,19 +1550,6 @@ RED.editor = (function() {
buildEditForm(nodePropertiesTab.content,"dialog-form",type,ns,node);
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>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
iconClass: "fa fa-list"
};
RED.subflow.buildPropertiesForm(subflowPropertiesTab.content,node);
editorTabs.addTab(subflowPropertiesTab);
}
if (!node._def.defaults || !node._def.defaults.hasOwnProperty('info')) {
var descriptionTab = {
id: "editor-tab-description",
@@ -1764,8 +1711,7 @@ RED.editor = (function() {
RED.tray.resize();
}
},
collapsible: true,
menu: false
collapsible: true
});
var nodePropertiesTab = {
@@ -1872,6 +1818,7 @@ RED.editor = (function() {
var configId = editing_config_node.id;
var configAdding = adding;
var configTypeDef = RED.nodes.getType(configType);
if (configTypeDef.oneditcancel) {
// TODO: what to pass as this to call
if (configTypeDef.oneditcancel) {
@@ -2208,16 +2155,16 @@ RED.editor = (function() {
if (updateLabels(editing_node, changes, null)) {
changed = true;
}
var icon = $("#red-ui-editor-node-icon").val()||"";
if ((editing_node.icon === undefined && icon !== "node-red/subflow.svg") ||
var icon = $("#red-ui-editor-node-icon").text()||"";
if ((editing_node.icon === undefined && icon !== "node-red/subflow.png") ||
(editing_node.icon !== undefined && editing_node.icon !== icon)) {
changes.icon = editing_node.icon;
editing_node.icon = icon;
changed = true;
}
var newCategory = $("#subflow-appearance-input-category").val().trim();
var newCategory = $("#subflow-input-category").val().trim();
if (newCategory === "_custom_") {
newCategory = $("#subflow-appearance-input-custom-category").val().trim();
newCategory = $("#subflow-input-custom-category").val().trim();
if (newCategory === "") {
newCategory = editing_node.category;
}
@@ -2231,22 +2178,14 @@ RED.editor = (function() {
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();
}
var old_env = editing_node.env;
var new_env = RED.subflow.exportSubflowTemplateEnv($("#node-input-env-container").editableList("items"));
if (!isSameObj(old_env, new_env)) {
var new_env = exportEnvList($("#node-input-env-container").editableList("items"));
if (!isSameEnv(old_env, new_env)) {
editing_node.env = new_env;
changes.env = editing_node.env;
changed = true;
}
RED.palette.refresh();
if (changed) {
@@ -2260,7 +2199,6 @@ RED.editor = (function() {
id:n.id,
changed:n.changed
})
n._def.color = editing_node.color;
n.changed = true;
n.dirty = true;
updateNodeProperties(n);
@@ -2288,39 +2226,21 @@ RED.editor = (function() {
],
resize: function(size) {
$(".red-ui-tray-content").height(size.height - 50);
var envContainer = $("#node-input-env-container");
if (envContainer.length) {
// var form = $(".red-ui-tray-content form").height(size.height - 50 - 40);
var rows = $("#dialog-form>div:not(#subflow-env-tabs-content)");
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 form = $(".red-ui-tray-content form").height(size.height - 50 - 40);
var rows = $("#dialog-form>div:not(.node-input-env-container-row)");
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-80);
},
open: function(tray) {
var trayFooter = tray.find(".red-ui-tray-footer");
var trayFooterLeft = $("<div/>", {
class: "red-ui-tray-footer-left"
}).appendTo(trayFooter)
var trayBody = tray.find('.red-ui-tray-body');
trayBody.parent().css('overflow','hidden');
if (editing_node.type === "subflow") {
var span = $("<span/>").css({
"margin-left": "10px"
}).appendTo(trayFooterLeft);
$("<i/>", {
class: "fa fa-info-circle"
}).appendTo(span);
$("<span/>").text(" ").appendTo(span);
$("<i/>", {
id: "red-ui-editor-subflow-user-count"
}).appendTo(span);
}
if (editing_node) {
RED.sidebar.info.refresh(editing_node);
@@ -2341,8 +2261,7 @@ RED.editor = (function() {
RED.tray.resize();
}
},
collapsible: true,
menu: false
collapsible: true
});
var nodePropertiesTab = {
@@ -2381,9 +2300,46 @@ RED.editor = (function() {
buildAppearanceForm(appearanceTab.content,editing_node);
editorTabs.addTab(appearanceTab);
$("#subflow-input-name").val(subflow.name);
RED.text.bidi.prepareInput($("#subflow-input-name"));
$("#subflow-input-category").empty();
var categories = RED.palette.getCategories();
categories.sort(function(A,B) {
return A.label.localeCompare(B.label);
})
categories.forEach(function(cat) {
$("#subflow-input-category").append($("<option></option>").val(cat.id).text(cat.label));
})
$("#subflow-input-category").append($("<option></option>").attr('disabled',true).text("---"));
$("#subflow-input-category").append($("<option></option>").val("_custom_").text(RED._("palette.addCategory")));
$("#subflow-input-category").on("change", function() {
var val = $(this).val();
if (val === "_custom_") {
$("#subflow-input-category").width(120);
$("#subflow-input-custom-category").show();
} else {
$("#subflow-input-category").width(250);
$("#subflow-input-custom-category").hide();
}
})
$("#subflow-input-category").val(subflow.category||"subflows");
var userCount = 0;
var subflowType = "subflow:"+editing_node.id;
RED.nodes.eachNode(function(n) {
if (n.type === subflowType) {
userCount++;
}
});
$("#subflow-dialog-user-count").text(RED._("subflow.subflowInstances", {count:userCount})).show();
trayBody.i18n();
finishedBuilding = true;
},
@@ -2504,7 +2460,6 @@ RED.editor = (function() {
content: RED._("markdownEditor.format"),
autoClose: 50
});
session.setUseWrapMode(true);
}
return editor;
}
@@ -2537,8 +2492,6 @@ RED.editor = (function() {
validateNode: validateNode,
updateNodeProperties: updateNodeProperties, // TODO: only exposed for edit-undo
showIconPicker:showIconPicker,
/**
* Show a type editor.
* @param {string} type - the type to display

View File

@@ -38,7 +38,7 @@
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-panel-editor" class="red-ui-panel">'+
'<div style="height: 100%; margin: auto;">'+
'<div style="height: 100%; margin: auto; max-width: 1000px;">'+
'<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>'+

View File

@@ -17,20 +17,7 @@
RED.palette = (function() {
var exclusion = ['config','unknown','deprecated'];
var coreCategories = [
'subflows',
'common',
'function',
'network',
'input',
'output',
'sequence',
'parser',
'storage',
'analysis',
'social',
'advanced'
];
var coreCategories = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'];
var categoryContainers = {};
var sidebarControls;
@@ -50,7 +37,6 @@ RED.palette = (function() {
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 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+'-output"></div>'+
'<div id="red-ui-palette-'+category+'-function"></div>'+
@@ -98,36 +84,18 @@ RED.palette = (function() {
var displayLines = [];
var currentLine = "";
for (var i=0;i<words.length;i++) {
var word = words[i];
var sep = (i == 0) ? "" : " ";
var newWidth = RED.view.calculateTextWidth(currentLine+sep+word, "red-ui-palette-label", 0);
var currentLine = words[0];
var currentLineWidth = RED.view.calculateTextWidth(currentLine, "red-ui-palette-label", 0);
for (var i=1;i<words.length;i++) {
var newWidth = RED.view.calculateTextWidth(currentLine+" "+words[i], "red-ui-palette-label", 0);
if (newWidth < nodeWidth) {
currentLine += sep +word;
currentLine += " "+words[i];
currentLineWidth = newWidth;
} else {
if (i > 0) {
displayLines.push(currentLine);
}
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);
currentLine = words[i];
currentLineWidth = RED.view.calculateTextWidth(currentLine, "red-ui-palette-label", 0);
}
}
displayLines.push(currentLine);
@@ -184,25 +152,19 @@ RED.palette = (function() {
function getPaletteNode(type) {
return $(".red-ui-palette-node[data-palette-type='"+type+"']");
}
function escapeCategory(category) {
return category.replace(/[ /.]/g,"_");
}
function addNodeType(nt,def) {
if (getPaletteNode(nt).length) {
return;
}
var nodeCategory = def.category;
if (exclusion.indexOf(def.category)===-1) {
if (exclusion.indexOf(nodeCategory)===-1) {
var originalCategory = nodeCategory;
var category = escapeCategory(nodeCategory);
var originalCategory = def.category;
var category = def.category.replace(/ /g,"_");
var rootCategory = category.split("-")[0];
var d = $('<div>',{class:"red-ui-palette-node"}).attr("data-palette-type",nt).data('category',rootCategory);
var label = nt;///^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
if (typeof def.paletteLabel !== "undefined") {
try {
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
@@ -240,7 +202,7 @@ RED.palette = (function() {
d.append(portIn);
}
createCategory(nodeCategory,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
createCategory(def.category,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
$("#red-ui-palette-"+category).append(d);
@@ -278,6 +240,7 @@ RED.palette = (function() {
RED.sidebar.info.set(helpText,RED._("sidebar.info.nodeHelp"));
});
var chart = $("#red-ui-workspace-chart");
var chartOffset = chart.offset();
var chartSVG = $("#red-ui-workspace-chart>svg").get(0);
var activeSpliceLink;
var mouseX;
@@ -298,12 +261,11 @@ 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;}},
drag: function(e,ui) {
var paletteNode = getPaletteNode(nt);
ui.originalPosition.left = paletteNode.offset().left;
ui.originalPosition.left = $('#' + e.target.id).offset().left;
if (def.inputs > 0 && def.outputs > 0) {
mouseX = ui.position.left - paletteWidth + (ui.helper.width()/2) + chart.scrollLeft();
mouseY = ui.position.top - paletteTop + (ui.helper.height()/2) + chart.scrollTop();
mouseX = ui.position.left-paletteWidth+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft();
mouseY = ui.position.top-paletteTop+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop();
if (!spliceTimer) {
spliceTimer = setTimeout(function() {
var nodes = [];
@@ -449,11 +411,11 @@ RED.palette = (function() {
var currentCategory = paletteNode.data('category');
var newCategory = (sf.category||"subflows");
if (currentCategory !== newCategory) {
var category = escapeCategory(newCategory);
var category = newCategory.replace(/ /g,"_");
createCategory(newCategory,category,category,"node-red");
var currentCategoryNode = paletteNode.closest(".red-ui-palette-category");
var newCategoryNode = $("#red-ui-palette-"+category);
var newCategoryNode = $("#palette-"+category);
newCategoryNode.append(paletteNode);
if (newCategoryNode.find(".red-ui-palette-node").length === 1) {
categoryContainers[category].open();
@@ -466,9 +428,10 @@ RED.palette = (function() {
currentCategoryNode.find("i").toggleClass("expanded");
}
}
}
paletteNode.css("backgroundColor", sf.color);
}
});
}
@@ -571,27 +534,21 @@ RED.palette = (function() {
sidebarControls.stop(false,true);
sidebarControls.hide();
})
var userCategories = [];
if (RED.settings.paletteCategories) {
userCategories = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) {
userCategories = RED.settings.theme('palette.categories');
}
if (!Array.isArray(userCategories)) {
userCategories = [];
}
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 categoryList = coreCategories;
if (RED.settings.paletteCategories) {
categoryList = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) {
categoryList = RED.settings.theme('palette.categories');
}
if (!Array.isArray(categoryList)) {
categoryList = coreCategories
}
categoryList.forEach(function(category){
createCategoryContainer(category, category, "palette.label."+category);
});
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);
paletteCollapseAll.on("click", function(e) {
@@ -635,6 +592,7 @@ RED.palette = (function() {
setTimeout(function() { $(window).trigger("resize"); } ,200);
}
function getCategories() {
var categories = [];
$("#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) {
desc = marked(activeProject.description);
} else {
desc = '<span class="red-ui-help-info-none">' + RED._("sidebar.project.noDescriptionAvailable") + '</span>';
desc = '<span class="red-ui-help-info-none">'+'No description available'+'</span>';
}
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>" );
@@ -222,7 +222,7 @@ RED.projects.settings = (function() {
if (summary) {
container.text(summary).removeClass('node-info-node');
} else {
container.text(RED._("sidebar.project.noSummaryAvailable")).addClass('red-ui-help-info-none');
container.text(RED._("sidebar.project.projectSettings.noSummaryAvailable")).addClass('red-ui-help-info-none');
}
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -14,29 +14,32 @@
* limitations under the License.
**/
RED.sidebar.context = (function() {
var content;
var sections;
var localCache = {};
var flowAutoRefresh;
var nodeAutoRefresh;
var nodeSection;
// var subflowSection;
var flowSection;
var globalSection;
var currentNode;
var currentFlow;
function init() {
content = $("<div>").css({"position":"relative","height":"100%"});
content.className = "red-ui-sidebar-context"
var footerToolbar = $('<div></div>');
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 stackContainer = $("<div>",{class:"red-ui-sidebar-context-stack"}).appendTo(content);
sections = RED.stack.create({
container: stackContainer
@@ -45,6 +48,7 @@ RED.sidebar.context = (function() {
nodeSection = sections.add({
title: RED._("sidebar.context.node"),
collapsible: true
// onexpand: function() { updateNode(currentNode,true); }
});
nodeSection.expand();
nodeSection.content.css({height:"100%"});
@@ -52,27 +56,14 @@ RED.sidebar.context = (function() {
var table = $('<table class="red-ui-info-table"></table>').appendTo(nodeSection.content);
nodeSection.table = $('<tbody>').appendTo(table);
var bg = $('<div style="float: right"></div>').appendTo(nodeSection.header);
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>')
$('<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();
updateNode(currentNode, true);
})
RED.popover.tooltip(manualRefreshNode,RED._("sidebar.context.refrsh"));
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
flowSection = sections.add({
title: RED._("sidebar.context.flow"),
@@ -84,26 +75,14 @@ RED.sidebar.context = (function() {
var table = $('<table class="red-ui-info-table"></table>').appendTo(flowSection.content);
flowSection.table = $('<tbody>').appendTo(table);
bg = $('<div style="float: right"></div>').appendTo(flowSection.header);
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>')
$('<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();
updateFlow(currentFlow, true);
})
RED.popover.tooltip(manualRefreshFlow,RED._("sidebar.context.refrsh"));
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
globalSection = sections.add({
title: RED._("sidebar.context.global"),
@@ -139,6 +118,27 @@ RED.sidebar.context = (function() {
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) {
var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0];
updateNode(selectedNode);
@@ -147,18 +147,40 @@ RED.sidebar.context = (function() {
RED.events.on("workspace:change", function(event) {
updateFlow(RED.nodes.workspace(event.workspace));
})
$(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;");
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;");
}
}
function updateNode(node,force) {
currentNode = node;
if (force || nodeAutoRefresh.prop("checked")) {
if (node) {
updateEntry(nodeSection,"context/node/"+node.id,node.id);
if (node && /^subflow:/.test(node.type)) {
if (currentNode && currentNode.hasOwnProperty("name") && currentNode.name.length > 0 ) {
$(nodeSection.title).text(RED._("sidebar.context.subflow") + ": " + currentNode.name);
} else {
$(nodeSection.title).text(RED._("sidebar.context.subflow"));
}
} else {
if (currentNode && currentNode.hasOwnProperty("name") && currentNode.name.length > 0 ) {
$(nodeSection.title).text(RED._("sidebar.context.node") + ": " + currentNode.name);
}
else { $(nodeSection.title).text(RED._("sidebar.context.node")); }
}
if (force) {
if (node) {
if (/^subflow:/.test(node.type)) {
//subflowSection.container.show();
updateEntry(nodeSection,"context/flow/"+node.id,node.id);
}
else {
updateEntry(nodeSection,"context/node/"+node.id,node.id);
}
} else {
// subflowSection.container.hide();
updateEntry(nodeSection)
}
} else {
@@ -171,8 +193,10 @@ RED.sidebar.context = (function() {
nodeSection.timestamp.html("&nbsp;");
}
}
function updateFlow(flow, force) {
currentFlow = flow;
$(flowSection.title).text(RED._("sidebar.context.flow") + ": " + currentFlow.label);
if (force || flowAutoRefresh.prop("checked")) {
if (flow) {
updateEntry(flowSection,"context/flow/"+flow.id,flow.id);
@@ -187,7 +211,6 @@ RED.sidebar.context = (function() {
}
function refreshEntry(section,baseUrl,id) {
var contextStores = RED.settings.context.stores;
var container = section.table;
@@ -287,7 +310,6 @@ RED.sidebar.context = (function() {
}
});
popover.open();
});
RED.popover.tooltip(deleteItem,RED._("sidebar.context.delete"));
var payload = v.msg;
@@ -308,6 +330,7 @@ RED.sidebar.context = (function() {
$(section.timestamp).text(new Date().toLocaleString());
});
}
function updateEntry(section,baseUrl,id) {
var container = section.table;
if (id) {
@@ -318,11 +341,10 @@ RED.sidebar.context = (function() {
}
}
function show() {
RED.sidebar.show("context");
}
return {
init: init
}

View File

@@ -140,7 +140,7 @@ RED.sidebar.info = (function() {
var activeProject = RED.projects.getActiveProject();
if (activeProject) {
propRow = $('<tr class="red-ui-help-info-row"><td>'+ RED._("sidebar.project.name") + '</td><td></td></tr>').appendTo(tableBody);
propRow = $('<tr class="red-ui-help-info-row"><td>Project</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).text(activeProject.name||"");
$('<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>')

View File

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

View File

@@ -802,13 +802,13 @@ RED.utils = (function() {
function getDefaultNodeIcon(def,node) {
var icon_url;
if (node && node.type === "subflow") {
icon_url = "node-red/subflow.svg";
icon_url = "node-red/subflow.png";
} else if (typeof def.icon === "function") {
try {
icon_url = def.icon.call(node);
} catch(err) {
console.log("Definition error: "+def.type+".icon",err);
icon_url = "arrow-in.svg";
icon_url = "arrow-in.png";
}
} else {
icon_url = def.icon;
@@ -838,11 +838,11 @@ RED.utils = (function() {
function getNodeIcon(def,node) {
if (def.category === 'config') {
return RED.settings.apiRootUrl+"icons/node-red/cog.svg"
return RED.settings.apiRootUrl+"icons/node-red/cog.png"
} else if (node && node.type === 'tab') {
return RED.settings.apiRootUrl+"icons/node-red/subflow.svg"
return RED.settings.apiRootUrl+"icons/node-red/subflow.png"
} else if (node && node.type === 'unknown') {
return RED.settings.apiRootUrl+"icons/node-red/alert.svg"
return RED.settings.apiRootUrl+"icons/node-red/alert.png"
} else if (node && node.icon) {
var iconPath = separateIconPath(node.icon);
if (isIconExists(iconPath)) {
@@ -851,11 +851,6 @@ RED.utils = (function() {
} else {
return RED.settings.apiRootUrl+"icons/" + node.icon;
}
} else if (iconPath.module !== "font-awesome" && /.png$/i.test(iconPath.file)) {
iconPath.file = iconPath.file.replace(/.png$/,".svg");
if (isIconExists(iconPath)) {
return RED.settings.apiRootUrl+"icons/" + node.icon.replace(/.png$/,".svg");
}
}
}
@@ -866,32 +861,17 @@ RED.utils = (function() {
} else {
return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file;
}
}
if (/.png$/i.test(iconPath.file)) {
var originalFile = iconPath.file;
iconPath.file = iconPath.file.replace(/.png$/,".svg");
if (isIconExists(iconPath)) {
return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file;
}
iconPath.file = originalFile;
}
// This could be a non-core node trying to use a core icon.
iconPath.module = 'node-red';
if (isIconExists(iconPath)) {
return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file;
}
if (/.png$/i.test(iconPath.file)) {
iconPath.file = iconPath.file.replace(/.png$/,".svg");
} else {
// This could be a non-core node trying to use a core icon.
iconPath.module = 'node-red';
if (isIconExists(iconPath)) {
return RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file;
} else if (def.category === 'subflows') {
return RED.settings.apiRootUrl+"icons/node-red/subflow.png";
} else {
return RED.settings.apiRootUrl+"icons/node-red/arrow-in.png";
}
}
if (def.category === 'subflows') {
return RED.settings.apiRootUrl+"icons/node-red/subflow.svg";
}
return RED.settings.apiRootUrl+"icons/node-red/arrow-in.svg";
}
function getNodeLabel(node,defaultLabel) {
@@ -912,10 +892,6 @@ RED.utils = (function() {
}
var nodeColorCache = {};
function clearNodeColorCache() {
nodeColorCache = {};
}
function getNodeColor(type, def) {
var result = def.color;
var paletteTheme = RED.settings.theme('palette.theme') || [];
@@ -1031,7 +1007,7 @@ RED.utils = (function() {
return;
}
// If the specified name is not defined in font-awesome, show arrow-in icon.
iconUrl = RED.settings.apiRootUrl+"icons/node-red/arrow-in.svg"
iconUrl = RED.settings.apiRootUrl+"icons/node-red/arrow-in.png"
}
var imageIconElement = $('<div/>',{class:"red-ui-palette-icon"}).appendTo(iconContainer);
imageIconElement.css("backgroundImage", "url("+iconUrl+")");
@@ -1048,7 +1024,6 @@ RED.utils = (function() {
getNodeIcon: getNodeIcon,
getNodeLabel: getNodeLabel,
getNodeColor: getNodeColor,
clearNodeColorCache: clearNodeColorCache,
addSpinnerOverlay: addSpinnerOverlay,
decodeObject: decodeObject,
parseContextKey: parseContextKey,

View File

@@ -291,7 +291,6 @@ RED.view = (function() {
}
RED.nodes.eachNode(function(n) {
n.dirty = true;
n.dirtyStatus = true;
});
updateSelection();
updateActiveNodes();
@@ -359,7 +358,7 @@ RED.view = (function() {
var spliceLink = $(ui.helper).data("splice");
if (spliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp/showQuickAddDialog
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
RED.nodes.removeLink(spliceLink);
var link1 = {
source:spliceLink.source,
@@ -407,7 +406,6 @@ RED.view = (function() {
RED.actions.add("core:delete-selection",deleteSelection);
RED.actions.add("core:edit-selected-node",editSelection);
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:zoom-in",zoomIn);
RED.actions.add("core:zoom-out",zoomOut);
@@ -696,8 +694,280 @@ RED.view = (function() {
}
if (mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) {
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();
showQuickAddDialog(d3.mouse(this));
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 = 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)) {
@@ -718,303 +988,6 @@ 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 = 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();
}
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() {
var i;
var node;
@@ -1161,8 +1134,8 @@ RED.view = (function() {
if (moving_set.length === 1) {
node = moving_set[0];
spliceActive = node.n.hasOwnProperty("_def") &&
((node.n.hasOwnProperty("inputs") && node.n.inputs > 0) || (!node.n.hasOwnProperty("inputs") && node.n._def.inputs > 0)) &&
((node.n.hasOwnProperty("outputs") && node.n.outputs > 0) || (!node.n.hasOwnProperty("outputs") && node.n._def.outputs > 0)) &&
node.n._def.inputs > 0 &&
node.n._def.outputs > 0 &&
RED.nodes.filterLinks({ source: node.n }).length === 0 &&
RED.nodes.filterLinks({ target: node.n }).length === 0;
}
@@ -1295,15 +1268,12 @@ RED.view = (function() {
removedLinks.push(drag_lines[i].link)
}
}
if (removedLinks.length > 0) {
historyEvent = {
t:"delete",
links: removedLinks,
dirty:RED.nodes.dirty()
};
RED.history.push(historyEvent);
RED.nodes.dirty(true);
}
historyEvent = {
t:"delete",
links: removedLinks,
dirty:RED.nodes.dirty()
};
RED.history.push(historyEvent);
hideDragLines();
}
if (lasso) {
@@ -1751,7 +1721,7 @@ RED.view = (function() {
],
dirty:RED.nodes.dirty()
}
RED.nodes.dirty(true);
selected_link.source.changed = true;
selected_link.target.changed = true;
selected_link.target.links.splice(sourceIdIndex,1);
@@ -2493,22 +2463,14 @@ RED.view = (function() {
.attr("class","red-ui-flow-node-icon")
.attr("x",0)
.attr("width","30")
.attr("height","30")
.style("display","none");
.attr("height","30");
var img = new Image();
img.src = iconUrl;
img.onload = function() {
var largestEdge = Math.max(img.width,img.height);
var scaleFactor = 1;
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);
icon.attr("width",Math.min(img.width,30));
icon.attr("height",Math.min(img.height,30));
icon.attr("x",15-Math.min(img.width,30)/2);
icon.attr("xlink:href",iconUrl);
icon.style("display",null);
//if ("right" == d._def.align) {
@@ -2570,8 +2532,8 @@ RED.view = (function() {
.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);});
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",28).text(function(d,i){ return i+1});
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 red-ui-flow-port-index").attr("x",20).attr("y",24).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;});
subflowInputs.exit().remove();
@@ -2997,7 +2959,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)});
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();
} 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");
@@ -3196,7 +3158,7 @@ RED.view = (function() {
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);
}
if (d.status.hasOwnProperty('text')) {
if (d.status.text) {
thisNode.selectAll(".red-ui-flow-node-status-label").text(d.status.text);
} else {
thisNode.selectAll(".red-ui-flow-node-status-label").text("");
@@ -3234,10 +3196,6 @@ RED.view = (function() {
redraw();
focusView();
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) {
if (mouse_mode === RED.state.SELECTING_NODE) {

View File

@@ -70,7 +70,7 @@ RED.workspaces = (function() {
RED.view.state(RED.state.EDITING);
var tabflowEditor;
var trayOptions = {
title: RED._("workspace.editFlow",{name:RED.utils.sanitize(workspace.label)}),
title: RED._("workspace.editFlow",{name:workspace.label}),
buttons: [
{
id: "node-dialog-delete",
@@ -157,27 +157,17 @@ RED.workspaces = (function() {
tabflowEditor.resize();
},
open: function(tray) {
var trayFooter = tray.find(".red-ui-tray-footer");
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);
$('<div class="form-row">'+
'<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">'+
'</div>').appendTo(dialogForm);
if (!workspace.hasOwnProperty("disabled")) {
workspace.disabled = false;
}
$('<input id="node-input-disabled" type="checkbox">').prop("checked",workspace.disabled).appendTo(trayFooterLeft).toggleButton({
enabledIcon: "fa-circle-thin",
disabledIcon: "fa-ban",
invertState: true
})
$('<div class="form-row">'+
'<label for="node-input-disabled" data-i18n="editor:workspace.status"></label>'+
'<input type="checkbox" id="node-input-disabled"/>'+
'</div>').appendTo(dialogForm);
var row = $('<div class="form-row node-text-editor-row">'+
'<label for="node-input-info" data-i18n="editor:workspace.info" style="width:300px;"></label>'+
@@ -206,7 +196,16 @@ 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);
dialogForm.on("submit", function(e) { e.preventDefault();});
@@ -440,7 +439,7 @@ RED.workspaces = (function() {
if (!workspace_tabs.contains(id)) {
var sf = RED.nodes.subflow(id);
if (sf) {
addWorkspace({type:"subflow",id:id,icon:"red/images/subflow_tab.svg",label:sf.name, closeable: true});
addWorkspace({type:"subflow",id:id,icon:"red/images/subflow_tab.png",label:sf.name, closeable: true});
} else {
return;
}

View File

@@ -73,8 +73,8 @@ RED.user = (function() {
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"/>'+
(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" class="red-ui-button" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("user.login")+'"></div>').appendTo("#node-dialog-login-fields");
(opts.cancelable?'<a href="#" id="node-dialog-login-cancel" 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");
$("#node-dialog-login-submit").button();
@@ -119,7 +119,7 @@ RED.user = (function() {
var field = data.prompts[i];
var row = $("<div/>",{class:"form-row",style:"text-align: center"}).appendTo("#node-dialog-login-fields");
var loginButton = $('<a href="#" class="red-ui-button"></a>',{style: "padding: 10px"}).appendTo(row).on("click", function() {
var loginButton = $('<a href="#"></a>',{style: "padding: 10px"}).appendTo(row).on("click", function() {
document.location = field.url;
});
if (field.image) {

View File

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

View File

@@ -218,7 +218,7 @@
.red-ui-debug-msg-row {
display: block;
padding: 4px 2px 2px;
padding: 2px 2px 2px;
position: relative;
&.red-ui-debug-msg-row-pinned {
background: $secondary-background-selected;

View File

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

View File

@@ -190,10 +190,6 @@ button.red-ui-tray-resize-button {
border-color: $form-input-border-error-color !important;
}
.input-updated {
border-color: $node-selected-color !important;
}
.form-row {
clear: both;
color: $form-text-color;
@@ -392,26 +388,28 @@ button.red-ui-button-small
}
}
button.red-ui-button.red-ui-editor-node-appearance-button {
position: relative;
height: 35px !important;
text-align: left;
padding: 0 6px 0 3px;
>i {
width: 15px;
vertical-align: middle;
padding-left: 2px;
}
.red-ui-search-result-node {
vertical-align: middle;
float: none;
position: relative;
top: -1px;
#red-ui-editor-node-icon-button {
position: relative;
padding-left: 30px;
width: calc(100% - 150px);
.red-ui-search-result-node {
position: absolute;
top: 2px;
left: 2px;
}
}
#red-ui-editor-node-icon {
margin-left: 10px;
width: calc(100% - 163px);
}
.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 {
box-sizing: border-box;
margin: 3px;
@@ -423,16 +421,6 @@ button.red-ui-button.red-ui-editor-node-appearance-button {
height: 200px;
overflow-y: scroll;
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 {
display: inline-block;
@@ -440,7 +428,6 @@ button.red-ui-button.red-ui-editor-node-appearance-button {
padding: 4px;
cursor: pointer;
border-radius: 4px;
&:hover {
background: $list-item-background-hover;
}
@@ -592,407 +579,3 @@ button.red-ui-button.red-ui-editor-node-appearance-button {
button.red-ui-toggleButton.toggle {
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

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

View File

@@ -36,7 +36,6 @@
font-size: 30px;
line-height: 30px;
text-decoration: none;
white-space: nowrap;
span {
vertical-align: middle;
@@ -193,7 +192,6 @@
color: $header-menu-color;
padding: 3px 40px;
img {
max-width: 100%;
margin-right: 10px;
padding: 4px;
border: 3px solid transparent;
@@ -273,9 +271,3 @@
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 {
// display: inline-block;
display: inline-block;
cursor: move;
background: $secondary-background;
margin: 10px auto;
margin: 5px auto;
height: 25px;
border-radius: 5px;
border: 1px solid $node-border;
@@ -131,16 +131,23 @@
width: 120px;
background-size: contain;
position: relative;
&:not(.red-ui-palette-node-config):first-child {
margin-top: 15px;
&:first-child {
margin-top: 10px;
}
&:not(.red-ui-palette-node-config):last-child {
margin-bottom: 15px;
&:last-child {
margin-bottom: 10px;
}
}
.red-ui-palette-node:hover {
border-color: transparent;
box-shadow: 0 0 0 2px $node-selected-color;
margin: 4px auto;
border-color: $node-selected-color;
border-width: 2px;
&:first-child {
margin-top: 9px;
}
&:last-child {
margin-bottom: 9px;
}
}
.red-ui-palette-port {
position: absolute;

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