Compare commits

..

2 Commits

Author SHA1 Message Date
Nick O'Leary
b65e4d5794 Moar changes 2020-06-15 21:06:27 +01:00
Nick O'Leary
7599e865fd WIP: move config nodes down a level in outliner tree 2020-06-15 19:08:51 +01:00
479 changed files with 5146 additions and 27097 deletions

View File

@@ -1,29 +0,0 @@
const fs = require("fs");
const newVersion = require("../../package.json").version;
if (process.env.GITHUB_REF !== "refs/tags/"+newVersion) {
console.log(`GITHUB_REF doesn't match the package.json version: ${process.env.GITHUB_REF} !== ${newVersion}`);
process.exit(0);
}
if (!/^\d+\.\d+\.\d+$/.test(newVersion)) {
console.log(`Not updating for a non-stable release - ${newVersion}`);
process.exit(0);
}
const currentVersion = require("../../../node-red-docker/package.json").version;
console.log(`Update from ${currentVersion} to ${newVersion}`)
updateFile(__dirname+"/../../../node-red-docker/package.json", currentVersion, newVersion);
updateFile(__dirname+"/../../../node-red-docker/docker-custom/package.json", currentVersion, newVersion);
updateFile(__dirname+"/../../../node-red-docker/README.md", currentVersion, newVersion);
console.log(`::set-env name=newVersion::${newVersion}`);
function updateFile(path,from,to) {
let contents = fs.readFileSync(path,"utf8");
contents = contents.replace(new RegExp(from.replace(/\./g,"\\."),"g"), to);
fs.writeFileSync(path, contents);
}

View File

@@ -1,18 +0,0 @@
const fs = require("fs");
const newVersion = require("../../package.json").version;
if (process.env.GITHUB_REF !== "refs/tags/"+newVersion) {
console.log(`GITHUB_REF doesn't match the package.json version: ${process.env.GITHUB_REF} !== ${newVersion}`);
process.exit(0);
}
if (!/^\d+\.\d+\.\d+$/.test(newVersion)) {
console.log(`Not updating for a non-stable release - ${newVersion}`);
process.exit(0);
}
const path = __dirname+"/../../../node-red.github.io/index.html";
let contents = fs.readFileSync(path, "utf8");
contents = contents.replace(/<span class="node-red-latest-version">v\d+\.\d+\.\d+<\/span>/, `<span class="node-red-latest-version">v${newVersion}<\/span>` );
fs.writeFileSync(path, contents);

View File

@@ -1,59 +0,0 @@
name: PublishDockerImage
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
on:
release:
types: [published]
jobs:
generate:
name: 'Update node-red-docker image'
runs-on: ubuntu-latest
steps:
- name: Check out node-red repository
uses: actions/checkout@v2
with:
path: 'node-red'
- name: Check out node-red-docker repository
uses: actions/checkout@v2
with:
repository: 'node-red/node-red-docker'
path: 'node-red-docker'
- name: Check out node-red.github.io repository
uses: actions/checkout@v2
with:
repository: 'node-red/node-red.github.io'
path: 'node-red.github.io'
- uses: actions/setup-node@v1
with:
node-version: '12'
- run: node ./node-red/.github/scripts/update-node-red-docker.js
- name: Create Docker Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.NR_REPO_TOKEN }}
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
path: 'node-red-docker'
commit-message: 'Bump to ${{ env.newVersion }}'
title: '🚀 Update to Node-RED ${{ env.newVersion }} release'
body: |
Updates the Node-RED Docker repo for the ${{ env.newVersion }} release.
Once this is merged, you will need to create a new release with the tag `v${{ env.newVersion }}`.
This PR was auto-generated by a GitHub Action. Any questions, speak to @knolleary
- run: node ./node-red/.github/scripts/update-node-red-website.js
- name: Create Website Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.NR_REPO_TOKEN }}
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
path: 'node-red.github.io'
commit-message: 'Bump to ${{ env.newVersion }}'
title: '🚀 Update to Node-RED ${{ env.newVersion }} release'
body: |
Updates the Node-RED Website repo for the ${{ env.newVersion }} release.
This PR was auto-generated by a GitHub Action. Any questions, speak to @knolleary

3
.gitignore vendored
View File

@@ -22,5 +22,4 @@ packages/node_modules/@node-red/editor-client/public
!test/**/node_modules
docs
!packages/node_modules/**/docs
.vscode
.nyc_output
.vscode

View File

@@ -1,21 +1,12 @@
sudo: false
addons:
chrome: stable
language: node_js
matrix:
include:
- node_js: "14"
script:
- ./node_modules/.bin/grunt && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage
# - scripts/install-ui-test-dependencies.sh && grunt test-ui
before_script:
- npm install -g coveralls
- node_js: "12"
script:
- ./node_modules/.bin/grunt no-coverage
- node_js: "10"
script:
- ./node_modules/.bin/grunt no-coverage
- ./node_modules/.bin/grunt && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage
before_script:
- npm install -g istanbul coveralls
- node_js: "8"
script:
- ./node_modules/.bin/grunt no-coverage

2
API.md
View File

@@ -10,6 +10,6 @@ Module | Description
[@node-red/editor-api](@node-red_editor-api.html) | an Express application that serves the Node-RED editor and provides the Admin HTTP API
[@node-red/runtime](@node-red_runtime.html) | the core runtime of Node-RED
[@node-red/util](@node-red_util.html) | common utilities for the Node-RED runtime and editor modules
[@node-red/registry](@node-red_registry.html) | the internal node registry
@node-red/registry | the internal node registry
@node-red/nodes | the default set of core nodes
@node-red/editor-client | the client-side resources of the Node-RED editor application

View File

@@ -1,482 +1,3 @@
### 1.3.0-beta.1: Beta Release
Editor
- Add config node to refer to when exporting subflow
- Add confirm dialog when deleting subflow with instances in use (#2845) @knolleary
- Add easier ways to find subflow instances
- Add enable/disable toggle button for groups in info-outliner (#2844) @knolleary
- Add IE11 polyfill to support URI download scheme (#2871) @HiroyasuNishiyama
- Add Japanese translations for Node-RED v1.3.0 (#2874) @kazuhitoyokoi
- Add preview of exported nodes to Export dialog (#2820) @knolleary
- Add RED.plugins module to editor
- Add select-connected action (#2877) @knolleary
- Add select-up/downstream-nodes action to editor (#2877) @knolleary
- Add subflow edit button to palette tooltip
- Add subflow meta data edit pane
- Add support for library source plugins (#2785) @knolleary
- Adds shift-click support for selecting up/down stream nodes
- Allow default keymap to be overridden in settings file (#2843) @knolleary
- Allow EditableList to have custom buttons (#2881) @bartbutenaers
- Allow filtering of debug node output within subflow (#2870) @HiroyasuNishiyama
- Ensure the first sidebar tab is shown when editor loads (#2846) @knolleary
- Ensure TypedInput Change event is passed type/value properties Fixes #2883
- Escape all user input
- Filter palette manager nodes based on allow/deny list
- Fix check for existing config nodes in subflow export set
- Fix handling of + in shortcuts
- fix jshint failure (#2850) @HiroyasuNishiyama
- Fix keymap entries with multiple keys for same action
- fix line break of exporting nodes to clipboard (#2849) @HiroyasuNishiyama
- Fix line break of subflow label on palette (#2828)
- Fix loading individual module catalog
- Fix removing links when deleting node
- Fix semver comparison for IE11 (#2888) @knolleary
- fixed #2790 swapped description of encodeUrl/encodeUrlComponent and d… (#2791)
- Handle timeouts when trying to load node credentials in editor Fixes #2840 (#2841) @knolleary
- Hide projects dialog when opening proj with invalid encrypt key
- hide unused input field (#2823)
- Implement node property typing (#2812) @knolleary
- Improve SemVer comparison in Palette Manager (#2821 #2879) @HaKr
- Library: properly handle symlinked folders (#2768) @natcl
- make flow download code separate utility instead of polyfill
- Prevent duplicate keyboard shortcut from being assigned
- Prevent rogue mouseup on tab from triggering tab change
- Rename paletteEditorEnabled to installerEnabled
- Tidy some subflow env props css
- Tidy up typedInput syntax
- Use subflow.info for help text and meta.type for node type
Runtime
- Deprecate autoInstallModules for externalModules.autoInstall
- Deprecate editorTheme.palette.editable for externalModules.palette.allowInstall
- Initial plugin runtime api implementation (#2779) @knolleary
- Add initial support for ThemePlugins (#2836) @knolleary
- Support npm subflow modules (#2690) @knolleary
- Ability to add projects path to the settings file (#2816) @tfmf
- Add i18n function to editor plugins when they are registered
- Add optional 'lang' to settings file (#2796) @fellinga
- Add SubflowModule class for running subflow modules
- Add support for settings.externalModules (#2797) @knolleary
- Allow default project workflow to be set via settings (#2763) @knolleary
- Allow for adding an array of middleware functions (#2788) @kevinGodell
- Better logging when deprecated editorTheme.palette.* settings used
- Detect externalModule dependencies inside subflow modules
- Fix global leak in lib/flows/index.js
- Fix numeric status not displaying by ensuring it's a string (#2859) @knolleary
- Fully remove when.js dependency (#2772) @knolleary
- make nodes with only group change not deployed by nodes deploy mode
- Move exec and events components to util module
- Nodes log via parent flow to allow flow-info to be added
- Restart node only if node's group changes (#2872) @HiroyasuNishiyama
- Stop config nodes after flow nodes Fixes #2876 (#2880) @knolleary
- Update marked dependency
- Use more async funcs in runtime/lib/api to reduce Promise creation
- Use npm info to check pending install version
Nodes
- Allow nested msg properties in msg/flow/global expressions (#2822)
- Batch: Messaging API support in Batch node (#2738) @k-toumura
- CSV: Handle commas in msg.columns if quoted.
- CSV: Fix csv node template reset when array complete (#2854) @dceejay
- CSV: Messaging API support in CSV node (#2734) @k-toumura
- Debug: Sanitize Debug node name when display enable/disable message
- Delay: Add support for Messaging API to delay node (#2733)
- Exec: Add settings.execMaxBufferSize to control buffer size of exec node (#2819)
- Exec: Don't append msg.payload to command by default (#2818)
- Function: Add 'node' object to close scope
- Function: allow to load external modules (#2873) @knolleary
- Function: Add functionExternalModules to settings and default to false
- Join: Fix join node in array mode with repeated messages, and allow reset all (#2869) @dceejay
- MQTT: Add MQTT v5 support (#2778 #2886) @Steve-Mcl
- Sort: Messaging API support in Sort node (#2744) @k-toumura
- Split/Join: Messaging API support in Split/Join nodes (#2750) @k-toumura
- Trigger: Messaging API support in Trigger node (#2751) @k-toumura
- Add example flows for storage nodes (#2784) @HiroyasuNishiyama
- Add example flows for network nodes (#2855) @HiroyasuNishiyama
- Add example flows for parser nodes (#2749) @HiroyasuNishiyama
### 1.2.9: Maintenance Release
Editor
- Sanitize node type names when displaying in notifications
- Sanitize branch name before displaying in notification message
Runtime
- Handle more valid language codes when validating lang params Fixes #2856
### 1.2.8: Maintenance Release
Editor
- Ensure subflow help is picked up for palette tooltip Fixes #2834
- Improve Ru locale (#2826) @alexk111
- Fix scrollbars (#2825) @alexk111
Runtime
- Restrict project file access to inside the project directory
- Validate user-provided language parameter before passing to i18n
- Fix grunt release mkdir issue on Node.js 14 (#2827) @alexk111
- Prevent crash when coreNodesDir is empty (#2831) @hardillb
Nodes
- Batch node: Fixing minor typo in node's documentation (#2848) @matthiasradde
- Split node: Handle out of order messages as long as one of the messages has msg.parts.count set to the proper value (#2748) @s4ke
### 1.2.7: Maintenance Release
Editor
- Ensure subflow-scoped config nodes do not get moved on import Fixes #2789
- Allow TypedInput to be disabled (#2752) @bartbutenaers
- Allow userMenu to be explicitly enabled (#2805) @tfmf
- Improvements to DE translation (#2192) @ketzu
Runtime
- Handle `undefined` error passed to node.error (#2781) @johnwang71
- Disable nyc coverage reporting on older node versions
- Improve Editor API unit test coverage (#2777) @aaronmyatt
Nodes
- Trigger: ensure timestamp option sends .now() at point of sending
### 1.2.6: Maintenance Release
Editor
- Update Japanese translations for 1.2.5 (#2764) @kazuhitoyokoi
- Library: properly handle symlinked folders (#2768) @natcl
Runtime
- Support Windows paths when installing tarball by path name Fixes #2769
- Fix unsecure command usage in GH Action
Nodes
- Update MQTT to latest to fix Node 8 URL breakage
### 1.2.5: Maintenance Release
Editor
- Fix import of config nodes with unknown z property
Runtime
- Set ACTIONS_ALLOW_UNSECURE_COMMANDS in GH Action
### 1.2.4: Maintenance Release
Editor
- Support bigint types in Debug sidebar
- Clear retained status of deleted nodes
- Prevent needless retention of node status messages
- Update projects dialogs to use TypedInput-cred input
- Restore cursor position in TypedInput cred-mode
- Ensure config nodes with invalid z are imported somewhere
- Ensure user keyboard shortcuts override defaults Fixes #2753
Runtime
- Disable projects when flowFile passed into grunt dev
- Add Russian Locale (#2761) (#2531) (@alexk111)
- Add Japanese translation for http-in node (#2758) (@kazuhitoyokoi)
Nodes
- CSV: Fix CSV node repeating array output
### 1.2.3: Maintenance Release
Editor
- Disable 'use strict' checking in Function node Fixes #2743
- Add gray/grey alternate options for status
- Handle import errors on initial load and report to user
- Only apply recovery tab on initial load Fixes #2731
- Reinstate coveralls reporting to travis build
- Update Japanese message catalogue for 1.2.3 release #2747 (@HiroyasuNishiyama)
Runtime
- Modify default settings comment (#2739)
- Add mutex lock to saveSettings storage call Fixes #2736 (#2737)
- Migrate to nyc instead of istanbul for code coverage
- Move mosca to ui-test-dependencies
- Remove " from npm install prefix option
### 1.2.2: Maintenance Release
Editor
- Prevent node z property getting set to 0 or ""
- Only apply z-recovery logic to flow nodes
- Fix api call to reload flows Fixes #2726
- Remove bad z property from import config nodes
### 1.2.1: Maintenance Release
Runtime
- Fix race condition in .config file migration Fixes #2724
### 1.2.0: Milestone Release
Editor
- Fix selection of link node not existing within active workspace #2722 (@HiroyasuNishiyama)
- Fix import of merged flow
- Fix width of upload button in Safari #2718 (@HiroyasuNishiyama)
- Update Chinese translations #2719 (@JiyeYu)
- Update Japanese translations needed for 1.2 #2710 (@kazuhitoyokoi)
- Fix unexpected line break of sidebar tab name popover #2716 (@HiroyasuNishiyama)
- i18n module refresh tooltip #2717 (@HiroyasuNishiyama)
- Add better error message if context file gets corrupted
- Update info text of function node #2714 (@HiroyasuNishiyama)
- Use markdown editor if editText called with md mode
- Prevent group actions when in non-default mouse mode
### 1.2.0-beta.1: Beta Release
Editor
- Detect importing duplicate nodes and help user resolve #2698
- Allow sidebar tabs to be reordered #2655
- Add tgz upload button to palette manager #2682
- Add 'automatic' git workflow for projects #2035
- Allow project version string to be edited
- Sanitize unknown node type when displaying
- Handle nodes with invalid z property Closes #2170
- Outline: Ensure sf instance nodes update in outliner when import-replace sf
- Outline: Ensure recovered nodes tab is added to outliner properly
- Groups: Only recalculate group label offsets when needed
- Groups: Reuse first group name/style when merging elements Fixes #2680
- Groups: Fix copy/paste of node into active group Fixes #2686
- ACE: Update ACE to 1.4.12-src-min-noconflict Fixes #1988
- ACE: Add comment highlighting to JSONata and fix regex handling Closes #2701
- ACE: Ensure errors in ACE NRJavaScript mode are on valid lines
- Prevent Enter on search box from reloading page Fixes #2678
- Allow toggleButton icons to be optional
- Allow treeList to have a header component
- Disable selection of FA icons when dbl clicking node
Runtime
- Add RED.hooks API for pluggable routing #2665
- Add flows:* events and deprecate nodes-* events
- Split .config.json into separate files #2794
- Add support for file upload in /nodes api #2682
- Add 'done' metric log for message tracing #2685 (@k-toumura)
- Add mutex locking around /flow apis #2679
- Default flowFilePretty to true if projects enabled
- Replace Math.random with crypto.getBytes for session tokens
- Fix `this` context when calling multiple event listeners Fixes #2692. #2693 (@mgroenhoff)
- Add --userDir=/tmp/foo support to grunt dev
- Skip loading node html if disableEditor set #2684
- Update util.writeFile to write to tmp file before rename #2683
- Fix getModuleFiles function to include path property #2705 (@t-kawamorita)
- Update nodemon to latest so grunt dev task behaves
- Improve jsdoc of util.getObjectProperty to clarify thrown error See #2703
Nodes
- Trigger: allow msg.delay to be used to set delay/loop interval #2707
- Function: allow to send & log in its initialize code #2644 (@cinhcet)
- MQTT: Update to MQTT 4.2.1 Closes #2694
- Debug: Handle undefined value in Debug view of Array and Object Fixes #2696
- Switch: Clarify empty rules in switch node documentation #2649 (@natcl) #2669 (@kazuhitoyokoi)
- Updated core nodes to use Done callback #2653 (@k-toumura)
- yaml, xml, json, html, http, template, range, link, status, catch, complete, inject
### 1.1.3: Maintenance Release
Editor
- Fix vertical align of fa node icons Fixes #2670
- Allow lasso selection to be restricted to active group
- Make ctrl-click on nested group more intuitive
- Fix copy/paste of nested groups
- Add Set(iterable) polyfill for IE11
- Support select-all inside active group
- Improve performance of moving groups
- Add additional check for git auth failure response Fixes #2656
- german translation, wording (#2660) (#2666)
- Remove filtering of duplicate fa icons
- Show node help when switching node edit dialogs Fixes #2652
- Ensure group theme picks up theme defaults properly Fixes #2651
Nodes
- Clarify Switch node isEmpty help
- HTTP In: handle application/cbor as binary
Runtime
- Move runtime settings back to adminApi from editorApi Fixes #2662
- Update Chinese message for debug node
### 1.1.2: Maintenance Release
Editor
- Fix all the touch screen issues Fixes #2647
- Add RED.view.redrawStatus to avoid full redraw on update
- Ensure node/group xrefs are consistent on import
- Disable keyboard handler when dialogs are open
- Ensure unknown nodes removed from outliner when node registers Fixes #2646
Runtime
- Allow Comms websocket auth to be done via token header Fixes #2642
### 1.1.1: Maintenance Release
Editor
- Set apiRootUrl for debug pop-out to load locales properly Fixes #2629, #2630
- Update build-custom-theme to handle keyframes properly Fixes #2636
- Remove hardcoded css and allow group to default from theme Fixes #2633
- Add RED.view.DEBUG_SYNC_REDRAW to disable requestAnimationFrame References #2631
- Fix up subflow port wiring
- Ensure groups are removed when deleting subflows
- Get group order right in history events to ensure proper handling
- Prevent wiring to node with no corresponding port Fixes #2641
- Avoid copying duplicate nodes to internal clipboard
- Fix connecting wires to subflow status or io ports on touchscreen Fixes #2637
Runtime
- Authenticate websocket comms using user-provided token if present Fixes #2642
Nodes
- Delay: add words about independence of messages being delayed.
- Debug: fix debug status to not loop, make migration more seamless, detect status type objects #2638
- Debug: Update Japanese message for debug node #2645 (@kazuhitoyokoi)
### 1.1.0: Milestone Release
Editor
- Align node labels on FF
- Fix node toggle button initial opacity
- Make color/icon/label-pos pickers keyboard navigable
- Default group label to be shown and improve toggle button
- Fix clearing group label
- Remove hardcoded css Fixes #2603
- Fix node button mouse pointer css
- Change node linebreak handling to use "\n "
- Handle import of node with non-default number of outputs
- Improve display of focussed form element
- Fix typedInput error on empty subflow input types #2624 (@HiroyasuNishiyama)
- Update JP message catalogue for subflow input type #2471 (@HiroyasuNishiyama)
- Outliner - add empty item when last config node moved
- Update zh-CN/zh-TW translations #2626 (@JiyeYu)
- Add default shortcut for `core:show-help-tab`
- Clear outline focus on config node sidebar panel
- Tweak group margin to fit node status and look better
- Fix reparenting nodes in outliner when they change
Runtime
- Add developer options - permits npm run build-dev #2628 (@Steve-Mcl)
Nodes
- Add example flows for lots of core nodes #2585 #2550 #2549 (@HiroyasuNishiyama)
- TCP: Fix tcp in node finishing packets when in streaming base64 receive mode.
- Join: Clear timeout when msg.reset received Fixes #2471
- Switch: JSONata expr does not require msg.parts.count
- Inject: fix backwards migration of inject without topic
#### 1.1.0-beta.3: Beta Release
Editor
- Fix wiring nodes from input back to output
- Fix sometimes unable to keyboard-move group to left/up
- Fix group position in outliner
- Handle unknown nodes with no icon
- Prevent node creep when switching tabs
#### 1.1.0-beta.2: Beta Release
Editor
- Add UI tests to travis build #2593 #2616 #2617 #2619 (@kazuhitoyokoi)
- Add Japanese translations for outliner, jsonata and runtime #2618 (@kazuhitoyokoi)
- Fix deleting node in group after changing selection
- Fixup padding of quick-add search box
- Move config nodes under type-level hierarchy in outline
- Emit nodes:change event for config node users list modified
- Increase group margin to avoid clash with status text
- Fix event order when quick-adding node to group
- Switch RED.events.DEBUG messages to warn to get stacktraces
- Fix empty item handling for subflows/config in outliner
- Fix search indexing of group nodes
- Avoid regenerating every node label on redraw
- Fix handling of multi-line node label
- Disable merge group menu for single item or non-group item #2611 (@HiroyasuNishiyama)
- Merge pull request #2609 from node-red-hitachi/fix-remove-from-group
- Fix position of empty group with multi-line label #2612 (@HiroyasuNishiyama)
- Make treelist of subflow/config nodes initially have empty placeholder
- Fix empty placeholder not shown on remove from group #2609 (@HiroyasuNishiyama)
- Prevent conversion of circular structure #2607 (@HiroyasuNishiyama)
- Handle null status text in the editor Fixes #2606
- Massively reduce our dependency on d3 to render the view
- EditableList/TreeList - defer adding elements to DOM
- Prevent RED.stop being called multiple times if >1 signal received
- Flag a node as removed when it is disabled
- Some performance improvements for TreeList
- Resize info/help sidebars whenever sidebar is opened
- Add search defaults to outliner searchBox
- Add search presets option to searchBox widget
- Add RED.popover.menu as a new type of menu widget
- Add support for is:XYZ search flags
- Track subflow instances on the subflow node itself
- Refresh outline filter whenever something changes Fixes #2601
- Fix Help tab search box appearance
- Rename Node Information to Information in sidebar
- Do a sync-redraw after clearing to ensure clean state
- Make catch/status/complete/link filter case-insensitive
- Add 'add' option to touch radialMenu for quick-add dialog
- Merge branch 'dev' of https://github.com/node-red/node-red into dev
- ensure trigger node detects changes to number of outputs
- Ignore whitespace when checking function setup/close code
- Preserve event handlers when moving outliner items
- Add tooltips to outliner buttons
- Only validate nodes once they have all been imported
- Ensure configNode.users is updated properly on import
Runtime
- Bump node-red-admin 0.2.6
Nodes
- WebSocket: Prevent charAt call on websocket listener #2610 ()
- Debug: fix status to migrate old nodes to correct default mode.
- Link: Fix Link node filter Fixes #2600
#### 1.1.0-beta.1: Beta Release
Runtime

View File

@@ -20,16 +20,10 @@ var sass = require("node-sass");
module.exports = function(grunt) {
var nodemonArgs = ["-V"];
var nodemonArgs = ["-v"];
var flowFile = grunt.option('flowFile');
if (flowFile) {
nodemonArgs.push(flowFile);
process.env.NODE_RED_ENABLE_PROJECTS=false;
}
var userDir = grunt.option('userDir');
if (userDir) {
nodemonArgs.push("-u");
nodemonArgs.push(userDir);
}
var browserstack = grunt.option('browserstack');
@@ -53,8 +47,8 @@ module.exports = function(grunt) {
ui: 'bdd',
reporter: 'spec'
},
all: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js","test/nodes/**/*_spec.js"] },
core: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js"]},
all: { src: ['test/**/*_spec.js'] },
core: { src: ["test/_spec.js","test/unit/**/*_spec.js"]},
nodes: { src: ["test/nodes/**/*_spec.js"]}
},
webdriver: {
@@ -62,19 +56,19 @@ module.exports = function(grunt) {
configFile: 'test/editor/wdio.conf.js'
}
},
nyc: {
mocha_istanbul: {
options: {
cwd: '.',
include: ['packages/node_modules/**'],
excludeNodeModules: false,
exclude: ['packages/node_modules/@node-red/editor-client/**'],
reporter: ['lcov', 'html','text-summary'],
reportDir: 'coverage',
all: true
globals: ['expect'],
timeout: 3000,
ignoreLeaks: false,
ui: 'bdd',
reportFormats: ['lcov','html'],
print: 'both',
istanbulOptions: ['--no-default-excludes', '-i','**/packages/node_modules/**']
},
all: { cmd: false, args: ['grunt', 'simplemocha:all'] },
core: { options: { exclude:['packages/node_modules/@node-red/editor-client/**', 'packages/node_modules/@node-red/nodes/**']},cmd: false, args: ['grunt', 'simplemocha:core'] },
nodes: { cmd: false, args: ['grunt', 'simplemocha:nodes'] }
all: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js","test/nodes/**/*_spec.js"] },
core: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js"]},
nodes: { src: ["test/nodes/**/*_spec.js"]}
},
jshint: {
options: {
@@ -142,7 +136,6 @@ module.exports = function(grunt) {
"packages/node_modules/@node-red/editor-client/src/js/text/bidi.js",
"packages/node_modules/@node-red/editor-client/src/js/text/format.js",
"packages/node_modules/@node-red/editor-client/src/js/ui/state.js",
"packages/node_modules/@node-red/editor-client/src/js/plugins.js",
"packages/node_modules/@node-red/editor-client/src/js/nodes.js",
"packages/node_modules/@node-red/editor-client/src/js/font-awesome.js",
"packages/node_modules/@node-red/editor-client/src/js/history.js",
@@ -459,11 +452,9 @@ module.exports = function(grunt) {
'packages/node_modules/@node-red/runtime/lib/index.js',
'packages/node_modules/@node-red/runtime/lib/api/*.js',
'packages/node_modules/@node-red/runtime/lib/events.js',
'packages/node_modules/@node-red/runtime/lib/hooks.js',
'packages/node_modules/@node-red/util/**/*.js',
'packages/node_modules/@node-red/editor-api/lib/index.js',
'packages/node_modules/@node-red/editor-api/lib/auth/index.js',
'packages/node_modules/@node-red/registry/lib/index.js'
'packages/node_modules/@node-red/editor-api/lib/auth/index.js'
],
options: {
destination: 'docs',
@@ -511,10 +502,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-chmod');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-mocha-istanbul');
if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) {
grunt.loadNpmTasks('grunt-webdriver');
}
@@ -522,26 +515,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
grunt.loadNpmTasks('grunt-npm-command');
grunt.loadNpmTasks('grunt-mkdir');
grunt.loadNpmTasks('grunt-simple-nyc');
grunt.registerMultiTask('nodemon', 'Runs a nodemon monitor of your node.js server.', function () {
const nodemon = require('nodemon');
this.async();
const options = this.options();
options.script = this.data.script;
let callback;
if (options.callback) {
callback = options.callback;
delete options.callback;
} else {
callback = function(nodemonApp) {
nodemonApp.on('log', function (event) {
console.log(event.colour);
});
};
}
callback(nodemon(options));
});
grunt.registerMultiTask('attachCopyright', function() {
var files = this.data.src;
@@ -623,16 +596,11 @@ module.exports = function(grunt) {
grunt.registerTask('default',
'Builds editor content then runs code style checks and unit tests on all components',
['build','verifyPackageDependencies','jshint:editor','nyc:all']);
grunt.registerTask('no-coverage',
'Builds editor content then runs code style checks and unit tests on all components without code coverage',
['build','verifyPackageDependencies','jshint:editor','simplemocha:all']);
['build','verifyPackageDependencies','jshint:editor','mocha_istanbul:all']);
grunt.registerTask('test-core',
'Runs code style check and unit tests on core runtime code',
['build','nyc:core']);
['build','mocha_istanbul:core']);
grunt.registerTask('test-editor',
'Runs code style check on editor code',
@@ -650,16 +618,12 @@ module.exports = function(grunt) {
grunt.registerTask('test-nodes',
'Runs unit tests on core nodes',
['build','nyc:nodes']);
['build','mocha_istanbul:nodes']);
grunt.registerTask('build',
'Builds editor content',
['clean:build','jsonlint','concat:build','concat:vendor','copy:build','uglify:build','sass:build','attachCopyright']);
grunt.registerTask('build-dev',
'Developer mode: build dev version',
['clean:build','concat:build','concat:vendor','copy:build','sass:build','setDevEnv']);
grunt.registerTask('dev',
'Developer mode: run node-red, watch for source changes and build/restart',
['build','setDevEnv','concurrent:dev']);
@@ -675,7 +639,7 @@ module.exports = function(grunt) {
grunt.registerTask('coverage',
'Run Istanbul code test coverage task',
['build','nyc:all']);
['build','mocha_istanbul:all']);
grunt.registerTask('docs',
'Generates API documentation',

View File

@@ -1,4 +1,4 @@
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
Copyright JS Foundation and other contributors, http://js.foundation
Apache License
Version 2.0, January 2004

View File

@@ -67,4 +67,4 @@ It was created by [IBM Emerging Technology](https://www.ibm.com/blogs/emerging-t
## Copyright and license
Copyright OpenJS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).
Copyright JS Foundation and other contributors, https://openjsf.org under [the Apache 2.0 license](LICENSE).

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "1.3.0-beta.1",
"version": "1.1.0-beta.1",
"description": "Low-code programming for event-driven applications",
"homepage": "http://nodered.org",
"license": "Apache-2.0",
@@ -13,8 +13,6 @@
"start": "node packages/node_modules/node-red/red.js",
"test": "grunt",
"build": "grunt build",
"dev": "grunt dev",
"build-dev": "grunt build-dev",
"docs": "grunt docs"
},
"contributors": [
@@ -26,8 +24,7 @@
}
],
"dependencies": {
"ajv": "6.12.6",
"async-mutex": "0.2.6",
"ajv": "6.12.2",
"basic-auth": "2.0.1",
"bcryptjs": "2.4.3",
"body-parser": "1.19.0",
@@ -38,7 +35,7 @@
"cookie-parser": "1.4.5",
"cors": "2.8.5",
"cron": "1.7.2",
"denque": "1.5.0",
"denque": "1.4.1",
"express": "4.17.1",
"express-session": "1.17.1",
"fs-extra": "8.1.0",
@@ -46,24 +43,24 @@
"hash-sum": "2.0.0",
"https-proxy-agent": "5.0.0",
"i18next": "15.1.2",
"iconv-lite": "0.6.2",
"iconv-lite": "0.5.1",
"is-utf8": "0.2.1",
"js-yaml": "3.14.0",
"json-stringify-safe": "5.0.1",
"jsonata": "1.8.4",
"jsonata": "1.8.3",
"lodash.clonedeep": "^4.5.0",
"media-typer": "1.1.0",
"memorystore": "1.6.4",
"mime": "2.4.7",
"moment-timezone": "0.5.32",
"mqtt": "4.2.6",
"memorystore": "1.6.2",
"mime": "2.4.6",
"moment-timezone": "^0.5.31",
"mqtt": "2.18.8",
"multer": "1.4.2",
"mustache": "4.1.0",
"mustache": "4.0.1",
"node-red-admin": "^0.2.6",
"node-red-node-rbe": "^0.2.9",
"node-red-node-sentiment": "^0.1.6",
"node-red-node-tail": "^0.1.0",
"nopt": "5.0.0",
"nopt": "4.0.3",
"oauth2orize": "1.11.0",
"on-headers": "1.0.2",
"passport": "0.4.1",
@@ -72,8 +69,8 @@
"raw-body": "2.4.1",
"request": "2.88.0",
"semver": "6.3.0",
"tar": "6.0.5",
"uglify-js": "3.12.4",
"uglify-js": "3.9.4",
"when": "3.7.8",
"ws": "6.2.1",
"xml2js": "0.4.23"
},
@@ -81,38 +78,40 @@
"bcrypt": "3.0.8"
},
"devDependencies": {
"dompurify": "2.2.6",
"grunt": "1.3.0",
"marked": "0.8.2",
"dompurify": "2.0.11",
"grunt": "~1.0.4",
"grunt-chmod": "~1.1.1",
"grunt-cli": "~1.3.2",
"grunt-concurrent": "3.0.0",
"grunt-concurrent": "~2.3.1",
"grunt-contrib-clean": "~2.0.0",
"grunt-contrib-compress": "1.6.0",
"grunt-contrib-compress": "~1.5.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jshint": "~2.1.0",
"grunt-contrib-uglify": "~4.0.1",
"grunt-contrib-watch": "~1.1.0",
"grunt-jsdoc": "2.4.1",
"grunt-jsdoc-to-markdown": "5.0.0",
"grunt-jsonlint": "2.1.3",
"grunt-mkdir": "~1.1.0",
"grunt-jsdoc": "^2.2.1",
"grunt-jsdoc-to-markdown": "^4.0.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": "~3.1.0",
"grunt-simple-mocha": "~0.4.1",
"grunt-simple-nyc": "^3.0.1",
"http-proxy": "1.18.1",
"istanbul": "0.4.5",
"jsdoc-nr-template": "github:node-red/jsdoc-nr-template",
"marked": "2.0.0",
"minami": "1.2.3",
"mocha": "^5.2.0",
"node-red-node-test-helper": "^0.2.7",
"mosca": "^2.8.3",
"node-red-node-test-helper": "^0.2.5",
"node-sass": "^4.14.1",
"nodemon": "2.0.6",
"should": "13.2.3",
"should": "^8.4.0",
"sinon": "1.17.7",
"stoppable": "^1.1.0",
"supertest": "5.0.0"
"supertest": "3.4.2"
},
"engines": {
"node": ">=8"

View File

@@ -21,19 +21,15 @@ var flows = require("./flows");
var flow = require("./flow");
var context = require("./context");
var auth = require("../auth");
var info = require("./settings");
var plugins = require("./plugins");
var apiUtil = require("../util");
module.exports = {
init: function(settings,runtimeAPI) {
init: function(runtimeAPI) {
flows.init(runtimeAPI);
flow.init(runtimeAPI);
nodes.init(runtimeAPI);
context.init(runtimeAPI);
info.init(settings,runtimeAPI);
plugins.init(runtimeAPI);
var needsPermission = auth.needsPermission;
@@ -51,16 +47,7 @@ module.exports = {
// Nodes
adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll,apiUtil.errorHandler);
if (!settings.externalModules || !settings.externalModules.palette || settings.externalModules.palette.allowInstall !== false) {
if (!settings.externalModules || !settings.externalModules.palette || settings.externalModules.palette.allowUpload !== false) {
const multer = require('multer');
const upload = multer({ storage: multer.memoryStorage() });
adminApp.post("/nodes",needsPermission("nodes.write"),upload.single("tarball"),nodes.post,apiUtil.errorHandler);
} else {
adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post,apiUtil.errorHandler);
}
}
adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post,apiUtil.errorHandler);
adminApp.get(/^\/nodes\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalogs,apiUtil.errorHandler);
adminApp.get(/^\/nodes\/((@[^\/]+\/)?[^\/]+\/[^\/]+)\/messages/,needsPermission("nodes.read"),nodes.getModuleCatalog,apiUtil.errorHandler);
adminApp.get(/^\/nodes\/((@[^\/]+\/)?[^\/]+)$/,needsPermission("nodes.read"),nodes.getModule,apiUtil.errorHandler);
@@ -80,12 +67,6 @@ module.exports = {
// adminApp.delete("/context/:scope(node|flow)/:id",needsPermission("context.write"),context.delete,apiUtil.errorHandler);
adminApp.delete("/context/:scope(node|flow)/:id/*",needsPermission("context.write"),context.delete,apiUtil.errorHandler);
adminApp.get("/settings",needsPermission("settings.read"),info.runtimeSettings,apiUtil.errorHandler);
// Plugins
adminApp.get("/plugins", needsPermission("plugins.read"), plugins.getAll, apiUtil.errorHandler);
adminApp.get("/plugins/messages", needsPermission("plugins.read"), plugins.getCatalogs, apiUtil.errorHandler);
return adminApp;
}
}

View File

@@ -33,9 +33,6 @@ module.exports = {
})
} else {
opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
opts.lang = "en-US";
}
runtimeAPI.nodes.getNodeConfigs(opts).then(function(configs) {
res.send(configs);
})
@@ -48,22 +45,11 @@ module.exports = {
module: req.body.module,
version: req.body.version,
url: req.body.url,
tarball: undefined,
req: apiUtils.getRequestLogObject(req)
}
if (!runtimeAPI.settings.editorTheme || !runtimeAPI.settings.editorTheme.palette || runtimeAPI.settings.editorTheme.palette.upload !== false) {
if (req.file) {
opts.tarball = {
name: req.file.originalname,
size: req.file.size,
buffer: req.file.buffer
}
}
}
runtimeAPI.nodes.addModule(opts).then(function(info) {
res.json(info);
}).catch(function(err) {
console.log(err.stack);
apiUtils.rejectHandler(req,res,err);
})
},
@@ -95,9 +81,6 @@ module.exports = {
})
} else {
opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
opts.lang = "en-US";
}
runtimeAPI.nodes.getNodeConfig(opts).then(function(result) {
return res.send(result);
}).catch(function(err) {
@@ -167,9 +150,6 @@ module.exports = {
lang: req.query.lng,
req: apiUtils.getRequestLogObject(req)
}
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
opts.lang = "en-US";
}
runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) {
res.json(result);
}).catch(function(err) {
@@ -184,9 +164,6 @@ module.exports = {
lang: req.query.lng,
req: apiUtils.getRequestLogObject(req)
}
if (/[^0-9a-z=\-\*]/i.test(opts.lang)) {
opts.lang = "en-US";
}
runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) {
res.json(result);
}).catch(function(err) {

View File

@@ -1,46 +0,0 @@
var apiUtils = require("../util");
var runtimeAPI;
module.exports = {
init: function(_runtimeAPI) {
runtimeAPI = _runtimeAPI;
},
getAll: function(req,res) {
var opts = {
user: req.user,
req: apiUtils.getRequestLogObject(req)
}
if (req.get("accept") == "application/json") {
runtimeAPI.plugins.getPluginList(opts).then(function(list) {
res.json(list);
})
} else {
opts.lang = apiUtils.determineLangFromHeaders(req.acceptsLanguages());
if (/[^a-z\-\*]/i.test(opts.lang)) {
res.json({});
return;
}
runtimeAPI.plugins.getPluginConfigs(opts).then(function(configs) {
res.send(configs);
})
}
},
getCatalogs: function(req,res) {
var opts = {
user: req.user,
lang: req.query.lng,
req: apiUtils.getRequestLogObject(req)
}
if (/[^a-z\-\*]/i.test(opts.lang)) {
res.json({});
return;
}
runtimeAPI.plugins.getPluginCatalogs(opts).then(function(result) {
res.json(result);
}).catch(function(err) {
console.log(err.stack);
apiUtils.rejectHandler(req,res,err);
})
}
};

View File

@@ -1,72 +0,0 @@
/**
* 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.
**/
var apiUtils = require("../util");
var runtimeAPI;
var settings;
var theme = require("../editor/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;
while(i--) {
var value = source[keys[i]]
var type = typeof value;
if (type === 'string' || type === 'number' || type === 'boolean' || Array.isArray(value)) {
target[keys[i]] = value;
} else if (value === null) {
if (target.hasOwnProperty(keys[i])) {
delete target[keys[i]];
}
} else {
// Object
if (target.hasOwnProperty(keys[i])) {
target[keys[i]] = extend(target[keys[i]],value);
} else {
target[keys[i]] = value;
}
}
}
return target;
}
module.exports = {
init: function(_settings,_runtimeAPI) {
runtimeAPI = _runtimeAPI;
settings = _settings;
},
runtimeSettings: function(req,res) {
var opts = {
user: req.user
}
runtimeAPI.settings.getRuntimeSettings(opts).then(function(result) {
if (!settings.disableEditor) {
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.languages = i18n.availableLanguages("editor");
}
res.json(result);
});
},
}

View File

@@ -123,57 +123,38 @@ AnonymousStrategy.prototype.authenticate = function(req) {
});
}
function authenticateUserToken(req) {
return new Promise( (resolve,reject) => {
var token = null;
var tokenHeader = Users.tokenHeader();
if (Users.tokenHeader() === null) {
// No custom user token provided. Fail the request
reject();
return;
} else if (Users.tokenHeader() === 'authorization') {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
token = req.headers.authorization.split(' ')[1];
}
} else {
token = req.headers[Users.tokenHeader()];
}
if (token) {
Users.tokens(token).then(function(user) {
if (user) {
resolve(user);
} else {
reject();
}
});
} else {
reject();
}
});
}
function TokensStrategy() {
passport.Strategy.call(this);
this.name = 'tokens';
}
util.inherits(TokensStrategy, passport.Strategy);
TokensStrategy.prototype.authenticate = function(req) {
authenticateUserToken(req).then(user => {
this.success(user,{scope:user.permissions});
}).catch(err => {
this.fail(401);
});
var self = this;
var token = null;
if (Users.tokenHeader() === 'authorization') {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
token = req.headers.authorization.split(' ')[1];
}
} else {
token = req.headers[Users.tokenHeader()];
}
if (token) {
Users.tokens(token).then(function(admin) {
if (admin) {
self.success(admin,{scope:admin.permissions});
} else {
self.fail(401);
}
});
} else {
self.fail(401);
}
}
module.exports = {
bearerStrategy: bearerStrategy,
clientPasswordStrategy: clientPasswordStrategy,
passwordTokenExchange: passwordTokenExchange,
anonymousStrategy: new AnonymousStrategy(),
tokensStrategy: new TokensStrategy(),
authenticateUserToken: authenticateUserToken
tokensStrategy: new TokensStrategy()
}

View File

@@ -14,7 +14,15 @@
* limitations under the License.
**/
const crypto = require("crypto");
function generateToken(length) {
var c = "ABCDEFGHIJKLMNOPQRSTUZWXYZabcdefghijklmnopqrstuvwxyz1234567890";
var token = [];
for (var i=0;i<length;i++) {
token.push(c[Math.floor(Math.random()*c.length)]);
}
return token.join("");
}
var storage;
var sessionExpiryTime
@@ -107,7 +115,7 @@ module.exports = {
},
create: function(user,client,scope) {
return loadSessions().then(function() {
var accessToken = crypto.randomBytes(128).toString('base64');
var accessToken = generateToken(128);
var accessTokenExpiresAt = Date.now() + (sessionExpiryTime*1000);

View File

@@ -61,7 +61,7 @@ var api = {
authenticate: authenticate,
default: getDefaultUser,
tokens: getDefaultUser,
tokenHeader: null
tokenHeader: "authorization"
}
function init(config) {
@@ -111,8 +111,6 @@ function init(config) {
api.tokens = config.tokens;
if (config.tokenHeader && typeof config.tokenHeader === "string") {
api.tokenHeader = config.tokenHeader.toLowerCase();
} else {
api.tokenHeader = "authorization";
}
}
}

View File

@@ -16,13 +16,11 @@
var ws = require("ws");
var url = require("url");
const crypto = require("crypto");
var log = require("@node-red/util").log; // TODO: separate module
var Tokens;
var Users;
var Permissions;
var Strategies;
var server;
var settings;
@@ -33,6 +31,8 @@ var activeConnections = [];
var anonymousUser;
var retained = {};
var heartbeatTimer;
var lastSentTime;
@@ -44,7 +44,6 @@ function init(_server,_settings,_runtimeAPI) {
Tokens.onSessionExpiry(handleSessionExpiry);
Users = require("../auth/users");
Permissions = require("../auth/permissions");
Strategies = require("../auth/strategies");
}
function handleSessionExpiry(session) {
@@ -55,19 +54,26 @@ function handleSessionExpiry(session) {
}
})
}
function generateSession(length) {
var c = "ABCDEFGHIJKLMNOPQRSTUZWXYZabcdefghijklmnopqrstuvwxyz1234567890";
var token = [];
for (var i=0;i<length;i++) {
token.push(c[Math.floor(Math.random()*c.length)]);
}
return token.join("");
}
function CommsConnection(ws, user) {
this.session = crypto.randomBytes(32).toString('base64');
function CommsConnection(ws) {
this.session = generateSession(32);
this.ws = ws;
this.stack = [];
this.user = user;
this.user = null;
this.lastSentTime = 0;
var self = this;
log.audit({event: "comms.open"});
log.trace("comms.open "+self.session);
var preAuthed = !!user;
var pendingAuth = !this.user && (settings.adminAuth != null);
var pendingAuth = (settings.adminAuth != null);
if (!pendingAuth) {
addActiveConnection(self);
@@ -124,16 +130,8 @@ function CommsConnection(ws, user) {
}
});
} else {
Users.tokens(msg.auth).then(function(user) {
if (user) {
self.user = user;
log.audit({event: "comms.auth",user:self.user});
completeConnection(user.permissions,msg.auth,true);
} else {
log.audit({event: "comms.auth.fail"});
completeConnection(null,null,false);
}
});
log.audit({event: "comms.auth.fail"});
completeConnection(null,null,false);
}
});
} else {
@@ -193,8 +191,8 @@ function start() {
var commsPath = settings.httpAdminRoot || "/";
commsPath = (commsPath.slice(0,1) != "/" ? "/":"") + commsPath + (commsPath.slice(-1) == "/" ? "":"/") + "comms";
wsServer = new ws.Server({ noServer: true });
wsServer.on('connection',function(ws, request, user) {
var commsConnection = new CommsConnection(ws, user);
wsServer.on('connection',function(ws) {
var commsConnection = new CommsConnection(ws);
});
wsServer.on('error', function(err) {
log.warn(log._("comms.error-server",{message:err.toString()}));
@@ -203,26 +201,8 @@ function start() {
server.on('upgrade', function upgrade(request, socket, head) {
const pathname = url.parse(request.url).pathname;
if (pathname === commsPath) {
if (Users.tokenHeader() !== null && request.headers[Users.tokenHeader()]) {
// The user has provided custom token handling. For the websocket,
// the token could be provided in two ways:
// - as an http header (only possible with a reverse proxy setup)
// - passed over the connected websock in an auth packet
// If the header is present, verify the token. If not, use the auth
// packet over the connected socket
//
Strategies.authenticateUserToken(request).then(user => {
wsServer.handleUpgrade(request, socket, head, function done(ws) {
wsServer.emit('connection', ws, request, user);
});
}).catch(err => {
log.audit({event: "comms.auth.fail"});
socket.destroy();
})
return
}
wsServer.handleUpgrade(request, socket, head, function done(ws) {
wsServer.emit('connection', ws, request, null);
wsServer.emit('connection', ws, request);
});
}
// Don't destroy the socket as other listeners may want to handle the

View File

@@ -76,7 +76,7 @@ module.exports = {
editorApp.get("/icons/:scope/:module/:icon",ui.icon);
var theme = require("./theme");
theme.init(settings, runtimeAPI);
theme.init(settings);
editorApp.use("/theme",theme.app());
editorApp.use("/",ui.editorResources);
@@ -93,7 +93,6 @@ module.exports = {
// Library
var library = require("./library");
library.init(runtimeAPI);
// editorApp.get("/library/:id",needsPermission("library.read"),library.getLibraryConfig);
editorApp.get(/^\/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
editorApp.post(/^\/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
@@ -104,7 +103,7 @@ module.exports = {
editorApp.get('/credentials/:type/:id', needsPermission("credentials.read"),credentials.get,apiUtil.errorHandler);
// Settings
// Main /settings route is an admin route - see lib/admin/settings.js
editorApp.get("/settings",needsPermission("settings.read"),info.runtimeSettings,apiUtil.errorHandler);
// User Settings
editorApp.get("/settings/user",needsPermission("settings.read"),info.userSettings,apiUtil.errorHandler);
// User Settings

View File

@@ -17,6 +17,7 @@
var apiUtils = require("../util");
var fs = require('fs');
var fspath = require('path');
var when = require('when');
var runtimeAPI;
@@ -24,17 +25,6 @@ module.exports = {
init: function(_runtimeAPI) {
runtimeAPI = _runtimeAPI;
},
// getLibraryConfig: function(req,res) {
// var opts = {
// user: req.user,
// library: req.params.id
// }
// runtimeAPI.library.getConfig(opts).then(function(result) {
// res.json(result);
// }).catch(function(err) {
// apiUtils.rejectHandler(req,res,err);
// });
// },
getEntry: function(req,res) {
var opts = {
user: req.user,

View File

@@ -39,12 +39,9 @@ module.exports = {
},
get: function(req,res) {
var namespace = req.params[0];
var lngs = req.query.lng;
namespace = namespace.replace(/\.json$/,"");
var lang = req.query.lng || i18n.defaultLang; //apiUtil.determineLangFromHeaders(req.acceptsLanguages() || []);
if (/[^0-9a-z=\-\*]/i.test(lang)) {
res.json({});
return;
}
var prevLang = i18n.i.language;
// Trigger a load from disk of the language if it is not the default
i18n.i.changeLanguage(lang, function(){

View File

@@ -137,7 +137,6 @@ module.exports = {
req.body.hasOwnProperty('description') ||
req.body.hasOwnProperty('dependencies')||
req.body.hasOwnProperty('summary') ||
req.body.hasOwnProperty('version') ||
req.body.hasOwnProperty('files') ||
req.body.hasOwnProperty('git')) {
runtimeAPI.projects.updateProject(opts).then(function() {

View File

@@ -16,12 +16,56 @@
var apiUtils = require("../util");
var runtimeAPI;
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;
while(i--) {
var value = source[keys[i]]
var type = typeof value;
if (type === 'string' || type === 'number' || type === 'boolean' || Array.isArray(value)) {
target[keys[i]] = value;
} else if (value === null) {
if (target.hasOwnProperty(keys[i])) {
delete target[keys[i]];
}
} else {
// Object
if (target.hasOwnProperty(keys[i])) {
target[keys[i]] = extend(target[keys[i]],value);
} else {
target[keys[i]] = value;
}
}
}
return target;
}
module.exports = {
init: function(_runtimeAPI) {
runtimeAPI = _runtimeAPI;
sshkeys.init(runtimeAPI);
},
runtimeSettings: function(req,res) {
var opts = {
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.languages = i18n.availableLanguages("editor");
res.json(result);
});
},
userSettings: function(req, res) {
var opts = {
user: req.user

View File

@@ -41,10 +41,6 @@ var theme = null;
var themeContext = clone(defaultContext);
var themeSettings = null;
var activeTheme = null;
var activeThemeInitialised = false;
var runtimeAPI;
var themeApp;
function serveFile(app,baseUrl,file) {
@@ -62,7 +58,7 @@ function serveFile(app,baseUrl,file) {
}
}
function serveFilesFromTheme(themeValue, themeApp, directory, baseDirectory) {
function serveFilesFromTheme(themeValue, themeApp, directory) {
var result = [];
if (themeValue) {
var array = themeValue;
@@ -71,14 +67,7 @@ function serveFilesFromTheme(themeValue, themeApp, directory, baseDirectory) {
}
for (var i=0;i<array.length;i++) {
let fullPath = array[i];
if (baseDirectory) {
fullPath = path.resolve(baseDirectory,array[i]);
if (fullPath.indexOf(baseDirectory) !== 0) {
continue;
}
}
var url = serveFile(themeApp,directory,fullPath);
var url = serveFile(themeApp,directory,array[i]);
if (url) {
result.push(url);
}
@@ -88,12 +77,10 @@ function serveFilesFromTheme(themeValue, themeApp, directory, baseDirectory) {
}
module.exports = {
init: function(settings, _runtimeAPI) {
runtimeAPI = _runtimeAPI;
init: function(settings) {
themeContext = clone(defaultContext);
themeSettings = null;
theme = settings.editorTheme || {};
activeTheme = theme.theme;
},
app: function() {
@@ -182,9 +169,7 @@ module.exports = {
}
}
}
themeApp.get("/", async function(req,res) {
const themePluginList = await runtimeAPI.plugins.getPluginsByType({type:"node-red-theme"});
themeContext.themes = themePluginList.map(theme => theme.id);
themeApp.get("/", function(req,res) {
res.json(themeContext);
})
@@ -200,42 +185,10 @@ module.exports = {
themeSettings.projects = theme.projects;
}
if (theme.hasOwnProperty("keymap")) {
themeSettings.keymap = theme.keymap;
}
if (theme.theme) {
themeSettings.theme = theme.theme;
}
return themeApp;
},
context: async function() {
if (activeTheme && !activeThemeInitialised) {
const themePlugin = await runtimeAPI.plugins.getPlugin({
id:activeTheme
});
if (themePlugin) {
if (themePlugin.css) {
const cssFiles = serveFilesFromTheme(
themePlugin.css,
themeApp,
"/css/",
themePlugin.path
);
themeContext.page.css = cssFiles.concat(themeContext.page.css || [])
}
if (themePlugin.scripts) {
const scriptFiles = serveFilesFromTheme(
themePlugin.scripts,
themeApp,
"/scripts/",
themePlugin.path
)
themeContext.page.scripts = scriptFiles.concat(themeContext.page.scripts || [])
}
}
activeThemeInitialised = true;
}
context: function() {
return themeContext;
},
settings: function() {

View File

@@ -68,8 +68,8 @@ module.exports = {
apiUtils.rejectHandler(req,res,err);
})
},
editor: async function(req,res) {
res.send(Mustache.render(editorTemplate,await theme.context()));
editor: function(req,res) {
res.send(Mustache.render(editorTemplate,theme.context()));
},
editorResources: express.static(path.join(editorClientDir,'public'))
};

View File

@@ -28,6 +28,7 @@ var express = require("express");
var bodyParser = require("body-parser");
var util = require('util');
var passport = require('passport');
var when = require('when');
var cors = require('cors');
var auth = require("./auth");
@@ -59,8 +60,8 @@ function init(settings,_server,storage,runtimeAPI) {
adminApp.use(corsHandler);
if (settings.httpAdminMiddleware) {
if (typeof settings.httpAdminMiddleware === "function" || Array.isArray(settings.httpAdminMiddleware)) {
adminApp.use(settings.httpAdminMiddleware);
if (typeof settings.httpAdminMiddleware === "function") {
adminApp.use(settings.httpAdminMiddleware)
}
}
@@ -98,7 +99,7 @@ function init(settings,_server,storage,runtimeAPI) {
adminApp.use(corsHandler);
}
var adminApiApp = require("./admin").init(settings, runtimeAPI);
var adminApiApp = require("./admin").init(runtimeAPI);
adminApp.use(adminApiApp);
} else {
adminApp = null;
@@ -110,9 +111,11 @@ function init(settings,_server,storage,runtimeAPI) {
* @return {Promise} resolves when the application is ready to handle requests
* @memberof @node-red/editor-api
*/
async function start() {
function start() {
if (editor) {
return editor.start();
} else {
return when.resolve();
}
}
@@ -121,10 +124,11 @@ async function start() {
* @return {Promise} resolves when the application is stopped
* @memberof @node-red/editor-api
*/
async function stop() {
function stop() {
if (editor) {
editor.stop();
}
return when.resolve();
}
module.exports = {
init: init,

View File

@@ -43,10 +43,6 @@ module.exports = {
rejectHandler: function(req,res,err) {
//TODO: why this when errorHandler also?!
log.audit({event: "api.error",error:err.code||"unexpected_error",message:err.message||err.toString()},req);
if (!err.code) {
// by definition, an unexpected_error to log
log.error(err);
}
var response = {
code: err.code||"unexpected_error",
message: err.message||err.toString()

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-api",
"version": "1.3.0-beta.1",
"version": "1.1.0-beta.1",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,22 +16,22 @@
}
],
"dependencies": {
"@node-red/util": "1.3.0-beta.1",
"@node-red/editor-client": "1.3.0-beta.1",
"@node-red/util": "1.1.0-beta.1",
"@node-red/editor-client": "1.1.0-beta.1",
"bcryptjs": "2.4.3",
"body-parser": "1.19.0",
"clone": "2.1.2",
"cors": "2.8.5",
"express-session": "1.17.1",
"express": "4.17.1",
"memorystore": "1.6.4",
"mime": "2.4.7",
"multer": "1.4.2",
"mustache": "4.1.0",
"memorystore": "1.6.2",
"mime": "2.4.6",
"mustache": "4.0.1",
"oauth2orize": "1.11.0",
"passport-http-bearer": "1.0.1",
"passport-oauth2-client-password": "0.1.2",
"passport": "0.4.1",
"when": "3.7.8",
"ws": "6.2.1"
},
"optionalDependencies": {

View File

@@ -32,7 +32,7 @@
"label" : {
"view" : {
"view" : "Ansicht",
"grid" : "Raster",
"grid" : "Gitter",
"showGrid" : "Raster anzeigen",
"snapGrid" : "Am Raster ausrichten",
"gridSize" : "Rastergröße",

View File

@@ -22,8 +22,7 @@
"color": "Color",
"position": "Position",
"enable": "Enable",
"disable": "Disable",
"upload": "Upload"
"disable": "Disable"
},
"type": {
"string": "string",
@@ -38,13 +37,11 @@
}
},
"event": {
"loadPlugins": "Loading Plugins",
"loadPalette": "Loading Palette",
"loadNodeCatalogs": "Loading Node catalogs",
"loadNodes": "Loading Nodes __count__",
"loadFlows": "Loading Flows",
"importFlows": "Adding Flows to workspace",
"importError": "<p>Error adding flows</p><p>__message__</p>"
"importFlows": "Adding Flows to workspace"
},
"workspace": {
"defaultName": "Flow __number__",
@@ -143,7 +140,6 @@
"nodeActionDisabled": "node actions disabled",
"nodeActionDisabledSubflow": "node actions disabled within subflow",
"missing-types": "<p>Flows stopped due to missing node types.</p>",
"missing-modules": "<p>Flows stopped due to missing modules.</p>",
"safe-mode":"<p>Flows stopped in safe mode.</p><p>You can modify your flows and deploy the changes to restart.</p>",
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
"credentials_load_failed": "<p>Flows stopped as the credentials could not be decrypted.</p><p>The flow credential file is encrypted, but the project's encryption key is missing or invalid.</p>",
@@ -201,8 +197,6 @@
"flow_plural": "__count__ flows",
"subflow": "__count__ subflow",
"subflow_plural": "__count__ subflows",
"replacedNodes": "__count__ node replaced",
"replacedNodes_plural": "__count__ nodes replaced",
"pasteNodes": "Paste flow json or",
"selectFile": "select a file to import",
"importNodes": "Import nodes",
@@ -210,8 +204,6 @@
"download": "Download",
"importUnrecognised": "Imported unrecognised type:",
"importUnrecognised_plural": "Imported unrecognised types:",
"importDuplicate": "Imported duplicate node:",
"importDuplicate_plural": "Imported duplicate nodes:",
"nodesExported": "Nodes exported to clipboard",
"nodesImported": "Imported:",
"nodeCopied": "__count__ node copied",
@@ -220,9 +212,6 @@
"groupCopied_plural": "__count__ groups copied",
"groupStyleCopied": "Group style copied",
"invalidFlow": "Invalid flow: __message__",
"recoveredNodes": "Recovered Nodes",
"recoveredNodesInfo": "The nodes on this flow were missing a valid flow id when they were imported. They have been added to this flow so you can either restore or delete them.",
"recoveredNodesNotification": "<p>Imported nodes without a valid flow id</p><p>They have been added to a new flow called '__flowName__'.</p>",
"export": {
"selected":"selected nodes",
"current":"current flow",
@@ -237,19 +226,13 @@
},
"import": {
"import": "Import to",
"importSelected": "Import selected",
"importCopy": "Import copy",
"viewNodes": "View nodes...",
"newFlow": "new flow",
"replace": "replace",
"errors": {
"notArray": "Input not a JSON Array",
"itemNotObject": "Input not a valid flow - item __index__ not a node object",
"missingId": "Input not a valid flow - item __index__ missing 'id' property",
"missingType": "Input not a valid flow - item __index__ missing 'type' property"
},
"conflictNotification1": "Some of the nodes you are importing already exist in your workspace.",
"conflictNotification2": "Select which nodes to import and whether to replace the existing nodes, or to import a copy of them."
}
},
"copyMessagePath": "Path copied",
"copyMessageValue": "Value copied",
@@ -339,21 +322,8 @@
"output": "outputs:",
"status": "status node",
"deleteSubflow": "delete subflow",
"confirmDelete": "Are you sure you want to delete this subflow?",
"info": "Description",
"category": "Category",
"module": "Module",
"license": "License",
"licenseNone": "none",
"licenseOther": "Other",
"type": "Node Type",
"version": "Version",
"versionPlaceholder": "x.y.z",
"keys": "Keywords",
"keysPlaceholder": "Comma-separated keywords",
"author": "Author",
"authorPlaceholder": "Your Name <email@example.com>",
"desc": "Description",
"env": {
"restore": "Restore to subflow default",
"remove": "Remove environment variable"
@@ -399,8 +369,6 @@
"locale": "Select UI Language",
"icon": "Icon",
"inputType": "Input type",
"selectType": "select types...",
"loadCredentials": "Loading node credentials",
"inputs" : {
"input": "input",
"select": "select",
@@ -435,8 +403,7 @@
},
"errors": {
"scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it",
"invalidProperties": "Invalid properties:",
"credentialLoadFailed": "Failed to load node credentials"
"invalidProperties": "Invalid properties:"
}
},
"keyboard": {
@@ -564,8 +531,6 @@
"sortAZ": "a-z",
"sortRecent": "recent",
"more": "+ __count__ more",
"upload": "Upload module tgz file",
"refresh": "Refresh module list",
"errors": {
"catalogLoadFailed": "<p>Failed to load node catalogue.</p><p>Check the browser console for more information</p>",
"installFailed": "<p>Failed to install: __module__</p><p>__message__</p><p>Check the log for more information</p>",
@@ -742,12 +707,6 @@
"committerTip": "Leave blank to use system default",
"userName": "Username",
"email": "Email",
"workflow": "Workflow",
"workfowTip": "Choose your preferred git workflow",
"workflowManual": "Manual",
"workflowManualTip": "All changes must be manually committed under the 'history' sidebar",
"workflowAuto": "Automatic",
"workflowAutoTip": "Changes are committed automatically with every deploy",
"sshKeys": "SSH Keys",
"sshKeysTip": "Allows you to create secure connections to remote git repositories.",
"add": "add key",
@@ -858,8 +817,7 @@
}
},
"editableList": {
"add": "add",
"addTitle": "add an item"
"add": "add"
},
"search": {
"empty": "No matches found",
@@ -1097,7 +1055,6 @@
"editor-tab": {
"properties": "Properties",
"envProperties": "Environment Variables",
"module": "Module Properties",
"description": "Description",
"appearance": "Appearance",
"preview": "UI Preview",
@@ -1108,7 +1065,6 @@
"en-US": "English",
"ja": "Japanese",
"ko": "Korean",
"ru": "Russian",
"zh-CN": "Chinese(Simplified)",
"zh-TW": "Chinese(Traditional)"
}

View File

@@ -243,19 +243,19 @@
"args": "array, function",
"desc": "Returns the one and only value in the `array` parameter that satisfies the `function` predicate (i.e. the `function` returns Boolean `true` when passed the value). Throws an exception if the number of matching values is not exactly one.\n\nThe function should be supplied in the following signature: `function(value [, index [, array]])` where value is each input of the array, index is the position of that value and the whole array is passed as the third argument"
},
"$encodeUrlComponent": {
"$encodeUrl": {
"args": "str",
"desc": "Encodes a Uniform Resource Locator (URL) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.\n\nExample: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrl": {
"$encodeUrlComponent": {
"args": "str",
"desc": "Encodes a Uniform Resource Locator (URL) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character. \n\nExample: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrlComponent": {
"$decodeUrl": {
"args": "str",
"desc": "Decodes a Uniform Resource Locator (URL) component previously created by encodeUrlComponent. \n\nExample: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrl": {
"$decodeUrlComponent": {
"args": "str",
"desc": "Decodes a Uniform Resource Locator (URL) previously created by encodeUrl. \n\nExample: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},

View File

@@ -20,10 +20,7 @@
"fill": "塗りつぶし",
"label": "ラベル",
"color": "色",
"position": "配置",
"enable": "有効",
"disable": "無効",
"upload": "アップロード"
"position": "配置"
},
"type": {
"string": "文字列",
@@ -38,13 +35,11 @@
}
},
"event": {
"loadPlugins": "プラグインを読み込み中",
"loadPalette": "パレットを読み込み中",
"loadNodeCatalogs": "ノードカタログを読み込み中",
"loadNodes": "ノードを読み込み中 __count__",
"loadFlows": "フローを読み込み中",
"importFlows": "ワークスペースにフローを追加中",
"importError": "<p>フロー追加エラー</p><p>__message__</p>"
"importFlows": "ワークスペースにフローを追加中"
},
"workspace": {
"defaultName": "フロー __number__",
@@ -86,7 +81,7 @@
"userSettings": "ユーザ設定",
"nodes": "ノード",
"displayStatus": "ノードのステータスを表示",
"displayConfig": "設定ノード",
"displayConfig": "ノードの設定",
"import": "読み込み",
"export": "書き出し",
"search": "ノードを検索",
@@ -200,17 +195,13 @@
"flow_plural": "__count__ 個のフロー",
"subflow": "__count__ 個のサブフロー",
"subflow_plural": "__count__ 個のサブフロー",
"replacedNodes": "置換された __count__ 個のノード",
"replacedNodes_plural": "置換された __count__ 個のノード",
"pasteNodes": "JSON形式のフローデータを貼り付け",
"selectFile": "読み込むファイルを選択",
"importNodes": "フローを読み込み",
"exportNodes": "フローを書き出し",
"pasteNodes": "JSON形式のフローデータを貼り付けてください",
"selectFile": "読み込むファイルを選択してください",
"importNodes": "フローをクリップボートから読み込み",
"exportNodes": "フローをクリップボードへ書き出し",
"download": "ダウンロード",
"importUnrecognised": "認識できない型が読み込まれました:",
"importUnrecognised_plural": "認識できない型が読み込まれました:",
"importDuplicate": "重複したノードを読み込みました:",
"importDuplicate_plural": "重複したノードを読み込みました:",
"nodesExported": "クリップボードへフローを書き出しました",
"nodesImported": "読み込みました:",
"nodeCopied": "__count__ 個のノードをコピーしました",
@@ -219,9 +210,6 @@
"groupCopied_plural": "__count__ 個のグループをコピーしました",
"groupStyleCopied": "グループの形式をコピーしました",
"invalidFlow": "不正なフロー: __message__",
"recoveredNodes": "復旧したノード",
"recoveredNodesInfo": "このフロー内のードは読み込み時に、有効なフローIDがありませんでした。これらフローIDは、フローに追加されているため、復元または削除できます。",
"recoveredNodesNotification": "<p>有効なフローIDを持たないードが読み込まれました</p><p>これらノードは '__flowName__' という新しいフローへ追加されました。</p>",
"export": {
"selected": "選択したフロー",
"current": "現在のタブ",
@@ -236,19 +224,13 @@
},
"import": {
"import": "読み込み先",
"importSelected": "選択したノードを読み込み",
"importCopy": "コピーを読み込み",
"viewNodes": "ノードを参照...",
"newFlow": "新規のタブ",
"replace": "置換",
"errors": {
"notArray": "JSON形式の配列ではありません",
"itemNotObject": "不正なフロー - __index__ 番目の要素はノードオブジェクトではありません",
"missingId": "不正なフロー - __index__ 番目の要素に'id'プロパティがありません",
"missingType": "不正なフロー - __index__ 番目の要素に'type'プロパティがありません"
},
"conflictNotification1": "読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。",
"conflictNotification2": "読み込むノードを選択し、また既存のノードを置き換えるか、もしくはそれらのコピーを読み込むかも選択してください。"
}
},
"copyMessagePath": "パスをコピーしました",
"copyMessageValue": "値をコピーしました",
@@ -267,7 +249,7 @@
"successfulDeploy": "デプロイが成功しました",
"successfulRestart": "フローの再起動が成功しました",
"deployFailed": "デプロイが失敗しました: __message__",
"unusedConfigNodes": "使われていない設定ノードがあります。",
"unusedConfigNodes": "使われていないノードの設定」があります。",
"unusedConfigNodesLink": "設定を参照する",
"errors": {
"noResponse": "サーバの応答がありません"
@@ -338,21 +320,8 @@
"output": "出力:",
"status": "ステータスノード",
"deleteSubflow": "サブフローを削除",
"confirmDelete": "このサブフローを削除しても良いですか?",
"info": "詳細",
"category": "カテゴリ",
"module": "モジュール",
"license": "ライセンス",
"licenseNone": "なし",
"licenseOther": "その他",
"type": "ノードの型",
"version": "バージョン",
"versionPlaceholder": "x.y.z",
"keys": "キーワード",
"keysPlaceholder": "カンマ区切りのキーワード",
"author": "作者",
"authorPlaceholder": "名前 <email@example.com>",
"desc": "説明",
"env": {
"restore": "デフォルト値に戻す",
"remove": "環境変数を削除"
@@ -376,9 +345,9 @@
"configDelete": "削除",
"nodesUse": "__count__ 個のノードが、この設定を使用しています",
"nodesUse_plural": "__count__ 個のノードが、この設定を使用しています",
"addNewConfig": "新規に __type__ 設定ノードを追加",
"addNewConfig": "新規に __type__ ノードの設定を追加",
"editNode": "__type__ ノードを編集",
"editConfig": "__type__ 設定ノードを編集",
"editConfig": "__type__ ノードの設定を編集",
"addNewType": "新規に __type__ を追加...",
"nodeProperties": "プロパティ",
"label": "ラベル",
@@ -398,8 +367,6 @@
"locale": "UI言語の選択",
"icon": "記号",
"inputType": "入力形式",
"selectType": "形式選択...",
"loadCredentials": "ノードの認証情報を読み込み中",
"inputs": {
"input": "入力",
"select": "メニュー",
@@ -434,8 +401,7 @@
},
"errors": {
"scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします",
"invalidProperties": "プロパティが不正です:",
"credentialLoadFailed": "ノードの認証情報の読み込みに失敗"
"invalidProperties": "プロパティが不正です:"
}
},
"keyboard": {
@@ -563,8 +529,6 @@
"sortAZ": "辞書順",
"sortRecent": "日付順",
"more": "+ さらに __count__ 個",
"upload": "モジュールのtgzファイルをアップロード",
"refresh": "モジュールリスト更新",
"errors": {
"catalogLoadFailed": "<p>ノードのカタログの読み込みに失敗しました。</p><p>詳細はブラウザのコンソールを確認してください。</p>",
"installFailed": "<p>追加処理が失敗しました: __module__</p><p>__message__</p><p>詳細はログを確認してください。</p>",
@@ -631,16 +595,7 @@
"showTips": "設定からヒントを表示できます",
"outline": "アウトライン",
"empty": "空",
"globalConfig": "グローバル設定ノード",
"triggerAction": "アクションを実行",
"find": "ワークスペース内を検索",
"search": {
"configNodes": "設定ノード",
"unusedConfigNodes": "未使用の設定ノード",
"invalidNodes": "不正なノード",
"uknownNodes": "未知のノード",
"unusedSubflows": "未使用のサブフロー"
}
"globalConfig": "グローバル設定ノード"
},
"help": {
"name": "ヘルプ",
@@ -653,8 +608,8 @@
"noHelp": "ヘルプのトピックが未選択"
},
"config": {
"name": "設定ノードを表示",
"label": "設定ノード",
"name": "ノードの設定を表示",
"label": "ノードの設定",
"global": "全てのフロー上",
"none": "なし",
"subflows": "サブフロー",
@@ -741,12 +696,6 @@
"committerTip": "システムのデフォルトを使用する場合、空白のままにしてください",
"userName": "ユーザ名",
"email": "メールアドレス",
"workflow": "ワークフロー",
"workfowTip": "望ましいgitワークフローを選択してください",
"workflowManual": "手動",
"workflowManualTip": "全ての変更は「履歴」サイドバー内で手動でコミットする必要があります",
"workflowAuto": "自動",
"workflowAutoTip": "変更はデプロイの度に自動的にコミットされます",
"sshKeys": "SSH キー",
"sshKeysTip": "gitリポジトリへのセキュアな接続を作成できます。",
"add": "キーを追加",
@@ -1095,7 +1044,6 @@
"editor-tab": {
"properties": "プロパティ",
"envProperties": "環境変数",
"module": "モジュールプロパティ",
"description": "説明",
"appearance": "外観",
"preview": "UIプレビュー",
@@ -1106,7 +1054,6 @@
"en-US": "英語",
"ja": "日本語",
"ko": "韓国語",
"ru": "ロシア語",
"zh-CN": "中国語(簡体)",
"zh-TW": "中国語(繁体)"
}

12
packages/node_modules/@node-red/editor-client/locales/ja/jsonata.json vendored Normal file → Executable file
View File

@@ -243,19 +243,19 @@
"args": "array, function",
"desc": "`array`の要素のうち、条件判定関数`function`を満たす(`function`に与えた場合に真偽値`true`を返す)要素が1つのみである場合、それを返します。マッチする要素が1つのみでない場合、例外を送出します。\n\n指定する関数は`function(value [, index [, array]])`というシグネチャでなければなりません。ここで、`value`は`array`の要素値、`index`は要素の添字、第三引数には配列全体を渡します。"
},
"$encodeUrlComponent": {
"$encodeUrl": {
"args": "str",
"desc": "Uniform Resource Locator (URL)を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrl": {
"$encodeUrlComponent": {
"args": "str",
"desc": "Uniform Resource Locator (URL)要素を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrlComponent": {
"$decodeUrl": {
"args": "str",
"desc": "encodeUrlComponentで置換したUniform Resource Locator (URL)をデコードします。\n\n例: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrl": {
"$decodeUrlComponent": {
"args": "str",
"desc": "encodeUrlで置換したUniform Resource Locator (URL)要素をデコードします。 \n\n例: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
@@ -266,9 +266,5 @@
"$type": {
"args": "value",
"desc": "`value` の型を文字列として返します。もし `value` が未定義の場合、 `undefined` が返されます。"
},
"$moment": {
"args": "[str]",
"desc": "Momentライブラリを使用して日付オブジェクトを取得します。"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +0,0 @@
{
"info": {
"tip0" : "Вы можете удалить выбранные узлы или провода с {{core:delete-selection}}",
"tip1" : "Ищите узлы с {{core:search}}",
"tip2" : "{{core:toggle-sidebar}} показывает/скрывает эту боковою панель",
"tip3" : "Вы можете управлять палитрой узлов с помощью {{core:manage-palette}}",
"tip4" : "Узлы конфигурации потока перечисляются на боковой панели. Доступ к списку можно получить из меню или с помощью {{core:show-config-tab}}",
"tip5" : "Эти советы можно включить/выключить через настройки",
"tip6" : "Перемещайте выбранные узлы клавишами [влево] [вверх] [вниз] и [вправо]. Удерживайте [Shift], чтобы увеличить шаг",
"tip7" : "Перетаскивание узла на провод соединит его с обеих сторон",
"tip8" : "Экспортируйте выбранные узлы или текущую вкладку с {{core:show-export-dialog}}",
"tip9" : "Импортируйте поток, перетаскивая его JSON в редактор или с помощью {{core:show-import-dialog}}",
"tip10" : "Нажмите [Shift], [кликните] по порту узла и перетаскивайте подключенные провода на другой узел",
"tip11" : "Открывайте вкладку Информация с {{core:show-info-tab}} или вкладку Отладка с {{core:show-debug-tab}}",
"tip12" : "Нажмите [ctrl] и [кликните] в рабочей области, чтобы открыть диалог быстрого добавления",
"tip13" : "Нажмите [ctrl] и [кликните] по порту узла, чтобы начать быстрое подключение",
"tip14" : "Нажмите [Shift] и [кликните] по узлу, чтобы выбрать все соединенные узлы",
"tip15" : "Нажмите [ctrl] и [кликните] по узлу, чтобы добавить или убрать его из текущего выбора",
"tip16" : "Переключайте вкладки потока с помощью {{core:show-previous-tab}} и {{core:show-next-tab}}",
"tip17" : "Вы можете подтвердить изменения в редакторе узла с {{core:confirm-edit-tray}} или отменить их с {{core:cancel-edit-tray}}",
"tip18" : "Нажатие {{core:edit-selected-node}} откроет редактор первого узла в текущем выборе"
}
}

View File

@@ -1,274 +0,0 @@
{
"$string": {
"args": "arg[, prettify]",
"desc": "Преобразует параметр `arg` в строку, используя следующие правила приведения:\n\n - Строки возвращаются как есть\n - Функции преобразуются в пустую строку\n - Числовая бесконечность и NaN выдают ошибку, поскольку они не могут быть представлены числом в JSON\n - Все остальные значения преобразуются в строку JSON с помощью функции `JSON.stringify`. Если значение `prettify` равно true, тогда будет сгенерирован \"отформатированный\" JSON. То есть каждое поле будет в отдельной строке, а строки будут иметь отступ в зависимости от глубины поля."
},
"$length": {
"args": "str",
"desc": "Возвращает количество символов в строке `str`. Выдается ошибка, если `str` не является строкой."
},
"$substring": {
"args": "str, start[, length]",
"desc": "Возвращает строку, содержащую символы из первого параметра `str`, начиная с позиции `start` (отсчет с нуля). Если указан `length`, то подстрока будет содержать максимум `length` символов. Если `start` отрицателен, то это означает количество символов с конца `str`."
},
"$substringBefore": {
"args": "str, chars",
"desc": "Возвращает подстроку перед первым вхождением последовательности символов `chars` в строке `str`. Если `str` не содержит `chars`, то он возвращает `str`."
},
"$substringAfter": {
"args": "str, chars",
"desc": "Возвращает подстроку после первого вхождения последовательности символов `chars` в строке `str`. Если `str` не содержит `chars`, то он возвращает `str`."
},
"$uppercase": {
"args": "str",
"desc": "Возвращает строку со всеми символами `str`, преобразованными в верхний регистр."
},
"$lowercase": {
"args": "str",
"desc": "Возвращает строку со всеми символами `str`, преобразованными в нижний регистр."
},
"$trim": {
"args": "str",
"desc": "Нормализует и обрезает все пробельные символы в строке `str`, выполняя следующие шаги:\n\n - Все символы табуляции, возврата каретки и перевода строки заменяются пробелами.\n- Последовательности пробелов сокращаются до одного пробела.\n- Пробелы в начале и конце `str` удаляются.\n\n Если `str` не указан (то есть эта функция вызывается без аргументов), тогда значение контекста используется в качестве значения `str`. Выдается ошибка, если `str` не является строкой."
},
"$contains": {
"args": "str, pattern",
"desc": "Возвращает `true`, если строка `str` соответствует шаблону `pattern`, в противном случае возвращает `false`. Если `str` не указан (то есть эта функция вызывается с одним аргументом), то значение контекста используется как значение `str`. Параметр `pattern` может быть либо строкой, либо регулярным выражением."
},
"$split": {
"args": "str[, separator][, limit]",
"desc": "Разбивает строку `str` на массив подстрок. Выдает ошибку, если `str` не является строкой. Необязательный параметр `separator` (строка или регулярное выражение) указывает символы внутри строки `str`, относительно которых она должна быть разделена. Если `separator` не указан, то предполагается пустая строка, и `str` будет разбит на массив из отдельных символов. Выдает ошибку, если `separator` не является строкой. Необязательный параметр `limit` - это число, указывающее максимальное количество подстрок для включения в результирующий массив. Любые дополнительные подстроки отбрасываются. Если `limit` не указан, то весь `str` разделяется без ограничения размера результирующего массива. Выдает ошибку, если `limit` не является положительным числом."
},
"$join": {
"args": "array[, separator]",
"desc": "Объединяет массив подстрок в одну объединенную строку, в которой каждая подстрока отделена необязательным параметром `separator`. Выдает ошибку, если входной массив содержит элемент, который не является строкой. Если `separator` не указан, то предполагается, что это пустая строка, то есть нет `separator` между подстроками. Выдает ошибку, если `separator` не является строкой."
},
"$match": {
"args": "str, pattern [, limit]",
"desc": "Применяет строку `str` к регулярному выражению `pattern` и возвращает массив объектов, каждый из которых содержит информацию о каждом совпадении внутри `str`."
},
"$replace": {
"args": "str, pattern, replacement [, limit]",
"desc": "Находит вхождения шаблона `pattern` в строке `str` и заменяет их на строку `replacement`.\n\nНеобязательный параметр `limit` - это максимальное количество замен."
},
"$now": {
"args":"",
"desc":"Создает отметку времени в формате, совместимом с ISO 8601, и возвращает ее как строку."
},
"$base64encode": {
"args":"string",
"desc":"Преобразует ASCII-строку в base-64 кодировку. Каждый символ в строке обрабатывается как байт двоичных данных. Для этого необходимо, чтобы все символы в строке находились в диапазоне от 0x00 до 0xFF, который включает все символы строк в URI-кодировке. Символы Юникода за пределами этого диапазона не поддерживаются."
},
"$base64decode": {
"args":"string",
"desc":"Преобразует байты в кодировке base-64 в строку, используя кодовую страницу Юникод UTF-8."
},
"$number": {
"args": "arg",
"desc": "Преобразует параметр `arg` в число с использованием следующих правил приведения:\n\n - Числа возвращаются как есть\n - Строки, которые содержат последовательность символов, представляющих допустимое в JSON число, преобразуются в это число\n - Все остальные значения вызывают ошибку."
},
"$abs": {
"args":"number",
"desc":"Возвращает абсолютное значение числа `number`."
},
"$floor": {
"args":"number",
"desc":"Возвращает значение числа `number`, округленное до ближайшего целого числа, которое меньше или равно `number`."
},
"$ceil": {
"args":"number",
"desc":"Возвращает значение числа `number`, округленное до ближайшего целого числа, которое больше или равно `number`."
},
"$round": {
"args":"number [, precision]",
"desc":"Возвращает значение числа `number`, округленное до количества десятичных знаков, указанных необязательным параметром `precision`."
},
"$power": {
"args":"base, exponent",
"desc":"Возвращает значение числа `base`, возведенное в степень `exponent`."
},
"$sqrt": {
"args":"number",
"desc":"Возвращает квадратный корень из значения числа `number`."
},
"$random": {
"args":"",
"desc":"Возвращает псевдослучайное число, которе больше или равно нулю и меньше единицы."
},
"$millis": {
"args":"",
"desc":"Возвращает число миллисекунд с начала Unix-эпохи (1 января 1970 года по Гринвичу) в виде числа. Все вызовы `$millis()` в пределах выполнения выражения будут возвращать одно и то же значение."
},
"$sum": {
"args": "array",
"desc": "Возвращает арифметическую сумму массива чисел `array`. Вызывает ошибку, если входной массив `array` содержит элемент, который не является числом."
},
"$max": {
"args": "array",
"desc": "Возвращает максимальное число в массиве чисел `array`. Вызывает ошибку, если входной массив `array` содержит элемент, который не является числом."
},
"$min": {
"args": "array",
"desc": "Возвращает минимальное число в массиве чисел `array`. Вызывает ошибку, если входной массив `array` содержит элемент, который не является числом."
},
"$average": {
"args": "array",
"desc": "Возвращает среднее значение массива чисел `array`. Вызывает ошибку, если входной массив `array` содержит элемент, который не является числом."
},
"$boolean": {
"args": "arg",
"desc": "Приводит аргумент к логическому значению, используя следующие правила: \n\n - Логические значения возвращаются как есть\n - пустая строка: `false`\n - непустая строка: `true`\n - число равное `0`: `false`\n - ненулевое число: `true`\n - `null` : `false`\n - пустой массив: `false`\n - массив, который содержит хотя бы один элемент, приводимый к `true`: `true`\n - массив, все элементы которого приводятся к `false`: `false`\n - пустой объект: `false`\n - непустой объект: `true`\n - функция: `false`"
},
"$not": {
"args": "arg",
"desc": "Возвращает логическое НЕ для аргумента. `arg` сначала приводится к логическому значению"
},
"$exists": {
"args": "arg",
"desc": "Возвращает логическое `true`, если выполнение выражения `arg` возвращает значение, или `false`, если выражение ничему не соответствует (например, путь к несуществующему полю)."
},
"$count": {
"args": "array",
"desc": "Возвращает количество элементов в массиве"
},
"$append": {
"args": "array, array",
"desc": "Присоединяет один массив к другому"
},
"$sort": {
"args":"array [, function]",
"desc":"Возвращает массив, содержащий все значения параметра `array`, но отсортированные по порядку.\n\nЕсли указан компаратор `function`, то это должна быть функция, которая принимает два параметра:\n\n`function(val1, val2)`\n\nЭту функцию вызывает алгоритм сортировки для сравнения двух значений: val1 и val2. Если значение val1 следует поместить после значения val2 в желаемом порядке сортировки, то функция должна возвращать логическое значение `true`, чтобы обозначить замену. В противном случае она должна вернуть `false`."
},
"$reverse": {
"args":"array",
"desc":"Возвращает массив, содержащий все значения из параметра `array`, но в обратном порядке."
},
"$shuffle": {
"args":"array",
"desc":"Возвращает массив, содержащий все значения из параметра `array`, но перемешанный в случайном порядке."
},
"$zip": {
"args":"array, ...",
"desc":"Возвращает свернутый (сжатый) массив, содержащий сгруппированные массивы значений из аргументов `array1` … `arrayN` по индексам 0, 1, 2...."
},
"$keys": {
"args": "object",
"desc": "Возвращает массив, содержащий ключи объекта. Если аргумент является массивом объектов, то возвращаемый массив содержит недублированный список всех ключей из всех объектов."
},
"$lookup": {
"args": "object, key",
"desc": "Возвращает значение, связанное с ключом в объекте. Если первый аргумент является массивом объектов, то просходит поиск по всем объектам в массиве, и возвращаются значения, связанные со всеми вхождениями ключа."
},
"$spread": {
"args": "object",
"desc": "Разбивает объект, содержащий пары ключ / значение, на массив объектов, каждый из которых имеет одну пару ключ / значение из входного объекта. Если параметр является массивом объектов, то результирующий массив содержит объект для каждой пары ключ / значение из каждого объекта предоставленного массива."
},
"$merge": {
"args": "array&lt;object&gt;",
"desc": "Объединяет массив объектов в один объект, содержащий все пары ключ / значение каждого из объектов входного массива. Если какой-либо из входных объектов содержит один и тот же ключ, возвращаемый объект будет содержать значение последнего в массиве. Вызывает ошибку, если входной массив содержит элемент, который не является объектом."
},
"$sift": {
"args":"object, function",
"desc":"Возвращает объект, который содержит только пары ключ / значение из параметра `object`, которые удовлетворяют предикату `function`, переданному в качестве второго параметра.\n\n`function`, которая передается в качестве второго параметра, должна иметь следующую сигнатуру:\n\n`function(value [, key [, object]])`"
},
"$each": {
"args":"object, function",
"desc":"Возвращает массив, который содержит значения, возвращаемые функцией `function` при применении к каждой паре ключ/значение из объекта `object`."
},
"$map": {
"args":"array, function",
"desc":"Возвращает массив, содержащий результаты применения функции `function` к каждому значению массива `array`.\n\nФункция `function`, указанная в качестве второго параметра, должна иметь следующую сигнатуру:\n\n`function(value [, index [, array]])`"
},
"$filter": {
"args":"array, function",
"desc":"Возвращает массив, содержащий только те значения из массива `array`, которые удовлетворяют предикату `function`.\n\nФункция `function`, указанная в качестве второго параметра, должна иметь следующую сигнатуру:\n\n`function(value [, index [, array]])`"
},
"$reduce": {
"args":"array, function [, init]",
"desc":"Возвращает агрегированное значение, полученное в результате последовательного применения функции `function` к каждому значению в массиве в сочетании с результатом от предыдущего применения функции.\n\nФункция должна принимать два аргумента и вести себя как инфиксный оператор между каждым значением в массиве `array`. Сигнатура `function` должна иметь форму: `myfunc($accumulator, $value[, $index[, $array]])`\n\nНеобязательный параметр `init` используется в качестве начального значения в агрегации."
},
"$flowContext": {
"args": "string[, string]",
"desc": "Извлекает свойство контекста потока.\n\nЭто функция от Node-RED."
},
"$globalContext": {
"args": "string[, string]",
"desc": "Извлекает свойство глобального контекста.\n\nЭто функция от Node-RED."
},
"$pad": {
"args": "string, width [, char]",
"desc": "Возвращает копию строки `string` с дополнительным заполнением, если необходимо, чтобы общее количество символов как минимум соответствовало абсолютному значению параметра `width`.\n\nЕсли `width` является положительным числом, то строка дополняется справа; если отрицательным, то дополняется слева.\n\nНеобязательный аргумент `char` указывает символ(ы) для заполнения. Если не указано, по умолчанию используется пробел."
},
"$fromMillis": {
"args": "number",
"desc": "Преобразует число, представляющее миллисекунды с начала Unix-эпохи (1 января 1970 года по Гринвичу), в строку отметки времени в формате ISO 8601."
},
"$formatNumber": {
"args": "number, picture [, options]",
"desc": "Преобразует число `number` в строку и форматирует ее в десятичное представление, как указано в строке `picture`.\n\nПоведение этой функции соответствует XPath/XQuery-функции fn:format-number, как определено в спецификация XPath F&O 3.1. Строка `picture` определяет, как форматируется число и имеет тот же синтаксис, что и fn:format-number.\n\nНеобязательный третий аргумент `options` используется для переопределения символов форматирования, специфичных для локали по умолчанию, таких как десятичный разделитель. Если аргумент указан, то это должен быть объект, содержащий пары имя/значение, указанные в разделе десятичного формата спецификации XPath F&O 3.1."
},
"$formatBase": {
"args": "number [, radix]",
"desc": "Преобразует число `number` в строку и форматирует ее в целое число, представленное в системе счисления, указанной аргументом `radix`. Если `radix` не указан, то по умолчанию используется десятичная. Значение 'radix` может быть от 2 до 36, в противном случае выдается ошибка."
},
"$toMillis": {
"args": "timestamp",
"desc": "Преобразует строку `timestamp` в формате ISO 8601 в число миллисекунд с начала Unix-эпохи (1 января 1970 года по Гринвичу). Вызывает ошибку, если строка в неправильном формате."
},
"$env": {
"args": "arg",
"desc": "Возвращает значение переменной среды.\n\nЭто функция от Node-RED."
},
"$eval": {
"args": "expr [, context]",
"desc": "Анализирует и исполняет строку `expr`, которая содержит JSON или выражение JSONata, используя текущий контекст в качестве контекста для исполнения."
},
"$formatInteger": {
"args": "number, picture",
"desc": "Преобразует число `number` в строку и форматирует ее в целочисленное представление, как указано в строке `picture`. Строка `picture` определяет, как форматируется число и имеет тот же синтаксис, что и `fn:format-integer` из спецификации XPath F&O 3.1."
},
"$parseInteger": {
"args": "string, picture",
"desc": "Разбирает содержимое строки `string` в целое число (как число JSON), используя формат, указанный в строке `picture`. Строковый параметр `picture` имеет тот же формат, что и `$formatInteger`."
},
"$error": {
"args": "[str]",
"desc": "Вызывает ошибку с сообщением. Необязательная строка `str` заменяет сообщение по умолчанию $error() function evaluated`"
},
"$assert": {
"args": "arg, str",
"desc": "Если значение `arg` равно true, функция возвращает значение undefined. Если значение `arg` равно false, генерируется исключение с `str` в качестве сообщения об исключении."
},
"$single": {
"args": "array, function",
"desc": "Возвращает одно-единственное значение из массива `array`, которое удовлетворяет предикату `function` (то есть когда `function` возвращает логическое `true` при передаче значения). Выдает исключение, если число подходящих значений не одно.\n\nФункция должна соответствовать следующей сигнатуре: `function(value [, index [, array]])` где value - элемент массива, index - позиция этого значения, а весь массив передается в качестве третьего аргумента"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "Кодирует компонент Uniform Resource Locator (URL), заменяя каждый экземпляр определенных символов одной, двумя, тремя или четырьмя escape-последовательностями, представляющими кодировку UTF-8 символа.\n\nПример: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrl": {
"args": "str",
"desc": "Кодирует Uniform Resource Locator (URL), заменяя каждый экземпляр определенных символов одной, двумя, тремя или четырьмя escape-последовательностями, представляющими кодировку UTF-8 символа.\n\nПример: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrlComponent": {
"args": "str",
"desc": "Декодирует компонент Uniform Resource Locator (URL), ранее созданный с помощью encodeUrlComponent.\n\nПример: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrl": {
"args": "str",
"desc": "Декодирует компонент Uniform Resource Locator (URL), ранее созданный с помощью encodeUrl. \n\nПример: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
"$distinct": {
"args": "array",
"desc": "Возвращает массив содержащий все элементы из массива `array`, с удаленными дупликатами"
},
"$type": {
"args": "value",
"desc": "Возвращает тип значения `value` в виде строки. Если `value` не определено, то будет возвращено `undefined`"
},
"$moment": {
"args": "[str]",
"desc": "Получает date объект, используя библиотеку Moment."
}
}

View File

@@ -14,16 +14,7 @@
"back": "后退",
"next": "下一个",
"clone": "克隆项目",
"cont": "继续",
"style": "风格",
"line": "大纲",
"fill": "填充",
"label": "标签",
"color": "颜色",
"position": "位置",
"enable": "启用",
"disable": "禁用",
"upload": "上传"
"cont": "继续"
},
"type": {
"string": "字符串",
@@ -37,18 +28,11 @@
"null": "空"
}
},
"event": {
"loadPalette": "加载控制板",
"loadNodeCatalogs": "加载节点目录",
"loadNodes": "加载 __count__ 个节点",
"loadFlows": "加载流程",
"importFlows": "往工作区中加载流程"
},
"workspace": {
"defaultName": "流程 __number__",
"defaultName": "流程__number__",
"editFlow": "编辑流程: __name__",
"confirmDelete": "确认删除",
"delete": "你确定删除 __label__ ?",
"delete": "你确定删除 '__label__'?",
"dropFlowHere": "把流程放到这里",
"addFlow": "添加流程",
"listFlows": "流程一览",
@@ -107,12 +91,7 @@
"projects-new": "新建",
"projects-open": "打开",
"projects-settings": "项目设定",
"showNodeLabelDefault": "显示新添加的节点的标签",
"groups": "组",
"groupSelection": "选择组",
"ungroupSelection": "取消选择组",
"groupMergeSelection": "合并选择",
"groupRemoveSelection": "从组中移除"
"showNodeLabelDefault": "显示新添加的节点的标签"
}
},
"actions": {
@@ -122,7 +101,7 @@
"zoom-in": "放大"
},
"user": {
"loggedInAs": "作为 __name__ 登陆",
"loggedInAs": "作为__name__登陆",
"username": "账号",
"password": "密码",
"login": "登陆",
@@ -148,13 +127,13 @@
"missing_flow_file": "<p>找不到项目流程文件。</p><p>该项目未配置流程文件。</p>",
"missing_package_file": "<p>找不到项目包文件。</p><p>项目缺少package.json文件。</p>",
"project_empty": "<p>该项目为空。</p><p>是否要创建一组默认的项目文件?<br/>否则,您将必须在编辑器外部手动将文件添加到项目中。</p>",
"project_not_found": "<p>未找到项目 __project__ 。</p>",
"project_not_found": "<p>未找到项目'__project__'。</p>",
"git_merge_conflict": "<p>自动合并更改失败。</p><p>修复未合并的冲突,然后提交结果。</p>"
},
"error": "<strong>错误</strong>: __message__",
"errors": {
"lostConnection": "丢失与服务器的连接,重新连接...",
"lostConnectionReconnect": "丢失与服务器的连接, __time__ 秒后重新连接",
"lostConnectionReconnect": "丢失与服务器的连接__time__秒后重新连接",
"lostConnectionTry": "现在尝试",
"cannotAddSubflowToItself": "无法向其自身添加子流程",
"cannotAddCircularReference": "无法添加子流程 - 循环引用",
@@ -188,18 +167,14 @@
"clipboard": {
"clipboard": "剪贴板",
"nodes": "节点",
"node": "__count__节点",
"node_plural": "__count__节点",
"configNode": "__count__配置节点",
"configNode_plural": "__count__配置节点",
"group": "__count__ 个组",
"group_plural": "__count__ 个组",
"flow": "__count__流程",
"flow_plural": "__count__流程",
"subflow": "__count__ 个子流程",
"subflow_plural": "__count__ 子流程",
"replacedNodes": "__count__ 个节点被置换",
"replacedNodes_plural": "__count__ 个节点被置换",
"node": "__count__节点",
"node_plural": "__count__节点",
"configNode": "__count__配置节点",
"configNode_plural": "__count__配置节点",
"flow": "__count__流程",
"flow_plural": "__count__流程",
"subflow": "__count__流程",
"subflow_plural": "__count__流程",
"pasteNodes": "在这里粘贴节点",
"selectFile": "选择要导入的文件",
"importNodes": "导入节点",
@@ -209,15 +184,9 @@
"importUnrecognised_plural": "导入了无法识别的类型:",
"nodesExported": "节点导出到了剪贴板",
"nodesImported": "导入:",
"nodeCopied": "已复制 __count__ 个节点",
"nodeCopied_plural": "已复制 __count__ 个节点",
"groupCopied": "复制 __count__ 个组",
"groupCopied_plural": "已复制 __count__ 个groups",
"groupStyleCopied": "已复制组风格",
"nodeCopied": "已复制__count__个节点",
"nodeCopied_plural": "已复制__count__个节点",
"invalidFlow": "无效的流程: __message__",
"recoveredNodes": "复原的节点",
"recoveredNodesInfo": "导入节点时此流上的节点缺少有效的流ID。 它们已被添加到此流中,您可以复原或删除它们。",
"recoveredNodesNotification": "<p>导入的节点缺少有效的流ID</p><p>已将它们添加到名为 '__flowName__'的新流中。</p>",
"export": {
"selected": "已选择的节点",
"current": "现在的节点",
@@ -232,19 +201,13 @@
},
"import": {
"import": "导入到",
"importSelected": "导入所选项",
"importCopy": "导入副本",
"viewNodes": "查看节点",
"newFlow": "新流程",
"replace": "置换",
"errors": {
"notArray": "输入的不是JSON数组",
"itemNotObject": "输入的流无效 - 项目 __index__ 不是节点对象",
"itemNotObject": "输入的流无效 - 项目__index__不是节点对象",
"missingId": "输入的流无效-项 __index__ 缺少'id'属性",
"missingType": "输入的流程无效-项 __index__ 缺少'类型'属性"
},
"conflictNotification1": "您要导入的某些节点已经存在于工作空间中。",
"conflictNotification2": "选择要导入的节点,并确认要替换现有的节点还是导入它们的副本"
"missingType": "输入的流程无效-项__index__缺少'类型'属性"
}
},
"copyMessagePath": "已复制路径",
"copyMessageValue": "已复制数值",
@@ -287,7 +250,7 @@
"conflictChecking": "检查是否可以自动合并更改",
"conflictAutoMerge": "此更改不包括冲突,可以自动合并",
"conflictManualMerge": "这些更改包括了在部署之前必须解决的冲突。",
"plusNMore": "+ __count__ 更多"
"plusNMore": "+ __count__更多"
}
},
"eventLog": {
@@ -324,11 +287,11 @@
"newVersionError": "新版本不包含有效的JSON"
},
"subflow": {
"editSubflowInstance": "编辑子流实例: __name__",
"editSubflow": "编辑流程模板 __name__",
"editSubflowInstance": "编辑子流实例__name__",
"editSubflow": "编辑流程模板: __name__",
"edit": "编辑流程模板",
"subflowInstances": "这个子流程模板有 __count__ 个实例",
"subflowInstances_plural": "这个子流程模板有 __count__ 个实例",
"subflowInstances": "这个子流程模板有__count__个实例",
"subflowInstances_plural": "这个子流程模板有__count__个实例",
"editSubflowProperties": "编辑属性",
"input": "输入:",
"output": "输出:",
@@ -345,24 +308,17 @@
"multipleInputsToSelection": "<strong>无法创建子流程</strong>: 多个输入到了选择"
}
},
"group": {
"editGroup": "编辑组: __name__",
"errors": {
"cannotCreateDiffGroups": "无法使用来自不同组的节点创建组",
"cannotAddSubflowPorts": "无法将子流程的端口添加到组"
}
},
"editor": {
"configEdit": "编辑",
"configAdd": "添加",
"configUpdate": "更新",
"configDelete": "删除",
"nodesUse": "__count__ 个节点使用此配置",
"nodesUse_plural": "__count__ 个节点使用此配置",
"addNewConfig": "添加新的 __type__ 配置",
"editNode": "编辑 __type__ 节点",
"editConfig": "编辑 __type__ 配置",
"addNewType": "添加新的 __type__ 节点",
"nodesUse": "__count__个节点使用此配置",
"nodesUse_plural": "__count__个节点使用此配置",
"addNewConfig": "添加新的__type__配置",
"editNode": "编辑__type__节点",
"editConfig": "编辑__type__配置",
"addNewType": "添加新的__type__节点",
"nodeProperties": "节点属性",
"label": "标签",
"color": "颜色",
@@ -381,7 +337,6 @@
"locale": "选择界面语言",
"icon": "图标",
"inputType": "输入类型",
"selectType": "选择类型...",
"inputs": {
"input": "输入",
"select": "选择",
@@ -396,8 +351,7 @@
"bool": "布尔",
"json": "JSON",
"bin": "buffer",
"env": "环境变量",
"cred": "证书"
"env": "环境变量"
},
"menu": {
"input": "输入",
@@ -427,7 +381,7 @@
"scope": "范围",
"unassigned": "未分配",
"global": "全局",
"workspace": "工作",
"workspace": "工作",
"selectAll": "选择所有节点",
"selectAllConnected": "选择所有连接的节点",
"addRemoveNode": "从选择中添加/删除节点",
@@ -506,33 +460,33 @@
"times": {
"seconds": "秒前",
"minutes": "分前",
"minutesV": "__count__ 分前",
"hoursV": "__count__ 小时前",
"hoursV_plural": "__count__ 小时前",
"daysV": "__count__ 天前",
"daysV_plural": "__count__ 天前",
"weeksV": "__count__ 周前",
"weeksV_plural": "__count__ 周前",
"monthsV": "__count__ 月前",
"monthsV_plural": "__count__ 月前",
"yearsV": "__count__ 年前",
"yearsV_plural": "__count__ 年前",
"yearMonthsV": "__y__ 年, __count__ 月前",
"yearMonthsV_plural": "__y__ 年, __count__ 月前",
"yearsMonthsV": "__y__ 年, __count__ 月前",
"yearsMonthsV_plural": "__y__ 年, __count__ 月前"
"minutesV": "__count__分前",
"hoursV": "__count__小时前",
"hoursV_plural": "__count__小时前",
"daysV": "__count__天前",
"daysV_plural": "__count__天前",
"weeksV": "__count__周前",
"weeksV_plural": "__count__周前",
"monthsV": "__count__月前",
"monthsV_plural": "__count__月前",
"yearsV": "__count__年前",
"yearsV_plural": "__count__年前",
"yearMonthsV": "__y__年, __count__月前",
"yearMonthsV_plural": "__y__年, __count__月前",
"yearsMonthsV": "__y__年, __count__月前",
"yearsMonthsV_plural": "__y__年, __count__月前"
},
"nodeCount": "__label__ 个节点",
"nodeCount_plural": "__label__ 个节点",
"moduleCount": "__count__ 个可用模块",
"moduleCount_plural": "__count__ 个可用模块",
"nodeCount": "__label__个节点",
"nodeCount_plural": "__label__个节点",
"moduleCount": "__count__个可用模块",
"moduleCount_plural": "__count__个可用模块",
"inuse": "使用中",
"enableall": "全部启用",
"disableall": "全部禁用",
"enable": "启用",
"disable": "禁用",
"remove": "移除",
"update": "更新至 __version__ 版本",
"update": "更新至__version__版本",
"updated": "已更新",
"install": "安装",
"installed": "已安装",
@@ -544,8 +498,7 @@
"sort": "排序:",
"sortAZ": "a-z顺序",
"sortRecent": "日期顺序",
"more": "增加 __count__ 个",
"upload": "上传模块tgz文件",
"more": "增加__count__个",
"errors": {
"catalogLoadFailed": "无法加载节点目录。<br>查看浏览器控制台了解更多信息",
"installFailed": "无法安装: __module__<br>__message__<br>查看日志了解更多信息",
@@ -586,7 +539,6 @@
"label": "信息",
"node": "节点",
"type": "类型",
"group": "组",
"module": "模组",
"id": "ID",
"status": "状态",
@@ -608,30 +560,8 @@
"subflowDesc": "子流程描述",
"nodeHelp": "节点帮助",
"none": "无",
"arrayItems": "__count__ 个项目",
"showTips": "您可以从设置面板启用提示信息",
"outline": "大纲",
"empty": "空的",
"globalConfig": "全局配置节点",
"triggerAction": "触发动作",
"find": "在工作区中查找",
"search": {
"configNodes": "配置节点",
"unusedConfigNodes": "未使用的配置节点",
"invalidNodes": "无效的节点",
"uknownNodes": "未知的节点",
"unusedSubflows": "未使用的子流程"
}
},
"help": {
"name": "帮助",
"label": "帮助",
"search": "搜索帮助",
"nodeHelp": "节点帮助",
"showHelp": "显示帮助",
"showInOutline": "在大纲中显示",
"showTopics": "显示主题",
"noHelp": "未选择帮助主题"
"arrayItems": "__count__个项目",
"showTips": "您可以从设置面板启用提示信息"
},
"config": {
"name": "配置节点",
@@ -684,9 +614,9 @@
"removeFromProject": "从项目中删除",
"addToProject": "添加到项目",
"files": "文件",
"package": "包",
"flow": "流程",
"credentials": "证书",
"package": "包",
"packageCreate": "保存更改后将创建文件",
"fileNotExist": "文件不存在",
"selectFile": "选择文件",
@@ -698,7 +628,7 @@
"changeTheEncryptionKey": "更改加密密钥",
"currentKey": "当前密钥",
"newKey": "新密钥",
"credentialsAlert": "这将删除所有现有证",
"credentialsAlert": "这将删除所有现有证",
"versionControl": "版本控制",
"branches": "分支",
"noBranches": "没有分支",
@@ -722,12 +652,6 @@
"committerTip": "保留空白以使用系统默认值",
"userName": "用户名",
"email": "电子邮件",
"workflow": "工作流",
"workfowTip": "选择您偏好的工作流",
"workflowManual": "手动",
"workflowManualTip": "所有更改都必须在“历史记录”侧边栏中手动提交",
"workflowAuto": "自动",
"workflowAutoTip": "每次部署后都会自动提交更改",
"sshKeys": "SSH密钥",
"sshKeysTip": "允许您创建到远程git存储库的安全连接。",
"add": "添加密钥",
@@ -744,7 +668,7 @@
"copyPublicKey": "将公钥复制到剪贴板",
"delete": "删除密钥",
"gitConfig": "Git配置",
"deleteConfirm": "您确定要删除SSH密钥 __name__ 吗?这不能被撤消。"
"deleteConfirm": "您确定要删除SSH密钥__name__吗这不能被撤消。"
},
"versionControl": {
"unstagedChanges": "未暂存的变更",
@@ -798,24 +722,24 @@
"pullChanges": "拉取更改",
"history": "历史",
"projectHistory": "项目历史",
"daysAgo": "__count__ 天前",
"daysAgo_plural": "__count__ 天前",
"hoursAgo": "__count__ 小时前",
"hoursAgo_plural": "__count__ 小时前",
"minsAgo": "__count__ 分钟前",
"minsAgo_plural": "__count__ 分钟前",
"daysAgo": "__count__天前",
"daysAgo_plural": "__count__天前",
"hoursAgo": "__count__小时前",
"hoursAgo_plural": "__count__小时前",
"minsAgo": "__count__分钟前",
"minsAgo_plural": "__count__分钟前",
"secondsAgo": "秒前",
"notTracking": "您的本地分支当前未跟踪一个远程分支。",
"statusUnmergedChanged": "您的仓库中有未合并的更改。您需要解决冲突并提交结果。",
"repositoryUpToDate": "您的仓库是最新的。",
"commitsAhead": "您的存储库领先远程仓库 __count__ 次提交。您现在可以推送这些提交。",
"commitsAhead_plural": "您的存储库领先远程仓库 __count__ 次提交。您现在可以推送这些提交。",
"commitsBehind": "您的存储库落后远程仓库 __count__ 次提交。您现在可以拉取这些提交。",
"commitsBehind_plural": "您的存储库落后远程仓库 __count__ 次提交。您现在可以拉取这些提交。",
"commitsAheadAndBehind1": "您的存储库落后远程仓库 __count__ 次提交",
"commitsAheadAndBehind1_plural": "您的存储库落后远程仓库 __count__ 次提交",
"commitsAheadAndBehind2": "领先远程仓库 __count__ 次提交。",
"commitsAheadAndBehind2_plural": "领先远程仓库 __count__ 次提交。",
"commitsAhead": "您的存储库领先远程仓库__count__次提交。您现在可以推送这些提交。",
"commitsAhead_plural": "您的存储库领先远程仓库__count__次提交。您现在可以推送这些提交。",
"commitsBehind": "您的存储库落后远程仓库__count__次提交。您现在可以拉取这些提交。",
"commitsBehind_plural": "您的存储库落后远程仓库__count__次提交。您现在可以拉取这些提交。",
"commitsAheadAndBehind1": "您的存储库落后远程仓库__count__次提交",
"commitsAheadAndBehind1_plural": "您的存储库落后远程仓库__count__次提交",
"commitsAheadAndBehind2": "领先远程仓库__count__次提交。",
"commitsAheadAndBehind2_plural": "领先远程仓库__count__次提交。",
"commitsAheadAndBehind3": "您必须先拉取远程提交,然后才能进行推送。",
"commitsAheadAndBehind3_plural": "您必须先拉取远程提交,然后才能进行推送。",
"refreshCommitHistory": "刷新提交历史",
@@ -833,8 +757,7 @@
"bin": "二进制流",
"date": "时间戳",
"jsonata": "表达式",
"env": "环境变量",
"cred": "证书"
"env": "环境变量"
}
},
"editableList": {
@@ -1054,8 +977,7 @@
"passphrase": "密码短语",
"retry": "重试",
"update-failed": "无法更新身份验证",
"unhandled": "未处理的错误响应",
"host-key-verify-failed": "<p>主机密钥验证失败。</p><p>无法验证存储库主机密钥。请更新您的<code>known_hosts</code>文件,然后重试。</p>"
"unhandled": "未处理的错误响应"
},
"create-branch-list": {
"invalid": "无效的分支",

View File

@@ -1,15 +1,15 @@
{
"$string": {
"args": "arg",
"desc": "通过以下的类型转换规则将参数 *arg* 转换成字符串:\n\n - 字符串不转换。\n -函数转换成空的字符串。\n - JSON的值无法用数字表示所以用无限大或者NaN非数表示。\n - 用 `JSON.stringify` 函数将其他值转换成JSON字符串。"
"desc": "通过以下的类型转换规则将参数*arg*转换成字符串:\n\n - 字符串不转换。\n -函数转换成空的字符串。\n - JSON的值无法用数字表示所以用无限大或者NaN非数表示。\n - 用JSON.stringify函数将其他值转换成JSON字符串。"
},
"$length": {
"args": "str",
"desc": "输出字符串 `str` 的字数。如果 `str` 不是字符串,抛出错误。"
"desc": "输出字符串str的字数。如果str不是字符串,抛出错误。"
},
"$substring": {
"args": "str, start[, length]",
"desc": "输出 `start` 位置后的的首次出现的包括 `str` 的子字符串。 如果 `length` 被指定,那么的字符串中将只包括前 `length` 个文字。如果 `start` 是负数则输出从 `str` 末尾开始的 `length` 个文字"
"desc": "输出`start`位置后的的首次出现的包括`str`的子字符串。 如果`length`被指定,那么的字符串中将只包括前`length`个文字。如果`start`是负数则输出从`str`末尾开始的`length`个文字"
},
"$substringBefore": {
"args": "str, chars",
@@ -17,11 +17,11 @@
},
"$substringAfter": {
"args": "str, chars",
"desc": "输出 `str` 中首次出现的 `chars` 之后的子字符串,如果 `str` 中不包括 `chars` 则输出 `str` 。"
"desc": "输出str中首次出现的chars之后的子字符串,如果str中不包括chars则输出str。"
},
"$uppercase": {
"args": "str",
"desc": "将 `str` 中的所有字母变为大写后输出。"
"desc": "`将’str中的所有字母变为大写后输出。"
},
"$lowercase": {
"args": "str",
@@ -29,27 +29,27 @@
},
"$trim": {
"args": "str",
"desc": "将以下步骤应用于 `str` 来去除所有空白文字并实现标准化。\n\n 将全部tab制表符、回车键、换行字符用空白代替。\n- 将连续的空白文字变成一个空白文字。\n- 消除开头和末尾的空白文字。\n\n如果 `str` 没有被指定(即在无输入参数的情况下调用本函数),将上下文的值作为 `str` 来使用。 如果 `str` 不是字符串则抛出错误。"
"desc": "将以下步骤应用于`str`来去除所有空白文字并实现标准化。\n\n 将全部tab制表符、回车键、换行字符用空白代替。\n- 将连续的空白文字变成一个空白文字。\n- 消除开头和末尾的空白文字。\n\n如果`str`没有被指定(即在无输入参数的情况下调用本函数),将上下文的值作为`str`来使用。 如果`str` 不是字符串则抛出错误。"
},
"$contains": {
"args": "str, pattern",
"desc": "字符串 `str` 和 `pattern` 匹配的话输出 `true` ,不匹配的情况下输出 `false` 。 不指定 `str` 的情况下(比如用一个参数调用本函数时)、将上下文的值作为 `str` 来使用。参数 `pattern` 可以为字符串或正则表达。"
"desc": "字符串`str` 和 `pattern`匹配的话输出`true`,不匹配的情况下输出 `false`。 不指定`str`的情况下(比如用一个参数调用本函数时)、将上下文的值作为`str`来使用。参数 `pattern`可以为字符串或正则表达。"
},
"$split": {
"args": "str[, separator][, limit]",
"desc": "将参数 `str` 分解成由子字符串组成的数组。 如果 `str` 不是字符串抛出错误。可以省略的参数 `separator` 中指定字符串 `str` 的分隔符。分隔符可以是文字或正则表达式。在不指定 `separator` 的情况下、将分隔符看作空的字符串并把 `str` 拆分成由单个字母组成的数组。如果 `separator` 不是字符串则抛出错误。在可省略的参数 `limit` 中指定分割后的子字符串的最大个数。超出个数的子字符串将被舍弃。如果 `limit` 没有被指定,`str` 将不考虑子字符串的个数而将字符串完全分隔。如果 `limit` 是负数则抛出错误。"
"desc": "将参数`str`分解成由子字符串组成的数组。 如果`str`不是字符串抛出错误。可以省略的参数 `separator`中指定字符串`str`的分隔符。分隔符可以是文字或正则表达式。在不指定`separator`的情况下、将分隔符看作空的字符串并把`str`拆分成由单个字母组成的数组。如果`separator`不是字符串则抛出错误。在可省略的参数`limit`中指定分割后的子字符串的最大个数。超出个数的子字符串将被舍弃。如果`limit`没有被指定,`str` 将不考虑子字符串的个数而将字符串完全分隔。如果`limit`是负数则抛出错误。"
},
"$join": {
"args": "array[, separator]",
"desc": "用可以省略的参数 `separator` 来把多个字符串连接。如果 `array` 不是字符串则抛出错误。 如果没有指定 `separator` ,则用空字符串来连接字符(即字符串之间没有 `separator` )。 如果 `separator` 不是字符则抛出错误。"
"desc": "用可以省略的参数 `separator`来把多个字符串连接。如果`array`不是字符串则抛出错误。 如果没有指定`separator`,则用空字符串来连接字符(即字符串之间没有`separator`)。 如果`separator`不是字符则抛出错误。"
},
"$match": {
"args": "str, pattern [, limit]",
"desc": "对字符串 `str` 使用正则表达式 `pattern` 并输出与 `str` 相匹配的部分信息。"
"desc": "对字符串`str`使用正则表达式`pattern`并输出与`str`相匹配的部分信息。"
},
"$replace": {
"args": "str, pattern, replacement [, limit]",
"desc": "在字符串 `str` 中搜索 `pattern` 并用 `replacement` 来替换。\n\n可选参数 `limit` 用来指定替换次数的上限。"
"desc": "在字符串`str`中搜索`pattern`并用`replacement`来替换。\n\n可选参数`limit`用来指定替换次数的上限。"
},
"$now": {
"args": "",
@@ -65,31 +65,31 @@
},
"$number": {
"args": "arg",
"desc": "用下述的规则将参数 `arg` 转换为数值。:\n\n 数值不做转换。\n 将字符串中合法的JSON数値表示转换成数値。\n 其他形式的值则抛出错误。"
"desc": "用下述的规则将参数 `arg`转换为数值。:\n\n 数值不做转换。\n 将字符串中合法的JSON数値表示转换成数値。\n 其他形式的值则抛出错误。"
},
"$abs": {
"args": "number",
"desc": "输出参数 `number` 的绝对值。"
"desc": "输出参数`number`的绝对值。"
},
"$floor": {
"args": "number",
"desc": "输出比 `number` 的值小的最大整数。"
"desc": "输出比`number`的值小的最大整数。"
},
"$ceil": {
"args": "number",
"desc": "输出比 `number` 的值大的最小整数。"
"desc": "输出比`number`的值大的最小整数。"
},
"$round": {
"args": "number [, precision]",
"desc": "输出四舍五入后的参数 `number` 。可省略的参数 `precision` 指定四舍五入后小数点下的位数。"
"desc": "输出四舍五入后的参数`number`。可省略的参数 `precision`指定四舍五入后小数点下的位数。"
},
"$power": {
"args": "base, exponent",
"desc": "输出底数 `base``exponent` 次幂。"
"desc": "输出底数`base``exponent`次幂。"
},
"$sqrt": {
"args": "number",
"desc": "输出参数 `number` 的平方根。"
"desc": "输出参数 `number`的平方根。"
},
"$random": {
"args": "",
@@ -97,35 +97,35 @@
},
"$millis": {
"args": "",
"desc": "返回从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。在同一个表达式的测试中所有对 `$millis()` 的调用将会返回相同的值。"
"desc": "返回从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。在同一个表达式的测试中所有对`$millis()`的调用将会返回相同的值。"
},
"$sum": {
"args": "array",
"desc": "输出数组 `array` 的总和。如果 `array` 不是数值则抛出错误。"
"desc": "输出数组`array`的总和。如果`array`不是数值则抛出错误。"
},
"$max": {
"args": "array",
"desc": "输出数组 `array` 的最大值。如果 `array` 不是数值则抛出错误。"
"desc": "输出数组`array`的最大值。如果`array`不是数值则抛出错误。"
},
"$min": {
"args": "array",
"desc": "输出数组 `array` 的最小值。如果 `array` 不是数值则抛出错误。。"
"desc": "输出数组`array`的最小值。如果`array`不是数值则抛出错误。。"
},
"$average": {
"args": "array",
"desc": "输出数组 `array` 的平均数。如果 `array` 不是数值则抛出错误。。"
"desc": "输出数组`array`的平均数。如果`array`不是数值则抛出错误。。"
},
"$boolean": {
"args": "arg",
"desc": "用下述规则将数据转换成布尔值。:\n\n - 不转换布尔值 `Boolean` 。\n 将空的字符串 `string` 转换为 `false` \n 将不为空的字符串 `string` 转换为 `true` \n 将为0的数字 `number` 转换成 `false` \n 将不为0的数字 `number` 转换成 `true` \n –将 `null` 转换成 `false` \n –将空的数组 `array` 转换成 `false` \n –如果数组 `array` 中含有可以转换成 `true` 的要素则转换成 `true` \n –如果 `array` 中没有可转换成 `true` 的要素则转换成 `false` \n 空的对象 `object` 转换成 `false` \n 非空的对象 `object` 转换成 `true` \n –将函数 `function` 转换成 `false` "
"desc": "用下述规则将数据转换成布尔值。:\n\n - 不转换布尔值`Boolean`。\n 将空的字符串`string`转换为`false`\n 将不为空的字符串`string`转换为`true`\n 将为0的数字`number`转换成`false`\n 将不为0的数字`number`转换成`true`\n –将`null`转换成`false`\n –将空的数组`array`转换成`false`\n –如果数组`array`中含有可以转换成`true`的要素则转换成`true`\n –如果`array`中没有可转换成`true`的要素则转换成`false`\n 空的对象`object`转换成`false`\n 非空的对象`object`转换成`true`\n –将函数`function`转换成`false`"
},
"$not": {
"args": "arg",
"desc": "输出做取反运算后的布尔值。首先将 `arg` 转换为布尔值。"
"desc": "输出做取反运算后的布尔值。首先将`arg`转换为布尔值。"
},
"$exists": {
"args": "arg",
"desc": "如果算式 `arg` 的值存在则输出 `true` 。如果算式的值不存在(比如指向不存在区域的引用)则输出 `false` 。"
"desc": "如果算式`arg`的值存在则输出`true`。如果算式的值不存在(比如指向不存在区域的引用)则输出`false`。"
},
"$count": {
"args": "array",
@@ -137,15 +137,15 @@
},
"$sort": {
"args": "array [, function]",
"desc": "输出排序后的数组 `array` 。\n\n如果使用了比较函数 `function` ,则下述两个参数需要被指定。\n\n `function(left, right)` \n\n该比较函数是为了比较left和right两个值而被排序算法调用的。如果用户希望left的值被置于right的值之后那么该函数必须输出布尔值 `true` 来表示位置交换。而在不需要位置交换时函数必须输出 `false` 。"
"desc": "输出排序后的数组`array`。\n\n如果使用了比较函数`function`,则下述两个参数需要被指定。\n\n`function(left, right)`\n\n该比较函数是为了比较left和right两个值而被排序算法调用的。如果用户希望left的值被置于right的值之后那么该函数必须输出布尔值`true`来表示位置交换。而在不需要位置交换时函数必须输出`false`。"
},
"$reverse": {
"args": "array",
"desc": "输出倒序后的数组 `array` 。"
"desc": "输出倒序后的数组`array`。"
},
"$shuffle": {
"args": "array",
"desc": "输出随机排序后的数组 `array` 。"
"desc": "输出随机排序后的数组 `array`。"
},
"$zip": {
"args": "array, ...",
@@ -157,35 +157,35 @@
},
"$lookup": {
"args": "object, key",
"desc": "输出对象中与参数 `key` 对应的值。如果第一个参数 `object` 是数组,那么数组中所有的对象都将被搜索并输出这些对象中与参数 `key` 对应的值。"
"desc": "输出对象中与参数`key`对应的值。如果第一个参数`object`是数组,那么数组中所有的对象都将被搜索并输出这些对象中与参数`key`对应的值。"
},
"$spread": {
"args": "object",
"desc": "将对象中的键值对分隔成每个要素中只含有一个键值对的数组。如果参数 `object` 是数组,那么返回值的数组中包含所有对象中的键值对。"
"desc": "将对象中的键值对分隔成每个要素中只含有一个键值对的数组。如果参数`object`是数组,那么返回值的数组中包含所有对象中的键值对。"
},
"$merge": {
"args": "array&lt;object&gt;",
"desc": "将输入数组 `objects` 中所有的键值对合并到一个 `object` 中并返回。如果输入数组的要素中含有重复的键,则返回的 `object` 中将只包含数组中最后出现要素的值。如果输入数组中包括对象以外的元素,则抛出错误。"
"desc": "将输入数组`objects`中所有的键值对合并到一个`object`中并返回。如果输入数组的要素中含有重复的键,则返回的`object`中将只包含数组中最后出现要素的值。如果输入数组中包括对象以外的元素,则抛出错误。"
},
"$sift": {
"args": "object, function",
"desc": "输出参数 `object` 中符合 `function` 的键值对。\n\n `function` 必须含有下述参数。\n\n `function(value [, key [, object]])` "
"desc": "输出参数`object`中符合`function`的键值对。\n\n`function`必须含有下述参数。\n\n`function(value [, key [, object]])`"
},
"$each": {
"args": "object, function",
"desc": "将函数 `function` 应用于 `object` 中的所有键值对并输出由所有返回值组成的数组。"
"desc": "将函数`function`应用于`object`中的所有键值对并输出由所有返回值组成的数组。"
},
"$map": {
"args": "array, function",
"desc": "将函数 `function` 应用于数组 `array` 中所有的值并输出由返回值组成的数组。\n\n `function` 中必须含有下述参数。\n\n`function(value [, index [, array]])` "
"desc": "将函数`function`应用于数组`array`中所有的值并输出由返回值组成的数组。\n\n`function`中必须含有下述参数。\n\n`function(value [, index [, array]])`"
},
"$filter": {
"args": "array, function",
"desc": "输出数组 `array` 中符合函数 `function` 条件的值组成的数组。\n\n `function` 必须包括下述参数。\n\n `function(value [, index [, array]])`"
"desc": "输出数组`array`中符合函数`function`条件的值组成的数组。\n\n`function`必须包括下述参数。\n\n`function(value [, index [, array]])`"
},
"$reduce": {
"args": "array, function [, init]",
"desc": "将 `function` 依次应用于数组中的各要素值。 其中,前一个要素值的计算结果将参与到下一次的函数运算中。。\n\n函数 `function` 接受两个参数并作为中缀表示法中的操作符。\n\n可省略的参数 `init` 将作为运算的初始值。"
"desc": "将`function`依次应用于数组中的各要素值。 其中,前一个要素值的计算结果将参与到下一次的函数运算中。。\n\n函数`function`接受两个参数并作为中缀表示法中的操作符。\n\n可省略的参数`init`将作为运算的初始值。"
},
"$flowContext": {
"args": "string",
@@ -197,7 +197,7 @@
},
"$pad": {
"args": "string, width [, char]",
"desc": "根据需要,向字符串 `string` 的副本中填充文字使该字符串的字数达到 `width` 的绝对值并返回填充文字后的字符串。\n\n如果 `width` 的值为正,则向字符串 `string` 的右侧填充文字,如果 `width` 为负,则向字符串 `string` 的左侧填充文字。\n\n可选参数 `char` 用来指定填充的文字。如果未指定该参数,则填充空白文字。"
"desc": "根据需要,向字符串`string`的副本中填充文字使该字符串的字数达到`width`的绝对值并返回填充文字后的字符串。\n\n如果`width`的值为正,则向字符串`string`的右侧填充文字,如果`width`为负,则向字符串`string`的左侧填充文字。\n\n可选参数`char`用来指定填充的文字。如果未指定该参数,则填充空白文字。"
},
"$fromMillis": {
"args": "number",
@@ -205,15 +205,15 @@
},
"$formatNumber": {
"args": "number, picture [, options]",
"desc": "将 `number` 转换成具有 `picture` 所指定的数值格式的字符串。\n\n此函数的功能与XPath F&O 3.1规格中定义的XPath/XQuery函数的fn:format-number功能相一致。参数 `picture` 用于指定数值的转换格式其语法与fn:format-number中的定义一致。\n\n可选的第三参数 `options` 用来覆盖默认的局部环境格式如小数点分隔符。如果指定该参数那么该参数必须是包含name/value对的对象并且name/value对必须符合XPath F&O 3.1规格中记述的数值格式。"
"desc": "将`number`转换成具有`picture`所指定的数值格式的字符串。\n\n此函数的功能与XPath F&O 3.1规格中定义的XPath/XQuery函数的fn:format-number功能相一致。参数`picture`用于指定数值的转换格式其语法与fn:format-number中的定义一致。\n\n可选的第三参数`options`用来覆盖默认的局部环境格式如小数点分隔符。如果指定该参数那么该参数必须是包含name/value对的对象并且name/value对必须符合XPath F&O 3.1规格中记述的数值格式。"
},
"$formatBase": {
"args": "number [, radix]",
"desc": "将 `number` 变换为以参数 `radix` 的值为基数形式的字符串。如果不指定 `radix` 的值则默认基数为10。指定的 `radix` 值必须在236之间否则抛出错误。"
"desc": "将`number`变换为以参数`radix`的值为基数形式的字符串。如果不指定`radix`的值则默认基数为10。指定的`radix`值必须在236之间否则抛出错误。"
},
"$toMillis": {
"args": "timestamp",
"desc": "将ISO 8601格式的字符串 `timestamp` 转换为从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。如果该字符串的格式不正确则抛出错误。"
"desc": "将ISO 8601格式的字符串`timestamp`转换为从UNIX时间 (1970年1月1日 UTC/GMT的午夜开始到现在的毫秒数。如果该字符串的格式不正确则抛出错误。"
},
"$env": {
"args": "arg",
@@ -221,7 +221,7 @@
},
"$eval": {
"args": "expr [, context]",
"desc": "使用当前上下文来作为评估依据,分析并评估字符串 `expr` 其中包含文字JSON或JSONata表达式。"
"desc": "使用当前上下文来作为评估依据,分析并评估字符串`expr`其中包含文字JSON或JSONata表达式。"
},
"$formatInteger": {
"args": "number, picture",
@@ -233,42 +233,38 @@
},
"$error": {
"args": "[str]",
"desc": "引发错误并显示一条消息。 可选的 `str` 将替代$error()函数评估的默认消息。"
"desc": "引发错误并显示一条消息。 可选的`str`将替代$error()函数评估的默认消息。"
},
"$assert": {
"args": "arg, str",
"desc": "如果 `arg` 为真,则该函数返回。 如果arg为假则抛出带有str的异常作为异常消息。"
"desc": "如果`arg`为真,则该函数返回。 如果arg为假则抛出带有str的异常作为异常消息。"
},
"$single": {
"args": "array, function",
"desc": "返回满足参数function谓语的array参数中的唯一值 (比如传递值时函数返回布尔值“true”)。如果匹配值的数量不唯一时,则抛出异常。\n\n应在以下签名中提供函数 `functionvalue [index [array []]]` 其中value是数组的每个输入index是该值的位置整个数组作为第三个参数传递。"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "通过用表示字符的UTF-8编码的一个两个三个或四个转义序列替换某些字符的每个实例对统一资源定位符URL组件进行编码。\n\n示例 `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
"desc": "返回满足参数function谓语的array参数中的唯一值 (比如传递值时函数返回布尔值“true”)。如果匹配值的数量不唯一时,则抛出异常。\n\n应在以下签名中提供函数`functionvalue [index [array []]]`其中value是数组的每个输入index是该值的位置整个数组作为第三个参数传递。"
},
"$encodeUrl": {
"args": "str",
"desc": "通过用表示字符的UTF-8编码的一个两个三个或四个转义序列替换某些字符的每个实例对统一资源定位符URL组件进行编码。\n\n示例`$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrlComponent": {
"args": "str",
"desc": "通过用表示字符的UTF-8编码的一个两个三个或四个转义序列替换某些字符的每个实例对统一资源定位符URL进行编码。\n\n示例 `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrlComponent": {
"$decodeUrl": {
"args": "str",
"desc": "解码以前由encodeUrlComponent创建的统一资源定位器URL组件。 \n\n示例 `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrl": {
"$decodeUrlComponent": {
"args": "str",
"desc": "解码先前由encodeUrl创建的统一资源定位符URL。 \n\n示例 `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
"$distinct": {
"args": "array",
"desc": "返回一个数组,其中重复的值已从 `数组` 中删除"
"desc": "返回一个数组,其中重复的值已从`数组`中删除"
},
"$type": {
"args": "value",
"desc": "以字符串形式返回 `值` 的类型。 如果该 `值` 未定义,则将返回 `未定义` "
},
"$moment": {
"args": "[str]",
"desc": "使用Moment库获取日期对象。"
"desc": "以字符串形式返回`值`的类型。 如果该`值`未定义,则将返回`未定义`"
}
}

View File

@@ -14,16 +14,7 @@
"back": "返回",
"next": "下一步",
"clone": "複製專案",
"cont": "繼續",
"style": "風格",
"line": "大綱",
"fill": "填充",
"label": "標籤",
"color": "顏色",
"position": "位置",
"enable": "啟用",
"disable": "禁用",
"upload": "上傳"
"cont": "Continue"
},
"type": {
"string": "字符串",
@@ -37,13 +28,6 @@
"null": "空"
}
},
"event": {
"loadPalette": "加載控制板",
"loadNodeCatalogs": "加載節點目錄",
"loadNodes": "加載 __count__ 個節點",
"loadFlows": "加載流程",
"importFlows": "往工作區中加載流程"
},
"workspace": {
"defaultName": "流程__number__",
"editFlow": "編輯流程: __name__",
@@ -107,12 +91,7 @@
"projects-new": "新專案",
"projects-open": "開啟專案",
"projects-settings": "專案設定",
"showNodeLabelDefault": "顯示新添加節點的標籤",
"groups": "組",
"groupSelection": "選擇組",
"ungroupSelection": "取消選擇組",
"groupMergeSelection": "合并選擇",
"groupRemoveSelection": "從組中移除"
"showNodeLabelDefault": "顯示新添加節點的標籤"
}
},
"actions": {
@@ -122,7 +101,7 @@
"zoom-in": "放大"
},
"user": {
"loggedInAs": "作為 __name__ 登入",
"loggedInAs": "作為__name__登入",
"username": "帳號",
"password": "密碼",
"login": "登入",
@@ -154,7 +133,7 @@
"error": "<strong>Error</strong>: __message__",
"errors": {
"lostConnection": "丟失與伺服器的連接,重新連接...",
"lostConnectionReconnect": "丟失與伺服器的連接__time__ 秒後重新連接",
"lostConnectionReconnect": "丟失與伺服器的連接__time__秒後重新連接",
"lostConnectionTry": "現在嘗試",
"cannotAddSubflowToItself": "無法向其自身添加子流程",
"cannotAddCircularReference": "無法添加子流程 - 迴圈引用",
@@ -167,7 +146,7 @@
"loaded": "已加載項目'__project__'",
"updated": "已更新項目'__project__'",
"pull": "已重新加載項目'__project__'",
"revert": "項目'__project__'已還原",
"revert": "項目__project__已還原",
"merge-complete": "Git合併完成",
"setupCredentials": "設定證書",
"setupProjectFiles": "設置項目文件",
@@ -192,14 +171,10 @@
"node_plural": "__count__ 多個節點",
"configNode": "__count__ 節點組態",
"configNode_plural": "__count__ 多節點組態",
"group": "__count__ 個組",
"group_plural": "__count__ 個組",
"flow": "__count__ 流程",
"flow_plural": "__count__ 多流程",
"subflow": "__count__ 子流程",
"subflow_plural": "__count__ 多子流程",
"replacedNodes": "__count__ 個節點被置換",
"replacedNodes_plural": "__count__ 個節點被置換",
"pasteNodes": "在這裡粘貼節點",
"selectFile": "匯入所選檔案",
"importNodes": "匯入節點",
@@ -209,15 +184,9 @@
"importUnrecognised_plural": "匯入了無法識別的類型:",
"nodesExported": "節點匯出到了剪貼簿",
"nodesImported": "已匯入:",
"nodeCopied": "已複製 __count__ 個節點",
"nodeCopied_plural": "已複製 __count__ 個節點",
"groupCopied": "複製 __count__ 個組",
"groupCopied_plural": "已複製 __count__ 個groups",
"groupStyleCopied": "已複製組風格",
"nodeCopied": "已複製__count__個節點",
"nodeCopied_plural": "已複製__count__個節點",
"invalidFlow": "無效的流程: __message__",
"recoveredNodes": "復原的節點",
"recoveredNodesInfo": "導入節點時此流上的節點缺少有效的流ID。它們已被添加到此流中您可以復原或刪除它們。",
"recoveredNodesNotification": "<p>導入的節點缺少有效的流ID</p><p>已將它們添加到名為 '__flowName__'的新流中。</p>",
"export": {
"selected": "已選擇的節點",
"current": "現在的節點",
@@ -232,19 +201,13 @@
},
"import": {
"import": "匯入到",
"importSelected": "導入所選項",
"importCopy": "導入副本",
"viewNodes": "查看節點",
"newFlow": "新流程",
"replace": "置換",
"errors": {
"notArray": "輸入的不是JSON數組",
"itemNotObject": "輸入的流程無效-項目 __index__ 不是節點對象",
"missingId": "輸入的流程無效-項 __index__ 缺少“ id”屬性",
"missingType": "輸入的流程無效-項 __index__ 缺少“類型”屬性"
},
"conflictNotification1": "您要導入的某些節點已經存在於工作空間中。",
"conflictNotification2": "選擇要導入的節點,並確認要替換現有的節點還是導入它們的副本"
"itemNotObject": "輸入的流程無效-項目__index__不是節點對象",
"missingId": "輸入的流程無效-項__index__缺少“ id”屬性",
"missingType": "輸入的流程無效-項__index__缺少“類型”屬性"
}
},
"copyMessagePath": "已複製路徑",
"copyMessageValue": "已複製數值",
@@ -287,7 +250,7 @@
"conflictChecking": "檢查是否可以自動合併更改",
"conflictAutoMerge": "此更改不包括衝突,可以自動合併",
"conflictManualMerge": "這些更改包括了在部署之前必須解決的衝突。",
"plusNMore": "+更多的 __count__"
"plusNMore": "+更多的__count__"
}
},
"eventLog": {
@@ -295,8 +258,8 @@
"view": "查看日誌"
},
"diff": {
"unresolvedCount": "__count__ 個未解決的衝突",
"unresolvedCount_plural": "__count__ 個未解決的衝突",
"unresolvedCount": "__count__個未解決的衝突",
"unresolvedCount_plural": "__count__個未解決的衝突",
"globalNodes": "全局節點",
"flowProperties": "流程屬性",
"type": {
@@ -306,11 +269,11 @@
"deleted": "已刪除",
"flowDeleted": "已刪除流程",
"flowAdded": "已添加流程",
"movedTo": "移動至 __id__",
"movedFrom": "從 __id__ 移動"
"movedTo": "移動至__id__",
"movedFrom": "從__id__移動"
},
"nodeCount": "__count__ 個節點",
"nodeCount_plural": "__count__ 個節點",
"nodeCount": "__count__個節點",
"nodeCount_plural": "__count__個節點",
"local": "本地",
"remote": "遠端",
"reviewChanges": "查看變更",
@@ -324,11 +287,11 @@
"newVersionError": "新版本不包含有效的JSON"
},
"subflow": {
"editSubflowInstance": "編輯子流程實例: __name__",
"editSubflow": "編輯流程範本 __name__",
"editSubflowInstance": "編輯子流程實例__name__",
"editSubflow": "編輯流程範本: __name__",
"edit": "編輯流程範本",
"subflowInstances": "這個子流程範本有 __count__ 個實例",
"subflowInstances_plural": "這個子流程範本有 __count__ 個實例",
"subflowInstances": "這個子流程範本有__count__個實例",
"subflowInstances_plural": "這個子流程範本有__count__個實例",
"editSubflowProperties": "編輯屬性",
"input": "輸入:",
"output": "輸出:",
@@ -345,24 +308,17 @@
"multipleInputsToSelection": "<strong>無法創建子流程</strong>: 多個輸入到了選擇"
}
},
"group": {
"editGroup": "編輯組: __name__",
"errors": {
"cannotCreateDiffGroups": "無法使用來自不同組的節點創建組",
"cannotAddSubflowPorts": "無法將子流程的端口添加到組"
}
},
"editor": {
"configEdit": "編輯",
"configAdd": "添加",
"configUpdate": "更新",
"configDelete": "刪除",
"nodesUse": "__count__ 個節點使用此配置",
"nodesUse_plural": "__count__ 個節點使用此配置",
"addNewConfig": "添加新的 __type__ 配置",
"editNode": "編輯 __type__ 節點",
"editConfig": "編輯 __type__ 配置",
"addNewType": "添加新的 __type__ 節點",
"nodesUse": "__count__個節點使用此配置",
"nodesUse_plural": "__count__個節點使用此配置",
"addNewConfig": "添加新的__type__配置",
"editNode": "編輯__type__節點",
"editConfig": "編輯__type__配置",
"addNewType": "添加新的__type__節點",
"nodeProperties": "節點屬性",
"label": "Label",
"color": "顏色",
@@ -381,7 +337,6 @@
"locale": "選擇界面語言",
"icon": "圖標",
"inputType": "輸入類型",
"selectType": "選擇類型...",
"inputs": {
"input": "輸入",
"select": "選擇",
@@ -396,8 +351,7 @@
"bool": "布爾",
"json": "JSON",
"bin": "buffer",
"env": "環境變量",
"cred": "證書"
"env": "環境變量"
},
"menu": {
"input": "輸入",
@@ -451,13 +405,13 @@
"library": "庫",
"openLibrary": "打開庫...",
"saveToLibrary": "保存到庫...",
"typeLibrary": "__type__ 型別程式庫",
"unnamedType": "無名 __type__",
"typeLibrary": "__type__型別程式庫",
"unnamedType": "無名__type__",
"exportedToLibrary": "節點導出到庫",
"dialogSaveOverwrite": "一個叫做 __libraryName____libraryType__ 已經存在,您需要覆蓋麼?",
"dialogSaveOverwrite": "一個叫做__libraryName____libraryType__已經存在您需要覆蓋麼",
"invalidFilename": "無效的檔案名",
"savedNodes": "保存的節點",
"savedType": "已保存 __type__",
"savedType": "已保存__type__",
"saveFailed": "保存失敗: __message__",
"newFolder": "新文件夾",
"types": {
@@ -506,33 +460,33 @@
"times": {
"seconds": "秒前",
"minutes": "分前",
"minutesV": "__count__ 分前",
"hoursV": "__count__ 小時前",
"hoursV_plural": "__count__ 小時前",
"daysV": "__count__ 天前",
"daysV_plural": "__count__ 天前",
"weeksV": "__count__ 周前",
"weeksV_plural": "__count__ 周前",
"monthsV": "__count__ 月前",
"monthsV_plural": "__count__ 月前",
"yearsV": "__count__ 年前",
"yearsV_plural": "__count__ 年前",
"yearMonthsV": "__y__ 年, __count__ 月前",
"yearMonthsV_plural": "__y__ 年, __count__ 月前",
"yearsMonthsV": "__y__ 年, __count__ 月前",
"yearsMonthsV_plural": "__y__ 年, __count__ 月前"
"minutesV": "__count__分前",
"hoursV": "__count__小時前",
"hoursV_plural": "__count__小時前",
"daysV": "__count__天前",
"daysV_plural": "__count__天前",
"weeksV": "__count__周前",
"weeksV_plural": "__count__周前",
"monthsV": "__count__月前",
"monthsV_plural": "__count__月前",
"yearsV": "__count__年前",
"yearsV_plural": "__count__年前",
"yearMonthsV": "__y__年, __count__月前",
"yearMonthsV_plural": "__y__年, __count__月前",
"yearsMonthsV": "__y__年, __count__月前",
"yearsMonthsV_plural": "__y__年, __count__月前"
},
"nodeCount": "__label__ 個節點",
"nodeCount_plural": "__label__ 個節點",
"moduleCount": "__count__ 個可用模組",
"moduleCount_plural": "__count__ 個可用模組",
"nodeCount": "__label__個節點",
"nodeCount_plural": "__label__個節點",
"moduleCount": "__count__個可用模組",
"moduleCount_plural": "__count__個可用模組",
"inuse": "使用中",
"enableall": "全部啟用",
"disableall": "全部禁用",
"enable": "啟用",
"disable": "禁用",
"remove": "移除",
"update": "更新至 __version__ 版本",
"update": "更新至__version__版本",
"updated": "已更新",
"install": "安裝",
"installed": "已安裝",
@@ -544,8 +498,7 @@
"sort": "排序:",
"sortAZ": "a-z順序",
"sortRecent": "日期順序",
"more": "增加 __count__ 個",
"upload": "上傳模塊tgz文件",
"more": "增加__count__個",
"errors": {
"catalogLoadFailed": "無法載入節點目錄。<br>查看瀏覽器控制臺瞭解更多資訊",
"installFailed": "無法安裝: __module__<br>__message__<br>查看日誌瞭解更多資訊",
@@ -586,7 +539,6 @@
"label": "信息",
"node": "節點",
"type": "類型",
"group": "組",
"module": "Module",
"id": "ID",
"status": "狀態",
@@ -608,30 +560,8 @@
"subflowDesc": "子流程描述",
"nodeHelp": "節點幫助",
"none": "無",
"arrayItems": "__count__ 個項目",
"showTips": "您可以從設置面板啟用提示資訊",
"outline": "大綱",
"empty": "空的",
"globalConfig": "全局配置節點",
"triggerAction": "觸發動作",
"find": "在工作區中查找",
"search": {
"configNodes": "配置節點",
"unusedConfigNodes": "未使用的配置節點",
"invalidNodes": "無效的節點",
"uknownNodes": "未知的節點",
"unusedSubflows": "未使用的子流程"
}
},
"help": {
"name": "幫助",
"label": "幫助",
"search": "搜索幫助",
"nodeHelp": "節點幫助",
"showHelp": "顯示幫助",
"showInOutline": "在大綱中顯示",
"showTopics": "顯示主題",
"noHelp": "未選擇幫助主題"
"arrayItems": "__count__個項目",
"showTips": "您可以從設置面板啟用提示資訊"
},
"config": {
"name": "配置節點",
@@ -684,9 +614,9 @@
"removeFromProject": "從項目中刪除",
"addToProject": "添加到項目",
"files": "文件",
"package": "包",
"flow": "流程",
"credentials": "證書",
"package": "包",
"packageCreate": "保存更改後將創建文件",
"fileNotExist": "文件不存在",
"selectFile": "選擇文件",
@@ -722,12 +652,6 @@
"committerTip": "保留空白以使用系統默認值",
"userName": "用戶名",
"email": "電子郵件",
"workflow": "工作流",
"workfowTip": "選擇您偏好的工作流",
"workflowManual": "手動",
"workflowManualTip": "所有更改都必須在“歷史記錄”側邊欄中手動提交",
"workflowAuto": "自動",
"workflowAutoTip": "每次部署後都會自動提交更改",
"sshKeys": "SSH密鑰",
"sshKeysTip": "允許您創建到遠程git存儲庫的安全連接。",
"add": "添加密鑰",
@@ -744,7 +668,7 @@
"copyPublicKey": "將公鑰複製到剪貼板",
"delete": "刪除密鑰",
"gitConfig": "Git配置",
"deleteConfirm": "您確定要刪除SSH密鑰 __name__ 嗎? 這不能被撤消。"
"deleteConfirm": "您確定要刪除SSH密鑰__name__嗎 這不能被撤消。"
},
"versionControl": {
"unstagedChanges": "未暫存的更改",
@@ -798,24 +722,24 @@
"pullChanges": "Pull變更",
"history": "歷史",
"projectHistory": "項目歷史",
"daysAgo": "__count__ 天前",
"daysAgo_plural": "__count__ 天前",
"hoursAgo": "__count__ 小時前",
"hoursAgo_plural": "__count__ 小時前",
"minsAgo": "__count__ 分鐘前",
"minsAgo_plural": "__count__ 分鐘前",
"daysAgo": "__count__天前",
"daysAgo_plural": "__count__天前",
"hoursAgo": "__count__小時前",
"hoursAgo_plural": "__count__小時前",
"minsAgo": "__count__分鐘前",
"minsAgo_plural": "__count__分鐘前",
"secondsAgo": "秒前",
"notTracking": "您的本地分支當前未跟蹤遠程分支。",
"statusUnmergedChanged": "您的存儲庫中有未合併的更改。您需要解決衝突並提交結果。",
"repositoryUpToDate": "您的存儲庫是最新的。",
"commitsAhead": "您的倉庫領先遠程倉庫 __count__ 次提交。您現在可以push這些提交。",
"commitsAhead_plural": "您的倉庫領先遠程倉庫 __count__ 次提交。您現在可以push這些提交。",
"commitsBehind": "您的倉庫落後遠程倉庫 __count__ 次提交。您現在可以pull這些提交。",
"commitsBehind_plural": "您的倉庫落後遠程倉庫 __count__ 次提交。您現在可以pull這些提交。",
"commitsAheadAndBehind1": "您的倉庫落後遠程倉庫 __count__ 次提交",
"commitsAheadAndBehind1_plural": "您的倉庫落後遠程倉庫 __count__ 次提交",
"commitsAheadAndBehind2": "領先遠程倉庫 __count__ 次提交。",
"commitsAheadAndBehind2_plural": "領先遠程倉庫 __count__ 次提交。",
"commitsAhead": "您的倉庫領先遠程倉庫__count__次提交。您現在可以push這些提交。",
"commitsAhead_plural": "您的倉庫領先遠程倉庫__count__次提交。您現在可以push這些提交。",
"commitsBehind": "您的倉庫落後遠程倉庫__count__次提交。您現在可以pull這些提交。",
"commitsBehind_plural": "您的倉庫落後遠程倉庫__count__次提交。您現在可以pull這些提交。",
"commitsAheadAndBehind1": "您的倉庫落後遠程倉庫__count__次提交",
"commitsAheadAndBehind1_plural": "您的倉庫落後遠程倉庫__count__次提交",
"commitsAheadAndBehind2": "領先遠程倉庫__count__次提交。",
"commitsAheadAndBehind2_plural": "領先遠程倉庫__count__次提交。",
"commitsAheadAndBehind3": "您必須先pull遠程提交然後再進行push。",
"commitsAheadAndBehind3_plural": "您必須先pull遠程提交然後再進行push。",
"refreshCommitHistory": "刷新提交歷史",
@@ -833,8 +757,7 @@
"bin": "二進位流",
"date": "時間戳記",
"jsonata": "expression",
"env": "env variable",
"cred": "證書"
"env": "env variable"
}
},
"editableList": {
@@ -1054,8 +977,7 @@
"passphrase": "密碼短語",
"retry": "重試",
"update-failed": "無法更新身份驗證",
"unhandled": "未處理的錯誤響應",
"host-key-verify-failed": "<p>主機密鑰驗證失敗。</p><p>無法驗證存儲庫主機密鑰。請更新您的<code>known_hosts</code>文件,然後重試。</p>"
"unhandled": "未處理的錯誤響應"
},
"create-branch-list": {
"invalid": "無效的分支",

View File

@@ -243,19 +243,19 @@
"args": "array, function",
"desc": "返回滿足參數function謂語的array參數中的唯一值 (比如傳遞值時函數返回布林值“true”)。如果匹配值的數量不唯一時,則拋出異常。\n\n應在以下簽名中提供函數`functionvalue [index [array []]]`其中value是數組的每個輸入index是該值的位置整個數組作為第三個參數傳遞。"
},
"$encodeUrlComponent": {
"$encodeUrl": {
"args": "str",
"desc": "通過用表示字符的UTF-8編碼的一個兩個三個或四個轉義序列替換某些字符的每個實例對統一資源定位符URL組件進行編碼。\n\n示例`$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
},
"$encodeUrl": {
"$encodeUrlComponent": {
"args": "str",
"desc": "通過用表示字符的UTF-8編碼的一個兩個三個或四個轉義序列替換某些字符的每個實例對統一資源定位符URL進行編碼。\n\n示例 `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
},
"$decodeUrlComponent": {
"$decodeUrl": {
"args": "str",
"desc": "解碼以前由encodeUrlComponent創建的統一資源定位器URL組件。 \n\n示例 `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
},
"$decodeUrl": {
"$decodeUrlComponent": {
"args": "str",
"desc": "解碼先前由encodeUrl創建的統一資源定位符URL。 \n\n示例 `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
},
@@ -266,9 +266,5 @@
"$type": {
"args": "value",
"desc": "以字符串形式返回`值`的類型。 如果該`值`未定義,則將返回`未定義`"
},
"$moment": {
"args": "[str]",
"desc": "使用Moment庫獲取日期對象。"
}
}

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -76,12 +76,13 @@ oop.inherits(NRJavaScriptWorker, Mirror);
(function() {
this.setOptions = function(options) {
this.options = {
this.options = options || {
// undef: true,
// unused: true,
esversion: 9,
esnext: true,
moz: true,
devel: true,
browser: false,
browser: true,
node: true,
laxcomma: true,
laxbreak: true,
@@ -91,17 +92,8 @@ oop.inherits(NRJavaScriptWorker, Mirror);
maxerr: 100,
expr: true,
multistr: true,
strict: false,
sub: true,
asi: true
globalstrict: true
};
if (options) {
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
this.options[opt] = options.opt;
}
}
}
this.doc.getValue() && this.deferredUpdate.schedule(100);
};
@@ -127,8 +119,6 @@ oop.inherits(NRJavaScriptWorker, Mirror);
if (!value)
return this.sender.emit("annotate", []);
var originalValue = value;
// [Node-RED] wrap the code in a function
value = "async function __nodered__(msg) {\n"+value+"\n}";
@@ -148,7 +138,6 @@ oop.inherits(NRJavaScriptWorker, Mirror);
continue;
var raw = error.raw;
var type = "warning";
var line = error.line - 2;
if (raw == "Missing semicolon.") {
var str = error.evidence.substr(error.character);
@@ -177,62 +166,9 @@ oop.inherits(NRJavaScriptWorker, Mirror);
type = "info";
}
if (raw === "Unmatched '{a}'." && line === -1) {
// This is an unmatched { error. It has incorrectly matched it
// against the { in the added line. Need to find the next valid {
// This code scans through the original code looking for the first '{'
// that is not in a comment or string.
// It will incorrectly find a '{' if it is inside a regex... but
// at least the error will be shown somwhere. There are only
// so many hours in the day to fix every tiny edge case of an
// edge case.
var inSingleComment = false;
var inMultiComment = false;
var inString = false;
var stringQ;
var lineNumber = 0;
for (var pos = 0;pos<originalValue.length;pos++) {
var c = originalValue[pos];
if (c === "\\") {
pos++;
} else if (inSingleComment) {
if (c === "\n") {
lineNumber++;
inSingleComment = false;
}
} else if (inMultiComment) {
if (c === "*" && originalValue[pos+1] === "/") {
pos++;
inMultiComment = false;
} else if (c === "\n") {
lineNumber++;
}
} else if (inString) {
if (c === stringQ) {
inString = false;
}
} else if (c === "'" || c === "\"") {
inString = true;
stringQ = c;
} else if (c === "/") {
if (originalValue[pos+1] === "/") {
inSingleComment = true;
} else if (originalValue[pos+1] === "*") {
inMultiComment = true;
}
} else if (c === "\n") {
lineNumber++;
} else if (c === "{") {
// found it!
break;
}
}
line = lineNumber;
}
errors.push({
// [Node-RED] offset the row for the added line
row: Math.max(0,line),
row: error.line-2,
column: error.character-1,
text: error.reason,
type: type,

View File

@@ -808,7 +808,17 @@ RED.nodes.fontAwesome = (function() {
"fa-youtube": "\uf167",
};
var iconList = Object.keys(iconMap);
var iconList = [];
var isUsed = {};
Object.keys(iconMap).forEach(function(icon) {
var unicode = iconMap[icon];
// skip icons with a same unicode
if (isUsed[unicode] !== true) {
iconList.push(icon);
isUsed[unicode] = true;
}
});
isUsed = undefined;
return {
getIconUnicode: function(name) {

View File

@@ -37,38 +37,22 @@ RED.history = (function() {
inverseEv.events.push(r);
}
} else if (ev.t == 'replace') {
if (ev.complete) {
// This is a replace of everything. We can short-cut
// the logic by clearing everyting first, then importing
// the ev.config.
// Used by RED.diff.mergeDiff
inverseEv = {
t: 'replace',
config: RED.nodes.createCompleteNodeSet(),
changed: {},
rev: RED.nodes.version()
};
RED.nodes.clear();
var imported = RED.nodes.import(ev.config);
imported.nodes.forEach(function(n) {
if (ev.changed[n.id]) {
n.changed = true;
inverseEv.changed[n.id] = true;
}
})
RED.nodes.version(ev.rev);
} else {
var importMap = {};
ev.config.forEach(function(n) {
importMap[n.id] = "replace";
})
var importedResult = RED.nodes.import(ev.config,{importMap: importMap})
inverseEv = {
t: 'replace',
config: importedResult.removedNodes
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",
@@ -101,7 +85,7 @@ RED.history = (function() {
}
if (ev.groups) {
inverseEv.groups = [];
for (i = ev.groups.length - 1;i>=0;i--) {
for (i=0;i<ev.groups.length;i++) {
group = ev.groups[i];
modifiedTabs[group.z] = true;
// The order of groups is important
@@ -230,7 +214,7 @@ RED.history = (function() {
inverseEv.groups = [];
var groupsToAdd = {};
ev.groups.forEach(function(g) { groupsToAdd[g.id] = g; });
for (i = ev.groups.length - 1;i>=0;i--) {
for (i=0;i<ev.groups.length;i++) {
RED.nodes.addGroup(ev.groups[i])
modifiedTabs[ev.groups[i].z] = true;
// The order of groups is important
@@ -343,29 +327,17 @@ RED.history = (function() {
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 property is a reference to another node or nodes.
var nodeList = ev.node[i];
if (!Array.isArray(nodeList)) {
nodeList = [nodeList];
// This is a config node property
var currentConfigNode = RED.nodes.node(ev.node[i]);
if (currentConfigNode) {
currentConfigNode.users.splice(currentConfigNode.users.indexOf(ev.node),1);
RED.events.emit("nodes:change",currentConfigNode);
}
nodeList.forEach(function(id) {
var currentConfigNode = RED.nodes.node(id);
if (currentConfigNode && currentConfigNode._def.category === "config") {
currentConfigNode.users.splice(currentConfigNode.users.indexOf(ev.node),1);
RED.events.emit("nodes:change",currentConfigNode);
}
});
nodeList = ev.changes[i];
if (!Array.isArray(nodeList)) {
nodeList = [nodeList];
var newConfigNode = RED.nodes.node(ev.changes[i]);
if (newConfigNode) {
newConfigNode.users.push(ev.node);
RED.events.emit("nodes:change",newConfigNode);
}
nodeList.forEach(function(id) {
var newConfigNode = RED.nodes.node(id);
if (newConfigNode && newConfigNode._def.category === "config") {
newConfigNode.users.push(ev.node);
RED.events.emit("nodes:change",newConfigNode);
}
});
}
ev.node[i] = ev.changes[i];
}

View File

@@ -108,31 +108,6 @@ RED.i18n = (function() {
}
});
})
},
loadPluginCatalogs: function(done) {
var languageList = i18n.functions.toLanguages(localStorage.getItem("editor-language")||i18n.detectLanguage());
var toLoad = languageList.length;
languageList.forEach(function(lang) {
$.ajax({
headers: {
"Accept":"application/json"
},
cache: false,
url: apiRootUrl+'plugins/messages?lng='+lang,
success: function(data) {
var namespaces = Object.keys(data);
namespaces.forEach(function(ns) {
i18n.addResourceBundle(lang,ns,data[ns]);
});
toLoad--;
if (toLoad === 0) {
done();
}
}
});
})
}
}
})();

View File

@@ -3,14 +3,13 @@
"alt-shift-p":"core:manage-palette",
"ctrl-f": "core:search",
"ctrl-shift-f": "core:list-flows",
"ctrl-+": "core:zoom-in",
"ctrl-=": "core:zoom-in",
"ctrl--": "core:zoom-out",
"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 h": "core:show-help-tab",
"ctrl-g d": "core:show-debug-tab",
"ctrl-g c": "core:show-config-tab",
"ctrl-g x": "core:show-context-tab",
@@ -44,9 +43,6 @@
"ctrl-z": "core:undo",
"ctrl-y": "core:redo",
"ctrl-a": "core:select-all-nodes",
"alt-s u": "core:select-upstream-nodes",
"alt-s d": "core:select-downstream-nodes",
"alt-s c": "core:select-connected-nodes",
"shift-?": "core:show-help",
"w": "core:scroll-view-up",
"d": "core:scroll-view-right",

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
RED.plugins = (function() {
var plugins = {};
var pluginsByType = {};
function registerPlugin(id,definition) {
plugins[id] = definition;
if (definition.type) {
pluginsByType[definition.type] = pluginsByType[definition.type] || [];
pluginsByType[definition.type].push(definition);
}
if (RED._loadingModule) {
definition.module = RED._loadingModule;
definition["_"] = function() {
var args = Array.prototype.slice.call(arguments);
var originalKey = args[0];
if (!/:/.test(args[0])) {
args[0] = definition.module+":"+args[0];
}
var result = RED._.apply(null,args);
if (result === args[0]) {
return originalKey;
}
return result;
}
} else {
definition["_"] = RED["_"]
}
if (definition.onadd && typeof definition.onadd === 'function') {
definition.onadd();
}
RED.events.emit("registry:plugin-added",id);
}
function getPlugin(id) {
return plugins[id]
}
function getPluginsByType(type) {
return pluginsByType[type] || [];
}
return {
registerPlugin: registerPlugin,
getPlugin: getPlugin,
getPluginsByType: getPluginsByType
}
})();

View File

@@ -37,20 +37,5 @@
}
return result;
}
if (new Set([0]).size === 0) {
// IE does not support passing an iterable to Set constructor
var _Set = Set;
/*global Set:true */
Set = function Set(iterable) {
var set = new _Set();
if (iterable) {
iterable.forEach(set.add, set);
}
return set;
};
Set.prototype = _Set.prototype;
Set.prototype.constructor = Set;
}
}
})();

View File

@@ -15,65 +15,19 @@
**/
var RED = (function() {
function loadPluginList() {
loader.reportProgress(RED._("event.loadPlugins"), 10)
$.ajax({
headers: {
"Accept":"application/json"
},
cache: false,
url: 'plugins',
success: function(data) {
loader.reportProgress(RED._("event.loadPlugins"), 13)
RED.i18n.loadPluginCatalogs(function() {
loadPlugins(function() {
loadNodeList();
});
});
}
});
}
function loadPlugins(done) {
loader.reportProgress(RED._("event.loadPlugins",{count:""}), 17)
var lang = localStorage.getItem("editor-language")||i18n.detectLanguage();
$.ajax({
headers: {
"Accept":"text/html",
"Accept-Language": lang
},
cache: false,
url: 'plugins',
success: function(data) {
var configs = data.trim().split(/(?=<!-- --- \[red-plugin:\S+\] --- -->)/);
var totalCount = configs.length;
var stepConfig = function() {
// loader.reportProgress(RED._("event.loadNodes",{count:(totalCount-configs.length)+"/"+totalCount}), 30 + ((totalCount-configs.length)/totalCount)*40 )
if (configs.length === 0) {
done();
} else {
var config = configs.shift();
appendPluginConfig(config,stepConfig);
}
}
stepConfig();
}
});
}
function appendConfig(config, moduleIdMatch, targetContainer, done) {
function appendNodeConfig(nodeConfig,done) {
done = done || function(){};
var m = /<!-- --- \[red-module:(\S+)\] --- -->/.exec(nodeConfig.trim());
var moduleId;
if (moduleIdMatch) {
moduleId = moduleIdMatch[1];
RED._loadingModule = moduleId;
if (m) {
moduleId = m[1];
} else {
moduleId = "unknown";
}
try {
var hasDeferred = false;
var nodeConfigEls = $("<div>"+config+"</div>");
var nodeConfigEls = $("<div>"+nodeConfig+"</div>");
var scripts = nodeConfigEls.find("script");
var scriptCount = scripts.length;
scripts.each(function(i,el) {
@@ -84,15 +38,14 @@ var RED = (function() {
newScript.onload = function() {
scriptCount--;
if (scriptCount === 0) {
$(targetContainer).append(nodeConfigEls);
delete RED._loadingModule;
$("#red-ui-editor-node-configs").append(nodeConfigEls);
done()
}
}
if ($(el).attr('type') === "module") {
newScript.type = "module";
}
$(targetContainer).append(newScript);
$("#red-ui-editor-node-configs").append(newScript);
newScript.src = RED.settings.apiRootUrl+srcUrl;
hasDeferred = true;
} else {
@@ -108,8 +61,7 @@ var RED = (function() {
}
})
if (!hasDeferred) {
$(targetContainer).append(nodeConfigEls);
delete RED._loadingModule;
$("#red-ui-editor-node-configs").append(nodeConfigEls);
done();
}
} catch(err) {
@@ -118,27 +70,9 @@ var RED = (function() {
timeout: 10000
});
console.log("["+moduleId+"] "+err.toString());
delete RED._loadingModule;
done();
}
}
function appendPluginConfig(pluginConfig,done) {
appendConfig(
pluginConfig,
/<!-- --- \[red-plugin:(\S+)\] --- -->/.exec(pluginConfig.trim()),
"#red-ui-editor-plugin-configs",
done
);
}
function appendNodeConfig(nodeConfig,done) {
appendConfig(
nodeConfig,
/<!-- --- \[red-module:(\S+)\] --- -->/.exec(nodeConfig.trim()),
"#red-ui-editor-node-configs",
done
);
}
function loadNodeList() {
loader.reportProgress(RED._("event.loadPalette"), 20)
@@ -244,22 +178,11 @@ var RED = (function() {
var currentHash = window.location.hash;
RED.nodes.version(nodes.rev);
loader.reportProgress(RED._("event.importFlows"),90 )
try {
RED.nodes.import(nodes.flows);
RED.nodes.dirty(false);
RED.view.redraw(true);
if (/^#flow\/.+$/.test(currentHash)) {
RED.workspaces.show(currentHash.substring(6));
}
} catch(err) {
console.warn(err);
RED.notify(
RED._("event.importError", {message: err.message}),
{
fixed: true,
type: 'error'
}
);
RED.nodes.import(nodes.flows);
RED.nodes.dirty(false);
RED.view.redraw(true);
if (/^#flow\/.+$/.test(currentHash)) {
RED.workspaces.show(currentHash.substring(6));
}
}
done();
@@ -298,7 +221,7 @@ var RED = (function() {
"merge-complete": RED._("notification.project.merge-complete")
}[msg.action];
loader.end()
RED.notify($("<p>").text(message));
RED.notify("<p>"+message+"</p>");
RED.sidebar.info.refresh()
});
});
@@ -315,7 +238,6 @@ var RED = (function() {
id: notificationId
}
if (notificationId === "runtime-state") {
RED.events.emit("runtime-state",msg);
if (msg.error === "safe-mode") {
options.buttons = [
{
@@ -337,7 +259,7 @@ var RED = (function() {
}
}
]
// } else if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
// } else if (RED.settings.theme('palette.editable') !== false) {
} else {
options.buttons = [
{
@@ -348,16 +270,6 @@ var RED = (function() {
}
]
}
} else if (msg.error === "missing-modules") {
text+="<ul><li>"+msg.modules.map(function(m) { return RED.utils.sanitize(m.module)+(m.error?(" - <small>"+RED.utils.sanitize(""+m.error)+"</small>"):"")}).join("</li><li>")+"</li></ul>";
options.buttons = [
{
text: RED._("common.label.close"),
click: function() {
persistentNotifications[notificationId].hideNotification();
}
}
]
} else if (msg.error === "credentials_load_failed") {
if (RED.settings.theme("projects.enabled",false)) {
// projects enabled
@@ -448,9 +360,6 @@ var RED = (function() {
} else if (persistentNotifications.hasOwnProperty(notificationId)) {
persistentNotifications[notificationId].close();
delete persistentNotifications[notificationId];
if (notificationId === 'runtime-state') {
RED.events.emit("runtime-state",msg);
}
}
});
RED.comms.subscribe("status/#",function(topic,msg) {
@@ -463,7 +372,7 @@ var RED = (function() {
node.status = msg;
node.dirtyStatus = true;
node.dirty = true;
RED.view.redrawStatus(node);
RED.view.redraw();
}
});
RED.comms.subscribe("notification/node/#",function(topic,msg) {
@@ -483,7 +392,7 @@ var RED = (function() {
});
});
if (addedTypes.length) {
typeList = "<ul><li>"+addedTypes.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success");
}
loadIconList();
@@ -492,7 +401,7 @@ var RED = (function() {
m = msg[i];
info = RED.nodes.removeNodeSet(m.id);
if (info.added) {
typeList = "<ul><li>"+m.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
}
}
@@ -502,12 +411,12 @@ var RED = (function() {
info = RED.nodes.getNodeSet(msg.id);
if (info.added) {
RED.nodes.enableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success");
} else {
$.get('nodes/'+msg.id, function(data) {
appendNodeConfig(data);
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
});
}
@@ -515,7 +424,7 @@ var RED = (function() {
} else if (topic == "notification/node/disabled") {
if (msg.types) {
RED.nodes.disableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
}
} else if (topic == "notification/node/upgraded") {
@@ -530,9 +439,6 @@ var RED = (function() {
$(".red-ui-header-toolbar").show();
RED.sidebar.show(":first");
setTimeout(function() {
loader.end();
},100);
@@ -593,7 +499,7 @@ var RED = (function() {
]});
menuOptions.push(null);
if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
if (RED.settings.theme('palette.editable') !== false) {
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
menuOptions.push(null);
}
@@ -628,7 +534,7 @@ var RED = (function() {
RED.palette.init();
RED.eventLog.init();
if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
if (RED.settings.theme('palette.editable') !== false) {
RED.palette.editor.init();
} else {
console.log("Palette editor disabled");
@@ -663,7 +569,7 @@ var RED = (function() {
RED.actions.add("core:show-about", showAbout);
loadPluginList();
loadNodeList();
}
@@ -679,7 +585,6 @@ var RED = (function() {
'<div id="red-ui-sidebar"></div>'+
'<div id="red-ui-sidebar-separator"></div>'+
'</div>').appendTo(options.target);
$('<div id="red-ui-editor-plugin-configs"></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);
@@ -698,12 +603,9 @@ var RED = (function() {
$('<span>').html(theme.header.title).appendTo(logo);
}
}
if (theme.themes) {
knownThemes = theme.themes;
}
});
}
var knownThemes = null;
var initialised = false;
function init(options) {
@@ -723,13 +625,7 @@ var RED = (function() {
buildEditor(options);
RED.i18n.init(options, function() {
RED.settings.init(options, function() {
if (knownThemes) {
RED.settings.editorTheme = RED.settings.editorTheme || {};
RED.settings.editorTheme.themes = knownThemes;
}
loadEditor();
});
RED.settings.init(options, loadEditor);
})
}

View File

@@ -57,11 +57,12 @@ RED.settings = (function () {
return JSON.parse(localStorage.getItem(key));
} else {
var v;
try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {}
if (v === undefined) {
try { v = RED.utils.getMessageProperty(RED.settings,key); } catch(err) {}
}
if (v === undefined) {
try {
v = RED.utils.getMessageProperty(userSettings,key);
if (v === undefined) {
v = defaultIfUndefined;
}
} catch(err) {
v = defaultIfUndefined;
}
return v;

View File

@@ -21,18 +21,7 @@ RED.actions = (function() {
var result = [];
Object.keys(actions).forEach(function(action) {
var shortcut = RED.keyboard.getShortcut(action);
var isUser = false;
if (shortcut) {
isUser = shortcut.user;
} else {
isUser = !!RED.keyboard.getUserShortcut(action);
}
result.push({
id:action,
scope:shortcut?shortcut.scope:undefined,
key:shortcut?shortcut.key:undefined,
user:isUser
})
result.push({id:action,scope:shortcut?shortcut.scope:undefined,key:shortcut?shortcut.key:undefined,user:shortcut?shortcut.user:undefined})
})
return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,26 +27,26 @@
this.partialFlag = false;
this.stateValue = 0;
var initialState = this.element.prop('checked');
this.states = [
this.options = [
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-square-o"></i></span>').appendTo(this.uiElement),
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-check-square-o"></i></span>').appendTo(this.uiElement),
$('<span class="red-ui-checkboxSet-option hide"><i class="fa fa-minus-square-o"></i></span>').appendTo(this.uiElement)
];
if (initialState) {
this.states[1].show();
this.options[1].show();
} else {
this.states[0].show();
this.options[0].show();
}
this.element.on("change", function() {
if (this.checked) {
that.states[0].hide();
that.states[1].show();
that.states[2].hide();
that.options[0].hide();
that.options[1].show();
that.options[2].hide();
} else {
that.states[1].hide();
that.states[0].show();
that.states[2].hide();
that.options[1].hide();
that.options[0].show();
that.options[2].hide();
}
var isChecked = this.checked;
that.children.forEach(function(child) {
@@ -106,17 +106,17 @@
var trueState = this.partialFlag||state;
this.element.prop('checked',trueState);
if (state === true) {
this.states[0].hide();
this.states[1].show();
this.states[2].hide();
this.options[0].hide();
this.options[1].show();
this.options[2].hide();
} else if (state === false) {
this.states[2].hide();
this.states[1].hide();
this.states[0].show();
this.options[2].hide();
this.options[1].hide();
this.options[0].show();
} else if (state === null) {
this.states[0].hide();
this.states[1].hide();
this.states[2].show();
this.options[0].hide();
this.options[1].hide();
this.options[2].show();
}
if (!suppressEvent) {
this.element.trigger('change',null);

View File

@@ -73,7 +73,7 @@ RED.colorPicker = (function() {
type:"text",
value:colorHiddenInput.val()
}).appendTo(row);
var focusTarget = colorInput;
colorInput.on("change", function (e) {
var color = colorInput.val();
colorHiddenInput.val(color).trigger('change');
@@ -188,14 +188,8 @@ RED.colorPicker = (function() {
refreshDisplay(colorHiddenInput.val())
},50);
colorPanel.show({
target: colorButton,
onclose: function() {
colorButton.focus();
}
target: colorButton
})
if (focusTarget) {
focusTarget.focus();
}
});
setTimeout(function() {
refreshDisplay(colorHiddenInput.val())

View File

@@ -18,7 +18,6 @@
/**
* options:
* - addButton : boolean|string - text for add label, default 'add'
* - buttons : array - list of custom buttons (objects with fields 'label', 'icon', 'title', 'click')
* - height : number|'auto'
* - resize : function - called when list as a whole is resized
* - resizeItem : function(item) - called to resize individual item
@@ -68,61 +67,30 @@
this.topContainer.addClass(this.options.class);
}
var buttons = this.options.buttons || [];
if (this.options.addButton !== false) {
var addLabel, addTittle;
var addLabel;
if (typeof this.options.addButton === 'string') {
addLabel = this.options.addButton
} else {
if (RED && RED._) {
addLabel = RED._("editableList.add");
addTitle = RED._("editableList.addTitle");
} else {
addLabel = 'add';
addTitle = 'add new item';
}
}
buttons.unshift({
label: addLabel,
icon: "fa fa-plus",
click: function(evt) {
that.addItem({});
},
title: addTitle
});
}
buttons.forEach(function(button) {
var element = $('<a href="#" class="red-ui-button red-ui-button-small red-ui-editableList-addButton" style="margin-top: 4px; margin-right: 5px;"></a>')
.appendTo(that.topContainer)
$('<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)
.on("click", function(evt) {
evt.preventDefault();
if (button.click !== undefined) {
button.click(evt);
}
that.addItem({});
});
if (button.title) {
element.attr("title", button.title);
}
if (button.icon) {
element.append($("<i></i>").attr("class", button.icon));
}
if (button.label) {
element.append($("<span></span>").text(" " + button.label));
}
});
}
if (this.element.css("position") === "absolute") {
["top","left","bottom","right"].forEach(function(s) {
var v = that.element.css(s);
if (v!=="auto" && v!=="") {
that.topContainer.css(s,v);
that.uiContainer.css(s,"0");
if (s === "top" && that.options.header) {
that.uiContainer.css(s,"20px")
}
that.element.css(s,'auto');
}
})

View File

@@ -84,7 +84,6 @@ RED.popover = (function() {
var targetHeight = target.outerHeight();
var divHeight = div.height();
var divWidth = div.width();
var paddingRight = 10;
var viewportTop = $(window).scrollTop();
var viewportLeft = $(window).scrollLeft();
@@ -106,7 +105,7 @@ RED.popover = (function() {
d = "right";
top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top;
left = targetPos.left+targetWidth+deltaSizes[size].leftRight;
} else if (left+divWidth+paddingRight > viewportRight) {
} else if (left+divWidth > viewportRight) {
d = "left";
top = targetPos.top+targetHeight/2-divHeight/2-deltaSizes[size].top;
left = targetPos.left-deltaSizes[size].leftLeft-divWidth;
@@ -367,7 +366,6 @@ RED.popover = (function() {
function hide(dispose) {
$(document).off("mousedown.red-ui-popover-panel-close");
$(document).off("keydown.red-ui-popover-panel-close");
panel.hide();
panel.css({
height: "auto"
@@ -409,16 +407,6 @@ RED.popover = (function() {
}
panel.slideDown(100);
$(document).on("keydown.red-ui-popover-panel-close", function(event) {
if (event.keyCode === 27) {
// ESCAPE
if (closeCallback) {
closeCallback();
}
hide(options.dispose);
}
});
$(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) {

View File

@@ -119,9 +119,6 @@
if (evt.keyCode === 27) {
that.element.val("");
}
if (evt.keyCode === 13) {
evt.preventDefault();
}
})
this.element.on("keyup",function(evt) {
that._change($(this).val());

View File

@@ -29,8 +29,7 @@ RED.tabs = (function() {
var currentTabWidth;
var currentActiveTabWidth = 0;
var collapsibleMenu;
var mousedownTab;
var preferredOrder = options.order;
var ul = options.element || $("#"+options.id);
var wrapper = ul.wrap( "<div>" ).parent();
var scrollContainer = ul.wrap( "<div>" ).parent();
@@ -133,11 +132,11 @@ RED.tabs = (function() {
activateTab(id);
}
};
// if (tabs[id].pinned) {
// pinnedOptions.push(opt);
// } else {
if (tabs[id].pinned) {
pinnedOptions.push(opt);
} else {
options.push(opt);
// }
}
});
options = pinnedOptions.concat(options);
collapsibleMenu = RED.menu.init({options: options});
@@ -208,11 +207,6 @@ RED.tabs = (function() {
if (dragActive) {
return
}
if (evt.currentTarget !== mousedownTab) {
mousedownTab = null;
return;
}
mousedownTab = null;
if (dblClickTime && Date.now()-dblClickTime < 400) {
dblClickTime = 0;
dblClickArmed = true;
@@ -369,39 +363,23 @@ RED.tabs = (function() {
var tabWidth;
if (options.collapsible) {
var availableCount = collapsedButtonsRow.children().length;
var visibleCount = collapsedButtonsRow.children(":visible").length;
tabWidth = width - collapsedButtonsRow.width()-10;
var maxTabWidth = 198;
var minTabWidth = 80;
if (tabWidth <= minTabWidth || (tabWidth < maxTabWidth && visibleCount > 5)) {
// The tab is too small. Hide the next button to make room
// Start at the end of the button row, -1 for the menu button
if (tabWidth < 198) {
var delta = 198 - tabWidth;
var b = collapsedButtonsRow.find("a:last").prev();
var index = collapsedButtonsRow.children().length - 2;
// Work backwards to find the first visible button
while (b.is(":not(:visible)")) {
b = b.prev();
index--;
}
// If it isn't a pinned button, hide it to get the room
if (tabWidth <= minTabWidth || visibleCount>6) {//}!b.hasClass("red-ui-tab-link-button-pinned")) {
if (!b.hasClass("red-ui-tab-link-button-pinned")) {
b.hide();
}
tabWidth = Math.max(minTabWidth,width - collapsedButtonsRow.width()-10);
tabWidth = width - collapsedButtonsRow.width()-10;
} else {
if (visibleCount !== availableCount) {
if (visibleCount < 6) {
tabWidth = minTabWidth;
} else {
tabWidth = maxTabWidth;
}
}
var space = width - tabWidth - collapsedButtonsRow.width();
var space = width - 198 - collapsedButtonsRow.width();
if (space > 40) {
collapsedButtonsRow.find("a:not(:visible):first").show();
tabWidth = width - collapsedButtonsRow.width()-10;
}
tabWidth = width - collapsedButtonsRow.width()-10;
}
tabs.css({width:tabWidth});
@@ -451,7 +429,6 @@ RED.tabs = (function() {
}
ul.find("li.red-ui-tab a")
.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
.on("mouseup",onTabClick)
.on("click", function(evt) {evt.preventDefault(); })
.on("dblclick", function(evt) {evt.stopPropagation(); evt.preventDefault(); })
@@ -492,7 +469,7 @@ RED.tabs = (function() {
}
}
var tabAPI = {
return {
addTab: function(tab,targetIndex) {
if (options.onselect) {
var selection = ul.find("li.red-ui-tab.selected");
@@ -516,8 +493,8 @@ RED.tabs = (function() {
li.attr('id',"red-ui-tab-"+(tab.id.replace(".","-")));
li.data("tabId",tab.id);
if (options.maximumTabWidth || tab.maximumTabWidth) {
li.css("maxWidth",(options.maximumTabWidth || tab.maximumTabWidth) +"px");
if (options.maximumTabWidth) {
li.css("maxWidth",options.maximumTabWidth+"px");
}
var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li);
if (tab.icon) {
@@ -554,96 +531,13 @@ RED.tabs = (function() {
evt.preventDefault();
activateTab(tab.id);
});
pinnedLink.data("tabId",tab.id)
if (tab.pinned) {
pinnedLink.addClass("red-ui-tab-link-button-pinned");
pinnedTabsCount++;
}
RED.popover.tooltip($(pinnedLink), tab.name, tab.action);
if (options.onreorder) {
var pinnedLinkIndex;
var pinnedLinks = [];
var startPinnedIndex;
pinnedLink.draggable({
distance: 10,
axis:"x",
containment: ".red-ui-tab-link-buttons",
start: function(event,ui) {
dragActive = true;
$(".red-ui-tab-link-buttons").width($(".red-ui-tab-link-buttons").width());
if (dblClickArmed) { dblClickArmed = false; return false }
collapsedButtonsRow.children().each(function(i) {
pinnedLinks[i] = {
el:$(this),
text: $(this).text(),
left: $(this).position().left,
width: $(this).width(),
menu: $(this).hasClass("red-ui-tab-link-button-menu")
};
if ($(this).is(pinnedLink)) {
pinnedLinkIndex = i;
startPinnedIndex = i;
}
});
collapsedButtonsRow.children().each(function(i) {
if (i!==pinnedLinkIndex) {
$(this).css({
position: 'absolute',
left: pinnedLinks[i].left+"px",
width: pinnedLinks[i].width+2,
transition: "left 0.3s"
});
}
})
if (!pinnedLink.hasClass('active')) {
pinnedLink.css({'zIndex':1});
}
},
drag: function(event,ui) {
ui.position.left += pinnedLinks[pinnedLinkIndex].left;
var tabCenter = ui.position.left + pinnedLinks[pinnedLinkIndex].width/2;
for (var i=0;i<pinnedLinks.length;i++) {
if (i === pinnedLinkIndex || pinnedLinks[i].menu || pinnedLinks[i].el.is(":not(:visible)")) {
continue;
}
if (tabCenter > pinnedLinks[i].left && tabCenter < pinnedLinks[i].left+pinnedLinks[i].width) {
if (i < pinnedLinkIndex) {
pinnedLinks[i].left += pinnedLinks[pinnedLinkIndex].width+8;
pinnedLinks[pinnedLinkIndex].el.detach().insertBefore(pinnedLinks[i].el);
} else {
pinnedLinks[i].left -= pinnedLinks[pinnedLinkIndex].width+8;
pinnedLinks[pinnedLinkIndex].el.detach().insertAfter(pinnedLinks[i].el);
}
pinnedLinks[i].el.css({left:pinnedLinks[i].left+"px"});
pinnedLinks.splice(i, 0, pinnedLinks.splice(pinnedLinkIndex, 1)[0]);
pinnedLinkIndex = i;
break;
}
}
},
stop: function(event,ui) {
dragActive = false;
collapsedButtonsRow.children().css({position:"relative",left:"",transition:""});
$(".red-ui-tab-link-buttons").width('auto');
pinnedLink.css({zIndex:""});
updateTabWidths();
if (startPinnedIndex !== pinnedLinkIndex) {
if (collapsibleMenu) {
collapsibleMenu.remove();
collapsibleMenu = null;
}
var newOrder = $.makeArray(collapsedButtonsRow.children().map(function() { return $(this).data('tabId');}));
tabAPI.order(newOrder);
options.onreorder(newOrder);
}
}
});
}
}
link.on("mousedown", function(evt) { mousedownTab = evt.currentTarget })
link.on("mouseup",onTabClick);
link.on("click", function(evt) { evt.preventDefault(); })
link.on("dblclick", function(evt) { evt.stopPropagation(); evt.preventDefault(); })
@@ -671,7 +565,7 @@ RED.tabs = (function() {
if (ul.find("li.red-ui-tab").length == 1) {
activateTab(link);
}
if (options.onreorder && !options.collapsible) {
if (options.onreorder) {
var originalTabOrder;
var tabDragIndex;
var tabElements = [];
@@ -758,9 +652,6 @@ RED.tabs = (function() {
collapsibleMenu.remove();
collapsibleMenu = null;
}
if (preferredOrder) {
tabAPI.order(preferredOrder);
}
},
removeTab: removeTab,
activateTab: activateTab,
@@ -782,8 +673,10 @@ RED.tabs = (function() {
},
selection: getSelection,
order: function(order) {
preferredOrder = order;
var existingTabOrder = $.makeArray(ul.children().map(function() { return $(this).data('tabId');}));
if (existingTabOrder.length !== order.length) {
return
}
var i;
var match = true;
for (i=0;i<order.length;i++) {
@@ -799,41 +692,12 @@ RED.tabs = (function() {
var existingTabs = ul.children().detach().each(function() {
existingTabMap[$(this).data("tabId")] = $(this);
});
var pinnedButtons = {};
if (options.collapsible) {
collapsedButtonsRow.children().detach().each(function() {
var id = $(this).data("tabId");
if (!id) {
id = "__menu__"
}
pinnedButtons[id] = $(this);
});
}
for (i=0;i<order.length;i++) {
if (existingTabMap[order[i]]) {
existingTabMap[order[i]].appendTo(ul);
if (options.collapsible) {
pinnedButtons[order[i]].appendTo(collapsedButtonsRow);
}
delete existingTabMap[order[i]];
}
}
// Add any tabs that aren't known in the order
for (i in existingTabMap) {
if (existingTabMap.hasOwnProperty(i)) {
existingTabMap[i].appendTo(ul);
if (options.collapsible) {
pinnedButtons[i].appendTo(collapsedButtonsRow);
}
}
}
if (options.collapsible) {
pinnedButtons["__menu__"].appendTo(collapsedButtonsRow);
updateTabWidths();
existingTabMap[order[i]].appendTo(ul);
}
}
}
return tabAPI;
}
return {

View File

@@ -37,8 +37,8 @@
invertState = this.options.invertState;
}
var baseClass = this.options.baseClass || "red-ui-button";
var enabledIcon = this.options.hasOwnProperty('enabledIcon')?this.options.enabledIcon : "fa-check-square-o";
var disabledIcon = this.options.hasOwnProperty('disabledIcon')?this.options.disabledIcon : "fa-square-o";
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");
@@ -46,41 +46,25 @@
this.element.on("focus", function() {
that.button.focus();
});
this.button = $('<button type="button" class="red-ui-toggleButton '+baseClass+' toggle single"></button>');
if (enabledLabel || disabledLabel) {
this.buttonLabel = $("<span>").appendTo(this.button);
}
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);
if (enabledIcon && disabledIcon) {
this.buttonIcon = $('<i class="fa"></i>').prependTo(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");
if (this.buttonIcon) {
this.buttonIcon.addClass(enabledIcon);
}
if (this.buttonLabel) {
this.buttonLabel.text(enabledLabel);
}
this.buttonIcon.addClass(enabledIcon);
this.buttonLabel.text(enabledLabel);
var width = this.button.width();
this.button.removeClass("selected");
if (this.buttonIcon) {
this.buttonIcon.removeClass(enabledIcon);
that.buttonIcon.addClass(disabledIcon);
}
if (this.buttonLabel) {
that.buttonLabel.text(disabledLabel);
}
this.buttonIcon.removeClass(enabledIcon);
that.buttonIcon.addClass(disabledIcon);
that.buttonLabel.text(disabledLabel);
width = Math.max(width,this.button.width());
if (this.buttonIcon) {
this.buttonIcon.removeClass(disabledIcon);
}
this.buttonIcon.removeClass(disabledIcon);
// Fix the width of the button so it doesn't jump around when toggled
if (width > 0) {
@@ -89,7 +73,7 @@
this.button.on("click",function(e) {
e.stopPropagation();
if (!that.state) {
if (that.buttonIcon.hasClass(disabledIcon)) {
that.element.prop("checked",!invertState);
} else {
that.element.prop("checked",invertState);
@@ -100,24 +84,14 @@
this.element.on("change", function(e) {
if ($(this).prop("checked") !== invertState) {
that.button.addClass("selected");
that.state = true;
if (that.buttonIcon) {
that.buttonIcon.addClass(enabledIcon);
that.buttonIcon.removeClass(disabledIcon);
}
if (that.buttonLabel) {
that.buttonLabel.text(enabledLabel);
}
that.buttonIcon.addClass(enabledIcon);
that.buttonIcon.removeClass(disabledIcon);
that.buttonLabel.text(enabledLabel);
} else {
that.button.removeClass("selected");
that.state = false;
if (that.buttonIcon) {
that.buttonIcon.addClass(disabledIcon);
that.buttonIcon.removeClass(enabledIcon);
}
if (that.buttonLabel) {
that.buttonLabel.text(disabledLabel);
}
that.buttonIcon.addClass(disabledIcon);
that.buttonIcon.removeClass(enabledIcon);
that.buttonLabel.text(disabledLabel);
}
})
this.element.trigger("change");

View File

@@ -167,7 +167,7 @@
this._selected = new Set();
this._topList = $('<ol class="red-ui-treeList-list">').css({
position:'absolute',
top:0,
top: 0,
left:0,
right:0,
bottom:0
@@ -181,9 +181,6 @@
that._addSubtree(that._topList,container,item,0);
}
};
if (this.options.header) {
topListOptions.header = this.options.header;
}
if (this.options.rootSortable !== false && !!this.options.sortable) {
topListOptions.sortable = this.options.sortable;
topListOptions.connectWith = '.red-ui-treeList-sortable';

View File

@@ -173,7 +173,6 @@
valueLabel: function(container,value) {
var that = this;
container.css("pointer-events","none");
container.css("flex-grow",0);
this.elementDiv.hide();
var buttons = $('<div>').css({
position: "absolute",
@@ -185,25 +184,22 @@
width:"20px"
}).appendTo(buttons).on("click", function(evt) {
evt.preventDefault();
var cursorPosition = that.input[0].selectionStart;
var currentType = that.input.attr("type");
if (currentType === "text") {
that.input.attr("type","password");
eyeCon.removeClass("fa-eye-slash").addClass("fa-eye");
setTimeout(function() {
that.input.focus();
that.input[0].setSelectionRange(cursorPosition, cursorPosition);
},50);
} else {
that.input.attr("type","text");
eyeCon.removeClass("fa-eye").addClass("fa-eye-slash");
setTimeout(function() {
that.input.focus();
that.input[0].setSelectionRange(cursorPosition, cursorPosition);
},50);
}
}).hide();
var eyeCon = $('<i class="fa fa-eye"></i>').css("margin-left","-2px").appendTo(eyeButton);
var eyeCon = $('<i class="fa fa-eye"></i>').css("margin-left","-1px").appendTo(eyeButton);
if (value === "__PWRD__") {
var innerContainer = $('<div><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i><i class="fa fa-asterisk"></i></div>').css({
@@ -288,7 +284,7 @@
this.input.css('width','100%');
this.uiSelect.width(m[1]);
this.uiWidth = null;
} else if (this.uiWidth !== 0){
} else {
this.uiSelect.width(this.uiWidth);
}
["Right","Left"].forEach(function(d) {
@@ -308,11 +304,7 @@
this.element.attr('type','hidden');
if (!this.options.types && this.options.type) {
this.options.types = [this.options.type]
} else {
this.options.types = this.options.types||Object.keys(allOptions);
}
this.options.types = this.options.types||Object.keys(allOptions);
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);
@@ -342,17 +334,7 @@
this.input.on('change', function() {
that.validate();
that.element.val(that.value());
that.element.trigger('change',[that.propertyType,that.value()]);
});
this.input.on('keyup', function(evt) {
that.validate();
that.element.val(that.value());
that.element.trigger('keyup',evt);
});
this.input.on('paste', function(evt) {
that.validate();
that.element.val(that.value());
that.element.trigger('paste',evt);
that.element.trigger('change',that.propertyType,that.value());
});
this.input.on('keydown', function(evt) {
if (evt.keyCode >= 37 && evt.keyCode <= 40) {
@@ -616,7 +598,7 @@
}
if (opt.hasValue) {
this.optionValue = o.value;
this.input.trigger('change',[this.propertyType,this.value()]);
this.input.trigger('change',this.propertyType,this.value());
}
} else {
this.optionSelectLabel.text(o.length+" selected");
@@ -709,7 +691,7 @@
opt.valueLabel.call(this,this.valueLabelContainer,value);
}
}
this.input.trigger('change',[this.type(),value]);
this.input.trigger('change',this.type(),value);
}
},
type: function(type) {
@@ -874,7 +856,7 @@
});
}
this._trigger("typechange",null,this.propertyType);
this.input.trigger('change',[this.propertyType,this.value()]);
this.input.trigger('change',this.propertyType,this.value());
} else {
if (this.optionSelectTrigger) {
this.optionSelectTrigger.hide();
@@ -890,9 +872,6 @@
this.elementDiv.hide();
this.valueLabelContainer.hide();
} else if (opt.valueLabel) {
// Reset any CSS the custom label may have set
this.valueLabelContainer.css("pointer-events","");
this.valueLabelContainer.css("flex-grow",1);
this.valueLabelContainer.show();
this.valueLabelContainer.empty();
this.elementDiv.hide();
@@ -944,7 +923,7 @@
}
}
this._trigger("typechange",null,this.propertyType);
this.input.trigger('change',[this.propertyType,this.value()]);
this.input.trigger('change',this.propertyType,this.value());
}
}
}
@@ -975,18 +954,6 @@
},
hide: function() {
this.uiSelect.hide();
},
disable: function(val) {
if(val === true) {
this.uiSelect.attr("disabled", "disabled");
} else if (val === false) {
this.uiSelect.attr("disabled", null); //remove attr
} else {
this.uiSelect.attr("disabled", val); //user value
}
},
disabled: function() {
return this.uiSelect.attr("disabled");
}
});
})(jQuery);

View File

@@ -1411,7 +1411,7 @@ RED.diff = (function() {
// Restore the original flow so subsequent merge resolutions can properly
// identify new-vs-old
RED.nodes.originalFlow(originalFlow);
imported.nodes.forEach(function(n) {
imported[0].forEach(function(n) {
if (nodeChangedStates[n.id] || localChangedStates[n.id]) {
n.changed = true;
}

View File

@@ -356,14 +356,14 @@ RED.editor = (function() {
function attachPropertyChangeHandler(node,definition,property,prefix) {
var input = $("#"+prefix+"-"+property);
if (definition !== undefined && "format" in definition[property] && definition[property].format !== "" && input[0].nodeName === "DIV") {
$("#"+prefix+"-"+property).on('change keyup', function(event) {
if (!$(this).attr("skipValidation")) {
$("#"+prefix+"-"+property).on('change keyup', function(event,skipValidation) {
if (!skipValidation) {
validateNodeEditor(node,prefix);
}
});
} else {
$("#"+prefix+"-"+property).on("change", function(event) {
if (!$(this).attr("skipValidation")) {
$("#"+prefix+"-"+property).on("change", function(event,skipValidation) {
if (!skipValidation) {
validateNodeEditor(node,prefix);
}
});
@@ -414,20 +414,18 @@ RED.editor = (function() {
for (var cred in credDefinition) {
if (credDefinition.hasOwnProperty(cred)) {
var input = $("#" + prefix + '-' + cred);
if (input.length > 0) {
var value = input.val();
if (credDefinition[cred].type == 'password') {
node.credentials['has_' + cred] = (value !== "");
if (value == '__PWRD__') {
continue;
}
changed = true;
var value = input.val();
if (credDefinition[cred].type == 'password') {
node.credentials['has_' + cred] = (value !== "");
if (value == '__PWRD__') {
continue;
}
changed = true;
}
node.credentials[cred] = value;
if (value != node.credentials._[cred]) {
changed = true;
}
}
node.credentials[cred] = value;
if (value != node.credentials._[cred]) {
changed = true;
}
}
}
@@ -444,18 +442,16 @@ RED.editor = (function() {
for (var d in definition.defaults) {
if (definition.defaults.hasOwnProperty(d)) {
if (definition.defaults[d].type) {
if (!definition.defaults[d]._type.array) {
var configTypeDef = RED.nodes.getType(definition.defaults[d].type);
if (configTypeDef && configTypeDef.category === 'config') {
if (configTypeDef.exclusive) {
prepareConfigNodeButton(node,d,definition.defaults[d].type,prefix);
} else {
prepareConfigNodeSelect(node,d,definition.defaults[d].type,prefix);
}
var configTypeDef = RED.nodes.getType(definition.defaults[d].type);
if (configTypeDef) {
if (configTypeDef.exclusive) {
prepareConfigNodeButton(node,d,definition.defaults[d].type,prefix);
} else {
console.log("Unknown type:", definition.defaults[d].type);
preparePropertyEditor(node,d,prefix,definition.defaults);
prepareConfigNodeSelect(node,d,definition.defaults[d].type,prefix);
}
} else {
console.log("Unknown type:", definition.defaults[d].type);
preparePropertyEditor(node,d,prefix,definition.defaults);
}
} else {
preparePropertyEditor(node,d,prefix,definition.defaults);
@@ -469,34 +465,19 @@ RED.editor = (function() {
definition.oneditprepare.call(node);
} catch(err) {
console.log("oneditprepare",node.id,node.type,err.toString());
console.log(err.stack);
}
}
// Now invoke any change handlers added to the fields - passing true
// to prevent full node validation from being triggered each time
for (var d in definition.defaults) {
if (definition.defaults.hasOwnProperty(d)) {
var el = $("#"+prefix+"-"+d);
el.attr("skipValidation", true);
if (el.data("noderedTypedInput") !== undefined) {
el.trigger("change",[el.typedInput('type'),el.typedInput('value')]);
} else {
el.trigger("change");
}
el.removeAttr("skipValidation");
$("#"+prefix+"-"+d).trigger("change",[true]);
}
}
if (definition.credentials) {
for (d in definition.credentials) {
if (definition.credentials.hasOwnProperty(d)) {
var el = $("#"+prefix+"-"+d);
el.attr("skipValidation", true);
if (el.data("noderedTypedInput") !== undefined) {
el.trigger("change",[el.typedInput('type'),el.typedInput('value')]);
} else {
el.trigger("change");
}
el.removeAttr("skipValidation");
$("#"+prefix+"-"+d).trigger("change",[true]);
}
}
}
@@ -510,13 +491,11 @@ RED.editor = (function() {
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix);
completePrepare();
} else {
getNodeCredentials(node.type, node.id, function(data) {
if (data) {
node.credentials = data;
node.credentials._ = $.extend(true,{},data);
if (!/^subflow:/.test(definition.type)) {
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix);
}
$.getJSON(getCredentialsURL(node.type, node.id), function (data) {
node.credentials = data;
node.credentials._ = $.extend(true,{},data);
if (!/^subflow:/.test(definition.type)) {
populateCredentialsInputs(node, definition.credentials, node.credentials, prefix);
}
completePrepare();
});
@@ -1104,11 +1083,8 @@ RED.editor = (function() {
node.infoEditor = nodeInfoEditor;
return nodeInfoEditor;
}
var buildingEditDialog = false;
function showEditDialog(node, defaultTab) {
if (buildingEditDialog) { return }
buildingEditDialog = true;
var editing_node = node;
var isDefaultIcon;
var defaultIcon;
@@ -1216,7 +1192,7 @@ var buildingEditDialog = false;
changed = true;
}
} catch(err) {
console.warn("oneditsave",editing_node.id,editing_node.type,err.toString());
console.log("oneditsave",editing_node.id,editing_node.type,err.toString());
}
for (d in editing_node._def.defaults) {
@@ -1633,7 +1609,6 @@ var buildingEditDialog = false;
if (defaultTab) {
editorTabs.activateTab(defaultTab);
}
buildingEditDialog = false;
done();
});
},
@@ -1655,7 +1630,6 @@ var buildingEditDialog = false;
show: function() {
if (editing_node) {
RED.sidebar.info.refresh(editing_node);
RED.sidebar.help.show(editing_node.type, false);
}
}
}
@@ -1685,8 +1659,6 @@ var buildingEditDialog = false;
* prefix - the input prefix of the parent property
*/
function showEditConfigNodeDialog(name,type,id,prefix) {
if (buildingEditDialog) { return }
buildingEditDialog = true;
var adding = (id == "_ADD_");
var node_def = RED.nodes.getType(type);
var editing_config_node = RED.nodes.node(id);
@@ -1850,7 +1822,6 @@ var buildingEditDialog = false;
trayBody.i18n();
trayFooter.i18n();
finishedBuilding = true;
buildingEditDialog = false;
done();
});
},
@@ -1865,7 +1836,6 @@ var buildingEditDialog = false;
show: function() {
if (editing_config_node) {
RED.sidebar.info.refresh(editing_config_node);
RED.sidebar.help.show(type, false);
}
}
}
@@ -1918,7 +1888,7 @@ var buildingEditDialog = false;
try {
configTypeDef.oneditsave.call(editing_config_node);
} catch(err) {
console.warn("oneditsave",editing_config_node.id,editing_config_node.type,err.toString());
console.log("oneditsave",editing_config_node.id,editing_config_node.type,err.toString());
}
}
@@ -2174,8 +2144,6 @@ var buildingEditDialog = false;
}
function showEditSubflowDialog(subflow) {
if (buildingEditDialog) { return }
buildingEditDialog = true;
var editing_node = subflow;
editStack.push(subflow);
RED.view.state(RED.state.EDITING);
@@ -2280,14 +2248,6 @@ var buildingEditDialog = false;
changed = true;
}
var newMeta = RED.subflow.exportSubflowModuleProperties(editing_node);
if (!isSameObj(editing_node.meta,newMeta)) {
changes.meta = editing_node.meta;
editing_node.meta = newMeta;
changed = true;
}
if (changed) {
var wasChanged = editing_node.changed;
editing_node.changed = true;
@@ -2394,16 +2354,6 @@ var buildingEditDialog = false;
};
editorTabs.addTab(nodePropertiesTab);
var moduleTab = {
id: "editor-tab-module",
label: RED._("editor-tab.module"),
name: RED._("editor-tab.module"),
content: $('<div>', {class:"red-ui-tray-content"}).appendTo(editorContent).hide(),
iconClass: "fa fa-cube",
};
editorTabs.addTab(moduleTab);
RED.subflow.buildModuleForm(moduleTab.content, editing_node);
var descriptionTab = {
id: "editor-tab-description",
label: RED._("editor-tab.description"),
@@ -2432,17 +2382,15 @@ var buildingEditDialog = false;
buildEditForm(nodePropertiesTab.content,"dialog-form","subflow-template", undefined, editing_node);
trayBody.i18n();
getNodeCredentials("subflow", subflow.id, function(data) {
if (data) {
subflow.credentials = data;
subflow.credentials._ = $.extend(true,{},data);
}
$.getJSON(getCredentialsURL("subflow", subflow.id), function (data) {
subflow.credentials = data;
subflow.credentials._ = $.extend(true,{},data);
$("#subflow-input-name").val(subflow.name);
RED.text.bidi.prepareInput($("#subflow-input-name"));
finishedBuilding = true;
buildingEditDialog = false;
done();
});
},
@@ -2463,39 +2411,7 @@ var buildingEditDialog = false;
RED.tray.show(trayOptions);
}
function getNodeCredentials(type, id, done) {
var timeoutNotification;
var intialTimeout = setTimeout(function() {
timeoutNotification = RED.notify($('<p data-i18n="[prepend]editor.loadCredentials"> <img src="red/images/spin.svg"/></p>').i18n(),{fixed: true})
},800);
$.ajax({
url: getCredentialsURL(type,id),
dataType: 'json',
success: function(data) {
if (timeoutNotification) {
timeoutNotification.close();
timeoutNotification = null;
}
clearTimeout(intialTimeout);
done(data);
},
error: function(jqXHR,status,error) {
if (timeoutNotification) {
timeoutNotification.close();
timeoutNotification = null;
}
clearTimeout(intialTimeout);
RED.notify(RED._("editor.errors.credentialLoadFailed"),"error")
done(null);
},
timeout: 30000,
});
}
function showEditGroupDialog(group) {
if (buildingEditDialog) { return }
buildingEditDialog = true;
var editing_node = group;
editStack.push(group);
RED.view.state(RED.state.EDITING);
@@ -2539,7 +2455,7 @@ var buildingEditDialog = false;
changed = true;
}
} catch(err) {
console.warn("oneditsave",editing_node.id,editing_node.type,err.toString());
console.log("oneditsave",editing_node.id,editing_node.type,err.toString());
}
for (d in editing_node._def.defaults) {
@@ -2719,7 +2635,6 @@ var buildingEditDialog = false;
prepareEditDialog(group,group._def,"node-input", function() {
trayBody.i18n();
finishedBuilding = true;
buildingEditDialog = false;
done();
});
},
@@ -2807,7 +2722,7 @@ var buildingEditDialog = false;
if (options.globals) {
setTimeout(function() {
if (!!session.$worker) {
session.$worker.send("setOptions", [{globals: options.globals, maxerr:1000}]);
session.$worker.send("setOptions", [{globals: options.globals, esversion:6, sub:true, asi:true, maxerr:1000}]);
}
},100);
}
@@ -2871,13 +2786,7 @@ var buildingEditDialog = false;
editExpression: function(options) { showTypeEditor("_expression", options) },
editJSON: function(options) { showTypeEditor("_json", options) },
editMarkdown: function(options) { showTypeEditor("_markdown", options) },
editText: function(options) {
if (options.mode == "markdown") {
showTypeEditor("_markdown", options)
} else {
showTypeEditor("_text", options)
}
},
editText: function(options) { showTypeEditor("_text", options) },
editBuffer: function(options) { showTypeEditor("_buffer", options) },
buildEditForm: buildEditForm,
validateNode: validateNode,

View File

@@ -82,15 +82,12 @@ RED.group = (function() {
colorPalette.push('#'+'000000'.slice(0, 6-s.length)+s);
}
var defaultGroupStyle = {
label: true,
"label-position": "nw"
};
var defaultGroupStyle = {};
var groupDef = {
defaults:{
name:{value:""},
style:{value:{label:true}},
style:{value:{}},
nodes:{value:[]}
},
category: "config",
@@ -98,25 +95,25 @@ RED.group = (function() {
var style = this.style || {};
RED.colorPicker.create({
id:"node-input-style-stroke",
value: style.stroke || defaultGroupStyle.stroke || "#a4a4a4",
value: style.stroke || "#a4a4a4",
palette: colorPalette,
cellPerRow: colorCount,
cellWidth: 16,
cellHeight: 16,
cellMargin: 3,
none: true,
opacity: style.hasOwnProperty('stroke-opacity')?style['stroke-opacity']:(defaultGroupStyle.hasOwnProperty('stroke-opacity')?defaultGroupStyle['stroke-opacity']:1.0)
opacity: style['stroke-opacity'] || 1.0
}).appendTo("#node-input-row-style-stroke");
RED.colorPicker.create({
id:"node-input-style-fill",
value: style.fill || defaultGroupStyle.fill ||"none",
value: style.fill || "none",
palette: colorPalette,
cellPerRow: colorCount,
cellWidth: 16,
cellHeight: 16,
cellMargin: 3,
none: true,
opacity: style.hasOwnProperty('fill-opacity')?style['fill-opacity']:(defaultGroupStyle.hasOwnProperty('fill-opacity')?defaultGroupStyle['fill-opacity']:1.0)
opacity: style['fill-opacity'] || 1.0
}).appendTo("#node-input-row-style-fill");
createLayoutPicker({
@@ -126,7 +123,7 @@ RED.group = (function() {
RED.colorPicker.create({
id:"node-input-style-color",
value: style.color || defaultGroupStyle.color ||"#a4a4a4",
value: style.color || "#a4a4a4",
palette: colorPalette,
cellPerRow: colorCount,
cellWidth: 16,
@@ -136,9 +133,10 @@ RED.group = (function() {
$("#node-input-style-label").toggleButton({
enabledLabel: RED._("editor.show"),
disabledLabel: RED._("editor.show"),
disabledLabel: RED._("editor.hide")
})
$("#node-input-style-label").on("change", function(evt) {
$("#node-input-row-style-label-options").toggle($(this).prop("checked"));
})
@@ -162,13 +160,12 @@ RED.group = (function() {
delete this.style.color;
}
var node = this;
['stroke','fill','stroke-opacity','fill-opacity','color','label-position'].forEach(function(prop) {
if (node.style[prop] === defaultGroupStyle[prop]) {
delete node.style[prop]
}
})
if (this.style["stroke-opacity"] === "1") {
delete this.style["stroke-opacity"]
}
if (this.style["fill-opacity"] === "1") {
delete this.style["fill-opacity"]
}
this.resize = true;
},
set:{
@@ -220,18 +217,9 @@ RED.group = (function() {
stroke: convertColorToHex(groupStyle.stroke),
"stroke-opacity": groupStyle.strokeOpacity,
fill: convertColorToHex(groupStyle.fill),
"fill-opacity": groupStyle.fillOpacity,
label: true,
"label-position": "nw"
"fill-opacity": groupStyle.fillOpacity
}
groupStyleDiv.remove();
groupStyleDiv = $("<div>",{
class:"red-ui-flow-group-label",
style: "position: absolute; top: -1000px;"
}).appendTo(document.body);
groupStyle = getComputedStyle(groupStyleDiv[0]);
defaultGroupStyle.color = convertColorToHex(groupStyle.fill);
groupStyleDiv.remove();
}
function convertColorToHex(c) {
@@ -247,7 +235,6 @@ RED.group = (function() {
var groupStyleClipboard;
function copyGroupStyle() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection();
if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].type === 'group') {
groupStyleClipboard = JSON.parse(JSON.stringify(selection.nodes[0].style));
@@ -255,7 +242,6 @@ RED.group = (function() {
}
}
function pasteGroupStyle() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
if (groupStyleClipboard) {
var selection = RED.view.selection();
if (selection.nodes) {
@@ -289,7 +275,6 @@ RED.group = (function() {
}
function groupSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection();
if (selection.nodes) {
var group = createGroup(selection.nodes);
@@ -306,7 +291,6 @@ RED.group = (function() {
}
}
function ungroupSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection();
if (selection.nodes) {
var newSelection = [];
@@ -355,7 +339,8 @@ RED.group = (function() {
}
function mergeSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
// TODO: this currently creates an entirely new group. Need to merge properties
// of any existing group
var selection = RED.view.selection();
if (selection.nodes) {
var nodes = [];
@@ -383,16 +368,11 @@ RED.group = (function() {
return;
}
}
var existingGroup;
// Second pass, ungroup any groups in the selection and add their contents
// to the selection
for (var i=0; i<selection.nodes.length; i++) {
n = selection.nodes[i];
if (n.type === "group") {
if (!existingGroup) {
existingGroup = n;
}
ungroupHistoryEvent.groups.push(n);
nodes = nodes.concat(ungroup(n));
} else {
@@ -406,10 +386,6 @@ RED.group = (function() {
// Finally, create the new group
var group = createGroup(nodes);
if (group) {
if (existingGroup) {
group.style = existingGroup.style;
group.name = existingGroup.name;
}
RED.view.select({nodes:[group]})
}
historyEvent.events.push({
@@ -423,7 +399,6 @@ RED.group = (function() {
}
function removeSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection();
if (selection.nodes) {
var nodes = [];
@@ -640,14 +615,14 @@ RED.group = (function() {
var row = null;
row = $("<div/>").appendTo(picker);
var currentButton;
for (var y=0;y<2;y++) { //red-ui-group-layout-text-pos
var yComponent= "ns"[y];
row = $("<div/>").appendTo(picker);
for (var x=0;x<3;x++) {
var xComponent = ["w","","e"][x];
var val = yComponent+xComponent;
var button = $("<button/>", { class:"red-ui-search-result-node red-ui-button","data-pos":val }).appendTo(row);
var button = $("<button/>", { class:"red-ui-search-result-node","data-pos":val }).appendTo(row);
button.on("click", function (e) {
e.preventDefault();
layoutHiddenInput.val($(this).data("pos"));
@@ -655,22 +630,15 @@ RED.group = (function() {
refreshDisplay();
});
$('<div>',{class:"red-ui-group-layout-picker-cell-text red-ui-group-layout-text-pos-"+val}).appendTo(button);
if (val === layoutHiddenInput.val()) {
currentButton = button;
}
}
}
refreshDisplay();
var layoutPanel = RED.popover.panel(picker);
layoutPanel.show({
target: layoutButton,
onclose: function() {
layoutButton.focus();
}
});
if (currentButton) {
currentButton.focus();
}
target: layoutButton
})
})
refreshDisplay();

View File

@@ -17,12 +17,7 @@ RED.keyboard = (function() {
var isMac = /Mac/i.test(window.navigator.platform);
var handlersActive = true;
var handlers = {};
var knownShortcuts;
var partialState;
var keyMap = {
@@ -37,7 +32,6 @@ RED.keyboard = (function() {
"space": 32,
";":186,
"=":187,
"+":187, // <- QWERTY specific
",":188,
"-":189,
".":190,
@@ -47,10 +41,10 @@ RED.keyboard = (function() {
"?":191 // <- QWERTY specific
}
var metaKeyCodes = {
16: true,
17: true,
16:true,
17:true,
18: true,
91: true,
91:true,
93: true
}
var actionToKeyMap = {}
@@ -64,90 +58,41 @@ RED.keyboard = (function() {
}
function migrateOldKeymap() {
// pre-0.18
if ('localStorage' in window && window['localStorage'] !== null) {
var oldKeyMap = localStorage.getItem("keymap");
if (oldKeyMap !== null) {
localStorage.removeItem("keymap");
RED.settings.set('editor.keymap',JSON.parse(oldKeyMap));
var currentEditorSettings = RED.settings.get('editor') || {};
currentEditorSettings.keymap = JSON.parse(oldKeyMap);
RED.settings.set('editor',currentEditorSettings);
}
}
}
function getUserKey(action) {
return RED.settings.get('editor.keymap',{})[action]
}
function mergeKeymaps(defaultKeymap, themeKeymap) {
// defaultKeymap has format: { scope: { key: action , key: action }}
// themeKeymap has format: {action: {scope,key}, action: {scope:key}}
var mergedKeymap = {};
for (var scope in defaultKeymap) {
if (defaultKeymap.hasOwnProperty(scope)) {
var keys = defaultKeymap[scope];
for (var key in keys) {
if (keys.hasOwnProperty(key)) {
if (!mergedKeymap[keys[key]]) {
mergedKeymap[keys[key]] = [{
scope:scope,
key:key,
user:false
}];
} else {
mergedKeymap[keys[key]].push({
scope:scope,
key:key,
user:false
})
}
}
}
}
}
for (var action in themeKeymap) {
if (themeKeymap.hasOwnProperty(action)) {
if (!themeKeymap[action].key) {
// No key for this action - default is no keybinding
delete mergedKeymap[action]
} else {
mergedKeymap[action] = [{
scope: themeKeymap[action].scope || "*",
key: [themeKeymap[action].key],
user: false
}]
if (mergedKeymap[action][0].scope === "workspace") {
mergedKeymap[action][0].scope = "red-ui-workspace";
}
}
}
}
return mergedKeymap;
}
function init() {
// Migrate from pre-0.18
migrateOldKeymap();
var userKeymap = RED.settings.get('editor.keymap', {});
$.getJSON("red/keymap.json",function(defaultKeymap) {
var keymap = mergeKeymaps(defaultKeymap, RED.settings.theme('keymap',{}));
// keymap has the format: {action: [{scope,key},{scope,key}], action: [{scope:key}]}
var currentEditorSettings = RED.settings.get('editor') || {};
var userKeymap = currentEditorSettings.keymap || {};
var action;
for (action in keymap) {
if (keymap.hasOwnProperty(action)) {
if (!userKeymap.hasOwnProperty(action)) {
keymap[action].forEach(function(km) {
addHandler(km.scope,km.key,action,false);
});
$.getJSON("red/keymap.json",function(data) {
for (var scope in data) {
if (data.hasOwnProperty(scope)) {
var keys = data[scope];
for (var key in keys) {
if (keys.hasOwnProperty(key)) {
if (!userKeymap.hasOwnProperty(keys[key])) {
addHandler(scope,key,keys[key],false);
}
defaultKeyMap[keys[key]] = {
scope:scope,
key:key,
user:false
};
}
}
defaultKeyMap[action] = keymap[action][0];
}
}
for (var action in userKeymap) {
if (userKeymap.hasOwnProperty(action) && userKeymap[action]) {
var obj = userKeymap[action];
@@ -280,9 +225,6 @@ RED.keyboard = (function() {
}
}
d3.select(window).on("keydown",function() {
if (!handlersActive) {
return;
}
if (metaKeyCodes[d3.event.keyCode]) {
return;
}
@@ -308,19 +250,6 @@ RED.keyboard = (function() {
var i=0;
if (typeof key === 'string') {
if (typeof cbdown === 'string') {
if (!ondown && !defaultKeyMap.hasOwnProperty(cbdown)) {
defaultKeyMap[cbdown] = {
scope:scope,
key:key,
user:false
}
}
if (!ondown) {
var userAction = getUserKey(cbdown);
if (userAction) {
return;
}
}
actionToKeyMap[cbdown] = {scope:scope,key:key};
if (typeof ondown === 'boolean') {
actionToKeyMap[cbdown].user = ondown;
@@ -456,21 +385,14 @@ RED.keyboard = (function() {
container.addClass('keyboard-shortcut-entry-expanded');
var keyInput = $('<input type="text">').attr('placeholder',RED._('keyboard.unassigned')).val(object.key||"").appendTo(key);
keyInput.on("change paste keyup",function(e) {
if (e.keyCode === 13 && !$(this).hasClass("input-error")) {
keyInput.on("keyup",function(e) {
if (e.keyCode === 13) {
return endEditShortcut();
}
if (e.keyCode === 27) {
return endEditShortcut(true);
}
var currentVal = $(this).val();
currentVal = currentVal.trim();
var valid = (currentVal === "" || RED.keyboard.validateKey(currentVal));
if (valid && currentVal !== "") {
valid = !knownShortcuts.has(scopeSelect.val()+":"+currentVal.toLowerCase());
}
$(this).toggleClass("input-error",!valid);
okButton.attr("disabled",!valid);
})
var scopeSelect = $('<select><option value="*" data-i18n="keyboard.global"></option><option value="red-ui-workspace" data-i18n="keyboard.workspace"></option></select>').appendTo(scope);
@@ -479,9 +401,6 @@ RED.keyboard = (function() {
object.scope = "red-ui-workspace";
}
scopeSelect.val(object.scope||'*');
scopeSelect.on("change", function() {
keyInput.trigger("change");
})
var div = $('<div class="keyboard-shortcut-edit button-group-vertical"></div>').appendTo(scope);
var okButton = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-check"></i></button>').appendTo(div);
@@ -493,16 +412,18 @@ RED.keyboard = (function() {
});
revertButton.on("click", function(e) {
e.stopPropagation();
RED.keyboard.revertToDefault(object.id);
container.empty();
container.removeClass('keyboard-shortcut-entry-expanded');
var userKeymap = RED.settings.get('editor.keymap', {});
userKeymap[object.id] = null;
RED.settings.set('editor.keymap',userKeymap);
RED.keyboard.revertToDefault(object.id);
var shortcut = RED.keyboard.getShortcut(object.id);
var userKeymap = RED.settings.get('keymap') || {};
var currentEditorSettings = RED.settings.get('editor') || {};
var userKeymap = currentEditorSettings.keymap || {};
userKeymap[object.id] = null;
currentEditorSettings.keymap = userKeymap;
RED.settings.set('editor',currentEditorSettings);
var obj = {
id:object.id,
scope:shortcut?shortcut.scope:undefined,
@@ -534,7 +455,6 @@ RED.keyboard = (function() {
keyDiv.empty();
scopeDiv.empty();
if (object.key) {
knownShortcuts.delete(object.scope+":"+object.key);
RED.keyboard.remove(object.key,true);
}
container.find(".keyboard-shortcut-entry-text i").css("opacity",1);
@@ -549,17 +469,14 @@ RED.keyboard = (function() {
$("<span>").text(scope).appendTo(scopeDiv);
object.key = key;
object.scope = scope;
knownShortcuts.add(object.scope+":"+object.key);
RED.keyboard.add(object.scope,object.key,object.id,true);
}
var userKeymap = RED.settings.get('editor.keymap', {});
var shortcut = RED.keyboard.getShortcut(object.id);
userKeymap[object.id] = {
scope:shortcut.scope,
key:shortcut.key
}
RED.settings.set('editor.keymap',userKeymap);
var currentEditorSettings = RED.settings.get('editor') || {};
var userKeymap = currentEditorSettings.keymap || {};
userKeymap[object.id] = RED.keyboard.getShortcut(object.id);
currentEditorSettings.keymap = userKeymap;
RED.settings.set('editor',currentEditorSettings);
}
}
}
@@ -647,23 +564,12 @@ RED.keyboard = (function() {
var Bid = B.id.replace(/^.*:/,"").replace(/[ -]/g,"").toLowerCase();
return Aid.localeCompare(Bid);
});
knownShortcuts = new Set();
shortcuts.forEach(function(s) {
if (s.key) {
knownShortcuts.add(s.scope+":"+s.key);
}
shortcutList.editableList('addItem',s);
});
return pane;
}
function enable() {
handlersActive = true;
}
function disable() {
handlersActive = false;
}
return {
init: init,
add: addHandler,
@@ -671,12 +577,9 @@ RED.keyboard = (function() {
getShortcut: function(actionName) {
return actionToKeyMap[actionName];
},
getUserShortcut: getUserKey,
revertToDefault: revertToDefault,
formatKey: formatKey,
validateKey: validateKey,
disable: disable,
enable: enable
validateKey: validateKey
}
})();

View File

@@ -216,7 +216,31 @@ RED.library = (function() {
{ id:'node-input-'+options.type+'-menu-open-library',
label: RED._("library.openLibrary"),
onselect: function() {
activeLibrary = options;
loadLibraryFolder("local",options.url, "", function(items) {
var listing = [{
library: "local",
type: options.url,
icon: 'fa fa-hdd-o',
label: RED._("library.types.local"),
path: "",
expanded: true,
writable: false,
children: [{
library: "local",
type: options.url,
icon: 'fa fa-cube',
label: options.type,
path: "",
expanded: true,
children: items
}]
}]
loadLibraryBrowser.data(listing);
setTimeout(function() {
loadLibraryBrowser.select(listing[0].children[0]);
},200);
});
libraryEditor = ace.edit('red-ui-library-dialog-load-preview-text',{
useWorker: false
});
@@ -232,43 +256,6 @@ RED.library = (function() {
libraryEditor.renderer.$cursorLayer.element.style.opacity=0;
libraryEditor.$blockScrolling = Infinity;
activeLibrary = options;
var listing = [];
var libraries = RED.settings.libraries || [];
libraries.forEach(function(lib) {
if (lib.types && lib.types.indexOf(options.url) === -1) {
return;
}
listing.push({
library: lib.id,
type: options.url,
icon: lib.icon || 'fa fa-hdd-o',
label: RED._(lib.label||lib.id),
path: "",
expanded: true,
writable: false,
children: [{
library: lib.id,
type: options.url,
icon: 'fa fa-cube',
label: options.type,
path: "",
expanded: false,
children: function(done, item) {
loadLibraryFolder(lib.id, options.url, "", function(children) {
item.children = children;
done(children);
})
}
}]
})
});
loadLibraryBrowser.data(listing);
setTimeout(function() {
loadLibraryBrowser.select(listing[0].children[0]);
},200);
var dialogHeight = 400;
var winHeight = $(window).height();
if (winHeight < 570) {
@@ -291,40 +278,30 @@ RED.library = (function() {
}
$("#red-ui-library-dialog-save-filename").attr("value",filename+"."+(options.ext||"txt"));
var listing = [];
var libraries = RED.settings.libraries || [];
libraries.forEach(function(lib) {
if (lib.types && lib.types.indexOf(options.url) === -1) {
return;
}
listing.push({
library: lib.id,
loadLibraryFolder("local",options.url, "", function(items) {
var listing = [{
library: "local",
type: options.url,
icon: lib.icon || 'fa fa-hdd-o',
label: RED._(lib.label||lib.id),
icon: 'fa fa-hdd-o',
label: RED._("library.types.local"),
path: "",
expanded: true,
writable: false,
children: [{
library: lib.id,
library: "local",
type: options.url,
icon: 'fa fa-cube',
label: options.type,
path: "",
expanded: false,
children: function(done, item) {
loadLibraryFolder(lib.id, options.url, "", function(children) {
item.children = children;
done(children);
})
}
expanded: true,
children: items
}]
})
}]
saveLibraryBrowser.data(listing);
setTimeout(function() {
saveLibraryBrowser.select(listing[0].children[0]);
},200);
});
saveLibraryBrowser.data(listing);
setTimeout(function() {
saveLibraryBrowser.select(listing[0].children[0]);
},200);
var dialogHeight = 400;
var winHeight = $(window).height();
@@ -483,235 +460,9 @@ RED.library = (function() {
}
}
// var libraryPlugins = {};
//
// function showLibraryDetailsDialog(container, lib, done) {
// var dialog = $('<div>').addClass("red-ui-projects-dialog-list-dialog").hide().appendTo(container);
// $('<div>').addClass("red-ui-projects-dialog-list-dialog-header").text(lib?"Edit library source":"Add library source").appendTo(dialog);
// var formRow = $('<div class="red-ui-settings-row"></div>').appendTo(dialog);
// $('<label>').text("Type").appendTo(formRow);
// var typeSelect = $('<select>').appendTo(formRow);
// for (var type in libraryPlugins) {
// if (libraryPlugins.hasOwnProperty(type)) {
// $('<option>').attr('value',type).attr('selected',(lib && lib.type === type)?true:null).text(libraryPlugins[type].name).appendTo(typeSelect);
// }
// }
// var dialogBody = $("<div>").addClass("red-ui-settings-section").appendTo(dialog);
// var libraryFields = {};
// var fieldsModified = {};
// function validateFields() {
// var validForm = true;
// for (var p in libraryFields) {
// if (libraryFields.hasOwnProperty(p)) {
// var v = libraryFields[p].input.val().trim();
// if (v === "") {
// validForm = false;
// if (libraryFields[p].modified) {
// libraryFields[p].input.addClass("input-error");
// }
// } else {
// libraryFields[p].input.removeClass("input-error");
// }
// }
// }
// okayButton.attr("disabled",validForm?null:"disabled");
// }
// typeSelect.on("change", function(evt) {
// dialogBody.empty();
// libraryFields = {};
// fieldsModified = {};
// var libDef = libraryPlugins[$(this).val()];
// var defaultIcon = lib?lib.icon:(libDef.icon || "font-awesome/fa-image");
// formRow = $('<div class="red-ui-settings-row"></div>').appendTo(dialogBody);
// $('<label>').text(RED._("editor.settingIcon")).appendTo(formRow);
// libraryFields['icon'] = {input: $('<input type="hidden">').val(defaultIcon) };
// var iconButton = $('<button type="button" class="red-ui-button"></button>').appendTo(formRow);
// iconButton.on("click", function(evt) {
// evt.preventDefault();
// var icon = libraryFields['icon'].input.val() || "";
// var iconPath = (icon ? RED.utils.separateIconPath(icon) : {});
// RED.editor.showIconPicker(iconButton, null, iconPath, true, function (newIcon) {
// iconButton.empty();
// var path = newIcon || "";
// var newPath = RED.utils.separateIconPath(path);
// if (newPath) {
// $('<i class="fa"></i>').addClass(newPath.file).appendTo(iconButton);
// }
// libraryFields['icon'].input.val(path);
// });
// })
// var newPath = RED.utils.separateIconPath(defaultIcon);
// $('<i class="fa '+newPath.file+'"></i>').appendTo(iconButton);
//
// var libProps = libDef.defaults;
// var libPropKeys = Object.keys(libProps).map(function(p) { return {id: p, def: libProps[p]}});
// libPropKeys.unshift({id: "label", def: {value:""}})
//
// libPropKeys.forEach(function(prop) {
// var p = prop.id;
// var def = prop.def;
// formRow = $('<div class="red-ui-settings-row"></div>').appendTo(dialogBody);
// var label = libDef._(def.label || "label."+p,{defaultValue: p});
// if (label === p) {
// label = libDef._("editor:common.label."+p,{defaultValue:p});
// }
// $('<label>').text(label).appendTo(formRow);
// libraryFields[p] = {
// input: $('<input type="text">').val(lib?(lib[p]||lib.config[p]):def.value).appendTo(formRow),
// modified: false
// }
// if (def.type === "password") {
// libraryFields[p].input.attr("type","password").typedInput({type:"cred"})
// }
//
// libraryFields[p].input.on("change paste keyup", function(evt) {
// if (!evt.key || evt.key.length === 1) {
// libraryFields[p].modified = true;
// }
// validateFields();
// })
// var desc = libDef._("desc."+p, {defaultValue: ""});
// if (desc) {
// $('<label class="red-ui-projects-edit-form-sublabel"></label>').append($('<small>').text(desc)).appendTo(formRow);
// }
// });
// validateFields();
// })
//
// var dialogButtons = $('<span class="button-row" style="position: relative; float: right; margin: 10px;"></span>').appendTo(dialog);
// var cancelButton = $('<button class="red-ui-button"></button>').text(RED._("common.label.cancel")).appendTo(dialogButtons).on("click", function(evt) {
// evt.preventDefault();
// done(false);
// })
// var okayButton = $('<button class="red-ui-button"></button>').text(lib?"Update library":"Add library").appendTo(dialogButtons).on("click", function(evt) {
// evt.preventDefault();
// var item;
// if (!lib) {
// item = {
// id: libraryFields['label'].input.val().trim().toLowerCase().replace(/( |[^a-z0-9])/g,"-"),
// user: true,
// type: typeSelect.val(),
// config: {}
// }
// } else {
// item = lib;
// }
//
// item.label = libraryFields['label'].input.val().trim();
// item.icon = libraryFields['icon'].input.val();
//
// for (var p in libraryFields) {
// if (libraryFields.hasOwnProperty(p) && p !== 'label') {
// item.config[p] = libraryFields[p].input.val().trim();
// }
// }
// done(item);
// });
//
// typeSelect.trigger("change");
// if (lib) {
// typeSelect.attr('disabled',true);
// }
//
// dialog.slideDown(200);
// }
//
// function createSettingsPane() {
// var pane = $('<div id="red-ui-settings-tab-library-manager"></div>');
// var toolbar = $('<div>').css("text-align","right").appendTo(pane);
// var addButton = $('<button class="red-ui-button"><i class="fa fa-plus"></i> Add library</button>').appendTo(toolbar);
//
// var addingLibrary = false;
//
// var libraryList = $("<ol>").css({
// position: "absolute",
// left: "10px",
// right: "10px",
// top: "50px",
// bottom: "10px"
// }).appendTo(pane).editableList({
// addButton: false,
// addItem: function(row,index,itemData) {
// if (itemData.id) {
// row.addClass("red-ui-settings-tab-library-entry");
// var iconCell = $("<span>").appendTo(row);
// if (itemData.icon) {
// var iconPath = RED.utils.separateIconPath(itemData.icon);
// if (iconPath) {
// $("<i>").addClass("fa "+iconPath.file).appendTo(iconCell);
// }
// }
// $("<span>").text(RED._(itemData.label)).appendTo(row);
// $("<span>").text(RED._(itemData.type)).appendTo(row);
// $('<button class="red-ui-button red-ui-button-small"></button>').text(RED._("sidebar.project.projectSettings.edit")).appendTo(
// $('<span>').appendTo(row)
// ).on("click", function(evt) {
// if (addingLibrary) {
// return;
// }
// evt.preventDefault();
// addingLibrary = true;
// row.empty();
// row.removeClass("red-ui-settings-tab-library-entry");
// showLibraryDetailsDialog(row,itemData,function(newItem) {
// var itemIndex = libraryList.editableList("indexOf", itemData);
// libraryList.editableList("removeItem", itemData);
// if (newItem) {
// libraryList.editableList("insertItemAt", newItem, itemIndex);
// } else {
// libraryList.editableList("insertItemAt", itemData,itemIndex);
// }
// addingLibrary = false;
//
// })
// })
//
// } else {
// showLibraryDetailsDialog(row,null,function(newItem) {
// libraryList.editableList("removeItem", itemData);
// if (newItem) {
// libraryList.editableList("addItem", newItem);
// }
// addingLibrary = false;
// })
//
// }
// }
// });
//
// addButton.on('click', function(evt) {
// evt.preventDefault();
// if (!addingLibrary) {
// addingLibrary = true;
// libraryList.editableList("addItem",{user:true});
// }
// })
// var libraries = RED.settings.libraries || [];
// libraries.forEach(function(library) {
// if (library.user) {
// libraryList.editableList("addItem",library)
// }
// })
//
// return pane;
// }
//
//
return {
init: function() {
// RED.events.on("registry:plugin-added", function(id) {
// var plugin = RED.plugins.getPlugin(id);
// if (plugin.type === "node-red-library-source") {
// libraryPlugins[id] = plugin;
// }
// });
//
// RED.userSettings.add({
// id:'library-manager',
// title: "NLS: Libraries",
// get: createSettingsPane,
// close: function() {}
// });
$(_librarySave).appendTo("#red-ui-editor").i18n();
$(_libraryLookup).appendTo("#red-ui-editor").i18n();
@@ -721,8 +472,6 @@ RED.library = (function() {
autoOpen: false,
width: 800,
resizable: false,
open: function( event, ui ) { RED.keyboard.disable() },
close: function( event, ui ) { RED.keyboard.enable() },
classes: {
"ui-dialog": "red-ui-editor-dialog",
"ui-dialog-titlebar-close": "hide",
@@ -807,11 +556,9 @@ RED.library = (function() {
}
],
open: function(e) {
RED.keyboard.disable();
$(this).parent().find(".ui-dialog-titlebar-close").hide();
},
close: function(e) {
RED.keyboard.enable();
if (libraryEditor) {
libraryEditor.destroy();
libraryEditor = null;

View File

@@ -31,53 +31,15 @@ RED.palette.editor = (function() {
var eventTimers = {};
var activeFilter = "";
var semverre = /^(\d+)(\.(\d+))?(\.(\d+))?(-([0-9A-Za-z-]+))?(\.([0-9A-Za-z-.]+))?$/;
var NUMBERS_ONLY = /^\d+$/;
function SemVerPart(part) {
this.number = 0;
this.text = part;
if ( NUMBERS_ONLY.test(part)){
this.number = parseInt(part);
this.type = "N";
} else {
this.type = part == undefined || part.length < 1 ? "E" : "T";
function semVerCompare(A,B) {
var aParts = A.split(".").map(function(m) { return parseInt(m);});
var bParts = B.split(".").map(function(m) { return parseInt(m);});
for (var i=0;i<3;i++) {
var j = aParts[i]-bParts[i];
if (j<0) { return -1 }
if (j>0) { return 1 }
}
}
SemVerPart.prototype.compare = function(other) {
var types = this.type + other.type;
switch ( types ) {
case "EE": return 0;
case "NT":
case "TE":
case "EN": return -1;
case "NN": return this.number - other.number;
case "TT": return this.text.localeCompare( other.text );
case "ET":
case "TN":
case "NE": return 1;
}
};
function SemVer(ver) {
var groups = ver.match( semverre );
this.parts = [ new SemVerPart( groups[1] ), new SemVerPart( groups[3] ), new SemVerPart( groups[5] ), new SemVerPart( groups[7] ), new SemVerPart( groups[9] ) ];
}
SemVer.prototype.compare = function(other) {
var result = 0;
for ( var i = 0, n = this.parts.length; result == 0 && i < n; i++ ) {
result = this.parts[ i ].compare( other.parts[ i ] );
}
return result;
};
function semVerCompare(ver1, ver2) {
var semver1 = new SemVer(ver1);
var semver2 = new SemVer(ver2);
var result = semver1.compare(semver2);
return result;
return 0;
}
function delayCallback(start,callback) {
@@ -367,26 +329,21 @@ RED.palette.editor = (function() {
catalogueLoadStatus.push(err||v);
if (!err) {
if (v.modules) {
var a = false;
v.modules = v.modules.filter(function(m) {
if (RED.utils.checkModuleAllowed(m.id,m.version,installAllowList,installDenyList)) {
loadedIndex[m.id] = m;
m.index = [m.id];
if (m.keywords) {
m.index = m.index.concat(m.keywords);
}
if (m.types) {
m.index = m.index.concat(m.types);
}
if (m.updated_at) {
m.timestamp = new Date(m.updated_at).getTime();
} else {
m.timestamp = 0;
}
m.index = m.index.join(",").toLowerCase();
return true;
v.modules.forEach(function(m) {
loadedIndex[m.id] = m;
m.index = [m.id];
if (m.keywords) {
m.index = m.index.concat(m.keywords);
}
return false;
if (m.types) {
m.index = m.index.concat(m.types);
}
if (m.updated_at) {
m.timestamp = new Date(m.updated_at).getTime();
} else {
m.timestamp = 0;
}
m.index = m.index.join(",").toLowerCase();
})
loadedList = loadedList.concat(v.modules);
}
@@ -480,22 +437,11 @@ RED.palette.editor = (function() {
return -1 * (A.info.timestamp-B.info.timestamp);
}
var installAllowList = ['*'];
var installDenyList = [];
function init() {
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
if (RED.settings.theme('palette.editable') === false) {
return;
}
var settingsAllowList = RED.settings.get("externalModules.palette.allowList")
var settingsDenyList = RED.settings.get("externalModules.palette.denyList")
if (settingsAllowList || settingsDenyList) {
installAllowList = settingsAllowList;
installDenyList = settingsDenyList
}
installAllowList = RED.utils.parseModuleList(installAllowList);
installDenyList = RED.utils.parseModuleList(installDenyList);
createSettingsPane();
RED.userSettings.add({
@@ -596,6 +542,8 @@ RED.palette.editor = (function() {
return settingsPane;
}
function createSettingsPane() {
settingsPane = $('<div id="red-ui-settings-tab-palette"></div>');
var content = $('<div id="red-ui-palette-editor">'+
@@ -626,11 +574,7 @@ RED.palette.editor = (function() {
minimumActiveTabWidth: 110
});
createNodeTab(content);
createInstallTab(content);
}
function createNodeTab(content) {
var modulesTab = $('<div>',{class:"red-ui-palette-editor-tab"}).appendTo(content);
editorTabs.addTab({
@@ -782,9 +726,9 @@ RED.palette.editor = (function() {
}
}
});
}
function createInstallTab(content) {
var installTab = $('<div>',{class:"red-ui-palette-editor-tab hide"}).appendTo(content);
editorTabs.addTab({
@@ -817,6 +761,7 @@ RED.palette.editor = (function() {
}
});
$('<span>').text(RED._("palette.editor.sort")+' ').appendTo(toolBar);
var sortGroup = $('<span class="button-group"></span>').appendTo(toolBar);
var sortRelevance = $('<a href="#" class="red-ui-palette-editor-install-sort-option red-ui-sidebar-header-button-toggle selected"><i class="fa fa-sort-amount-desc"></i></a>').appendTo(sortGroup);
@@ -850,7 +795,6 @@ RED.palette.editor = (function() {
loadedIndex = {};
initInstallTab();
})
RED.popover.tooltip(refreshButton,RED._("palette.editor.refresh"));
packageList = $('<ol>',{style:"position: absolute;top: 79px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
addButton: false,
@@ -934,89 +878,10 @@ RED.palette.editor = (function() {
}
});
if (RED.settings.get('externalModules.palette.allowUpload', true) !== false) {
var uploadSpan = $('<span class="button-group">').prependTo(toolBar);
var uploadButton = $('<button type="button" class="red-ui-sidebar-header-button red-ui-palette-editor-upload-button"><label><i class="fa fa-upload"></i><form id="red-ui-palette-editor-upload-form" enctype="multipart/form-data"><input name="tarball" type="file" accept=".tgz"></label></button>').appendTo(uploadSpan);
var uploadInput = uploadButton.find('input[type="file"]');
uploadInput.on("change", function(evt) {
if (this.files.length > 0) {
uploadFilenameLabel.text(this.files[0].name)
uploadToolbar.slideDown(200);
}
})
var uploadToolbar = $('<div class="red-ui-palette-editor-upload"></div>').appendTo(installTab);
var uploadForm = $('<div>').appendTo(uploadToolbar);
var uploadFilename = $('<div class="placeholder-input"><i class="fa fa-upload"></i> </div>').appendTo(uploadForm);
var uploadFilenameLabel = $('<span></span>').appendTo(uploadFilename);
var uploadButtons = $('<div class="red-ui-palette-editor-upload-buttons"></div>').appendTo(uploadForm);
$('<button class="editor-button"></button>').text(RED._("common.label.cancel")).appendTo(uploadButtons).on("click", function(evt) {
evt.preventDefault();
uploadToolbar.slideUp(200);
uploadInput.val("");
});
$('<button class="editor-button primary"></button>').text(RED._("common.label.upload")).appendTo(uploadButtons).on("click", function(evt) {
evt.preventDefault();
var spinner = RED.utils.addSpinnerOverlay(uploadToolbar, true);
var buttonRow = $('<div style="position: relative;bottom: calc(50% + 17px); padding-right: 10px;text-align: right;"></div>').appendTo(spinner);
$('<button class="red-ui-button"></button>').text(RED._("eventLog.view")).appendTo(buttonRow).on("click", function(evt) {
evt.preventDefault();
RED.actions.invoke("core:show-event-log");
});
RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install")+" : "+uploadInput[0].files[0].name);
var data = new FormData();
data.append("tarball",uploadInput[0].files[0]);
var filename = uploadInput[0].files[0].name;
$.ajax({
url: 'nodes',
data: data,
cache: false,
contentType: false,
processData: false,
method: 'POST',
}).always(function(data,textStatus,xhr) {
spinner.remove();
uploadInput.val("");
uploadToolbar.slideUp(200);
}).fail(function(xhr,textStatus,err) {
var message = textStatus;
if (xhr.responseJSON) {
message = xhr.responseJSON.message;
}
var notification = RED.notify(RED._('palette.editor.errors.installFailed',{module: filename,message:message}),{
type: 'error',
modal: true,
fixed: true,
buttons: [
{
text: RED._("common.label.close"),
click: function() {
notification.close();
}
},{
text: RED._("eventLog.view"),
click: function() {
notification.close();
RED.actions.invoke("core:show-event-log");
}
}
]
});
uploadInput.val("");
uploadToolbar.slideUp(200);
})
})
RED.popover.tooltip(uploadButton,RED._("palette.editor.upload"));
}
$('<div id="red-ui-palette-module-install-shade" class="red-ui-palette-module-shade hide"><div class="red-ui-palette-module-shade-status"></div><img src="red/images/spin.svg" class="red-ui-palette-spinner"/></div>').appendTo(installTab);
}
function update(entry,version,url,container,done) {
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
if (RED.settings.theme('palette.editable') === false) {
done(new Error('Palette not editable'));
return;
}
@@ -1075,7 +940,7 @@ RED.palette.editor = (function() {
})
}
function remove(entry,container,done) {
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
if (RED.settings.theme('palette.editable') === false) {
done(new Error('Palette not editable'));
return;
}
@@ -1132,7 +997,7 @@ RED.palette.editor = (function() {
})
}
function install(entry,container,done) {
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
if (RED.settings.theme('palette.editable') === false) {
done(new Error('Palette not editable'));
return;
}

View File

@@ -97,18 +97,13 @@ RED.palette = (function() {
label = RED.utils.sanitize(label);
var words = label.split(/([ -]|\\n )/);
var words = label.split(/[ -]/);
var displayLines = [];
var currentLine = "";
for (var i=0;i<words.length;i++) {
var word = words[i];
if (word === "\\n ") {
displayLines.push(currentLine);
currentLine = "";
continue;
}
var sep = (i == 0) ? "" : " ";
var newWidth = RED.view.calculateTextWidth(currentLine+sep+word, "red-ui-palette-label");
if (newWidth < nodeWidth) {
@@ -152,7 +147,7 @@ RED.palette = (function() {
var popOverContent;
try {
var l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b></p>";
popOverContent = $('<div></div>').append($(l+(info?info:RED.nodes.getNodeHelp(type)||"<p>"+RED._("palette.noInfo")+"</p>").trim())
popOverContent = $('<div></div>').append($(l+(info?info:$("script[data-help-name='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
.filter(function(n) {
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
}).slice(0,2));
@@ -170,16 +165,7 @@ RED.palette = (function() {
metaData = typeInfo.set.module+" : ";
}
metaData += type;
if (/^subflow:/.test(type)) {
$('<button type="button" onclick="RED.workspaces.show(\''+type.substring(8).replace(/'/g,"\\'")+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-pencil"></i></button>').appendTo(popOverContent)
}
var safeType = type.replace(/'/g,"\\'");
$('<button type="button" onclick="RED.search.show(\'type:'+safeType+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-search"></i></button>').appendTo(popOverContent)
$('<button type="button" onclick="RED.sidebar.help.show(\''+safeType+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right; margin-left: 5px;"><i class="fa fa-book"></i></button>').appendTo(popOverContent)
$('<button type="button" onclick="RED.sidebar.help.show(\''+type+'\'); return false;" class="red-ui-button red-ui-button-small" style="float: right"><i class="fa fa-book"></i></button>').appendTo(popOverContent)
$('<p>',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent);
}
} catch(err) {
@@ -278,6 +264,27 @@ RED.palette = (function() {
d.data('popover',popover);
// $(d).popover({
// title:d.type,
// placement:"right",
// trigger: "hover",
// delay: { show: 750, hide: 50 },
// html: true,
// container:'body'
// });
// d.on("click", function() {
// RED.view.focus();
// var helpText;
// if (nt.indexOf("subflow:") === 0) {
// helpText = RED.utils.renderMarkdown(RED.nodes.subflow(nt.substring(8)).info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
// } else {
// helpText = $("script[data-help-name='"+d.attr("data-palette-type")+"']").html()||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
// }
// // Don't look too closely. RED.sidebar.info.set will set the 'Description'
// // section of the sidebar. Pass in the title of the Help section so it looks
// // right.
// RED.sidebar.type.show(helpText,RED._("sidebar.info.nodeHelp"));
// });
var chart = $("#red-ui-workspace-chart");
var chartSVG = $("#red-ui-workspace-chart>svg").get(0);
var activeSpliceLink;
@@ -410,8 +417,7 @@ RED.palette = (function() {
RED.workspaces.show(nt.substring(8));
e.preventDefault();
});
var subflow = RED.nodes.subflow(nt.substring(8));
nodeInfo = RED.utils.renderMarkdown(subflow.info||"");
nodeInfo = RED.utils.renderMarkdown(def.info||"");
}
setLabel(nt,d,label,nodeInfo);

View File

@@ -166,42 +166,34 @@ RED.projects.settings = (function() {
description.find(".red-ui-text-bidi-aware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
}
function editSummary(activeProject, summary, container, version, versionContainer) {
function editSummary(activeProject, summary, container) {
var editButton = container.prev();
editButton.hide();
container.empty();
versionContainer.empty();
var bg = $('<span class="button-row" style="position: relative; float: right; margin-right:0;"></span>').appendTo(container);
var input = $('<input type="text" style="width: calc(100% - 150px); margin-right: 10px;">').val(summary||"").appendTo(container);
var versionInput = $('<input type="text" style="width: calc(100% - 150px); margin-right: 10px;">').val(version||"").appendTo(versionContainer);
$('<button class="red-ui-button">' + RED._("common.label.cancel") + '</button>')
.appendTo(bg)
.on("click", function(evt) {
evt.preventDefault();
updateProjectSummary(activeProject.summary, container);
updateProjectVersion(activeProject.version, versionContainer);
editButton.show();
});
$('<button class="red-ui-button">' + RED._("common.label.save") + '</button>')
.appendTo(bg)
.on("click", function(evt) {
evt.preventDefault();
var newSummary = input.val();
var newVersion = versionInput.val();
updateProjectSummary(newSummary, container);
updateProjectVersion(newVersion, versionContainer);
var spinner = utils.addSpinnerOverlay(container).addClass('red-ui-component-spinner-contain');
var v = input.val();
updateProjectSummary(v, container);
var spinner = utils.addSpinnerOverlay(container);
var done = function(err,res) {
if (err) {
spinner.remove();
return editSummary(activeProject, summary, container, version, versionContainer);
return editSummary(activeProject, summary, container);
}
activeProject.summary = newSummary;
activeProject.version = newVersion;
activeProject.summary = v;
spinner.remove();
updateProjectSummary(activeProject.summary, container);
updateProjectVersion(activeProject.version, versionContainer);
editButton.show();
}
utils.sendRequest({
@@ -222,39 +214,31 @@ RED.projects.settings = (function() {
}
},
}
},{summary:newSummary, version: newVersion});
},{summary:v});
});
}
function updateProjectSummary(summary, container) {
container.empty();
if (summary) {
container.text(summary).removeClass('red-ui-help-info-none');
container.text(summary).removeClass('node-info-node');
} else {
container.text(RED._("sidebar.project.noSummaryAvailable")).addClass('red-ui-help-info-none');
}
}
function updateProjectVersion(version, container) {
container.empty();
if (version) {
container.text(version);
}
}
function createMainPane(activeProject) {
var pane = $('<div id="red-ui-project-settings-tab-main" class="red-ui-project-settings-tab-pane red-ui-help"></div>');
$('<h1>').text(activeProject.name).appendTo(pane);
var summary = $('<div style="position: relative">').appendTo(pane);
var summaryContent = $('<div></div>').appendTo(summary);
var versionContent = $('<div></div>').addClass('red-ui-help-info-none').appendTo(summary);
updateProjectSummary(activeProject.summary, summaryContent);
updateProjectVersion(activeProject.version, versionContent);
if (RED.user.hasPermission("projects.write")) {
$('<button class="red-ui-button red-ui-button-small" style="float: right;">' + RED._('sidebar.project.editDescription') + '</button>')
.prependTo(summary)
.on("click", function(evt) {
evt.preventDefault();
editSummary(activeProject, activeProject.summary, summaryContent, activeProject.version, versionContent);
editSummary(activeProject, activeProject.summary, summaryContent);
});
}
$('<hr>').appendTo(pane);
@@ -465,7 +449,7 @@ RED.projects.settings = (function() {
metaRow = $('<div class="red-ui-palette-module-meta"></div>').appendTo(headerRow);
var buttons = $('<div class="red-ui-palette-module-button-group"></div>').appendTo(metaRow);
if (RED.user.hasPermission("projects.write")) {
if (!entry.installed && RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
if (!entry.installed && RED.settings.theme('palette.editable') !== false) {
$('<a href="#" class="red-ui-button red-ui-button-small">' + RED._("sidebar.project.projectSettings.install") + '</a>').appendTo(buttons)
.on("click", function(evt) {
evt.preventDefault();
@@ -1033,7 +1017,7 @@ RED.projects.settings = (function() {
var credentialSecretExistingRow = $('<div class="red-ui-settings-row red-ui-settings-row-credentials"></div>').appendTo(credentialFormRows);
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.currentKey")).appendTo(credentialSecretExistingRow);
var credentialSecretExistingInput = $('<input type="text">').appendTo(credentialSecretExistingRow).typedInput({type:"cred"})
var credentialSecretExistingInput = $('<input type="password">').appendTo(credentialSecretExistingRow)
.on("change keyup paste",function() {
if (popover) {
popover.close();
@@ -1046,7 +1030,7 @@ RED.projects.settings = (function() {
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.newKey")).appendTo(credentialSecretNewRow);
var credentialSecretNewInput = $('<input type="text">').appendTo(credentialSecretNewRow).typedInput({type:"cred"}).on("change keyup paste",checkFiles);
var credentialSecretNewInput = $('<input type="password">').appendTo(credentialSecretNewRow).on("change keyup paste",checkFiles);
var credentialResetWarning = $('<div class="form-tips form-warning" style="margin: 10px;"><i class="fa fa-warning"></i>' + RED._("sidebar.project.projectSettings.credentialsAlert") + '</div>').hide().appendTo(credentialFormRows);
@@ -1589,6 +1573,8 @@ RED.projects.settings = (function() {
updateForm();
}
function createSettingsPane(activeProject) {
var pane = $('<div id="red-ui-project-settings-tab-settings" class="red-ui-project-settings-tab-pane red-ui-help"></div>');
createFilesSection(activeProject,pane);

View File

@@ -38,36 +38,13 @@ RED.projects.userSettings = (function() {
$('<label for="user-settings-gitconfig-email"></label>').text(RED._("editor:sidebar.project.userSettings.email")).appendTo(row);
gitEmailInput = $('<input type="text" id="user-settings-gitconfig-email">').appendTo(row);
gitEmailInput.val(currentGitSettings.user.email||"");
}
function createWorkflowSection(pane) {
var defaultWorkflowMode = RED.settings.theme("projects.workflow.mode","manual");
var currentGitSettings = RED.settings.get('git') || {};
currentGitSettings.workflow = currentGitSettings.workflow || {};
currentGitSettings.workflow.mode = currentGitSettings.workflow.mode || defaultWorkflowMode;
var title = $('<h3></h3>').text(RED._("editor:sidebar.project.userSettings.workflow")).appendTo(pane);
var workflowContainer = $('<div class="red-ui-settings-section"></div>').appendTo(pane);
$('<div class="red-ui-settings-section-description"></div>').appendTo(workflowContainer).text(RED._("editor:sidebar.project.userSettings.workfowTip"));
var row = $('<div class="red-ui-settings-row"></div>').appendTo(workflowContainer);
$('<label><input type="radio" name="user-setting-gitworkflow" value="manual"> <div style="margin-left: 3px; display: inline-block"><div data-i18n="editor:sidebar.project.userSettings.workflowManual"></div><div style="color:#aaa;" data-i18n="editor:sidebar.project.userSettings.workflowManualTip"></div></div></label>').appendTo(row);
row = $('<div class="red-ui-settings-row"></div>').appendTo(workflowContainer);
$('<label><input type="radio" name="user-setting-gitworkflow" value="auto"> <div style="margin-left: 3px; display: inline-block"><div data-i18n="editor:sidebar.project.userSettings.workflowAuto"></div><div style="color:#aaa;" data-i18n="editor:sidebar.project.userSettings.workflowAutoTip"></div></div></label>').appendTo(row);
workflowContainer.find('[name="user-setting-gitworkflow"][type="radio"][value="'+currentGitSettings.workflow.mode+'"]').prop('checked',true)
}
function createSSHKeySection(pane) {
var title = $('<h3></h3>').text(RED._("editor:sidebar.project.userSettings.sshKeys")).appendTo(pane);
var container = $('<div class="red-ui-settings-section"></div>').appendTo(pane);
var popover;
var title = $('<h3></h3>').text(RED._("editor:sidebar.project.userSettings.sshKeys")).appendTo(container);
var subtitle = $('<div class="red-ui-settings-section-description"></div>').appendTo(container).text(RED._("editor:sidebar.project.userSettings.sshKeysTip"));
var addKeyButton = $('<button id="user-settings-gitconfig-add-key" class="red-ui-button red-ui-button-small" style="float: right; margin-right: 10px;">'+RED._("editor:sidebar.project.userSettings.add")+'</button>')
@@ -414,7 +391,6 @@ RED.projects.userSettings = (function() {
function createSettingsPane(activeProject) {
var pane = $('<div id="red-ui-settings-tab-gitconfig" class="project-settings-tab-pane red-ui-help"></div>');
createGitUserSection(pane);
createWorkflowSection(pane);
createSSHKeySection(pane);
return pane;
}
@@ -431,9 +407,6 @@ RED.projects.userSettings = (function() {
currentGitSettings.user = currentGitSettings.user || {};
currentGitSettings.user.name = gitUsernameInput.val();
currentGitSettings.user.email = gitEmailInput.val();
currentGitSettings.workflow = currentGitSettings.workflow || {};
currentGitSettings.workflow.mode = $('[name="user-setting-gitworkflow"][type="radio"]:checked').val()
RED.settings.set('git', currentGitSettings);
}
});

View File

@@ -81,8 +81,8 @@ RED.projects = (function() {
$('<p>').text(RED._("projects.welcome.desc2")).appendTo(body);
var row = $('<div style="text-align: center"></div>').appendTo(body);
var createAsEmpty = $('<button data-type="empty" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-asterisk"></i><br/>'+RED._("projects.welcome.create")+'</button>').appendTo(row);
var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-git"></i><br/>'+RED._("projects.welcome.clone")+'</button>').appendTo(row);
var createAsEmpty = $('<button data-type="empty" class="red-ui-button red-ui-projects-dialog-screen-create-type"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-asterisk"></i><br/>'+RED._("projects.welcome.create")+'</button>').appendTo(row);
var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-screen-create-type"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-git"></i><br/>'+RED._("projects.welcome.clone")+'</button>').appendTo(row);
createAsEmpty.on("click", function(e) {
e.preventDefault();
@@ -511,8 +511,7 @@ RED.projects = (function() {
subrow = $('<div style="width: calc(50% - 10px); margin-left: 20px; display:inline-block;"></div>').appendTo(row);
$('<label for="red-ui-projects-dialog-screen-create-project-repo-pass">'+RED._("projects.clone-project.passwd")+'</label>').appendTo(subrow);
projectRepoPasswordInput = $('<input style="width:100%" id="red-ui-projects-dialog-screen-create-project-repo-pass" type="password"></input>').appendTo(subrow);
projectRepoPasswordInput.typedInput({type:"cred"});
projectRepoPasswordInput = $('<input id="red-ui-projects-dialog-screen-create-project-repo-pass" type="password"></input>').appendTo(subrow);
// -----------------------------------------------------
// Repo credentials - key/passphrase -------------------
@@ -540,12 +539,12 @@ RED.projects = (function() {
subrow = $('<div style="width: calc(50% - 10px); margin-left: 20px; display:inline-block;"></div>').appendTo(row);
$('<label for="red-ui-projects-dialog-screen-create-project-repo-passphrase">'+RED._("projects.clone-project.passphrase")+'</label>').appendTo(subrow);
projectRepoPassphrase = $('<input id="red-ui-projects-dialog-screen-create-project-repo-passphrase" type="password"></input>').appendTo(subrow);
projectRepoPassphrase.typedInput({type:"cred"});
subrow = $('<div class="form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-sshkey"></div>').appendTo(cloneAuthRows);
var sshwarningRow = $('<div class="red-ui-projects-dialog-screen-create-row-auth-error-no-keys"></div>').hide().appendTo(subrow);
$('<div class="form-row"><i class="fa fa-warning"></i> '+RED._("projects.clone-project.ssh-key-desc")+'</div>').appendTo(sshwarningRow);
subrow = $('<div style="text-align: center">').appendTo(sshwarningRow);
$('<button class="red-ui-button red-ui-projects-dialog-button">'+RED._("projects.clone-project.ssh-key-add")+'</button>').appendTo(subrow).on("click", function(e) {
$('<button class="red-ui-button">'+RED._("projects.clone-project.ssh-key-add")+'</button>').appendTo(subrow).on("click", function(e) {
e.preventDefault();
dialog.dialog( "close" );
RED.userSettings.show('gitconfig');
@@ -559,8 +558,8 @@ RED.projects = (function() {
// Secret - clone
row = $('<div class="form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-clone"></div>').appendTo(body);
$('<label>'+RED._("projects.clone-project.credential-key")+'</label>').appendTo(row);
projectSecretInput = $('<input style="width: 100%" type="password"></input>').appendTo(row);
projectSecretInput.typedInput({type:"cred"});
projectSecretInput = $('<input type="password"></input>').appendTo(row);
return container;
@@ -895,7 +894,6 @@ RED.projects = (function() {
$('<label class="red-ui-projects-edit-form-inline-label" style="margin-left: 5px"><input type="radio" style="vertical-align: middle; margin-top:0; margin-right: 10px;" value="custom" name="projects-encryption-key"> <span style="vertical-align: middle;">'+RED._("projects.encryption-config.use-custom")+'</span></label>').appendTo(row);
row = $('<div class="projects-encryption-enabled-row"></div>').appendTo(credentialsRightBox);
emptyProjectCredentialInput = $('<input disabled type="password" style="margin-left: 25px; width: calc(100% - 30px);"></input>').appendTo(row);
emptyProjectCredentialInput.typedInput({type:"cred"});
emptyProjectCredentialInput.on("change keyup paste", validateForm);
row = $('<div class="form-row projects-encryption-disabled-row"></div>').hide().appendTo(credentialsRightBox);
@@ -1171,11 +1169,11 @@ RED.projects = (function() {
row = $('<div class="form-row button-group"></div>').appendTo(container);
var openProject = $('<button data-type="open" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-folder-open"></i><br/>'+RED._("projects.create.open")+'</button>').appendTo(row);
var createAsEmpty = $('<button data-type="empty" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-asterisk"></i><br/>'+RED._("projects.create.create")+'</button>').appendTo(row);
// var createAsCopy = $('<button data-type="copy" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i class="fa fa-long-arrow-right fa-2x"></i><i class="fa fa-archive fa-2x"></i><br/>Copy existing</button>').appendTo(row);
var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-git"></i><br/>'+RED._("projects.create.clone")+'</button>').appendTo(row);
// var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-git fa-2x"></i><i class="fa fa-arrows-h fa-2x"></i><i class="fa fa-archive fa-2x"></i><br/>Clone Repository</button>').appendTo(row);
var openProject = $('<button data-type="open" class="red-ui-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-folder-open"></i><br/>'+RED._("projects.create.open")+'</button>').appendTo(row);
var createAsEmpty = $('<button data-type="empty" class="red-ui-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-asterisk"></i><br/>'+RED._("projects.create.create")+'</button>').appendTo(row);
// var createAsCopy = $('<button data-type="copy" class="red-ui-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i class="fa fa-long-arrow-right fa-2x"></i><i class="fa fa-archive fa-2x"></i><br/>Copy existing</button>').appendTo(row);
var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-archive fa-2x"></i><i style="position: absolute;" class="fa fa-git"></i><br/>'+RED._("projects.create.clone")+'</button>').appendTo(row);
// var createAsClone = $('<button data-type="clone" class="red-ui-button red-ui-projects-dialog-screen-create-type toggle"><i class="fa fa-git fa-2x"></i><i class="fa fa-arrows-h fa-2x"></i><i class="fa fa-archive fa-2x"></i><br/>Clone Repository</button>').appendTo(row);
row.find(".red-ui-projects-dialog-screen-create-type").on("click", function(evt) {
evt.preventDefault();
container.find(".red-ui-projects-dialog-screen-create-type").removeClass('selected');
@@ -1300,7 +1298,6 @@ RED.projects = (function() {
$('<label class="red-ui-projects-edit-form-inline-label">'+RED._("projects.create.encryption-key")+'</label>').appendTo(row);
// row = $('<div class="projects-encryption-enabled-row"></div>').appendTo(credentialsRightBox);
emptyProjectCredentialInput = $('<input type="password"></input>').appendTo(row);
emptyProjectCredentialInput.typedInput({type:"cred"});
emptyProjectCredentialInput.on("change keyup paste", validateForm);
$('<label class="red-ui-projects-edit-form-sublabel"><small>'+RED._("projects.create.desc0")+'</small></label>').appendTo(row);
@@ -1359,8 +1356,7 @@ RED.projects = (function() {
subrow = $('<div style="width: calc(50% - 10px); margin-left: 20px; display:inline-block;"></div>').appendTo(row);
$('<label for="red-ui-projects-dialog-screen-create-project-repo-pass">'+RED._("projects.create.password")+'</label>').appendTo(subrow);
projectRepoPasswordInput = $('<input style="width:100%" id="red-ui-projects-dialog-screen-create-project-repo-pass" type="password"></input>').appendTo(subrow);
projectRepoPasswordInput.typedInput({type:"cred"});
projectRepoPasswordInput = $('<input id="red-ui-projects-dialog-screen-create-project-repo-pass" type="password"></input>').appendTo(subrow);
// -----------------------------------------------------
// Repo credentials - key/passphrase -------------------
@@ -1388,13 +1384,12 @@ RED.projects = (function() {
subrow = $('<div style="width: calc(50% - 10px); margin-left: 20px; display:inline-block;"></div>').appendTo(row);
$('<label for="red-ui-projects-dialog-screen-create-project-repo-passphrase">'+RED._("projects.create.passphrase")+'</label>').appendTo(subrow);
projectRepoPassphrase = $('<input id="red-ui-projects-dialog-screen-create-project-repo-passphrase" type="password"></input>').appendTo(subrow);
projectRepoPassphrase.typedInput({type:"cred"});
subrow = $('<div class="form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-sshkey"></div>').appendTo(cloneAuthRows);
var sshwarningRow = $('<div class="red-ui-projects-dialog-screen-create-row-auth-error-no-keys"></div>').hide().appendTo(subrow);
$('<div class="form-row"><i class="fa fa-warning"></i> '+RED._("projects.create.desc2")+'</div>').appendTo(sshwarningRow);
subrow = $('<div style="text-align: center">').appendTo(sshwarningRow);
$('<button class="red-ui-button red-ui-projects-dialog-button">'+RED._("projects.create.add-ssh-key")+'</button>').appendTo(subrow).on("click", function(e) {
$('<button class="red-ui-button">'+RED._("projects.create.add-ssh-key")+'</button>').appendTo(subrow).on("click", function(e) {
e.preventDefault();
$('#red-ui-projects-dialog-cancel').trigger("click");
RED.userSettings.show('gitconfig');
@@ -1408,8 +1403,8 @@ RED.projects = (function() {
// Secret - clone
row = $('<div class="hide form-row red-ui-projects-dialog-screen-create-row red-ui-projects-dialog-screen-create-row-clone"></div>').appendTo(container);
$('<label>'+RED._("projects.create.credentials-encryption-key")+'</label>').appendTo(row);
projectSecretInput = $('<input style="width:100%" type="password"></input>').appendTo(row);
projectSecretInput.typedInput({type:"cred"});
projectSecretInput = $('<input type="password"></input>').appendTo(row);
switch(options.screen||"empty") {
case "empty": createAsEmpty.trigger("click"); break;
@@ -1606,11 +1601,6 @@ RED.projects = (function() {
done(null,data);
},
400: {
'credentials_load_failed': function(data) {
dialog.dialog( "close" );
RED.events.emit("project:change", {name:name});
done(null,data);
},
'*': done
},
}
@@ -1625,16 +1615,25 @@ RED.projects = (function() {
}
function deleteProject(row,name,done) {
var cover = $('<div class="red-ui-projects-dialog-project-list-entry-delete-confirm"></div>').on("click", function(evt) { evt.stopPropagation(); }).appendTo(row);
$('<span>').text(RED._("projects.delete.confirm")).appendTo(cover);
$('<button class="red-ui-button red-ui-projects-dialog-button">'+RED._("common.label.cancel")+'</button>')
var cover = $('<div>').css({
background:"white",
position:"absolute",
top:0,right:0,bottom:0,left:"100%",
overflow:"hidden",
padding: "5px 20px",
transition: "left 0.4s",
whitespace: "nowrap",
width:"1000px"
}).on("click", function(evt) { evt.stopPropagation(); }).appendTo(row);
$('<span>').css({"lineHeight":"40px"}).text(RED._("projects.delete.confirm")).appendTo(cover);
$('<button style="margin-left:20px" class="red-ui-button">'+RED._("common.label.cancel")+'</button>')
.appendTo(cover)
.on("click", function(e) {
e.stopPropagation();
cover.remove();
done(true);
});
$('<button class="red-ui-button red-ui-projects-dialog-button primary">'+RED._("common.label.delete")+'</button>')
$('<button style="margin-left:20px" class="red-ui-button primary">'+RED._("common.label.delete")+'</button>')
.appendTo(cover)
.on("click", function(e) {
e.stopPropagation();
@@ -1818,7 +1817,7 @@ RED.projects = (function() {
header.addClass("selectable");
var tools = $('<div class="red-ui-projects-dialog-project-list-entry-tools"></div>').appendTo(header);
$('<button class="red-ui-button red-ui-projects-dialog-button red-ui-button-small" style="float: right;"><i class="fa fa-trash"></i></button>')
$('<button class="red-ui-button red-ui-button-small" style="float: right;"><i class="fa fa-trash"></i></button>')
.appendTo(tools)
.on("click", function(e) {
e.stopPropagation();
@@ -1972,8 +1971,7 @@ RED.projects = (function() {
var isSSH = false;
if (/^https?:\/\//.test(url)) {
$('<div class="form-row"><label for="projects-user-auth-username">'+RED._("projects.send-req.username")+'</label><input id="projects-user-auth-username" type="text"></input></div>'+
'<div class="form-row"><label for="projects-user-auth-password">'+RED._("projects.send-req.password")+'</label><input id="projects-user-auth-password" type="password"></input></div>').appendTo(message);
message.find("#projects-user-auth-password").typedInput({type:"cred"})
'<div class="form-row"><label for=projects-user-auth-password">'+RED._("projects.send-req.password")+'</label><input id="projects-user-auth-password" type="password"></input></div>').appendTo(message);
} else if (/^(?:ssh|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?/.test(url)) {
isSSH = true;
var row = $('<div class="form-row"></div>').appendTo(message);
@@ -1991,7 +1989,7 @@ RED.projects = (function() {
});
row = $('<div class="form-row"></div>').appendTo(message);
$('<label for="projects-user-auth-passphrase">'+RED._("projects.send-req.passphrase")+'</label>').appendTo(row);
$('<input id="projects-user-auth-passphrase" type="password"></input>').appendTo(row).typedInput({type:"cred"});
$('<input id="projects-user-auth-passphrase" type="password"></input>').appendTo(row);
}
var notification = RED.notify(message,{
@@ -2274,12 +2272,6 @@ RED.projects = (function() {
autoOpen: false,
width: 600,
resizable: false,
open: function(e) {
RED.keyboard.disable();
},
close: function(e) {
RED.keyboard.enable();
},
classes: {
"ui-dialog": "red-ui-editor-dialog",
"ui-dialog-titlebar-close": "hide",

View File

@@ -293,23 +293,14 @@ RED.sidebar.versionControl = (function() {
if (activeProject) {
// TODO: this is a full refresh of the files - should be able to
// just do an incremental refresh
allChanges = {};
unstagedChangesList.editableList('empty');
stagedChangesList.editableList('empty');
unmergedChangesList.editableList('empty');
// Get the default workflow mode from theme settings
var defaultWorkflowMode = RED.settings.theme("projects.workflow.mode","manual");
// Check for the user-defined choice of mode
var workflowMode = ((RED.settings.get('git') || {}).workflow || {}).mode || defaultWorkflowMode;
if (workflowMode === 'auto') {
refresh(true);
} else {
allChanges = {};
unstagedChangesList.editableList('empty');
stagedChangesList.editableList('empty');
unmergedChangesList.editableList('empty');
$.getJSON("projects/"+activeProject.name+"/status",function(result) {
refreshFiles(result);
});
}
$.getJSON("projects/"+activeProject.name+"/status",function(result) {
refreshFiles(result);
});
}
});
RED.events.on("login",function() {

View File

@@ -83,7 +83,7 @@ RED.search = (function() {
// flagName:XYZ
var regEx = new RegExp("(?:^| )"+flagName+":([^ ]+)(?: |$)");
var m
while(!!(m = regEx.exec(val))) {
while(m = regEx.exec(val)) {
val = val.replace(regEx," ").trim();
flags[flagName] = flags[flagName] || [];
flags[flagName].push(m[1]);
@@ -93,7 +93,7 @@ RED.search = (function() {
function search(val) {
var results = [];
var keys = [];
var keys = Object.keys(index);
var typeFilter;
var m = /(?:^| )type:([^ ]+)/.exec(val);
if (m) {
@@ -118,11 +118,6 @@ RED.search = (function() {
var j;
var list = [];
var nodes = {};
if (flags.uses) {
keys = flags.uses;
} else {
keys = Object.keys(index);
}
for (i=0;i<keys.length;i++) {
var key = keys[i];
var kpos = keys[i].indexOf(val);
@@ -131,9 +126,6 @@ RED.search = (function() {
for (j=0;j<ids.length;j++) {
var node = index[key][ids[j]];
var isConfigNode = node.node._def.category === "config" && node.node.type !== 'group';
if (flags.uses && key === node.node.id) {
continue;
}
if (flags.hasOwnProperty("invalid")) {
var nodeIsValid = !node.node.hasOwnProperty("valid") || node.node.valid;
if (flags.invalid === nodeIsValid) {

View File

@@ -195,9 +195,6 @@ RED.sidebar = (function() {
}
function showSidebar(id) {
if (id === ":first") {
id = RED.settings.get("editor.sidebar.order",["info", "help", "version-control", "debug"])[0]
}
if (id) {
if (!containsTab(id)) {
sidebar_tabs.addTab(knownTabs[id]);
@@ -235,11 +232,7 @@ RED.sidebar = (function() {
}
},
// minimumActiveTabWidth: 70,
collapsible: true,
onreorder: function(order) {
RED.settings.set("editor.sidebar.order",order);
},
order: RED.settings.get("editor.sidebar.order",["info", "help", "version-control", "debug"])
collapsible: true
// scrollable: true
});

View File

@@ -47,37 +47,6 @@ RED.subflow = (function() {
'</div>'+
'</script>';
var _subflowModulePaneTemplate = '<form class="dialog-form form-horizontal" autocomplete="off">'+
'<div class="form-row">'+
'<label for="subflow-input-module-module" data-i18n="[append]editor:subflow.module"><i class="fa fa-cube"></i> </label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-module" data-i18n="[placeholder]common.label.name">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-type" data-i18n="[append]editor:subflow.type"> </label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-type">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-version" data-i18n="[append]editor:subflow.version"></label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-version" data-i18n="[placeholder]editor:subflow.versionPlaceholder">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-desc" data-i18n="[append]editor:subflow.desc"></label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-desc">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-license" data-i18n="[append]editor:subflow.license"></label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-license">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-author" data-i18n="[append]editor:subflow.author"></label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-author" data-i18n="[placeholder]editor:subflow.authorPlaceholder">'+
'</div>'+
'<div class="form-row">'+
'<label for="subflow-input-module-keywords" data-i18n="[append]editor:subflow.keys"></label>'+
'<input style="width: calc(100% - 110px)" type="text" id="subflow-input-module-keywords" data-i18n="[placeholder]editor:subflow.keysPlaceholder">'+
'</div>'+
'</form>';
function findAvailableSubflowIOPosition(subflow,isInput) {
var pos = {x:50,y:30};
if (!isInput) {
@@ -464,43 +433,12 @@ RED.subflow = (function() {
$("#red-ui-subflow-delete").on("click", function(event) {
event.preventDefault();
var subflow = RED.nodes.subflow(RED.workspaces.active());
if (subflow.instances.length > 0) {
var msg = $('<div>')
$('<p>').text(RED._("subflow.subflowInstances",{count: subflow.instances.length})).appendTo(msg);
$('<p>').text(RED._("subflow.confirmDelete")).appendTo(msg);
var confirmDeleteNotification = RED.notify(msg, {
modal: true,
fixed: true,
buttons: [
{
text: RED._('common.label.cancel'),
click: function() {
confirmDeleteNotification.close();
}
},
{
text: RED._('workspace.confirmDelete'),
class: "primary",
click: function() {
confirmDeleteNotification.close();
completeDelete();
}
}
]
});
var startDirty = RED.nodes.dirty();
var historyEvent = removeSubflow(RED.workspaces.active());
historyEvent.t = 'delete';
historyEvent.dirty = startDirty;
return;
} else {
completeDelete();
}
function completeDelete() {
var startDirty = RED.nodes.dirty();
var historyEvent = removeSubflow(RED.workspaces.active());
historyEvent.t = 'delete';
historyEvent.dirty = startDirty;
RED.history.push(historyEvent);
}
RED.history.push(historyEvent);
});
@@ -515,16 +453,14 @@ RED.subflow = (function() {
$("#red-ui-workspace-chart").css({"margin-top": "0"});
}
function removeSubflow(id, keepInstanceNodes) {
// TODO: A lot of this logic is common with RED.nodes.removeWorkspace
function removeSubflow(id) {
var removedNodes = [];
var removedLinks = [];
var removedGroups = [];
var activeSubflow = RED.nodes.subflow(id);
RED.nodes.eachNode(function(n) {
if (!keepInstanceNodes && n.type == "subflow:"+id) {
if (n.type == "subflow:"+id) {
removedNodes.push(n);
}
if (n.z == id) {
@@ -536,9 +472,7 @@ RED.subflow = (function() {
removedNodes.push(n);
}
});
RED.nodes.groups(id).forEach(function(n) {
removedGroups.push(n);
})
var removedConfigNodes = [];
for (var i=0;i<removedNodes.length;i++) {
var removedEntities = RED.nodes.remove(removedNodes[i].id);
@@ -548,18 +482,6 @@ RED.subflow = (function() {
// TODO: this whole delete logic should be in RED.nodes.removeSubflow..
removedNodes = removedNodes.concat(removedConfigNodes);
removedGroups = RED.nodes.groups(id).filter(function(g) { return !g.g; });
for (i=0;i<removedGroups.length;i++) {
removedGroups[i].nodes.forEach(function(n) {
if (n.type === "group") {
removedGroups.push(n);
}
});
}
// Now remove them in the reverse order
for (i=removedGroups.length-1; i>=0; i--) {
RED.nodes.removeGroup(removedGroups[i]);
}
RED.nodes.removeSubflow(activeSubflow);
RED.workspaces.remove(activeSubflow);
RED.nodes.dirty(true);
@@ -568,7 +490,6 @@ RED.subflow = (function() {
return {
nodes:removedNodes,
links:removedLinks,
groups: removedGroups,
subflows: [activeSubflow]
}
}
@@ -1055,7 +976,6 @@ RED.subflow = (function() {
icon: "",
type: "cred"
}
opt.ui.type = "cred";
} else {
opt.ui = opt.ui || {
icon: "",
@@ -1245,7 +1165,11 @@ RED.subflow = (function() {
default: DEFAULT_ENV_TYPE_LIST,
valueLabel: function(container,value) {
container.css("padding",0);
var innerContainer = $('<div class="red-ui-editor-subflow-env-input-type"></div>').appendTo(container);
var innerContainer = $('<div>').css({
"background":"white",
"height":"100%",
"box-sizing": "border-box"
}).appendTo(container);
var input = $('<div class="placeholder-input">').appendTo(innerContainer);
$('<span><i class="fa fa-i-cursor"></i></span>').appendTo(input);
@@ -1259,7 +1183,10 @@ RED.subflow = (function() {
}
})
} else {
$('<span class="red-ui-editor-subflow-env-input-type-placeholder"></span>').text(RED._("editor.selectType")).appendTo(input);
$("<span>").css({
"color":"#aaa",
"padding-left": "4px"
}).text("select types...").appendTo(input);
}
}
},
@@ -1268,7 +1195,10 @@ RED.subflow = (function() {
label: RED._("typedInput.type.cred"), icon:"fa fa-lock", showLabel: false,
valueLabel: function(container,value) {
container.css("padding",0);
var innerContainer = $('<div class="red-ui-editor-subflow-env-input-type">').css({
var innerContainer = $('<div>').css({
"background":"white",
"height":"100%",
"box-sizing": "border-box",
"border-top-right-radius": "4px",
"border-bottom-right-radius": "4px"
}).appendTo(container);
@@ -1413,7 +1343,11 @@ RED.subflow = (function() {
label:RED._("editor.inputs.spinner"), icon:"fa fa-sort-numeric-asc", showLabel:false,
valueLabel: function(container,value) {
container.css("padding",0);
var innerContainer = $('<div class="red-ui-editor-subflow-env-input-type"></div>').appendTo(container);
var innerContainer = $('<div>').css({
"background":"white",
"height":"100%",
"box-sizing": "border-box"
}).appendTo(container);
var input = $('<div class="placeholder-input">').appendTo(innerContainer);
$('<span><i class="fa fa-sort-numeric-asc"></i></span>').appendTo(input);
@@ -1518,8 +1452,7 @@ RED.subflow = (function() {
}).on("change", function(evt,type) {
if (ui.type === 'input') {
var types = inputCellInput.typedInput('value');
ui.opts.types = (types === "") ? ["str"] : types.split(",");
ui.opts.types = inputCellInput.typedInput('value').split(",");
valueField.typedInput('types',ui.opts.types);
}
});
@@ -1551,7 +1484,6 @@ RED.subflow = (function() {
var locale = RED.i18n.lang();
var labelText = lookupLabel(labels, labels["en-US"]||tenv.name, locale);
var label = $('<label>').appendTo(row);
$('<span>&nbsp;</span>').appendTo(row);
var labelContainer = $('<span></span>').appendTo(label);
if (ui.icon) {
var newPath = RED.utils.separateIconPath(ui.icon);
@@ -1787,54 +1719,22 @@ RED.subflow = (function() {
parentEnv[env.name] = item;
})
}
if (node.env) {
for (var i = 0; i < node.env.length; i++) {
var env = node.env[i];
if (parentEnv.hasOwnProperty(env.name)) {
parentEnv[env.name].type = env.type;
parentEnv[env.name].value = env.value;
} else {
// envList.push({
// name: env.name,
// type: env.type,
// value: env.value,
// });
}
}
if (node.env) {
for (var i = 0; i < node.env.length; i++) {
var env = node.env[i];
if (parentEnv.hasOwnProperty(env.name)) {
parentEnv[env.name].type = env.type;
parentEnv[env.name].value = env.value;
} else {
// envList.push({
// name: env.name,
// type: env.type,
// value: env.value,
// });
}
}
} else if (node._def.subflowModule) {
var keys = Object.keys(node._def.defaults);
keys.forEach(function(name) {
if (name !== 'name') {
var prop = node._def.defaults[name];
var nodeProp = node[name];
var nodePropType;
var nodePropValue = nodeProp;
if (prop.ui && prop.ui.type === "cred") {
nodePropType = "cred";
} else {
switch(typeof nodeProp) {
case "string": nodePropType = "str"; break;
case "number": nodePropType = "num"; break;
case "boolean": nodePropType = "bool"; nodePropValue = nodeProp?"true":"false"; break;
default:
nodePropType = nodeProp.type;
nodePropValue = nodeProp.value;
}
}
var item = {
name: name,
type: nodePropType,
value: nodePropValue,
parent: {
type: prop.type,
value: prop.value
},
ui: $.extend(true,{},prop.ui)
}
envList.push(item);
}
})
}
return envList;
}
@@ -1955,126 +1855,6 @@ RED.subflow = (function() {
buildPropertiesList(list, node);
}
function setupInputValidation(input,validator) {
var errorTip;
var validateTimeout;
var validateFunction = function() {
if (validateTimeout) {
return;
}
validateTimeout = setTimeout(function() {
var error = validator(input.val());
// if (!error && errorTip) {
// errorTip.close();
// errorTip = null;
// } else if (error && !errorTip) {
// errorTip = RED.popover.create({
// tooltip: true,
// target:input,
// size: "small",
// direction: "bottom",
// content: error,
// }).open();
// }
input.toggleClass("input-error",!!error);
validateTimeout = null;
})
}
input.on("change keyup paste", validateFunction);
}
function buildModuleForm(container, node) {
$(_subflowModulePaneTemplate).appendTo(container);
var moduleProps = node.meta || {};
[
'module',
'type',
'version',
'author',
'desc',
'keywords',
'license'
].forEach(function(property) {
$("#subflow-input-module-"+property).val(moduleProps[property]||"")
})
$("#subflow-input-module-type").attr("placeholder",node.id);
setupInputValidation($("#subflow-input-module-module"), function(newValue) {
newValue = newValue.trim();
var isValid = newValue.length < 215;
isValid = isValid && !/^[._]/.test(newValue);
isValid = isValid && !/[A-Z]/.test(newValue);
if (newValue !== encodeURIComponent(newValue)) {
var m = /^@([^\/]+)\/([^\/]+)$/.exec(newValue);
if (m) {
isValid = isValid && (m[1] === encodeURIComponent(m[1]) && m[2] === encodeURIComponent(m[2]))
} else {
isValid = false;
}
}
return isValid?"":"Invalid module name"
})
setupInputValidation($("#subflow-input-module-version"), function(newValue) {
newValue = newValue.trim();
var isValid = newValue === "" ||
/^(\d|[1-9]\d*)\.(\d|[1-9]\d*)\.(\d|[1-9]\d*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9A-Za-z-][0-9A-Za-z-]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/.test(newValue);
return isValid?"":"Invalid version number"
})
var licenses = ["none", "Apache-2.0", "BSD-3-Clause", "BSD-2-Clause", "GPL-2.0", "GPL-3.0", "MIT", "MPL-2.0", "CDDL-1.0", "EPL-2.0"];
var typedLicenses = {
types: licenses.map(function(l) {
return {
value: l,
label: l === "none" ? RED._("editor:subflow.licenseNone") : l,
hasValue: false
};
})
}
typedLicenses.types.push({
value:"_custom_", label:RED._("editor:subflow.licenseOther"), icon:"red/images/typedInput/az.svg"
})
if (!moduleProps.license) {
typedLicenses.default = "none";
} else if (licenses.indexOf(moduleProps.license) > -1) {
typedLicenses.default = moduleProps.license;
} else {
typedLicenses.default = "_custom_";
}
$("#subflow-input-module-license").typedInput(typedLicenses)
}
function exportSubflowModuleProperties(node) {
var value;
var moduleProps = {};
[
'module',
'type',
'version',
'author',
'desc',
'keywords'
].forEach(function(property) {
value = $("#subflow-input-module-"+property).val().trim();
if (value) {
moduleProps[property] = value;
}
})
var selectedLicenseType = $("#subflow-input-module-license").typedInput("type");
if (selectedLicenseType === '_custom_') {
value = $("#subflow-input-module-license").val();
if (value) {
moduleProps.license = value;
}
} else if (selectedLicenseType !== "none") {
moduleProps.license = selectedLicenseType;
}
return moduleProps;
}
return {
init: init,
createSubflow: createSubflow,
@@ -2088,11 +1868,9 @@ RED.subflow = (function() {
buildEditForm: buildEditForm,
buildPropertiesForm: buildPropertiesForm,
buildModuleForm: buildModuleForm,
exportSubflowTemplateEnv: exportEnvList,
exportSubflowInstanceEnv: exportSubflowInstanceEnv,
exportSubflowModuleProperties: exportSubflowModuleProperties
exportSubflowInstanceEnv: exportSubflowInstanceEnv
}
})();

View File

@@ -247,7 +247,7 @@ RED.sidebar.help = (function() {
helpText = (RED.utils.renderMarkdown(subflowNode.info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>'));
title = subflowNode.name || nodeType;
} else {
helpText = RED.nodes.getNodeHelp(nodeType)||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
helpText = $("script[data-help-name='"+nodeType+"']").html()||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
title = nodeType;
}
setInfoText(title, helpText, helpSection);
@@ -261,12 +261,10 @@ RED.sidebar.help = (function() {
}
function show(type, bringToFront) {
if (bringToFront !== false) {
RED.sidebar.show("help");
}
function show(type) {
RED.sidebar.show("help");
if (type) {
// hideTOC();
hideTOC();
showHelp(type);
}
resizeStack();

View File

@@ -30,7 +30,6 @@ RED.sidebar.info.outliner = (function() {
},
{
id: "__global__",
flow: "__global__",
label: RED._("sidebar.info.globalConfig"),
types: {},
children: [
@@ -79,7 +78,7 @@ RED.sidebar.info.outliner = (function() {
try {
label = (typeof n._def.label === "function" ? n._def.label.call(n) : n._def.label)||"";
} catch(err) {
console.log("Definition error: "+n.type+".label",err);
console.log("Definition error: "+type+".label",err);
}
}
var newlineIndex = label.indexOf("\\n");
@@ -119,17 +118,34 @@ RED.sidebar.info.outliner = (function() {
return div;
}
function getSubflowLabel(n) {
var div = $('<div>',{class:"red-ui-info-outline-item"});
RED.utils.createNodeIcon(n).appendTo(div);
var contentDiv = $('<div>',{class:"red-ui-search-result-description"}).appendTo(div);
var labelText = getNodeLabelText(n);
var label = $('<div>',{class:"red-ui-search-result-node-label red-ui-info-outline-item-label"}).appendTo(contentDiv);
if (labelText) {
label.text(labelText)
} else {
label.html("&nbsp;")
}
addControls(n, div);
return div;
// var div = $('<div>',{class:"red-ui-info-outline-item red-ui-info-outline-item-flow"});
// var contentDiv = $('<div>',{class:"red-ui-search-result-description red-ui-info-outline-item-label"}).appendTo(div);
// contentDiv.text(n.name || n.id);
// addControls(n, div);
// return div;
}
function addControls(n,div) {
var controls = $('<div>',{class:"red-ui-info-outline-item-controls red-ui-info-outline-item-hover-controls"}).appendTo(div);
if (n.type === "subflow") {
var subflowInstanceBadge = $('<button type="button" class="red-ui-info-outline-item-control-users red-ui-button red-ui-button-small"><i class="fa fa-toggle-right"></i></button>').text(n.instances.length).appendTo(controls).on("click",function(evt) {
evt.preventDefault();
evt.stopPropagation();
RED.search.show("type:subflow:"+n.id);
})
// RED.popover.tooltip(userCountBadge,function() { return RED._('editor.nodesUse',{count:n.users.length})});
}
if (n._def.category === "config" && n.type !== "group") {
var userCountBadge = $('<button type="button" class="red-ui-info-outline-item-control-users red-ui-button red-ui-button-small"><i class="fa fa-toggle-right"></i></button>').text(n.users.length).appendTo(controls).on("click",function(evt) {
evt.preventDefault();
@@ -152,7 +168,7 @@ RED.sidebar.info.outliner = (function() {
// evt.stopPropagation();
// RED.view.reveal(n.id);
// })
if (n.type !== 'subflow') {
if (n.type !== 'group' && n.type !== 'subflow') {
var toggleButton = $('<button type="button" class="red-ui-info-outline-item-control-disable red-ui-button red-ui-button-small"><i class="fa fa-circle-thin"></i><i class="fa fa-ban"></i></button>').appendTo(controls).on("click",function(evt) {
evt.preventDefault();
evt.stopPropagation();
@@ -162,46 +178,6 @@ RED.sidebar.info.outliner = (function() {
} else {
RED.workspaces.disable(n.id)
}
} else if (n.type === 'group') {
var groupNodes = RED.group.getNodes(n,true);
var groupHistoryEvent = {
t:'multi',
events:[],
dirty: RED.nodes.dirty()
}
var targetState;
groupNodes.forEach(function(n) {
if (n.type !== 'group') {
if (targetState === undefined) {
targetState = !n.d;
}
var state = !!n.d;
if (state !== targetState) {
var historyEvent = {
t: "edit",
node: n,
changed: n.changed,
changes: {
d: n.d
}
}
if (n.d) {
delete n.d;
} else {
n.d = true;
}
n.dirty = true;
n.changed = true;
RED.events.emit("nodes:change",n);
groupHistoryEvent.events.push(historyEvent);
}
}
if (groupHistoryEvent.events.length > 0) {
RED.history.push(groupHistoryEvent);
RED.nodes.dirty(true)
RED.view.redraw();
}
})
} else {
// TODO: this ought to be a utility function in RED.nodes
var historyEvent = {
@@ -221,16 +197,12 @@ RED.sidebar.info.outliner = (function() {
n.dirty = true;
n.changed = true;
RED.events.emit("nodes:change",n);
RED.history.push(historyEvent);
RED.nodes.dirty(true)
RED.view.redraw();
}
});
RED.popover.tooltip(toggleButton,function() {
if (n.type === "group") {
return RED._("common.label.enable")+" / "+RED._("common.label.disable")
}
return RED._("common.label."+(((n.type==='tab' && n.disabled) || (n.type!=='tab' && n.d))?"enable":"disable"));
return RED._("common.label."+((n.type==='tab' && n.disabled) || (n.type!=='tab' && n.d))?"enable":"disable")
});
} else {
$('<div class="red-ui-info-outline-item-control-spacer">').appendTo(controls)
@@ -436,11 +408,7 @@ RED.sidebar.info.outliner = (function() {
} else {
existingObject.element.find(".red-ui-info-outline-item-label").html("&nbsp;");
}
var existingParent = existingObject.parent.id;
if (!existingParent) {
existingParent = existingObject.parent.parent.flow
}
if (parent !== existingParent) {
if (parent !== existingObject.parent.id) {
var parentItem = existingObject.parent;
existingObject.treeList.remove(true);
if (parentItem.children.length === 0) {
@@ -458,28 +426,15 @@ RED.sidebar.info.outliner = (function() {
} else {
delete configNodeTypes[parentItem.parent.parent.id];
parentItem.parent.treeList.remove();
if (parentItem.parent.parent.children.length === 0) {
parentItem.parent.parent.treeList.addChild(getEmptyItem(parentItem.parent.parent.id));
}
}
}
} else {
parentItem.treeList.addChild(getEmptyItem(parentItem.id));
}
}
if (n._def.category === 'config' && n.type !== 'group') {
// This must be a config node that has been rescoped
createFlowConfigNode(parent,n.type);
configNodeTypes[parent].types[n.type].treeList.addChild(objects[n.id]);
} else {
// This is a node that has moved groups
if (empties[parent]) {
empties[parent].treeList.remove();
delete empties[parent];
}
objects[parent].treeList.addChild(existingObject)
}
// This must be a config node that has been rescoped
createFlowConfigNode(parent,n.type);
configNodeTypes[parent].types[n.type].treeList.addChild(objects[n.id]);
// if (parent === "__global__") {
// // Global always exists here
@@ -513,13 +468,6 @@ RED.sidebar.info.outliner = (function() {
existingObject.treeList.remove();
delete objects[n.id]
if (/^subflow:/.test(n.type)) {
var sfType = n.type.substring(8);
if (objects[sfType]) {
objects[sfType].element.find(".red-ui-info-outline-item-control-users").text(RED.nodes.subflow(sfType).instances.length);
}
}
// If this is a group being removed, it may have an empty item
if (empties[n.id]) {
delete empties[n.id];
@@ -536,9 +484,6 @@ RED.sidebar.info.outliner = (function() {
} else {
delete configNodeTypes[n.z];
parent.parent.treeList.remove();
if (parent.parent.parent.children.length === 0) {
parent.parent.parent.treeList.addChild(getEmptyItem(parent.parent.parent.id));
}
}
}
} else {
@@ -567,7 +512,6 @@ RED.sidebar.info.outliner = (function() {
// There is no 'config nodes' item in the parent flow
configNodeTypes[parent] = {
config: true,
flow: parent,
types: {},
label: RED._("menu.label.displayConfig"),
children: []
@@ -621,12 +565,6 @@ RED.sidebar.info.outliner = (function() {
configNodeTypes[parent].types[n.type].treeList.addChild(objects[n.id]);
}
objects[n.id].element.toggleClass("red-ui-info-outline-item-disabled", !!n.d)
if (/^subflow:/.test(n.type)) {
var sfType = n.type.substring(8);
if (objects[sfType]) {
objects[sfType].element.find(".red-ui-info-outline-item-control-users").text(RED.nodes.subflow(sfType).instances.length);
}
}
updateSearch();
}

View File

@@ -338,7 +338,7 @@ RED.sidebar.info = (function() {
count++;
propRow = $('<tr class="red-ui-help-info-property-row'+(expandedSections.property?"":" hide")+'"><td></td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[0]).text(n);
if (defaults[n].type && !defaults[n]._type.array) {
if (defaults[n].type) {
var configNode = RED.nodes.node(val);
if (!configNode) {
RED.utils.createObjectElement(undefined).appendTo(propRow.children()[1]);
@@ -382,14 +382,21 @@ RED.sidebar.info = (function() {
var category = subflowNode.category||"subflows";
$(propRow.children()[1]).text(RED._("palette.label."+category,{defaultValue:category}))
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+subflowUserCount+'</td></tr>').appendTo(tableBody);
if (subflowNode.meta) {
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("subflow.module")+'</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).text(subflowNode.meta.module||"")
propRow = $('<tr class="red-ui-help-info-row"><td>'+RED._("subflow.version")+'</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).text(subflowNode.meta.version||"")
}
}
// var helpText = "";
// if (node.type === "tab" || node.type === "subflow") {
// } else {
// if (subflowNode && node.type !== "subflow") {
// // Selected a subflow instance node.
// // - The subflow template info goes into help
// helpText = (RED.utils.renderMarkdown(subflowNode.info||"")||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>'));
// } else {
// helpText = $("script[data-help-name='"+node.type+"']").html()||('<span class="red-ui-help-info-none">'+RED._("sidebar.info.none")+'</span>');
// }
// setInfoText(helpText, helpSection.content);
// }
var infoText = "";
if (node._def && node._def.info) {
@@ -402,6 +409,23 @@ RED.sidebar.info = (function() {
}
var infoSectionContainer = $("<div>").css("padding","0 6px 6px").appendTo(propertiesPanelContent)
// var editInfo = $('<button class="red-ui-button red-ui-button-small" style="float: right"><i class="fa fa-file-text-o"></button>').appendTo(infoSectionContainer).on("click", function(evt) {
// //.text(RED._("sidebar.info.editDescription"))
// evt.preventDefault();
// evt.stopPropagation();
// if (node.type === 'tab') {
//
// } else if (node.type === 'subflow') {
//
// } else if (node.type === 'group') {
//
// } else if (node._def.category !== 'config') {
// RED.editor.edit(node,"editor-tab-description");
// } else {
//
// }
// })
setInfoText(infoText, infoSectionContainer);
$(".red-ui-sidebar-info-stack").scrollTop(0);

View File

@@ -112,14 +112,14 @@ RED.touch.radialMenu = (function() {
if (!opt.disabled) {
if (p[0]>opt.x-30 && p[0]<opt.x+30 && p[1]>opt.y-30 && p[1]<opt.y+30) {
if (opt !== activeOption) {
opt.el.classed("selected",true);
opt.el.style("background","#999");
activeOption = opt;
}
} else if (opt === activeOption) {
opt.el.style("background","#fff");
activeOption = null;
} else {
if (opt === activeOption) {
activeOption = null;
}
opt.el.classed("selected",false);
opt.el.style("background","#fff");
}
}
}

View File

@@ -109,19 +109,13 @@ RED.userSettings = (function() {
function compText(a, b) {
return a.text.localeCompare(b.text);
}
var viewSettings = [
{
options: [
{setting:"editor-language",local: true, label:"menu.label.view.language",options:function(done){ done([{val:'',text:RED._('menu.label.view.browserDefault')}].concat(RED.settings.theme("languages").map(localeToName).sort(compText))) }},
]
},
// {
// options: [
// {setting:"theme", label:"Theme",options:function(done){ done([{val:'',text:'default'}].concat(RED.settings.theme("themes"))) }},
// ]
// },
{
},{
title: "menu.label.view.grid",
options: [
{setting:"view-show-grid",oldSetting:"menu-menu-item-view-show-grid",label:"menu.label.view.showGrid", default: true, toggle:true,onchange:"core:toggle-show-grid"},

View File

@@ -52,15 +52,13 @@ RED.utils = (function() {
} else if (value === null) {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-null">null</span>');
} else if (typeof value === 'object') {
if (value.hasOwnProperty('type') && value.type === 'undefined') {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-null">undefined</span>');
} else if (value.hasOwnProperty('type') && value.type === 'Buffer' && value.hasOwnProperty('data')) {
if (value.hasOwnProperty('type') && value.type === 'Buffer' && value.hasOwnProperty('data')) {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text('buffer['+value.length+']');
} else if (value.hasOwnProperty('type') && value.type === 'array' && value.hasOwnProperty('data')) {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text('array['+value.length+']');
} else if (value.hasOwnProperty('type') && value.type === 'function') {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text('function');
} else if (value.hasOwnProperty('type') && (value.type === 'number' || value.type === 'bigint')) {
} else if (value.hasOwnProperty('type') && value.type === 'number') {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-number"></span>').text(value.data);
} else {
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta">object</span>');
@@ -350,9 +348,7 @@ RED.utils = (function() {
}
if (obj === null || obj === undefined) {
$('<span class="red-ui-debug-msg-type-null">'+obj+'</span>').appendTo(entryObj);
} else if (obj.__enc__ && obj.type === 'undefined') {
$('<span class="red-ui-debug-msg-type-null">undefined</span>').appendTo(entryObj);
} else if (obj.__enc__ && (obj.type === 'number' || obj.type === 'bigint')) {
} else if (obj.__enc__ && obj.type === 'number') {
e = $('<span class="red-ui-debug-msg-type-number red-ui-debug-msg-object-header"></span>').text(obj.data).appendTo(entryObj);
} else if (typeHint === "function" || (obj.__enc__ && obj.type === 'function')) {
e = $('<span class="red-ui-debug-msg-type-meta red-ui-debug-msg-object-header"></span>').text("function").appendTo(entryObj);
@@ -615,25 +611,18 @@ RED.utils = (function() {
return element;
}
function createError(code, message) {
var e = new Error(message);
e.code = code;
return e;
}
function normalisePropertyExpression(str,msg) {
function normalisePropertyExpression(str) {
// This must be kept in sync with validatePropertyExpression
// in editor/js/ui/utils.js
var length = str.length;
if (length === 0) {
throw createError("INVALID_EXPR","Invalid property expression: zero-length");
throw new Error("Invalid property expression: zero-length");
}
var parts = [];
var start = 0;
var inString = false;
var inBox = false;
var boxExpression = false;
var quoteChar;
var v;
for (var i=0;i<length;i++) {
@@ -641,14 +630,14 @@ RED.utils = (function() {
if (!inString) {
if (c === "'" || c === '"') {
if (i != start) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+i);
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
}
inString = true;
quoteChar = c;
start = i+1;
} else if (c === '.') {
if (i===0) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected . at position 0");
throw new Error("Invalid property expression: unexpected . at position 0");
}
if (start != i) {
v = str.substring(start,i);
@@ -659,99 +648,57 @@ RED.utils = (function() {
}
}
if (i===length-1) {
throw createError("INVALID_EXPR","Invalid property expression: unterminated expression");
throw new Error("Invalid property expression: unterminated expression");
}
// Next char is first char of an identifier: a-z 0-9 $ _
if (!/[a-z0-9\$\_]/i.test(str[i+1])) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
}
start = i+1;
} else if (c === '[') {
if (i === 0) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+i);
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
}
if (start != i) {
parts.push(str.substring(start,i));
}
if (i===length-1) {
throw createError("INVALID_EXPR","Invalid property expression: unterminated expression");
throw new Error("Invalid property expression: unterminated expression");
}
// Start of a new expression. If it starts with msg it is a nested expression
// Need to scan ahead to find the closing bracket
if (/^msg[.\[]/.test(str.substring(i+1))) {
var depth = 1;
var inLocalString = false;
var localStringQuote;
for (var j=i+1;j<length;j++) {
if (/["']/.test(str[j])) {
if (inLocalString) {
if (str[j] === localStringQuote) {
inLocalString = false
}
} else {
inLocalString = true;
localStringQuote = str[j]
}
}
if (str[j] === '[') {
depth++;
} else if (str[j] === ']') {
depth--;
}
if (depth === 0) {
try {
if (msg) {
parts.push(getMessageProperty(msg, str.substring(i+1,j)))
} else {
parts.push(normalisePropertyExpression(str.substring(i+1,j), msg));
}
inBox = false;
i = j;
start = j+1;
break;
} catch(err) {
throw createError("INVALID_EXPR","Invalid expression started at position "+(i+1))
}
}
}
if (depth > 0) {
throw createError("INVALID_EXPR","Invalid property expression: unmatched '[' at position "+i);
}
continue;
} else if (!/["'\d]/.test(str[i+1])) {
// Next char is either a quote or a number
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
// Next char is either a quote or a number
if (!/["'\d]/.test(str[i+1])) {
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
}
start = i+1;
inBox = true;
} else if (c === ']') {
if (!inBox) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+i);
throw new Error("Invalid property expression: unexpected "+c+" at position "+i);
}
if (start != i) {
v = str.substring(start,i);
if (/^\d+$/.test(v)) {
parts.push(parseInt(v));
} else {
throw createError("INVALID_EXPR","Invalid property expression: unexpected array expression at position "+start);
throw new Error("Invalid property expression: unexpected array expression at position "+start);
}
}
start = i+1;
inBox = false;
} else if (c === ' ') {
throw createError("INVALID_EXPR","Invalid property expression: unexpected ' ' at position "+i);
throw new Error("Invalid property expression: unexpected ' ' at position "+i);
}
} else {
if (c === quoteChar) {
if (i-start === 0) {
throw createError("INVALID_EXPR","Invalid property expression: zero-length string at position "+start);
throw new Error("Invalid property expression: zero-length string at position "+start);
}
parts.push(str.substring(start,i));
// If inBox, next char must be a ]. Otherwise it may be [ or .
if (inBox && !/\]/.test(str[i+1])) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected array expression at position "+start);
throw new Error("Invalid property expression: unexpected array expression at position "+start);
} else if (!inBox && i+1!==length && !/[\[\.]/.test(str[i+1])) {
throw createError("INVALID_EXPR","Invalid property expression: unexpected "+str[i+1]+" expression at position "+(i+1));
throw new Error("Invalid property expression: unexpected "+str[i+1]+" expression at position "+(i+1));
}
start = i+1;
inString = false;
@@ -760,7 +707,7 @@ RED.utils = (function() {
}
if (inBox || inString) {
throw new createError("INVALID_EXPR","Invalid property expression: unterminated expression");
throw new Error("Invalid property expression: unterminated expression");
}
if (start < length) {
parts.push(str.substring(start));
@@ -1171,67 +1118,6 @@ RED.utils = (function() {
return '#'+'000000'.slice(0, 6-s.length)+s;
}
function parseModuleList(list) {
list = list || ["*"];
return list.map(function(rule) {
var m = /^(.+?)(?:@(.*))?$/.exec(rule);
var wildcardPos = m[1].indexOf("*");
wildcardPos = wildcardPos===-1?Infinity:wildcardPos;
return {
module: new RegExp("^"+m[1].replace(/\*/g,".*")+"$"),
version: m[2],
wildcardPos: wildcardPos
}
})
}
function checkAgainstList(module,version,list) {
for (var i=0;i<list.length;i++) {
var rule = list[i];
if (rule.module.test(module)) {
// Without a full semver library in the editor,
// we skip the version check.
// Not ideal - but will get caught in the runtime
// if the user tries to install.
return rule;
}
}
}
function checkModuleAllowed(module,version,allowList,denyList) {
if (!allowList && !denyList) {
// Default to allow
return true;
}
if (allowList.length === 0 && denyList.length === 0) {
return true;
}
var allowedRule = checkAgainstList(module,version,allowList);
var deniedRule = checkAgainstList(module,version,denyList);
// console.log("A",allowedRule)
// console.log("D",deniedRule)
if (allowedRule && !deniedRule) {
return true;
}
if (!allowedRule && deniedRule) {
return false;
}
if (!allowedRule && !deniedRule) {
return true;
}
if (allowedRule.wildcardPos !== deniedRule.wildcardPos) {
return allowedRule.wildcardPos > deniedRule.wildcardPos
} else {
// First wildcard in same position.
// Go with the longer matching rule. This isn't going to be 100%
// right, but we are deep into edge cases at this point.
return allowedRule.module.toString().length > deniedRule.module.toString().length
}
return false;
}
return {
createObjectElement: buildMessageElement,
getMessageProperty: getMessageProperty,
@@ -1251,8 +1137,6 @@ RED.utils = (function() {
sanitize: sanitize,
renderMarkdown: renderMarkdown,
createNodeIcon: createNodeIcon,
getDarkerColor: getDarkerColor,
parseModuleList: parseModuleList,
checkModuleAllowed: checkModuleAllowed
getDarkerColor: getDarkerColor
}
})();

View File

@@ -16,27 +16,6 @@
RED.view.tools = (function() {
function selectConnected(type) {
var selection = RED.view.selection();
var visited = new Set();
if (selection.nodes && selection.nodes.length > 0) {
selection.nodes.forEach(function(n) {
if (!visited.has(n)) {
var connected;
if (type === 'all') {
connected = RED.nodes.getAllFlowNodes(n);
} else if (type === 'up') {
connected = [n].concat(RED.nodes.getAllUpstreamNodes(n));
} else if (type === 'down') {
connected = [n].concat(RED.nodes.getAllDownstreamNodes(n));
}
connected.forEach(function(nn) { visited.add(nn) })
}
});
RED.view.select({nodes:Array.from(visited)});
}
}
function alignToGrid() {
var selection = RED.view.selection();
@@ -123,13 +102,11 @@ RED.view.tools = (function() {
node.n.dirty = true;
if (node.n.type === "group") {
RED.group.markDirty(node.n);
minX = Math.min(node.n.x - 5,minX);
minY = Math.min(node.n.y - 5,minY);
} else {
minX = Math.min(node.n.x-node.n.w/2-5,minX);
minY = Math.min(node.n.y-node.n.h/2-5,minY);
}
minX = Math.min(node.n.x-node.n.w/2-5,minX);
minY = Math.min(node.n.y-node.n.h/2-5,minY);
}
if (minX !== 0 || minY !== 0) {
for (var n = 0; n<moving_set.length; n++) {
node = moving_set[n];
@@ -227,10 +204,6 @@ RED.view.tools = (function() {
RED.actions.add("core:step-selection-right", function() { moveSelection(RED.view.gridSize(),0);});
RED.actions.add("core:step-selection-down", function() { moveSelection(0,RED.view.gridSize());});
RED.actions.add("core:step-selection-left", function() { moveSelection(-RED.view.gridSize(),0);});
RED.actions.add("core:select-connected-nodes", function() { selectConnected("all") });
RED.actions.add("core:select-downstream-nodes", function() { selectConnected("down") });
RED.actions.add("core:select-upstream-nodes", function() { selectConnected("up") });
},
/**
* Aligns all selected nodes to the current grid

File diff suppressed because it is too large Load Diff

View File

@@ -39,11 +39,7 @@ RED.user = (function() {
closeOnEscape: !!opts.cancelable,
width: 600,
resizable: false,
draggable: false,
close: function( event, ui ) {
$("#node-dialog-login").dialog('destroy').remove();
RED.keyboard.enable()
}
draggable: false
});
$("#node-dialog-login-fields").empty();
@@ -102,10 +98,10 @@ RED.user = (function() {
data: body
}).done(function(data,textStatus,xhr) {
RED.settings.set("auth-tokens",data);
$("#node-dialog-login").dialog('destroy').remove();
if (opts.updateMenu) {
updateUserMenu();
}
$("#node-dialog-login").dialog("close");
done();
}).fail(function(jqXHR,textStatus,errorThrown) {
RED.settings.remove("auth-tokens");
@@ -147,8 +143,7 @@ RED.user = (function() {
}
if (opts.cancelable) {
$("#node-dialog-login-cancel").button().on("click", function( event ) {
$("#node-dialog-login").dialog('close');
$("#node-dialog-login").dialog('destroy').remove();
});
}
@@ -157,7 +152,8 @@ RED.user = (function() {
$("#node-dialog-login-image").load(function() {
dialog.dialog("open");
}).attr("src",loginImageSrc);
RED.keyboard.disable();
}
});
}
@@ -219,7 +215,7 @@ RED.user = (function() {
function init() {
if (RED.settings.user) {
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu") || RED.settings.editorTheme.userMenu) {
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
var userMenu = $('<li><a id="red-ui-header-button-user" class="button hide" href="#"></a></li>')
.prependTo(".red-ui-header-toolbar");

View File

@@ -15,9 +15,6 @@
**/
body {
overflow: hidden;
}
.red-ui-editor {
font-size: $primary-font-size;
@@ -70,9 +67,6 @@ body {
text-decoration: none;
color: $primary-text-color;
}
a:focus {
outline: 1px solid $form-input-focus-color;
}
p {
margin: 0 0 10px;
@@ -146,13 +140,6 @@ body {
background-size: contain
}
.red-ui-font-code {
font-family: $monospace-font;
font-size: $primary-font-size;
color: $info-text-code-color;
white-space: nowrap;
}
code {
font-family: $monospace-font;
font-size: $primary-font-size;

View File

@@ -129,7 +129,7 @@ $workspace-button-color-primary: #eee;
$workspace-button-background-primary: #AD1625;
$workspace-button-background-primary-hover: #6E0A1E;
$workspace-button-color-focus-outline: $form-input-focus-color;
$workspace-button-color-focus-outline: $form-input-border-color;
$shade-color: rgba(160,160,160,0.5);
@@ -289,4 +289,3 @@ $group-default-fill: none;
$group-default-fill-opacity: 1;
$group-default-stroke: #999;
$group-default-stroke-opacity: 1;
$group-default-label-color: #a4a4a4;

View File

@@ -174,8 +174,8 @@ button.red-ui-tray-resize-button {
.red-ui-editor .red-ui-tray {
.dialog-form, #dialog-form, #node-config-dialog-edit-form {
margin: 10px 20px;
height: calc(100% - 20px);
margin: 20px;
height: calc(100% - 40px);
}
}
@@ -410,7 +410,7 @@ button.red-ui-button.red-ui-editor-node-appearance-button {
.red-ui-group-layout-picker {
padding: 5px;
background: $secondary-background;
background: $primary-background;
}
.red-ui-group-layout-picker-cell-text {
position: absolute;
@@ -597,7 +597,6 @@ div.red-ui-button-small.red-ui-color-picker-opacity-slider-handle {
padding: 4px;
color: $secondary-text-color;
font-size: 0.9em;
line-height: 24px;
}
button {
float: right;
@@ -716,9 +715,6 @@ div.red-ui-button-small.red-ui-color-picker-opacity-slider-handle {
button.red-ui-toggleButton.toggle {
text-align: left;
i {
min-width: 15px;
}
}
@@ -765,10 +761,6 @@ button.red-ui-toggleButton.toggle {
width: calc(100% - 10px);
padding-left: 3px;
}
select {
padding: 0 3px;
font-size: 11px;
}
.placeholder-input {
span:first-child {
display:inline-block;
@@ -836,18 +828,8 @@ span.red-ui-editor-subflow-env-lang-icon {
right: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.red-ui-editor-subflow-env-input-type {
background: $secondary-background;
height: 100%;
box-sizing: border-box;
}
.red-ui-editor-subflow-env-input-type-placeholder {
color: $tertiary-text-color;
padding-left: 4px;
}
// .red-ui-editor-subflow-ui-grid {
// width: 100%;
// .red-ui-editableList-container {

View File

@@ -37,7 +37,7 @@
@include disable-selection;
.red-ui-flow-node-label-text {
dominant-baseline: middle;
alignment-baseline: middle;
}
&.red-ui-flow-node-label-right .red-ui-flow-node-label-text {
@@ -49,7 +49,7 @@
stroke-width: 0;
fill: $secondary-text-color;
font-size: 16px;
dominant-baseline: middle;
alignment-baseline: middle;
text-anchor: middle;
pointer-events: none;
-webkit-touch-callout: none;
@@ -106,11 +106,6 @@
pointer-events: stroke;
stroke-opacity: 0;
stroke-width: 3;
&.red-ui-flow-group-outline-select-background {
stroke: $view-background;
stroke-width: 6;
}
}
.red-ui-flow-group-body {
pointer-events: none;
@@ -122,7 +117,6 @@
}
.red-ui-flow-group-label {
@include disable-selection;
fill: $group-default-label-color;
}
@@ -139,11 +133,7 @@
stroke-width: 2;
}
.red-ui-flow-node-icon-group {
text {
@include disable-selection;
}
.fa-lg {
@include disable-selection;
stroke: none;
fill: $node-icon-color;
text-anchor: middle;
@@ -163,15 +153,6 @@
.red-ui-flow-node-button {
fill: inherit;
&.red-ui-flow-node-button-disabled {
opacity: 0.4;
.red-ui-flow-node-button-button {
cursor: default;
}
}
}
.red-ui-flow-node-button-button {
cursor: pointer;
}
.red-ui-flow-node-button-background {
fill: $node-background-placeholder;
@@ -254,7 +235,7 @@ g.red-ui-flow-node-selected {
stroke-dasharray: none;
}
}
@each $current-color in red green yellow blue grey gray {
@each $current-color in red green yellow blue grey {
.red-ui-flow-node-status-dot-#{$current-color} {
fill: map-get($node-status-colors,$current-color);
stroke: map-get($node-status-colors,$current-color);
@@ -346,10 +327,7 @@ g.red-ui-flow-link-unknown path.red-ui-flow-link-line {
stroke-dasharray: 10, 4;
}
// @keyframes *must* be on multiple lines so build-custom-theme can filter them out
@keyframes red-ui-flow-port-tooltip-fadeIn {
from { opacity:0; } to { opacity:1; }
}
@keyframes red-ui-flow-port-tooltip-fadeIn { from { opacity:0; } to { opacity:1; } }
.red-ui-flow-port-tooltip {
opacity:0;

View File

@@ -29,30 +29,8 @@
}
}
}
#red-ui-clipboard-dialog-export-tab-clipboard-preview {
.red-ui-treeList-container,.red-ui-editableList-border {
border: none;
border-radius: 0;
}
}
#red-ui-clipboard-dialog-export-tab-clipboard-json {
padding: 10px 10px 0;
}
#red-ui-clipboard-dialog-import-tab-clipboard {
padding: 10px;
}
.red-ui-clipboard-dialog-export-tab-clipboard-tab {
position: absolute;
top: 40px;
right: 0;
left: 0;
bottom: 0;
}
.red-ui-clipboard-dialog-tab-clipboard {
padding: 10px;
textarea {
resize: none;
width: 100%;
@@ -93,9 +71,10 @@
border:1px solid $primary-border-color;
}
#red-ui-clipboard-dialog-export-tab-library-filename {
height: auto !important;
margin-left: 10px;
.red-ui-clipboard-dialog-tab-library {
.form-row {
margin-left: 10px;
}
}
#red-ui-clipboard-dialog {
@@ -109,7 +88,7 @@
#red-ui-clipboard-dialog-tab-library-name {
width: calc(100% - 120px);
}
.red-ui-clipboard-dialog-tabs-content>div.red-ui-clipboard-dialog-export-tab-library-browser {
#red-ui-clipboard-dialog-export-tab-library-browser {
height: calc(100% - 60px);
margin-bottom: 13px;
border-bottom: 1px solid $primary-border-color;
@@ -174,99 +153,3 @@
border-top: none;
}
}
.red-ui-clipboard-dialog-import-conflicts-list-container {
min-height: 300px;
position: relative;
li:not(:first-child) .red-ui-clipboard-dialog-import-conflicts-item-header {
// border-top: 1px solid $secondary-border-color;
}
}
.red-ui-clipboard-dialog-import-conflicts-item-header {
background: $tertiary-background;
& > span:first-child {
color: $header-text-color;
padding-left: 4px;
font-size: 12px;
}
}
.red-ui-clipboard-dialog-import-conflicts-controls {
position: absolute;
top:0;
bottom: 0;
right: 0px;
text-align: center;
color: $form-text-color;
.form-row & label {
padding: 2px 0;
line-height: 23px;
margin-bottom: 0;
width: 80px;
display: inline-block;
position: relative;
height: 100%;
width: 80px;
text-align: center;
border-left: 1px solid $secondary-border-color;
}
input[type="checkbox"] {
display: inline-block;
width: auto;
margin: 0;
}
}
#red-ui-clipboard-dialog-import-conflicts-list .disabled .red-ui-info-outline-item {
opacity: 0.4;
}
.form-row label.red-ui-clipboard-dialog-import-conflicts-gutter {
box-sizing: border-box;
width: 22px;
text-align: center;
.red-ui-editor-dialog & input[type="checkbox"] {
width: auto;
padding: 0;
margin: 0;
}
}
#red-ui-settings-tab-library-manager {
box-sizing: border-box;
padding: 10px;
position: relative;
height: 100%;
li {
padding: 0;
}
}
.red-ui-settings-tab-library-entry {
display: flex;
flex-direction: row;
span:not(:nth-child(2)) {
@include disable-selection;
}
span {
padding: 8px 0;
}
span:first-child {
display: inline-block;
width: 20px;
padding-right: 8px;
text-align: center;
flex-grow: 0;
}
span:nth-child(2) {
flex-grow: 1;
}
span:nth-child(3), span:nth-child(4) {
flex-grow: 0;
padding-right: 5px;
color: $secondary-text-color;
font-size: 0.9em;
}
}

View File

@@ -71,9 +71,38 @@
}
.red-ui-notification-shake-horizontal {
animation: red-ui-notification-shake-horizontal 0.3s steps(2, end) both;
-webkit-animation: red-ui-notification-shake-horizontal 0.3s steps(2, end) both;
animation: red-ui-notification-shake-horizontal 0.3s steps(2, end) both;
}
@-webkit-keyframes red-ui-notification-shake-horizontal {
0%,
100% {
-webkit-transform: translateX(0);
transform: translateX(0);
}
10%,
30%,
50%,
70% {
-webkit-transform: translateX(-1px);
transform: translateX(-1px);
}
20%,
40%,
60% {
-webkit-transform: translateX(1px);
transform: translateX(1px);
}
// 80% {
// -webkit-transform: translateX(1px);
// transform: translateX(1px);
// }
// 90% {
// -webkit-transform: translateX(-1px);
// transform: translateX(-1px);
// }
}
// @keyframes *must* be on multiple lines so build-custom-theme can filter them out
@keyframes red-ui-notification-shake-horizontal {
0%,
100% {
@@ -93,4 +122,12 @@
-webkit-transform: translateX(1px);
transform: translateX(1px);
}
// 80% {
// -webkit-transform: translateX(1px);
// transform: translateX(1px);
// }
// 90% {
// -webkit-transform: translateX(-1px);
// transform: translateX(-1px);
// }
}

View File

@@ -237,45 +237,3 @@ ul.red-ui-palette-module-error-list {
#red-ui-palette-module-install-shade {
padding-top: 80px;
}
button.red-ui-palette-editor-upload-button {
padding: 0;
height: 25px;
margin-top: -1px;
input[type="file"] {
opacity: 0;
margin: 0;
height: 0;
width: 0;
}
.red-ui-settings-tabs-content & label {
margin: 0;
min-width: 0;
padding: 2px 8px;
}
form {
width: 0;
}
}
.red-ui-palette-editor-upload {
display: none;
position: absolute;
left: 0;
right: 0;
top: 44px;
padding: 20px;
background: $secondary-background;
border-bottom: 1px $secondary-border-color solid;
box-shadow: 1px 1px 4px $shadow;
.placeholder-input {
width: calc(100% - 180px);
margin: 0;
}
}
.red-ui-palette-editor-upload-buttons {
float: right;
button {
margin-left: 10px;
}
}

View File

@@ -131,10 +131,10 @@
width: 120px;
background-size: contain;
position: relative;
&:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child {
&:not(.red-ui-palette-node-config):first-child {
margin-top: 15px;
}
&:not(.red-ui-palette-node-config):not(.red-ui-palette-node-small):first-child {
&:not(.red-ui-palette-node-config):last-child {
margin-bottom: 15px;
}
}
@@ -204,7 +204,7 @@
.red-ui-palette-icon-fa {
color: white;
position: absolute;
top: calc(50% - 7px);
top: 7px;
left: 3px;
}
.red-ui-palette-node-small {

View File

@@ -90,7 +90,7 @@
font-size: 1.2em;
}
}
button.red-ui-button.red-ui-projects-dialog-button {
button.red-ui-button {
width: calc(50% - 80px);
margin: 20px;
height: auto;
@@ -265,26 +265,6 @@
}
}
}
.red-ui-projects-dialog-project-list-entry-delete-confirm {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 100%;
width: 1000px;
overflow: hidden;
padding: 5px 20px;
background: $secondary-background;
transition: left 0.4s;
white-space: nowrap;
> span {
line-height: 40px;
}
button {
margin-left: 20px;
}
}
.red-ui-projects-dialog-screen-create-type {
position: relative;
}
@@ -807,7 +787,6 @@ div.red-ui-projects-dialog-ssh-public-key {
border: 1px solid $secondary-border-color;
.red-ui-projects-edit-form-sublabel {
margin-top: -8px !important;
margin-right: 50px;
display: block !important;
width: auto !important;
}

View File

@@ -42,11 +42,7 @@
background: $secondary-background;
border: 2px solid $primary-border-color;
text-align: center;
line-height:50px;
&.selected {
background: $workspace-button-background-hover;
}
line-height:50px
}
.red-ui-editor-radial-menu-opt-disabled {

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