bump to v1.0.2. wip
2
.github/ISSUE_TEMPLATE.md
vendored
@ -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:
|
||||
|
2
.github/ISSUE_TEMPLATE/--bug_report.md
vendored
@ -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:
|
||||
|
7
.github/ISSUE_TEMPLATE/-anything-else.md
vendored
@ -7,8 +7,11 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Please use the [Node-RED Forum](https://discourse.nodered.org) or [slack team](https://nodered.org/slack).
|
||||
Please DO NOT raise an issue.
|
||||
|
||||
You could also consider asking a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/node-red) and tag it `node-red`.
|
||||
We DO NOT use the issue tracker for general support or feature requests. Only bug reports should be raised here using the 'Bug report' template.
|
||||
|
||||
For general support, please use the [Node-RED Forum](https://discourse.nodered.org) or [slack team](https://nodered.org/slack). You could also consider asking a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/node-red) and tag it `node-red`.
|
||||
That way the whole Node-RED user community can help, rather than rely on the core development team.
|
||||
|
||||
For feature requests, please use the Node-RED Forum](https://discourse.nodered.org). Many ideas have already been discussed there and you should search that for your request before starting a new discussion.
|
||||
|
@ -2,6 +2,7 @@ sudo: false
|
||||
language: node_js
|
||||
matrix:
|
||||
include:
|
||||
- node_js: "12"
|
||||
- node_js: "10"
|
||||
script:
|
||||
- ./node_modules/.bin/grunt && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage
|
||||
|
258
CHANGELOG.md
@ -1,3 +1,259 @@
|
||||
#### 1.0.2: Maintenance Release
|
||||
|
||||
Runtime
|
||||
- Allow node.status() to be passed number/bool types
|
||||
- Allow node emitted events to have multiple arguments
|
||||
- #2323 Fixed docstrings to have them match the function signature (name of parameters).
|
||||
- #2318 NLS: Unify translations of "boolean"
|
||||
|
||||
Editor
|
||||
- Ensure node status is refreshed whenever node is edited
|
||||
- #2315 #2316 Ensure z property included in full message debug payload
|
||||
- #2321 Fixed editor.json (JA nls)
|
||||
- #2313 Fix element to collapse items in visual JSON editor
|
||||
- #2314 Insert divider in menu by calling RED.menu.addItem('id', null);
|
||||
|
||||
Nodes
|
||||
- Change: Fixup use of node.done
|
||||
- #2322 Template: Fix invalid JSON data in template node docs
|
||||
- #2320 File: Fixed a typo in 10-file.html (JA nls)
|
||||
- #2312 Template: Remove unnecessary comma in help text
|
||||
- #2319 Inject: Interval of inject node should be 596 hours or less.
|
||||
|
||||
#### 1.0.1: Maintenance Release
|
||||
|
||||
Runtime
|
||||
- #2301 Add env vars to enable safe mode and projects
|
||||
- `NODE_RED_ENABLE_SAFE_MODE`
|
||||
- `NODE_RED_ENABLE_PROJECTS`
|
||||
|
||||
Editor
|
||||
- #2308 Fix grid setting
|
||||
- #2306 i18n support in tooltips
|
||||
- Fix error when setting typedInput to boolean true/false
|
||||
- #2299 Fix SVG icons in IE11
|
||||
- #2303 Fix issue where subflow color did not update when not on a flow
|
||||
|
||||
Nodes
|
||||
- #2297 TLS: Allow TLS config node to provide just CA cert
|
||||
- #2307 Inject: Fix width on inject node property
|
||||
- #2305 Switch: Let switch node between rule work both ways round
|
||||
- Range: Add example to range node info and make use of target consistent
|
||||
- Join: node must clone group message before sending
|
||||
|
||||
|
||||
#### 1.0.0: Milestone Release
|
||||
|
||||
Editor
|
||||
- Add click-on-tooltip to close
|
||||
- Fix node draggable handling
|
||||
- Ensure complete node scope property is remapped on import
|
||||
- Update i18n for project feature
|
||||
- Fix menu hiding function for flow editor
|
||||
- Normalise default subflow color references
|
||||
- Hide header text of very small screens to deploy is visible
|
||||
- Fix tab access on touch screens
|
||||
- Update radialMenu to use standard theme colours
|
||||
- Fix undefined reference loading on mobile
|
||||
- Allow word breaking of node name with long word
|
||||
- Enable wrap mode in Markdown editor
|
||||
- Maximize the size of markdown editor
|
||||
|
||||
Nodes
|
||||
- remove legacy error option from file in mode
|
||||
- Change MQTT node default 3.1 compatibility mode to false
|
||||
- Show clear debug shortcut in tooltip
|
||||
- Fix file-in port labels for all 4 options
|
||||
- Add extra comment re Mustache escapes to Template info
|
||||
- Fix typo in complete node
|
||||
- Allow Function node output input to go to 0
|
||||
|
||||
#### 1.0.0-beta.4: Beta Release
|
||||
|
||||
Runtime
|
||||
- Clone the first message passed to node.send in Function node
|
||||
|
||||
Editor
|
||||
- Move flow-status button to footer for consistency
|
||||
- Fix node hover effect to prevent jumping position
|
||||
- Filter quick-add properly when splicing a wire
|
||||
- Mark workspace dirty when deleting link node link Fixes #2274
|
||||
- Add red-ui-button class to strategy login button
|
||||
- Fix padding of subflow locale select Closes #2276
|
||||
- Update info text of complete node & add JP text
|
||||
- Add class red-ui-button to cancel button
|
||||
- Add css class to login submit button (#2275)
|
||||
- Realign subflow output port labels
|
||||
- Move context sidebar auto-refresh option to individual sections
|
||||
- Update Japanese message catalogue
|
||||
- Fix subflow UI for select
|
||||
- remove padding before label text for SUBFLOW UI row
|
||||
- Allow SUBFLOW UI label row without variable name
|
||||
|
||||
Nodes
|
||||
- Remove old rc option from exec node for 1.0
|
||||
- Add python and SQL to template language options
|
||||
- Fix Switch node display of jsonata_exp type
|
||||
- Remove sentiment from core nodes
|
||||
|
||||
#### 1.0.0-beta.3: Beta Release
|
||||
|
||||
Runtime
|
||||
- [FEATURE] Add Node Done API - make message passing async
|
||||
- Ensure the subflow stop promise is waiting for before restarting
|
||||
- Limit the regex for the /nodes/ api end points
|
||||
- Add error event handler to ssh-keygen child_process Fixes #2255
|
||||
- Fix default value handling on context array access Fixes #2252
|
||||
- Remove all ui test dependencies from package.json
|
||||
- Add req back to audit log events and extend to Projects api
|
||||
- Ensure 2nd arg to node.error is an object Fixes #2228
|
||||
- Use a more atomic process for writing context files Fixes #2271
|
||||
|
||||
|
||||
Editor
|
||||
- [FEATURE] Change core node categories
|
||||
- [FEATURE] Subflow Instance property UI (#2236)
|
||||
- [FEATURE] Add visual JSON editor
|
||||
- [FEATURE] Add Action List dialog
|
||||
- [FEATURE] Add new shortcut to clear debug message list - ctrl-alt-l
|
||||
- [FEATURE] Add show-library dialog actions
|
||||
- [FEATURE] Add shift-cursor handling for moving quick-add dialog
|
||||
- [FEATURE] Add enable/disable-flow actions
|
||||
- [FEATURE] Add actions to change deploy type
|
||||
- [FEATURE] Allow config nodes to be disabled, tidy css and add actions
|
||||
- [FEATURE] Add default shortcut (ctrl-d) for deploy
|
||||
- [FEATURE] Initial implementation of redo (un-undo) - ctrl-y
|
||||
- [FEATURE] add support for specifying subflow template color
|
||||
- [FEATURE] Use ctrl-click on wire to splice node in place
|
||||
- [FEATURE] Allow search results to show more than 25 results
|
||||
- [FEATURE] Allow a node to change if it has an input port Closes #2268
|
||||
- Revealing node position needs to account for zoom level Fixes #2172
|
||||
- Fix typedInput option selection Fixes #2174
|
||||
- Fix palette node id handling so search works Fixes #2173
|
||||
- Add popover tooltips to debug sidebar,function and template
|
||||
- Add popovers to context sidebar mini buttons
|
||||
- Ensure node status icon is shown when value set
|
||||
- Revert treeList children function signature change
|
||||
- Restore tray component css for compatibility. Mark as deprecated
|
||||
- fix function name & string compare function
|
||||
- Handle empty list of example flows Fixes #2171
|
||||
- Ensure library list has an item selected when opened
|
||||
- Ensure tooltip popover doesn't replace normal popover
|
||||
- Fix clipboard export download button
|
||||
- Ensure input box has focus on repeated quick add
|
||||
- Fix width calculation of typedInput
|
||||
- Remove some hardcoded css colors
|
||||
- Fix display of node help when clicking in palette Fixes #2194
|
||||
- Ensure node help is loaded in the right language Fixes #2195
|
||||
- Do not allow tab focus on clipboard hidden element
|
||||
- Fix undefined error on typedInput due to valueLabel used before being added
|
||||
- Fix undo of flow disable state change
|
||||
- Fix select-all action in main view
|
||||
- Fix delete-all action on config node sidebar
|
||||
- Update UI tests for new editor css
|
||||
- Add insertItemAt doc to editableList
|
||||
- Ensure focus returns to the right element after dialogs shown
|
||||
- Set autocomplete to disabled in form input elements
|
||||
- Update all node icons to SVG
|
||||
- Handle png/svg fallback for def.icon values. Remove old pngs
|
||||
- Ignore empty examples directories (don't add to import menu)
|
||||
- better handle example file at any depth - #2222
|
||||
- Properly escape node types in palette
|
||||
- Ensure session expiry timeout doesn't exceed limit
|
||||
- Use node/tab map to make filterNodes more efficient
|
||||
- Rearrange contents of subflow template settings tab
|
||||
- Handle undefined node.\_def in edit stack title.
|
||||
- fix converting selection to subflow
|
||||
- Fix inserting new subflow node to existing wire between nodes
|
||||
- Support displaying falsey node status values Fixes #2246
|
||||
- Remove tab menu from node property UI for subflow and config nodes
|
||||
- Mark workspace dirty when shift-click-drag detaches wires Fixes #2260
|
||||
- Fix subflow category change on palette
|
||||
|
||||
|
||||
Nodes
|
||||
- Remove pi gpi, twitter, email and feedparser nodes from core
|
||||
- Fix error handling in Websocket broadcast function Fixes #2182
|
||||
- Handle websocket item being parseable but not an object better
|
||||
- stop join tripping up if last message of buffer is blank.
|
||||
- Add support for env var propety in switch node
|
||||
- Improve handling of file upload in request node
|
||||
- Add "has key" rule to switch node + tests
|
||||
- Optimise generation of switch node edit dialog
|
||||
- Add keep-alive option to HTTP Request - #2261
|
||||
|
||||
#### 1.0.0-beta.2: Beta Release
|
||||
|
||||
Runtime
|
||||
- Fix length calculation when loading library file
|
||||
|
||||
#### 1.0.0-beta.1: Beta Release
|
||||
|
||||
Runtime
|
||||
- Update runtime apis to support multiple libraries
|
||||
- Add Node 12 to travis (allow_failures)
|
||||
- Bump all dependencies Fixes #2152
|
||||
|
||||
Editor
|
||||
- [BREAKING] complete overhaul of editor DOM/CSS structure
|
||||
- [BREAKING] Get rid of Bootstrap
|
||||
- Simplify index.mst to a single div to insert the editor
|
||||
- Append node configs to div rather than body
|
||||
- Only redraw node status when it has changed
|
||||
- Minimise work done to calculate node label widths
|
||||
- Allow script tags with src to reference esm modules
|
||||
- Upgrade to jq 3.4.1 / jq-ui 1.12.1
|
||||
- Allow editor language to be chosen in editor settings
|
||||
- Only NLS status text that starts with a letter Fixes #2128
|
||||
- Fix display of link node list within subflow Fixes #2140
|
||||
- Blur the active element when closing edit dialog via action Fixes #2097
|
||||
- Trigger change evnt on typedInput when type changes and options present Fixes #2160
|
||||
- Move library import/export to single dialog
|
||||
- Move type-library dialogs to new style dialog
|
||||
- Fix node drag and drop animation
|
||||
- let status be simple text if wanted
|
||||
- Add workspace statusBar
|
||||
- Complete refresh of German translations
|
||||
- Fix memory leak in Debug sidebar #2163
|
||||
- Introduce toggleButton and move flow-disabled to use it
|
||||
- Allow RED.settings.get/set to use full property desc
|
||||
- Add auto-refresh toggle to context sidebar
|
||||
- Add build-custom-theme script
|
||||
- Add RED.view.selectNodes api for node selection whilst editing
|
||||
- Add node-select to typedInput
|
||||
|
||||
Nodes
|
||||
- http request node: warn user if msg.requestTimeout == 0
|
||||
- hide delay node reset label on deploy
|
||||
- Fix CSV regex to treat strings starting e as text
|
||||
- Add "don't parse numbers" option to csv node
|
||||
- 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
|
||||
|
||||
- Revert error handling in palette manager
|
||||
@ -658,7 +914,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 `nodeMaxMessageBufferLength` setting for msg sequence nodes
|
||||
- Introduce `nodeMessageBufferMaxLength` 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)
|
||||
|
@ -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
|
||||
|
||||
|
55
Gruntfile.js
@ -145,11 +145,13 @@ module.exports = function(grunt) {
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/common/stack.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/actions.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/diff.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/statusBar.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/view.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/view-navigator.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js",
|
||||
@ -167,6 +169,7 @@ module.exports = function(grunt) {
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/library.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/search.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/js/ui/userSettings.js",
|
||||
@ -181,22 +184,22 @@ module.exports = function(grunt) {
|
||||
vendor: {
|
||||
files: {
|
||||
"packages/node_modules/@node-red/editor-client/public/vendor/vendor.js": [
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/js/bootstrap.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-3.4.1.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-migrate-3.0.1.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/marked/marked.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/d3/d3.v3.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js"
|
||||
],
|
||||
"packages/node_modules/@node-red/editor-client/public/vendor/vendor.css": [
|
||||
// TODO: resolve relative resource paths in
|
||||
// bootstrap/FA/jquery
|
||||
],
|
||||
"packages/node_modules/@node-red/editor-client/public/vendor/jsonata/jsonata.min.js": [
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js",
|
||||
"node_modules/jsonata/jsonata-es5.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js"
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/ace/ace.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-language_tools.js",
|
||||
],
|
||||
// "packages/node_modules/@node-red/editor-client/public/vendor/vendor.css": [
|
||||
// // TODO: resolve relative resource paths in
|
||||
// // bootstrap/FA/jquery
|
||||
// ],
|
||||
"packages/node_modules/@node-red/editor-client/public/vendor/ace/worker-jsonata.js": [
|
||||
"node_modules/jsonata/jsonata-es5.min.js",
|
||||
"packages/node_modules/@node-red/editor-client/src/vendor/jsonata/worker-jsonata.js"
|
||||
@ -222,10 +225,6 @@ module.exports = function(grunt) {
|
||||
files: [{
|
||||
dest: 'packages/node_modules/@node-red/editor-client/public/red/style.min.css',
|
||||
src: 'packages/node_modules/@node-red/editor-client/src/sass/style.scss'
|
||||
},
|
||||
{
|
||||
dest: 'packages/node_modules/@node-red/editor-client/public/vendor/bootstrap/css/bootstrap.min.css',
|
||||
src: 'packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.css'
|
||||
}]
|
||||
}
|
||||
},
|
||||
@ -277,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: [
|
||||
@ -352,9 +351,7 @@ module.exports = function(grunt) {
|
||||
cwd: 'packages/node_modules/@node-red/editor-client/src/vendor',
|
||||
src: [
|
||||
'ace/**',
|
||||
//'bootstrap/css/**',
|
||||
'bootstrap/img/**',
|
||||
'jquery/css/**',
|
||||
'jquery/css/base/**',
|
||||
'font-awesome/**'
|
||||
],
|
||||
expand: true,
|
||||
@ -499,7 +496,9 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-chmod');
|
||||
grunt.loadNpmTasks('grunt-jsonlint');
|
||||
grunt.loadNpmTasks('grunt-mocha-istanbul');
|
||||
grunt.loadNpmTasks('grunt-webdriver');
|
||||
if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
|
||||
grunt.loadNpmTasks('grunt-webdriver');
|
||||
}
|
||||
grunt.loadNpmTasks('grunt-jsdoc');
|
||||
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
|
||||
grunt.loadNpmTasks('grunt-npm-command');
|
||||
@ -558,8 +557,8 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
grunt.registerTask('verifyUiTestDependencies', function() {
|
||||
if (!fs.existsSync(path.join("node_modules", "chromedriver"))) {
|
||||
grunt.fail.fatal('You need to run "npm install chromedriver@2" before running UI test.');
|
||||
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"');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -582,9 +581,15 @@ module.exports = function(grunt) {
|
||||
'Runs code style check on editor code',
|
||||
['jshint:editor']);
|
||||
|
||||
grunt.registerTask('test-ui',
|
||||
'Builds editor content then runs unit tests on editor ui',
|
||||
['verifyUiTestDependencies','build','jshint:editor','webdriver:all']);
|
||||
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-nodes',
|
||||
'Runs unit tests on core nodes',
|
||||
|
@ -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)
|
||||
|
||||
A visual tool for wiring the Internet of Things.
|
||||
Low-code programming for event-driven applications.
|
||||
|
||||
![Node-RED: A visual tool for wiring the Internet of Things](http://nodered.org/images/node-red-screenshot.png)
|
||||
![Node-RED: Low-code programming for event-driven applications](http://nodered.org/images/node-red-screenshot.png)
|
||||
|
||||
## Quick Start
|
||||
|
||||
@ -56,7 +56,7 @@ This project adheres to the [Contributor Covenant 1.4](http://contributor-covena
|
||||
|
||||
## Authors
|
||||
|
||||
Node-RED is a project of the [JS Foundation](http://js.foundation).
|
||||
Node-RED is a project of the [OpenJS Foundation](https://openjsf.org).
|
||||
|
||||
It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-technology/).
|
||||
|
||||
@ -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, http://js.foundation under [the Apache 2.0 license](LICENSE).
|
||||
Copyright JS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).
|
||||
|
13
SECURITY.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.0.0 | :white_check_mark: |
|
||||
| 0.20.x | :white_check_mark: |
|
||||
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report any potential security issues to `team@nodered.org`. This will notify the core project team who will respond accordingly.
|
67
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "0.20.5",
|
||||
"description": "A visual tool for wiring the Internet of Things",
|
||||
"version": "1.0.2",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@ -24,80 +24,77 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ajv": "6.10.0",
|
||||
"ajv": "6.10.2",
|
||||
"basic-auth": "2.0.1",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.19.0",
|
||||
"cheerio": "0.22.0",
|
||||
"clone": "2.1.2",
|
||||
"content-type": "1.0.4",
|
||||
"cookie": "0.3.1",
|
||||
"cookie": "0.4.0",
|
||||
"cookie-parser": "1.4.4",
|
||||
"cors": "2.8.5",
|
||||
"cron": "1.7.1",
|
||||
"denque": "1.4.1",
|
||||
"express": "4.16.4",
|
||||
"express-session": "1.16.1",
|
||||
"fs-extra": "7.0.1",
|
||||
"express": "4.17.1",
|
||||
"express-session": "1.16.2",
|
||||
"fs-extra": "8.1.0",
|
||||
"fs.notify": "0.0.4",
|
||||
"hash-sum": "1.0.2",
|
||||
"https-proxy-agent": "2.2.1",
|
||||
"i18next": "15.1.0",
|
||||
"iconv-lite": "0.4.24",
|
||||
"hash-sum": "2.0.0",
|
||||
"https-proxy-agent": "2.2.2",
|
||||
"i18next": "15.1.2",
|
||||
"iconv-lite": "0.5.0",
|
||||
"is-utf8": "0.2.1",
|
||||
"js-yaml": "3.13.1",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonata": "1.6.4",
|
||||
"jsonata": "1.6.5",
|
||||
"media-typer": "1.1.0",
|
||||
"memorystore": "1.6.1",
|
||||
"mime": "2.4.2",
|
||||
"mime": "2.4.4",
|
||||
"mqtt": "2.18.8",
|
||||
"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",
|
||||
"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",
|
||||
"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.0",
|
||||
"raw-body": "2.4.1",
|
||||
"request": "2.88.0",
|
||||
"semver": "6.0.0",
|
||||
"uglify-js": "3.5.9",
|
||||
"semver": "6.3.0",
|
||||
"uglify-js": "3.6.0",
|
||||
"when": "3.7.8",
|
||||
"ws": "6.2.1",
|
||||
"xml2js": "0.4.19"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bcrypt": "3.0.5"
|
||||
"bcrypt": "3.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~1.0.3",
|
||||
"grunt": "~1.0.4",
|
||||
"grunt-chmod": "~1.1.1",
|
||||
"grunt-cli": "~1.3.2",
|
||||
"grunt-concurrent": "~2.3.1",
|
||||
"grunt-contrib-clean": "~1.1.0",
|
||||
"grunt-contrib-compress": "~1.4.0",
|
||||
"grunt-contrib-clean": "~2.0.0",
|
||||
"grunt-contrib-compress": "~1.5.0",
|
||||
"grunt-contrib-concat": "~1.0.1",
|
||||
"grunt-contrib-copy": "~1.0.0",
|
||||
"grunt-contrib-jshint": "~1.1.0",
|
||||
"grunt-contrib-uglify": "~3.4.0",
|
||||
"grunt-contrib-jshint": "~2.1.0",
|
||||
"grunt-contrib-uglify": "~4.0.1",
|
||||
"grunt-contrib-watch": "~1.1.0",
|
||||
"grunt-jsdoc": "^2.2.1",
|
||||
"grunt-jsdoc-to-markdown": "^4.0.0",
|
||||
"grunt-jsonlint": "~1.1.0",
|
||||
"grunt-jsonlint": "~2.0.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",
|
||||
@ -107,11 +104,7 @@
|
||||
"sinon": "1.17.7",
|
||||
"stoppable": "^1.1.0",
|
||||
"supertest": "3.4.2",
|
||||
"wdio-chromedriver-service": "^0.1.5",
|
||||
"wdio-mocha-framework": "^0.6.4",
|
||||
"wdio-spec-reporter": "^0.1.5",
|
||||
"webdriverio": "^4.14.1",
|
||||
"node-red-node-test-helper": "^0.2.2",
|
||||
"node-red-node-test-helper": "^0.2.3",
|
||||
"jsdoc-nr-template": "node-red/jsdoc-nr-template"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -30,7 +30,8 @@ module.exports = {
|
||||
scope: req.params.scope,
|
||||
id: req.params.id,
|
||||
key: req.params[0],
|
||||
store: req.query['store']
|
||||
store: req.query['store'],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.context.getValue(opts).then(function(result) {
|
||||
res.json(result);
|
||||
@ -45,7 +46,8 @@ module.exports = {
|
||||
scope: req.params.scope,
|
||||
id: req.params.id,
|
||||
key: req.params[0],
|
||||
store: req.query['store']
|
||||
store: req.query['store'],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.context.delete(opts).then(function(result) {
|
||||
res.status(204).end();
|
||||
|
@ -24,7 +24,8 @@ module.exports = {
|
||||
get: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.getFlow(opts).then(function(result) {
|
||||
return res.json(result);
|
||||
@ -35,7 +36,8 @@ module.exports = {
|
||||
post: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
flow: req.body
|
||||
flow: req.body,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.addFlow(opts).then(function(id) {
|
||||
return res.json({id:id});
|
||||
@ -47,7 +49,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
flow: req.body
|
||||
flow: req.body,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.updateFlow(opts).then(function(id) {
|
||||
return res.json({id:id});
|
||||
@ -58,7 +61,8 @@ module.exports = {
|
||||
delete: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.deleteFlow(opts).then(function() {
|
||||
res.status(204).end();
|
||||
|
@ -27,7 +27,8 @@ module.exports = {
|
||||
return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"});
|
||||
}
|
||||
var opts = {
|
||||
user: req.user
|
||||
user: req.user,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.getFlows(opts).then(function(result) {
|
||||
if (version === "v1") {
|
||||
@ -46,7 +47,8 @@ module.exports = {
|
||||
}
|
||||
var opts = {
|
||||
user: req.user,
|
||||
deploymentType: req.get("Node-RED-Deployment-Type")||"full"
|
||||
deploymentType: req.get("Node-RED-Deployment-Type")||"full",
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
|
||||
if (opts.deploymentType !== 'reload') {
|
||||
|
@ -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);
|
||||
|
@ -24,7 +24,8 @@ module.exports = {
|
||||
},
|
||||
getAll: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user
|
||||
user: req.user,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
if (req.get("accept") == "application/json") {
|
||||
runtimeAPI.nodes.getNodeList(opts).then(function(list) {
|
||||
@ -42,7 +43,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
module: req.body.module,
|
||||
version: req.body.version
|
||||
version: req.body.version,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.addModule(opts).then(function(info) {
|
||||
res.json(info);
|
||||
@ -54,7 +56,8 @@ module.exports = {
|
||||
delete: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
module: req.params[0]
|
||||
module: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.removeModule(opts).then(function() {
|
||||
res.status(204).end();
|
||||
@ -66,7 +69,8 @@ module.exports = {
|
||||
getSet: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params[0] + "/" + req.params[2]
|
||||
id: req.params[0] + "/" + req.params[2],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
if (req.get("accept") === "application/json") {
|
||||
runtimeAPI.nodes.getNodeInfo(opts).then(function(result) {
|
||||
@ -87,7 +91,8 @@ module.exports = {
|
||||
getModule: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
module: req.params[0]
|
||||
module: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.getModuleInfo(opts).then(function(result) {
|
||||
res.send(result);
|
||||
@ -106,7 +111,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params[0] + "/" + req.params[2],
|
||||
enabled: body.enabled
|
||||
enabled: body.enabled,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.setNodeSetState(opts).then(function(result) {
|
||||
res.send(result);
|
||||
@ -125,7 +131,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
module: req.params[0],
|
||||
enabled: body.enabled
|
||||
enabled: body.enabled,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.setModuleState(opts).then(function(result) {
|
||||
res.send(result);
|
||||
@ -139,7 +146,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
module: req.params[0],
|
||||
lang: req.query.lng
|
||||
lang: req.query.lng,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) {
|
||||
res.json(result);
|
||||
@ -152,7 +160,8 @@ module.exports = {
|
||||
getModuleCatalogs: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
lang: req.query.lng
|
||||
lang: req.query.lng,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) {
|
||||
res.json(result);
|
||||
@ -164,7 +173,8 @@ module.exports = {
|
||||
|
||||
getIcons: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user
|
||||
user: req.user,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.nodes.getIconList(opts).then(function(list) {
|
||||
res.json(list);
|
||||
|
@ -56,7 +56,7 @@ function expireSessions() {
|
||||
}
|
||||
if (nextExpiry < Number.MAX_SAFE_INTEGER) {
|
||||
// Allow 5 seconds grace
|
||||
expiryTimeout = setTimeout(expireSessions,(nextExpiry - Date.now()) + 5000)
|
||||
expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(nextExpiry - Date.now()) + 5000))
|
||||
}
|
||||
if (modified) {
|
||||
return storage.saveSessions(sessions);
|
||||
@ -129,7 +129,7 @@ module.exports = {
|
||||
sessions[accessToken] = session;
|
||||
|
||||
if (!expiryTimeout) {
|
||||
expiryTimeout = setTimeout(expireSessions,(accessTokenExpiresAt - Date.now()) + 5000)
|
||||
expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(accessTokenExpiresAt - Date.now()) + 5000))
|
||||
}
|
||||
|
||||
return storage.saveSessions(sessions).then(function() {
|
||||
|
@ -25,8 +25,8 @@ var auth = require("../auth");
|
||||
var nodes = require("../admin/nodes"); // TODO: move /icons into here
|
||||
var needsPermission;
|
||||
var runtimeAPI;
|
||||
var log = require("@node-red/util").log; // TODO: separate module
|
||||
var i18n = require("@node-red/util").i18n; // TODO: separate module
|
||||
var log = require("@node-red/util").log;
|
||||
var i18n = require("@node-red/util").i18n;
|
||||
|
||||
var apiUtil = require("../util");
|
||||
|
||||
@ -93,9 +93,8 @@ module.exports = {
|
||||
// Library
|
||||
var library = require("./library");
|
||||
library.init(runtimeAPI);
|
||||
editorApp.get("/library/flows",needsPermission("library.read"),library.getAll,apiUtil.errorHandler);
|
||||
editorApp.get(/library\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
|
||||
editorApp.post(/library\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
|
||||
editorApp.get(/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
|
||||
editorApp.post(/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
|
||||
|
||||
|
||||
// Credentials
|
||||
|
@ -25,23 +25,12 @@ module.exports = {
|
||||
init: function(_runtimeAPI) {
|
||||
runtimeAPI = _runtimeAPI;
|
||||
},
|
||||
|
||||
getAll: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
type: 'flows'
|
||||
}
|
||||
runtimeAPI.library.getEntries(opts).then(function(result) {
|
||||
res.json(result);
|
||||
}).catch(function(err) {
|
||||
apiUtils.rejectHandler(req,res,err);
|
||||
});
|
||||
},
|
||||
getEntry: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
type: req.params[0],
|
||||
path: req.params[1]||""
|
||||
library: req.params[0],
|
||||
type: req.params[1],
|
||||
path: req.params[2]||""
|
||||
}
|
||||
runtimeAPI.library.getEntry(opts).then(function(result) {
|
||||
if (typeof result === "string") {
|
||||
@ -62,8 +51,9 @@ module.exports = {
|
||||
saveEntry: function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
type: req.params[0],
|
||||
path: req.params[1]||""
|
||||
library: req.params[0],
|
||||
type: req.params[1],
|
||||
path: req.params[2]||""
|
||||
}
|
||||
// TODO: horrible inconsistencies between flows and all other types
|
||||
if (opts.type === "flows") {
|
||||
|
@ -22,7 +22,8 @@ var needsPermission = require("../auth").needsPermission;
|
||||
|
||||
function listProjects(req,res) {
|
||||
var opts = {
|
||||
user: req.user
|
||||
user: req.user,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.listProjects(opts).then(function(result) {
|
||||
res.json(result);
|
||||
@ -33,7 +34,8 @@ function listProjects(req,res) {
|
||||
function getProject(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getProject(opts).then(function(data) {
|
||||
if (data) {
|
||||
@ -49,7 +51,8 @@ function getProjectStatus(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: req.query.remote
|
||||
remote: req.query.remote,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getStatus(opts).then(function(data){
|
||||
if (data) {
|
||||
@ -64,7 +67,8 @@ function getProjectStatus(req,res) {
|
||||
function getProjectRemotes(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getRemotes(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -98,7 +102,8 @@ module.exports = {
|
||||
app.post("/", needsPermission("projects.write"), function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
project: req.body
|
||||
project: req.body,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.createProject(opts).then(function(result) {
|
||||
res.json(result);
|
||||
@ -112,7 +117,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
project: req.body
|
||||
project: req.body,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
|
||||
if (req.body.active) {
|
||||
@ -150,7 +156,8 @@ module.exports = {
|
||||
app.delete("/:id", needsPermission("projects.write"), function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.deleteProject(opts).then(function() {
|
||||
res.status(204).end();
|
||||
@ -168,7 +175,8 @@ module.exports = {
|
||||
app.get("/:id/files", needsPermission("projects.read"), function(req,res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getFiles(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -185,7 +193,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0],
|
||||
tree: req.params.treeish
|
||||
tree: req.params.treeish,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getFile(opts).then(function(data) {
|
||||
res.json({content:data});
|
||||
@ -199,7 +208,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0]
|
||||
path: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
|
||||
runtimeAPI.projects.revertFile(opts).then(function() {
|
||||
@ -214,7 +224,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0]
|
||||
path: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.stageFile(opts).then(function() {
|
||||
getProjectStatus(req,res);
|
||||
@ -228,7 +239,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.body.files
|
||||
path: req.body.files,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.stageFile(opts).then(function() {
|
||||
getProjectStatus(req,res);
|
||||
@ -242,7 +254,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
message: req.body.message
|
||||
message: req.body.message,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.commit(opts).then(function() {
|
||||
getProjectStatus(req,res);
|
||||
@ -256,7 +269,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0]
|
||||
path: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.unstageFile(opts).then(function() {
|
||||
getProjectStatus(req,res);
|
||||
@ -269,7 +283,8 @@ module.exports = {
|
||||
app.delete("/:id/stage", needsPermission("projects.write"), function(req, res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.unstageFile(opts).then(function() {
|
||||
getProjectStatus(req,res);
|
||||
@ -284,7 +299,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0],
|
||||
type: req.params.type
|
||||
type: req.params.type,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getFileDiff(opts).then(function(data) {
|
||||
res.json({
|
||||
@ -301,7 +317,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
limit: req.query.limit || 20,
|
||||
before: req.query.before
|
||||
before: req.query.before,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getCommits(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -315,7 +332,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
sha: req.params.sha
|
||||
sha: req.params.sha,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getCommit(opts).then(function(data) {
|
||||
res.json({commit:data});
|
||||
@ -330,7 +348,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: req.params[0],
|
||||
track: req.query.u
|
||||
track: req.query.u,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.push(opts).then(function(data) {
|
||||
res.status(204).end();
|
||||
@ -346,7 +365,8 @@ module.exports = {
|
||||
id: req.params.id,
|
||||
remote: req.params[0],
|
||||
track: req.query.setUpstream,
|
||||
allowUnrelatedHistories: req.query.allowUnrelatedHistories
|
||||
allowUnrelatedHistories: req.query.allowUnrelatedHistories,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.pull(opts).then(function(data) {
|
||||
res.status(204).end();
|
||||
@ -359,7 +379,8 @@ module.exports = {
|
||||
app.delete("/:id/merge", needsPermission("projects.write"), function(req, res) {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id
|
||||
id: req.params.id,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.abortMerge(opts).then(function() {
|
||||
res.status(204).end();
|
||||
@ -374,7 +395,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
path: req.params[0],
|
||||
resolution: req.body.resolutions
|
||||
resolution: req.body.resolutions,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.resolveMerge(opts).then(function() {
|
||||
res.status(204).end();
|
||||
@ -388,7 +410,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: false
|
||||
remote: false,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getBranches(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -403,7 +426,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
branch: req.params.branchName,
|
||||
force: !!req.query.force
|
||||
force: !!req.query.force,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.deleteBranch(opts).then(function(data) {
|
||||
res.status(204).end();
|
||||
@ -417,7 +441,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: true
|
||||
remote: true,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getBranches(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -431,7 +456,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
branch: req.params[0]
|
||||
branch: req.params[0],
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.getBranchStatus(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -446,7 +472,8 @@ module.exports = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
branch: req.body.name,
|
||||
create: req.body.create
|
||||
create: req.body.create,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.setBranch(opts).then(function(data) {
|
||||
res.json(data);
|
||||
@ -463,7 +490,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: req.body
|
||||
remote: req.body,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
if (/^https?:\/\/[^/]+@/i.test(req.body.url)) {
|
||||
res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"});
|
||||
@ -481,7 +509,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: req.params.remoteName
|
||||
remote: req.params.remoteName,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.removeRemote(opts).then(function(data) {
|
||||
getProjectRemotes(req,res);
|
||||
@ -497,7 +526,8 @@ module.exports = {
|
||||
var opts = {
|
||||
user: req.user,
|
||||
id: req.params.id,
|
||||
remote: remote
|
||||
remote: remote,
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.projects.updateRemote(opts).then(function() {
|
||||
res.status(204).end();
|
||||
|
@ -19,6 +19,8 @@ var sshkeys = require("./sshkeys");
|
||||
var theme = require("./theme");
|
||||
var clone = require("clone");
|
||||
|
||||
var i18n = require("@node-red/util").i18n
|
||||
|
||||
function extend(target, source) {
|
||||
var keys = Object.keys(source);
|
||||
var i = keys.length;
|
||||
@ -53,12 +55,14 @@ module.exports = {
|
||||
user: req.user
|
||||
}
|
||||
runtimeAPI.settings.getRuntimeSettings(opts).then(function(result) {
|
||||
result.editorTheme = result.editorTheme||{};
|
||||
var themeSettings = theme.settings();
|
||||
if (themeSettings) {
|
||||
// result.editorTheme may already exist with the palette
|
||||
// disabled. Need to merge that into the receive settings
|
||||
result.editorTheme = extend(clone(themeSettings),result.editorTheme||{});
|
||||
result.editorTheme = extend(clone(themeSettings),result.editorTheme);
|
||||
}
|
||||
result.editorTheme.languages = i18n.availableLanguages("editor");
|
||||
res.json(result);
|
||||
});
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ var defaultContext = {
|
||||
},
|
||||
header: {
|
||||
title: "Node-RED",
|
||||
image: "red/images/node-red.png"
|
||||
image: "red/images/node-red.svg"
|
||||
},
|
||||
asset: {
|
||||
red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js",
|
||||
@ -169,6 +169,9 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
}
|
||||
themeApp.get("/", function(req,res) {
|
||||
res.json(themeContext);
|
||||
})
|
||||
|
||||
if (theme.hasOwnProperty("menu")) {
|
||||
themeSettings.menu = theme.menu;
|
||||
|
@ -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.png");
|
||||
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.svg");
|
||||
var editorTemplatePath = path.join(editorClientDir,"templates","index.mst");
|
||||
var editorTemplate;
|
||||
|
||||
|
@ -47,5 +47,12 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-api",
|
||||
"version": "0.20.5",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@ -16,17 +16,17 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "0.20.5",
|
||||
"@node-red/editor-client": "0.20.5",
|
||||
"@node-red/util": "1.0.2",
|
||||
"@node-red/editor-client": "1.0.2",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.19.0",
|
||||
"clone": "2.1.2",
|
||||
"cors": "2.8.5",
|
||||
"express-session": "1.16.1",
|
||||
"express": "4.16.4",
|
||||
"express-session": "1.16.2",
|
||||
"express": "4.17.1",
|
||||
"memorystore": "1.6.1",
|
||||
"mime": "2.4.2",
|
||||
"mustache": "3.0.1",
|
||||
"mime": "2.4.4",
|
||||
"mustache": "3.0.2",
|
||||
"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.5"
|
||||
"bcrypt": "3.0.6"
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@
|
||||
"status" : "Status",
|
||||
"enabled" : "Aktiviert",
|
||||
"disabled" : "Inaktiviert",
|
||||
"info" : "Beschreibung",
|
||||
"tip" : "Beschreibung akzeptiert Markdown und wird auf der Registerkarte Info angezeigt."
|
||||
"info" : "Beschreibung"
|
||||
},
|
||||
"menu" : {
|
||||
"label" : {
|
||||
@ -48,16 +47,13 @@
|
||||
},
|
||||
"settings" : "Einstellungen",
|
||||
"userSettings" : "Benutzereinstellungen",
|
||||
"nodes" : "Knoten",
|
||||
"displayStatus" : "Knotenstatus anzeigen",
|
||||
"displayConfig" : "Konfigurationsknoten",
|
||||
"nodes" : "Nodes",
|
||||
"displayStatus" : "Nodestatus anzeigen",
|
||||
"displayConfig" : "Konfigurations-Node",
|
||||
"import" : "Import",
|
||||
"export" : "Exportieren",
|
||||
"search" : "Flows durchsuchen",
|
||||
"searchInput" : "durchsuchen Sie Ihre Flows",
|
||||
"clipboard" : "Zwischenablage",
|
||||
"library" : "Bibliothek",
|
||||
"examples" : "Beispiele",
|
||||
"subflows" : "Subflow",
|
||||
"createSubflow" : "Subflow erstellen",
|
||||
"selectionToSubflow" : "Auswahl für Subflow",
|
||||
@ -87,17 +83,17 @@
|
||||
"notAuthorized" : "Keine Berechtigung",
|
||||
"errors" : {
|
||||
"settings" : "Sie müssen angemeldet sein, um auf die Einstellungen zuzugreifen.",
|
||||
"deploy" : "Sie müssen angemeldet sein, um Änderungen implementieren zu können.",
|
||||
"deploy" : "Sie müssen angemeldet sein, um Änderungen anwenden zu können.",
|
||||
"notAuthorized" : "Sie müssen angemeldet sein, um diese Aktion ausführen zu können."
|
||||
}
|
||||
},
|
||||
"notification" : {
|
||||
"warning" : "<strong> Warnung </strong>: __message__",
|
||||
"warnings" : {
|
||||
"undeployedChanges" : "Knoten hat nicht implementierte Änderungen",
|
||||
"nodeActionDisabled" : "In Subflow inaktivierte Knotenaktionen",
|
||||
"missing-types" : "<p> Die Flows wurden aufgrund fehlender Knotentypen gestoppt. </p>",
|
||||
"restartRequired" : "Knoten-RED muss erneut gestartet werden, damit aufgerüstete Module aktiviert werden können",
|
||||
"undeployedChanges" : "Node hat nicht implementierte Änderungen",
|
||||
"nodeActionDisabled" : "In Subflow inaktivierte Nodeaktionen",
|
||||
"missing-types" : "<p> Die Flows wurden aufgrund fehlender Nodetypen gestoppt. </p>",
|
||||
"restartRequired" : "Node-RED muss erneut gestartet werden, damit aufgerüstete Module aktiviert werden können",
|
||||
"credentials_load_failed" : "<p> Die Flows wurden gestoppt, da die Berechtigungsnachweise nicht entschlüsselt werden konnten. </p> <p> Die Datei mit dem Datenflowberechtigungsnachweis ist verschlüsselt, aber der Verschlüsselungsschlüssel des Projekts fehlt oder ist ungültig. </p>",
|
||||
"credentials_load_failed_reset" : "<p> Die Berechtigungsnachweise konnten nicht entschlüsselt werden </p> <p> Die Datei mit dem Flow-Berechtigungsnachweis ist verschlüsselt, aber der Chiffrierschlüssel des Projekts fehlt oder ist ungültig. </p> <p> Die Datei des Flow-Berechtigungsnachweises wird bei der nächsten Implementierung zurückgesetzt. Alle vorhandenen Datenflowberechtigungsnachweise werden gelöscht. </p>",
|
||||
"missing_flow_file" : "<p> Die Projektflowdatei wurde nicht gefunden. </p> <p> Das Projekt ist nicht mit einer Flow-Datei konfiguriert. </p>",
|
||||
@ -136,19 +132,19 @@
|
||||
}
|
||||
},
|
||||
"clipboard" : {
|
||||
"nodes" : "Knoten",
|
||||
"selectNodes" : "Wählen Sie den Text oben aus, und kopieren Sie die Datei in die Zwischenablage.",
|
||||
"pasteNodes" : "Knoten hier einfügen",
|
||||
"importNodes" : "Knoten importieren",
|
||||
"exportNodes" : "Knoten in Zwischenablage exportieren",
|
||||
"clipboard" : "Zwischenablage",
|
||||
"nodes" : "Nodes",
|
||||
"pasteNodes" : "Nodes hier einfügen",
|
||||
"importNodes" : "Nodes importieren",
|
||||
"exportNodes" : "Nodes in Zwischenablage exportieren",
|
||||
"importUnrecognised" : "Importierter Typ nicht erkannt:",
|
||||
"importUnrecognised_plural" : "Importierte Typen nicht erkannt:",
|
||||
"nodesExported" : "Knoten, die in die Zwischenablage exportiert wurden",
|
||||
"nodeCopied" : "__count__ Knoten kopiert",
|
||||
"nodeCopied_plural" : "__count__ Knoten kopiert",
|
||||
"nodesExported" : "Nodes, die in die Zwischenablage exportiert wurden",
|
||||
"nodeCopied" : "__count__ Node kopiert",
|
||||
"nodeCopied_plural" : "__count__ Nodes kopiert",
|
||||
"invalidFlow" : "Ungültiger Nachrichtenflow: __message__",
|
||||
"export" : {
|
||||
"selected" : "Ausgewählte Knoten",
|
||||
"selected" : "Ausgewählte Nodes",
|
||||
"current" : "Aktueller Flow",
|
||||
"all" : "alle Flows",
|
||||
"compact" : "kompakt",
|
||||
@ -164,16 +160,16 @@
|
||||
"copyMessageValue_truncated" : "Abgeschnittene Wert kopiert"
|
||||
},
|
||||
"deploy" : {
|
||||
"deploy" : "Implementieren",
|
||||
"deploy" : "deploy",
|
||||
"full" : "Voll",
|
||||
"fullDesc" : "Implementiert alles im Arbeitsbereich",
|
||||
"modifiedFlows" : "Geänderte Flows",
|
||||
"modifiedFlowsDesc" : "Implementiert nur Flows, die geänderte Knoten enthalten.",
|
||||
"modifiedNodes" : "Geänderte Knoten",
|
||||
"modifiedNodesDesc" : "Implementiert nur Knoten, die sich geändert haben.",
|
||||
"modifiedFlowsDesc" : "Implementiert nur Flows, die geänderte Nodes enthalten.",
|
||||
"modifiedNodes" : "Geänderte Nodes",
|
||||
"modifiedNodesDesc" : "Implementiert nur Nodes, die sich geändert haben.",
|
||||
"successfulDeploy" : "Erfolgreich implementiert",
|
||||
"deployFailed" : "Implementieren fehlgeschlagen: __message__",
|
||||
"unusedConfigNodes" : "Sie haben einige nicht verwendete Konfigurationsknoten.",
|
||||
"deployFailed" : "Deploy fehlgeschlagen: __message__",
|
||||
"unusedConfigNodes" : "Sie haben einige nicht verwendete Konfigurations-Nodes.",
|
||||
"unusedConfigNodesLink" : "Klicken Sie hier, um sie zu sehen",
|
||||
"errors" : {
|
||||
"noResponse" : "Keine Antwort vom Server"
|
||||
@ -181,16 +177,16 @@
|
||||
"confirm" : {
|
||||
"button" : {
|
||||
"ignore" : "Ignorieren",
|
||||
"confirm" : "Implementieren bestätigen",
|
||||
"confirm" : "Deploy bestätigen",
|
||||
"review" : "Änderungen prüfen",
|
||||
"cancel" : "Abbrechen",
|
||||
"merge" : "Zusammenführen",
|
||||
"overwrite" : "Ignorieren & implementieren"
|
||||
"overwrite" : "Ignorieren & deployen"
|
||||
},
|
||||
"undeployedChanges" : "Sie haben nicht implementierte Änderungen.\n\nWenn Sie diese Seite verlassen, gehen diese Änderungen verloren.",
|
||||
"improperlyConfigured" : "Der Arbeitsbereich enthält einige Knoten, die nicht ordnungsgemäß konfiguriert sind:",
|
||||
"unknown" : "Der Arbeitsbereich enthält einige unbekannte Knotentypen:",
|
||||
"confirm" : "Sind Sie sicher, dass Sie implementieren möchten?",
|
||||
"improperlyConfigured" : "Der Arbeitsbereich enthält einige Nodes, die nicht ordnungsgemäß konfiguriert sind:",
|
||||
"unknown" : "Der Arbeitsbereich enthält einige unbekannte Node-Typen:",
|
||||
"confirm" : "Sind Sie sicher, dass Sie deployen möchten?",
|
||||
"doNotWarn" : "warnen Sie nicht noch einmal.",
|
||||
"conflict" : "Auf dem Server wird eine aktuellere Gruppe von Datenflüssen ausgeführt.",
|
||||
"backgroundUpdate" : "Die Datenflüsse auf dem Server wurden aktualisiert.",
|
||||
@ -203,7 +199,7 @@
|
||||
"diff" : {
|
||||
"unresolvedCount" : "__count__ unaufgelöster Konflikt",
|
||||
"unresolvedCount_plural" : "__count__ unaufgelöste Konflikte",
|
||||
"globalNodes" : "Globale Knoten",
|
||||
"globalNodes" : "Globale Nodes",
|
||||
"flowProperties" : "Flow-Eigenschaften",
|
||||
"type" : {
|
||||
"added" : "hinzugefügt",
|
||||
@ -215,8 +211,8 @@
|
||||
"movedTo" : "verschoben zu __id__",
|
||||
"movedFrom" : "verschoben von __id__"
|
||||
},
|
||||
"nodeCount" : "__count__, Knoten",
|
||||
"nodeCount_plural" : "__count__-Knoten",
|
||||
"nodeCount" : "__count__, Node",
|
||||
"nodeCount_plural" : "__count__-Nodes",
|
||||
"local" : "Lokale Änderungen",
|
||||
"remote" : "Ferne Änderungen",
|
||||
"reviewChanges" : "Änderungen prüfen",
|
||||
@ -240,9 +236,8 @@
|
||||
"deleteSubflow" : "Subflow löschen",
|
||||
"info" : "Beschreibung",
|
||||
"category" : "Kategorie",
|
||||
"format" : "Markdown-Format",
|
||||
"errors" : {
|
||||
"noNodesSelected" : "<strong> Subflow kann nicht erstellt werden </strong>: Es wurden keine Knoten ausgewählt.",
|
||||
"noNodesSelected" : "<strong> Subflow kann nicht erstellt werden </strong>: Es wurden keine Nodes ausgewählt.",
|
||||
"multipleInputsToSelection" : "<strong> Subflow kann nicht erstellt werden </strong>: Mehrere Eingaben zur Auswahl"
|
||||
}
|
||||
},
|
||||
@ -252,13 +247,13 @@
|
||||
"configUpdate" : "Aktualisieren",
|
||||
"configDelete" : "Löschen",
|
||||
"nodesUse" : "__count__node verwendet diese Konfiguration",
|
||||
"nodesUse_plural" : "__count__ -Knoten verwenden diese Konfiguration",
|
||||
"addNewConfig" : "Neuen __type__config-Knoten hinzufügen",
|
||||
"editNode" : "__type__ Knoten bearbeiten",
|
||||
"editConfig" : "__type__config-Knoten bearbeiten",
|
||||
"nodesUse_plural" : "__count__ -Nodes verwenden diese Konfiguration",
|
||||
"addNewConfig" : "Neuen __type__config-Node hinzufügen",
|
||||
"editNode" : "__type__ Node bearbeiten",
|
||||
"editConfig" : "__type__config-Node bearbeiten",
|
||||
"addNewType" : "Neuen __type__ hinzufügen ...",
|
||||
"nodeProperties" : "Knoteneigenschaften",
|
||||
"portLabels" : "Knoteneinstellungen",
|
||||
"nodeProperties" : "Node-Eigenschaften",
|
||||
"portLabels" : "Node-Einstellungen",
|
||||
"labelInputs" : "Eingänge",
|
||||
"labelOutputs" : "Ausgänge",
|
||||
"settingIcon" : "Symbol",
|
||||
@ -267,7 +262,7 @@
|
||||
"searchIcons" : "Suchsymbole",
|
||||
"useDefault" : "Standardwert verwenden",
|
||||
"errors" : {
|
||||
"scopeChange" : "Wenn Sie den Geltungsbereich ändern, wird er für Knoten in anderen Nachrichtenflüssen, die ihn verwenden, nicht verfügbar sein."
|
||||
"scopeChange" : "Wenn Sie den Geltungsbereich ändern, wird er für Nodes in anderen Nachrichtenflüssen, die ihn verwenden, nicht verfügbar sein."
|
||||
}
|
||||
},
|
||||
"keyboard" : {
|
||||
@ -279,48 +274,45 @@
|
||||
"unassigned" : "Nicht zugeordnet",
|
||||
"global" : "global",
|
||||
"workspace" : "Arbeitsbereich",
|
||||
"selectAll" : "Alle Knoten auswählen",
|
||||
"selectAllConnected" : "Alle verbundenen Knoten auswählen",
|
||||
"addRemoveNode" : "Knoten aus Auswahl hinzufügen/entfernen",
|
||||
"editSelected" : "Ausgewählten Knoten bearbeiten",
|
||||
"deleteSelected" : "Ausgewählte Knoten oder ausgewählten Link löschen",
|
||||
"importNode" : "Knoten importieren",
|
||||
"exportNode" : "Knoten exportieren",
|
||||
"nudgeNode" : "Ausgewählte Knoten verschieben (1px)",
|
||||
"moveNode" : "Ausgewählte Knoten verschieben (20px)",
|
||||
"selectAll" : "Alle Nodes auswählen",
|
||||
"selectAllConnected" : "Alle verbundenen Nodes auswählen",
|
||||
"addRemoveNode" : "Node aus Auswahl hinzufügen/entfernen",
|
||||
"editSelected" : "Ausgewählten Node bearbeiten",
|
||||
"deleteSelected" : "Ausgewählte Node oder ausgewählten Link löschen",
|
||||
"importNode" : "Node importieren",
|
||||
"exportNode" : "Node exportieren",
|
||||
"nudgeNode" : "Ausgewählte Nodes verschieben (1px)",
|
||||
"moveNode" : "Ausgewählte Nodes verschieben (20px)",
|
||||
"toggleSidebar" : "Seitenleiste ein-/ausschalten",
|
||||
"copyNode" : "Ausgewählte Knoten kopieren",
|
||||
"cutNode" : "Ausgewählte Knoten ausschneiden",
|
||||
"pasteNode" : "Knoten einfügen",
|
||||
"copyNode" : "Ausgewählte Nodes kopieren",
|
||||
"cutNode" : "Ausgewählte Nodes ausschneiden",
|
||||
"pasteNode" : "Node einfügen",
|
||||
"undoChange" : "Letzte Änderung rückgängig machen",
|
||||
"searchBox" : "Suchfeld öffnen",
|
||||
"managePalette" : "Palette verwalten"
|
||||
},
|
||||
"library" : {
|
||||
"library" : "Bibliothek",
|
||||
"openLibrary" : "Bibliothek öffnen ...",
|
||||
"saveToLibrary" : "In Bibliothek speichern ...",
|
||||
"typeLibrary" : "__type__, Bibliothek",
|
||||
"unnamedType" : "Unbenannt __type__",
|
||||
"exportToLibrary" : "Knoten in Bibliothek exportieren",
|
||||
"dialogSaveOverwrite" : "Ein __libraryType__ mit dem Namen __libraryName__ ist bereits vorhanden. Überschreiben?",
|
||||
"invalidFilename" : "Ungültiger Dateiname",
|
||||
"savedNodes" : "Gespeicherte Knoten",
|
||||
"savedNodes" : "Gespeicherte Nodes",
|
||||
"savedType" : "Gespeichert __type__",
|
||||
"saveFailed" : "Speichern fehlgeschlagen: __message__",
|
||||
"filename" : "Name der Datei",
|
||||
"folder" : "Ordner",
|
||||
"filenamePlaceholder" : "Datei",
|
||||
"fullFilenamePlaceholder" : "a/b/Datei",
|
||||
"folderPlaceholder" : "a/b",
|
||||
"breadcrumb" : "Bibliothek"
|
||||
"types": {
|
||||
"examples" : "Beispiele"
|
||||
}
|
||||
},
|
||||
"palette" : {
|
||||
"noInfo" : "Keine Informationen verfügbar",
|
||||
"filter" : "Filterknoten",
|
||||
"filter" : "Filter Nodes",
|
||||
"search" : "Suchmodule",
|
||||
"addCategory" : "Neu hinzufügen ...",
|
||||
"label" : {
|
||||
"subflows" : "untergeordnete Nachrichtenflüsse",
|
||||
"subflows" : "Subflows",
|
||||
"input" : "Eingabe",
|
||||
"output" : "Ausgabe",
|
||||
"function" : "Funktion",
|
||||
@ -330,15 +322,15 @@
|
||||
"advanced" : "fortgeschritten"
|
||||
},
|
||||
"event" : {
|
||||
"nodeAdded" : "Knoten zur Palette hinzugefügt:",
|
||||
"nodeAdded_plural" : "Die Palette wurde der Palette hinzugefügt.",
|
||||
"nodeRemoved" : "Knoten aus Palette entfernt:",
|
||||
"nodeRemoved_plural" : "Knoten aus Palette entfernt:",
|
||||
"nodeEnabled" : "Knoten aktiviert:",
|
||||
"nodeEnabled_plural" : "Knoten aktiviert:",
|
||||
"nodeDisabled" : "Knoten inaktiviert:",
|
||||
"nodeDisabled_plural" : "Knoten inaktiviert:",
|
||||
"nodeUpgraded" : "Knotenmodul __module__ aktualisiert auf Version __version__"
|
||||
"nodeAdded" : "Node zur Palette hinzugefügt:",
|
||||
"nodeAdded_plural" : "Die Nodes wurde der Palette hinzugefügt.",
|
||||
"nodeRemoved" : "Node aus Palette entfernt:",
|
||||
"nodeRemoved_plural" : "Nodes aus Palette entfernt:",
|
||||
"nodeEnabled" : "Node aktiviert:",
|
||||
"nodeEnabled_plural" : "Nodes aktiviert:",
|
||||
"nodeDisabled" : "Node inaktiviert:",
|
||||
"nodeDisabled_plural" : "Nodes inaktiviert:",
|
||||
"nodeUpgraded" : "Node-Modul __module__ aktualisiert auf Version __version__"
|
||||
},
|
||||
"editor" : {
|
||||
"title" : "Palette verwalten",
|
||||
@ -362,8 +354,8 @@
|
||||
"yearsMonthsV" : "____ Jahre, __count__ Monat vor",
|
||||
"yearsMonthsV_plural" : "____ Jahre, __count__ Monaten"
|
||||
},
|
||||
"nodeCount" : "__label__, Knoten",
|
||||
"nodeCount_plural" : "__label__ Knoten",
|
||||
"nodeCount" : "__label__, Node",
|
||||
"nodeCount_plural" : "__label__ Nodes",
|
||||
"moduleCount" : "__count__ Modul verfügbar",
|
||||
"moduleCount_plural" : "__count__-Module verfügbar",
|
||||
"inuse" : "im Gebrauch",
|
||||
@ -377,14 +369,14 @@
|
||||
"install" : "installieren",
|
||||
"installed" : "installiert",
|
||||
"loading" : "Kataloge werden geladen ...",
|
||||
"tab-nodes" : "Knoten",
|
||||
"tab-nodes" : "Nodes",
|
||||
"tab-install" : "installieren",
|
||||
"sort" : "Sortierung:",
|
||||
"sortAZ" : "a-z",
|
||||
"sortRecent" : "kürzlich",
|
||||
"more" : "+ __count__ mehr",
|
||||
"errors" : {
|
||||
"catalogLoadFailed" : "<p> Fehler beim Laden des Knotenkatalogs. </p> <p> Weitere Informationen finden Sie in der Browserkonsole. </p>",
|
||||
"catalogLoadFailed" : "<p> Fehler beim Laden des Node-Katalogs. </p> <p> Weitere Informationen finden Sie in der Browserkonsole. </p>",
|
||||
"installFailed" : "<p> Installation fehlgeschlagen: __module__ </p> <p> __message__ </p> <p> Überprüfen Sie das Protokoll auf weitere Informationen. </p>",
|
||||
"removeFailed" : "<p> Entfernen fehlgeschlagen: __module__ </p> <p> __message__ </p> <p> Überprüfen Sie das Protokoll auf weitere Informationen. </p>",
|
||||
"updateFailed" : "<p> Aktualisierung fehlgeschlagen: __module__ </p> <p> __message__ </p> <p> Überprüfen Sie das Protokoll auf weitere Informationen. </p>",
|
||||
@ -393,22 +385,22 @@
|
||||
},
|
||||
"confirm" : {
|
||||
"install" : {
|
||||
"body" : "<p> Installieren von '__module__' </p> <p> Vor der Installation von lesen Sie bitte die Dokumentation des Knotens. Einige Knoten haben Abhängigkeiten, die nicht automatisch aufgelöst werden können und einen Neustart von 'Node-RED' erfordern. </p>",
|
||||
"title" : "Knoten installieren"
|
||||
"body" : "<p> Installieren von '__module__' </p> <p> Vor der Installation von lesen Sie bitte die Dokumentation des Nodes. Einige Nodes haben Abhängigkeiten, die nicht automatisch aufgelöst werden können und einen Neustart von 'Node-RED' erfordern. </p>",
|
||||
"title" : "Nodes installieren"
|
||||
},
|
||||
"remove" : {
|
||||
"body" : "<p> Entfernen von '__module__' </p> <p>-Der Knoten deinstalliert ihn aus Node-RED. Der Knoten kann weiterhin Ressourcen verwenden, bis Node-RED erneut gestartet wird. </p>",
|
||||
"title" : "Knoten entfernen"
|
||||
"body" : "<p> Entfernen von '__module__' </p> <p>-Der Node deinstalliert ihn aus Node-RED. Der Node kann weiterhin Ressourcen verwenden, bis Node-RED erneut gestartet wird. </p>",
|
||||
"title" : "Nodes entfernen"
|
||||
},
|
||||
"update" : {
|
||||
"body" : "<p> Aktualisieren von '__module__' </p> <p> Für die Aktualisierung des Knotens ist ein Neustart von 'Node-RED' erforderlich, damit die Aktualisierung abgeschlossen werden kann. Dies muss manuell geschehen. </p>",
|
||||
"title" : "Knoten aktualisieren"
|
||||
"body" : "<p> Aktualisieren von '__module__' </p> <p> Für die Aktualisierung des Nodes ist ein Neustart von 'Node-RED' erforderlich, damit die Aktualisierung abgeschlossen werden kann. Dies muss manuell geschehen. </p>",
|
||||
"title" : "Nodes aktualisieren"
|
||||
},
|
||||
"cannotUpdate" : {
|
||||
"body" : "Es ist eine Aktualisierung für diesen Knoten verfügbar, aber sie ist nicht an einer Position installiert, die vom Palettenmanager aktualisiert werden kann. <br/> <br/> Weitere Informationen zum Aktualisieren dieses Knotens finden Sie in der Dokumentation."
|
||||
"body" : "Es ist eine Aktualisierung für diesen Node verfügbar, aber sie ist nicht an einer Position installiert, die vom Palettenmanager aktualisiert werden kann. <br/> <br/> Weitere Informationen zum Aktualisieren dieses Nodes finden Sie in der Dokumentation."
|
||||
},
|
||||
"button" : {
|
||||
"review" : "Knoteninformationen öffnen",
|
||||
"review" : "Node-Informationen öffnen",
|
||||
"install" : "installieren",
|
||||
"remove" : "Entfernen",
|
||||
"update" : "Aktualisieren"
|
||||
@ -418,10 +410,10 @@
|
||||
},
|
||||
"sidebar" : {
|
||||
"info" : {
|
||||
"name" : "Knoteninformationen",
|
||||
"name" : "Node-Informationen",
|
||||
"tabName" : "Name",
|
||||
"label" : "info",
|
||||
"node" : "Knoten",
|
||||
"node" : "Node",
|
||||
"type" : "Typ",
|
||||
"id" : "ID",
|
||||
"status" : "Status",
|
||||
@ -437,23 +429,23 @@
|
||||
"showLess" : "Weniger anzeigen",
|
||||
"flow" : "Flow",
|
||||
"selection" : "Auswahl",
|
||||
"nodes" : "__count__ Knoten",
|
||||
"nodes" : "__count__ Nodes",
|
||||
"flowDesc" : "Beschreibung des Flows",
|
||||
"subflowDesc" : "Beschreibung des Subflows",
|
||||
"nodeHelp" : "Knotenhilfe",
|
||||
"nodeHelp" : "Node-Hilfe",
|
||||
"none" : "Keine",
|
||||
"arrayItems" : "__count__ items",
|
||||
"showTips" : "Sie können die Tipps in der Anzeige \"Einstellungen\" öffnen."
|
||||
},
|
||||
"config" : {
|
||||
"name" : "Konfigurationsknoten",
|
||||
"name" : "Konfigurations-Node",
|
||||
"label" : "Konfiguration",
|
||||
"global" : "Bei allen Flows",
|
||||
"none" : "keine",
|
||||
"subflows" : "Subflows",
|
||||
"flows" : "Flows",
|
||||
"filterUnused" : "Nicht verwendet",
|
||||
"filterAll" : "alle",
|
||||
"filterUnused" : "Nicht verwendet",
|
||||
"filtered" : "__count__ verdeckt"
|
||||
},
|
||||
"context" : {
|
||||
@ -462,7 +454,7 @@
|
||||
"none" : "keine ausgewählt",
|
||||
"refresh" : "Aktualisierung zum Laden",
|
||||
"empty" : "leer",
|
||||
"node" : "Knoten",
|
||||
"node" : "Node",
|
||||
"flow" : "Flow",
|
||||
"global" : "Global"
|
||||
},
|
||||
@ -610,13 +602,13 @@
|
||||
},
|
||||
"typedInput" : {
|
||||
"type" : {
|
||||
"str" : "Zeichenfolge",
|
||||
"num" : "Anzahl",
|
||||
"str" : "String",
|
||||
"num" : "Number",
|
||||
"re" : "Regulärer Ausdruck",
|
||||
"bool" : "boolean",
|
||||
"json" : "JSON",
|
||||
"bin" : "Puffer",
|
||||
"date" : "Zeitmarke",
|
||||
"bin" : "Buffer",
|
||||
"date" : "timestamp",
|
||||
"jsonata" : "Ausdruck",
|
||||
"env" : "env, Variable"
|
||||
}
|
||||
@ -626,7 +618,7 @@
|
||||
},
|
||||
"search" : {
|
||||
"empty" : "Keine Übereinstimmungen gefunden",
|
||||
"addNode" : "Knoten hinzufügen ..."
|
||||
"addNode" : "Node hinzufügen ..."
|
||||
},
|
||||
"expressionEditor" : {
|
||||
"functions" : "Funktionen",
|
||||
@ -658,10 +650,10 @@
|
||||
"title" : "Markdown-Editor"
|
||||
},
|
||||
"bufferEditor" : {
|
||||
"title" : "Puffereditor",
|
||||
"title" : "Buffereditor",
|
||||
"modeString" : "Als UTF-8-Zeichenfolge bearbeiten",
|
||||
"modeArray" : "Als JSON-Array bearbeiten",
|
||||
"modeDesc" : "<h3> Puffereditor </h3> <p> Der Puffertyp wird als JSON-Array mit Bytewerten gespeichert. Der Editor versucht, den eingegebenen Wert als JSON-Array zu parsen. Wenn es sich nicht um ein gültiges JSON handelt, wird es als UTF-8-Zeichenfolge behandelt und in ein Array der einzelnen Zeichencodepunkte konvertiert. </p> <p> Beispiel: Der Wert <code> Hello World </code> wird in das JSON-Array konvertiert: <pre> [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] </pre> </p>"
|
||||
"modeDesc" : "<h3> Buffereditor </h3> <p> Der Buffertyp wird als JSON-Array mit Bytewerten gespeichert. Der Editor versucht, den eingegebenen Wert als JSON-Array zu parsen. Wenn es sich nicht um ein gültiges JSON handelt, wird es als UTF-8-Zeichenfolge behandelt und in ein Array der einzelnen Zeichencodepunkte konvertiert. </p> <p> Beispiel: Der Wert <code> Hello World </code> wird in das JSON-Array konvertiert: <pre> [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100] </pre> </p>"
|
||||
},
|
||||
"projects" : {
|
||||
"config-git" : "Git-Client konfigurieren",
|
||||
|
@ -1,23 +1,23 @@
|
||||
{
|
||||
"info" : {
|
||||
"tip0" : "Sie können die ausgewählten Knoten oder Verbindungen mit {{ core:delete-selection }} entfernen.",
|
||||
"tip1" : "Suche nach Knoten mit {{ core:search }}",
|
||||
"tip0" : "Sie können die ausgewählten Nodes oder Verbindungen mit {{ core:delete-selection }} entfernen.",
|
||||
"tip1" : "Suche nach Nodes mit {{ core:search }}",
|
||||
"tip2" : "{{ core:toggle-sidebar }} schaltet die Ansicht dieser Seitenleiste ein.",
|
||||
"tip3" : "Sie können Ihre Palette von Knoten mit {{ core:manage-palette }} verwalten.",
|
||||
"tip4" : "Ihre Flow-Konfigurationsknoten werden in der Seitenleiste angezeigt. Es kann über das Menü oder mit {{ core:show-config-tab }} aufgerufen werden.",
|
||||
"tip3" : "Sie können Ihre Palette von Nodes mit {{ core:manage-palette }} verwalten.",
|
||||
"tip4" : "Ihre Flow-Konfigurations-Nodes werden in der Seitenleiste angezeigt. Es kann über das Menü oder mit {{ core:show-config-tab }} aufgerufen werden.",
|
||||
"tip5" : "Aktiviert oder inaktiviert diese Tipps von der Option in den Einstellungen",
|
||||
"tip6" : "Verschieben Sie die ausgewählten Knoten mit Hilfe der [left] [up] [down] und [right] Tasten. Halten Sie [Shift] gedrückt, um das Fenster weiter zu schieben",
|
||||
"tip7" : "Wenn Sie einen Knoten auf eine Verbindung ziehen, wird er in die Verbindung eingefügt.",
|
||||
"tip8" : "Die ausgewählten Knoten exportieren oder die aktuelle Registerkarte mit {{ core:show-export-dialog }}",
|
||||
"tip6" : "Verschieben Sie die ausgewählten Nodes mit Hilfe der [left] [up] [down] und [right] Tasten. Halten Sie [Shift] gedrückt, um das Fenster weiter zu schieben",
|
||||
"tip7" : "Wenn Sie einen Node auf eine Verbindung ziehen, wird er in die Verbindung eingefügt.",
|
||||
"tip8" : "Die ausgewählten Nodes exportieren oder die aktuelle Registerkarte mit {{ core:show-export-dialog }}",
|
||||
"tip9" : "Importieren Sie einen Flow, indem Sie sein JSON in den Editor ziehen oder mit {{ core:show-import-dialog }}.",
|
||||
"tip10" : "[Umschalt] [Klicken] und ziehen Sie auf einen Knotenanschluss, um alle angeschlossenen Verbindungen oder nur die ausgewählte zu verschieben.",
|
||||
"tip10" : "[Umschalt] [Klicken] und ziehen Sie auf einen Node-Anschluss, um alle angeschlossenen Verbindungen oder nur die ausgewählte zu verschieben.",
|
||||
"tip11" : "Die Registerkarte \"Info\" mit {{ core:show-info-tab }} oder der Registerkarte \"Debug\" mit {{ core:show-debug-tab }} anzeigen",
|
||||
"tip12" : "[ctrl] [Klicken] in den Arbeitsbereich, um den Schnellhinzufügedialog zu öffnen.",
|
||||
"tip13" : "Halten Sie [ctrl] gedrückt, wenn Sie auf einem Knotenanschluss klicken, um eine Schnellverbindung zu aktivieren.",
|
||||
"tip14" : "Halten Sie [Umschalt] gedrückt, wenn Sie auf einen Knoten klicken, um auch alle verbundenen Knoten auszuwählen.",
|
||||
"tip15" : "Halten Sie [ctrl] gedrückt, wenn Sie auf einen Knoten klicken, um ihn aus der aktuellen Auswahl hinzuzufügen oder zu entfernen.",
|
||||
"tip13" : "Halten Sie [ctrl] gedrückt, wenn Sie auf einem Node-Anschluss klicken, um eine Schnellverbindung zu aktivieren.",
|
||||
"tip14" : "Halten Sie [Umschalt] gedrückt, wenn Sie auf einen Node klicken, um auch alle verbundenen Nodes auszuwählen.",
|
||||
"tip15" : "Halten Sie [ctrl] gedrückt, wenn Sie auf einen Node klicken, um ihn aus der aktuellen Auswahl hinzuzufügen oder zu entfernen.",
|
||||
"tip16" : "Indexzungen wechseln mit {{ core:show-previous-tab }} und {{ core:show-next-tab }}",
|
||||
"tip17" : "Sie können die Änderungen im Editierrahmen des Knotens mit {{ core:confirm-edit-tray }} bestätigen oder sie mit {{ core:cancel-edit-tray }} abbrechen.",
|
||||
"tip18" : "Durch Drücken von {{ core:edit-selected-node }} wird der erste Knoten in der aktuellen Auswahl bearbeitet."
|
||||
"tip17" : "Sie können die Änderungen im Editierrahmen des Nodes mit {{ core:confirm-edit-tray }} bestätigen oder sie mit {{ core:cancel-edit-tray }} abbrechen.",
|
||||
"tip18" : "Durch Drücken von {{ core:edit-selected-node }} wird der erste Node in der aktuellen Auswahl bearbeitet."
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@
|
||||
},
|
||||
"$now" : {
|
||||
"args" : "",
|
||||
"desc" : "Generiert eine Zeitmarke im ISO-8601-kompatiblen Format und gibt sie als Zeichenfolge zurück."
|
||||
"desc" : "Generiert einen Zeitstempel im ISO-8601-kompatiblen Format und gibt sie als Zeichenfolge zurück."
|
||||
},
|
||||
"$base64encode" : {
|
||||
"args" : "Zeichenfolge",
|
||||
@ -201,7 +201,7 @@
|
||||
},
|
||||
"$fromMillis" : {
|
||||
"args" : "Anzahl",
|
||||
"desc" : "Konvertieren Sie eine Zahl, die Millisekunden seit der Unix-Epoche (1. Januar 1970 (UTC)) in eine Zeitmarkenzeichenfolge im ISO 8601-Format darstellt."
|
||||
"desc" : "Konvertieren Sie eine Zahl, die Millisekunden seit der Unix-Epoche (1. Januar 1970 (UTC)) enthält in eine Zeitangabe im ISO 8601-Format."
|
||||
},
|
||||
"$formatNumber" : {
|
||||
"args" : "Zahl, Bild [, Optionen]",
|
||||
@ -212,8 +212,8 @@
|
||||
"desc" : "Transformiere die `Zahl` in eine Zeichenfolge und formatiert sie in eine ganze Zahl, die in der durch das `radix` -Argument angegebenen Zahlenbasis dargestellt wird. Wenn 'radix' nicht angegeben wird, wird standardmäßig die Basis 10 verwendet. 'radix` kann zwischen 2 und 36 liegen, andernfalls wird ein Fehler ausgelöst."
|
||||
},
|
||||
"$toMillis" : {
|
||||
"args" : "Zeitmarke",
|
||||
"desc" : "Konvertieren Sie eine Zeichenfolge `Zeitmarke' im ISO 8601-Format in die Anzahl der Millisekunden seit der Unix-Epoche (1. Januar 1970 (UTC)) als Zahl. Es wird ein Fehler ausgelöst, wenn die Zeichenfolge nicht das richtige Format hat."
|
||||
"args" : "timestamp",
|
||||
"desc" : "Konvertieren Sie eine Zeitangabe im ISO 8601-Format in die Anzahl der Millisekunden seit der Unix-Epoche (1. Januar 1970 (UTC)) als Zahl. Es wird ein Fehler ausgelöst, wenn die Zeichenfolge nicht das richtige Format hat."
|
||||
},
|
||||
"$env" : {
|
||||
"args" : "arg",
|
||||
|
@ -28,7 +28,8 @@
|
||||
"status": "Status",
|
||||
"enabled": "Enabled",
|
||||
"disabled":"Disabled",
|
||||
"info": "Description"
|
||||
"info": "Description",
|
||||
"selectNodes": "Click nodes to select"
|
||||
},
|
||||
"menu": {
|
||||
"label": {
|
||||
@ -43,6 +44,8 @@
|
||||
"ltr": "Left-to-right",
|
||||
"rtl": "Right-to-left",
|
||||
"auto": "Contextual",
|
||||
"language": "Language",
|
||||
"browserDefault": "Browser default",
|
||||
"flowVertical": "Vertical flow"
|
||||
},
|
||||
"sidebar": {
|
||||
@ -60,9 +63,6 @@
|
||||
"export": "Export",
|
||||
"search": "Search flows",
|
||||
"searchInput": "search your flows",
|
||||
"clipboard": "Clipboard",
|
||||
"library": "Library",
|
||||
"examples": "Examples",
|
||||
"subflows": "Subflows",
|
||||
"createSubflow": "Create Subflow",
|
||||
"selectionToSubflow": "Selection to Subflow",
|
||||
@ -155,6 +155,7 @@
|
||||
}
|
||||
},
|
||||
"clipboard": {
|
||||
"clipboard": "Clipboard",
|
||||
"nodes": "Nodes",
|
||||
"node": "__count__ node",
|
||||
"node_plural": "__count__ nodes",
|
||||
@ -164,7 +165,6 @@
|
||||
"flow_plural": "__count__ flows",
|
||||
"subflow": "__count__ subflow",
|
||||
"subflow_plural": "__count__ subflows",
|
||||
"selectNodes": "Select the text above and copy to the clipboard.",
|
||||
"pasteNodes": "Paste flow json or",
|
||||
"selectFile": "select a file to import",
|
||||
"importNodes": "Import nodes",
|
||||
@ -183,7 +183,11 @@
|
||||
"all":"all flows",
|
||||
"compact":"compact",
|
||||
"formatted":"formatted",
|
||||
"copy": "Export to clipboard"
|
||||
"copy": "Copy to clipboard",
|
||||
"export": "Export to library",
|
||||
"exportAs": "Export as",
|
||||
"overwrite": "Replace",
|
||||
"exists": "<p><b>\"__file__\"</b> already exists.</p><p>Do you want to replace it?</p>"
|
||||
},
|
||||
"import": {
|
||||
"import": "Import to",
|
||||
@ -307,10 +311,12 @@
|
||||
"addNewType": "Add new __type__...",
|
||||
"nodeProperties": "node properties",
|
||||
"label": "Label",
|
||||
"color": "Color",
|
||||
"portLabels": "Port labels",
|
||||
"labelInputs": "Inputs",
|
||||
"labelOutputs": "Outputs",
|
||||
"settingIcon": "Icon",
|
||||
"default": "default",
|
||||
"noDefaultLabel": "none",
|
||||
"defaultLabel": "use default label",
|
||||
"searchIcons": "Search icons",
|
||||
@ -318,8 +324,43 @@
|
||||
"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"
|
||||
"scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it",
|
||||
"invalidProperties": "Invalid properties:"
|
||||
}
|
||||
},
|
||||
"keyboard": {
|
||||
@ -347,25 +388,26 @@
|
||||
"pasteNode": "Paste nodes",
|
||||
"undoChange": "Undo the last change performed",
|
||||
"searchBox": "Open search box",
|
||||
"managePalette": "Manage palette"
|
||||
"managePalette": "Manage palette",
|
||||
"actionList":"Action list"
|
||||
},
|
||||
"library": {
|
||||
"library": "Library",
|
||||
"openLibrary": "Open Library...",
|
||||
"saveToLibrary": "Save to Library...",
|
||||
"typeLibrary": "__type__ library",
|
||||
"unnamedType": "Unnamed __type__",
|
||||
"exportToLibrary": "Export nodes to library",
|
||||
"exportedToLibrary": "Nodes exported to library",
|
||||
"dialogSaveOverwrite": "A __libraryType__ called __libraryName__ already exists. Overwrite?",
|
||||
"invalidFilename": "Invalid filename",
|
||||
"savedNodes": "Saved nodes",
|
||||
"savedType": "Saved __type__",
|
||||
"saveFailed": "Save failed: __message__",
|
||||
"filename": "Filename",
|
||||
"folder": "Folder",
|
||||
"filenamePlaceholder": "file",
|
||||
"fullFilenamePlaceholder": "a/b/file",
|
||||
"folderPlaceholder": "a/b",
|
||||
"breadcrumb": "Library"
|
||||
"newFolder": "New folder",
|
||||
"types": {
|
||||
"local": "Local",
|
||||
"examples": "Examples"
|
||||
}
|
||||
},
|
||||
"palette": {
|
||||
"noInfo": "no information available",
|
||||
@ -374,9 +416,13 @@
|
||||
"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",
|
||||
@ -513,8 +559,10 @@
|
||||
"none": "none",
|
||||
"subflows": "subflows",
|
||||
"flows": "flows",
|
||||
"filterUnused":"unused",
|
||||
"filterAll":"all",
|
||||
"filterAll": "all",
|
||||
"showAllConfigNodes": "Show all config nodes",
|
||||
"filterUnused": "unused",
|
||||
"showAllUnusedConfigNodes": "Show all unused config nodes",
|
||||
"filtered": "__count__ hidden"
|
||||
},
|
||||
"context": {
|
||||
@ -526,7 +574,10 @@
|
||||
"node": "Node",
|
||||
"flow": "Flow",
|
||||
"global": "Global",
|
||||
"deleteConfirm": "Are you sure you want to delete this item?"
|
||||
"deleteConfirm": "Are you sure you want to delete this item?",
|
||||
"autoRefresh": "Refresh on selection change",
|
||||
"refrsh": "Refresh",
|
||||
"delete": "Delete"
|
||||
},
|
||||
"palette": {
|
||||
"name": "Palette management",
|
||||
@ -541,6 +592,7 @@
|
||||
"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": {
|
||||
@ -727,9 +779,21 @@
|
||||
"jsEditor": {
|
||||
"title": "JavaScript editor"
|
||||
},
|
||||
"textEditor": {
|
||||
"title": "Text editor"
|
||||
},
|
||||
"jsonEditor": {
|
||||
"title": "JSON editor",
|
||||
"format": "format JSON"
|
||||
"format": "format JSON",
|
||||
"rawMode": "Edit JSON",
|
||||
"uiMode": "Visual editor",
|
||||
"insertAbove": "Insert above",
|
||||
"insertBelow": "Insert below",
|
||||
"addItem": "Add item",
|
||||
"copyPath": "Copy path to item",
|
||||
"expandItems": "Expand items",
|
||||
"collapseItems": "Collapse items",
|
||||
"duplicate": "Duplicate"
|
||||
},
|
||||
"markdownEditor": {
|
||||
"title": "Markdown editor",
|
||||
@ -919,8 +983,17 @@
|
||||
},
|
||||
"editor-tab": {
|
||||
"properties": "Properties",
|
||||
"envProperties": "Environment Variables",
|
||||
"description": "Description",
|
||||
"appearance": "Appearance",
|
||||
"env": "Environment Variables"
|
||||
"preview": "UI Preview",
|
||||
"defaultValue": "Default value"
|
||||
},
|
||||
"languages" : {
|
||||
"de": "German",
|
||||
"en-US": "English",
|
||||
"ja": "Japanese",
|
||||
"ko": "Korean",
|
||||
"zh-CN": "Chinese(Simplified)"
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@
|
||||
"status": "状態",
|
||||
"enabled": "有効",
|
||||
"disabled": "無効",
|
||||
"info": "詳細"
|
||||
"info": "詳細",
|
||||
"selectNodes": "ノードをクリックして選択"
|
||||
},
|
||||
"menu": {
|
||||
"label": {
|
||||
@ -43,6 +44,8 @@
|
||||
"ltr": "左から右",
|
||||
"rtl": "右から左",
|
||||
"auto": "文脈",
|
||||
"language": "表示言語",
|
||||
"browserDefault": "ブラウザのデフォルト",
|
||||
"flowVertical": "縦フロー"
|
||||
},
|
||||
"sidebar": {
|
||||
@ -60,9 +63,6 @@
|
||||
"export": "書き出し",
|
||||
"search": "ノードを検索",
|
||||
"searchInput": "ノードを検索",
|
||||
"clipboard": "クリップボード",
|
||||
"library": "ライブラリ",
|
||||
"examples": "サンプル",
|
||||
"subflows": "サブフロー",
|
||||
"createSubflow": "サブフローを作成",
|
||||
"selectionToSubflow": "選択部分をサブフロー化",
|
||||
@ -81,7 +81,7 @@
|
||||
"projects-new": "新規",
|
||||
"projects-open": "開く",
|
||||
"projects-settings": "設定",
|
||||
"showNodeLabelDefault": "追加したノードのラベルを表示する"
|
||||
"showNodeLabelDefault": "追加したノードのラベルを表示"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
@ -155,6 +155,7 @@
|
||||
}
|
||||
},
|
||||
"clipboard": {
|
||||
"clipboard": "クリップボード",
|
||||
"nodes": "ノード",
|
||||
"node": "__count__ 個のノード",
|
||||
"node_plural": "__count__ 個のノード",
|
||||
@ -164,7 +165,6 @@
|
||||
"flow_plural": "__count__ 個のフロー",
|
||||
"subflow": "__count__ 個のサブフロー",
|
||||
"subflow_plural": "__count__ 個のサブフロー",
|
||||
"selectNodes": "上のテキストを選択し、クリップボードへコピーしてください",
|
||||
"pasteNodes": "JSON形式のフローデータを貼り付けてください",
|
||||
"selectFile": "読み込むファイルを選択してください",
|
||||
"importNodes": "フローをクリップボートから読み込み",
|
||||
@ -183,7 +183,11 @@
|
||||
"all": "全てのタブ",
|
||||
"compact": "インデントのないJSONフォーマット",
|
||||
"formatted": "インデント付きのJSONフォーマット",
|
||||
"copy": "書き出し"
|
||||
"copy": "書き出し",
|
||||
"export": "ライブラリに書き出し",
|
||||
"exportAs": "書き出し先",
|
||||
"overwrite": "更新",
|
||||
"exists": "<p><b>\"__file__\"</b>は既に存在します。</p><p>更新しますか?</p>"
|
||||
},
|
||||
"import": {
|
||||
"import": "読み込み先",
|
||||
@ -307,10 +311,12 @@
|
||||
"addNewType": "新規に __type__ を追加...",
|
||||
"nodeProperties": "プロパティ",
|
||||
"label": "ラベル",
|
||||
"color": "色",
|
||||
"portLabels": "ポートラベル",
|
||||
"labelInputs": "入力",
|
||||
"labelOutputs": "出力",
|
||||
"settingIcon": "アイコン",
|
||||
"default": "デフォルト",
|
||||
"noDefaultLabel": "なし",
|
||||
"defaultLabel": "既定のラベルを使用",
|
||||
"searchIcons": "アイコンを検索",
|
||||
@ -318,8 +324,43 @@
|
||||
"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": "スコープの変更は、他のフローで使われているノードを無効にします"
|
||||
"scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします",
|
||||
"invalidProperties": "プロパティが不正です:"
|
||||
}
|
||||
},
|
||||
"keyboard": {
|
||||
@ -347,25 +388,26 @@
|
||||
"pasteNode": "ノードを貼り付け",
|
||||
"undoChange": "変更操作を戻す",
|
||||
"searchBox": "ノードを検索",
|
||||
"managePalette": "パレットの管理"
|
||||
"managePalette": "パレットの管理",
|
||||
"actionList": "動作一覧"
|
||||
},
|
||||
"library": {
|
||||
"library": "ライブラリ",
|
||||
"openLibrary": "ライブラリを開く",
|
||||
"saveToLibrary": "ライブラリへ保存",
|
||||
"typeLibrary": "__type__ ライブラリ",
|
||||
"unnamedType": "名前なし __type__",
|
||||
"exportToLibrary": "ライブラリへフローを書き出す",
|
||||
"exportedToLibrary": "ライブラリにノードを書き出しました",
|
||||
"dialogSaveOverwrite": "__libraryName__ という __libraryType__ は既に存在しています 上書きしますか?",
|
||||
"invalidFilename": "不正なファイル名",
|
||||
"savedNodes": "フローを保存しました",
|
||||
"savedType": "__type__ を保存しました",
|
||||
"saveFailed": "保存に失敗しました: __message__",
|
||||
"filename": "ファイル名",
|
||||
"folder": "フォルダ",
|
||||
"filenamePlaceholder": "ファイル",
|
||||
"fullFilenamePlaceholder": "a/b/file",
|
||||
"folderPlaceholder": "a/b",
|
||||
"breadcrumb": "ライブラリ"
|
||||
"newFolder": "新規フォルダ",
|
||||
"types": {
|
||||
"local": "ローカル",
|
||||
"examples": "サンプル"
|
||||
}
|
||||
},
|
||||
"palette": {
|
||||
"noInfo": "情報がありません",
|
||||
@ -374,9 +416,13 @@
|
||||
"addCategory": "新規追加...",
|
||||
"label": {
|
||||
"subflows": "サブフロー",
|
||||
"network": "ネットワーク",
|
||||
"common": "共通",
|
||||
"input": "入力",
|
||||
"output": "出力",
|
||||
"function": "機能",
|
||||
"sequence": "シーケンス",
|
||||
"parser": "パーサ",
|
||||
"social": "ソーシャル",
|
||||
"storage": "ストレージ",
|
||||
"analysis": "分析",
|
||||
@ -513,8 +559,10 @@
|
||||
"none": "なし",
|
||||
"subflows": "サブフロー",
|
||||
"flows": "フロー",
|
||||
"filterUnused": "未使用",
|
||||
"filterAll": "全て",
|
||||
"showAllConfigNodes": "全設定ノードを表示",
|
||||
"filterUnused": "未使用",
|
||||
"showAllUnusedConfigNodes": "未使用の全設定ノードを表示",
|
||||
"filtered": "__count__ 個が無効"
|
||||
},
|
||||
"context": {
|
||||
@ -523,10 +571,13 @@
|
||||
"none": "選択されていません",
|
||||
"refresh": "読み込みのため更新してください",
|
||||
"empty": "データが存在しません",
|
||||
"node": "Node",
|
||||
"flow": "Flow",
|
||||
"global": "Global",
|
||||
"deleteConfirm": "データを削除しても良いですか?"
|
||||
"node": "ノード",
|
||||
"flow": "フロー",
|
||||
"global": "グローバル",
|
||||
"deleteConfirm": "データを削除しても良いですか?",
|
||||
"autoRefresh": "選択対象が変化した場合更新",
|
||||
"refrsh": "更新",
|
||||
"delete": "削除"
|
||||
},
|
||||
"palette": {
|
||||
"name": "パレットの管理",
|
||||
@ -538,9 +589,10 @@
|
||||
"description": "詳細",
|
||||
"dependencies": "依存関係",
|
||||
"settings": "設定",
|
||||
"noSummaryAvailable": "サマリが存在しません",
|
||||
"noSummaryAvailable": "要約が存在しません",
|
||||
"editDescription": "プロジェクトの詳細を編集",
|
||||
"editDependencies": "プロジェクトの依存関係を編集",
|
||||
"noDescriptionAvailable": "詳細が存在しません",
|
||||
"editReadme": "README.mdを編集",
|
||||
"showProjectSettings": "プロジェクト設定を表示",
|
||||
"projectSettings": {
|
||||
@ -726,9 +778,21 @@
|
||||
"jsEditor": {
|
||||
"title": "JavaScriptエディタ"
|
||||
},
|
||||
"textEditor": {
|
||||
"title": "テキストエディタ"
|
||||
},
|
||||
"jsonEditor": {
|
||||
"title": "JSONエディタ",
|
||||
"format": "JSONフォーマット"
|
||||
"format": "JSONフォーマット",
|
||||
"rawMode": "JSONを編集",
|
||||
"uiMode": "ビジュアルエディタ",
|
||||
"insertAbove": "上に挿入",
|
||||
"insertBelow": "下に挿入",
|
||||
"addItem": "要素を追加",
|
||||
"copyPath": "要素のパスをコピー",
|
||||
"expandItems": "要素を展開",
|
||||
"collapseItems": "要素を折り畳む",
|
||||
"duplicate": "複製"
|
||||
},
|
||||
"markdownEditor": {
|
||||
"title": "マークダウンエディタ",
|
||||
@ -892,7 +956,7 @@
|
||||
"confirm": "<p>デプロイされていない変更は失われます。</p><p>続けますか?</p>"
|
||||
},
|
||||
"send-req": {
|
||||
"auth-req": "リポジトリ対する認証が必要です",
|
||||
"auth-req": "リポジトリに対する認証が必要です",
|
||||
"username": "ユーザ名",
|
||||
"password": "パスワード",
|
||||
"passphrase": "パスフレーズ",
|
||||
@ -918,8 +982,17 @@
|
||||
},
|
||||
"editor-tab": {
|
||||
"properties": "プロパティ",
|
||||
"envProperties": "環境変数",
|
||||
"description": "説明",
|
||||
"appearance": "外観",
|
||||
"env": "環境変数"
|
||||
"preview": "UIプレビュー",
|
||||
"defaultValue": "デフォルト値"
|
||||
},
|
||||
"languages": {
|
||||
"de": "ドイツ語",
|
||||
"en-US": "英語",
|
||||
"ja": "日本語",
|
||||
"ko": "韓国語",
|
||||
"zh-CN": "中国語(簡体)"
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,6 @@
|
||||
"export": "내보내기",
|
||||
"search": "플로우 겅색",
|
||||
"searchInput": "플로우 검색",
|
||||
"clipboard": "클립보드",
|
||||
"library": "라이브러리",
|
||||
"examples": "예시",
|
||||
"subflows": "보조 플로우",
|
||||
"createSubflow": "보조 플로우 생성",
|
||||
"selectionToSubflow": "보조 플로우 선택",
|
||||
@ -148,6 +145,7 @@
|
||||
}
|
||||
},
|
||||
"clipboard": {
|
||||
"clipboard": "클립보드",
|
||||
"nodes": "노드",
|
||||
"node": "__count__ 개의 노드",
|
||||
"node_plural": "__count__ 개의 노드",
|
||||
@ -157,7 +155,6 @@
|
||||
"flow_plural": "__count__ 개의 플로우",
|
||||
"subflow": "__count__ 개의 서브 플로우",
|
||||
"subflow_plural": "__count__ 개의 서브 플로우",
|
||||
"selectNodes": "텍스트를 선택하고 클립보드에 복사하세요",
|
||||
"pasteNodes": "여기에 노드를 붙여넣기 하세요",
|
||||
"selectFile": "불러올 파일을 선택하세요",
|
||||
"importNodes": "노드 불러오기",
|
||||
@ -276,7 +273,6 @@
|
||||
"deleteSubflow": "서브 플로우 삭제",
|
||||
"info": "상세내역",
|
||||
"category": "카테고리",
|
||||
"format": "Markdown 형식",
|
||||
"errors": {
|
||||
"noNodesSelected": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 노드가 선택되지 않았습니다",
|
||||
"multipleInputsToSelection": "<strong>서브 플로우를 생성할 수 없습니다</strong> : 복수의 입력이 선택되었습니다"
|
||||
@ -338,22 +334,19 @@
|
||||
"managePalette": "팔렛트 관리"
|
||||
},
|
||||
"library": {
|
||||
"library": "라이브러리",
|
||||
"openLibrary": "라이브러리 열기...",
|
||||
"saveToLibrary": "라이브러리로 저장...",
|
||||
"typeLibrary": "__type__ 라이브러리",
|
||||
"unnamedType": "이름없는 __type__",
|
||||
"exportToLibrary": "라이브러리로 노드 내보내기",
|
||||
"dialogSaveOverwrite": "__libraryType__이 __libraryName__으로 이미 등록되어있습니다. 덮어쓸까요?",
|
||||
"invalidFilename": "파일명이 올바르지 않습니다",
|
||||
"savedNodes": "저장된 노드",
|
||||
"savedType": "저장된 __type__",
|
||||
"saveFailed": "저장 실패 : __message__",
|
||||
"filename": "파일명",
|
||||
"folder": "폴더명",
|
||||
"filenamePlaceholder": "파일",
|
||||
"fullFilenamePlaceholder": "a/b/file",
|
||||
"folderPlaceholder": "a/b",
|
||||
"breadcrumb": "라이브러리"
|
||||
"types": {
|
||||
"examples": "예시"
|
||||
}
|
||||
},
|
||||
"palette": {
|
||||
"noInfo": "정보 없음",
|
||||
@ -501,8 +494,8 @@
|
||||
"none": "없음",
|
||||
"subflows": "보조 플로우",
|
||||
"flows": "플로우",
|
||||
"filterUnused": "미사용",
|
||||
"filterAll": "전체",
|
||||
"filterUnused": "미사용",
|
||||
"filtered": "__count__ 개 숨김"
|
||||
},
|
||||
"context": {
|
||||
|
@ -51,9 +51,6 @@
|
||||
"export": "导出",
|
||||
"search": "查找流程",
|
||||
"searchInput": "查找流程",
|
||||
"clipboard": "剪贴板",
|
||||
"library": "库",
|
||||
"examples": "例子",
|
||||
"subflows": "子流程",
|
||||
"createSubflow": "新建子流程",
|
||||
"selectionToSubflow": "将选择部分更改为子流程",
|
||||
@ -101,8 +98,8 @@
|
||||
}
|
||||
},
|
||||
"clipboard": {
|
||||
"clipboard": "剪贴板",
|
||||
"nodes": "节点",
|
||||
"selectNodes": "选择上面的文本并复制到剪贴板",
|
||||
"pasteNodes": "在这里粘贴节点",
|
||||
"importNodes": "导入节点",
|
||||
"exportNodes": "导出节点至剪贴板",
|
||||
@ -238,6 +235,7 @@
|
||||
"managePalette": "管理面板"
|
||||
},
|
||||
"library": {
|
||||
"library": "库",
|
||||
"openLibrary": "打开库...",
|
||||
"saveToLibrary": "保存到库...",
|
||||
"typeLibrary": "__type__类型库",
|
||||
@ -248,12 +246,9 @@
|
||||
"savedNodes": "保存的节点",
|
||||
"savedType": "已保存__type__",
|
||||
"saveFailed": "保存失败: __message__",
|
||||
"filename": "文件名",
|
||||
"folder": "文件夹",
|
||||
"filenamePlaceholder": "文件",
|
||||
"fullFilenamePlaceholder": "a/b/文件",
|
||||
"folderPlaceholder": "a/b",
|
||||
"breadcrumb": "库"
|
||||
"types": {
|
||||
"examples": "例子"
|
||||
}
|
||||
},
|
||||
"palette": {
|
||||
"noInfo": "无可用信息",
|
||||
@ -391,8 +386,8 @@
|
||||
"none": "无",
|
||||
"subflows": "子流程",
|
||||
"flows": "流程",
|
||||
"filterUnused": "未使用",
|
||||
"filterAll": "所有",
|
||||
"filterUnused": "未使用",
|
||||
"filtered": "__count__ 个隐藏"
|
||||
},
|
||||
"palette": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "0.20.5",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Before Width: | Height: | Size: 291 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 386 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-flows.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 289 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 368 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-full.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 290 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 392 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 1015 B |
1
packages/node_modules/@node-red/editor-client/src/images/deploy-reload.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 606 B |
Before Width: | Height: | Size: 393 B |
1
packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="40" height="60" viewBox="0, 0, 40, 60" xmlns="http://www.w3.org/2000/svg"><path d="M18 5v12H7v26h11v12l14-25z" fill="#fff"/></svg>
|
After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 1019 B |
1
packages/node_modules/@node-red/editor-client/src/images/node-red.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<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>
|
After Width: | Height: | Size: 636 B |
Before Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 410 B |
1
packages/node_modules/@node-red/editor-client/src/images/subflow_tab.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="40" height="40" viewBox="0, 0, 40, 40" xmlns="http://www.w3.org/2000/svg"><path d="M25 16h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1h-7c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zM8 28h7c.58 0 1-.42 1-1v-2c0-.58-.42-1-1-1H8c-.58 0-1 .42-1 1v2c0 .58.42 1 1 1zm-.416 11C5.624 39 4 37.375 4 35.416V4.582C4 2.622 5.625 1 7.584 1h24.832C34.376 1 36 2.623 36 4.582v30.834C36 37.376 34.375 39 32.416 39zM32 27H19c0 2.19-1.81 4-4 4H7v4.416c0 .35.235.584.584.584h24.832c.35 0 .584-.235.584-.584v-8.417zm1-2v-6h-8c-2.19 0-4-1.81-4-4h-1c-4.333-.002-8.667.004-13 0v6h8c2.19 0 4 1.81 4 4h13zm0-16V4.582c0-.35-.235-.582-.584-.582H7.584C7.234 4 7 4.233 7 4.582v8.417c4.333.002 8.667.001 13 .001h1c0-2.19 1.81-4 4-4z" color="#000" fill="#333"/></svg>
|
After Width: | Height: | Size: 732 B |
Before Width: | Height: | Size: 638 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/09.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M14.16 27.38l1.555-.144c.132.731.383 1.261.755 1.591.371.33.848.494 1.429.494.497 0 .931-.114 1.303-.341.377-.228.686-.53.926-.908.24-.383.44-.899.602-1.546a8.122 8.122 0 0 0 .233-2.3 3.732 3.732 0 0 1-1.33 1.258 3.605 3.605 0 0 1-1.815.476c-1.09 0-2.013-.395-2.768-1.186s-1.133-1.834-1.133-3.128c0-1.336.393-2.411 1.178-3.226.79-.815 1.78-1.223 2.966-1.223.856 0 1.638.231 2.345.692.713.462 1.253 1.12 1.618 1.978.372.85.557 2.085.557 3.702 0 1.684-.182 3.026-.548 4.027-.365.994-.91 1.752-1.636 2.274-.719.52-1.563.781-2.534.781-1.03 0-1.872-.284-2.525-.853-.654-.576-1.046-1.381-1.178-2.418zm6.624-5.815c0-.928-.249-1.666-.746-2.21-.492-.546-1.085-.819-1.78-.819-.719 0-1.345.294-1.878.881s-.8 1.348-.8 2.283c0 .839.252 1.522.755 2.05.51.52 1.135.781 1.878.781.75 0 1.363-.26 1.843-.782.485-.527.728-1.255.728-2.184zM4.858 10.466c0-1.558.158-2.81.476-3.757.324-.952.8-1.686 1.429-2.201.635-.516 1.432-.773 2.39-.773.708 0 1.328.143 1.861.431.533.282.974.692 1.321 1.231.348.534.62 1.187.818 1.96.198.767.297 1.803.297 3.11 0 1.545-.16 2.794-.477 3.747-.317.947-.794 1.68-1.429 2.202-.629.515-1.426.773-2.39.773-1.27 0-2.268-.456-2.993-1.366-.869-1.097-1.303-2.882-1.303-5.357zm1.662 0c0 2.163.252 3.604.755 4.323.51.713 1.136 1.07 1.879 1.07.743 0 1.366-.36 1.87-1.079.508-.719.763-2.157.763-4.314 0-2.169-.255-3.61-.764-4.323-.503-.713-1.132-1.07-1.887-1.07-.743 0-1.336.315-1.78.944-.557.803-.836 2.286-.836 4.45z" fill="#444"/></svg>
|
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 546 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/az.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M13.27 29.15l6.733-8.143h-6.235V19.3h8.8v1.559l-6.69 8.09h6.892v1.707h-9.5zm4.909-10.125zM6.577 12.58q0 .827.604 1.304.605.478 1.432.478 1.007 0 1.95-.467 1.59-.774 1.59-2.534V9.824q-.349.222-.9.37-.552.15-1.082.213l-1.155.148q-1.04.138-1.56.435-.88.498-.88 1.59zM11.2 8.721q.657-.085.88-.551.127-.255.127-.732 0-.975-.7-1.41-.689-.445-1.983-.445-1.495 0-2.12.805-.35.446-.456 1.326H5.167q.053-2.1 1.357-2.916 1.315-.827 3.043-.827 2.004 0 3.255.763 1.24.764 1.24 2.375v6.542q0 .297.117.477.127.18.52.18.127 0 .286-.01.159-.021.34-.053v1.41q-.446.127-.68.16-.233.031-.636.031-.986 0-1.43-.7-.234-.37-.33-1.05-.583.764-1.675 1.326t-2.407.562q-1.58 0-2.587-.954-.996-.965-.996-2.407 0-1.58.986-2.45.986-.869 2.587-1.07zm-1.58-4.75z" fill="#444"/></svg>
|
After Width: | Height: | Size: 846 B |
Before Width: | Height: | Size: 638 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M18.8 33.9c3.328 0 4.776-2.603 4.776-7.066s-1.448-7.066-4.776-7.066-4.776 2.603-4.776 7.066S15.473 33.9 18.8 33.9zm0-1.429c-2.192 0-3.073-1.781-3.073-4.522v-2.23c0-2.741.88-4.523 3.073-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.88 4.522-3.073 4.522zm-6.306 1.194v-1.429H8.892V20.002H6.328l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02H3.333v1.429zm11.2-17.7v-1.429h-3.602V2.302h-2.564l-3.621 3.386.959 1.038 3.445-3.21h.137v11.02h-3.915v1.429zM7.5 16.2c3.327 0 4.776-2.603 4.776-7.066S10.828 2.068 7.5 2.068 2.725 4.67 2.725 9.134 4.173 16.2 7.5 16.2zm0-1.429c-2.193 0-3.074-1.781-3.074-4.522V8.02c0-2.741.881-4.523 3.074-4.523s3.073 1.782 3.073 4.522v2.231c0 2.74-.881 4.522-3.073 4.522z" fill="#444"/></svg>
|
After Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 646 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M9.96 21.98a5 5 0 1 1 6.11-7.917zm3.035-13.973c-5.512 0-10 4.488-10 10s4.488 9.998 10 9.998 10-4.486 10-9.998-4.488-10-10-10zm0 1.816c4.53 0 8.182 3.655 8.182 8.184s-3.652 8.182-8.182 8.182-8.181-3.653-8.181-8.182 3.652-8.184 8.181-8.184z" color="#000" fill="#444"/></svg>
|
After Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 809 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/env.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M14.33 27.19q2.916-.136 4.024-2.131.58-1.024.58-2.37 0-2.132-1.569-3.24-.904-.648-3.035-1.228zM8.55 10.736q0 1.688 1.108 2.643 1.125.955 3.018 1.33V6.695q-2.234.085-3.189 1.364-.937 1.279-.937 2.677zm-3.07.205q0-2.592 1.893-4.672 1.91-2.08 5.337-2.115V1.887h1.62V4.12q3.393.239 5.2 2.012 1.825 1.757 1.91 4.655h-2.984q-.119-1.296-.699-2.233-1.074-1.723-3.427-1.808v8.287q3.956 1.108 5.371 2.08 2.302 1.603 2.302 4.74 0 4.536-2.95 6.446-1.637 1.057-4.723 1.398v3.308h-1.62v-3.308q-4.962-.324-6.735-3.513-.972-1.722-.972-4.655h3.018q.136 2.336.733 3.41 1.057 1.927 3.922 2.166v-9.293q-3.683-.699-5.44-2.336Q5.48 13.84 5.48 10.941z" fill="#444"/></svg>
|
After Width: | Height: | Size: 745 B |
Before Width: | Height: | Size: 563 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-337.103 -913.25) scale(1.2585)" fill="#444" stroke-width=".795"><circle cx="284.36" cy="733.68" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><circle cx="284.33" cy="740.74" r="1.5" color="#000" style="isolation:auto;mix-blend-mode:normal"/><path d="M276.18 727.78l4.396-1.565v18.515c-.711 2.606-2.922 4.394-5.812 5.812l-4.135 1.974-.559-1.192 3.353-1.639c1.459-.724 2.689-1.87 2.869-4.955z" fill-rule="evenodd"/></g></svg>
|
After Width: | Height: | Size: 556 B |
Before Width: | Height: | Size: 588 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/json.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M15 5.225v-1.92h2.24q.608 0 1.216.288.608.256 1.12.8.48.512.8 1.312.32.768.32 1.792v5.824q0 .832.224 1.536t.608 1.216q.352.48.832.768.48.256.992.256v2.176q-.512 0-.992.256t-.832.736q-.384.48-.608 1.184t-.224 1.568v5.792q0 1.024-.32 1.792-.32.8-.8 1.312-.512.544-1.12.8-.608.288-1.216.288H15v-1.92h1.6q.48 0 .768-.256.288-.224.48-.64.16-.384.224-.896.064-.48.064-.96v-5.824q0-1.216.352-2.016.32-.8.768-1.28.448-.512.928-.736.448-.224.736-.256v-.096q-.288-.064-.736-.32-.48-.256-.928-.768t-.768-1.28q-.352-.8-.352-1.92V7.977q0-.512-.064-.992-.064-.512-.224-.896-.192-.384-.48-.608-.288-.256-.768-.256zm-3.648 0v-1.92h-2.24q-.608 0-1.216.288-.608.256-1.12.8-.48.512-.8 1.312-.32.768-.32 1.792v5.824q0 .832-.224 1.536t-.608 1.216q-.352.48-.832.768-.48.256-.992.256v2.176q.512 0 .992.256t.832.736q.384.48.608 1.184t.224 1.568v5.792q0 1.024.32 1.792.32.8.8 1.312.512.544 1.12.8.608.288 1.216.288h2.24v-1.92h-1.6q-.48 0-.768-.256-.288-.224-.48-.64-.16-.384-.224-.896-.064-.48-.064-.96v-5.824q0-1.216-.352-2.016-.32-.8-.768-1.28-.448-.512-.928-.736-.448-.224-.736-.256v-.096q.288-.064.736-.32.48-.256.928-.768t.768-1.28q.352-.8.352-1.92V7.977q0-.512.064-.992.064-.512.224-.896.192-.384.48-.608.288-.256.768-.256z" fill="#444"/></svg>
|
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 502 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/re.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M2 19h5v5H2zm16.099-3.304v-5.659h-2.654v5.66l-5.309-2.004-.901 2.404L14.543 18l-3.255 4.557 2.254 1.553 3.255-4.808 3.455 4.808 2.054-1.553L19 18l5.46-1.903-1.002-2.404z" color="#000" fill="#444444"/></svg>
|
After Width: | Height: | Size: 302 B |
1
packages/node_modules/@node-red/editor-client/src/images/typedInput/target.svg
vendored
Normal file
@ -0,0 +1 @@
|
||||
<svg width="26" height="36" viewBox="0, 0, 26, 36" xmlns="http://www.w3.org/2000/svg"><path d="M11 5v5.77a7.542 7.542 0 0 0-5.234 5.25L1 16c-1.432 1.397-1.232 2.722 0 4l4.75-.078a7.542 7.542 0 0 0 5.22 5.297L11 31c1.316 1.303 2.649 1.363 4 0l.009-5.775A7.542 7.542 0 0 0 20.228 20H25c1.261-1.294 1.404-2.623 0-4l-4.774-.01a7.542 7.542 0 0 0-5.23-5.22L15 5c-1.3-1.273-2.63-1.393-4 0zm2 7.499c3.05 0 5.5 2.45 5.5 5.5s-2.45 5.5-5.5 5.5-5.5-2.45-5.5-5.5 2.45-5.5 5.5-5.5z" color="#000" fill="#444"/></svg>
|
After Width: | Height: | Size: 502 B |
@ -143,7 +143,7 @@ RED.comms = (function() {
|
||||
} else {
|
||||
var msg = RED._("notification.errors.lostConnectionReconnect",{time: connectCountdown})+' <a href="#">'+ RED._("notification.errors.lostConnectionTry")+'</a>';
|
||||
errornotification.update(msg,{silent:true});
|
||||
$(errornotification).find("a").click(function(e) {
|
||||
$(errornotification).find("a").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
errornotification.update(RED._("notification.errors.lostConnection"),{silent:true});
|
||||
clearInterval(connectCountdownTimer);
|
||||
|
@ -14,7 +14,8 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
RED.history = (function() {
|
||||
var undo_history = [];
|
||||
var undoHistory = [];
|
||||
var redoHistory = [];
|
||||
|
||||
function undoEvent(ev) {
|
||||
var i;
|
||||
@ -22,52 +23,81 @@ 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--) {
|
||||
undoEvent(ev.events[i]);
|
||||
var r = undoEvent(ev.events[i]);
|
||||
inverseEv.events.push(r);
|
||||
}
|
||||
} 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;
|
||||
@ -83,21 +113,30 @@ 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]);
|
||||
}
|
||||
}
|
||||
@ -126,8 +165,11 @@ 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;
|
||||
@ -152,14 +194,25 @@ 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) {
|
||||
@ -179,8 +232,14 @@ 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;
|
||||
@ -188,18 +247,28 @@ 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]);
|
||||
@ -214,23 +283,34 @@ RED.history = (function() {
|
||||
ev.node[i] = ev.changes[i];
|
||||
}
|
||||
}
|
||||
if (ev.node.type === 'tab' && ev.changes.hasOwnProperty('disabled')) {
|
||||
$("#red-ui-tab-"+(ev.node.id.replace(".","-"))).toggleClass('red-ui-workspace-disabled',!!ev.node.disabled);
|
||||
$("#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;
|
||||
@ -254,9 +334,11 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,39 +346,107 @@ 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);
|
||||
}
|
||||
@ -316,6 +466,8 @@ RED.history = (function() {
|
||||
RED.workspaces.refresh();
|
||||
RED.sidebar.config.refresh();
|
||||
RED.subflow.refresh();
|
||||
|
||||
return inverseEv;
|
||||
}
|
||||
|
||||
}
|
||||
@ -323,28 +475,42 @@ 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<undo_history.length;i++) {
|
||||
undo_history[i].dirty = true;
|
||||
for (var i=0;i<undoHistory.length;i++) {
|
||||
undoHistory[i].dirty = true;
|
||||
}
|
||||
},
|
||||
list: function() {
|
||||
return undo_history
|
||||
return undoHistory;
|
||||
},
|
||||
depth: function() {
|
||||
return undo_history.length;
|
||||
return undoHistory.length;
|
||||
},
|
||||
push: function(ev) {
|
||||
undo_history.push(ev);
|
||||
undoHistory.push(ev);
|
||||
redoHistory = [];
|
||||
},
|
||||
pop: function() {
|
||||
var ev = undo_history.pop();
|
||||
undoEvent(ev);
|
||||
var ev = undoHistory.pop();
|
||||
var rev = undoEvent(ev);
|
||||
if (rev) {
|
||||
redoHistory.push(rev);
|
||||
}
|
||||
},
|
||||
peek: function() {
|
||||
return undo_history[undo_history.length-1];
|
||||
return undoHistory[undoHistory.length-1];
|
||||
},
|
||||
clear: function() {
|
||||
undo_history = [];
|
||||
undoHistory = [];
|
||||
redoHistory = [];
|
||||
},
|
||||
redo: function() {
|
||||
var ev = redoHistory.pop();
|
||||
if (ev) {
|
||||
var uev = undoEvent(ev);
|
||||
if (uev) {
|
||||
undoHistory.push(uev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ RED.i18n = (function() {
|
||||
return {
|
||||
init: function(options, done) {
|
||||
apiRootUrl = options.apiRootUrl||"";
|
||||
i18n.init({
|
||||
var preferredLanguage = localStorage.getItem("editor-language");
|
||||
var opts = {
|
||||
resGetPath: apiRootUrl+'locales/__ns__?lng=__lng__',
|
||||
dynamicLoad: false,
|
||||
load:'current',
|
||||
@ -32,7 +33,11 @@ RED.i18n = (function() {
|
||||
fallbackLng: ['en-US'],
|
||||
useCookie: false,
|
||||
returnObjectTrees: true
|
||||
},function() {
|
||||
};
|
||||
if (preferredLanguage) {
|
||||
opts.lng = preferredLanguage;
|
||||
}
|
||||
i18n.init(opts,function() {
|
||||
done();
|
||||
});
|
||||
RED["_"] = function() {
|
||||
@ -45,8 +50,21 @@ 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(i18n.detectLanguage());
|
||||
var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
|
||||
var toLoad = languageList.length;
|
||||
languageList.forEach(function(lang) {
|
||||
$.ajax({
|
||||
@ -68,7 +86,7 @@ RED.i18n = (function() {
|
||||
},
|
||||
|
||||
loadNodeCatalogs: function(done) {
|
||||
var languageList = i18n.functions.toLanguages(i18n.detectLanguage());
|
||||
var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
|
||||
var toLoad = languageList.length;
|
||||
|
||||
languageList.forEach(function(lang) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"*": {
|
||||
"ctrl-shift-p":"core:manage-palette",
|
||||
"alt-shift-p":"core:manage-palette",
|
||||
"ctrl-f": "core:search",
|
||||
"ctrl-shift-f": "core:list-flows",
|
||||
"ctrl-=": "core:zoom-in",
|
||||
@ -8,6 +8,7 @@
|
||||
"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",
|
||||
@ -17,19 +18,22 @@
|
||||
"ctrl-space": "core:toggle-sidebar",
|
||||
"ctrl-p": "core:toggle-palette",
|
||||
"ctrl-,": "core:show-user-settings",
|
||||
"ctrl-alt-l": "core:clear-debug-messages",
|
||||
"ctrl-alt-r": "core:show-remote-diff",
|
||||
"ctrl-alt-n": "core:new-project",
|
||||
"ctrl-alt-o": "core:open-project",
|
||||
"ctrl-g v": "core:show-version-control-tab",
|
||||
"ctrl-shift-l": "core:show-event-log"
|
||||
"ctrl-shift-l": "core:show-event-log",
|
||||
"ctrl-shift-p":"core:show-action-list"
|
||||
},
|
||||
"sidebar-node-config": {
|
||||
"red-ui-sidebar-node-config": {
|
||||
"backspace": "core:delete-config-selection",
|
||||
"delete": "core:delete-config-selection",
|
||||
"ctrl-a": "core:select-all-config-nodes",
|
||||
"ctrl-z": "core:undo"
|
||||
"ctrl-z": "core:undo",
|
||||
"ctrl-y": "core:redo"
|
||||
},
|
||||
"workspace": {
|
||||
"red-ui-workspace": {
|
||||
"backspace": "core:delete-selection",
|
||||
"delete": "core:delete-selection",
|
||||
"enter": "core:edit-selected-node",
|
||||
@ -37,6 +41,7 @@
|
||||
"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",
|
||||
|
@ -17,6 +17,8 @@ RED.nodes = (function() {
|
||||
|
||||
var node_defs = {};
|
||||
var nodes = [];
|
||||
var nodeTabMap = {};
|
||||
|
||||
var configNodes = {};
|
||||
var links = [];
|
||||
var defaultWorkspace;
|
||||
@ -213,6 +215,11 @@ 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);
|
||||
}
|
||||
@ -246,6 +253,9 @@ 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;
|
||||
@ -291,6 +301,17 @@ 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) {
|
||||
@ -300,6 +321,8 @@ 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);
|
||||
@ -312,6 +335,7 @@ RED.nodes = (function() {
|
||||
}
|
||||
function removeWorkspace(id) {
|
||||
delete workspaces[id];
|
||||
delete nodeTabMap[id];
|
||||
workspacesOrder.splice(workspacesOrder.indexOf(id),1);
|
||||
|
||||
var removedNodes = [];
|
||||
@ -357,30 +381,32 @@ 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.png" },
|
||||
icon: function() { return sf.icon||"subflow.svg" },
|
||||
category: sf.category || "subflows",
|
||||
inputs: sf.in.length,
|
||||
outputs: sf.out.length,
|
||||
color: "#da9",
|
||||
color: sf.color || "#DDAA99",
|
||||
label: function() { return this.name||RED.nodes.subflow(sf.id).name },
|
||||
labelStyle: function() { return this.name?"node_label_italic":""; },
|
||||
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")));
|
||||
$("#node-input-env-container").editableList('height',height-80);
|
||||
// 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);
|
||||
},
|
||||
set:{
|
||||
module: "node-red"
|
||||
@ -393,6 +419,7 @@ RED.nodes = (function() {
|
||||
}
|
||||
function removeSubflow(sf) {
|
||||
delete subflows[sf.id];
|
||||
delete nodeTabMap[sf.id];
|
||||
registry.removeNodeType("subflow:"+sf.id);
|
||||
}
|
||||
|
||||
@ -463,7 +490,9 @@ RED.nodes = (function() {
|
||||
node.id = n.id;
|
||||
node.type = n.type;
|
||||
node.z = n.z;
|
||||
|
||||
if (n.d === true) {
|
||||
node.d = true;
|
||||
}
|
||||
if (node.type == "unknown") {
|
||||
for (var p in n._orig) {
|
||||
if (n._orig.hasOwnProperty(p)) {
|
||||
@ -549,6 +578,7 @@ 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:[]};
|
||||
@ -581,7 +611,7 @@ RED.nodes = (function() {
|
||||
node.outputLabels = n.outputLabels.slice();
|
||||
}
|
||||
if (n.icon) {
|
||||
if (n.icon !== "node-red/subflow.png") {
|
||||
if (n.icon !== "node-red/subflow.svg") {
|
||||
node.icon = n.icon;
|
||||
}
|
||||
}
|
||||
@ -967,6 +997,9 @@ RED.nodes = (function() {
|
||||
users:[],
|
||||
_config:{}
|
||||
};
|
||||
if (n.hasOwnProperty('d')) {
|
||||
configNode.d = n.d;
|
||||
}
|
||||
for (d in def.defaults) {
|
||||
if (def.defaults.hasOwnProperty(d)) {
|
||||
configNode[d] = n[d];
|
||||
@ -1016,6 +1049,9 @@ RED.nodes = (function() {
|
||||
if (n.hasOwnProperty('l')) {
|
||||
node.l = n.l;
|
||||
}
|
||||
if (n.hasOwnProperty('d')) {
|
||||
node.d = n.d;
|
||||
}
|
||||
if (createNewIds) {
|
||||
if (subflow_blacklist[n.z]) {
|
||||
continue;
|
||||
@ -1072,7 +1108,7 @@ RED.nodes = (function() {
|
||||
color:"#fee",
|
||||
defaults: {},
|
||||
label: "unknown: "+n.type,
|
||||
labelStyle: "node_label_italic",
|
||||
labelStyle: "red-ui-flow-node-label-italic",
|
||||
outputs: n.outputs||n.wires.length,
|
||||
set: registry.getNodeSet("node-red/unknown")
|
||||
}
|
||||
@ -1158,6 +1194,7 @@ RED.nodes = (function() {
|
||||
var nodeTypeArrayReferences = {
|
||||
"catch":"scope",
|
||||
"status":"scope",
|
||||
"complete": "scope",
|
||||
"link in":"links",
|
||||
"link out":"links"
|
||||
}
|
||||
@ -1258,13 +1295,22 @@ 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<nodes.length;n++) {
|
||||
var node = nodes[n];
|
||||
if (filter.hasOwnProperty("z") && node.z !== filter.z) {
|
||||
for (var n=0;n<searchSet.length;n++) {
|
||||
var node = searchSet[n];
|
||||
if (filter.hasOwnProperty("type") && node.type !== filter.type) {
|
||||
continue;
|
||||
}
|
||||
if (filter.hasOwnProperty("type") && node.type !== filter.type) {
|
||||
if (doZFilter && node.z !== filter.z) {
|
||||
continue;
|
||||
}
|
||||
result.push(node);
|
||||
@ -1331,6 +1377,7 @@ RED.nodes = (function() {
|
||||
function clear() {
|
||||
nodes = [];
|
||||
links = [];
|
||||
nodeTabMap = {};
|
||||
configNodes = {};
|
||||
workspacesOrder = [];
|
||||
var subflowIds = Object.keys(subflows);
|
||||
@ -1440,6 +1487,8 @@ RED.nodes = (function() {
|
||||
remove: removeNode,
|
||||
clear: clear,
|
||||
|
||||
moveNodeToTab: moveNodeToTab,
|
||||
|
||||
addLink: addLink,
|
||||
removeLink: removeLink,
|
||||
|
||||
|
@ -38,11 +38,14 @@ var RED = (function() {
|
||||
newScript.onload = function() {
|
||||
scriptCount--;
|
||||
if (scriptCount === 0) {
|
||||
$("body").append(nodeConfigEls);
|
||||
$("#red-ui-editor-node-configs").append(nodeConfigEls);
|
||||
done()
|
||||
}
|
||||
}
|
||||
$('body').append(newScript);
|
||||
if ($(el).attr('type') === "module") {
|
||||
newScript.type = "module";
|
||||
}
|
||||
$("#red-ui-editor-node-configs").append(newScript);
|
||||
newScript.src = RED.settings.apiRootUrl+srcUrl;
|
||||
hasDeferred = true;
|
||||
} else {
|
||||
@ -58,7 +61,7 @@ var RED = (function() {
|
||||
}
|
||||
})
|
||||
if (!hasDeferred) {
|
||||
$("body").append(nodeConfigEls);
|
||||
$("#red-ui-editor-node-configs").append(nodeConfigEls);
|
||||
done();
|
||||
}
|
||||
} catch(err) {
|
||||
@ -104,9 +107,12 @@ var RED = (function() {
|
||||
}
|
||||
|
||||
function loadNodes() {
|
||||
var lang = localStorage.getItem("editor-language")||i18n.detectLanguage();
|
||||
|
||||
$.ajax({
|
||||
headers: {
|
||||
"Accept":"text/html"
|
||||
"Accept":"text/html",
|
||||
"Accept-Language": lang
|
||||
},
|
||||
cache: false,
|
||||
url: 'nodes',
|
||||
@ -114,10 +120,10 @@ var RED = (function() {
|
||||
var configs = data.trim().split(/(?=<!-- --- \[red-module:\S+\] --- -->)/);
|
||||
var stepConfig = function() {
|
||||
if (configs.length === 0) {
|
||||
$("body").i18n();
|
||||
$("#palette > .palette-spinner").hide();
|
||||
$(".palette-scroll").removeClass("hide");
|
||||
$("#palette-search").removeClass("hide");
|
||||
$("#red-ui-editor").i18n();
|
||||
$("#red-ui-palette > .red-ui-palette-spinner").hide();
|
||||
$(".red-ui-palette-scroll").removeClass("hide");
|
||||
$("#red-ui-palette-search").removeClass("hide");
|
||||
loadFlows(function() {
|
||||
if (RED.settings.theme("projects.enabled",false)) {
|
||||
RED.projects.refresh(function(activeProject) {
|
||||
@ -347,12 +353,11 @@ var RED = (function() {
|
||||
var parts = topic.split("/");
|
||||
var node = RED.nodes.node(parts[1]);
|
||||
if (node) {
|
||||
if (msg.hasOwnProperty("text")) {
|
||||
if (msg.text[0] !== ".") {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
}
|
||||
if (msg.hasOwnProperty("text") && /^[a-zA-Z]/.test(msg.text)) {
|
||||
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
|
||||
}
|
||||
node.status = msg;
|
||||
node.dirtyStatus = true;
|
||||
node.dirty = true;
|
||||
RED.view.redraw();
|
||||
}
|
||||
@ -433,7 +438,7 @@ var RED = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
function loadEditor() {
|
||||
function buildMainMenu() {
|
||||
var menuOptions = [];
|
||||
if (RED.settings.theme("projects.enabled",false)) {
|
||||
menuOptions.push({id:"menu-item-projects-menu",label:RED._("menu.label.projects"),options:[
|
||||
@ -442,34 +447,20 @@ var RED = (function() {
|
||||
{id:"menu-item-projects-settings",label:RED._("menu.label.projects-settings"),disabled:false,onselect:"core:show-project-settings"}
|
||||
]});
|
||||
}
|
||||
|
||||
|
||||
menuOptions.push({id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
|
||||
// {id:"menu-item-view-show-grid",setting:"view-show-grid",label:RED._("menu.label.view.showGrid"),toggle:true,onselect:"core:toggle-show-grid"},
|
||||
// {id:"menu-item-view-snap-grid",setting:"view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:"core:toggle-snap-grid"},
|
||||
// {id:"menu-item-status",setting:"node-show-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:"core:toggle-status", selected: true},
|
||||
//null,
|
||||
// {id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[
|
||||
// {id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}},
|
||||
// {id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
|
||||
// {id:"menu-item-bidi-rtl",toggle:"text-direction",label:RED._("menu.label.view.rtl"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("rtl")}}},
|
||||
// {id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}}
|
||||
// ]},
|
||||
// null,
|
||||
{id:"menu-item-palette",label:RED._("menu.label.palette.show"),toggle:true,onselect:"core:toggle-palette", selected: true},
|
||||
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:"core:toggle-sidebar", selected: true},
|
||||
{id:"menu-item-event-log",label:RED._("eventLog.title"),onselect:"core:show-event-log"},
|
||||
{id:"menu-item-action-list",label:RED._("keyboard.actionList"),onselect:"core:show-action-list"},
|
||||
null
|
||||
]});
|
||||
menuOptions.push(null);
|
||||
menuOptions.push({id:"menu-item-import",label:RED._("menu.label.import"),options:[
|
||||
{id:"menu-item-import-clipboard",label:RED._("menu.label.clipboard"),onselect:"core:show-import-dialog"},
|
||||
{id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]}
|
||||
]});
|
||||
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),options:[
|
||||
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),onselect:"core:show-export-dialog"},
|
||||
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:"core:library-export"}
|
||||
]});
|
||||
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(null);
|
||||
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:"core:search"});
|
||||
menuOptions.push(null);
|
||||
@ -492,7 +483,9 @@ var RED = (function() {
|
||||
menuOptions.push({id:"menu-item-user-settings",label:RED._("menu.label.settings"),onselect:"core:show-user-settings"});
|
||||
menuOptions.push(null);
|
||||
|
||||
menuOptions.push({id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:"core:show-help"});
|
||||
if (RED.settings.theme("menu.menu-item-keyboard-shortcuts", true)) {
|
||||
menuOptions.push({id: "menu-item-keyboard-shortcuts", label: RED._("menu.label.keyboardShortcuts"), onselect: "core:show-help"});
|
||||
}
|
||||
menuOptions.push({id:"menu-item-help",
|
||||
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")
|
||||
@ -500,13 +493,24 @@ var RED = (function() {
|
||||
menuOptions.push({id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: "core:show-about" });
|
||||
|
||||
|
||||
$('<li><a id="red-ui-header-button-sidemenu" class="button" href="#"><i class="fa fa-bars"></i></a></li>').appendTo(".red-ui-header-toolbar")
|
||||
RED.menu.init({id:"red-ui-header-button-sidemenu",options: menuOptions});
|
||||
|
||||
}
|
||||
|
||||
function loadEditor() {
|
||||
|
||||
RED.workspaces.init();
|
||||
RED.statusBar.init();
|
||||
RED.view.init();
|
||||
RED.userSettings.init();
|
||||
RED.user.init();
|
||||
RED.notifications.init();
|
||||
RED.library.init();
|
||||
RED.keyboard.init();
|
||||
RED.palette.init();
|
||||
RED.eventLog.init();
|
||||
|
||||
if (RED.settings.theme('palette.editable') !== false) {
|
||||
RED.palette.editor.init();
|
||||
} else {
|
||||
@ -522,27 +526,57 @@ var RED = (function() {
|
||||
}
|
||||
|
||||
RED.subflow.init();
|
||||
RED.workspaces.init();
|
||||
RED.clipboard.init();
|
||||
RED.search.init();
|
||||
RED.actionList.init();
|
||||
RED.editor.init();
|
||||
RED.diff.init();
|
||||
|
||||
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
|
||||
|
||||
RED.deploy.init(RED.settings.theme("deployButton",null));
|
||||
RED.notifications.init();
|
||||
|
||||
RED.actions.add("core:show-about", showAbout);
|
||||
buildMainMenu();
|
||||
|
||||
RED.nodes.init();
|
||||
RED.comms.connect();
|
||||
|
||||
$("#main-container").show();
|
||||
$(".header-toolbar").show();
|
||||
$("#red-ui-main-container").show();
|
||||
$(".red-ui-header-toolbar").show();
|
||||
|
||||
RED.actions.add("core:show-about", showAbout);
|
||||
|
||||
loadNodeList();
|
||||
}
|
||||
|
||||
function buildEditor(options) {
|
||||
var header = $('<div id="red-ui-header"></div>').appendTo(options.target);
|
||||
var logo = $('<span class="red-ui-header-logo"></span>').appendTo(header);
|
||||
$('<ul class="red-ui-header-toolbar hide"></ul>').appendTo(header);
|
||||
$('<div id="red-ui-header-shade" class="hide"></div>').appendTo(header);
|
||||
$('<div id="red-ui-main-container" class="red-ui-sidebar-closed hide">'+
|
||||
'<div id="red-ui-workspace"></div>'+
|
||||
'<div id="red-ui-editor-stack"></div>'+
|
||||
'<div id="red-ui-palette"></div>'+
|
||||
'<div id="red-ui-sidebar"></div>'+
|
||||
'<div id="red-ui-sidebar-separator"></div>'+
|
||||
'</div>').appendTo(options.target);
|
||||
$('<div id="red-ui-editor-node-configs"></div>').appendTo(options.target);
|
||||
$('<div id="red-ui-full-shade" class="hide"></div>').appendTo(options.target);
|
||||
$.getJSON(options.apiRootUrl+"theme", function(theme) {
|
||||
if (theme.header) {
|
||||
if (theme.header.url) {
|
||||
logo = $("<a>",{href:theme.header.url}).appendTo(logo);
|
||||
}
|
||||
if (theme.header.image) {
|
||||
$('<img>',{src:theme.header.image}).appendTo(logo);
|
||||
}
|
||||
if (theme.header.title) {
|
||||
$('<span>').html(theme.header.title).appendTo(logo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var initialised = false;
|
||||
|
||||
function init(options) {
|
||||
@ -556,6 +590,10 @@ var RED = (function() {
|
||||
if (options.apiRootUrl && !/\/$/.test(options.apiRootUrl)) {
|
||||
options.apiRootUrl = options.apiRootUrl+"/";
|
||||
}
|
||||
options.target = $("#red-ui-editor");
|
||||
options.target.addClass("red-ui-editor");
|
||||
|
||||
buildEditor(options);
|
||||
RED.i18n.init(options, function() {
|
||||
RED.settings.init(options, loadEditor);
|
||||
})
|
||||
|
@ -37,7 +37,7 @@ RED.settings = (function () {
|
||||
if (key === "auth-tokens") {
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
} else {
|
||||
userSettings[key] = value;
|
||||
RED.utils.setMessageProperty(userSettings,key,value);
|
||||
saveUserSettings();
|
||||
}
|
||||
};
|
||||
@ -46,16 +46,25 @@ RED.settings = (function () {
|
||||
* If the key is not set in the localStorage it returns <i>undefined</i>
|
||||
* Else return the JSON parsed value
|
||||
* @param key
|
||||
* @param defaultIfUndefined
|
||||
* @returns {*}
|
||||
*/
|
||||
var get = function (key) {
|
||||
var get = function (key,defaultIfUndefined) {
|
||||
if (!hasLocalStorage()) {
|
||||
return undefined;
|
||||
}
|
||||
if (key === "auth-tokens") {
|
||||
return JSON.parse(localStorage.getItem(key));
|
||||
} else {
|
||||
return userSettings[key];
|
||||
try {
|
||||
var v = RED.utils.getMessageProperty(userSettings,key);
|
||||
if (v === undefined) {
|
||||
v = defaultIfUndefined;
|
||||
}
|
||||
} catch(err) {
|
||||
v = defaultIfUndefined;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
@ -131,6 +140,12 @@ RED.settings = (function () {
|
||||
RED.settings.remove("auth-tokens");
|
||||
}
|
||||
console.log("Node-RED: " + data.version);
|
||||
console.groupCollapsed("Versions");
|
||||
console.log("jQuery",$().jquery)
|
||||
console.log("jQuery UI",$.ui.version);
|
||||
console.log("ACE",ace.version);
|
||||
console.log("D3",d3.version);
|
||||
console.groupEnd();
|
||||
loadUserSettings(done);
|
||||
},
|
||||
error: function(jqXHR,textStatus,errorThrown) {
|
||||
|
@ -97,14 +97,14 @@ RED.text.bidi = (function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enforces the text direction for all the spans with style bidiAware under
|
||||
* Enforces the text direction for all the spans with style red-ui-text-bidi-aware under
|
||||
* workspace or sidebar div
|
||||
*/
|
||||
function enforceTextDirectionOnPage() {
|
||||
$("#workspace").find('span.bidiAware').each(function() {
|
||||
$("#red-ui-workspace").find('span.red-ui-text-bidi-aware').each(function() {
|
||||
$(this).attr("dir", resolveBaseTextDir($(this).html()));
|
||||
});
|
||||
$("#sidebar").find('span.bidiAware').each(function() {
|
||||
$("#red-ui-sidebar").find('span.red-ui-text-bidi-aware').each(function() {
|
||||
$(this).attr("dir", resolveBaseTextDir($(this).text()));
|
||||
});
|
||||
}
|
||||
|
230
packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js
vendored
Normal file
@ -0,0 +1,230 @@
|
||||
/**
|
||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
RED.actionList = (function() {
|
||||
|
||||
var disabled = false;
|
||||
var dialog = null;
|
||||
var searchInput;
|
||||
var searchResults;
|
||||
var selected = -1;
|
||||
var visible = false;
|
||||
|
||||
var filterTerm = "";
|
||||
var filterTerms = [];
|
||||
var previousActiveElement;
|
||||
|
||||
function ensureSelectedIsVisible() {
|
||||
var selectedEntry = searchResults.find("li.selected");
|
||||
if (selectedEntry.length === 1) {
|
||||
var scrollWindow = searchResults.parent();
|
||||
var scrollHeight = scrollWindow.height();
|
||||
var scrollOffset = scrollWindow.scrollTop();
|
||||
var y = selectedEntry.position().top;
|
||||
var h = selectedEntry.height();
|
||||
if (y+h > scrollHeight) {
|
||||
scrollWindow.animate({scrollTop: '-='+(scrollHeight-(y+h)-10)},50);
|
||||
} else if (y<0) {
|
||||
scrollWindow.animate({scrollTop: '+='+(y-10)},50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createDialog() {
|
||||
dialog = $("<div>",{id:"red-ui-actionList",class:"red-ui-search"}).appendTo("#red-ui-main-container");
|
||||
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(" ");
|
||||
searchResults.editableList('filter');
|
||||
searchResults.find("li.selected").removeClass("selected");
|
||||
var children = searchResults.children(":visible");
|
||||
if (children.length) {
|
||||
$(children[0]).addClass('selected');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
searchInput.on('keydown',function(evt) {
|
||||
var selectedChild;
|
||||
if (evt.keyCode === 40) {
|
||||
// Down
|
||||
selectedChild = searchResults.find("li.selected");
|
||||
if (!selectedChild.length) {
|
||||
var children = searchResults.children(":visible");
|
||||
if (children.length) {
|
||||
$(children[0]).addClass('selected');
|
||||
}
|
||||
} else {
|
||||
var nextChild = selectedChild.nextAll(":visible").first();
|
||||
if (nextChild.length) {
|
||||
selectedChild.removeClass('selected');
|
||||
nextChild.addClass('selected');
|
||||
}
|
||||
}
|
||||
ensureSelectedIsVisible();
|
||||
evt.preventDefault();
|
||||
} else if (evt.keyCode === 38) {
|
||||
// Up
|
||||
selectedChild = searchResults.find("li.selected");
|
||||
var nextChild = selectedChild.prevAll(":visible").first();
|
||||
if (nextChild.length) {
|
||||
selectedChild.removeClass('selected');
|
||||
nextChild.addClass('selected');
|
||||
}
|
||||
ensureSelectedIsVisible();
|
||||
evt.preventDefault();
|
||||
} else if (evt.keyCode === 13) {
|
||||
// Enter
|
||||
selectedChild = searchResults.find("li.selected");
|
||||
selectCommand(searchResults.editableList('getItem',selectedChild));
|
||||
}
|
||||
});
|
||||
searchInput.i18n();
|
||||
|
||||
var searchResultsDiv = $("<div>",{class:"red-ui-search-results-container"}).appendTo(dialog);
|
||||
searchResults = $('<ol>',{style:"position: absolute;top: 5px;bottom: 5px;left: 5px;right: 5px;"}).appendTo(searchResultsDiv).editableList({
|
||||
addButton: false,
|
||||
addItem: function(container,i,action) {
|
||||
if (action.id === undefined) {
|
||||
$('<div>',{class:"red-ui-search-empty"}).text(RED._('search.empty')).appendTo(container);
|
||||
} else {
|
||||
var div = $('<a>',{href:'#',class:"red-ui-search-result"}).appendTo(container);
|
||||
var contentDiv = $('<div>',{class:"red-ui-search-result-action"}).appendTo(div);
|
||||
|
||||
|
||||
$('<div>').text(action.label).appendTo(contentDiv);
|
||||
// $('<div>',{class:"red-ui-search-result-node-type"}).text(node.type).appendTo(contentDiv);
|
||||
// $('<div>',{class:"red-ui-search-result-node-id"}).text(node.id).appendTo(contentDiv);
|
||||
if (action.key) {
|
||||
$('<div>',{class:"red-ui-search-result-action-key"}).html(RED.keyboard.formatKey(action.key)).appendTo(contentDiv);
|
||||
}
|
||||
div.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
selectCommand(action);
|
||||
});
|
||||
}
|
||||
},
|
||||
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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function selectCommand(command) {
|
||||
hide();
|
||||
if (command) {
|
||||
RED.actions.invoke(command.id);
|
||||
}
|
||||
}
|
||||
|
||||
function show(v) {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
if (!visible) {
|
||||
previousActiveElement = document.activeElement;
|
||||
RED.keyboard.add("*","escape",function(){hide()});
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
$("#red-ui-palette-shade").show();
|
||||
$("#red-ui-sidebar-shade").show();
|
||||
$("#red-ui-sidebar-separator").hide();
|
||||
if (dialog === null) {
|
||||
createDialog();
|
||||
}
|
||||
dialog.slideDown(300);
|
||||
searchInput.searchBox('value',v)
|
||||
searchResults.editableList('empty');
|
||||
results = [];
|
||||
var actions = RED.actions.list();
|
||||
actions.sort(function(A,B) {
|
||||
return A.id.localeCompare(B.id);
|
||||
});
|
||||
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() {
|
||||
if (visible) {
|
||||
RED.keyboard.remove("escape");
|
||||
visible = false;
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
$("#red-ui-sidebar-shade").hide();
|
||||
$("#red-ui-sidebar-separator").show();
|
||||
if (dialog !== null) {
|
||||
dialog.slideUp(200,function() {
|
||||
searchInput.searchBox('value','');
|
||||
});
|
||||
}
|
||||
RED.events.emit("actionList:close");
|
||||
if (previousActiveElement) {
|
||||
$(previousActiveElement).trigger("focus");
|
||||
previousActiveElement = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
RED.actions.add("core:show-action-list",show);
|
||||
|
||||
RED.events.on("editor:open",function() { disabled = true; });
|
||||
RED.events.on("editor:close",function() { disabled = false; });
|
||||
RED.events.on("search:open",function() { disabled = true; });
|
||||
RED.events.on("search:close",function() { disabled = false; });
|
||||
RED.events.on("type-search:open",function() { disabled = true; });
|
||||
RED.events.on("type-search:close",function() { disabled = false; });
|
||||
|
||||
$("#red-ui-header-shade").on('mousedown',hide);
|
||||
$("#red-ui-editor-shade").on('mousedown',hide);
|
||||
$("#red-ui-palette-shade").on('mousedown',hide);
|
||||
$("#red-ui-sidebar-shade").on('mousedown',hide);
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
show: show,
|
||||
hide: hide
|
||||
};
|
||||
|
||||
})();
|
@ -24,38 +24,38 @@ RED.clipboard = (function() {
|
||||
var disabled = false;
|
||||
var popover;
|
||||
var currentPopoverError;
|
||||
var activeTab;
|
||||
var libraryBrowser;
|
||||
var examplesBrowser;
|
||||
|
||||
function setupDialogs() {
|
||||
dialog = $('<div id="clipboard-dialog" class="hide node-red-dialog"><form class="dialog-form form-horizontal"></form></div>')
|
||||
.appendTo("body")
|
||||
dialog = $('<div id="red-ui-clipboard-dialog" class="hide"><form class="dialog-form form-horizontal"></form></div>')
|
||||
.appendTo("#red-ui-editor")
|
||||
.dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 500,
|
||||
width: 700,
|
||||
resizable: false,
|
||||
classes: {
|
||||
"ui-dialog": "red-ui-editor-dialog",
|
||||
"ui-dialog-titlebar-close": "hide",
|
||||
"ui-widget-overlay": "red-ui-editor-dialog"
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
id: "clipboard-dialog-cancel",
|
||||
id: "red-ui-clipboard-dialog-cancel",
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "clipboard-dialog-close",
|
||||
class: "primary",
|
||||
text: RED._("common.label.close"),
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "clipboard-dialog-download",
|
||||
id: "red-ui-clipboard-dialog-download",
|
||||
class: "primary",
|
||||
text: RED._("clipboard.download"),
|
||||
click: function() {
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent($("#clipboard-export").val()));
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent($("#red-ui-clipboard-dialog-export-text").val()));
|
||||
element.setAttribute('download', "flows.json");
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
@ -65,30 +65,100 @@ RED.clipboard = (function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "clipboard-dialog-copy",
|
||||
id: "red-ui-clipboard-dialog-export",
|
||||
class: "primary",
|
||||
text: RED._("clipboard.export.copy"),
|
||||
click: function() {
|
||||
$("#clipboard-export").select();
|
||||
document.execCommand("copy");
|
||||
document.getSelection().removeAllRanges();
|
||||
RED.notify(RED._("clipboard.nodesExported"),{id:"clipboard"});
|
||||
$( this ).dialog( "close" );
|
||||
if (activeTab === "red-ui-clipboard-dialog-export-tab-clipboard") {
|
||||
$("#red-ui-clipboard-dialog-export-text").select();
|
||||
document.execCommand("copy");
|
||||
document.getSelection().removeAllRanges();
|
||||
RED.notify(RED._("clipboard.nodesExported"),{id:"clipboard"});
|
||||
$( this ).dialog( "close" );
|
||||
} else {
|
||||
var flowToExport = $("#red-ui-clipboard-dialog-export-text").val();
|
||||
var selectedPath = libraryBrowser.getSelected();
|
||||
if (!selectedPath.children) {
|
||||
selectedPath = selectedPath.parent;
|
||||
}
|
||||
var filename = $("#red-ui-clipboard-dialog-tab-library-name").val().trim();
|
||||
var saveFlow = function() {
|
||||
$.ajax({
|
||||
url:'library/'+selectedPath.library+'/'+selectedPath.type+'/'+selectedPath.path + filename,
|
||||
type: "POST",
|
||||
data: flowToExport,
|
||||
contentType: "application/json; charset=utf-8"
|
||||
}).done(function() {
|
||||
$(dialog).dialog( "close" );
|
||||
RED.notify(RED._("library.exportedToLibrary"),"success");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("library.saveFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
} else {
|
||||
RED.notify(RED._("library.saveFailed",{message:xhr.responseText}),"error");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (selectedPath.children) {
|
||||
var exists = false;
|
||||
selectedPath.children.forEach(function(f) {
|
||||
if (f.label === filename) {
|
||||
exists = true;
|
||||
}
|
||||
});
|
||||
if (exists) {
|
||||
dialog.dialog("close");
|
||||
var notification = RED.notify(RED._("clipboard.export.exists",{file:RED.utils.sanitize(filename)}),{
|
||||
type: "warning",
|
||||
fixed: true,
|
||||
buttons: [{
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
notification.hideNotification()
|
||||
dialog.dialog( "open" );
|
||||
}
|
||||
},{
|
||||
text: RED._("clipboard.export.overwrite"),
|
||||
click: function() {
|
||||
notification.hideNotification()
|
||||
saveFlow();
|
||||
}
|
||||
}]
|
||||
});
|
||||
} else {
|
||||
saveFlow();
|
||||
}
|
||||
} else {
|
||||
saveFlow();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "clipboard-dialog-ok",
|
||||
id: "red-ui-clipboard-dialog-ok",
|
||||
class: "primary",
|
||||
text: RED._("common.label.import"),
|
||||
click: function() {
|
||||
RED.view.importNodes($("#clipboard-import").val(),$("#import-tab > a.selected").attr('id') === 'import-tab-new');
|
||||
var addNewFlow = ($("#red-ui-clipboard-dialog-import-opt > a.selected").attr('id') === 'red-ui-clipboard-dialog-import-opt-new');
|
||||
if (activeTab === "red-ui-clipboard-dialog-import-tab-clipboard") {
|
||||
RED.view.importNodes($("#red-ui-clipboard-dialog-import-text").val(),addNewFlow);
|
||||
} else {
|
||||
var selectedPath;
|
||||
if (activeTab === "red-ui-clipboard-dialog-import-tab-library") {
|
||||
selectedPath = libraryBrowser.getSelected();
|
||||
} else {
|
||||
selectedPath = examplesBrowser.getSelected();
|
||||
}
|
||||
if (selectedPath.path) {
|
||||
$.get('library/'+selectedPath.library+'/'+selectedPath.type+'/'+selectedPath.path, function(data) {
|
||||
RED.view.importNodes(data,addNewFlow);
|
||||
});
|
||||
}
|
||||
}
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
],
|
||||
open: function(e) {
|
||||
$(this).parent().find(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
close: function(e) {
|
||||
if (popover) {
|
||||
popover.close(true);
|
||||
@ -101,152 +171,281 @@ RED.clipboard = (function() {
|
||||
|
||||
exportNodesDialog =
|
||||
'<div class="form-row">'+
|
||||
'<label style="width:auto;margin-right: 10px;" data-i18n="clipboard.export.copy"></label>'+
|
||||
'<span id="export-range-group" class="button-group">'+
|
||||
'<a id="export-range-selected" class="editor-button toggle" href="#" data-i18n="clipboard.export.selected"></a>'+
|
||||
'<a id="export-range-flow" class="editor-button toggle" href="#" data-i18n="clipboard.export.current"></a>'+
|
||||
'<a id="export-range-full" class="editor-button toggle" href="#" data-i18n="clipboard.export.all"></a>'+
|
||||
'<label style="width:auto;margin-right: 10px;" data-i18n="common.label.export"></label>'+
|
||||
'<span id="red-ui-clipboard-dialog-export-rng-group" class="button-group">'+
|
||||
'<a id="red-ui-clipboard-dialog-export-rng-selected" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.selected"></a>'+
|
||||
'<a id="red-ui-clipboard-dialog-export-rng-flow" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.current"></a>'+
|
||||
'<a id="red-ui-clipboard-dialog-export-rng-full" class="red-ui-button toggle" href="#" data-i18n="clipboard.export.all"></a>'+
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<textarea readonly style="resize: none; width: 100%; border-radius: 4px;font-family: monospace; font-size: 12px; background:#f3f3f3; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-export" rows="5"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="form-row" style="text-align: right;">'+
|
||||
'<span id="export-format-group" class="button-group">'+
|
||||
'<a id="export-format-mini" class="editor-button editor-button-small toggle" href="#" data-i18n="clipboard.export.compact"></a>'+
|
||||
'<a id="export-format-full" class="editor-button editor-button-small toggle" href="#" data-i18n="clipboard.export.formatted"></a>'+
|
||||
'</span>'+
|
||||
'</div>';
|
||||
'<div class="red-ui-clipboard-dialog-box">'+
|
||||
'<div class="red-ui-clipboard-dialog-tabs">'+
|
||||
'<ul id="red-ui-clipboard-dialog-export-tabs"></ul>'+
|
||||
'</div>'+
|
||||
'<div id="red-ui-clipboard-dialog-export-tabs-content" class="red-ui-clipboard-dialog-tabs-content">'+
|
||||
'<div id="red-ui-clipboard-dialog-export-tab-clipboard" class="red-ui-clipboard-dialog-tab-clipboard">'+
|
||||
'<div class="form-row">'+
|
||||
'<textarea readonly id="red-ui-clipboard-dialog-export-text"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="form-row" style="text-align: right;">'+
|
||||
'<span id="red-ui-clipboard-dialog-export-fmt-group" class="button-group">'+
|
||||
'<a id="red-ui-clipboard-dialog-export-fmt-mini" class="red-ui-button red-ui-button-small toggle" href="#" data-i18n="clipboard.export.compact"></a>'+
|
||||
'<a id="red-ui-clipboard-dialog-export-fmt-full" class="red-ui-button red-ui-button-small toggle" href="#" data-i18n="clipboard.export.formatted"></a>'+
|
||||
'</span>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<div id="red-ui-clipboard-dialog-export-tab-library" class="red-ui-clipboard-dialog-tab-library">'+
|
||||
'<div id="red-ui-clipboard-dialog-export-tab-library-browser"></div>'+
|
||||
'<div class="form-row">'+
|
||||
'<label data-i18n="clipboard.export.exportAs"></label><input id="red-ui-clipboard-dialog-tab-library-name" type="text">'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>'
|
||||
;
|
||||
|
||||
|
||||
importNodesDialog =
|
||||
'<div class="form-row"><span data-i18n="clipboard.pasteNodes"></span>'+
|
||||
' <a class="editor-button" id="import-file-upload-btn"><i class="fa fa-upload"></i> <span data-i18n="clipboard.selectFile"></span></a>'+
|
||||
'<input type="file" id="import-file-upload" accept=".json" style="display:none">'+
|
||||
'<div class="red-ui-clipboard-dialog-box" style="margin-bottom: 12px">'+
|
||||
'<div class="red-ui-clipboard-dialog-tabs">'+
|
||||
'<ul id="red-ui-clipboard-dialog-import-tabs"></ul>'+
|
||||
'</div>'+
|
||||
'<div id="red-ui-clipboard-dialog-import-tabs-content" class="red-ui-clipboard-dialog-tabs-content">'+
|
||||
'<div id="red-ui-clipboard-dialog-import-tab-clipboard" class="red-ui-clipboard-dialog-tab-clipboard">'+
|
||||
'<div class="form-row"><span data-i18n="clipboard.pasteNodes"></span>'+
|
||||
' <a class="red-ui-button" id="red-ui-clipboard-dialog-import-file-upload-btn"><i class="fa fa-upload"></i> <span data-i18n="clipboard.selectFile"></span></a>'+
|
||||
'<input type="file" id="red-ui-clipboard-dialog-import-file-upload" accept=".json" style="display:none">'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<textarea id="red-ui-clipboard-dialog-import-text"></textarea>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<div id="red-ui-clipboard-dialog-import-tab-library" class="red-ui-clipboard-dialog-tab-library"></div>'+
|
||||
'<div id="red-ui-clipboard-dialog-import-tab-examples" class="red-ui-clipboard-dialog-tab-library"></div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<textarea style="resize: none; width: 100%; border-radius: 0px;font-family: monospace; font-size: 12px; background:#eee; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-import" rows="5"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="form-row">'+
|
||||
'<label style="width:auto;margin-right: 10px;" data-i18n="clipboard.import.import"></label>'+
|
||||
'<span id="import-tab" class="button-group">'+
|
||||
'<a id="import-tab-current" class="editor-button toggle selected" href="#" data-i18n="clipboard.export.current"></a>'+
|
||||
'<a id="import-tab-new" class="editor-button toggle" href="#" data-i18n="clipboard.import.newFlow"></a>'+
|
||||
'</span>'+
|
||||
'<label style="width:auto;margin-right: 10px;" data-i18n="clipboard.import.import"></label>'+
|
||||
'<span id="red-ui-clipboard-dialog-import-opt" class="button-group">'+
|
||||
'<a id="red-ui-clipboard-dialog-import-opt-current" class="red-ui-button toggle selected" href="#" data-i18n="clipboard.export.current"></a>'+
|
||||
'<a id="red-ui-clipboard-dialog-import-opt-new" class="red-ui-button toggle" href="#" data-i18n="clipboard.import.newFlow"></a>'+
|
||||
'</span>'+
|
||||
'</div>';
|
||||
|
||||
}
|
||||
|
||||
var validateImportTimeout;
|
||||
|
||||
function validateImport() {
|
||||
if (validateImportTimeout) {
|
||||
clearTimeout(validateImportTimeout);
|
||||
var validateExportFilenameTimeout
|
||||
function validateExportFilename() {
|
||||
if (validateExportFilenameTimeout) {
|
||||
clearTimeout(validateExportFilenameTimeout);
|
||||
}
|
||||
validateImportTimeout = setTimeout(function() {
|
||||
var importInput = $("#clipboard-import");
|
||||
var v = importInput.val().trim();
|
||||
if (v === "") {
|
||||
popover.close(true);
|
||||
currentPopoverError = null;
|
||||
importInput.removeClass("input-error");
|
||||
$("#clipboard-dialog-ok").button("disable");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!/^\[[\s\S]*\]$/m.test(v)) {
|
||||
throw new Error(RED._("clipboard.import.errors.notArray"));
|
||||
}
|
||||
var res = JSON.parse(v);
|
||||
for (var i=0;i<res.length;i++) {
|
||||
if (typeof res[i] !== "object") {
|
||||
throw new Error(RED._("clipboard.import.errors.itemNotObject",{index:i}));
|
||||
}
|
||||
if (!res[i].hasOwnProperty('id')) {
|
||||
throw new Error(RED._("clipboard.import.errors.missingId",{index:i}));
|
||||
}
|
||||
if (!res[i].hasOwnProperty('type')) {
|
||||
throw new Error(RED._("clipboard.import.errors.missingType",{index:i}));
|
||||
}
|
||||
}
|
||||
currentPopoverError = null;
|
||||
popover.close(true);
|
||||
importInput.removeClass("input-error");
|
||||
importInput.val(v);
|
||||
$("#clipboard-dialog-ok").button("enable");
|
||||
} catch(err) {
|
||||
if (v !== "") {
|
||||
importInput.addClass("input-error");
|
||||
var errString = err.toString();
|
||||
if (errString !== currentPopoverError) {
|
||||
// Display the error as-is.
|
||||
// Error messages are only in English. Each browser has its
|
||||
// own set of messages with very little consistency.
|
||||
// To provide translated messages this code will either need to:
|
||||
// - reduce everything down to 'unexpected token at position x'
|
||||
// which is the least useful, but most consistent message
|
||||
// - use a custom/library parser that gives consistent messages
|
||||
// which can be translated.
|
||||
var message = $('<div class="clipboard-import-error"></div>').text(errString);
|
||||
var errorPos;
|
||||
// Chrome error messages
|
||||
var m = /at position (\d+)/i.exec(errString);
|
||||
if (m) {
|
||||
errorPos = parseInt(m[1]);
|
||||
} else {
|
||||
// Firefox error messages
|
||||
m = /at line (\d+) column (\d+)/i.exec(errString);
|
||||
if (m) {
|
||||
var line = parseInt(m[1])-1;
|
||||
var col = parseInt(m[2])-1;
|
||||
var lines = v.split("\n");
|
||||
errorPos = 0;
|
||||
for (var i=0;i<line;i++) {
|
||||
errorPos += lines[i].length+1;
|
||||
}
|
||||
errorPos += col;
|
||||
} else {
|
||||
// Safari doesn't provide any position information
|
||||
// IE: tbd
|
||||
}
|
||||
}
|
||||
|
||||
if (errorPos !== undefined) {
|
||||
v = v.replace(/\n/g,"↵");
|
||||
var index = parseInt(m[1]);
|
||||
var parseError = $('<div>').appendTo(message);
|
||||
var code = $('<pre>').appendTo(parseError);
|
||||
$('<span>').text(v.substring(errorPos-12,errorPos)).appendTo(code)
|
||||
$('<span class="error">').text(v.charAt(errorPos)).appendTo(code);
|
||||
$('<span>').text(v.substring(errorPos+1,errorPos+12)).appendTo(code);
|
||||
}
|
||||
popover.close(true).setContent(message).open();
|
||||
currentPopoverError = errString;
|
||||
}
|
||||
} else {
|
||||
currentPopoverError = null;
|
||||
}
|
||||
$("#clipboard-dialog-ok").button("disable");
|
||||
validateExportFilenameTimeout = setTimeout(function() {
|
||||
var filenameInput = $("#red-ui-clipboard-dialog-tab-library-name");
|
||||
var filename = filenameInput.val().trim();
|
||||
var valid = filename.length > 0 && !/[\/\\]/.test(filename);
|
||||
if (valid) {
|
||||
filenameInput.removeClass("input-error");
|
||||
$("#red-ui-clipboard-dialog-export").button("enable");
|
||||
} else {
|
||||
filenameInput.addClass("input-error");
|
||||
$("#red-ui-clipboard-dialog-export").button("disable");
|
||||
}
|
||||
},100);
|
||||
}
|
||||
|
||||
function importNodes() {
|
||||
var validateImportTimeout;
|
||||
function validateImport() {
|
||||
if (activeTab === "red-ui-clipboard-dialog-import-tab-clipboard") {
|
||||
if (validateImportTimeout) {
|
||||
clearTimeout(validateImportTimeout);
|
||||
}
|
||||
validateImportTimeout = setTimeout(function() {
|
||||
var importInput = $("#red-ui-clipboard-dialog-import-text");
|
||||
var v = importInput.val().trim();
|
||||
if (v === "") {
|
||||
popover.close(true);
|
||||
currentPopoverError = null;
|
||||
importInput.removeClass("input-error");
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!/^\[[\s\S]*\]$/m.test(v)) {
|
||||
throw new Error(RED._("clipboard.import.errors.notArray"));
|
||||
}
|
||||
var res = JSON.parse(v);
|
||||
for (var i=0;i<res.length;i++) {
|
||||
if (typeof res[i] !== "object") {
|
||||
throw new Error(RED._("clipboard.import.errors.itemNotObject",{index:i}));
|
||||
}
|
||||
if (!res[i].hasOwnProperty('id')) {
|
||||
throw new Error(RED._("clipboard.import.errors.missingId",{index:i}));
|
||||
}
|
||||
if (!res[i].hasOwnProperty('type')) {
|
||||
throw new Error(RED._("clipboard.import.errors.missingType",{index:i}));
|
||||
}
|
||||
}
|
||||
currentPopoverError = null;
|
||||
popover.close(true);
|
||||
importInput.removeClass("input-error");
|
||||
importInput.val(v);
|
||||
$("#red-ui-clipboard-dialog-ok").button("enable");
|
||||
} catch(err) {
|
||||
if (v !== "") {
|
||||
importInput.addClass("input-error");
|
||||
var errString = err.toString();
|
||||
if (errString !== currentPopoverError) {
|
||||
// Display the error as-is.
|
||||
// Error messages are only in English. Each browser has its
|
||||
// own set of messages with very little consistency.
|
||||
// To provide translated messages this code will either need to:
|
||||
// - reduce everything down to 'unexpected token at position x'
|
||||
// which is the least useful, but most consistent message
|
||||
// - use a custom/library parser that gives consistent messages
|
||||
// which can be translated.
|
||||
var message = $('<div class="red-ui-clipboard-import-error"></div>').text(errString);
|
||||
var errorPos;
|
||||
// Chrome error messages
|
||||
var m = /at position (\d+)/i.exec(errString);
|
||||
if (m) {
|
||||
errorPos = parseInt(m[1]);
|
||||
} else {
|
||||
// Firefox error messages
|
||||
m = /at line (\d+) column (\d+)/i.exec(errString);
|
||||
if (m) {
|
||||
var line = parseInt(m[1])-1;
|
||||
var col = parseInt(m[2])-1;
|
||||
var lines = v.split("\n");
|
||||
errorPos = 0;
|
||||
for (var i=0;i<line;i++) {
|
||||
errorPos += lines[i].length+1;
|
||||
}
|
||||
errorPos += col;
|
||||
} else {
|
||||
// Safari doesn't provide any position information
|
||||
// IE: tbd
|
||||
}
|
||||
}
|
||||
|
||||
if (errorPos !== undefined) {
|
||||
v = v.replace(/\n/g,"↵");
|
||||
var index = parseInt(m[1]);
|
||||
var parseError = $('<div>').appendTo(message);
|
||||
var code = $('<pre>').appendTo(parseError);
|
||||
$('<span>').text(v.substring(errorPos-12,errorPos)).appendTo(code)
|
||||
$('<span class="error">').text(v.charAt(errorPos)).appendTo(code);
|
||||
$('<span>').text(v.substring(errorPos+1,errorPos+12)).appendTo(code);
|
||||
}
|
||||
popover.close(true).setContent(message).open();
|
||||
currentPopoverError = errString;
|
||||
}
|
||||
} else {
|
||||
currentPopoverError = null;
|
||||
}
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
}
|
||||
},100);
|
||||
} else {
|
||||
var file = libraryBrowser.getSelected();
|
||||
if (file && file.label && !file.children) {
|
||||
$("#red-ui-clipboard-dialog-ok").button("enable");
|
||||
} else {
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function importNodes(mode) {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
mode = mode || "clipboard";
|
||||
|
||||
dialogContainer.empty();
|
||||
dialogContainer.append($(importNodesDialog));
|
||||
|
||||
var tabs = RED.tabs.create({
|
||||
id: "red-ui-clipboard-dialog-import-tabs",
|
||||
vertical: true,
|
||||
onchange: function(tab) {
|
||||
$("#red-ui-clipboard-dialog-import-tabs-content").children().hide();
|
||||
$("#" + tab.id).show();
|
||||
activeTab = tab.id;
|
||||
if (popover) {
|
||||
popover.close(true);
|
||||
currentPopoverError = null;
|
||||
}
|
||||
if (tab.id === "red-ui-clipboard-dialog-import-tab-clipboard") {
|
||||
$("#red-ui-clipboard-dialog-import-text").trigger("focus");
|
||||
} else {
|
||||
libraryBrowser.focus();
|
||||
}
|
||||
validateImport();
|
||||
}
|
||||
});
|
||||
tabs.addTab({
|
||||
id: "red-ui-clipboard-dialog-import-tab-clipboard",
|
||||
label: RED._("clipboard.clipboard")
|
||||
});
|
||||
tabs.addTab({
|
||||
id: "red-ui-clipboard-dialog-import-tab-library",
|
||||
label: RED._("library.library")
|
||||
});
|
||||
tabs.addTab({
|
||||
id: "red-ui-clipboard-dialog-import-tab-examples",
|
||||
label: RED._("library.types.examples")
|
||||
});
|
||||
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").on("keyup", validateExportFilename);
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").on('paste',function() { setTimeout(validateExportFilename,10)});
|
||||
$("#red-ui-clipboard-dialog-export").button("enable");
|
||||
|
||||
libraryBrowser = RED.library.createBrowser({
|
||||
container: $("#red-ui-clipboard-dialog-import-tab-library"),
|
||||
onselect: function(file) {
|
||||
if (file && file.label && !file.children) {
|
||||
$("#red-ui-clipboard-dialog-ok").button("enable");
|
||||
} else {
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
}
|
||||
},
|
||||
onconfirm: function(item) {
|
||||
if (item && item.label && !item.children) {
|
||||
$("#red-ui-clipboard-dialog-ok").trigger("click");
|
||||
}
|
||||
}
|
||||
})
|
||||
loadFlowLibrary(libraryBrowser,"local",RED._("library.types.local"));
|
||||
|
||||
examplesBrowser = RED.library.createBrowser({
|
||||
container: $("#red-ui-clipboard-dialog-import-tab-examples"),
|
||||
onselect: function(file) {
|
||||
if (file && file.label && !file.children) {
|
||||
$("#red-ui-clipboard-dialog-ok").button("enable");
|
||||
} else {
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
}
|
||||
},
|
||||
onconfirm: function(item) {
|
||||
if (item && item.label && !item.children) {
|
||||
$("#red-ui-clipboard-dialog-ok").trigger("click");
|
||||
}
|
||||
}
|
||||
})
|
||||
loadFlowLibrary(examplesBrowser,"_examples_",RED._("library.types.examples"));
|
||||
|
||||
|
||||
dialogContainer.i18n();
|
||||
|
||||
$("#clipboard-dialog-ok").show();
|
||||
$("#clipboard-dialog-cancel").show();
|
||||
$("#clipboard-dialog-close").hide();
|
||||
$("#clipboard-dialog-copy").hide();
|
||||
$("#clipboard-dialog-download").hide();
|
||||
$("#clipboard-dialog-ok").button("disable");
|
||||
$("#clipboard-import").keyup(validateImport);
|
||||
$("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)});
|
||||
$("#red-ui-clipboard-dialog-ok").show();
|
||||
$("#red-ui-clipboard-dialog-cancel").show();
|
||||
$("#red-ui-clipboard-dialog-export").hide();
|
||||
$("#red-ui-clipboard-dialog-download").hide();
|
||||
$("#red-ui-clipboard-dialog-ok").button("disable");
|
||||
$("#red-ui-clipboard-dialog-import-text").on("keyup", validateImport);
|
||||
$("#red-ui-clipboard-dialog-import-text").on('paste',function() { setTimeout(validateImport,10)});
|
||||
|
||||
$("#import-tab > a").click(function(evt) {
|
||||
$("#red-ui-clipboard-dialog-import-opt > a").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||
return;
|
||||
@ -255,66 +454,122 @@ RED.clipboard = (function() {
|
||||
$(this).addClass('selected');
|
||||
});
|
||||
|
||||
$("#import-file-upload").change(function() {
|
||||
$("#red-ui-clipboard-dialog-import-file-upload").on("change", function() {
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = function () {
|
||||
$("#clipboard-import").val(fileReader.result);
|
||||
$("#red-ui-clipboard-dialog-import-text").val(fileReader.result);
|
||||
validateImport();
|
||||
};
|
||||
fileReader.readAsText($(this).prop('files')[0]);
|
||||
})
|
||||
$("#import-file-upload-btn").click(function(evt) {
|
||||
$("#red-ui-clipboard-dialog-import-file-upload-btn").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
$("#import-file-upload").click();
|
||||
$("#red-ui-clipboard-dialog-import-file-upload").trigger("click");
|
||||
})
|
||||
|
||||
tabs.activateTab("red-ui-clipboard-dialog-import-tab-"+mode);
|
||||
if (mode === 'clipboard') {
|
||||
setTimeout(function() {
|
||||
$("#red-ui-clipboard-dialog-import-text").trigger("focus");
|
||||
},100)
|
||||
}
|
||||
|
||||
|
||||
dialog.dialog("option","title",RED._("clipboard.importNodes")).dialog("open");
|
||||
popover = RED.popover.create({
|
||||
target: $("#clipboard-import"),
|
||||
target: $("#red-ui-clipboard-dialog-import-text"),
|
||||
trigger: "manual",
|
||||
direction: "bottom",
|
||||
content: ""
|
||||
});
|
||||
}
|
||||
|
||||
function exportNodes() {
|
||||
function exportNodes(mode) {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mode = mode || "clipboard";
|
||||
|
||||
dialogContainer.empty();
|
||||
dialogContainer.append($(exportNodesDialog));
|
||||
dialogContainer.i18n();
|
||||
var format = RED.settings.flowFilePretty ? "export-format-full" : "export-format-mini";
|
||||
|
||||
$("#export-format-group > a").click(function(evt) {
|
||||
var tabs = RED.tabs.create({
|
||||
id: "red-ui-clipboard-dialog-export-tabs",
|
||||
vertical: true,
|
||||
onchange: function(tab) {
|
||||
$("#red-ui-clipboard-dialog-export-tabs-content").children().hide();
|
||||
$("#" + tab.id).show();
|
||||
activeTab = tab.id;
|
||||
if (tab.id === "red-ui-clipboard-dialog-export-tab-clipboard") {
|
||||
$("#red-ui-clipboard-dialog-export").button("option","label", RED._("clipboard.export.copy"))
|
||||
$("#red-ui-clipboard-dialog-download").show();
|
||||
} else {
|
||||
$("#red-ui-clipboard-dialog-export").button("option","label", RED._("clipboard.export.export"))
|
||||
$("#red-ui-clipboard-dialog-download").hide();
|
||||
libraryBrowser.focus();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
tabs.addTab({
|
||||
id: "red-ui-clipboard-dialog-export-tab-clipboard",
|
||||
label: RED._("clipboard.clipboard")
|
||||
});
|
||||
tabs.addTab({
|
||||
id: "red-ui-clipboard-dialog-export-tab-library",
|
||||
label: RED._("library.library")
|
||||
});
|
||||
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").on("keyup", validateExportFilename);
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").on('paste',function() { setTimeout(validateExportFilename,10)});
|
||||
$("#red-ui-clipboard-dialog-export").button("enable");
|
||||
|
||||
libraryBrowser = RED.library.createBrowser({
|
||||
container: $("#red-ui-clipboard-dialog-export-tab-library-browser"),
|
||||
folderTools: true,
|
||||
onselect: function(file) {
|
||||
if (file && file.label && !file.children) {
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").val(file.label);
|
||||
}
|
||||
}
|
||||
})
|
||||
loadFlowLibrary(libraryBrowser,"local",RED._("library.types.local"));
|
||||
|
||||
$("#red-ui-clipboard-dialog-tab-library-name").val("flows.json").select();
|
||||
|
||||
dialogContainer.i18n();
|
||||
var format = RED.settings.flowFilePretty ? "red-ui-clipboard-dialog-export-fmt-full" : "red-ui-clipboard-dialog-export-fmt-mini";
|
||||
|
||||
$("#red-ui-clipboard-dialog-export-fmt-group > a").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||
$("#clipboard-export").focus();
|
||||
$("#red-ui-clipboard-dialog-export-text").trigger("focus");
|
||||
return;
|
||||
}
|
||||
$(this).parent().children().removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
|
||||
var flow = $("#clipboard-export").val();
|
||||
var flow = $("#red-ui-clipboard-dialog-export-text").val();
|
||||
if (flow.length > 0) {
|
||||
var nodes = JSON.parse(flow);
|
||||
|
||||
format = $(this).attr('id');
|
||||
if (format === 'export-format-full') {
|
||||
if (format === 'red-ui-clipboard-dialog-export-fmt-full') {
|
||||
flow = JSON.stringify(nodes,null,4);
|
||||
} else {
|
||||
flow = JSON.stringify(nodes);
|
||||
}
|
||||
$("#clipboard-export").val(flow);
|
||||
$("#clipboard-export").focus();
|
||||
$("#red-ui-clipboard-dialog-export-text").val(flow);
|
||||
setTimeout(function() { $("#red-ui-clipboard-dialog-export-text").scrollTop(0); },50);
|
||||
|
||||
$("#red-ui-clipboard-dialog-export-text").trigger("focus");
|
||||
}
|
||||
});
|
||||
|
||||
$("#export-range-group > a").click(function(evt) {
|
||||
$("#red-ui-clipboard-dialog-export-rng-group > a").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
|
||||
$("#clipboard-export").focus();
|
||||
return;
|
||||
}
|
||||
$(this).parent().children().removeClass('selected');
|
||||
@ -322,7 +577,7 @@ RED.clipboard = (function() {
|
||||
var type = $(this).attr('id');
|
||||
var flow = "";
|
||||
var nodes = null;
|
||||
if (type === 'export-range-selected') {
|
||||
if (type === 'red-ui-clipboard-dialog-export-rng-selected') {
|
||||
var selection = RED.workspaces.selection();
|
||||
if (selection.length > 0) {
|
||||
nodes = [];
|
||||
@ -335,77 +590,97 @@ RED.clipboard = (function() {
|
||||
}
|
||||
// Don't include the subflow meta-port nodes in the exported selection
|
||||
nodes = RED.nodes.createExportableNodeSet(nodes.filter(function(n) { return n.type !== 'subflow'}));
|
||||
} else if (type === 'export-range-flow') {
|
||||
} else if (type === 'red-ui-clipboard-dialog-export-rng-flow') {
|
||||
var activeWorkspace = RED.workspaces.active();
|
||||
nodes = RED.nodes.filterNodes({z:activeWorkspace});
|
||||
var parentNode = RED.nodes.workspace(activeWorkspace)||RED.nodes.subflow(activeWorkspace);
|
||||
nodes.unshift(parentNode);
|
||||
nodes = RED.nodes.createExportableNodeSet(nodes);
|
||||
} else if (type === 'export-range-full') {
|
||||
} else if (type === 'red-ui-clipboard-dialog-export-rng-full') {
|
||||
nodes = RED.nodes.createCompleteNodeSet(false);
|
||||
}
|
||||
if (nodes !== null) {
|
||||
if (format === "export-format-full") {
|
||||
if (format === "red-ui-clipboard-dialog-export-fmt-full") {
|
||||
flow = JSON.stringify(nodes,null,4);
|
||||
} else {
|
||||
flow = JSON.stringify(nodes);
|
||||
}
|
||||
}
|
||||
if (flow.length > 0) {
|
||||
$("#export-copy").removeClass('disabled');
|
||||
$("#red-ui-clipboard-dialog-export").removeClass('disabled');
|
||||
} else {
|
||||
$("#export-copy").addClass('disabled');
|
||||
$("#red-ui-clipboard-dialog-export").addClass('disabled');
|
||||
}
|
||||
$("#clipboard-export").val(flow);
|
||||
$("#clipboard-export").focus();
|
||||
$("#red-ui-clipboard-dialog-export-text").val(flow);
|
||||
setTimeout(function() { $("#red-ui-clipboard-dialog-export-text").scrollTop(0); },50);
|
||||
$("#red-ui-clipboard-dialog-export-text").trigger("focus");
|
||||
})
|
||||
|
||||
$("#clipboard-dialog-ok").hide();
|
||||
$("#clipboard-dialog-cancel").hide();
|
||||
$("#clipboard-dialog-copy").hide();
|
||||
$("#clipboard-dialog-close").hide();
|
||||
$("#red-ui-clipboard-dialog-ok").hide();
|
||||
$("#red-ui-clipboard-dialog-cancel").hide();
|
||||
$("#red-ui-clipboard-dialog-export").hide();
|
||||
var selection = RED.workspaces.selection();
|
||||
if (selection.length > 0) {
|
||||
$("#export-range-selected").click();
|
||||
$("#red-ui-clipboard-dialog-export-rng-selected").trigger("click");
|
||||
} else {
|
||||
selection = RED.view.selection();
|
||||
if (selection.nodes) {
|
||||
$("#export-range-selected").click();
|
||||
$("#red-ui-clipboard-dialog-export-rng-selected").trigger("click");
|
||||
} else {
|
||||
$("#export-range-selected").addClass('disabled').removeClass('selected');
|
||||
$("#export-range-flow").click();
|
||||
$("#red-ui-clipboard-dialog-export-rng-selected").addClass('disabled').removeClass('selected');
|
||||
$("#red-ui-clipboard-dialog-export-rng-flow").trigger("click");
|
||||
}
|
||||
}
|
||||
if (format === "export-format-full") {
|
||||
$("#export-format-full").click();
|
||||
if (format === "red-ui-clipboard-dialog-export-fmt-full") {
|
||||
$("#red-ui-clipboard-dialog-export-fmt-full").trigger("click");
|
||||
} else {
|
||||
$("#export-format-mini").click();
|
||||
$("#red-ui-clipboard-dialog-export-fmt-mini").trigger("click");
|
||||
}
|
||||
$("#clipboard-export")
|
||||
.focus(function() {
|
||||
var textarea = $(this);
|
||||
textarea.select();
|
||||
textarea.mouseup(function() {
|
||||
textarea.unbind("mouseup");
|
||||
return false;
|
||||
})
|
||||
});
|
||||
tabs.activateTab("red-ui-clipboard-dialog-export-tab-"+mode);
|
||||
dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
|
||||
|
||||
$("#clipboard-export").focus();
|
||||
if (!document.queryCommandSupported("copy")) {
|
||||
$("#clipboard-dialog-cancel").hide();
|
||||
$("#clipboard-dialog-close").show();
|
||||
} else {
|
||||
$("#clipboard-dialog-cancel").show();
|
||||
$("#clipboard-dialog-copy").show();
|
||||
}
|
||||
$("#clipboard-dialog-download").show();
|
||||
$("#red-ui-clipboard-dialog-export-text").trigger("focus");
|
||||
$("#red-ui-clipboard-dialog-cancel").show();
|
||||
$("#red-ui-clipboard-dialog-export").show();
|
||||
$("#red-ui-clipboard-dialog-download").show();
|
||||
|
||||
}
|
||||
|
||||
function loadFlowLibrary(browser,library,label) {
|
||||
// if (includeExamples) {
|
||||
// listing.push({
|
||||
// library: "_examples_",
|
||||
// type: "flows",
|
||||
// icon: 'fa fa-hdd-o',
|
||||
// label: RED._("library.types.examples"),
|
||||
// path: "",
|
||||
// children: function(done,item) {
|
||||
// RED.library.loadLibraryFolder("_examples_","flows","",function(children) {
|
||||
// item.children = children;
|
||||
// done(children);
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
browser.data([{
|
||||
library: library,
|
||||
type: "flows",
|
||||
icon: 'fa fa-hdd-o',
|
||||
label: label,
|
||||
path: "",
|
||||
expanded: true,
|
||||
children: function(done, item) {
|
||||
RED.library.loadLibraryFolder(library,"flows","",function(children) {
|
||||
item.children = children;
|
||||
done(children);
|
||||
})
|
||||
}
|
||||
}], true);
|
||||
|
||||
}
|
||||
|
||||
function hideDropTarget() {
|
||||
$("#dropTarget").hide();
|
||||
$("#red-ui-drop-target").hide();
|
||||
RED.keyboard.remove("escape");
|
||||
}
|
||||
function copyText(value,element,msg) {
|
||||
@ -435,7 +710,7 @@ RED.clipboard = (function() {
|
||||
if (truncated) {
|
||||
msg += "_truncated";
|
||||
}
|
||||
$("#clipboard-hidden").val(value).select();
|
||||
$("#red-ui-clipboard-hidden").val(value).select();
|
||||
var result = document.execCommand("copy");
|
||||
if (result && element) {
|
||||
var popover = RED.popover.create({
|
||||
@ -455,29 +730,34 @@ RED.clipboard = (function() {
|
||||
init: function() {
|
||||
setupDialogs();
|
||||
|
||||
$('<input type="text" id="clipboard-hidden">').appendTo("body");
|
||||
$('<input type="text" id="red-ui-clipboard-hidden" tabIndex="-1">').appendTo("#red-ui-editor");
|
||||
|
||||
RED.actions.add("core:show-export-dialog",exportNodes);
|
||||
RED.actions.add("core:show-import-dialog",importNodes);
|
||||
|
||||
RED.actions.add("core:show-library-export-dialog",function() { exportNodes('library') });
|
||||
RED.actions.add("core:show-library-import-dialog",function() { importNodes('library') });
|
||||
|
||||
RED.events.on("editor:open",function() { disabled = true; });
|
||||
RED.events.on("editor:close",function() { disabled = false; });
|
||||
RED.events.on("search:open",function() { disabled = true; });
|
||||
RED.events.on("search:close",function() { disabled = false; });
|
||||
RED.events.on("actionList:open",function() { disabled = true; });
|
||||
RED.events.on("actionList:close",function() { disabled = false; });
|
||||
RED.events.on("type-search:open",function() { disabled = true; });
|
||||
RED.events.on("type-search:close",function() { disabled = false; });
|
||||
|
||||
$('<div id="red-ui-drop-target"><div data-i18n="[append]workspace.dropFlowHere"><i class="fa fa-download"></i><br></div></div>').appendTo('#red-ui-editor');
|
||||
|
||||
$('#chart').on("dragenter",function(event) {
|
||||
$('#red-ui-workspace-chart').on("dragenter",function(event) {
|
||||
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
|
||||
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
|
||||
$("#dropTarget").css({display:'table'});
|
||||
$("#red-ui-drop-target").css({display:'table'});
|
||||
RED.keyboard.add("*", "escape" ,hideDropTarget);
|
||||
}
|
||||
});
|
||||
|
||||
$('#dropTarget').on("dragover",function(event) {
|
||||
$('#red-ui-drop-target').on("dragover",function(event) {
|
||||
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
|
||||
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
|
||||
event.preventDefault();
|
||||
|
@ -38,7 +38,7 @@
|
||||
this.options[0].show();
|
||||
}
|
||||
|
||||
this.element.change(function() {
|
||||
this.element.on("change", function() {
|
||||
if (this.checked) {
|
||||
that.options[0].hide();
|
||||
that.options[1].show();
|
||||
@ -53,7 +53,7 @@
|
||||
child.checkboxSet('state',isChecked,false,true);
|
||||
})
|
||||
})
|
||||
this.uiElement.click(function(e) {
|
||||
this.uiElement.on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
// state returns null for a partial state. Clicking on that should
|
||||
// result in false.
|
||||
|
@ -32,7 +32,10 @@
|
||||
* - scrollOnAdd : boolean - whether to scroll to newly added items
|
||||
* methods:
|
||||
* - addItem(itemData)
|
||||
* - insertItemAt : function(data,index) - add an item at the specified index
|
||||
* - removeItem(itemData)
|
||||
* - getItemAt(index)
|
||||
* - indexOf(itemData)
|
||||
* - width(width)
|
||||
* - height(height)
|
||||
* - items()
|
||||
@ -75,9 +78,9 @@
|
||||
addLabel = 'add';
|
||||
}
|
||||
}
|
||||
$('<a href="#" class="editor-button editor-button-small red-ui-editableList-addButton" style="margin-top: 4px;"><i class="fa fa-plus"></i> '+addLabel+'</a>')
|
||||
$('<a href="#" class="red-ui-button red-ui-button-small red-ui-editableList-addButton" style="margin-top: 4px;"><i class="fa fa-plus"></i> '+addLabel+'</a>')
|
||||
.appendTo(this.topContainer)
|
||||
.click(function(evt) {
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
that.addItem({});
|
||||
});
|
||||
@ -185,6 +188,11 @@
|
||||
}
|
||||
},
|
||||
_destroy: function() {
|
||||
if (this.topContainer) {
|
||||
var tc = this.topContainer;
|
||||
delete this.topContainer;
|
||||
tc.remove();
|
||||
}
|
||||
},
|
||||
_refreshFilter: function() {
|
||||
var that = this;
|
||||
@ -230,7 +238,24 @@
|
||||
this.uiHeight = desiredHeight;
|
||||
this._resize();
|
||||
},
|
||||
addItem: function(data) {
|
||||
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 || {};
|
||||
var li = $('<li>');
|
||||
@ -248,7 +273,13 @@
|
||||
});
|
||||
}
|
||||
if (!added) {
|
||||
li.appendTo(this.element);
|
||||
if (index <= 0) {
|
||||
li.prependTo(this.element);
|
||||
} else if (index > that.element.children().length-1) {
|
||||
li.appendTo(this.element);
|
||||
} else {
|
||||
li.insertBefore(this.element.children().eq(index));
|
||||
}
|
||||
}
|
||||
var row = $('<div/>').addClass("red-ui-editableList-item-content").appendTo(li);
|
||||
row.data('data',data);
|
||||
@ -257,10 +288,10 @@
|
||||
li.addClass("red-ui-editableList-item-sortable");
|
||||
}
|
||||
if (this.options.removable) {
|
||||
var deleteButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove editor-button editor-button-small"}).appendTo(li);
|
||||
var deleteButton = $('<a/>',{href:"#",class:"red-ui-editableList-item-remove red-ui-button red-ui-button-small"}).appendTo(li);
|
||||
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
||||
li.addClass("red-ui-editableList-item-removable");
|
||||
deleteButton.click(function(evt) {
|
||||
deleteButton.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var data = row.data('data');
|
||||
li.addClass("red-ui-editableList-item-deleting")
|
||||
@ -293,6 +324,9 @@
|
||||
},0);
|
||||
}
|
||||
},
|
||||
addItem: function(data) {
|
||||
this.insertItemAt(data,this.element.children().length)
|
||||
},
|
||||
addItems: function(items) {
|
||||
for (var i=0; i<items.length;i++) {
|
||||
this.addItem(items[i]);
|
||||
@ -312,6 +346,7 @@
|
||||
},
|
||||
empty: function() {
|
||||
this.element.empty();
|
||||
this.uiContainer.scrollTop(0);
|
||||
},
|
||||
filter: function(filter) {
|
||||
if (filter !== undefined) {
|
||||
@ -335,6 +370,14 @@
|
||||
if (items.length > 0) {
|
||||
this.uiContainer.scrollTop(this.uiContainer.scrollTop()+items.position().top)
|
||||
}
|
||||
},
|
||||
getItem: function(li) {
|
||||
var el = li.find(".red-ui-editableList-item-content");
|
||||
if (el.length) {
|
||||
return el.data('data');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
@ -56,12 +56,12 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
if (opt === null) {
|
||||
item = $('<li class="divider"></li>');
|
||||
item = $('<li class="red-ui-menu-divider"></li>');
|
||||
} else {
|
||||
item = $('<li></li>');
|
||||
|
||||
if (opt.group) {
|
||||
item.addClass("menu-group-"+opt.group);
|
||||
item.addClass("red-ui-menu-group-"+opt.group);
|
||||
|
||||
}
|
||||
var linkContent = '<a '+(opt.id?'id="'+opt.id+'" ':'')+'tabindex="-1" href="#">';
|
||||
@ -71,7 +71,7 @@ RED.menu = (function() {
|
||||
|
||||
}
|
||||
if (opt.icon !== undefined) {
|
||||
if (/\.png/.test(opt.icon)) {
|
||||
if (/\.(png|svg)/.test(opt.icon)) {
|
||||
linkContent += '<img src="'+opt.icon+'"/> ';
|
||||
} else {
|
||||
linkContent += '<i class="'+(opt.icon?opt.icon:'" style="display: inline-block;"')+'"></i> ';
|
||||
@ -79,10 +79,10 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
if (opt.sublabel) {
|
||||
linkContent += '<span class="menu-label-container"><span class="menu-label">'+opt.label+'</span>'+
|
||||
'<span class="menu-sublabel">'+opt.sublabel+'</span></span>'
|
||||
linkContent += '<span class="red-ui-menu-label-container"><span class="red-ui-menu-label">'+opt.label+'</span>'+
|
||||
'<span class="red-ui-menu-sublabel">'+opt.sublabel+'</span></span>'
|
||||
} else {
|
||||
linkContent += '<span class="menu-label">'+opt.label+'</span>'
|
||||
linkContent += '<span class="red-ui-menu-label">'+opt.label+'</span>'
|
||||
}
|
||||
|
||||
linkContent += '</a>';
|
||||
@ -92,27 +92,16 @@ RED.menu = (function() {
|
||||
menuItems[opt.id] = opt;
|
||||
|
||||
if (opt.onselect) {
|
||||
link.click(function(e) {
|
||||
link.on("click", function(e) {
|
||||
e.preventDefault();
|
||||
if ($(this).parent().hasClass("disabled")) {
|
||||
return;
|
||||
}
|
||||
if (opt.toggle) {
|
||||
var selected = isSelected(opt.id);
|
||||
if (typeof opt.toggle === "string") {
|
||||
if (!selected) {
|
||||
for (var m in menuItems) {
|
||||
if (menuItems.hasOwnProperty(m)) {
|
||||
var mi = menuItems[m];
|
||||
if (mi.id != opt.id && opt.toggle == mi.toggle) {
|
||||
setSelected(mi.id,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
setSelected(opt.id,true);
|
||||
}
|
||||
if (opt.toggle === true) {
|
||||
setSelected(opt.id, !isSelected(opt.id));
|
||||
} else {
|
||||
setSelected(opt.id, !selected);
|
||||
setSelected(opt.id, true);
|
||||
}
|
||||
} else {
|
||||
triggerAction(opt.id);
|
||||
@ -125,13 +114,13 @@ RED.menu = (function() {
|
||||
link.attr("target","_blank").attr("href",opt.href);
|
||||
} else if (!opt.options) {
|
||||
item.addClass("disabled");
|
||||
link.click(function(event) {
|
||||
link.on("click", function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
if (opt.options) {
|
||||
item.addClass("dropdown-submenu pull-left");
|
||||
var submenu = $('<ul id="'+opt.id+'-submenu" class="dropdown-menu"></ul>').appendTo(item);
|
||||
item.addClass("red-ui-menu-dropdown-submenu pull-left");
|
||||
var submenu = $('<ul id="'+opt.id+'-submenu" class="red-ui-menu-dropdown"></ul>').appendTo(item);
|
||||
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
var li = createMenuItem(opt.options[i]);
|
||||
@ -150,13 +139,29 @@ RED.menu = (function() {
|
||||
|
||||
}
|
||||
function createMenu(options) {
|
||||
var topMenu = $("<ul/>",{class:"dropdown-menu pull-right"});
|
||||
var topMenu = $("<ul/>",{class:"red-ui-menu red-ui-menu-dropdown pull-right"});
|
||||
|
||||
if (options.id) {
|
||||
topMenu.attr({id:options.id+"-submenu"});
|
||||
var menuParent = $("#"+options.id);
|
||||
if (menuParent.length === 1) {
|
||||
topMenu.insertAfter(menuParent);
|
||||
menuParent.on("click", function(evt) {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
if (topMenu.is(":visible")) {
|
||||
$(document).off("click.red-ui-menu");
|
||||
topMenu.hide();
|
||||
} else {
|
||||
$(document).on("click.red-ui-menu", function(evt) {
|
||||
$(document).off("click.red-ui-menu");
|
||||
activeMenu = null;
|
||||
topMenu.hide();
|
||||
});
|
||||
$(".red-ui-menu").hide();
|
||||
topMenu.show();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,8 +198,9 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
function setSelected(id,state) {
|
||||
var alreadySet = false;
|
||||
if (isSelected(id) == state) {
|
||||
return;
|
||||
alreadySet = true;
|
||||
}
|
||||
var opt = menuItems[id];
|
||||
if (state) {
|
||||
@ -202,10 +208,26 @@ RED.menu = (function() {
|
||||
} else {
|
||||
$("#"+id).removeClass("active");
|
||||
}
|
||||
if (opt && opt.onselect) {
|
||||
triggerAction(opt.id,state);
|
||||
if (opt) {
|
||||
if (opt.toggle && typeof opt.toggle === "string") {
|
||||
if (state) {
|
||||
for (var m in menuItems) {
|
||||
if (menuItems.hasOwnProperty(m)) {
|
||||
var mi = menuItems[m];
|
||||
if (mi.id != opt.id && opt.toggle == mi.toggle) {
|
||||
setSelected(mi.id,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!alreadySet && opt.onselect) {
|
||||
triggerAction(opt.id,state);
|
||||
}
|
||||
if (!opt.local && !alreadySet) {
|
||||
RED.settings.set(opt.setting||("menu-"+opt.id), state);
|
||||
}
|
||||
}
|
||||
RED.settings.set(opt.setting||("menu-"+opt.id), state);
|
||||
}
|
||||
|
||||
function toggleSelected(id) {
|
||||
@ -222,14 +244,14 @@ RED.menu = (function() {
|
||||
|
||||
function addItem(id,opt) {
|
||||
var item = createMenuItem(opt);
|
||||
if (opt.group) {
|
||||
var groupItems = $("#"+id+"-submenu").children(".menu-group-"+opt.group);
|
||||
if (opt !== null && opt.group) {
|
||||
var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
|
||||
if (groupItems.length === 0) {
|
||||
item.appendTo("#"+id+"-submenu");
|
||||
} else {
|
||||
for (var i=0;i<groupItems.length;i++) {
|
||||
var groupItem = groupItems[i];
|
||||
var label = $(groupItem).find(".menu-label").html();
|
||||
var label = $(groupItem).find(".red-ui-menu-label").html();
|
||||
if (opt.label < label) {
|
||||
$(groupItem).before(item);
|
||||
break;
|
||||
@ -263,6 +285,5 @@ RED.menu = (function() {
|
||||
addItem: addItem,
|
||||
removeItem: removeItem,
|
||||
setAction: setAction
|
||||
//TODO: add an api for replacing a submenu - see library.js:loadFlowLibrary
|
||||
}
|
||||
})();
|
||||
|
@ -21,6 +21,7 @@ RED.panels = (function() {
|
||||
var container = options.container || $("#"+options.id);
|
||||
var children = container.children();
|
||||
if (children.length !== 2) {
|
||||
console.log(options.id);
|
||||
throw new Error("Container must have exactly two children");
|
||||
}
|
||||
var vertical = (!options.dir || options.dir === "vertical");
|
||||
@ -86,10 +87,10 @@ RED.panels = (function() {
|
||||
resize: function(size) {
|
||||
var panelSizes;
|
||||
if (vertical) {
|
||||
panelSizes = [$(children[0]).height(),$(children[1]).height()];
|
||||
panelSizes = [$(children[0]).outerHeight(),$(children[1]).outerHeight()];
|
||||
container.height(size);
|
||||
} else {
|
||||
panelSizes = [$(children[0]).width(),$(children[1]).width()];
|
||||
panelSizes = [$(children[0]).outerWidth(),$(children[1]).outerWidth()];
|
||||
container.width(size);
|
||||
}
|
||||
if (modifiedSizes) {
|
||||
@ -105,6 +106,11 @@ RED.panels = (function() {
|
||||
}
|
||||
}
|
||||
if (options.resize) {
|
||||
if (vertical) {
|
||||
panelSizes = [$(children[0]).height(),$(children[1]).height()];
|
||||
} else {
|
||||
panelSizes = [$(children[0]).width(),$(children[1]).width()];
|
||||
}
|
||||
options.resize(panelSizes[0],panelSizes[1]);
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,11 @@ RED.popover = (function() {
|
||||
|
||||
var openPopup = function(instant) {
|
||||
if (active) {
|
||||
var existingPopover = target.data("red-ui-popover");
|
||||
if (options.tooltip && existingPopover) {
|
||||
active = false;
|
||||
return;
|
||||
}
|
||||
div = $('<div class="red-ui-popover"></div>');
|
||||
if (size !== "default") {
|
||||
div.addClass("red-ui-popover-size-"+size);
|
||||
@ -122,7 +127,15 @@ RED.popover = (function() {
|
||||
}
|
||||
}
|
||||
div.addClass('red-ui-popover-'+d).css({top: top, left: left});
|
||||
|
||||
if (existingPopover) {
|
||||
existingPopover.close(true);
|
||||
}
|
||||
target.data("red-ui-popover",res)
|
||||
if (options.tooltip) {
|
||||
div.on("mousedown", function(evt) {
|
||||
closePopup(true);
|
||||
});
|
||||
}
|
||||
if (instant) {
|
||||
div.show();
|
||||
} else {
|
||||
@ -131,7 +144,7 @@ RED.popover = (function() {
|
||||
}
|
||||
}
|
||||
var closePopup = function(instant) {
|
||||
$(document).off('mousedown.modal-popover-close');
|
||||
$(document).off('mousedown.red-ui-popover');
|
||||
if (!active) {
|
||||
if (div) {
|
||||
if (instant) {
|
||||
@ -142,6 +155,7 @@ RED.popover = (function() {
|
||||
});
|
||||
}
|
||||
div = null;
|
||||
target.removeData("red-ui-popover",res)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,7 +176,7 @@ RED.popover = (function() {
|
||||
}
|
||||
});
|
||||
} else if (trigger === 'click') {
|
||||
target.click(function(e) {
|
||||
target.on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
active = !active;
|
||||
@ -185,7 +199,7 @@ RED.popover = (function() {
|
||||
}
|
||||
|
||||
} else if (trigger === 'modal') {
|
||||
$(document).on('mousedown.modal-popover-close', function (event) {
|
||||
$(document).on('mousedown.red-ui-popover', function (event) {
|
||||
var target = event.target;
|
||||
while (target.nodeName !== 'BODY' && target !== div[0]) {
|
||||
target = target.parentElement;
|
||||
@ -236,6 +250,7 @@ RED.popover = (function() {
|
||||
}
|
||||
}
|
||||
return RED.popover.create({
|
||||
tooltip: true,
|
||||
target:target,
|
||||
trigger: "hover",
|
||||
size: "small",
|
||||
@ -243,6 +258,71 @@ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
this.currentTimeout = null;
|
||||
this.lastSent = "";
|
||||
this.element.val("");
|
||||
this.element.addClass("red-ui-searchBox-input");
|
||||
this.uiContainer = this.element.wrap("<div>").parent();
|
||||
this.uiContainer.addClass("red-ui-searchBox-container");
|
||||
|
||||
@ -44,7 +45,7 @@
|
||||
e.preventDefault();
|
||||
that.element.val("");
|
||||
that._change("",true);
|
||||
that.element.focus();
|
||||
that.element.trigger("focus");
|
||||
});
|
||||
|
||||
this.resultCount = $('<span>',{class:"red-ui-searchBox-resultCount hide"}).appendTo(this.uiContainer);
|
||||
@ -60,7 +61,7 @@
|
||||
});
|
||||
|
||||
this.element.on("focus",function() {
|
||||
$("body").one("mousedown",function() {
|
||||
$(document).one("mousedown",function() {
|
||||
that.element.blur();
|
||||
});
|
||||
});
|
||||
@ -86,6 +87,7 @@
|
||||
that._trigger("change");
|
||||
},this.options.delay);
|
||||
} else {
|
||||
this.lastSent = this.element.val();
|
||||
this._trigger("change");
|
||||
}
|
||||
}
|
||||
|
@ -39,17 +39,17 @@ RED.stack = (function() {
|
||||
}
|
||||
}
|
||||
if (options.fill && options.singleExpanded) {
|
||||
$(window).resize(resizeStack);
|
||||
$(window).focus(resizeStack);
|
||||
$(window).on("resize", resizeStack);
|
||||
$(window).on("focus", resizeStack);
|
||||
}
|
||||
return {
|
||||
add: function(entry) {
|
||||
entries.push(entry);
|
||||
entry.container = $('<div class="palette-category">').appendTo(container);
|
||||
entry.container = $('<div class="red-ui-palette-category">').appendTo(container);
|
||||
if (!visible) {
|
||||
entry.container.hide();
|
||||
}
|
||||
var header = $('<div class="palette-header"></div>').appendTo(entry.container);
|
||||
var header = $('<div class="red-ui-palette-header"></div>').appendTo(entry.container);
|
||||
entry.header = header;
|
||||
entry.contentWrap = $('<div></div>',{style:"position:relative"}).appendTo(entry.container);
|
||||
if (options.fill) {
|
||||
@ -57,7 +57,7 @@ RED.stack = (function() {
|
||||
}
|
||||
entry.content = $('<div></div>').appendTo(entry.contentWrap);
|
||||
if (entry.collapsible !== false) {
|
||||
header.click(function() {
|
||||
header.on("click", function() {
|
||||
if (options.singleExpanded) {
|
||||
if (!entry.isExpanded()) {
|
||||
for (var i=0;i<entries.length;i++) {
|
||||
@ -82,7 +82,7 @@ RED.stack = (function() {
|
||||
var icon = $('<i class="fa fa-angle-down"></i>').appendTo(header);
|
||||
|
||||
if (entry.expanded) {
|
||||
entry.container.addClass("palette-category-expanded");
|
||||
entry.container.addClass("expanded");
|
||||
icon.addClass("expanded");
|
||||
} else {
|
||||
entry.contentWrap.hide();
|
||||
@ -118,7 +118,7 @@ RED.stack = (function() {
|
||||
}
|
||||
|
||||
icon.addClass("expanded");
|
||||
entry.container.addClass("palette-category-expanded");
|
||||
entry.container.addClass("expanded");
|
||||
entry.contentWrap.slideDown(200);
|
||||
return true;
|
||||
}
|
||||
@ -126,13 +126,13 @@ RED.stack = (function() {
|
||||
entry.collapse = function() {
|
||||
if (entry.isExpanded()) {
|
||||
icon.removeClass("expanded");
|
||||
entry.container.removeClass("palette-category-expanded");
|
||||
entry.container.removeClass("expanded");
|
||||
entry.contentWrap.slideUp(200);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
entry.isExpanded = function() {
|
||||
return entry.container.hasClass("palette-category-expanded");
|
||||
return entry.container.hasClass("expanded");
|
||||
};
|
||||
if (options.fill && options.singleExpanded) {
|
||||
resizeStack();
|
||||
|
@ -19,6 +19,9 @@
|
||||
RED.tabs = (function() {
|
||||
|
||||
var defaultTabIcon = "fa fa-lemon-o";
|
||||
var dragActive = false;
|
||||
var dblClickTime;
|
||||
var dblClickArmed = false;
|
||||
|
||||
function createTabs(options) {
|
||||
var tabs = {};
|
||||
@ -37,7 +40,7 @@ RED.tabs = (function() {
|
||||
if (options.addButton) {
|
||||
wrapper.addClass("red-ui-tabs-add");
|
||||
var addButton = $('<div class="red-ui-tab-button red-ui-tabs-add"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
|
||||
addButton.find('a').click(function(evt) {
|
||||
addButton.find('a').on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if (typeof options.addButton === 'function') {
|
||||
options.addButton();
|
||||
@ -73,7 +76,7 @@ RED.tabs = (function() {
|
||||
if (options.searchButton) {
|
||||
wrapper.addClass("red-ui-tabs-search");
|
||||
var searchButton = $('<div class="red-ui-tab-button red-ui-tabs-search"><a href="#"><i class="fa fa-list-ul"></i></a></div>').appendTo(wrapper);
|
||||
searchButton.find('a').click(function(evt) {
|
||||
searchButton.find('a').on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
if (typeof options.searchButton === 'function') {
|
||||
options.searchButton()
|
||||
@ -96,7 +99,7 @@ RED.tabs = (function() {
|
||||
if (options.scrollable) {
|
||||
wrapper.addClass("red-ui-tabs-scrollable");
|
||||
scrollContainer.addClass("red-ui-tabs-scroll-container");
|
||||
scrollContainer.scroll(updateScroll);
|
||||
scrollContainer.on("scroll",updateScroll);
|
||||
scrollLeft = $('<div class="red-ui-tab-button red-ui-tab-scroll red-ui-tab-scroll-left"><a href="#" style="display:none;"><i class="fa fa-caret-left"></i></a></div>').appendTo(wrapper).find("a");
|
||||
scrollLeft.on('mousedown',function(evt) { scrollEventHandler(evt,'-=150') }).on('click',function(evt){ evt.preventDefault();});
|
||||
scrollRight = $('<div class="red-ui-tab-button red-ui-tab-scroll red-ui-tab-scroll-right"><a href="#" style="display:none;"><i class="fa fa-caret-right"></i></a></div>').appendTo(wrapper).find("a");
|
||||
@ -113,7 +116,7 @@ RED.tabs = (function() {
|
||||
if (options.menu !== false) {
|
||||
var selectButton = $('<a href="#"><i class="fa fa-caret-down"></i></a>').appendTo(collapsedButtonsRow);
|
||||
selectButton.addClass("red-ui-tab-link-button-menu")
|
||||
selectButton.click(function(evt) {
|
||||
selectButton.on("click", function(evt) {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
if (!collapsibleMenu) {
|
||||
@ -136,7 +139,7 @@ RED.tabs = (function() {
|
||||
}
|
||||
});
|
||||
options = pinnedOptions.concat(options);
|
||||
collapsibleMenu = RED.menu.init({id:"debug-message-option-menu",options: options});
|
||||
collapsibleMenu = RED.menu.init({options: options});
|
||||
collapsibleMenu.css({
|
||||
position: "absolute"
|
||||
})
|
||||
@ -148,10 +151,11 @@ RED.tabs = (function() {
|
||||
left: (elementPos.left - collapsibleMenu.width() + selectButton.width())+"px"
|
||||
})
|
||||
if (collapsibleMenu.is(":visible")) {
|
||||
$(document).off("click.tabmenu");
|
||||
$(document).off("click.red-ui-tabmenu");
|
||||
} else {
|
||||
$(document).on("click.tabmenu", function(evt) {
|
||||
$(document).off("click.tabmenu");
|
||||
$(".red-ui-menu").hide();
|
||||
$(document).on("click.red-ui-tabmenu", function(evt) {
|
||||
$(document).off("click.red-ui-tabmenu");
|
||||
collapsibleMenu.hide();
|
||||
});
|
||||
}
|
||||
@ -200,7 +204,16 @@ RED.tabs = (function() {
|
||||
}
|
||||
|
||||
function onTabClick(evt) {
|
||||
evt.preventDefault();
|
||||
if (dragActive) {
|
||||
return
|
||||
}
|
||||
if (dblClickTime && Date.now()-dblClickTime < 400) {
|
||||
dblClickTime = 0;
|
||||
dblClickArmed = true;
|
||||
return onTabDblClick.call(this,evt);
|
||||
}
|
||||
dblClickTime = Date.now();
|
||||
|
||||
var currentTab = ul.find("li.red-ui-tab.active");
|
||||
var thisTab = $(this).parent();
|
||||
var fireSelectionChanged = false;
|
||||
@ -266,7 +279,6 @@ RED.tabs = (function() {
|
||||
if (fireSelectionChanged) {
|
||||
selectionChanged();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateScroll() {
|
||||
@ -288,7 +300,6 @@ RED.tabs = (function() {
|
||||
}
|
||||
function onTabDblClick(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (evt.metaKey || evt.shiftKey) {
|
||||
return;
|
||||
}
|
||||
@ -348,7 +359,7 @@ RED.tabs = (function() {
|
||||
}
|
||||
var tabs = ul.find("li.red-ui-tab");
|
||||
var width = wrapper.width();
|
||||
var tabCount = tabs.size();
|
||||
var tabCount = tabs.length;
|
||||
var tabWidth;
|
||||
|
||||
if (options.collapsible) {
|
||||
@ -417,7 +428,11 @@ RED.tabs = (function() {
|
||||
|
||||
}
|
||||
|
||||
ul.find("li.red-ui-tab a").on("click",onTabClick).on("dblclick",onTabDblClick);
|
||||
ul.find("li.red-ui-tab a")
|
||||
.on("mouseup",onTabClick)
|
||||
.on("click", function(evt) {evt.preventDefault(); })
|
||||
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
|
||||
|
||||
setTimeout(function() {
|
||||
updateTabWidths();
|
||||
},0);
|
||||
@ -434,7 +449,7 @@ RED.tabs = (function() {
|
||||
var li = ul.find("a[href='#"+id+"']").parent();
|
||||
if (li.hasClass("active")) {
|
||||
var tab = li.prev();
|
||||
if (tab.size() === 0) {
|
||||
if (tab.length === 0) {
|
||||
tab = li.next();
|
||||
}
|
||||
activateTab(tab.find("a"));
|
||||
@ -448,7 +463,10 @@ RED.tabs = (function() {
|
||||
}
|
||||
delete tabs[id];
|
||||
updateTabWidths();
|
||||
collapsibleMenu = null;
|
||||
if (collapsibleMenu) {
|
||||
collapsibleMenu.remove();
|
||||
collapsibleMenu = null;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@ -484,7 +502,7 @@ RED.tabs = (function() {
|
||||
} else if (tab.iconClass) {
|
||||
$('<i>',{class:"red-ui-tab-icon "+tab.iconClass}).appendTo(link);
|
||||
}
|
||||
var span = $('<span/>',{class:"bidiAware"}).text(tab.label).appendTo(link);
|
||||
var span = $('<span/>',{class:"red-ui-text-bidi-aware"}).text(tab.label).appendTo(link);
|
||||
span.attr('dir', RED.text.bidi.resolveBaseTextDir(tab.label));
|
||||
if (options.collapsible) {
|
||||
li.addClass("red-ui-tab-pinned");
|
||||
@ -509,7 +527,7 @@ RED.tabs = (function() {
|
||||
} else {
|
||||
$('<i>',{class:defaultTabIcon}).appendTo(pinnedLink);
|
||||
}
|
||||
pinnedLink.click(function(evt) {
|
||||
pinnedLink.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
activateTab(tab.id);
|
||||
});
|
||||
@ -520,8 +538,9 @@ RED.tabs = (function() {
|
||||
RED.popover.tooltip($(pinnedLink), tab.name, tab.action);
|
||||
|
||||
}
|
||||
link.on("click",onTabClick);
|
||||
link.on("dblclick",onTabDblClick);
|
||||
link.on("mouseup",onTabClick);
|
||||
link.on("click", function(evt) { evt.preventDefault(); })
|
||||
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
|
||||
|
||||
|
||||
if (tab.closeable) {
|
||||
@ -543,7 +562,7 @@ RED.tabs = (function() {
|
||||
options.onadd(tab);
|
||||
}
|
||||
link.attr("title",tab.label);
|
||||
if (ul.find("li.red-ui-tab").size() == 1) {
|
||||
if (ul.find("li.red-ui-tab").length == 1) {
|
||||
activateTab(link);
|
||||
}
|
||||
if (options.onreorder) {
|
||||
@ -556,6 +575,8 @@ 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) {
|
||||
@ -611,6 +632,7 @@ RED.tabs = (function() {
|
||||
}
|
||||
},
|
||||
stop: function(event,ui) {
|
||||
dragActive = false;
|
||||
ul.children().css({position:"relative",left:"",transition:""});
|
||||
if (!li.hasClass('active')) {
|
||||
li.css({zIndex:""});
|
||||
@ -626,7 +648,10 @@ RED.tabs = (function() {
|
||||
setTimeout(function() {
|
||||
updateTabWidths();
|
||||
},10);
|
||||
collapsibleMenu = null;
|
||||
if (collapsibleMenu) {
|
||||
collapsibleMenu.remove();
|
||||
collapsibleMenu = null;
|
||||
}
|
||||
},
|
||||
removeTab: removeTab,
|
||||
activateTab: activateTab,
|
||||
@ -634,7 +659,7 @@ RED.tabs = (function() {
|
||||
previousTab: activatePreviousTab,
|
||||
resize: updateTabWidths,
|
||||
count: function() {
|
||||
return ul.find("li.red-ui-tab").size();
|
||||
return ul.find("li.red-ui-tab").length;
|
||||
},
|
||||
contains: function(id) {
|
||||
return ul.find("a[href='#"+id+"']").length > 0;
|
||||
@ -643,7 +668,7 @@ RED.tabs = (function() {
|
||||
tabs[id].label = label;
|
||||
var tab = ul.find("a[href='#"+id+"']");
|
||||
tab.attr("title",label);
|
||||
tab.find("span.bidiAware").text(label).attr('dir', RED.text.bidi.resolveBaseTextDir(label));
|
||||
tab.find("span.red-ui-text-bidi-aware").text(label).attr('dir', RED.text.bidi.resolveBaseTextDir(label));
|
||||
updateTabWidths();
|
||||
},
|
||||
selection: getSelection,
|
||||
|
100
packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* options:
|
||||
* - invertState : boolean - if "true" the button will show "enabled" when the
|
||||
* checkbox is not selected and vice versa.
|
||||
* - enabledIcon : string - the icon for "enabled" state, default "fa-check-square-o"
|
||||
* - enabledLabel : string - the label for "enabled" state, default "Enabled" ("editor:workspace.enabled")
|
||||
* - disabledIcon : string - the icon for "disabled" state, default "fa-square-o"
|
||||
* - disabledLabel : string - the label for "disabled" state, default "Disabled" ("editor:workspace.disabled")
|
||||
* - baseClass : string - the base css class to apply, default "red-ui-button" (alternative eg "red-ui-sidebar-header-button")
|
||||
* - class : string - additional classes to apply to the button - eg "red-ui-button-small"
|
||||
* methods:
|
||||
* -
|
||||
*/
|
||||
$.widget( "nodered.toggleButton", {
|
||||
_create: function() {
|
||||
var that = this;
|
||||
|
||||
var invertState = false;
|
||||
if (this.options.hasOwnProperty("invertState")) {
|
||||
invertState = this.options.invertState;
|
||||
}
|
||||
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");
|
||||
|
||||
this.element.css("display","none");
|
||||
this.element.on("focus", function() {
|
||||
that.button.focus();
|
||||
});
|
||||
this.button = $('<button type="button" class="red-ui-toggleButton '+baseClass+' toggle single"><i class="fa"></i> <span></span></button>');
|
||||
if (this.options.class) {
|
||||
this.button.addClass(this.options.class)
|
||||
}
|
||||
this.element.after(this.button);
|
||||
this.buttonIcon = this.button.find("i");
|
||||
this.buttonLabel = this.button.find("span");
|
||||
|
||||
// Quick hack to find the maximum width of the button
|
||||
this.button.addClass("selected");
|
||||
this.buttonIcon.addClass(enabledIcon);
|
||||
this.buttonLabel.text(enabledLabel);
|
||||
var width = this.button.width();
|
||||
this.button.removeClass("selected");
|
||||
this.buttonIcon.removeClass(enabledIcon);
|
||||
that.buttonIcon.addClass(disabledIcon);
|
||||
that.buttonLabel.text(disabledLabel);
|
||||
width = Math.max(width,this.button.width());
|
||||
this.buttonIcon.removeClass(disabledIcon);
|
||||
|
||||
// Fix the width of the button so it doesn't jump around when toggled
|
||||
if (width > 0) {
|
||||
this.button.width(Math.ceil(width));
|
||||
}
|
||||
|
||||
this.button.on("click",function(e) {
|
||||
e.stopPropagation();
|
||||
if (that.buttonIcon.hasClass(disabledIcon)) {
|
||||
that.element.prop("checked",!invertState);
|
||||
} else {
|
||||
that.element.prop("checked",invertState);
|
||||
}
|
||||
that.element.trigger("change");
|
||||
})
|
||||
|
||||
this.element.on("change", function(e) {
|
||||
if ($(this).prop("checked") !== invertState) {
|
||||
that.button.addClass("selected");
|
||||
that.buttonIcon.addClass(enabledIcon);
|
||||
that.buttonIcon.removeClass(disabledIcon);
|
||||
that.buttonLabel.text(enabledLabel);
|
||||
} else {
|
||||
that.button.removeClass("selected");
|
||||
that.buttonIcon.addClass(disabledIcon);
|
||||
that.buttonIcon.removeClass(enabledIcon);
|
||||
that.buttonLabel.text(disabledLabel);
|
||||
}
|
||||
})
|
||||
this.element.trigger("change");
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
@ -18,32 +18,70 @@
|
||||
/**
|
||||
* options:
|
||||
* - data : array - initial items to display in tree
|
||||
* - multi : boolean - if true, .selected will return an array of results
|
||||
* otherwise, returns the first selected item
|
||||
* - sortable: boolean/string - TODO: see editableList
|
||||
* - rootSortable: boolean - if 'sortable' is set, then setting this to
|
||||
* false, prevents items being sorted to the
|
||||
* top level of the tree
|
||||
*
|
||||
* methods:
|
||||
* - data(items) - clears existing items and replaces with new data
|
||||
*
|
||||
* events:
|
||||
* - treelistselect : function(event, item) {}
|
||||
*
|
||||
* - treelistconfirm : function(event,item) {}
|
||||
* - treelistchangeparent: function(event,item, oldParent, newParent) {}
|
||||
*
|
||||
* data:
|
||||
* [
|
||||
* {
|
||||
* label: 'Local', // label for the item
|
||||
* sublabel: 'Local', // a sub-label for the item
|
||||
* icon: 'fa fa-rocket', // (optional) icon for the item
|
||||
* selected: true/false, // (optional) if present, display checkbox accordingly
|
||||
* children: [] | function(done) // (optional) an array of child items, or a function
|
||||
* children: [] | function(done,item) // (optional) an array of child items, or a function
|
||||
* // that will call the `done` callback with an array
|
||||
* // of child items
|
||||
* expanded: true/false, // show the child items by default
|
||||
* deferBuild: true/false, // don't build any ui elements for the item's children
|
||||
* until it is expanded by the user.
|
||||
* element: // custom dom element to use for the item - ignored if `label` is set
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
*
|
||||
*
|
||||
* var treeList = $("<div>").css({width: "100%", height: "100%"}).treeList({data:[...]})
|
||||
* treeList.on('treelistselect', function(e,item) { console.log(item)})
|
||||
* treeList.treeList('data',[ ... ] )
|
||||
*
|
||||
*
|
||||
* After `data` has been added to the tree, each item is augmented the following
|
||||
* properties and functions:
|
||||
*
|
||||
* item.parent - set to the parent item
|
||||
* item.treeList.container
|
||||
* item.treeList.label - the label element for the item
|
||||
* item.treeList.depth - the depth in the tree (0 == root)
|
||||
* item.treeList.parentList - the editableList instance this item is in
|
||||
* item.treeList.remove() - removes the item from the tree
|
||||
* item.treeList.makeLeaf(detachChildElements) - turns an element with children into a leaf node,
|
||||
* removing the UI decoration etc.
|
||||
* detachChildElements - any children with custom
|
||||
* elements will be detached rather than removed
|
||||
* so jQuery event handlers are preserved in case
|
||||
* the child elements need to be reattached later
|
||||
* item.treeList.makeParent(children) - turns an element into a parent node, adding the necessary
|
||||
* UI decoration.
|
||||
* item.treeList.insertChildAt(newItem,position,select) - adds a child item an the specified position.
|
||||
* Optionally selects the item after adding.
|
||||
* item.treeList.addChild(newItem,select) - appends a child item.
|
||||
* Optionally selects the item after adding.
|
||||
* item.treeList.expand(done) - expands the parent item to show children. Optional 'done' callback.
|
||||
* item.treeList.collapse() - collapse the parent item to hide children.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$.widget( "nodered.treeList", {
|
||||
@ -51,110 +89,449 @@
|
||||
var that = this;
|
||||
|
||||
this.element.addClass('red-ui-treeList');
|
||||
this.element.attr("tabIndex",0);
|
||||
var wrapper = $('<div>',{class:'red-ui-treeList-container'}).appendTo(this.element);
|
||||
this.element.on('keydown', function(evt) {
|
||||
var selected = that._topList.find(".selected").parent().data('data');
|
||||
if (!selected && (evt.keyCode === 40 || evt.keyCode === 38)) {
|
||||
that.select(that._data[0]);
|
||||
return;
|
||||
}
|
||||
var target;
|
||||
switch(evt.keyCode) {
|
||||
case 13: // ENTER
|
||||
if (selected.children) {
|
||||
if (selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.collapse()
|
||||
} else {
|
||||
selected.treeList.expand()
|
||||
}
|
||||
} else {
|
||||
that._trigger("confirm",null,selected)
|
||||
}
|
||||
|
||||
break;
|
||||
case 37: // LEFT
|
||||
if (selected.children&& selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.collapse()
|
||||
} else if (selected.parent) {
|
||||
target = selected.parent;
|
||||
}
|
||||
break;
|
||||
case 38: // UP
|
||||
target = that._getPreviousSibling(selected);
|
||||
if (target) {
|
||||
target = that._getLastDescendant(target);
|
||||
}
|
||||
if (!target && selected.parent) {
|
||||
target = selected.parent;
|
||||
}
|
||||
break;
|
||||
case 39: // RIGHT
|
||||
if (selected.children) {
|
||||
if (!selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.expand()
|
||||
}
|
||||
}
|
||||
break
|
||||
case 40: //DOWN
|
||||
if (selected.children && Array.isArray(selected.children) && selected.children.length > 0 && selected.treeList.container.hasClass("expanded")) {
|
||||
target = selected.children[0];
|
||||
} else {
|
||||
target = that._getNextSibling(selected);
|
||||
while (!target && selected.parent) {
|
||||
selected = selected.parent;
|
||||
target = that._getNextSibling(selected);
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
if (target) {
|
||||
that.select(target);
|
||||
}
|
||||
});
|
||||
this._data = [];
|
||||
|
||||
this._topList = $('<ol>').css({
|
||||
this._topList = $('<ol class="red-ui-treeList-list">').css({
|
||||
position:'absolute',
|
||||
top: 0,
|
||||
left:0,
|
||||
right:0,
|
||||
bottom:0
|
||||
}).appendTo(wrapper).editableList({
|
||||
}).appendTo(wrapper);
|
||||
|
||||
var topListOptions = {
|
||||
addButton: false,
|
||||
scrollOnAdd: false,
|
||||
height: '100%',
|
||||
addItem: function(container,i,item) {
|
||||
that._addSubtree(container,item,0);
|
||||
that._addSubtree(that._topList,container,item,0);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (this.options.rootSortable !== false && !!this.options.sortable) {
|
||||
topListOptions.sortable = this.options.sortable;
|
||||
topListOptions.connectWith = '.red-ui-treeList-sortable';
|
||||
this._topList.addClass('red-ui-treeList-sortable');
|
||||
}
|
||||
this._topList.editableList(topListOptions)
|
||||
|
||||
|
||||
if (this.options.data) {
|
||||
this.data(this.options.data);
|
||||
}
|
||||
},
|
||||
_addChildren: function(container,children,depth) {
|
||||
_getLastDescendant: function(item) {
|
||||
// Gets the last visible descendant of the item
|
||||
if (!item.children || !item.treeList.container.hasClass("expanded") || item.children.length === 0) {
|
||||
return item;
|
||||
}
|
||||
return this._getLastDescendant(item.children[item.children.length-1]);
|
||||
},
|
||||
_getPreviousSibling: function(item) {
|
||||
var candidates;
|
||||
if (!item.parent) {
|
||||
candidates = this._data;
|
||||
} else {
|
||||
candidates = item.parent.children;
|
||||
}
|
||||
var index = candidates.indexOf(item);
|
||||
if (index === 0) {
|
||||
return null;
|
||||
} else {
|
||||
return candidates[index-1];
|
||||
}
|
||||
},
|
||||
_getNextSibling: function(item) {
|
||||
var candidates;
|
||||
if (!item.parent) {
|
||||
candidates = this._data;
|
||||
} else {
|
||||
candidates = item.parent.children;
|
||||
}
|
||||
var index = candidates.indexOf(item);
|
||||
if (index === candidates.length - 1) {
|
||||
return null;
|
||||
} else {
|
||||
return candidates[index+1];
|
||||
}
|
||||
},
|
||||
_addChildren: function(container,parent,children,depth) {
|
||||
var that = this;
|
||||
var subtree = $('<ol>').appendTo(container).editableList({
|
||||
var subtree = $('<ol class="red-ui-treeList-list">').appendTo(container).editableList({
|
||||
connectWith: ".red-ui-treeList-sortable",
|
||||
sortable: that.options.sortable,
|
||||
addButton: false,
|
||||
scrollOnAdd: false,
|
||||
height: 'auto',
|
||||
addItem: function(container,i,item) {
|
||||
that._addSubtree(container,item,depth+1);
|
||||
that._addSubtree(subtree,container,item,depth+1);
|
||||
},
|
||||
sortItems: function(data) {
|
||||
var children = [];
|
||||
var reparented = [];
|
||||
data.each(function() {
|
||||
var child = $(this).data('data');
|
||||
children.push(child);
|
||||
var evt = that._fixDepths(parent,child);
|
||||
if (evt) {
|
||||
reparented.push(evt);
|
||||
}
|
||||
})
|
||||
if (Array.isArray(parent.children)) {
|
||||
parent.children = children;
|
||||
}
|
||||
reparented.forEach(function(evt) {
|
||||
that._trigger("changeparent",null,evt);
|
||||
});
|
||||
that._trigger("sort",null,parent);
|
||||
}
|
||||
});
|
||||
if (!!that.options.sortable) {
|
||||
subtree.addClass('red-ui-treeList-sortable');
|
||||
}
|
||||
for (var i=0;i<children.length;i++) {
|
||||
children[i].parent = parent;
|
||||
subtree.editableList('addItem',children[i])
|
||||
}
|
||||
return subtree;
|
||||
},
|
||||
_addSubtree: function(container, item, depth) {
|
||||
_fixDepths: function(parent,child) {
|
||||
// If child has just been moved into parent in the UI
|
||||
// this will fix up the internal data structures to match.
|
||||
// The calling function must take care of getting child
|
||||
// into the parent.children array. The rest is up to us.
|
||||
var that = this;
|
||||
var labelNodeType = "<label>";
|
||||
if (item.children && item.hasOwnProperty('selected')) {
|
||||
labelNodeType = "<div>";
|
||||
var reparentedEvent = null;
|
||||
if (child.parent !== parent) {
|
||||
reparented = true;
|
||||
var oldParent = child.parent;
|
||||
child.parent = parent;
|
||||
reparentedEvent = {
|
||||
item: child,
|
||||
old: oldParent,
|
||||
}
|
||||
}
|
||||
var label = $(labelNodeType,{tabindex:"0",class:"red-ui-treeList-label"}).appendTo(container);
|
||||
if (child.depth !== parent.depth+1) {
|
||||
child.depth = parent.depth+1;
|
||||
var labelPaddingWidth = ((child.gutter?child.gutter.width()+2:0)+(child.depth*20));
|
||||
child.treeList.labelPadding.width(labelPaddingWidth+'px');
|
||||
if (child.element) {
|
||||
$(child.element).css({
|
||||
width: "calc(100% - "+(labelPaddingWidth+20+(child.icon?20:0))+"px)"
|
||||
})
|
||||
}
|
||||
// This corrects all child item depths
|
||||
if (child.children && Array.isArray(child.children)) {
|
||||
child.children.forEach(function(item) {
|
||||
that._fixDepths(child,item);
|
||||
})
|
||||
}
|
||||
}
|
||||
return reparentedEvent;
|
||||
},
|
||||
_addSubtree: function(parentList, container, item, depth) {
|
||||
var that = this;
|
||||
item.treeList = {};
|
||||
item.treeList.depth = depth;
|
||||
item.treeList.container = container;
|
||||
|
||||
item.treeList.parentList = parentList;
|
||||
item.treeList.remove = function() {
|
||||
parentList.editableList('removeItem',item);
|
||||
if (item.parent) {
|
||||
var index = item.parent.children.indexOf(item);
|
||||
item.parent.children.splice(index,1)
|
||||
that._trigger("sort",null,item.parent);
|
||||
}
|
||||
}
|
||||
|
||||
var label = $("<div>",{class:"red-ui-treeList-label"}).appendTo(container);
|
||||
item.treeList.label = label;
|
||||
if (item.class) {
|
||||
label.addClass(item.class);
|
||||
}
|
||||
label.css({
|
||||
paddingLeft: (depth*15)+'px'
|
||||
})
|
||||
if (item.gutter) {
|
||||
item.gutter.css({
|
||||
position: 'absolute'
|
||||
}).appendTo(label)
|
||||
|
||||
}
|
||||
var labelPaddingWidth = (item.gutter?item.gutter.width()+2:0)+(depth*20);
|
||||
item.treeList.labelPadding = $('<span>').css({
|
||||
display: "inline-block",
|
||||
width: labelPaddingWidth+'px'
|
||||
}).appendTo(label);
|
||||
|
||||
label.on('mouseover',function(e) { that._trigger('itemmouseover',e,item); })
|
||||
label.on('mouseout',function(e) { that._trigger('itemmouseout',e,item); })
|
||||
label.on('mouseenter',function(e) { that._trigger('itemmouseenter',e,item); })
|
||||
label.on('mouseleave',function(e) { that._trigger('itemmouseleave',e,item); })
|
||||
|
||||
if (item.children) {
|
||||
$('<span class="red-ui-treeList-icon"><i class="fa fa-angle-right" /></span>').appendTo(label);
|
||||
item.treeList.makeLeaf = function(detachChildElements) {
|
||||
if (!treeListIcon.children().length) {
|
||||
// Already a leaf
|
||||
return
|
||||
}
|
||||
if (detachChildElements && item.children) {
|
||||
var detachChildren = function(item) {
|
||||
if (item.children) {
|
||||
item.children.forEach(function(child) {
|
||||
if (child.element) {
|
||||
child.element.detach();
|
||||
}
|
||||
if (child.gutter) {
|
||||
child.gutter.detach();
|
||||
}
|
||||
detachChildren(child);
|
||||
});
|
||||
}
|
||||
}
|
||||
detachChildren(item);
|
||||
}
|
||||
treeListIcon.empty();
|
||||
if (!item.deferBuild) {
|
||||
item.treeList.childList.remove();
|
||||
delete item.treeList.childList;
|
||||
}
|
||||
label.off("click.red-ui-treeList-expand");
|
||||
treeListIcon.off("click.red-ui-treeList-expand");
|
||||
delete item.children;
|
||||
container.removeClass("expanded");
|
||||
}
|
||||
item.treeList.makeParent = function(children) {
|
||||
if (treeListIcon.children().length) {
|
||||
// Already a parent because we've got the angle-right icon
|
||||
return;
|
||||
}
|
||||
$('<i class="fa fa-angle-right" />').appendTo(treeListIcon);
|
||||
treeListIcon.on("click.red-ui-treeList-expand", function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
if (container.hasClass("expanded")) {
|
||||
item.treeList.collapse();
|
||||
} else {
|
||||
item.treeList.expand();
|
||||
}
|
||||
});
|
||||
// $('<span class="red-ui-treeList-icon"><i class="fa fa-folder-o" /></span>').appendTo(label);
|
||||
label.click(function(e) {
|
||||
if (!container.hasClass("built") && typeof item.children === 'function') {
|
||||
container.addClass('built');
|
||||
var childrenAdded = false;
|
||||
var spinner;
|
||||
item.children(function(children) {
|
||||
childrenAdded = true;
|
||||
that._addChildren(container,children,depth);
|
||||
label.on("click.red-ui-treeList-expand", function(e) {
|
||||
if (container.hasClass("expanded")) {
|
||||
if (item.hasOwnProperty('selected') || label.hasClass("selected")) {
|
||||
item.treeList.collapse();
|
||||
}
|
||||
} else {
|
||||
item.treeList.expand();
|
||||
}
|
||||
})
|
||||
if (!item.children) {
|
||||
item.children = children||[];
|
||||
item.treeList.childList = that._addChildren(container,item,item.children,depth).hide();
|
||||
}
|
||||
}
|
||||
item.treeList.insertChildAt = function(newItem,position,select) {
|
||||
newItem.parent = item;
|
||||
item.children.splice(position,0,newItem);
|
||||
|
||||
if (!item.deferBuild) {
|
||||
item.treeList.childList.editableList('insertItemAt',newItem,position)
|
||||
if (select) {
|
||||
setTimeout(function() {
|
||||
that.select(newItem)
|
||||
},100);
|
||||
}
|
||||
that._trigger("sort",null,item);
|
||||
}
|
||||
}
|
||||
item.treeList.addChild = function(newItem,select) {
|
||||
item.treeList.insertChildAt(newItem,item.children.length,select);
|
||||
}
|
||||
item.treeList.expand = function(done) {
|
||||
if (!item.children) {
|
||||
return;
|
||||
}
|
||||
if (container.hasClass("expanded")) {
|
||||
done && done();
|
||||
return;
|
||||
}
|
||||
if (!container.hasClass("built") && (item.deferBuild || typeof item.children === 'function')) {
|
||||
container.addClass('built');
|
||||
var childrenAdded = false;
|
||||
var spinner;
|
||||
var startTime = 0;
|
||||
var completeBuild = function(children) {
|
||||
childrenAdded = true;
|
||||
item.treeList.childList = that._addChildren(container,item,children,depth).hide();
|
||||
var delta = Date.now() - startTime;
|
||||
if (delta < 400) {
|
||||
setTimeout(function() {
|
||||
item.treeList.childList.slideDown('fast');
|
||||
if (spinner) {
|
||||
spinner.remove();
|
||||
}
|
||||
},400-delta);
|
||||
} else {
|
||||
item.treeList.childList.slideDown('fast');
|
||||
if (spinner) {
|
||||
spinner.remove();
|
||||
}
|
||||
});
|
||||
if (!childrenAdded) {
|
||||
spinner = $('<div class="red-ui-treeList-spinner">').css({
|
||||
"background-position": (35+depth*15)+'px 50%'
|
||||
}).appendTo(container);
|
||||
}
|
||||
|
||||
done && done();
|
||||
that._trigger("childrenloaded",null,item)
|
||||
}
|
||||
container.toggleClass("expanded");
|
||||
})
|
||||
} else {
|
||||
$('<span class="red-ui-treeList-icon"></span>').appendTo(label);
|
||||
if (typeof item.children === 'function') {
|
||||
item.children(completeBuild,item);
|
||||
} else {
|
||||
delete item.deferBuild;
|
||||
completeBuild(item.children);
|
||||
}
|
||||
if (!childrenAdded) {
|
||||
startTime = Date.now();
|
||||
spinner = $('<div class="red-ui-treeList-spinner">').css({
|
||||
"background-position": (35+depth*20)+'px 50%'
|
||||
}).appendTo(container);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (that._loadingData) {
|
||||
item.treeList.childList.show();
|
||||
} else {
|
||||
item.treeList.childList.slideDown('fast');
|
||||
}
|
||||
done && done();
|
||||
}
|
||||
container.addClass("expanded");
|
||||
}
|
||||
item.treeList.collapse = function() {
|
||||
if (!item.children) {
|
||||
return;
|
||||
}
|
||||
item.treeList.childList.slideUp('fast');
|
||||
container.removeClass("expanded");
|
||||
}
|
||||
|
||||
var treeListIcon = $('<span class="red-ui-treeList-icon"></span>').appendTo(label);
|
||||
if (item.children) {
|
||||
item.treeList.makeParent();
|
||||
}
|
||||
|
||||
if (item.hasOwnProperty('selected')) {
|
||||
var selectWrapper = $('<span class="red-ui-treeList-icon"></span>').appendTo(label);
|
||||
var cb = $('<input type="checkbox">').prop('checked',item.selected).appendTo(selectWrapper);
|
||||
var cb = $('<input class="red-ui-treeList-checkbox" type="checkbox">').prop('checked',item.selected).appendTo(selectWrapper);
|
||||
label.toggleClass("selected",item.selected);
|
||||
cb.on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
cb.on('change', function(e) {
|
||||
item.selected = this.checked;
|
||||
label.toggleClass("selected",this.checked);
|
||||
that._trigger("select",e,item);
|
||||
})
|
||||
} else if (!item.children) {
|
||||
label.click(function(e) {
|
||||
if (!item.children) {
|
||||
label.on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
cb.trigger("click");
|
||||
})
|
||||
}
|
||||
item.treeList.select = function(v) {
|
||||
if (v !== item.selected) {
|
||||
cb.trigger("click");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
label.on("click", function(e) {
|
||||
that._topList.find(".selected").removeClass("selected");
|
||||
label.addClass("selected");
|
||||
that._trigger("select",e,item)
|
||||
})
|
||||
label.on("dblclick", function(e) {
|
||||
if (!item.children) {
|
||||
that._trigger("confirm",e,item);
|
||||
}
|
||||
})
|
||||
}
|
||||
if (item.icon) {
|
||||
$('<span class="red-ui-treeList-icon"><i class="'+item.icon+'" /></span>').appendTo(label);
|
||||
}
|
||||
$('<span class="red-ui-treeList-label-text"></span>').text(item.label).appendTo(label);
|
||||
if (item.hasOwnProperty('label') || item.hasOwnProperty('sublabel')) {
|
||||
if (item.hasOwnProperty('label')) {
|
||||
$('<span class="red-ui-treeList-label-text"></span>').text(item.label).appendTo(label);
|
||||
}
|
||||
if (item.hasOwnProperty('sublabel')) {
|
||||
$('<span class="red-ui-treeList-sublabel-text"></span>').text(item.sublabel).appendTo(label);
|
||||
}
|
||||
|
||||
} else if (item.element) {
|
||||
$(item.element).appendTo(label);
|
||||
$(item.element).css({
|
||||
width: "calc(100% - "+(labelPaddingWidth+20+(item.icon?20:0))+"px)"
|
||||
})
|
||||
}
|
||||
if (item.children) {
|
||||
if (Array.isArray(item.children)) {
|
||||
that._addChildren(container,item.children,depth);
|
||||
if (Array.isArray(item.children) && !item.deferBuild) {
|
||||
item.treeList.childList = that._addChildren(container,item,item.children,depth).hide();
|
||||
}
|
||||
if (item.expanded) {
|
||||
label.click();
|
||||
item.treeList.expand();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -162,12 +539,19 @@
|
||||
this._topList.editableList('empty');
|
||||
},
|
||||
data: function(items) {
|
||||
var that = this;
|
||||
if (items !== undefined) {
|
||||
this._data = items;
|
||||
this._topList.editableList('empty');
|
||||
this._loadingData = true;
|
||||
for (var i=0; i<items.length;i++) {
|
||||
this._topList.editableList('addItem',items[i]);
|
||||
}
|
||||
setTimeout(function() {
|
||||
delete that._loadingData;
|
||||
},200);
|
||||
this._trigger("select")
|
||||
|
||||
} else {
|
||||
return this._data;
|
||||
}
|
||||
@ -178,6 +562,27 @@
|
||||
this._topList.editableList('show',this._data[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
select: function(item) {
|
||||
this._topList.find(".selected").removeClass("selected");
|
||||
item.treeList.label.addClass("selected");
|
||||
this._trigger("select",null,item)
|
||||
|
||||
},
|
||||
selected: function() {
|
||||
var s = this._topList.find(".selected");
|
||||
if (this.options.multi) {
|
||||
var res = [];
|
||||
s.each(function() {
|
||||
res.push($(this).parent().data('data'));
|
||||
})
|
||||
return res;
|
||||
}
|
||||
if (s.length) {
|
||||
return s.parent().data('data');
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -32,6 +32,12 @@
|
||||
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,
|
||||
@ -46,13 +52,13 @@
|
||||
parse: contextParse,
|
||||
export: contextExport
|
||||
},
|
||||
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"]},
|
||||
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"]},
|
||||
json: {
|
||||
value:"json",
|
||||
label:"JSON",
|
||||
icon:"red/images/typedInput/json.png",
|
||||
icon:"red/images/typedInput/json.svg",
|
||||
validate: function(v) { try{JSON.parse(v);return true;}catch(e){return false;}},
|
||||
expand: function() {
|
||||
var that = this;
|
||||
@ -74,12 +80,12 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.png"},
|
||||
date: {value:"date",label:"timestamp",hasValue:false},
|
||||
re: {value:"re",label:"regular expression",icon:"red/images/typedInput/re.svg"},
|
||||
date: {value:"date",label:"timestamp",icon:"fa fa-clock-o",hasValue:false},
|
||||
jsonata: {
|
||||
value: "jsonata",
|
||||
label: "expression",
|
||||
icon: "red/images/typedInput/expr.png",
|
||||
icon: "red/images/typedInput/expr.svg",
|
||||
validate: function(v) { try{jsonata(v);return true;}catch(e){return false;}},
|
||||
expand:function() {
|
||||
var that = this;
|
||||
@ -94,7 +100,7 @@
|
||||
bin: {
|
||||
value: "bin",
|
||||
label: "buffer",
|
||||
icon: "red/images/typedInput/bin.png",
|
||||
icon: "red/images/typedInput/bin.svg",
|
||||
expand: function() {
|
||||
var that = this;
|
||||
RED.editor.editBuffer({
|
||||
@ -108,7 +114,56 @@
|
||||
env: {
|
||||
value: "env",
|
||||
label: "env variable",
|
||||
icon: "red/images/typedInput/env.png"
|
||||
icon: "red/images/typedInput/env.svg"
|
||||
},
|
||||
node: {
|
||||
value: "node",
|
||||
label: "node",
|
||||
icon: "red/images/typedInput/target.svg",
|
||||
valueLabel: function(container,value) {
|
||||
var node = RED.nodes.node(value);
|
||||
var nodeDiv = $('<div>',{class:"red-ui-search-result-node"}).css({
|
||||
"margin-top": "2px",
|
||||
"margin-left": "3px"
|
||||
}).appendTo(container);
|
||||
var nodeLabel = $('<span>').css({
|
||||
"line-height": "32px",
|
||||
"margin-left": "6px"
|
||||
}).appendTo(container);
|
||||
if (node) {
|
||||
var colour = RED.utils.getNodeColor(node.type,node._def);
|
||||
var icon_url = RED.utils.getNodeIcon(node._def,node);
|
||||
if (node.type === 'tab') {
|
||||
colour = "#C0DEED";
|
||||
}
|
||||
nodeDiv.css('backgroundColor',colour);
|
||||
var iconContainer = $('<div/>',{class:"red-ui-palette-icon-container"}).appendTo(nodeDiv);
|
||||
RED.utils.createIconElement(icon_url, iconContainer, true);
|
||||
var l = RED.utils.getNodeLabel(node,node.id);
|
||||
nodeLabel.text(l);
|
||||
} else {
|
||||
nodeDiv.css({
|
||||
'backgroundColor': '#eee',
|
||||
'border-style' : 'dashed'
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
expand: function() {
|
||||
var that = this;
|
||||
RED.tray.hide();
|
||||
RED.view.selectNodes({
|
||||
single: true,
|
||||
selected: [that.value()],
|
||||
onselect: function(selection) {
|
||||
that.value(selection.id);
|
||||
RED.tray.show();
|
||||
},
|
||||
oncancel: function() {
|
||||
RED.tray.show();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
var nlsd = false;
|
||||
@ -124,7 +179,7 @@
|
||||
}
|
||||
var contextStores = RED.settings.context.stores;
|
||||
var contextOptions = contextStores.map(function(store) {
|
||||
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database" style="color: #'+(store==='memory'?'ddd':'777')+'"></i>'}
|
||||
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database"></i>'}
|
||||
})
|
||||
if (contextOptions.length < 2) {
|
||||
allOptions.flow.options = [];
|
||||
@ -138,12 +193,12 @@
|
||||
var that = this;
|
||||
|
||||
this.disarmClick = false;
|
||||
this.input = $('<input type="text"></input>');
|
||||
this.input = $('<input class="red-ui-typedInput-input" type="text"></input>');
|
||||
this.input.insertAfter(this.element);
|
||||
this.input.val(this.element.val());
|
||||
this.element.addClass('red-ui-typedInput');
|
||||
this.uiWidth = this.element.outerWidth();
|
||||
this.elementDiv = this.input.wrap("<div>").parent().addClass('red-ui-typedInput-input');
|
||||
this.elementDiv = this.input.wrap("<div>").parent().addClass('red-ui-typedInput-input-wrap');
|
||||
this.uiSelect = this.elementDiv.wrap( "<div>" ).parent();
|
||||
var attrStyle = this.element.attr('style');
|
||||
var m;
|
||||
@ -160,7 +215,7 @@
|
||||
that.input.css("margin"+d,0);
|
||||
});
|
||||
|
||||
["type","placeholder"].forEach(function(d) {
|
||||
["type","placeholder","autocomplete","data-i18n"].forEach(function(d) {
|
||||
var m = that.element.attr(d);
|
||||
that.input.attr(d,m);
|
||||
});
|
||||
@ -171,11 +226,13 @@
|
||||
|
||||
this.options.types = this.options.types||Object.keys(allOptions);
|
||||
|
||||
this.selectTrigger = $('<button tabindex="0"></button>').prependTo(this.uiSelect);
|
||||
$('<i class="red-ui-typedInput-icon fa fa-sort-desc"></i>').toggle(this.options.types.length > 1).appendTo(this.selectTrigger);
|
||||
this.selectTrigger = $('<button class="red-ui-typedInput-type-select" tabindex="0"></button>').prependTo(this.uiSelect);
|
||||
$('<i class="red-ui-typedInput-icon fa fa-caret-down"></i>').toggle(this.options.types.length > 1).appendTo(this.selectTrigger);
|
||||
|
||||
this.selectLabel = $('<span class="red-ui-typedInput-type-label"></span>').appendTo(this.selectTrigger);
|
||||
|
||||
this.valueLabelContainer = $('<div class="red-ui-typedInput-value-label">').appendTo(this.uiSelect)
|
||||
|
||||
this.types(this.options.types);
|
||||
|
||||
if (this.options.typeField) {
|
||||
@ -198,9 +255,15 @@
|
||||
that.validate();
|
||||
that.element.val(that.value());
|
||||
that.element.trigger('change',that.propertyType,that.value());
|
||||
});
|
||||
this.input.on('keydown', function(evt) {
|
||||
if (evt.keyCode >= 37 && evt.keyCode <= 40) {
|
||||
evt.stopPropagation();
|
||||
}
|
||||
})
|
||||
this.selectTrigger.click(function(event) {
|
||||
this.selectTrigger.on("click", function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
that._showTypeMenu();
|
||||
});
|
||||
this.selectTrigger.on('keydown',function(evt) {
|
||||
@ -208,31 +271,35 @@
|
||||
// Down
|
||||
that._showTypeMenu();
|
||||
}
|
||||
evt.stopPropagation();
|
||||
}).on('focus', function() {
|
||||
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||
})
|
||||
|
||||
// explicitly set optionSelectTrigger display to inline-block otherwise jQ sets it to 'inline'
|
||||
this.optionSelectTrigger = $('<button tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="red-ui-typedInput-icon fa fa-sort-desc"></i></span></button>').appendTo(this.uiSelect);
|
||||
this.optionSelectTrigger = $('<button tabindex="0" class="red-ui-typedInput-option-trigger" style="display:inline-block"><span class="red-ui-typedInput-option-caret"><i class="red-ui-typedInput-icon fa fa-caret-down"></i></span></button>').appendTo(this.uiSelect);
|
||||
this.optionSelectLabel = $('<span class="red-ui-typedInput-option-label"></span>').prependTo(this.optionSelectTrigger);
|
||||
RED.popover.tooltip(this.optionSelectLabel,function() {
|
||||
return that.optionValue;
|
||||
});
|
||||
this.optionSelectTrigger.click(function(event) {
|
||||
this.optionSelectTrigger.on("click", function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
that._showOptionSelectMenu();
|
||||
}).on('keydown', function(evt) {
|
||||
if (evt.keyCode === 40) {
|
||||
// Down
|
||||
that._showOptionSelectMenu();
|
||||
}
|
||||
evt.stopPropagation();
|
||||
}).on('blur', function() {
|
||||
that.uiSelect.removeClass('red-ui-typedInput-focus');
|
||||
}).on('focus', function() {
|
||||
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||
});
|
||||
|
||||
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"><i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i></button>').appendTo(this.uiSelect);
|
||||
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
|
||||
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);
|
||||
this.type(this.options.default||this.typeList[0].value);
|
||||
}catch(err) {
|
||||
console.log(err.stack);
|
||||
@ -241,9 +308,12 @@
|
||||
_showTypeMenu: function() {
|
||||
if (this.typeList.length > 1) {
|
||||
this._showMenu(this.menu,this.selectTrigger);
|
||||
this.menu.find("[value='"+this.propertyType+"']").focus();
|
||||
var selected = this.menu.find("[value='"+this.propertyType+"']");
|
||||
setTimeout(function() {
|
||||
selected.trigger("focus");
|
||||
},120);
|
||||
} else {
|
||||
this.input.focus();
|
||||
this.input.trigger("focus");
|
||||
}
|
||||
},
|
||||
_showOptionSelectMenu: function() {
|
||||
@ -257,25 +327,41 @@
|
||||
if (selectedOption.length === 0) {
|
||||
selectedOption = this.optionMenu.children(":first");
|
||||
}
|
||||
selectedOption.focus();
|
||||
selectedOption.trigger("focus");
|
||||
|
||||
}
|
||||
},
|
||||
_hideMenu: function(menu) {
|
||||
$(document).off("mousedown.close-property-select");
|
||||
$(document).off("mousedown.red-ui-typedInput-close-property-select");
|
||||
menu.hide();
|
||||
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.focus();
|
||||
this.input.trigger("focus");
|
||||
} else if (this.optionSelectTrigger.is(":visible")){
|
||||
this.optionSelectTrigger.focus();
|
||||
this.optionSelectTrigger.trigger("focus");
|
||||
} else {
|
||||
this.selectTrigger.focus();
|
||||
this.selectTrigger.trigger("focus");
|
||||
}
|
||||
},
|
||||
_createMenu: function(opts,callback) {
|
||||
_createMenu: function(menuOptions,opts,callback) {
|
||||
var that = this;
|
||||
var menu = $("<div>").addClass("red-ui-typedInput-options");
|
||||
opts.forEach(function(opt) {
|
||||
var menu = $("<div>").addClass("red-ui-typedInput-options red-ui-editor-dialog");
|
||||
menu.opts = opts;
|
||||
menu.callback = callback;
|
||||
menuOptions.forEach(function(opt) {
|
||||
if (typeof opt === 'string') {
|
||||
opt = {value:opt,label:opt};
|
||||
}
|
||||
@ -287,7 +373,7 @@
|
||||
if (opt.icon.indexOf("<") === 0) {
|
||||
$(opt.icon).prependTo(op);
|
||||
} else if (opt.icon.indexOf("/") !== -1) {
|
||||
$('<img>',{src:opt.icon,style:"margin-right: 4px; height: 18px;"}).prependTo(op);
|
||||
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px; height: 18px;"}).prependTo(op);
|
||||
} else {
|
||||
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(op);
|
||||
}
|
||||
@ -297,32 +383,43 @@
|
||||
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.click(function(event) {
|
||||
op.on("click", function(event) {
|
||||
event.preventDefault();
|
||||
callback(opt.value);
|
||||
that._hideMenu(menu);
|
||||
event.stopPropagation();
|
||||
if (!opts.multiple) {
|
||||
callback(opt.value);
|
||||
that._hideMenu(menu);
|
||||
} else {
|
||||
cb.prop("checked",!cb.prop("checked"));
|
||||
}
|
||||
});
|
||||
});
|
||||
menu.css({
|
||||
display: "none",
|
||||
display: "none"
|
||||
});
|
||||
menu.appendTo(document.body);
|
||||
|
||||
menu.on('keydown', function(evt) {
|
||||
if (evt.keyCode === 40) {
|
||||
evt.preventDefault();
|
||||
// DOWN
|
||||
$(this).children(":focus").next().focus();
|
||||
$(this).children(":focus").next().trigger("focus");
|
||||
} else if (evt.keyCode === 38) {
|
||||
evt.preventDefault();
|
||||
// UP
|
||||
$(this).children(":focus").prev().focus();
|
||||
$(this).children(":focus").prev().trigger("focus");
|
||||
} else if (evt.keyCode === 27) {
|
||||
// ESCAPE
|
||||
evt.preventDefault();
|
||||
that._hideMenu(menu);
|
||||
}
|
||||
evt.stopPropagation();
|
||||
})
|
||||
|
||||
|
||||
|
||||
return menu;
|
||||
|
||||
},
|
||||
@ -331,22 +428,37 @@
|
||||
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-3);
|
||||
var top = (height+pos.top);
|
||||
if (top+menuHeight > $(window).height()) {
|
||||
top -= (top+menuHeight)-$(window).height()+5;
|
||||
}
|
||||
if (top < 0) {
|
||||
menu.height(menuHeight+top)
|
||||
top = 0;
|
||||
}
|
||||
menu.css({
|
||||
top: top+"px",
|
||||
left: (2+pos.left)+"px",
|
||||
left: (pos.left)+"px",
|
||||
});
|
||||
menu.slideDown(100);
|
||||
this._delay(function() {
|
||||
that.uiSelect.addClass('red-ui-typedInput-focus');
|
||||
$(document).on("mousedown.close-property-select", function(event) {
|
||||
$(document).on("mousedown.red-ui-typedInput-close-property-select", function(event) {
|
||||
if(!$(event.target).closest(menu).length) {
|
||||
that._hideMenu(menu);
|
||||
}
|
||||
@ -357,21 +469,27 @@
|
||||
})
|
||||
});
|
||||
},
|
||||
_getLabelWidth: function(label) {
|
||||
_getLabelWidth: function(label, done) {
|
||||
var labelWidth = label.outerWidth();
|
||||
if (labelWidth === 0) {
|
||||
var container = $('<div class="red-ui-typedInput-container"></div>').css({
|
||||
var wrapper = $('<div class="red-ui-editor"></div>').css({
|
||||
position:"absolute",
|
||||
top:0,
|
||||
left:-1000
|
||||
"white-space": "nowrap",
|
||||
top:-2000
|
||||
}).appendTo(document.body);
|
||||
var container = $('<div class="red-ui-typedInput-container"></div>').appendTo(wrapper);
|
||||
var newTrigger = label.clone().appendTo(container);
|
||||
labelWidth = newTrigger.outerWidth();
|
||||
container.remove();
|
||||
setTimeout(function() {
|
||||
labelWidth = newTrigger.outerWidth();
|
||||
wrapper.remove();
|
||||
done(labelWidth);
|
||||
},50)
|
||||
} else {
|
||||
done(labelWidth);
|
||||
}
|
||||
return labelWidth;
|
||||
},
|
||||
_resize: function() {
|
||||
var that = this;
|
||||
if (this.uiWidth !== null) {
|
||||
this.uiSelect.width(this.uiWidth);
|
||||
}
|
||||
@ -380,68 +498,78 @@
|
||||
this.selectTrigger.addClass("red-ui-typedInput-full-width");
|
||||
} else {
|
||||
this.selectTrigger.removeClass("red-ui-typedInput-full-width");
|
||||
var labelWidth = this._getLabelWidth(this.selectTrigger);
|
||||
this.elementDiv.css('left',labelWidth+"px");
|
||||
if (this.optionExpandButton.is(":visible")) {
|
||||
this.elementDiv.css('right',"22px");
|
||||
} else {
|
||||
this.elementDiv.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
|
||||
});
|
||||
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 {
|
||||
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'
|
||||
that.elementDiv.css('right','0');
|
||||
that.valueLabelContainer.css('right','0');
|
||||
that.input.css({
|
||||
'border-top-right-radius': '4px',
|
||||
'border-bottom-right-radius': '4px'
|
||||
});
|
||||
}
|
||||
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 {
|
||||
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 (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);
|
||||
if (this.typeMap[this.propertyType].valueLabel) {
|
||||
if (opt.multiple) {
|
||||
this.typeMap[this.propertyType].valueLabel.call(this,this.optionSelectLabel,o);
|
||||
} else {
|
||||
// icon class
|
||||
$('<i>',{class:"red-ui-typedInput-icon "+o.icon}).prependTo(this.optionSelectLabel);
|
||||
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());
|
||||
}
|
||||
} 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());
|
||||
this.optionSelectLabel.text(o.length+" selected");
|
||||
}
|
||||
},
|
||||
_destroy: function() {
|
||||
@ -449,6 +577,7 @@
|
||||
this.optionMenu.remove();
|
||||
}
|
||||
this.menu.remove();
|
||||
this.uiSelect.remove();
|
||||
},
|
||||
types: function(types) {
|
||||
var that = this;
|
||||
@ -465,11 +594,11 @@
|
||||
return result;
|
||||
});
|
||||
this.selectTrigger.toggleClass("disabled", this.typeList.length === 1);
|
||||
this.selectTrigger.find(".fa-sort-desc").toggle(this.typeList.length > 1)
|
||||
this.selectTrigger.find(".fa-caret-down").toggle(this.typeList.length > 1)
|
||||
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 {
|
||||
@ -483,33 +612,52 @@
|
||||
this._resize();
|
||||
},
|
||||
value: function(value) {
|
||||
var that = this;
|
||||
var opt = this.typeMap[this.propertyType];
|
||||
if (!arguments.length) {
|
||||
var v = this.input.val();
|
||||
if (this.typeMap[this.propertyType].export) {
|
||||
v = this.typeMap[this.propertyType].export(v,this.optionValue)
|
||||
if (opt.export) {
|
||||
v = opt.export(v,this.optionValue)
|
||||
}
|
||||
return v;
|
||||
} else {
|
||||
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];
|
||||
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 || op === ""+value) {
|
||||
selectedOption.push(that.activeOptions[op]);
|
||||
break;
|
||||
}
|
||||
} else if (op.value === value) {
|
||||
selectedOption.push(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:""}
|
||||
} else {
|
||||
this.input.val(value);
|
||||
if (opt.valueLabel) {
|
||||
this.valueLabelContainer.empty();
|
||||
opt.valueLabel.call(this,this.valueLabelContainer,value);
|
||||
}
|
||||
this._updateOptionSelectLabel(selectedOption)
|
||||
}
|
||||
this.input.val(value);
|
||||
this.input.trigger('change',this.type(),value);
|
||||
}
|
||||
},
|
||||
@ -526,20 +674,23 @@
|
||||
}
|
||||
this.selectLabel.empty();
|
||||
var image;
|
||||
if (opt.icon) {
|
||||
if (opt.icon && opt.showLabel !== false) {
|
||||
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 = opt.icon;
|
||||
$('<img>',{src:opt.icon,style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
|
||||
image.src = mapDeprecatedIcon(opt.icon);
|
||||
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px;height: 18px;"}).prependTo(this.selectLabel);
|
||||
}
|
||||
else {
|
||||
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(this.selectLabel);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (opt.hasValue === false || (opt.showLabel !== false && !opt.icon)) {
|
||||
this.selectLabel.text(opt.label);
|
||||
}
|
||||
if (this.optionMenu) {
|
||||
@ -549,13 +700,16 @@
|
||||
if (opt.options) {
|
||||
if (this.optionExpandButton) {
|
||||
this.optionExpandButton.hide();
|
||||
this.optionExpandButton.shown = false;
|
||||
}
|
||||
if (this.optionSelectTrigger) {
|
||||
this.optionSelectTrigger.show();
|
||||
if (!opt.hasValue) {
|
||||
this.elementDiv.hide();
|
||||
this.valueLabelContainer.hide();
|
||||
} else {
|
||||
this.elementDiv.show();
|
||||
this.valueLabelContainer.hide();
|
||||
}
|
||||
this.activeOptions = {};
|
||||
opt.options.forEach(function(o) {
|
||||
@ -569,36 +723,50 @@
|
||||
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 currentVal = this.input.val();
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
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(","));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -634,7 +802,22 @@
|
||||
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) {
|
||||
this.optionSelectTrigger.hide();
|
||||
@ -643,31 +826,62 @@
|
||||
this.oldValue = this.input.val();
|
||||
this.input.val("");
|
||||
this.elementDiv.hide();
|
||||
this.valueLabelContainer.hide();
|
||||
} else if (opt.valueLabel) {
|
||||
this.valueLabelContainer.show();
|
||||
this.valueLabelContainer.empty();
|
||||
opt.valueLabel.call(this,this.valueLabelContainer,this.input.val());
|
||||
this.elementDiv.hide();
|
||||
} else {
|
||||
if (this.oldValue !== undefined) {
|
||||
this.input.val(this.oldValue);
|
||||
delete this.oldValue;
|
||||
}
|
||||
this.valueLabelContainer.hide();
|
||||
this.elementDiv.show();
|
||||
}
|
||||
if (this.optionExpandButton) {
|
||||
if (opt.expand && typeof opt.expand === 'function') {
|
||||
if (opt.expand) {
|
||||
if (opt.expand.icon) {
|
||||
this.optionExpandButtonIcon.removeClass().addClass("red-ui-typedInput-icon fa "+opt.expand.icon)
|
||||
} else {
|
||||
this.optionExpandButtonIcon.removeClass().addClass("red-ui-typedInput-icon fa fa-ellipsis-h")
|
||||
}
|
||||
this.optionExpandButton.shown = true;
|
||||
this.optionExpandButton.show();
|
||||
this.optionExpandButton.off('click');
|
||||
this.optionExpandButton.on('click',function(evt) {
|
||||
evt.preventDefault();
|
||||
opt.expand.call(that);
|
||||
if (typeof opt.expand === 'function') {
|
||||
opt.expand.call(that);
|
||||
} else {
|
||||
var container = $('<div>');
|
||||
var content = opt.expand.content.call(that,container);
|
||||
var panel = RED.popover.panel(container);
|
||||
panel.container.css({
|
||||
width:that.valueLabelContainer.width()
|
||||
});
|
||||
if (opt.expand.minWidth) {
|
||||
panel.container.css({
|
||||
minWidth: opt.expand.minWidth+"px"
|
||||
});
|
||||
}
|
||||
panel.show({
|
||||
target:that.optionExpandButton,
|
||||
onclose:content.onclose,
|
||||
align: "right"
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.optionExpandButton.shown = false;
|
||||
this.optionExpandButton.hide();
|
||||
}
|
||||
}
|
||||
this._trigger("typechange",null,this.propertyType);
|
||||
this.input.trigger('change',this.propertyType,this.value());
|
||||
}
|
||||
if (image) {
|
||||
image.onload = function() { that._resize(); }
|
||||
image.onerror = function() { that._resize(); }
|
||||
} else {
|
||||
if (!image) {
|
||||
this._resize();
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@
|
||||
RED.deploy = (function() {
|
||||
|
||||
var deploymentTypes = {
|
||||
"full":{img:"red/images/deploy-full-o.png"},
|
||||
"nodes":{img:"red/images/deploy-nodes-o.png"},
|
||||
"flows":{img:"red/images/deploy-flows-o.png"}
|
||||
"full":{img:"red/images/deploy-full-o.svg"},
|
||||
"nodes":{img:"red/images/deploy-nodes-o.svg"},
|
||||
"flows":{img:"red/images/deploy-flows-o.svg"}
|
||||
}
|
||||
|
||||
var ignoreDeployWarnings = {
|
||||
@ -36,7 +36,7 @@ RED.deploy = (function() {
|
||||
|
||||
function changeDeploymentType(type) {
|
||||
deploymentType = type;
|
||||
$("#btn-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
$("#red-ui-header-button-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,62 +44,68 @@ 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.png"
|
||||
* icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.svg"
|
||||
*/
|
||||
function init(options) {
|
||||
options = options || {};
|
||||
var type = options.type || "default";
|
||||
|
||||
if (type == "default") {
|
||||
$('<li><span class="deploy-button-group button-group">'+
|
||||
'<a id="btn-deploy" class="deploy-button disabled" href="#">'+
|
||||
'<span class="deploy-button-content">'+
|
||||
'<img id="btn-deploy-icon" src="red/images/deploy-full-o.png"> '+
|
||||
$('<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"> '+
|
||||
'<span>'+RED._("deploy.deploy")+'</span>'+
|
||||
'</span>'+
|
||||
'<span class="deploy-button-spinner hide">'+
|
||||
'<span class="red-ui-deploy-button-spinner hide">'+
|
||||
'<img src="red/images/spin.svg"/>'+
|
||||
'</span>'+
|
||||
'</a>'+
|
||||
'<a id="btn-deploy-options" data-toggle="dropdown" class="deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
||||
'</span></li>').prependTo(".header-toolbar");
|
||||
RED.menu.init({id:"btn-deploy-options",
|
||||
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
||||
'</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.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")}}},
|
||||
{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")}}},
|
||||
null,
|
||||
{id:"deploymenu-item-reload", icon:"red/images/deploy-reload.png",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"},
|
||||
{id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",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.png';
|
||||
var icon = 'red/images/deploy-full-o.svg';
|
||||
if (options.hasOwnProperty('icon')) {
|
||||
icon = options.icon;
|
||||
}
|
||||
|
||||
$('<li><span class="deploy-button-group button-group">'+
|
||||
'<a id="btn-deploy" class="deploy-button disabled" href="#">'+
|
||||
'<span class="deploy-button-content">'+
|
||||
(icon?'<img id="btn-deploy-icon" src="'+icon+'"> ':'')+
|
||||
$('<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">'+
|
||||
(icon?'<img id="red-ui-header-button-deploy-icon" src="'+icon+'"> ':'')+
|
||||
'<span>'+label+'</span>'+
|
||||
'</span>'+
|
||||
'<span class="deploy-button-spinner hide">'+
|
||||
'<span class="red-ui-deploy-button-spinner hide">'+
|
||||
'<img src="red/images/spin.svg"/>'+
|
||||
'</span>'+
|
||||
'</a>'+
|
||||
'</span></li>').prependTo(".header-toolbar");
|
||||
'</span></li>').prependTo(".red-ui-header-toolbar");
|
||||
}
|
||||
|
||||
$('#btn-deploy').click(function(event) {
|
||||
$('#red-ui-header-button-deploy').on("click", function(event) {
|
||||
event.preventDefault();
|
||||
save();
|
||||
});
|
||||
|
||||
RED.actions.add("core:deploy-flows",save);
|
||||
RED.actions.add("core:restart-flows",restart);
|
||||
if (type === "default") {
|
||||
RED.actions.add("core:restart-flows",restart);
|
||||
RED.actions.add("core:set-deploy-type-to-full",function() { RED.menu.setSelected("deploymenu-item-full",true);});
|
||||
RED.actions.add("core:set-deploy-type-to-modified-flows",function() { RED.menu.setSelected("deploymenu-item-flow",true); });
|
||||
RED.actions.add("core:set-deploy-type-to-modified-nodes",function() { RED.menu.setSelected("deploymenu-item-node",true); });
|
||||
}
|
||||
|
||||
|
||||
|
||||
RED.events.on('nodes:change',function(state) {
|
||||
@ -107,10 +113,10 @@ RED.deploy = (function() {
|
||||
window.onbeforeunload = function() {
|
||||
return RED._("deploy.confirm.undeployedChanges");
|
||||
}
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
} else {
|
||||
window.onbeforeunload = null;
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
@ -176,14 +182,14 @@ RED.deploy = (function() {
|
||||
function resolveConflict(currentNodes, activeDeploy) {
|
||||
var message = $('<div>');
|
||||
$('<p data-i18n="deploy.confirm.conflict"></p>').appendTo(message);
|
||||
var conflictCheck = $('<div id="node-dialog-confirm-deploy-conflict-checking" class="node-dialog-confirm-conflict-row">'+
|
||||
var conflictCheck = $('<div class="red-ui-deploy-dialog-confirm-conflict-row">'+
|
||||
'<img src="red/images/spin.svg"/><div data-i18n="deploy.confirm.conflictChecking"></div>'+
|
||||
'</div>').appendTo(message);
|
||||
var conflictAutoMerge = $('<div class="node-dialog-confirm-conflict-row">'+
|
||||
'<i style="color: #3a3;" class="fa fa-check"></i><div data-i18n="deploy.confirm.conflictAutoMerge"></div>'+
|
||||
var conflictAutoMerge = $('<div class="red-ui-deploy-dialog-confirm-conflict-row">'+
|
||||
'<i class="fa fa-check"></i><div data-i18n="deploy.confirm.conflictAutoMerge"></div>'+
|
||||
'</div>').hide().appendTo(message);
|
||||
var conflictManualMerge = $('<div id="node-dialog-confirm-deploy-conflict-manual-merge" class="node-dialog-confirm-conflict-row">'+
|
||||
'<i style="color: #999;" class="fa fa-exclamation"></i><div data-i18n="deploy.confirm.conflictManualMerge"></div>'+
|
||||
var conflictManualMerge = $('<div class="red-ui-deploy-dialog-confirm-conflict-row">'+
|
||||
'<i class="fa fa-exclamation"></i><div data-i18n="deploy.confirm.conflictManualMerge"></div>'+
|
||||
'</div>').hide().appendTo(message);
|
||||
|
||||
message.i18n();
|
||||
@ -196,22 +202,22 @@ RED.deploy = (function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-review",
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-review",
|
||||
text: RED._("deploy.confirm.button.review"),
|
||||
class: "primary disabled",
|
||||
click: function() {
|
||||
if (!$("#node-dialog-confirm-deploy-review").hasClass('disabled')) {
|
||||
if (!$("#red-ui-deploy-dialog-confirm-deploy-review").hasClass('disabled')) {
|
||||
RED.diff.showRemoteDiff();
|
||||
conflictNotification.close();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-merge",
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-merge",
|
||||
text: RED._("deploy.confirm.button.merge"),
|
||||
class: "primary disabled",
|
||||
click: function() {
|
||||
if (!$("#node-dialog-confirm-deploy-merge").hasClass('disabled')) {
|
||||
if (!$("#red-ui-deploy-dialog-confirm-deploy-merge").hasClass('disabled')) {
|
||||
RED.diff.mergeDiff(currentDiff);
|
||||
conflictNotification.close();
|
||||
}
|
||||
@ -220,7 +226,7 @@ RED.deploy = (function() {
|
||||
];
|
||||
if (activeDeploy) {
|
||||
buttons.push({
|
||||
id: "node-dialog-confirm-deploy-overwrite",
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-overwrite",
|
||||
text: RED._("deploy.confirm.button.overwrite"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
@ -245,11 +251,11 @@ RED.deploy = (function() {
|
||||
var d = Object.keys(diff.conflicts);
|
||||
if (d.length === 0) {
|
||||
conflictAutoMerge.show();
|
||||
$("#node-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-merge").removeClass('disabled')
|
||||
} else {
|
||||
conflictManualMerge.show();
|
||||
}
|
||||
$("#node-dialog-confirm-deploy-review").removeClass('disabled')
|
||||
$("#red-ui-deploy-dialog-confirm-deploy-review").removeClass('disabled')
|
||||
},ellapsed);
|
||||
})
|
||||
}
|
||||
@ -266,15 +272,15 @@ RED.deploy = (function() {
|
||||
}
|
||||
function restart() {
|
||||
var startTime = Date.now();
|
||||
$(".deploy-button-content").css('opacity',0);
|
||||
$(".deploy-button-spinner").show();
|
||||
var deployWasEnabled = !$("#btn-deploy").hasClass("disabled");
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$(".red-ui-deploy-button-content").css('opacity',0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
var deployWasEnabled = !$("#red-ui-header-button-deploy").hasClass("disabled");
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
deployInflight = true;
|
||||
$("#header-shade").show();
|
||||
$("#editor-shade").show();
|
||||
$("#palette-shade").show();
|
||||
$("#sidebar-shade").show();
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
$("#red-ui-palette-shade").show();
|
||||
$("#red-ui-sidebar-shade").show();
|
||||
|
||||
$.ajax({
|
||||
url:"flows",
|
||||
@ -284,12 +290,12 @@ RED.deploy = (function() {
|
||||
}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
if (deployWasEnabled) {
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
}
|
||||
RED.notify('<p>'+RED._("deploy.successfulRestart")+'</p>',"success");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
if (deployWasEnabled) {
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
}
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
@ -304,17 +310,17 @@ RED.deploy = (function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".deploy-button-content").css('opacity',1);
|
||||
$(".deploy-button-spinner").hide();
|
||||
$("#header-shade").hide();
|
||||
$("#editor-shade").hide();
|
||||
$("#palette-shade").hide();
|
||||
$("#sidebar-shade").hide();
|
||||
$(".red-ui-deploy-button-content").css('opacity',1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
$("#red-ui-sidebar-shade").hide();
|
||||
},delta);
|
||||
});
|
||||
}
|
||||
function save(skipValidation,force) {
|
||||
if (!$("#btn-deploy").hasClass("disabled")) {
|
||||
if (!$("#red-ui-header-button-deploy").hasClass("disabled")) {
|
||||
if (!RED.user.hasPermission("flows.write")) {
|
||||
RED.notify(RED._("user.errors.deploy"),"error");
|
||||
return;
|
||||
@ -355,13 +361,13 @@ RED.deploy = (function() {
|
||||
if (hasUnknown && !ignoreDeployWarnings.unknown) {
|
||||
showWarning = true;
|
||||
notificationMessage = "<p>"+RED._('deploy.confirm.unknown')+"</p>"+
|
||||
'<ul class="node-dialog-configm-deploy-list"><li>'+cropList(unknownNodes).map(function(n) { return sanitize(n) }).join("</li><li>")+"</li></ul><p>"+
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>'+cropList(unknownNodes).map(function(n) { return sanitize(n) }).join("</li><li>")+"</li></ul><p>"+
|
||||
RED._('deploy.confirm.confirm')+
|
||||
"</p>";
|
||||
|
||||
notificationButtons= [
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-deploy",
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
@ -375,12 +381,12 @@ RED.deploy = (function() {
|
||||
invalidNodes.sort(sortNodeInfo);
|
||||
|
||||
notificationMessage = "<p>"+RED._('deploy.confirm.improperlyConfigured')+"</p>"+
|
||||
'<ul class="node-dialog-configm-deploy-list"><li>'+cropList(invalidNodes.map(function(A) { return sanitize( (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")")})).join("</li><li>")+"</li></ul><p>"+
|
||||
'<ul class="red-ui-deploy-dialog-confirm-list"><li>'+cropList(invalidNodes.map(function(A) { return sanitize( (A.tab?"["+A.tab+"] ":"")+A.label+" ("+A.type+")")})).join("</li><li>")+"</li></ul><p>"+
|
||||
RED._('deploy.confirm.confirm')+
|
||||
"</p>";
|
||||
notificationButtons= [
|
||||
{
|
||||
id: "node-dialog-confirm-deploy-deploy",
|
||||
id: "red-ui-deploy-dialog-confirm-deploy-deploy",
|
||||
text: RED._("deploy.confirm.button.confirm"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
@ -411,9 +417,9 @@ RED.deploy = (function() {
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
|
||||
var startTime = Date.now();
|
||||
$(".deploy-button-content").css('opacity',0);
|
||||
$(".deploy-button-spinner").show();
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$(".red-ui-deploy-button-content").css('opacity',0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
|
||||
var data = {flows:nns};
|
||||
|
||||
@ -422,10 +428,10 @@ RED.deploy = (function() {
|
||||
}
|
||||
|
||||
deployInflight = true;
|
||||
$("#header-shade").show();
|
||||
$("#editor-shade").show();
|
||||
$("#palette-shade").show();
|
||||
$("#sidebar-shade").show();
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
$("#red-ui-palette-shade").show();
|
||||
$("#red-ui-sidebar-shade").show();
|
||||
$.ajax({
|
||||
url:"flows",
|
||||
type: "POST",
|
||||
@ -476,7 +482,7 @@ RED.deploy = (function() {
|
||||
RED.events.emit("deploy");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
RED.nodes.dirty(true);
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
} else if (xhr.status === 409) {
|
||||
@ -490,12 +496,12 @@ RED.deploy = (function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".deploy-button-content").css('opacity',1);
|
||||
$(".deploy-button-spinner").hide();
|
||||
$("#header-shade").hide();
|
||||
$("#editor-shade").hide();
|
||||
$("#palette-shade").hide();
|
||||
$("#sidebar-shade").hide();
|
||||
$(".red-ui-deploy-button-content").css('opacity',1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
$("#red-ui-sidebar-shade").hide();
|
||||
},delta);
|
||||
});
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
**/
|
||||
(function() {
|
||||
|
||||
var template = '<script type="text/x-red" data-template-name="_buffer"><div id="node-input-buffer-panels"><div id="node-input-buffer-panel-str" class="red-ui-panel"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><span class="node-input-buffer-type"><i class="fa fa-exclamation-circle"></i> <span id="node-input-buffer-type-string" data-i18n="bufferEditor.modeString"></span><span id="node-input-buffer-type-array" data-i18n="bufferEditor.modeArray"></span></span></div><div class="form-row node-text-editor-row"><div class="node-text-editor" id="node-input-buffer-str"></div></div></div><div id="node-input-buffer-panel-bin" class="red-ui-panel"><div class="form-row node-text-editor-row" style="margin-top: 10px"><div class="node-text-editor" id="node-input-buffer-bin"></div></div></div></div></script>';
|
||||
var template = '<script type="text/x-red" data-template-name="_buffer"><div id="red-ui-editor-type-buffer-panels"><div id="red-ui-editor-type-buffer-panel-str" class="red-ui-panel"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><button class="red-ui-editor-type-buffer-type red-ui-button red-ui-button-small"><i class="fa fa-exclamation-circle"></i> <span id="red-ui-editor-type-buffer-type-string" data-i18n="bufferEditor.modeString"></span><span id="red-ui-editor-type-buffer-type-array" data-i18n="bufferEditor.modeArray"></span></button></div><div class="form-row node-text-editor-row"><div class="node-text-editor" id="red-ui-editor-type-buffer-str"></div></div></div><div id="red-ui-editor-type-buffer-panel-bin" class="red-ui-panel"><div class="form-row node-text-editor-row" style="margin-top: 10px"><div class="node-text-editor" id="red-ui-editor-type-buffer-bin"></div></div></div></div></script>';
|
||||
|
||||
function stringToUTF8Array(str) {
|
||||
var data = [];
|
||||
@ -49,6 +49,9 @@
|
||||
var value = options.value;
|
||||
var onComplete = options.complete;
|
||||
var type = "_buffer"
|
||||
if ($("script[data-template-name='"+type+"']").length === 0) {
|
||||
$(template).appendTo("#red-ui-editor-node-configs");
|
||||
}
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var bufferStringEditor = [];
|
||||
var bufferBinValue;
|
||||
@ -83,18 +86,18 @@
|
||||
}
|
||||
},
|
||||
open: function(tray) {
|
||||
var trayBody = tray.find('.editor-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||
var trayBody = tray.find('.red-ui-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.red-ui-tray-body'),'dialog-form',type,'editor');
|
||||
|
||||
bufferStringEditor = RED.editor.createEditor({
|
||||
id: 'node-input-buffer-str',
|
||||
id: 'red-ui-editor-type-buffer-str',
|
||||
value: "",
|
||||
mode:"ace/mode/text"
|
||||
});
|
||||
bufferStringEditor.getSession().setValue(value||"",-1);
|
||||
|
||||
bufferBinEditor = RED.editor.createEditor({
|
||||
id: 'node-input-buffer-bin',
|
||||
id: 'red-ui-editor-type-buffer-bin',
|
||||
value: "",
|
||||
mode:"ace/mode/text",
|
||||
readOnly: true
|
||||
@ -132,8 +135,8 @@
|
||||
binBuffer.push((d<16?"0":"")+d.toString(16).toUpperCase());
|
||||
}
|
||||
if (valid) {
|
||||
$("#node-input-buffer-type-string").toggle(isString);
|
||||
$("#node-input-buffer-type-array").toggle(!isString);
|
||||
$("#red-ui-editor-type-buffer-type-string").toggle(isString);
|
||||
$("#red-ui-editor-type-buffer-type-array").toggle(!isString);
|
||||
bufferBinEditor.setValue(binBuffer.join(""),1);
|
||||
}
|
||||
return valid;
|
||||
@ -165,24 +168,24 @@
|
||||
dialogForm.i18n();
|
||||
|
||||
panels = RED.panels.create({
|
||||
id:"node-input-buffer-panels",
|
||||
id:"red-ui-editor-type-buffer-panels",
|
||||
resize: function(p1Height,p2Height) {
|
||||
var p1 = $("#node-input-buffer-panel-str");
|
||||
var p1 = $("#red-ui-editor-type-buffer-panel-str");
|
||||
p1Height -= $(p1.children()[0]).outerHeight(true);
|
||||
var editorRow = $(p1.children()[1]);
|
||||
p1Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||
$("#node-input-buffer-str").css("height",(p1Height-5)+"px");
|
||||
$("#red-ui-editor-type-buffer-str").css("height",(p1Height-5)+"px");
|
||||
bufferStringEditor.resize();
|
||||
|
||||
var p2 = $("#node-input-buffer-panel-bin");
|
||||
var p2 = $("#red-ui-editor-type-buffer-panel-bin");
|
||||
editorRow = $(p2.children()[0]);
|
||||
p2Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||
$("#node-input-buffer-bin").css("height",(p2Height-5)+"px");
|
||||
$("#red-ui-editor-type-buffer-bin").css("height",(p2Height-5)+"px");
|
||||
bufferBinEditor.resize();
|
||||
}
|
||||
});
|
||||
|
||||
$(".node-input-buffer-type").click(function(e) {
|
||||
$(".red-ui-editor-type-buffer-type").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
RED.sidebar.info.set(RED._("bufferEditor.modeDesc"));
|
||||
RED.sidebar.info.show();
|
||||
@ -202,7 +205,6 @@
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
}
|
||||
$(template).appendTo(document.body);
|
||||
RED.editor.registerTypeEditor("_buffer", definition);
|
||||
|
||||
})();
|
||||
|
@ -17,28 +17,28 @@
|
||||
|
||||
|
||||
var template = '<script type="text/x-red" data-template-name="_expression">'+
|
||||
'<div id="node-input-expression-panels">'+
|
||||
'<div id="node-input-expression-panel-expr" class="red-ui-panel">'+
|
||||
'<div class="form-row" style="margin-bottom: 3px; text-align: right;"><span class="node-input-expression-legacy"><i class="fa fa-exclamation-circle"></i> <span data-i18n="expressionEditor.compatMode"></span></span><button id="node-input-expression-reformat" class="editor-button editor-button-small"><span data-i18n="expressionEditor.format"></span></button></div>'+
|
||||
'<div class="form-row node-text-editor-row"><div class="node-text-editor" id="node-input-expression"></div></div>'+
|
||||
'<div id="red-ui-editor-type-expression-panels">'+
|
||||
'<div id="red-ui-editor-type-expression-panel-expr" class="red-ui-panel">'+
|
||||
'<div class="form-row" style="margin-bottom: 3px; text-align: right;"><button class="red-ui-editor-type-expression-legacy red-ui-button red-ui-button-small"><i class="fa fa-exclamation-circle"></i> <span data-i18n="expressionEditor.compatMode"></span></button><button id="red-ui-editor-type-expression-reformat" class="red-ui-button red-ui-button-small"><span data-i18n="expressionEditor.format"></span></button></div>'+
|
||||
'<div class="form-row node-text-editor-row"><div class="node-text-editor" id="red-ui-editor-type-expression"></div></div>'+
|
||||
'</div>'+
|
||||
'<div id="node-input-expression-panel-info" class="red-ui-panel">'+
|
||||
'<div id="red-ui-editor-type-expression-panel-info" class="red-ui-panel">'+
|
||||
'<div class="form-row">'+
|
||||
'<ul id="node-input-expression-tabs"></ul>'+
|
||||
'<div id="node-input-expression-tab-help" class="node-input-expression-tab-content hide">'+
|
||||
'<ul id="red-ui-editor-type-expression-tabs"></ul>'+
|
||||
'<div id="red-ui-editor-type-expression-tab-help" class="red-ui-editor-type-expression-tab-content hide">'+
|
||||
'<div>'+
|
||||
'<select id="node-input-expression-func"></select>'+
|
||||
'<button id="node-input-expression-func-insert" class="editor-button" data-i18n="expressionEditor.insert"></button>'+
|
||||
'<select id="red-ui-editor-type-expression-func"></select>'+
|
||||
'<button id="red-ui-editor-type-expression-func-insert" class="red-ui-button" data-i18n="expressionEditor.insert"></button>'+
|
||||
'</div>'+
|
||||
'<div id="node-input-expression-help"></div>'+
|
||||
'<div id="red-ui-editor-type-expression-help"></div>'+
|
||||
'</div>'+
|
||||
'<div id="node-input-expression-tab-test" class="node-input-expression-tab-content hide">'+
|
||||
'<div id="red-ui-editor-type-expression-tab-test" class="red-ui-editor-type-expression-tab-content hide">'+
|
||||
'<div>'+
|
||||
'<span style="display: inline-block; width: calc(50% - 5px);"><span data-i18n="expressionEditor.data"></span><button style="float: right; margin-right: 5px;" id="node-input-example-reformat" class="editor-button editor-button-small"><span data-i18n="jsonEditor.format"></span></button></span>'+
|
||||
'<span style="display: inline-block; width: calc(50% - 5px);" data-i18n="expressionEditor.result"></span>'+
|
||||
'<span style="display: inline-block; width: calc(50% - 5px);"><span data-i18n="expressionEditor.data"></span><button style="float: right; margin-right: 5px;" id="node-input-example-reformat" class="red-ui-button red-ui-button-small"><span data-i18n="jsonEditor.format"></span></button></span>'+
|
||||
'<span style="display: inline-block; margin-left: 10px; width: calc(50% - 5px);" data-i18n="expressionEditor.result"></span>'+
|
||||
'</div>'+
|
||||
'<div style="display: inline-block; width: calc(50% - 5px);" class="node-text-editor" id="node-input-expression-test-data"></div>'+
|
||||
'<div style="display: inline-block; width: calc(50% - 5px);" class="node-text-editor" id="node-input-expression-test-result"></div>'+
|
||||
'<div style="display: inline-block; width: calc(50% - 5px);" class="node-text-editor" id="red-ui-editor-type-expression-test-data"></div>'+
|
||||
'<div style="display: inline-block; margin-left: 10px; width:calc(50% - 5px);" class="node-text-editor" id="red-ui-editor-type-expression-test-result"></div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
@ -52,6 +52,9 @@
|
||||
var value = options.value;
|
||||
var onComplete = options.complete;
|
||||
var type = "_expression"
|
||||
if ($("script[data-template-name='"+type+"']").length === 0) {
|
||||
$(template).appendTo("#red-ui-editor-node-configs");
|
||||
}
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var expressionEditor;
|
||||
var testDataEditor;
|
||||
@ -74,7 +77,7 @@
|
||||
text: RED._("common.label.done"),
|
||||
class: "primary",
|
||||
click: function() {
|
||||
$("#node-input-expression-help").text("");
|
||||
$("#red-ui-editor-type-expression-help").text("");
|
||||
onComplete(expressionEditor.getValue());
|
||||
RED.tray.close();
|
||||
}
|
||||
@ -88,23 +91,23 @@
|
||||
|
||||
},
|
||||
open: function(tray) {
|
||||
var trayBody = tray.find('.editor-tray-body');
|
||||
trayBody.addClass("node-input-expression-editor")
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form','_expression','editor');
|
||||
var funcSelect = $("#node-input-expression-func");
|
||||
var trayBody = tray.find('.red-ui-tray-body');
|
||||
trayBody.addClass("red-ui-editor-type-expression")
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.red-ui-tray-body'),'dialog-form','_expression','editor');
|
||||
var funcSelect = $("#red-ui-editor-type-expression-func");
|
||||
Object.keys(jsonata.functions).forEach(function(f) {
|
||||
funcSelect.append($("<option></option>").val(f).text(f));
|
||||
})
|
||||
funcSelect.change(function(e) {
|
||||
funcSelect.on("change", function(e) {
|
||||
var f = $(this).val();
|
||||
var args = RED._('jsonata:'+f+".args",{defaultValue:''});
|
||||
var title = "<h5>"+f+"("+args+")</h5>";
|
||||
var body = marked(RED._('jsonata:'+f+'.desc',{defaultValue:''}));
|
||||
$("#node-input-expression-help").html(title+"<p>"+body+"</p>");
|
||||
$("#red-ui-editor-type-expression-help").html(title+"<p>"+body+"</p>");
|
||||
|
||||
})
|
||||
expressionEditor = RED.editor.createEditor({
|
||||
id: 'node-input-expression',
|
||||
id: 'red-ui-editor-type-expression',
|
||||
value: "",
|
||||
mode:"ace/mode/jsonata",
|
||||
options: {
|
||||
@ -180,13 +183,13 @@
|
||||
expressionEditor.session.removeMarker(currentFunctionMarker);
|
||||
if (scopedFunction) {
|
||||
//console.log(token,.map(function(t) { return t.type}));
|
||||
funcSelect.val(scopedFunction.value).change();
|
||||
funcSelect.val(scopedFunction.value).trigger("change");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dialogForm.i18n();
|
||||
$("#node-input-expression-func-insert").click(function(e) {
|
||||
$("#red-ui-editor-type-expression-func-insert").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var pos = expressionEditor.getCursorPosition();
|
||||
var f = funcSelect.val();
|
||||
@ -194,7 +197,7 @@
|
||||
expressionEditor.insertSnippet(snippet);
|
||||
expressionEditor.focus();
|
||||
});
|
||||
$("#node-input-expression-reformat").click(function(evt) {
|
||||
$("#red-ui-editor-type-expression-reformat").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var v = expressionEditor.getValue()||"";
|
||||
try {
|
||||
@ -206,9 +209,9 @@
|
||||
});
|
||||
|
||||
var tabs = RED.tabs.create({
|
||||
element: $("#node-input-expression-tabs"),
|
||||
element: $("#red-ui-editor-type-expression-tabs"),
|
||||
onchange:function(tab) {
|
||||
$(".node-input-expression-tab-content").hide();
|
||||
$(".red-ui-editor-type-expression-tab-content").hide();
|
||||
tab.content.show();
|
||||
trayOptions.resize();
|
||||
}
|
||||
@ -217,21 +220,21 @@
|
||||
tabs.addTab({
|
||||
id: 'expression-help',
|
||||
label: RED._('expressionEditor.functionReference'),
|
||||
content: $("#node-input-expression-tab-help")
|
||||
content: $("#red-ui-editor-type-expression-tab-help")
|
||||
});
|
||||
tabs.addTab({
|
||||
id: 'expression-tests',
|
||||
label: RED._('expressionEditor.test'),
|
||||
content: $("#node-input-expression-tab-test")
|
||||
content: $("#red-ui-editor-type-expression-tab-test")
|
||||
});
|
||||
testDataEditor = RED.editor.createEditor({
|
||||
id: 'node-input-expression-test-data',
|
||||
id: 'red-ui-editor-type-expression-test-data',
|
||||
value: expressionTestCache[expressionTestCacheId] || '{\n "payload": "hello world"\n}',
|
||||
mode:"ace/mode/json",
|
||||
lineNumbers: false
|
||||
});
|
||||
var changeTimer;
|
||||
$(".node-input-expression-legacy").click(function(e) {
|
||||
$(".red-ui-editor-type-expression-legacy").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
RED.sidebar.info.set(RED._("expressionEditor.compatModeDesc"));
|
||||
RED.sidebar.info.show();
|
||||
@ -243,7 +246,7 @@
|
||||
var expr;
|
||||
var usesContext = false;
|
||||
var legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(currentExpression);
|
||||
$(".node-input-expression-legacy").toggle(legacyMode);
|
||||
$(".red-ui-editor-type-expression-legacy").toggle(legacyMode);
|
||||
try {
|
||||
expr = jsonata(currentExpression);
|
||||
expr.assign('flowContext',function(val) {
|
||||
@ -295,33 +298,33 @@
|
||||
});
|
||||
|
||||
testResultEditor = RED.editor.createEditor({
|
||||
id: 'node-input-expression-test-result',
|
||||
id: 'red-ui-editor-type-expression-test-result',
|
||||
value: "",
|
||||
mode:"ace/mode/json",
|
||||
lineNumbers: false,
|
||||
readOnly: true
|
||||
});
|
||||
panels = RED.panels.create({
|
||||
id:"node-input-expression-panels",
|
||||
id:"red-ui-editor-type-expression-panels",
|
||||
resize: function(p1Height,p2Height) {
|
||||
var p1 = $("#node-input-expression-panel-expr");
|
||||
var p1 = $("#red-ui-editor-type-expression-panel-expr");
|
||||
p1Height -= $(p1.children()[0]).outerHeight(true);
|
||||
var editorRow = $(p1.children()[1]);
|
||||
p1Height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||
$("#node-input-expression").css("height",(p1Height-5)+"px");
|
||||
$("#red-ui-editor-type-expression").css("height",(p1Height-5)+"px");
|
||||
expressionEditor.resize();
|
||||
|
||||
var p2 = $("#node-input-expression-panel-info > .form-row > div:first-child");
|
||||
var p2 = $("#red-ui-editor-type-expression-panel-info > .form-row > div:first-child");
|
||||
p2Height -= p2.outerHeight(true) + 20;
|
||||
$(".node-input-expression-tab-content").height(p2Height);
|
||||
$("#node-input-expression-test-data").css("height",(p2Height-5)+"px");
|
||||
$(".red-ui-editor-type-expression-tab-content").height(p2Height);
|
||||
$("#red-ui-editor-type-expression-test-data").css("height",(p2Height-5)+"px");
|
||||
testDataEditor.resize();
|
||||
$("#node-input-expression-test-result").css("height",(p2Height-5)+"px");
|
||||
$("#red-ui-editor-type-expression-test-result").css("height",(p2Height-5)+"px");
|
||||
testResultEditor.resize();
|
||||
}
|
||||
});
|
||||
|
||||
$("#node-input-example-reformat").click(function(evt) {
|
||||
$("#node-input-example-reformat").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var v = testDataEditor.getValue()||"";
|
||||
try {
|
||||
@ -346,6 +349,5 @@
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
}
|
||||
$(template).appendTo(document.body);
|
||||
RED.editor.registerTypeEditor("_expression", definition);
|
||||
})();
|
||||
|
@ -23,6 +23,9 @@
|
||||
var value = options.value;
|
||||
var onComplete = options.complete;
|
||||
var type = "_js"
|
||||
if ($("script[data-template-name='"+type+"']").length === 0) {
|
||||
$(template).appendTo("#red-ui-editor-node-configs");
|
||||
}
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var expressionEditor;
|
||||
var changeTimer;
|
||||
@ -59,8 +62,8 @@
|
||||
expressionEditor.resize();
|
||||
},
|
||||
open: function(tray) {
|
||||
var trayBody = tray.find('.editor-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||
var trayBody = tray.find('.red-ui-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.red-ui-tray-body'),'dialog-form',type,'editor');
|
||||
expressionEditor = RED.editor.createEditor({
|
||||
id: 'node-input-js',
|
||||
mode: options.mode || 'ace/mode/javascript',
|
||||
@ -96,7 +99,6 @@
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
}
|
||||
$(template).appendTo(document.body);
|
||||
RED.editor.registerTypeEditor("_js", definition);
|
||||
|
||||
})();
|
||||
|
@ -16,13 +16,429 @@
|
||||
(function() {
|
||||
|
||||
|
||||
var template = '<script type="text/x-red" data-template-name="_json"><div class="form-row" style="margin-bottom: 3px; text-align: right;"><button id="node-input-json-reformat" class="editor-button editor-button-small"><span data-i18n="jsonEditor.format"></span></button></div><div class="form-row node-text-editor-row"><div style="height: 200px;min-height: 150px;" class="node-text-editor" id="node-input-json"></div></div></script>';
|
||||
// var template = '<script type="text/x-red" data-template-name="_json"></script>';
|
||||
var template = '<script type="text/x-red" data-template-name="_json">'+
|
||||
'<ul id="red-ui-editor-type-json-tabs"></ul>'+
|
||||
'<div id="red-ui-editor-type-json-tab-raw" class="red-ui-editor-type-json-tab-content hide">'+
|
||||
'<div class="form-row" style="margin-bottom: 3px; text-align: right;">'+
|
||||
'<button id="node-input-json-reformat" class="red-ui-button red-ui-button-small"><span data-i18n="jsonEditor.format"></span></button>'+
|
||||
'</div>'+
|
||||
'<div class="form-row node-text-editor-row">'+
|
||||
'<div style="height: 200px;min-height: 150px;" class="node-text-editor" id="node-input-json"></div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'<div id="red-ui-editor-type-json-tab-ui" class="red-ui-editor-type-json-tab-content hide">'+
|
||||
'<div id="red-ui-editor-type-json-tab-ui-container"></div>'+
|
||||
'</div>'+
|
||||
'</script>';
|
||||
|
||||
var activeTab;
|
||||
|
||||
function insertNewItem(parent,index,copyIndex) {
|
||||
var newValue = "";
|
||||
|
||||
if (parent.children.length > 0) {
|
||||
switch (parent.children[Math.max(0,Math.min(parent.children.length-1,copyIndex))].type) {
|
||||
case 'string': newValue = ""; break;
|
||||
case 'number': newValue = 0; break;
|
||||
case 'boolean': newValue = true; break;
|
||||
case 'null': newValue = null; break;
|
||||
case 'object': newValue = {}; break;
|
||||
case 'array': newValue = []; break;
|
||||
}
|
||||
}
|
||||
var newKey;
|
||||
if (parent.type === 'array') {
|
||||
newKey = parent.children.length;
|
||||
} else {
|
||||
var usedKeys = {};
|
||||
parent.children.forEach(function(child) { usedKeys[child.key] = true })
|
||||
var keyRoot = "item";
|
||||
var keySuffix = 2;
|
||||
newKey = keyRoot;
|
||||
while(usedKeys[newKey]) {
|
||||
newKey = keyRoot+"-"+(keySuffix++);
|
||||
}
|
||||
}
|
||||
var newItem = handleItem(newKey,newValue,parent.depth+1,parent);
|
||||
parent.treeList.insertChildAt(newItem, index, true);
|
||||
parent.treeList.expand();
|
||||
}
|
||||
function showObjectMenu(button,item) {
|
||||
var elementPos = button.offset();
|
||||
var options = [];
|
||||
if (item.parent) {
|
||||
options.push({id:"red-ui-editor-type-json-menu-insert-above", icon:"fa fa-toggle-up", label:RED._('jsonEditor.insertAbove'),onselect:function(){
|
||||
var index = item.parent.children.indexOf(item);
|
||||
insertNewItem(item.parent,index,index);
|
||||
}});
|
||||
options.push({id:"red-ui-editor-type-json-menu-insert-below", icon:"fa fa-toggle-down", label:RED._('jsonEditor.insertBelow'),onselect:function(){
|
||||
var index = item.parent.children.indexOf(item)+1;
|
||||
insertNewItem(item.parent,index,index-1);
|
||||
}});
|
||||
}
|
||||
if (item.type === 'array' || item.type === 'object') {
|
||||
options.push({id:"red-ui-editor-type-json-menu-add-child", icon:"fa fa-plus", label:RED._('jsonEditor.addItem'),onselect:function(){
|
||||
insertNewItem(item,item.children.length,item.children.length-1);
|
||||
}});
|
||||
}
|
||||
if (item.parent) {
|
||||
options.push({id:"red-ui-editor-type-json-menu-copy-path", icon:"fa fa-terminal", label:RED._('jsonEditor.copyPath'),onselect:function(){
|
||||
var i = item;
|
||||
var path = "";
|
||||
var newPath;
|
||||
while(i.parent) {
|
||||
if (i.parent.type === "array") {
|
||||
newPath = "["+i.key+"]";
|
||||
} else {
|
||||
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(i.key)) {
|
||||
newPath = i.key;
|
||||
} else {
|
||||
newPath = "[\""+i.key.replace(/"/,"\\\"")+"\"]"
|
||||
}
|
||||
}
|
||||
path = newPath+(path.length>0 && path[0] !== "["?".":"")+path;
|
||||
i = i.parent;
|
||||
}
|
||||
RED.clipboard.copyText(path,item.element,"clipboard.copyMessagePath");
|
||||
}});
|
||||
|
||||
options.push({id:"red-ui-editor-type-json-menu-duplicate", icon:"fa fa-copy", label:RED._("jsonEditor.duplicate"),onselect:function(){
|
||||
var newKey = item.key;
|
||||
if (item.parent.type === 'array') {
|
||||
newKey = parent.children.length;
|
||||
} else {
|
||||
var m = /^(.*?)(-(\d+))?$/.exec(newKey);
|
||||
var usedKeys = {};
|
||||
item.parent.children.forEach(function(child) { usedKeys[child.key] = true })
|
||||
var keyRoot = m[1];
|
||||
var keySuffix = 2;
|
||||
if (m[3] !== undefined) {
|
||||
keySuffix = parseInt(m[3]);
|
||||
}
|
||||
newKey = keyRoot;
|
||||
while(usedKeys[newKey]) {
|
||||
newKey = keyRoot+"-"+(keySuffix++);
|
||||
}
|
||||
}
|
||||
var newItem = handleItem(newKey,convertToObject(item),item.parent.depth+1,item.parent);
|
||||
var index = item.parent.children.indexOf(item)+1;
|
||||
|
||||
item.parent.treeList.insertChildAt(newItem, index, true);
|
||||
item.parent.treeList.expand();
|
||||
}});
|
||||
|
||||
options.push({id:"red-ui-editor-type-json-menu-delete", icon:"fa fa-times", label:RED._('common.label.delete'),onselect:function(){
|
||||
item.treeList.remove();
|
||||
}});
|
||||
}
|
||||
if (item.type === 'array' || item.type === 'object') {
|
||||
options.push(null)
|
||||
options.push({id:"red-ui-editor-type-json-menu-expand-children",icon:"fa fa-angle-double-down", label:RED._('jsonEditor.expandItems'),onselect:function(){
|
||||
item.treeList.expand();
|
||||
item.children.forEach(function(child) {
|
||||
child.treeList.expand();
|
||||
})
|
||||
}});
|
||||
options.push({id:"red-ui-editor-type-json-menu-collapse-children",icon:"fa fa-angle-double-up", label:RED._('jsonEditor.collapseItems'),onselect:function(){
|
||||
item.treeList.collapse();
|
||||
item.children.forEach(function(child) {
|
||||
child.treeList.collapse();
|
||||
})
|
||||
}});
|
||||
}
|
||||
|
||||
var menuOptionMenu = RED.menu.init({
|
||||
id:"red-ui-editor-type-json-menu",
|
||||
options: options
|
||||
});
|
||||
menuOptionMenu.css({
|
||||
position: "absolute"
|
||||
})
|
||||
menuOptionMenu.on('mouseleave', function(){ $(this).hide() });
|
||||
menuOptionMenu.on('mouseup', function() { $(this).hide() });
|
||||
menuOptionMenu.appendTo("body");
|
||||
var top = elementPos.top;
|
||||
var height = menuOptionMenu.height();
|
||||
var winHeight = $(window).height();
|
||||
if (top+height > winHeight) {
|
||||
top -= (top+height)-winHeight + 20;
|
||||
}
|
||||
menuOptionMenu.css({
|
||||
top: top+"px",
|
||||
left: elementPos.left+"px"
|
||||
})
|
||||
menuOptionMenu.show();
|
||||
}
|
||||
|
||||
function parseObject(obj,depth,parent) {
|
||||
var result = [];
|
||||
for (var prop in obj) {
|
||||
if (obj.hasOwnProperty(prop)) {
|
||||
result.push(handleItem(prop,obj[prop],depth,parent));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function parseArray(obj,depth,parent) {
|
||||
var result = [];
|
||||
var l = obj.length;
|
||||
for (var i=0;i<l;i++) {
|
||||
result.push(handleItem(i,obj[i],depth,parent));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function handleItem(key,val,depth,parent) {
|
||||
var item = {depth:depth, type: typeof val};
|
||||
var container = $('<span class="red-ui-editor-type-json-editor-label">');
|
||||
if (key != null) {
|
||||
item.key = key;
|
||||
var keyText;
|
||||
if (typeof key === 'string') {
|
||||
keyText = '"'+key+'"';
|
||||
} else {
|
||||
keyText = key;
|
||||
}
|
||||
var keyLabel = $('<span class="red-ui-debug-msg-object-key red-ui-editor-type-json-editor-label-key">').text(keyText).appendTo(container);
|
||||
keyLabel.addClass('red-ui-debug-msg-type-'+(typeof key));
|
||||
if (parent && parent.type === "array") {
|
||||
keyLabel.addClass("red-ui-editor-type-json-editor-label-array-key")
|
||||
}
|
||||
|
||||
keyLabel.on("click", function(evt) {
|
||||
if (item.parent.type === 'array') {
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
var w = Math.max(150,keyLabel.width());
|
||||
var keyInput = $('<input type="text" class="red-ui-editor-type-json-editor-key">').css({width:w+"px"}).val(""+item.key).insertAfter(keyLabel).typedInput({types:['str']});
|
||||
$(document).on("mousedown.nr-ui-json-editor", function(evt) {
|
||||
var typedInputElement = keyInput.next(".red-ui-typedInput-container")[0];
|
||||
var target = evt.target;
|
||||
while (target.nodeName !== 'BODY' && target !== typedInputElement && !$(target).hasClass("red-ui-typedInput-options")) {
|
||||
target = target.parentElement;
|
||||
}
|
||||
if (target.nodeName === 'BODY') {
|
||||
var newKey = keyInput.typedInput("value");
|
||||
item.key = newKey;
|
||||
var keyText;
|
||||
if (typeof newKey === 'string') {
|
||||
keyText = '"'+newKey+'"';
|
||||
} else {
|
||||
keyText = newKey;
|
||||
}
|
||||
keyLabel.text(keyText);
|
||||
keyInput.remove();
|
||||
keyLabel.show();
|
||||
$(document).off("mousedown.nr-ui-json-editor");
|
||||
$(document).off("keydown.nr-ui-json-editor");
|
||||
}
|
||||
});
|
||||
$(document).on("keydown.nr-ui-json-editor",function(evt) {
|
||||
if (evt.keyCode === 27) {
|
||||
// Escape
|
||||
keyInput.remove();
|
||||
keyLabel.show();
|
||||
$(document).off("mousedown.nr-ui-json-editor");
|
||||
$(document).off("keydown.nr-ui-json-editor");
|
||||
}
|
||||
});
|
||||
keyLabel.hide();
|
||||
});
|
||||
$('<span>').text(" : ").appendTo(container);
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
item.expanded = depth < 2;
|
||||
item.type = "array";
|
||||
item.deferBuild = depth >= 2;
|
||||
item.children = parseArray(val,depth+1,item);
|
||||
} else if (val !== null && item.type === "object") {
|
||||
item.expanded = depth < 2;
|
||||
item.children = parseObject(val,depth+1,item);
|
||||
item.deferBuild = depth >= 2;
|
||||
} else {
|
||||
item.value = val;
|
||||
if (val === null) {
|
||||
item.type = 'null'
|
||||
}
|
||||
}
|
||||
|
||||
var valType;
|
||||
var valValue = "";
|
||||
var valClass;
|
||||
switch(item.type) {
|
||||
case 'string': valType = 'str'; valValue = '"'+item.value+'"'; valClass = "red-ui-debug-msg-type-string"; break;
|
||||
case 'number': valType = 'num'; valValue = item.value; valClass = "red-ui-debug-msg-type-number";break;
|
||||
case 'boolean': valType = 'bool'; valValue = item.value; valClass = "red-ui-debug-msg-type-other";break;
|
||||
case 'null': valType = item.type; valValue = item.type; valClass = "red-ui-debug-msg-type-null";break;
|
||||
case 'object':
|
||||
valType = item.type;
|
||||
valValue = item.type;//+"{"+item.children.length+"}";
|
||||
valClass = "red-ui-debug-msg-type-meta";
|
||||
break;
|
||||
case 'array':
|
||||
valType = item.type;
|
||||
valValue = item.type+"["+item.children.length+"]";
|
||||
valClass = "red-ui-debug-msg-type-meta";
|
||||
break;
|
||||
}
|
||||
//
|
||||
var orphanedChildren;
|
||||
var valueLabel = $('<span class="red-ui-editor-type-json-editor-label-value">').addClass(valClass).text(valValue).appendTo(container);
|
||||
valueLabel.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (valType === 'str') {
|
||||
valValue = valValue.substring(1,valValue.length-1);
|
||||
} else if (valType === 'array') {
|
||||
valValue = "";
|
||||
} else if (valType === 'object') {
|
||||
valValue = "";
|
||||
}
|
||||
var w = Math.max(150,valueLabel.width());
|
||||
var val = $('<input type="text" class="red-ui-editor-type-json-editor-value">').css({width:w+"px"}).val(""+valValue).insertAfter(valueLabel).typedInput({
|
||||
types:[
|
||||
'str','num','bool',
|
||||
{value:"null",label:"null",hasValue:false},
|
||||
{value:"array",label:"array",hasValue:false},
|
||||
{value:"object",label:"object",hasValue:false}
|
||||
],
|
||||
default: valType
|
||||
});
|
||||
$(document).on("mousedown.nr-ui-json-editor", function(evt) {
|
||||
var typedInputElement = val.next(".red-ui-typedInput-container")[0];
|
||||
var target = evt.target;
|
||||
while (target.nodeName !== 'BODY' && target !== typedInputElement && !$(target).hasClass("red-ui-typedInput-options")) {
|
||||
target = target.parentElement;
|
||||
}
|
||||
if (target.nodeName === 'BODY') {
|
||||
valType = val.typedInput("type");
|
||||
valValue = val.typedInput("value");
|
||||
if (valType === 'num') {
|
||||
valValue = valValue.trim();
|
||||
if (isNaN(valValue)) {
|
||||
valType = 'str';
|
||||
} else if (valValue === "") {
|
||||
valValue = 0;
|
||||
}
|
||||
}
|
||||
item.value = valValue;
|
||||
var valClass;
|
||||
switch(valType) {
|
||||
case 'str': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "string"; valClass = "red-ui-debug-msg-type-string"; valValue = '"'+valValue+'"'; break;
|
||||
case 'num': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "number"; valClass = "red-ui-debug-msg-type-number"; break;
|
||||
case 'bool': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "boolean"; valClass = "red-ui-debug-msg-type-other"; item.value = (valValue === "true"); break;
|
||||
case 'null': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "null"; valClass = "red-ui-debug-msg-type-null"; item.value = valValue = "null"; break;
|
||||
case 'object':
|
||||
item.treeList.makeParent(orphanedChildren);
|
||||
item.type = "object";
|
||||
valClass = "red-ui-debug-msg-type-meta";
|
||||
item.value = valValue = "object";
|
||||
item.children.forEach(function(child,i) {
|
||||
if (child.hasOwnProperty('_key')) {
|
||||
child.key = child._key;
|
||||
delete child._key;
|
||||
var keyText;
|
||||
var keyLabel = child.element.find(".red-ui-editor-type-json-editor-label-key");
|
||||
keyLabel.removeClass("red-ui-editor-type-json-editor-label-array-key");
|
||||
if (typeof child.key === 'string') {
|
||||
keyText = '"'+child.key+'"';
|
||||
keyLabel.addClass('red-ui-debug-msg-type-string');
|
||||
keyLabel.removeClass('red-ui-debug-msg-type-number');
|
||||
} else {
|
||||
keyText = child.key;
|
||||
keyLabel.removeClass('red-ui-debug-msg-type-string');
|
||||
keyLabel.addClass('red-ui-debug-msg-type-number');
|
||||
}
|
||||
keyLabel.text(keyText);
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'array':
|
||||
item.treeList.makeParent(orphanedChildren);
|
||||
item.type = "array";
|
||||
valClass = "red-ui-debug-msg-type-meta";
|
||||
item.value = valValue = "array["+(item.children.length)+"]";
|
||||
item.children.forEach(function(child,i) {
|
||||
child._key = child.key;
|
||||
child.key = i;
|
||||
child.element.find(".red-ui-editor-type-json-editor-label-key")
|
||||
.addClass("red-ui-editor-type-json-editor-label-array-key")
|
||||
.text(""+child.key)
|
||||
.removeClass('red-ui-debug-msg-type-string')
|
||||
.addClass('red-ui-debug-msg-type-number');
|
||||
})
|
||||
break;
|
||||
}
|
||||
valueLabel.text(valValue).removeClass().addClass("red-ui-editor-type-json-editor-label-value "+valClass);
|
||||
val.remove();
|
||||
valueLabel.show();
|
||||
$(document).off("mousedown.nr-ui-json-editor");
|
||||
$(document).off("keydown.nr-ui-json-editor");
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on("keydown.nr-ui-json-editor",function(evt) {
|
||||
if (evt.keyCode === 27) {
|
||||
// Escape
|
||||
val.remove();
|
||||
valueLabel.show();
|
||||
if (valType === 'str') {
|
||||
valValue = '"'+valValue+'"';
|
||||
}
|
||||
$(document).off("mousedown.nr-ui-json-editor");
|
||||
$(document).off("keydown.nr-ui-json-editor");
|
||||
}
|
||||
});
|
||||
valueLabel.hide();
|
||||
})
|
||||
item.gutter = $('<span class="red-ui-editor-type-json-editor-item-gutter"></span>');
|
||||
|
||||
if (parent) {//red-ui-editor-type-json-editor-item-handle
|
||||
$('<span class="red-ui-editor-type-json-editor-item-handle"><i class="fa fa-bars"></span>').appendTo(item.gutter);
|
||||
} else {
|
||||
$('<span></span>').appendTo(item.gutter);
|
||||
}
|
||||
$('<button type="button" class="editor-button editor-button-small"><i class="fa fa-caret-down"></button>').appendTo(item.gutter).on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
showObjectMenu($(this), item);
|
||||
});
|
||||
item.element = container;
|
||||
return item;
|
||||
}
|
||||
function convertToObject(item) {
|
||||
var element;
|
||||
switch (item.type) {
|
||||
case 'string': element = item.value; break;
|
||||
case 'number': element = Number(item.value); break;
|
||||
case 'boolean': element = item.value; break;
|
||||
case 'null': element = null; break;
|
||||
case 'object':
|
||||
element = {};
|
||||
item.children.forEach(function(child) {
|
||||
element[child.key] = convertToObject(child);
|
||||
})
|
||||
break;
|
||||
case 'array':
|
||||
element = item.children.map(function(child) {
|
||||
return convertToObject(child);
|
||||
})
|
||||
break;
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
var definition = {
|
||||
show: function(options) {
|
||||
var value = options.value;
|
||||
var onComplete = options.complete;
|
||||
var type = "_json"
|
||||
if ($("script[data-template-name='"+type+"']").length === 0) {
|
||||
$(template).appendTo("#red-ui-editor-node-configs");
|
||||
}
|
||||
RED.view.state(RED.state.EDITING);
|
||||
var expressionEditor;
|
||||
var changeTimer;
|
||||
@ -38,9 +454,11 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var rootNode;
|
||||
|
||||
var trayOptions = {
|
||||
title: options.title,
|
||||
width: "inherit",
|
||||
width: options.width||700,
|
||||
buttons: [
|
||||
{
|
||||
id: "node-dialog-cancel",
|
||||
@ -57,25 +475,60 @@
|
||||
if (options.requireValid && !checkValid()) {
|
||||
return;
|
||||
}
|
||||
onComplete(expressionEditor.getValue());
|
||||
var result;
|
||||
if (activeTab === "json-ui") {
|
||||
if (rootNode) {
|
||||
result = JSON.stringify(convertToObject(rootNode),null,4);
|
||||
} else {
|
||||
result = expressionEditor.getValue();
|
||||
}
|
||||
} else if (activeTab === "json-raw") {
|
||||
result = expressionEditor.getValue();
|
||||
}
|
||||
onComplete && onComplete(result);
|
||||
RED.tray.close();
|
||||
}
|
||||
}
|
||||
],
|
||||
resize: function(dimensions) {
|
||||
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
||||
var editorRow = $("#dialog-form>div.node-text-editor-row");
|
||||
var height = $("#dialog-form").height();
|
||||
for (var i=0;i<rows.size();i++) {
|
||||
height -= $(rows[i]).outerHeight(true);
|
||||
}
|
||||
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
|
||||
$(".node-text-editor").css("height",height+"px");
|
||||
var height = $(".red-ui-editor-type-json-tab-content").height();
|
||||
$(".node-text-editor").css("height",(height-45)+"px");
|
||||
expressionEditor.resize();
|
||||
},
|
||||
open: function(tray) {
|
||||
var trayBody = tray.find('.editor-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.editor-tray-body'),'dialog-form',type,'editor');
|
||||
var trayBody = tray.find('.red-ui-tray-body');
|
||||
var dialogForm = RED.editor.buildEditForm(tray.find('.red-ui-tray-body'),'dialog-form',type,'editor');
|
||||
|
||||
var container = $("#red-ui-editor-type-json-tab-ui-container").css({"height":"100%"});
|
||||
var filterDepth = Infinity;
|
||||
var list = $('<div class="red-ui-debug-msg-payload red-ui-editor-type-json-editor">').appendTo(container).treeList({
|
||||
rootSortable: false,
|
||||
sortable: ".red-ui-editor-type-json-editor-item-handle",
|
||||
}).on("treelistchangeparent", function(event, evt) {
|
||||
if (evt.old.type === 'array') {
|
||||
evt.old.element.find(".red-ui-editor-type-json-editor-label-type").text("array["+evt.old.children.length+"]");
|
||||
}
|
||||
if (evt.item.parent.type === 'array') {
|
||||
evt.item.parent.element.find(".red-ui-editor-type-json-editor-label-type").text("array["+evt.item.parent.children.length+"]");
|
||||
}
|
||||
}).on("treelistsort", function(event, item) {
|
||||
item.children.forEach(function(child,i) {
|
||||
if (item.type === 'array') {
|
||||
child.key = i;
|
||||
child.element.find(".red-ui-editor-type-json-editor-label-key")
|
||||
.text(child.key)
|
||||
.removeClass('red-ui-debug-msg-type-string')
|
||||
.addClass('red-ui-debug-msg-type-number');
|
||||
} else {
|
||||
child.element.find(".red-ui-editor-type-json-editor-label-key")
|
||||
.text('"'+child.key+'"')
|
||||
.removeClass('red-ui-debug-msg-type-number')
|
||||
.addClass('red-ui-debug-msg-type-string');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
expressionEditor = RED.editor.createEditor({
|
||||
id: 'node-input-json',
|
||||
value: "",
|
||||
@ -89,7 +542,7 @@
|
||||
});
|
||||
checkValid();
|
||||
}
|
||||
$("#node-input-json-reformat").click(function(evt) {
|
||||
$("#node-input-json-reformat").on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
var v = expressionEditor.getValue()||"";
|
||||
try {
|
||||
@ -100,9 +553,56 @@
|
||||
expressionEditor.getSession().setValue(v||"",-1);
|
||||
});
|
||||
dialogForm.i18n();
|
||||
|
||||
var finishedBuild = false;
|
||||
var tabs = RED.tabs.create({
|
||||
element: $("#red-ui-editor-type-json-tabs"),
|
||||
onchange:function(tab) {
|
||||
activeTab = tab.id;
|
||||
$(".red-ui-editor-type-json-tab-content").hide();
|
||||
if (finishedBuild) {
|
||||
if (tab.id === "json-raw") {
|
||||
if (rootNode) {
|
||||
var result = JSON.stringify(convertToObject(rootNode),null,4);
|
||||
expressionEditor.getSession().setValue(result||"",-1);
|
||||
}
|
||||
|
||||
} else if (tab.id === "json-ui") {
|
||||
var raw = expressionEditor.getValue().trim() ||"{}";
|
||||
try {
|
||||
var parsed = JSON.parse(raw);
|
||||
rootNode = handleItem(null,parsed,0,null);
|
||||
rootNode.class = "red-ui-editor-type-json-root-node"
|
||||
list.treeList('data',[rootNode]);
|
||||
} catch(err) {
|
||||
rootNode = null;
|
||||
list.treeList('data',[{
|
||||
label: "Invalid JSON: "+err.toString()
|
||||
}]);
|
||||
}
|
||||
}
|
||||
}
|
||||
tab.content.show();
|
||||
trayOptions.resize();
|
||||
}
|
||||
})
|
||||
|
||||
tabs.addTab({
|
||||
id: 'json-raw',
|
||||
label: RED._('jsonEditor.rawMode'),
|
||||
content: $("#red-ui-editor-type-json-tab-raw")
|
||||
});
|
||||
tabs.addTab({
|
||||
id: 'json-ui',
|
||||
label: RED._('jsonEditor.uiMode'),
|
||||
content: $("#red-ui-editor-type-json-tab-ui")
|
||||
});
|
||||
finishedBuild = true;
|
||||
|
||||
|
||||
},
|
||||
close: function() {
|
||||
expressionEditor.destroy();
|
||||
// expressionEditor.destroy();
|
||||
if (options.onclose) {
|
||||
options.onclose();
|
||||
}
|
||||
@ -112,6 +612,5 @@
|
||||
RED.tray.show(trayOptions);
|
||||
}
|
||||
}
|
||||
$(template).appendTo(document.body);
|
||||
RED.editor.registerTypeEditor("_json", definition);
|
||||
})();
|
||||
|