diff --git a/.travis.yml b/.travis.yml index 94bf3698c..a101eecb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ sudo: false language: node_js matrix: include: + - node_js: "12" - node_js: "10" script: - ./node_modules/.bin/grunt && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bdc154c..793b5c565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,51 @@ +#### 1.0.0-beta.2: Beta Release + +Runtime + - Fix length calculation when loading library file + +#### 1.0.0-beta.1: Beta Release + +Runtime + - Update runtime apis to support multiple libraries + - Add Node 12 to travis (allow_failures) + - Bump all dependencies Fixes #2152 + +Editor + - [BREAKING] complete overhaul of editor DOM/CSS structure + - [BREAKING] Get rid of Bootstrap + - Simplify index.mst to a single div to insert the editor + - Append node configs to div rather than body + - Only redraw node status when it has changed + - Minimise work done to calculate node label widths + - Allow script tags with src to reference esm modules + - Upgrade to jq 3.4.1 / jq-ui 1.12.1 + - Allow editor language to be chosen in editor settings + - Only NLS status text that starts with a letter Fixes #2128 + - Fix display of link node list within subflow Fixes #2140 + - Blur the active element when closing edit dialog via action Fixes #2097 + - Trigger change evnt on typedInput when type changes and options present Fixes #2160 + - Move library import/export to single dialog + - Move type-library dialogs to new style dialog + - Fix node drag and drop animation + - let status be simple text if wanted + - Add workspace statusBar + - Complete refresh of German translations + - Fix memory leak in Debug sidebar #2163 + - Introduce toggleButton and move flow-disabled to use it + - Allow RED.settings.get/set to use full property desc + - Add auto-refresh toggle to context sidebar + - Add build-custom-theme script + - Add RED.view.selectNodes api for node selection whilst editing + - Add node-select to typedInput + +Nodes + - http request node: warn user if msg.requestTimeout == 0 + - hide delay node reset label on deploy + - Fix CSV regex to treat strings starting e as text + - Add "don't parse numbers" option to csv node + - Add expand editor button to Template node + - Update catch/status nodes to use selectNodes api and treeList + #### 0.20.7: Maintenance Release - Update jsonata to 1.6.5 which should fix #2183 diff --git a/Gruntfile.js b/Gruntfile.js index e11caabbc..66ebf4f38 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -145,11 +145,13 @@ module.exports = function(grunt) { "packages/node_modules/@node-red/editor-client/src/js/ui/common/tabs.js", "packages/node_modules/@node-red/editor-client/src/js/ui/common/stack.js", "packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js", "packages/node_modules/@node-red/editor-client/src/js/ui/actions.js", "packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js", "packages/node_modules/@node-red/editor-client/src/js/ui/diff.js", "packages/node_modules/@node-red/editor-client/src/js/ui/keyboard.js", "packages/node_modules/@node-red/editor-client/src/js/ui/workspaces.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/statusBar.js", "packages/node_modules/@node-red/editor-client/src/js/ui/view.js", "packages/node_modules/@node-red/editor-client/src/js/ui/view-navigator.js", "packages/node_modules/@node-red/editor-client/src/js/ui/view-tools.js", @@ -167,6 +169,7 @@ module.exports = function(grunt) { "packages/node_modules/@node-red/editor-client/src/js/ui/library.js", "packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js", "packages/node_modules/@node-red/editor-client/src/js/ui/search.js", + "packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js", "packages/node_modules/@node-red/editor-client/src/js/ui/typeSearch.js", "packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js", "packages/node_modules/@node-red/editor-client/src/js/ui/userSettings.js", @@ -181,22 +184,22 @@ module.exports = function(grunt) { vendor: { files: { "packages/node_modules/@node-red/editor-client/public/vendor/vendor.js": [ - "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js", - "packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/js/bootstrap.min.js", - "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-3.4.1.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-migrate-3.0.1.min.js", + "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery-ui.min.js", "packages/node_modules/@node-red/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js", "packages/node_modules/@node-red/editor-client/src/vendor/marked/marked.min.js", "packages/node_modules/@node-red/editor-client/src/vendor/d3/d3.v3.min.js", - "packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js" - ], - "packages/node_modules/@node-red/editor-client/public/vendor/vendor.css": [ - // TODO: resolve relative resource paths in - // bootstrap/FA/jquery - ], - "packages/node_modules/@node-red/editor-client/public/vendor/jsonata/jsonata.min.js": [ + "packages/node_modules/@node-red/editor-client/src/vendor/i18next/i18next.min.js", "node_modules/jsonata/jsonata-es5.min.js", - "packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js" + "packages/node_modules/@node-red/editor-client/src/vendor/jsonata/formatter.js", + "packages/node_modules/@node-red/editor-client/src/vendor/ace/ace.js", + "packages/node_modules/@node-red/editor-client/src/vendor/ace/ext-language_tools.js", ], + // "packages/node_modules/@node-red/editor-client/public/vendor/vendor.css": [ + // // TODO: resolve relative resource paths in + // // bootstrap/FA/jquery + // ], "packages/node_modules/@node-red/editor-client/public/vendor/ace/worker-jsonata.js": [ "node_modules/jsonata/jsonata-es5.min.js", "packages/node_modules/@node-red/editor-client/src/vendor/jsonata/worker-jsonata.js" @@ -222,10 +225,6 @@ module.exports = function(grunt) { files: [{ dest: 'packages/node_modules/@node-red/editor-client/public/red/style.min.css', src: 'packages/node_modules/@node-red/editor-client/src/sass/style.scss' - }, - { - dest: 'packages/node_modules/@node-red/editor-client/public/vendor/bootstrap/css/bootstrap.min.css', - src: 'packages/node_modules/@node-red/editor-client/src/vendor/bootstrap/css/bootstrap.css' }] } }, @@ -352,9 +351,7 @@ module.exports = function(grunt) { cwd: 'packages/node_modules/@node-red/editor-client/src/vendor', src: [ 'ace/**', - //'bootstrap/css/**', - 'bootstrap/img/**', - 'jquery/css/**', + 'jquery/css/base/**', 'font-awesome/**' ], expand: true, @@ -499,7 +496,9 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-chmod'); grunt.loadNpmTasks('grunt-jsonlint'); grunt.loadNpmTasks('grunt-mocha-istanbul'); - grunt.loadNpmTasks('grunt-webdriver'); + if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.loadNpmTasks('grunt-webdriver'); + } grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-jsdoc-to-markdown'); grunt.loadNpmTasks('grunt-npm-command'); @@ -558,8 +557,8 @@ module.exports = function(grunt) { }); grunt.registerTask('verifyUiTestDependencies', function() { - if (!fs.existsSync(path.join("node_modules", "chromedriver"))) { - grunt.fail.fatal('You need to run "npm install chromedriver@2" before running UI test.'); + if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.fail.fatal('You need to install the UI test dependencies first.\nUse the script in "scripts/install-ui-test-dependencies.sh"'); return false; } }); @@ -582,9 +581,15 @@ module.exports = function(grunt) { 'Runs code style check on editor code', ['jshint:editor']); - grunt.registerTask('test-ui', - 'Builds editor content then runs unit tests on editor ui', - ['verifyUiTestDependencies','build','jshint:editor','webdriver:all']); + if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.registerTask('test-ui', + 'Builds editor content then runs unit tests on editor ui', + ['verifyUiTestDependencies']); + } else { + grunt.registerTask('test-ui', + 'Builds editor content then runs unit tests on editor ui', + ['verifyUiTestDependencies','build','jshint:editor','webdriver:all']); + } grunt.registerTask('test-nodes', 'Runs unit tests on core nodes', diff --git a/package.json b/package.json index 9f2770acb..e0997ce16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red", - "version": "0.20.7", + "version": "1.0.0-beta.2", "description": "A visual tool for wiring the Internet of Things", "homepage": "http://nodered.org", "license": "Apache-2.0", @@ -42,7 +42,7 @@ "fs.notify": "0.0.4", "hash-sum": "2.0.0", "https-proxy-agent": "2.2.1", - "i18next": "15.1.0", + "i18next": "15.1.2", "iconv-lite": "0.5.0", "is-utf8": "0.2.1", "js-yaml": "3.13.1", @@ -54,12 +54,9 @@ "mqtt": "2.18.8", "multer": "1.4.1", "mustache": "3.0.1", - "node-red-node-email": "^1.6.2", - "node-red-node-feedparser": "^0.1.14", "node-red-node-rbe": "^0.2.4", "node-red-node-sentiment": "^0.1.3", "node-red-node-tail": "^0.0.2", - "node-red-node-twitter": "^1.1.5", "nopt": "4.0.1", "oauth2orize": "1.11.0", "on-headers": "1.0.2", @@ -98,7 +95,6 @@ "grunt-npm-command": "~0.1.2", "grunt-sass": "~2.0.0", "grunt-simple-mocha": "~0.4.1", - "grunt-webdriver": "^2.0.3", "http-proxy": "^1.16.2", "istanbul": "0.4.5", "minami": "1.2.3", @@ -108,11 +104,7 @@ "sinon": "1.17.7", "stoppable": "^1.1.0", "supertest": "3.4.2", - "wdio-chromedriver-service": "^0.1.5", - "wdio-mocha-framework": "^0.6.4", - "wdio-spec-reporter": "^0.1.5", - "webdriverio": "^4.14.1", - "node-red-node-test-helper": "^0.2.2", + "node-red-node-test-helper": "^0.2.3", "jsdoc-nr-template": "node-red/jsdoc-nr-template" }, "engines": { diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/context.js b/packages/node_modules/@node-red/editor-api/lib/admin/context.js index 6a2efd82d..54bfd9f85 100644 --- a/packages/node_modules/@node-red/editor-api/lib/admin/context.js +++ b/packages/node_modules/@node-red/editor-api/lib/admin/context.js @@ -30,7 +30,8 @@ module.exports = { scope: req.params.scope, id: req.params.id, key: req.params[0], - store: req.query['store'] + store: req.query['store'], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.context.getValue(opts).then(function(result) { res.json(result); @@ -45,7 +46,8 @@ module.exports = { scope: req.params.scope, id: req.params.id, key: req.params[0], - store: req.query['store'] + store: req.query['store'], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.context.delete(opts).then(function(result) { res.status(204).end(); diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/flow.js b/packages/node_modules/@node-red/editor-api/lib/admin/flow.js index 5ba5d7a04..98ae997ff 100644 --- a/packages/node_modules/@node-red/editor-api/lib/admin/flow.js +++ b/packages/node_modules/@node-red/editor-api/lib/admin/flow.js @@ -24,7 +24,8 @@ module.exports = { get: function(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.flows.getFlow(opts).then(function(result) { return res.json(result); @@ -35,7 +36,8 @@ module.exports = { post: function(req,res) { var opts = { user: req.user, - flow: req.body + flow: req.body, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.flows.addFlow(opts).then(function(id) { return res.json({id:id}); @@ -47,7 +49,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - flow: req.body + flow: req.body, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.flows.updateFlow(opts).then(function(id) { return res.json({id:id}); @@ -58,7 +61,8 @@ module.exports = { delete: function(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.flows.deleteFlow(opts).then(function() { res.status(204).end(); diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/flows.js b/packages/node_modules/@node-red/editor-api/lib/admin/flows.js index ccad8718f..11b30e446 100644 --- a/packages/node_modules/@node-red/editor-api/lib/admin/flows.js +++ b/packages/node_modules/@node-red/editor-api/lib/admin/flows.js @@ -27,7 +27,8 @@ module.exports = { return res.status(400).json({code:"invalid_api_version", message:"Invalid API Version requested"}); } var opts = { - user: req.user + user: req.user, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.flows.getFlows(opts).then(function(result) { if (version === "v1") { @@ -46,7 +47,8 @@ module.exports = { } var opts = { user: req.user, - deploymentType: req.get("Node-RED-Deployment-Type")||"full" + deploymentType: req.get("Node-RED-Deployment-Type")||"full", + req: apiUtils.getRequestLogObject(req) } if (opts.deploymentType !== 'reload') { diff --git a/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js b/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js index 59a137587..2787a5c36 100644 --- a/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js +++ b/packages/node_modules/@node-red/editor-api/lib/admin/nodes.js @@ -24,7 +24,8 @@ module.exports = { }, getAll: function(req,res) { var opts = { - user: req.user + user: req.user, + req: apiUtils.getRequestLogObject(req) } if (req.get("accept") == "application/json") { runtimeAPI.nodes.getNodeList(opts).then(function(list) { @@ -42,7 +43,8 @@ module.exports = { var opts = { user: req.user, module: req.body.module, - version: req.body.version + version: req.body.version, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.addModule(opts).then(function(info) { res.json(info); @@ -54,7 +56,8 @@ module.exports = { delete: function(req,res) { var opts = { user: req.user, - module: req.params[0] + module: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.removeModule(opts).then(function() { res.status(204).end(); @@ -66,7 +69,8 @@ module.exports = { getSet: function(req,res) { var opts = { user: req.user, - id: req.params[0] + "/" + req.params[2] + id: req.params[0] + "/" + req.params[2], + req: apiUtils.getRequestLogObject(req) } if (req.get("accept") === "application/json") { runtimeAPI.nodes.getNodeInfo(opts).then(function(result) { @@ -87,7 +91,8 @@ module.exports = { getModule: function(req,res) { var opts = { user: req.user, - module: req.params[0] + module: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.getModuleInfo(opts).then(function(result) { res.send(result); @@ -106,7 +111,8 @@ module.exports = { var opts = { user: req.user, id: req.params[0] + "/" + req.params[2], - enabled: body.enabled + enabled: body.enabled, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.setNodeSetState(opts).then(function(result) { res.send(result); @@ -125,7 +131,8 @@ module.exports = { var opts = { user: req.user, module: req.params[0], - enabled: body.enabled + enabled: body.enabled, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.setModuleState(opts).then(function(result) { res.send(result); @@ -139,7 +146,8 @@ module.exports = { var opts = { user: req.user, module: req.params[0], - lang: req.query.lng + lang: req.query.lng, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.getModuleCatalog(opts).then(function(result) { res.json(result); @@ -152,7 +160,8 @@ module.exports = { getModuleCatalogs: function(req,res) { var opts = { user: req.user, - lang: req.query.lng + lang: req.query.lng, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.getModuleCatalogs(opts).then(function(result) { res.json(result); @@ -164,7 +173,8 @@ module.exports = { getIcons: function(req,res) { var opts = { - user: req.user + user: req.user, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.nodes.getIconList(opts).then(function(list) { res.json(list); diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/index.js b/packages/node_modules/@node-red/editor-api/lib/editor/index.js index dbf4c18f2..3628fa702 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/index.js @@ -25,8 +25,8 @@ var auth = require("../auth"); var nodes = require("../admin/nodes"); // TODO: move /icons into here var needsPermission; var runtimeAPI; -var log = require("@node-red/util").log; // TODO: separate module -var i18n = require("@node-red/util").i18n; // TODO: separate module +var log = require("@node-red/util").log; +var i18n = require("@node-red/util").i18n; var apiUtil = require("../util"); @@ -93,9 +93,8 @@ module.exports = { // Library var library = require("./library"); library.init(runtimeAPI); - editorApp.get("/library/flows",needsPermission("library.read"),library.getAll,apiUtil.errorHandler); - editorApp.get(/library\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry); - editorApp.post(/library\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry); + editorApp.get(/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry); + editorApp.post(/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry); // Credentials diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/library.js b/packages/node_modules/@node-red/editor-api/lib/editor/library.js index e8b09424a..47a41bb7b 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/library.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/library.js @@ -25,23 +25,12 @@ module.exports = { init: function(_runtimeAPI) { runtimeAPI = _runtimeAPI; }, - - getAll: function(req,res) { - var opts = { - user: req.user, - type: 'flows' - } - runtimeAPI.library.getEntries(opts).then(function(result) { - res.json(result); - }).catch(function(err) { - apiUtils.rejectHandler(req,res,err); - }); - }, getEntry: function(req,res) { var opts = { user: req.user, - type: req.params[0], - path: req.params[1]||"" + library: req.params[0], + type: req.params[1], + path: req.params[2]||"" } runtimeAPI.library.getEntry(opts).then(function(result) { if (typeof result === "string") { @@ -62,8 +51,9 @@ module.exports = { saveEntry: function(req,res) { var opts = { user: req.user, - type: req.params[0], - path: req.params[1]||"" + library: req.params[0], + type: req.params[1], + path: req.params[2]||"" } // TODO: horrible inconsistencies between flows and all other types if (opts.type === "flows") { diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/projects.js b/packages/node_modules/@node-red/editor-api/lib/editor/projects.js index ff7fc5e85..0849c8ff8 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/projects.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/projects.js @@ -22,7 +22,8 @@ var needsPermission = require("../auth").needsPermission; function listProjects(req,res) { var opts = { - user: req.user + user: req.user, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.listProjects(opts).then(function(result) { res.json(result); @@ -33,7 +34,8 @@ function listProjects(req,res) { function getProject(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getProject(opts).then(function(data) { if (data) { @@ -49,7 +51,8 @@ function getProjectStatus(req,res) { var opts = { user: req.user, id: req.params.id, - remote: req.query.remote + remote: req.query.remote, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getStatus(opts).then(function(data){ if (data) { @@ -64,7 +67,8 @@ function getProjectStatus(req,res) { function getProjectRemotes(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getRemotes(opts).then(function(data) { res.json(data); @@ -98,7 +102,8 @@ module.exports = { app.post("/", needsPermission("projects.write"), function(req,res) { var opts = { user: req.user, - project: req.body + project: req.body, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.createProject(opts).then(function(result) { res.json(result); @@ -112,7 +117,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - project: req.body + project: req.body, + req: apiUtils.getRequestLogObject(req) } if (req.body.active) { @@ -150,7 +156,8 @@ module.exports = { app.delete("/:id", needsPermission("projects.write"), function(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.deleteProject(opts).then(function() { res.status(204).end(); @@ -168,7 +175,8 @@ module.exports = { app.get("/:id/files", needsPermission("projects.read"), function(req,res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getFiles(opts).then(function(data) { res.json(data); @@ -185,7 +193,8 @@ module.exports = { user: req.user, id: req.params.id, path: req.params[0], - tree: req.params.treeish + tree: req.params.treeish, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getFile(opts).then(function(data) { res.json({content:data}); @@ -199,7 +208,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - path: req.params[0] + path: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.revertFile(opts).then(function() { @@ -214,7 +224,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - path: req.params[0] + path: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.stageFile(opts).then(function() { getProjectStatus(req,res); @@ -228,7 +239,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - path: req.body.files + path: req.body.files, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.stageFile(opts).then(function() { getProjectStatus(req,res); @@ -242,7 +254,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - message: req.body.message + message: req.body.message, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.commit(opts).then(function() { getProjectStatus(req,res); @@ -256,7 +269,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - path: req.params[0] + path: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.unstageFile(opts).then(function() { getProjectStatus(req,res); @@ -269,7 +283,8 @@ module.exports = { app.delete("/:id/stage", needsPermission("projects.write"), function(req, res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.unstageFile(opts).then(function() { getProjectStatus(req,res); @@ -284,7 +299,8 @@ module.exports = { user: req.user, id: req.params.id, path: req.params[0], - type: req.params.type + type: req.params.type, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getFileDiff(opts).then(function(data) { res.json({ @@ -301,7 +317,8 @@ module.exports = { user: req.user, id: req.params.id, limit: req.query.limit || 20, - before: req.query.before + before: req.query.before, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getCommits(opts).then(function(data) { res.json(data); @@ -315,7 +332,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - sha: req.params.sha + sha: req.params.sha, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getCommit(opts).then(function(data) { res.json({commit:data}); @@ -330,7 +348,8 @@ module.exports = { user: req.user, id: req.params.id, remote: req.params[0], - track: req.query.u + track: req.query.u, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.push(opts).then(function(data) { res.status(204).end(); @@ -346,7 +365,8 @@ module.exports = { id: req.params.id, remote: req.params[0], track: req.query.setUpstream, - allowUnrelatedHistories: req.query.allowUnrelatedHistories + allowUnrelatedHistories: req.query.allowUnrelatedHistories, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.pull(opts).then(function(data) { res.status(204).end(); @@ -359,7 +379,8 @@ module.exports = { app.delete("/:id/merge", needsPermission("projects.write"), function(req, res) { var opts = { user: req.user, - id: req.params.id + id: req.params.id, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.abortMerge(opts).then(function() { res.status(204).end(); @@ -374,7 +395,8 @@ module.exports = { user: req.user, id: req.params.id, path: req.params[0], - resolution: req.body.resolutions + resolution: req.body.resolutions, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.resolveMerge(opts).then(function() { res.status(204).end(); @@ -388,7 +410,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - remote: false + remote: false, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getBranches(opts).then(function(data) { res.json(data); @@ -403,7 +426,8 @@ module.exports = { user: req.user, id: req.params.id, branch: req.params.branchName, - force: !!req.query.force + force: !!req.query.force, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.deleteBranch(opts).then(function(data) { res.status(204).end(); @@ -417,7 +441,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - remote: true + remote: true, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getBranches(opts).then(function(data) { res.json(data); @@ -431,7 +456,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - branch: req.params[0] + branch: req.params[0], + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.getBranchStatus(opts).then(function(data) { res.json(data); @@ -446,7 +472,8 @@ module.exports = { user: req.user, id: req.params.id, branch: req.body.name, - create: req.body.create + create: req.body.create, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.setBranch(opts).then(function(data) { res.json(data); @@ -463,7 +490,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - remote: req.body + remote: req.body, + req: apiUtils.getRequestLogObject(req) } if (/^https?:\/\/[^/]+@/i.test(req.body.url)) { res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"}); @@ -481,7 +509,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - remote: req.params.remoteName + remote: req.params.remoteName, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.removeRemote(opts).then(function(data) { getProjectRemotes(req,res); @@ -497,7 +526,8 @@ module.exports = { var opts = { user: req.user, id: req.params.id, - remote: remote + remote: remote, + req: apiUtils.getRequestLogObject(req) } runtimeAPI.projects.updateRemote(opts).then(function() { res.status(204).end(); diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/settings.js b/packages/node_modules/@node-red/editor-api/lib/editor/settings.js index 944792fb7..9d9867f1b 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/settings.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/settings.js @@ -19,6 +19,8 @@ var sshkeys = require("./sshkeys"); var theme = require("./theme"); var clone = require("clone"); +var i18n = require("@node-red/util").i18n + function extend(target, source) { var keys = Object.keys(source); var i = keys.length; @@ -53,12 +55,14 @@ module.exports = { user: req.user } runtimeAPI.settings.getRuntimeSettings(opts).then(function(result) { + result.editorTheme = result.editorTheme||{}; var themeSettings = theme.settings(); if (themeSettings) { // result.editorTheme may already exist with the palette // disabled. Need to merge that into the receive settings - result.editorTheme = extend(clone(themeSettings),result.editorTheme||{}); + result.editorTheme = extend(clone(themeSettings),result.editorTheme); } + result.editorTheme.languages = i18n.availableLanguages("editor"); res.json(result); }); }, diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/theme.js b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js index ea088b3eb..17dbbafea 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/theme.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/theme.js @@ -28,7 +28,7 @@ var defaultContext = { }, header: { title: "Node-RED", - image: "red/images/node-red.png" + image: "red/images/node-red.svg" }, asset: { red: (process.env.NODE_ENV == "development")? "red/red.js":"red/red.min.js", @@ -169,6 +169,9 @@ module.exports = { } } } + themeApp.get("/", function(req,res) { + res.json(themeContext); + }) if (theme.hasOwnProperty("menu")) { themeSettings.menu = theme.menu; diff --git a/packages/node_modules/@node-red/editor-api/lib/editor/ui.js b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js index ce3ec862c..24b819fec 100644 --- a/packages/node_modules/@node-red/editor-api/lib/editor/ui.js +++ b/packages/node_modules/@node-red/editor-api/lib/editor/ui.js @@ -25,7 +25,7 @@ var theme = require("./theme"); var runtimeAPI; var editorClientDir = path.dirname(require.resolve("@node-red/editor-client")); -var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.png"); +var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.svg"); var editorTemplatePath = path.join(editorClientDir,"templates","index.mst"); var editorTemplate; diff --git a/packages/node_modules/@node-red/editor-api/lib/util.js b/packages/node_modules/@node-red/editor-api/lib/util.js index 1984bd5f1..0cef96bbb 100644 --- a/packages/node_modules/@node-red/editor-api/lib/util.js +++ b/packages/node_modules/@node-red/editor-api/lib/util.js @@ -47,5 +47,12 @@ module.exports = { code: err.code||"unexpected_error", message: err.message||err.toString() }); + }, + getRequestLogObject: function(req) { + return { + user: req.user, + path: req.path, + ip: (req.headers && req.headers['x-forwarded-for']) || (req.connection && req.connection.remoteAddress) || undefined + } } } diff --git a/packages/node_modules/@node-red/editor-api/package.json b/packages/node_modules/@node-red/editor-api/package.json index 60322caeb..e4b3b1f69 100644 --- a/packages/node_modules/@node-red/editor-api/package.json +++ b/packages/node_modules/@node-red/editor-api/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-api", - "version": "0.20.7", + "version": "1.0.0-beta.2", "license": "Apache-2.0", "main": "./lib/index.js", "repository": { @@ -16,8 +16,8 @@ } ], "dependencies": { - "@node-red/util": "0.20.7", - "@node-red/editor-client": "0.20.7", + "@node-red/util": "1.0.0-beta.2", + "@node-red/editor-client": "1.0.0-beta.2", "bcryptjs": "2.4.3", "body-parser": "1.19.0", "clone": "2.1.2", diff --git a/packages/node_modules/@node-red/editor-client/locales/de/editor.json b/packages/node_modules/@node-red/editor-client/locales/de/editor.json index 02e3ccfdf..911816bcc 100755 --- a/packages/node_modules/@node-red/editor-client/locales/de/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/de/editor.json @@ -26,8 +26,7 @@ "status" : "Status", "enabled" : "Aktiviert", "disabled" : "Inaktiviert", - "info" : "Beschreibung", - "tip" : "Beschreibung akzeptiert Markdown und wird auf der Registerkarte Info angezeigt." + "info" : "Beschreibung" }, "menu" : { "label" : { @@ -55,9 +54,6 @@ "export" : "Exportieren", "search" : "Flows durchsuchen", "searchInput" : "durchsuchen Sie Ihre Flows", - "clipboard" : "Zwischenablage", - "library" : "Bibliothek", - "examples" : "Beispiele", "subflows" : "Subflow", "createSubflow" : "Subflow erstellen", "selectionToSubflow" : "Auswahl für Subflow", @@ -136,8 +132,8 @@ } }, "clipboard" : { + "clipboard" : "Zwischenablage", "nodes" : "Nodes", - "selectNodes" : "Wählen Sie den Text oben aus, und kopieren Sie die Datei in die Zwischenablage.", "pasteNodes" : "Nodes hier einfügen", "importNodes" : "Nodes importieren", "exportNodes" : "Nodes in Zwischenablage exportieren", @@ -240,7 +236,6 @@ "deleteSubflow" : "Subflow löschen", "info" : "Beschreibung", "category" : "Kategorie", - "format" : "Markdown-Format", "errors" : { "noNodesSelected" : " Subflow kann nicht erstellt werden : Es wurden keine Nodes ausgewählt.", "multipleInputsToSelection" : " Subflow kann nicht erstellt werden : Mehrere Eingaben zur Auswahl" @@ -297,22 +292,19 @@ "managePalette" : "Palette verwalten" }, "library" : { + "library" : "Bibliothek", "openLibrary" : "Bibliothek öffnen ...", "saveToLibrary" : "In Bibliothek speichern ...", "typeLibrary" : "__type__, Bibliothek", "unnamedType" : "Unbenannt __type__", - "exportToLibrary" : "Node in Bibliothek exportieren", "dialogSaveOverwrite" : "Ein __libraryType__ mit dem Namen __libraryName__ ist bereits vorhanden. Überschreiben?", "invalidFilename" : "Ungültiger Dateiname", "savedNodes" : "Gespeicherte Nodes", "savedType" : "Gespeichert __type__", "saveFailed" : "Speichern fehlgeschlagen: __message__", - "filename" : "Name der Datei", - "folder" : "Ordner", - "filenamePlaceholder" : "Datei", - "fullFilenamePlaceholder" : "a/b/Datei", - "folderPlaceholder" : "a/b", - "breadcrumb" : "Bibliothek" + "types": { + "examples" : "Beispiele" + } }, "palette" : { "noInfo" : "Keine Informationen verfügbar", @@ -826,4 +818,4 @@ "code" : "code" } } -} \ No newline at end of file +} diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 5b4985765..67dfa8a73 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -28,7 +28,8 @@ "status": "Status", "enabled": "Enabled", "disabled":"Disabled", - "info": "Description" + "info": "Description", + "selectNodes": "Click nodes to select" }, "menu": { "label": { @@ -42,7 +43,9 @@ "defaultDir": "Default", "ltr": "Left-to-right", "rtl": "Right-to-left", - "auto": "Contextual" + "auto": "Contextual", + "language": "Language", + "browserDefault": "Browser default" }, "sidebar": { "show": "Show sidebar" @@ -59,9 +62,6 @@ "export": "Export", "search": "Search flows", "searchInput": "search your flows", - "clipboard": "Clipboard", - "library": "Library", - "examples": "Examples", "subflows": "Subflows", "createSubflow": "Create Subflow", "selectionToSubflow": "Selection to Subflow", @@ -154,6 +154,7 @@ } }, "clipboard": { + "clipboard": "Clipboard", "nodes": "Nodes", "node": "__count__ node", "node_plural": "__count__ nodes", @@ -163,7 +164,6 @@ "flow_plural": "__count__ flows", "subflow": "__count__ subflow", "subflow_plural": "__count__ subflows", - "selectNodes": "Select the text above and copy to the clipboard.", "pasteNodes": "Paste flow json or", "selectFile": "select a file to import", "importNodes": "Import nodes", @@ -182,7 +182,11 @@ "all":"all flows", "compact":"compact", "formatted":"formatted", - "copy": "Export to clipboard" + "copy": "Copy to clipboard", + "export": "Export to library", + "exportAs": "Export as", + "overwrite": "Replace", + "exists": "
\"__file__\" already exists.
Do you want to replace it?
" }, "import": { "import": "Import to", @@ -306,6 +310,7 @@ "addNewType": "Add new __type__...", "nodeProperties": "node properties", "label": "Label", + "color": "Color", "portLabels": "Port labels", "labelInputs": "Inputs", "labelOutputs": "Outputs", @@ -317,8 +322,43 @@ "description": "Description", "show": "Show", "hide": "Hide", + "locale": "Select UI Language", + "icon": "Icon", + "inputType": "Input type", + "inputs" : { + "input": "input", + "select": "select", + "checkbox": "checkbox", + "spinner": "spinner", + "none": "none", + "hidden": "hide property" + }, + "types": { + "str": "string", + "num": "number", + "bool": "bool", + "json": "JSON", + "bin": "buffer", + "env": "env variable" + }, + "menu": { + "input": "input", + "select": "select", + "checkbox": "checkbox", + "spinner": "spinner", + "hidden": "label only" + }, + "select": { + "label": "Label", + "value": "Value" + }, + "spinner": { + "min": "Minimum", + "max": "Maximum" + }, "errors": { - "scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it" + "scopeChange": "Changing the scope will make it unavailable to nodes in other flows that use it", + "invalidProperties": "Invalid properties:" } }, "keyboard": { @@ -346,25 +386,26 @@ "pasteNode": "Paste nodes", "undoChange": "Undo the last change performed", "searchBox": "Open search box", - "managePalette": "Manage palette" + "managePalette": "Manage palette", + "actionList":"Action list" }, "library": { + "library": "Library", "openLibrary": "Open Library...", "saveToLibrary": "Save to Library...", "typeLibrary": "__type__ library", "unnamedType": "Unnamed __type__", - "exportToLibrary": "Export nodes to library", + "exportedToLibrary": "Nodes exported to library", "dialogSaveOverwrite": "A __libraryType__ called __libraryName__ already exists. Overwrite?", "invalidFilename": "Invalid filename", "savedNodes": "Saved nodes", "savedType": "Saved __type__", "saveFailed": "Save failed: __message__", - "filename": "Filename", - "folder": "Folder", - "filenamePlaceholder": "file", - "fullFilenamePlaceholder": "a/b/file", - "folderPlaceholder": "a/b", - "breadcrumb": "Library" + "newFolder": "New folder", + "types": { + "local": "Local", + "examples": "Examples" + } }, "palette": { "noInfo": "no information available", @@ -525,7 +566,10 @@ "node": "Node", "flow": "Flow", "global": "Global", - "deleteConfirm": "Are you sure you want to delete this item?" + "deleteConfirm": "Are you sure you want to delete this item?", + "autoRefresh": "Auto-refresh", + "refrsh": "Refresh", + "delete": "Delete" }, "palette": { "name": "Palette management", @@ -726,9 +770,21 @@ "jsEditor": { "title": "JavaScript editor" }, + "textEditor": { + "title": "Text editor" + }, "jsonEditor": { "title": "JSON editor", - "format": "format JSON" + "format": "format JSON", + "rawMode": "Edit JSON", + "uiMode": "Visual editor", + "insertAbove": "Insert above", + "insertBelow": "Insert below", + "addItem": "Add item", + "copyPath": "Copy path to item", + "expandItems": "Expand items", + "collapseItems": "Collapse items", + "duplicate": "Duplicate" }, "markdownEditor": { "title": "Markdown editor", @@ -918,8 +974,17 @@ }, "editor-tab": { "properties": "Properties", + "envProperties": "Environment Variables", "description": "Description", "appearance": "Appearance", - "env": "Environment Variables" + "preview": "UI Preview", + "defaultValue": "Default value" + }, + "languages" : { + "de": "German", + "en-US": "English", + "ja": "Japanese", + "ko": "Korean", + "zh-CN": "Chinese(Simplified)" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index 3672dde38..b95119530 100755 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -28,7 +28,8 @@ "status": "状態", "enabled": "有効", "disabled": "無効", - "info": "詳細" + "info": "詳細", + "selectNodes": "ノードをクリックして選択" }, "menu": { "label": { @@ -42,7 +43,9 @@ "defaultDir": "標準", "ltr": "左から右", "rtl": "右から左", - "auto": "文脈" + "auto": "文脈", + "language": "表示言語", + "browserDefault": "ブラウザのデフォルト" }, "sidebar": { "show": "サイドバーを表示" @@ -59,9 +62,6 @@ "export": "書き出し", "search": "ノードを検索", "searchInput": "ノードを検索", - "clipboard": "クリップボード", - "library": "ライブラリ", - "examples": "サンプル", "subflows": "サブフロー", "createSubflow": "サブフローを作成", "selectionToSubflow": "選択部分をサブフロー化", @@ -80,7 +80,7 @@ "projects-new": "新規", "projects-open": "開く", "projects-settings": "設定", - "showNodeLabelDefault": "追加したノードのラベルを表示する" + "showNodeLabelDefault": "追加したノードのラベルを表示" } }, "actions": { @@ -154,6 +154,7 @@ } }, "clipboard": { + "clipboard": "クリップボード", "nodes": "ノード", "node": "__count__ 個のノード", "node_plural": "__count__ 個のノード", @@ -163,7 +164,6 @@ "flow_plural": "__count__ 個のフロー", "subflow": "__count__ 個のサブフロー", "subflow_plural": "__count__ 個のサブフロー", - "selectNodes": "上のテキストを選択し、クリップボードへコピーしてください", "pasteNodes": "JSON形式のフローデータを貼り付けてください", "selectFile": "読み込むファイルを選択してください", "importNodes": "フローをクリップボートから読み込み", @@ -182,7 +182,11 @@ "all": "全てのタブ", "compact": "インデントのないJSONフォーマット", "formatted": "インデント付きのJSONフォーマット", - "copy": "書き出し" + "copy": "書き出し", + "export": "ライブラリに書き出し", + "exportAs": "書き出し先", + "overwrite": "更新", + "exists": "\"__file__\"は既に存在します。
更新しますか?
" }, "import": { "import": "読み込み先", @@ -306,6 +310,7 @@ "addNewType": "新規に __type__ を追加...", "nodeProperties": "プロパティ", "label": "ラベル", + "color": "色", "portLabels": "ポートラベル", "labelInputs": "入力", "labelOutputs": "出力", @@ -317,8 +322,45 @@ "description": "詳細", "show": "表示", "hide": "非表示", + "locale": "UI言語の選択", + "icon": "記号", + "inputType": "入力形式", + "previewUI": "UI確認", + "previewOK": "確認OK", + "inputs" : { + "input": "入力", + "select": "メニュー", + "checkbox": "チェックボックス", + "spinner": "スピナー", + "none": "無し", + "hidden": "非表示" + }, + "types": { + "str": "文字列", + "num": "数値", + "bool": "真偽", + "json": "JSON", + "bin": "バッファ", + "env": "環境変数" + }, + "menu": { + "input": "入力", + "select": "選択", + "checkbox": "チェックボックス", + "spinner": "数値", + "hidden": "ラベルのみ" + }, + "select": { + "label": "ラベル", + "value": "値" + }, + "spinner": { + "min": "最小値", + "max": "最大値" + }, "errors": { - "scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします" + "scopeChange": "スコープの変更は、他のフローで使われているノードを無効にします", + "invalidProperties": "プロパティが不正です:" } }, "keyboard": { @@ -346,25 +388,26 @@ "pasteNode": "ノードを貼り付け", "undoChange": "変更操作を戻す", "searchBox": "ノードを検索", - "managePalette": "パレットの管理" + "managePalette": "パレットの管理", + "actionList": "動作一覧" }, "library": { + "library": "ライブラリ", "openLibrary": "ライブラリを開く", "saveToLibrary": "ライブラリへ保存", "typeLibrary": "__type__ ライブラリ", "unnamedType": "名前なし __type__", - "exportToLibrary": "ライブラリへフローを書き出す", + "exportedToLibrary": "ライブラリにノードを書き出しました", "dialogSaveOverwrite": "__libraryName__ という __libraryType__ は既に存在しています 上書きしますか?", "invalidFilename": "不正なファイル名", "savedNodes": "フローを保存しました", "savedType": "__type__ を保存しました", "saveFailed": "保存に失敗しました: __message__", - "filename": "ファイル名", - "folder": "フォルダ", - "filenamePlaceholder": "ファイル", - "fullFilenamePlaceholder": "a/b/file", - "folderPlaceholder": "a/b", - "breadcrumb": "ライブラリ" + "newFolder": "新規フォルダ", + "types": { + "local": "ローカル", + "examples": "サンプル" + } }, "palette": { "noInfo": "情報がありません", @@ -522,10 +565,13 @@ "none": "選択されていません", "refresh": "読み込みのため更新してください", "empty": "データが存在しません", - "node": "Node", - "flow": "Flow", - "global": "Global", - "deleteConfirm": "データを削除しても良いですか?" + "node": "ノード", + "flow": "フロー", + "global": "グローバル", + "deleteConfirm": "データを削除しても良いですか?", + "autoRefresh": "自動更新", + "refrsh": "更新", + "delete": "削除" }, "palette": { "name": "パレットの管理", @@ -725,9 +771,21 @@ "jsEditor": { "title": "JavaScriptエディタ" }, + "textEditor": { + "title": "テキストエディタ" + }, "jsonEditor": { "title": "JSONエディタ", - "format": "JSONフォーマット" + "format": "JSONフォーマット", + "rawMode": "JSONを編集", + "uiMode": "ビジュアルエディタ", + "insertAbove": "上に挿入", + "insertBelow": "下に挿入", + "addItem": "要素を追加", + "copyPath": "要素のパスをコピー", + "expandItems": "要素を展開", + "collapseItems": "要素を折り畳む", + "duplicate": "複製" }, "markdownEditor": { "title": "マークダウンエディタ", @@ -917,8 +975,17 @@ }, "editor-tab": { "properties": "プロパティ", + "envProperties": "環境変数", "description": "説明", "appearance": "外観", - "env": "環境変数" + "preview": "UIプレビュー", + "defaultValue": "デフォルト値" + }, + "languages": { + "de": "ドイツ語", + "en-US": "英語", + "ja": "日本語", + "ko": "韓国語", + "zh-CN": "中国語(簡体)" } } diff --git a/packages/node_modules/@node-red/editor-client/locales/ko/editor.json b/packages/node_modules/@node-red/editor-client/locales/ko/editor.json index da7c69e64..7f3c9ea76 100755 --- a/packages/node_modules/@node-red/editor-client/locales/ko/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ko/editor.json @@ -58,9 +58,6 @@ "export": "내보내기", "search": "플로우 겅색", "searchInput": "플로우 검색", - "clipboard": "클립보드", - "library": "라이브러리", - "examples": "예시", "subflows": "보조 플로우", "createSubflow": "보조 플로우 생성", "selectionToSubflow": "보조 플로우 선택", @@ -148,6 +145,7 @@ } }, "clipboard": { + "clipboard": "클립보드", "nodes": "노드", "node": "__count__ 개의 노드", "node_plural": "__count__ 개의 노드", @@ -157,7 +155,6 @@ "flow_plural": "__count__ 개의 플로우", "subflow": "__count__ 개의 서브 플로우", "subflow_plural": "__count__ 개의 서브 플로우", - "selectNodes": "텍스트를 선택하고 클립보드에 복사하세요", "pasteNodes": "여기에 노드를 붙여넣기 하세요", "selectFile": "불러올 파일을 선택하세요", "importNodes": "노드 불러오기", @@ -276,7 +273,6 @@ "deleteSubflow": "서브 플로우 삭제", "info": "상세내역", "category": "카테고리", - "format": "Markdown 형식", "errors": { "noNodesSelected": "서브 플로우를 생성할 수 없습니다 : 노드가 선택되지 않았습니다", "multipleInputsToSelection": "서브 플로우를 생성할 수 없습니다 : 복수의 입력이 선택되었습니다" @@ -338,22 +334,19 @@ "managePalette": "팔렛트 관리" }, "library": { + "library": "라이브러리", "openLibrary": "라이브러리 열기...", "saveToLibrary": "라이브러리로 저장...", "typeLibrary": "__type__ 라이브러리", "unnamedType": "이름없는 __type__", - "exportToLibrary": "라이브러리로 노드 내보내기", "dialogSaveOverwrite": "__libraryType__이 __libraryName__으로 이미 등록되어있습니다. 덮어쓸까요?", "invalidFilename": "파일명이 올바르지 않습니다", "savedNodes": "저장된 노드", "savedType": "저장된 __type__", "saveFailed": "저장 실패 : __message__", - "filename": "파일명", - "folder": "폴더명", - "filenamePlaceholder": "파일", - "fullFilenamePlaceholder": "a/b/file", - "folderPlaceholder": "a/b", - "breadcrumb": "라이브러리" + "types": { + "examples": "예시" + } }, "palette": { "noInfo": "정보 없음", @@ -904,4 +897,4 @@ "description": "상세 내역", "appearance": "모양" } -} \ No newline at end of file +} diff --git a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json index 975a20448..f65f428f6 100644 --- a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json @@ -50,9 +50,6 @@ "export": "导出", "search": "查找流程", "searchInput": "查找流程", - "clipboard": "剪贴板", - "library": "库", - "examples": "例子", "subflows": "子流程", "createSubflow": "新建子流程", "selectionToSubflow": "将选择部分更改为子流程", @@ -100,8 +97,8 @@ } }, "clipboard": { + "clipboard": "剪贴板", "nodes": "节点", - "selectNodes": "选择上面的文本并复制到剪贴板", "pasteNodes": "在这里粘贴节点", "importNodes": "导入节点", "exportNodes": "导出节点至剪贴板", @@ -237,6 +234,7 @@ "managePalette": "管理面板" }, "library": { + "library": "库", "openLibrary": "打开库...", "saveToLibrary": "保存到库...", "typeLibrary": "__type__类型库", @@ -247,12 +245,9 @@ "savedNodes": "保存的节点", "savedType": "已保存__type__", "saveFailed": "保存失败: __message__", - "filename": "文件名", - "folder": "文件夹", - "filenamePlaceholder": "文件", - "fullFilenamePlaceholder": "a/b/文件", - "folderPlaceholder": "a/b", - "breadcrumb": "库" + "types": { + "examples": "例子" + } }, "palette": { "noInfo": "无可用信息", diff --git a/packages/node_modules/@node-red/editor-client/package.json b/packages/node_modules/@node-red/editor-client/package.json index 5c04db292..162b73c75 100644 --- a/packages/node_modules/@node-red/editor-client/package.json +++ b/packages/node_modules/@node-red/editor-client/package.json @@ -1,6 +1,6 @@ { "name": "@node-red/editor-client", - "version": "0.20.7", + "version": "1.0.0-beta.2", "license": "Apache-2.0", "repository": { "type": "git", diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.png deleted file mode 100644 index a2f5373e2..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.svg new file mode 100644 index 000000000..c4511ba87 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows-o.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.png deleted file mode 100644 index e83638234..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.svg new file mode 100644 index 000000000..0b0069272 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-flows.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.png deleted file mode 100644 index b5f3a9870..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.svg new file mode 100644 index 000000000..fc3221f1c --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-full-o.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-full.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-full.png deleted file mode 100644 index 775374d17..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-full.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-full.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-full.svg new file mode 100644 index 000000000..e4448e10f --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-full.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.png deleted file mode 100644 index 3174716cc..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.svg new file mode 100644 index 000000000..af540dd3d --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes-o.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.png deleted file mode 100644 index 4d982a9c8..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.svg new file mode 100644 index 000000000..12d4c8972 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-nodes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png b/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png deleted file mode 100644 index 197fc610d..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.svg b/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.svg new file mode 100644 index 000000000..00f319014 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/deploy-reload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.png b/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.png deleted file mode 100644 index e38f39146..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.svg b/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.svg new file mode 100644 index 000000000..a5fcb49af --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/icons/arrow-in.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/images/icons/node-changed.png b/packages/node_modules/@node-red/editor-client/src/images/icons/node-changed.png deleted file mode 100644 index 38a179444..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/icons/node-changed.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/icons/node-error.png b/packages/node_modules/@node-red/editor-client/src/images/icons/node-error.png deleted file mode 100644 index c20c8e85a..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/icons/node-error.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/node-red.png b/packages/node_modules/@node-red/editor-client/src/images/node-red.png deleted file mode 100644 index a60c26729..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/node-red.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/node-red.svg b/packages/node_modules/@node-red/editor-client/src/images/node-red.svg new file mode 100644 index 000000000..c62b35866 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/node-red.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/pw_maze_white.png b/packages/node_modules/@node-red/editor-client/src/images/pw_maze_white.png deleted file mode 100644 index 66464831c..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/pw_maze_white.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.png b/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.png deleted file mode 100644 index 022777c4d..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.svg b/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.svg new file mode 100644 index 000000000..4acb241e4 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/subflow_tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.png deleted file mode 100644 index 247371fe5..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.svg new file mode 100644 index 000000000..29c54b860 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/09.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.png deleted file mode 100644 index 5f5d2404e..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.svg new file mode 100644 index 000000000..e0abbdc4a --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/az.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.png deleted file mode 100644 index 615c8dd4f..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.svg new file mode 100644 index 000000000..0ef91aed8 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.png deleted file mode 100644 index 9530983de..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.svg new file mode 100644 index 000000000..e2e4297c7 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/bool.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.png deleted file mode 100644 index 0ea51da00..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.svg new file mode 100644 index 000000000..bddd1c082 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/env.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.png deleted file mode 100644 index 704105ce5..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.svg new file mode 100644 index 000000000..c6357af50 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/expr.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.png deleted file mode 100644 index 57ac8761f..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.svg new file mode 100644 index 000000000..713fe7944 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/json.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.png b/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.png deleted file mode 100644 index 87deb02ae..000000000 Binary files a/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.png and /dev/null differ diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.svg new file mode 100644 index 000000000..c30cbff55 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/re.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/images/typedInput/target.svg b/packages/node_modules/@node-red/editor-client/src/images/typedInput/target.svg new file mode 100644 index 000000000..b98996701 --- /dev/null +++ b/packages/node_modules/@node-red/editor-client/src/images/typedInput/target.svg @@ -0,0 +1 @@ + diff --git a/packages/node_modules/@node-red/editor-client/src/js/comms.js b/packages/node_modules/@node-red/editor-client/src/js/comms.js index ea128424b..75a018a56 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/comms.js +++ b/packages/node_modules/@node-red/editor-client/src/js/comms.js @@ -143,7 +143,7 @@ RED.comms = (function() { } else { var msg = RED._("notification.errors.lostConnectionReconnect",{time: connectCountdown})+' '+ RED._("notification.errors.lostConnectionTry")+''; errornotification.update(msg,{silent:true}); - $(errornotification).find("a").click(function(e) { + $(errornotification).find("a").on("click", function(e) { e.preventDefault(); errornotification.update(RED._("notification.errors.lostConnection"),{silent:true}); clearInterval(connectCountdownTimer); diff --git a/packages/node_modules/@node-red/editor-client/src/js/history.js b/packages/node_modules/@node-red/editor-client/src/js/history.js index 2e256564c..db54701bb 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/history.js +++ b/packages/node_modules/@node-red/editor-client/src/js/history.js @@ -14,7 +14,8 @@ * limitations under the License. **/ RED.history = (function() { - var undo_history = []; + var undoHistory = []; + var redoHistory = []; function undoEvent(ev) { var i; @@ -22,52 +23,81 @@ RED.history = (function() { var node; var subflow; var modifiedTabs = {}; + var inverseEv; if (ev) { if (ev.t == 'multi') { + inverseEv = { + t: 'multi', + events: [] + }; len = ev.events.length; for (i=len-1;i>=0;i--) { - undoEvent(ev.events[i]); + var r = undoEvent(ev.events[i]); + inverseEv.events.push(r); } } else if (ev.t == 'replace') { + inverseEv = { + t: 'replace', + config: RED.nodes.createCompleteNodeSet(), + changed: [], + rev: RED.nodes.version() + }; RED.nodes.clear(); var imported = RED.nodes.import(ev.config); imported[0].forEach(function(n) { if (ev.changed[n.id]) { n.changed = true; + inverseEv.changed[n.id] = true; } }) RED.nodes.version(ev.rev); } else if (ev.t == 'add') { + inverseEv = { + t: "delete", + }; if (ev.nodes) { + inverseEv.nodes = []; for (i=0;i').appendTo(parseError);
- $('').text(v.substring(errorPos-12,errorPos)).appendTo(code)
- $('').text(v.charAt(errorPos)).appendTo(code);
- $('').text(v.substring(errorPos+1,errorPos+12)).appendTo(code);
- }
- popover.close(true).setContent(message).open();
- currentPopoverError = errString;
- }
- } else {
- currentPopoverError = null;
- }
- $("#clipboard-dialog-ok").button("disable");
+ validateExportFilenameTimeout = setTimeout(function() {
+ var filenameInput = $("#red-ui-clipboard-dialog-tab-library-name");
+ var filename = filenameInput.val().trim();
+ var valid = filename.length > 0 && !/[\/\\]/.test(filename);
+ if (valid) {
+ filenameInput.removeClass("input-error");
+ $("#red-ui-clipboard-dialog-export").button("enable");
+ } else {
+ filenameInput.addClass("input-error");
+ $("#red-ui-clipboard-dialog-export").button("disable");
}
},100);
}
- function importNodes() {
+ var validateImportTimeout;
+ function validateImport() {
+ if (activeTab === "red-ui-clipboard-dialog-import-tab-clipboard") {
+ if (validateImportTimeout) {
+ clearTimeout(validateImportTimeout);
+ }
+ validateImportTimeout = setTimeout(function() {
+ var importInput = $("#red-ui-clipboard-dialog-import-text");
+ var v = importInput.val().trim();
+ if (v === "") {
+ popover.close(true);
+ currentPopoverError = null;
+ importInput.removeClass("input-error");
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ return;
+ }
+ try {
+ if (!/^\[[\s\S]*\]$/m.test(v)) {
+ throw new Error(RED._("clipboard.import.errors.notArray"));
+ }
+ var res = JSON.parse(v);
+ for (var i=0;i
').appendTo(parseError);
+ $('').text(v.substring(errorPos-12,errorPos)).appendTo(code)
+ $('').text(v.charAt(errorPos)).appendTo(code);
+ $('').text(v.substring(errorPos+1,errorPos+12)).appendTo(code);
+ }
+ popover.close(true).setContent(message).open();
+ currentPopoverError = errString;
+ }
+ } else {
+ currentPopoverError = null;
+ }
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ }
+ },100);
+ } else {
+ var file = libraryBrowser.getSelected();
+ if (file && file.label && !file.children) {
+ $("#red-ui-clipboard-dialog-ok").button("enable");
+ } else {
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ }
+ }
+ }
+
+ function importNodes(mode) {
if (disabled) {
return;
}
+ mode = mode || "clipboard";
+
dialogContainer.empty();
dialogContainer.append($(importNodesDialog));
+
+ var tabs = RED.tabs.create({
+ id: "red-ui-clipboard-dialog-import-tabs",
+ vertical: true,
+ onchange: function(tab) {
+ $("#red-ui-clipboard-dialog-import-tabs-content").children().hide();
+ $("#" + tab.id).show();
+ activeTab = tab.id;
+ if (popover) {
+ popover.close(true);
+ currentPopoverError = null;
+ }
+ if (tab.id === "red-ui-clipboard-dialog-import-tab-clipboard") {
+ $("#red-ui-clipboard-dialog-import-text").trigger("focus");
+ } else {
+ libraryBrowser.focus();
+ }
+ validateImport();
+ }
+ });
+ tabs.addTab({
+ id: "red-ui-clipboard-dialog-import-tab-clipboard",
+ label: RED._("clipboard.clipboard")
+ });
+ tabs.addTab({
+ id: "red-ui-clipboard-dialog-import-tab-library",
+ label: RED._("library.library")
+ });
+ tabs.addTab({
+ id: "red-ui-clipboard-dialog-import-tab-examples",
+ label: RED._("library.types.examples")
+ });
+
+ $("#red-ui-clipboard-dialog-tab-library-name").on("keyup", validateExportFilename);
+ $("#red-ui-clipboard-dialog-tab-library-name").on('paste',function() { setTimeout(validateExportFilename,10)});
+ $("#red-ui-clipboard-dialog-export").button("enable");
+
+ libraryBrowser = RED.library.createBrowser({
+ container: $("#red-ui-clipboard-dialog-import-tab-library"),
+ onselect: function(file) {
+ if (file && file.label && !file.children) {
+ $("#red-ui-clipboard-dialog-ok").button("enable");
+ } else {
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ }
+ },
+ onconfirm: function(item) {
+ if (item && item.label && !item.children) {
+ $("#red-ui-clipboard-dialog-ok").trigger("click");
+ }
+ }
+ })
+ loadFlowLibrary(libraryBrowser,"local",RED._("library.types.local"));
+
+ examplesBrowser = RED.library.createBrowser({
+ container: $("#red-ui-clipboard-dialog-import-tab-examples"),
+ onselect: function(file) {
+ if (file && file.label && !file.children) {
+ $("#red-ui-clipboard-dialog-ok").button("enable");
+ } else {
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ }
+ },
+ onconfirm: function(item) {
+ if (item && item.label && !item.children) {
+ $("#red-ui-clipboard-dialog-ok").trigger("click");
+ }
+ }
+ })
+ loadFlowLibrary(examplesBrowser,"_examples_",RED._("library.types.examples"));
+
+
dialogContainer.i18n();
- $("#clipboard-dialog-ok").show();
- $("#clipboard-dialog-cancel").show();
- $("#clipboard-dialog-close").hide();
- $("#clipboard-dialog-copy").hide();
- $("#clipboard-dialog-download").hide();
- $("#clipboard-dialog-ok").button("disable");
- $("#clipboard-import").keyup(validateImport);
- $("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)});
+ $("#red-ui-clipboard-dialog-ok").show();
+ $("#red-ui-clipboard-dialog-cancel").show();
+ $("#red-ui-clipboard-dialog-export").hide();
+ $("#red-ui-clipboard-dialog-download").hide();
+ $("#red-ui-clipboard-dialog-ok").button("disable");
+ $("#red-ui-clipboard-dialog-import-text").on("keyup", validateImport);
+ $("#red-ui-clipboard-dialog-import-text").on('paste',function() { setTimeout(validateImport,10)});
- $("#import-tab > a").click(function(evt) {
+ $("#red-ui-clipboard-dialog-import-opt > a").on("click", function(evt) {
evt.preventDefault();
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
return;
@@ -255,66 +454,122 @@ RED.clipboard = (function() {
$(this).addClass('selected');
});
- $("#import-file-upload").change(function() {
+ $("#red-ui-clipboard-dialog-import-file-upload").on("change", function() {
var fileReader = new FileReader();
fileReader.onload = function () {
- $("#clipboard-import").val(fileReader.result);
+ $("#red-ui-clipboard-dialog-import-text").val(fileReader.result);
validateImport();
};
fileReader.readAsText($(this).prop('files')[0]);
})
- $("#import-file-upload-btn").click(function(evt) {
+ $("#red-ui-clipboard-dialog-import-file-upload-btn").on("click", function(evt) {
evt.preventDefault();
- $("#import-file-upload").click();
+ $("#red-ui-clipboard-dialog-import-file-upload").trigger("click");
})
+ tabs.activateTab("red-ui-clipboard-dialog-import-tab-"+mode);
+ if (mode === 'clipboard') {
+ setTimeout(function() {
+ $("#red-ui-clipboard-dialog-import-text").trigger("focus");
+ },100)
+ }
+
+
dialog.dialog("option","title",RED._("clipboard.importNodes")).dialog("open");
popover = RED.popover.create({
- target: $("#clipboard-import"),
+ target: $("#red-ui-clipboard-dialog-import-text"),
trigger: "manual",
direction: "bottom",
content: ""
});
}
- function exportNodes() {
+ function exportNodes(mode) {
if (disabled) {
return;
}
+ mode = mode || "clipboard";
+
dialogContainer.empty();
dialogContainer.append($(exportNodesDialog));
- dialogContainer.i18n();
- var format = RED.settings.flowFilePretty ? "export-format-full" : "export-format-mini";
- $("#export-format-group > a").click(function(evt) {
+ var tabs = RED.tabs.create({
+ id: "red-ui-clipboard-dialog-export-tabs",
+ vertical: true,
+ onchange: function(tab) {
+ $("#red-ui-clipboard-dialog-export-tabs-content").children().hide();
+ $("#" + tab.id).show();
+ activeTab = tab.id;
+ if (tab.id === "red-ui-clipboard-dialog-export-tab-clipboard") {
+ $("#red-ui-clipboard-dialog-export").button("option","label", RED._("clipboard.export.copy"))
+ $("#red-ui-clipboard-dialog-download").show();
+ } else {
+ $("#red-ui-clipboard-dialog-export").button("option","label", RED._("clipboard.export.export"))
+ $("#red-ui-clipboard-dialog-download").hide();
+ libraryBrowser.focus();
+ }
+
+ }
+ });
+ tabs.addTab({
+ id: "red-ui-clipboard-dialog-export-tab-clipboard",
+ label: RED._("clipboard.clipboard")
+ });
+ tabs.addTab({
+ id: "red-ui-clipboard-dialog-export-tab-library",
+ label: RED._("library.library")
+ });
+
+ $("#red-ui-clipboard-dialog-tab-library-name").on("keyup", validateExportFilename);
+ $("#red-ui-clipboard-dialog-tab-library-name").on('paste',function() { setTimeout(validateExportFilename,10)});
+ $("#red-ui-clipboard-dialog-export").button("enable");
+
+ libraryBrowser = RED.library.createBrowser({
+ container: $("#red-ui-clipboard-dialog-export-tab-library-browser"),
+ folderTools: true,
+ onselect: function(file) {
+ if (file && file.label && !file.children) {
+ $("#red-ui-clipboard-dialog-tab-library-name").val(file.label);
+ }
+ }
+ })
+ loadFlowLibrary(libraryBrowser,"local",RED._("library.types.local"));
+
+ $("#red-ui-clipboard-dialog-tab-library-name").val("flows.json").select();
+
+ dialogContainer.i18n();
+ var format = RED.settings.flowFilePretty ? "red-ui-clipboard-dialog-export-fmt-full" : "red-ui-clipboard-dialog-export-fmt-mini";
+
+ $("#red-ui-clipboard-dialog-export-fmt-group > a").on("click", function(evt) {
evt.preventDefault();
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
- $("#clipboard-export").focus();
+ $("#red-ui-clipboard-dialog-export-text").trigger("focus");
return;
}
$(this).parent().children().removeClass('selected');
$(this).addClass('selected');
- var flow = $("#clipboard-export").val();
+ var flow = $("#red-ui-clipboard-dialog-export-text").val();
if (flow.length > 0) {
var nodes = JSON.parse(flow);
format = $(this).attr('id');
- if (format === 'export-format-full') {
+ if (format === 'red-ui-clipboard-dialog-export-fmt-full') {
flow = JSON.stringify(nodes,null,4);
} else {
flow = JSON.stringify(nodes);
}
- $("#clipboard-export").val(flow);
- $("#clipboard-export").focus();
+ $("#red-ui-clipboard-dialog-export-text").val(flow);
+ setTimeout(function() { $("#red-ui-clipboard-dialog-export-text").scrollTop(0); },50);
+
+ $("#red-ui-clipboard-dialog-export-text").trigger("focus");
}
});
- $("#export-range-group > a").click(function(evt) {
+ $("#red-ui-clipboard-dialog-export-rng-group > a").on("click", function(evt) {
evt.preventDefault();
if ($(this).hasClass('disabled') || $(this).hasClass('selected')) {
- $("#clipboard-export").focus();
return;
}
$(this).parent().children().removeClass('selected');
@@ -322,7 +577,7 @@ RED.clipboard = (function() {
var type = $(this).attr('id');
var flow = "";
var nodes = null;
- if (type === 'export-range-selected') {
+ if (type === 'red-ui-clipboard-dialog-export-rng-selected') {
var selection = RED.workspaces.selection();
if (selection.length > 0) {
nodes = [];
@@ -335,77 +590,97 @@ RED.clipboard = (function() {
}
// Don't include the subflow meta-port nodes in the exported selection
nodes = RED.nodes.createExportableNodeSet(nodes.filter(function(n) { return n.type !== 'subflow'}));
- } else if (type === 'export-range-flow') {
+ } else if (type === 'red-ui-clipboard-dialog-export-rng-flow') {
var activeWorkspace = RED.workspaces.active();
nodes = RED.nodes.filterNodes({z:activeWorkspace});
var parentNode = RED.nodes.workspace(activeWorkspace)||RED.nodes.subflow(activeWorkspace);
nodes.unshift(parentNode);
nodes = RED.nodes.createExportableNodeSet(nodes);
- } else if (type === 'export-range-full') {
+ } else if (type === 'red-ui-clipboard-dialog-export-rng-full') {
nodes = RED.nodes.createCompleteNodeSet(false);
}
if (nodes !== null) {
- if (format === "export-format-full") {
+ if (format === "red-ui-clipboard-dialog-export-fmt-full") {
flow = JSON.stringify(nodes,null,4);
} else {
flow = JSON.stringify(nodes);
}
}
if (flow.length > 0) {
- $("#export-copy").removeClass('disabled');
+ $("#red-ui-clipboard-dialog-export").removeClass('disabled');
} else {
- $("#export-copy").addClass('disabled');
+ $("#red-ui-clipboard-dialog-export").addClass('disabled');
}
- $("#clipboard-export").val(flow);
- $("#clipboard-export").focus();
+ $("#red-ui-clipboard-dialog-export-text").val(flow);
+ setTimeout(function() { $("#red-ui-clipboard-dialog-export-text").scrollTop(0); },50);
+ $("#red-ui-clipboard-dialog-export-text").trigger("focus");
})
- $("#clipboard-dialog-ok").hide();
- $("#clipboard-dialog-cancel").hide();
- $("#clipboard-dialog-copy").hide();
- $("#clipboard-dialog-close").hide();
+ $("#red-ui-clipboard-dialog-ok").hide();
+ $("#red-ui-clipboard-dialog-cancel").hide();
+ $("#red-ui-clipboard-dialog-export").hide();
var selection = RED.workspaces.selection();
if (selection.length > 0) {
- $("#export-range-selected").click();
+ $("#red-ui-clipboard-dialog-export-rng-selected").trigger("click");
} else {
selection = RED.view.selection();
if (selection.nodes) {
- $("#export-range-selected").click();
+ $("#red-ui-clipboard-dialog-export-rng-selected").trigger("click");
} else {
- $("#export-range-selected").addClass('disabled').removeClass('selected');
- $("#export-range-flow").click();
+ $("#red-ui-clipboard-dialog-export-rng-selected").addClass('disabled').removeClass('selected');
+ $("#red-ui-clipboard-dialog-export-rng-flow").trigger("click");
}
}
- if (format === "export-format-full") {
- $("#export-format-full").click();
+ if (format === "red-ui-clipboard-dialog-export-fmt-full") {
+ $("#red-ui-clipboard-dialog-export-fmt-full").trigger("click");
} else {
- $("#export-format-mini").click();
+ $("#red-ui-clipboard-dialog-export-fmt-mini").trigger("click");
}
- $("#clipboard-export")
- .focus(function() {
- var textarea = $(this);
- textarea.select();
- textarea.mouseup(function() {
- textarea.unbind("mouseup");
- return false;
- })
- });
+ tabs.activateTab("red-ui-clipboard-dialog-export-tab-"+mode);
dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
- $("#clipboard-export").focus();
- if (!document.queryCommandSupported("copy")) {
- $("#clipboard-dialog-cancel").hide();
- $("#clipboard-dialog-close").show();
- } else {
- $("#clipboard-dialog-cancel").show();
- $("#clipboard-dialog-copy").show();
- }
- $("#clipboard-dialog-download").show();
+ $("#red-ui-clipboard-dialog-export-text").trigger("focus");
+ $("#red-ui-clipboard-dialog-cancel").show();
+ $("#red-ui-clipboard-dialog-export").show();
+ $("#red-ui-clipboard-dialog-download").show();
+
+ }
+
+ function loadFlowLibrary(browser,library,label) {
+ // if (includeExamples) {
+ // listing.push({
+ // library: "_examples_",
+ // type: "flows",
+ // icon: 'fa fa-hdd-o',
+ // label: RED._("library.types.examples"),
+ // path: "",
+ // children: function(done,item) {
+ // RED.library.loadLibraryFolder("_examples_","flows","",function(children) {
+ // item.children = children;
+ // done(children);
+ // })
+ // }
+ // })
+ // }
+ browser.data([{
+ library: library,
+ type: "flows",
+ icon: 'fa fa-hdd-o',
+ label: label,
+ path: "",
+ expanded: true,
+ children: function(done, item) {
+ RED.library.loadLibraryFolder(library,"flows","",function(children) {
+ item.children = children;
+ done(children);
+ })
+ }
+ }], true);
}
function hideDropTarget() {
- $("#dropTarget").hide();
+ $("#red-ui-drop-target").hide();
RED.keyboard.remove("escape");
}
function copyText(value,element,msg) {
@@ -435,7 +710,7 @@ RED.clipboard = (function() {
if (truncated) {
msg += "_truncated";
}
- $("#clipboard-hidden").val(value).select();
+ $("#red-ui-clipboard-hidden").val(value).select();
var result = document.execCommand("copy");
if (result && element) {
var popover = RED.popover.create({
@@ -455,29 +730,34 @@ RED.clipboard = (function() {
init: function() {
setupDialogs();
- $('').appendTo("body");
+ $('').appendTo("#red-ui-editor");
RED.actions.add("core:show-export-dialog",exportNodes);
RED.actions.add("core:show-import-dialog",importNodes);
+ RED.actions.add("core:show-library-export-dialog",function() { exportNodes('library') });
+ RED.actions.add("core:show-library-import-dialog",function() { importNodes('library') });
RED.events.on("editor:open",function() { disabled = true; });
RED.events.on("editor:close",function() { disabled = false; });
RED.events.on("search:open",function() { disabled = true; });
RED.events.on("search:close",function() { disabled = false; });
+ RED.events.on("actionList:open",function() { disabled = true; });
+ RED.events.on("actionList:close",function() { disabled = false; });
RED.events.on("type-search:open",function() { disabled = true; });
RED.events.on("type-search:close",function() { disabled = false; });
+ $('
').appendTo('#red-ui-editor');
- $('#chart').on("dragenter",function(event) {
+ $('#red-ui-workspace-chart').on("dragenter",function(event) {
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
- $("#dropTarget").css({display:'table'});
+ $("#red-ui-drop-target").css({display:'table'});
RED.keyboard.add("*", "escape" ,hideDropTarget);
}
});
- $('#dropTarget').on("dragover",function(event) {
+ $('#red-ui-drop-target').on("dragover",function(event) {
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1 ||
$.inArray("Files",event.originalEvent.dataTransfer.types) != -1) {
event.preventDefault();
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js
index be7d2d4cd..157c1e495 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/checkboxSet.js
@@ -38,7 +38,7 @@
this.options[0].show();
}
- this.element.change(function() {
+ this.element.on("change", function() {
if (this.checked) {
that.options[0].hide();
that.options[1].show();
@@ -53,7 +53,7 @@
child.checkboxSet('state',isChecked,false,true);
})
})
- this.uiElement.click(function(e) {
+ this.uiElement.on("click", function(e) {
e.stopPropagation();
// state returns null for a partial state. Clicking on that should
// result in false.
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js
index ee29a6a35..06ccc97d9 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/editableList.js
@@ -32,7 +32,10 @@
* - scrollOnAdd : boolean - whether to scroll to newly added items
* methods:
* - addItem(itemData)
+ * - insertItemAt : function(data,index) - add an item at the specified index
* - removeItem(itemData)
+ * - getItemAt(index)
+ * - indexOf(itemData)
* - width(width)
* - height(height)
* - items()
@@ -75,9 +78,9 @@
addLabel = 'add';
}
}
- $(' '+addLabel+'')
+ $(' '+addLabel+'')
.appendTo(this.topContainer)
- .click(function(evt) {
+ .on("click", function(evt) {
evt.preventDefault();
that.addItem({});
});
@@ -185,6 +188,11 @@
}
},
_destroy: function() {
+ if (this.topContainer) {
+ var tc = this.topContainer;
+ delete this.topContainer;
+ tc.remove();
+ }
},
_refreshFilter: function() {
var that = this;
@@ -230,7 +238,24 @@
this.uiHeight = desiredHeight;
this._resize();
},
- addItem: function(data) {
+ getItemAt: function(index) {
+ var items = this.items();
+ if (index >= 0 && index < items.length) {
+ return $(items[index]).data('data');
+ } else {
+ return;
+ }
+ },
+ indexOf: function(data) {
+ var items = this.items();
+ for (var i=0;i');
@@ -248,7 +273,13 @@
});
}
if (!added) {
- li.appendTo(this.element);
+ if (index <= 0) {
+ li.prependTo(this.element);
+ } else if (index > that.element.children().length-1) {
+ li.appendTo(this.element);
+ } else {
+ li.insertBefore(this.element.children().eq(index));
+ }
}
var row = $('').addClass("red-ui-editableList-item-content").appendTo(li);
row.data('data',data);
@@ -257,10 +288,10 @@
li.addClass("red-ui-editableList-item-sortable");
}
if (this.options.removable) {
- var deleteButton = $('',{href:"#",class:"red-ui-editableList-item-remove editor-button editor-button-small"}).appendTo(li);
+ var deleteButton = $('',{href:"#",class:"red-ui-editableList-item-remove red-ui-button red-ui-button-small"}).appendTo(li);
$('',{class:"fa fa-remove"}).appendTo(deleteButton);
li.addClass("red-ui-editableList-item-removable");
- deleteButton.click(function(evt) {
+ deleteButton.on("click", function(evt) {
evt.preventDefault();
var data = row.data('data');
li.addClass("red-ui-editableList-item-deleting")
@@ -293,6 +324,9 @@
},0);
}
},
+ addItem: function(data) {
+ this.insertItemAt(data,this.element.children().length)
+ },
addItems: function(items) {
for (var i=0; i 0) {
this.uiContainer.scrollTop(this.uiContainer.scrollTop()+items.position().top)
}
+ },
+ getItem: function(li) {
+ var el = li.find(".red-ui-editableList-item-content");
+ if (el.length) {
+ return el.data('data');
+ } else {
+ return null;
+ }
}
});
})(jQuery);
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
index 612bf4516..3e16ef9d3 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/menu.js
@@ -56,12 +56,12 @@ RED.menu = (function() {
}
if (opt === null) {
- item = $('');
+ item = $('');
} else {
item = $('');
if (opt.group) {
- item.addClass("menu-group-"+opt.group);
+ item.addClass("red-ui-menu-group-"+opt.group);
}
var linkContent = '';
@@ -71,7 +71,7 @@ RED.menu = (function() {
}
if (opt.icon !== undefined) {
- if (/\.png/.test(opt.icon)) {
+ if (/\.(png|svg)/.test(opt.icon)) {
linkContent += ' ';
} else {
linkContent += ' ';
@@ -79,10 +79,10 @@ RED.menu = (function() {
}
if (opt.sublabel) {
- linkContent += '';
@@ -92,27 +92,16 @@ RED.menu = (function() {
menuItems[opt.id] = opt;
if (opt.onselect) {
- link.click(function(e) {
+ link.on("click", function(e) {
e.preventDefault();
if ($(this).parent().hasClass("disabled")) {
return;
}
if (opt.toggle) {
- var selected = isSelected(opt.id);
- if (typeof opt.toggle === "string") {
- if (!selected) {
- for (var m in menuItems) {
- if (menuItems.hasOwnProperty(m)) {
- var mi = menuItems[m];
- if (mi.id != opt.id && opt.toggle == mi.toggle) {
- setSelected(mi.id,false);
- }
- }
- }
- setSelected(opt.id,true);
- }
+ if (opt.toggle === true) {
+ setSelected(opt.id, !isSelected(opt.id));
} else {
- setSelected(opt.id, !selected);
+ setSelected(opt.id, true);
}
} else {
triggerAction(opt.id);
@@ -125,13 +114,13 @@ RED.menu = (function() {
link.attr("target","_blank").attr("href",opt.href);
} else if (!opt.options) {
item.addClass("disabled");
- link.click(function(event) {
+ link.on("click", function(event) {
event.preventDefault();
});
}
if (opt.options) {
- item.addClass("dropdown-submenu pull-left");
- var submenu = $(' '
+ linkContent += ' '
} else {
- linkContent += ' '
+ linkContent += ' '
}
linkContent += ' ').appendTo(item);
+ item.addClass("red-ui-menu-dropdown-submenu pull-left");
+ var submenu = $(' ').appendTo(item);
for (var i=0;i",{class:"dropdown-menu pull-right"});
+ var topMenu = $("
",{class:"red-ui-menu red-ui-menu-dropdown pull-right"});
if (options.id) {
topMenu.attr({id:options.id+"-submenu"});
var menuParent = $("#"+options.id);
if (menuParent.length === 1) {
topMenu.insertAfter(menuParent);
+ menuParent.on("click", function(evt) {
+ evt.stopPropagation();
+ evt.preventDefault();
+ if (topMenu.is(":visible")) {
+ $(document).off("click.red-ui-menu");
+ topMenu.hide();
+ } else {
+ $(document).on("click.red-ui-menu", function(evt) {
+ $(document).off("click.red-ui-menu");
+ activeMenu = null;
+ topMenu.hide();
+ });
+ $(".red-ui-menu").hide();
+ topMenu.show();
+ }
+ })
}
}
@@ -193,8 +198,9 @@ RED.menu = (function() {
}
function setSelected(id,state) {
+ var alreadySet = false;
if (isSelected(id) == state) {
- return;
+ alreadySet = true;
}
var opt = menuItems[id];
if (state) {
@@ -202,10 +208,26 @@ RED.menu = (function() {
} else {
$("#"+id).removeClass("active");
}
- if (opt && opt.onselect) {
- triggerAction(opt.id,state);
+ if (opt) {
+ if (opt.toggle && typeof opt.toggle === "string") {
+ if (state) {
+ for (var m in menuItems) {
+ if (menuItems.hasOwnProperty(m)) {
+ var mi = menuItems[m];
+ if (mi.id != opt.id && opt.toggle == mi.toggle) {
+ setSelected(mi.id,false);
+ }
+ }
+ }
+ }
+ }
+ if (!alreadySet && opt.onselect) {
+ triggerAction(opt.id,state);
+ }
+ }
+ if (!opt.local && !alreadySet) {
+ RED.settings.set(opt.setting||("menu-"+opt.id), state);
}
- RED.settings.set(opt.setting||("menu-"+opt.id), state);
}
function toggleSelected(id) {
@@ -223,13 +245,13 @@ RED.menu = (function() {
function addItem(id,opt) {
var item = createMenuItem(opt);
if (opt.group) {
- var groupItems = $("#"+id+"-submenu").children(".menu-group-"+opt.group);
+ var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
if (groupItems.length === 0) {
item.appendTo("#"+id+"-submenu");
} else {
for (var i=0;i
'+RED._("deploy.successfulRestart")+'
',"success"); }).fail(function(xhr,textStatus,err) { if (deployWasEnabled) { - $("#btn-deploy").removeClass("disabled"); + $("#red-ui-header-button-deploy").removeClass("disabled"); } if (xhr.status === 401) { RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error"); @@ -304,17 +310,17 @@ RED.deploy = (function() { deployInflight = false; var delta = Math.max(0,300-(Date.now()-startTime)); setTimeout(function() { - $(".deploy-button-content").css('opacity',1); - $(".deploy-button-spinner").hide(); - $("#header-shade").hide(); - $("#editor-shade").hide(); - $("#palette-shade").hide(); - $("#sidebar-shade").hide(); + $(".red-ui-deploy-button-content").css('opacity',1); + $(".red-ui-deploy-button-spinner").hide(); + $("#red-ui-header-shade").hide(); + $("#red-ui-editor-shade").hide(); + $("#red-ui-palette-shade").hide(); + $("#red-ui-sidebar-shade").hide(); },delta); }); } function save(skipValidation,force) { - if (!$("#btn-deploy").hasClass("disabled")) { + if (!$("#red-ui-header-button-deploy").hasClass("disabled")) { if (!RED.user.hasPermission("flows.write")) { RED.notify(RED._("user.errors.deploy"),"error"); return; @@ -355,13 +361,13 @@ RED.deploy = (function() { if (hasUnknown && !ignoreDeployWarnings.unknown) { showWarning = true; notificationMessage = ""+RED._('deploy.confirm.unknown')+"
"+ - '"+ + '
"+ RED._('deploy.confirm.confirm')+ "
"; notificationButtons= [ { - id: "node-dialog-confirm-deploy-deploy", + id: "red-ui-deploy-dialog-confirm-deploy-deploy", text: RED._("deploy.confirm.button.confirm"), class: "primary", click: function() { @@ -375,12 +381,12 @@ RED.deploy = (function() { invalidNodes.sort(sortNodeInfo); notificationMessage = ""+RED._('deploy.confirm.improperlyConfigured')+"
"+ - '"+ + '
"+ RED._('deploy.confirm.confirm')+ "
"; notificationButtons= [ { - id: "node-dialog-confirm-deploy-deploy", + id: "red-ui-deploy-dialog-confirm-deploy-deploy", text: RED._("deploy.confirm.button.confirm"), class: "primary", click: function() { @@ -411,9 +417,9 @@ RED.deploy = (function() { var nns = RED.nodes.createCompleteNodeSet(); var startTime = Date.now(); - $(".deploy-button-content").css('opacity',0); - $(".deploy-button-spinner").show(); - $("#btn-deploy").addClass("disabled"); + $(".red-ui-deploy-button-content").css('opacity',0); + $(".red-ui-deploy-button-spinner").show(); + $("#red-ui-header-button-deploy").addClass("disabled"); var data = {flows:nns}; @@ -422,10 +428,10 @@ RED.deploy = (function() { } deployInflight = true; - $("#header-shade").show(); - $("#editor-shade").show(); - $("#palette-shade").show(); - $("#sidebar-shade").show(); + $("#red-ui-header-shade").show(); + $("#red-ui-editor-shade").show(); + $("#red-ui-palette-shade").show(); + $("#red-ui-sidebar-shade").show(); $.ajax({ url:"flows", type: "POST", @@ -476,7 +482,7 @@ RED.deploy = (function() { RED.events.emit("deploy"); }).fail(function(xhr,textStatus,err) { RED.nodes.dirty(true); - $("#btn-deploy").removeClass("disabled"); + $("#red-ui-header-button-deploy").removeClass("disabled"); if (xhr.status === 401) { RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error"); } else if (xhr.status === 409) { @@ -490,12 +496,12 @@ RED.deploy = (function() { deployInflight = false; var delta = Math.max(0,300-(Date.now()-startTime)); setTimeout(function() { - $(".deploy-button-content").css('opacity',1); - $(".deploy-button-spinner").hide(); - $("#header-shade").hide(); - $("#editor-shade").hide(); - $("#palette-shade").hide(); - $("#sidebar-shade").hide(); + $(".red-ui-deploy-button-content").css('opacity',1); + $(".red-ui-deploy-button-spinner").hide(); + $("#red-ui-header-shade").hide(); + $("#red-ui-editor-shade").hide(); + $("#red-ui-palette-shade").hide(); + $("#red-ui-sidebar-shade").hide(); },delta); }); } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js index bef2ffc69..4ebdcdce9 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/diff.js @@ -22,7 +22,7 @@ RED.diff = (function() { } function createDiffTable(container,CurrentDiff) { - var diffList = $('",{class:"node-diff-property-cell-label"}).text("id").appendTo(row); - localCell = $(" | ",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); + $(" | ",{class:"red-ui-diff-list-cell-label"}).text("id").appendTo(row); + localCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row); if (localNode) { - localCell.addClass("node-diff-node-unchanged"); - $('').appendTo(localCell); - element = $('').appendTo(localCell); + localCell.addClass("red-ui-diff-status-unchanged"); + $('').appendTo(localCell); + element = $('').appendTo(localCell); propertyElements['local.id'] = RED.utils.createObjectElement(localNode.id).appendTo(element); } else { - localCell.addClass("node-diff-empty"); + localCell.addClass("red-ui-diff-empty"); } if (remoteNode !== undefined) { - remoteCell = $(" | ",{class:"node-diff-property-cell node-diff-node-remote"}).appendTo(row); - remoteCell.addClass("node-diff-node-unchanged"); + remoteCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-remote"}).appendTo(row); + remoteCell.addClass("red-ui-diff-status-unchanged"); if (remoteNode) { - $('').appendTo(remoteCell); - element = $('').appendTo(remoteCell); + $('').appendTo(remoteCell); + element = $('').appendTo(remoteCell); propertyElements['remote.id'] = RED.utils.createObjectElement(remoteNode.id).appendTo(element); } else { - remoteCell.addClass("node-diff-empty"); + remoteCell.addClass("red-ui-diff-empty"); } } @@ -785,12 +784,12 @@ RED.diff = (function() { conflict = true; } row = $(" |
",{class:"node-diff-property-cell-label"}).text("position").appendTo(row); - localCell = $(" | ",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); + $(" | ",{class:"red-ui-diff-list-cell-label"}).text("position").appendTo(row); + localCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row); if (localNode) { - localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged")); - $(''+(localChanged?'':'')+'').appendTo(localCell); - element = $('').appendTo(localCell); + localCell.addClass("red-ui-diff-status-"+(localChanged?"changed":"unchanged")); + $(''+(localChanged?'':'')+'').appendTo(localCell); + element = $('').appendTo(localCell); propertyElements['local.position'] = RED.utils.createObjectElement({x:localNode.x,y:localNode.y}, { path: "position", @@ -803,15 +802,15 @@ RED.diff = (function() { } ).appendTo(element); } else { - localCell.addClass("node-diff-empty"); + localCell.addClass("red-ui-diff-empty"); } if (remoteNode !== undefined) { - remoteCell = $(" | ",{class:"node-diff-property-cell node-diff-node-remote"}).appendTo(row); - remoteCell.addClass("node-diff-node-"+(remoteChanged?"changed":"unchanged")); + remoteCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-remote"}).appendTo(row); + remoteCell.addClass("red-ui-diff-status-"+(remoteChanged?"changed":"unchanged")); if (remoteNode) { - $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); - element = $('').appendTo(remoteCell); + $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); + element = $('').appendTo(remoteCell); propertyElements['remote.position'] = RED.utils.createObjectElement({x:remoteNode.x,y:remoteNode.y}, { path: "position", @@ -824,7 +823,7 @@ RED.diff = (function() { } ).appendTo(element); } else { - remoteCell.addClass("node-diff-empty"); + remoteCell.addClass("red-ui-diff-empty"); } } } @@ -853,34 +852,34 @@ RED.diff = (function() { conflict = true; } row = $(" |
",{class:"node-diff-property-cell-label"}).text("wires").appendTo(row); - localCell = $(" | ",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); + $(" | ",{class:"red-ui-diff-list-cell-label"}).text("wires").appendTo(row); + localCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row); if (localNode) { if (!conflict) { - localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged")); - $(''+(localChanged?'':'')+'').appendTo(localCell); + localCell.addClass("red-ui-diff-status-"+(localChanged?"changed":"unchanged")); + $(''+(localChanged?'':'')+'').appendTo(localCell); } else { - localCell.addClass("node-diff-node-conflict"); - $('').appendTo(localCell); + localCell.addClass("red-ui-diff-status-conflict"); + $('').appendTo(localCell); } formatWireProperty(localNode.wires,localNodeObj.all).appendTo(localCell); } else { - localCell.addClass("node-diff-empty"); + localCell.addClass("red-ui-diff-empty"); } if (remoteNode !== undefined) { - remoteCell = $(" | ",{class:"node-diff-property-cell node-diff-node-remote"}).appendTo(row); + remoteCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-remote"}).appendTo(row); if (remoteNode) { if (!conflict) { - remoteCell.addClass("node-diff-node-"+(remoteChanged?"changed":"unchanged")); - $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); + remoteCell.addClass("red-ui-diff-status-"+(remoteChanged?"changed":"unchanged")); + $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); } else { - remoteCell.addClass("node-diff-node-conflict"); - $('').appendTo(remoteCell); + remoteCell.addClass("red-ui-diff-status-conflict"); + $('').appendTo(remoteCell); } formatWireProperty(remoteNode.wires,remoteNodeObj.all).appendTo(remoteCell); } else { - remoteCell.addClass("node-diff-empty"); + remoteCell.addClass("red-ui-diff-empty"); } } } @@ -926,17 +925,17 @@ RED.diff = (function() { } row = $(" |
",{class:"node-diff-property-cell-label"}).text(d).appendTo(row); - localCell = $(" | ",{class:"node-diff-property-cell node-diff-node-local"}).appendTo(row); + var propertyNameCell = $(" | ",{class:"red-ui-diff-list-cell-label"}).text(d).appendTo(row); + localCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-local"}).appendTo(row); if (localNode) { if (!conflict) { - localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged")); - $(''+(localChanged?'':'')+'').appendTo(localCell); + localCell.addClass("red-ui-diff-status-"+(localChanged?"changed":"unchanged")); + $(''+(localChanged?'':'')+'').appendTo(localCell); } else { - localCell.addClass("node-diff-node-conflict"); - $('').appendTo(localCell); + localCell.addClass("red-ui-diff-status-conflict"); + $('').appendTo(localCell); } - element = $('').appendTo(localCell); + element = $('').appendTo(localCell); propertyElements['local.'+d] = RED.utils.createObjectElement(localNode[d], { path: d, @@ -949,19 +948,19 @@ RED.diff = (function() { } ).appendTo(element); } else { - localCell.addClass("node-diff-empty"); + localCell.addClass("red-ui-diff-empty"); } if (remoteNode !== undefined) { - remoteCell = $(" | ",{class:"node-diff-property-cell node-diff-node-remote"}).appendTo(row); + remoteCell = $(" | ",{class:"red-ui-diff-list-cell red-ui-diff-list-node-remote"}).appendTo(row); if (remoteNode) { if (!conflict) { - remoteCell.addClass("node-diff-node-"+(remoteChanged?"changed":"unchanged")); - $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); + remoteCell.addClass("red-ui-diff-status-"+(remoteChanged?"changed":"unchanged")); + $(''+(remoteChanged?'':'')+'').appendTo(remoteCell); } else { - remoteCell.addClass("node-diff-node-conflict"); - $('').appendTo(remoteCell); + remoteCell.addClass("red-ui-diff-status-conflict"); + $('').appendTo(remoteCell); } - element = $('').appendTo(remoteCell); + element = $('').appendTo(remoteCell); propertyElements['remote.'+d] = RED.utils.createObjectElement(remoteNode[d], { path: d, @@ -974,12 +973,12 @@ RED.diff = (function() { } ).appendTo(element); } else { - remoteCell.addClass("node-diff-empty"); + remoteCell.addClass("red-ui-diff-empty"); } } if (localNode && remoteNode && typeof localNode[d] === "string") { if (/\n/.test(localNode[d]) || /\n/.test(remoteNode[d])) { - $('').click(function() { + $('').on("click", function() { showTextDiff(localNode[d],remoteNode[d]); }).appendTo(propertyNameCell); } @@ -990,10 +989,10 @@ RED.diff = (function() { return nodePropertiesDiv; } function createNodeConflictRadioBoxes(node,row,localDiv,remoteDiv,propertiesTable,hide,state,diff) { - var safeNodeId = "node-diff-selectbox-"+node.id.replace(/\./g,'-')+(propertiesTable?"-props":""); + var safeNodeId = "red-ui-diff-selectbox-"+node.id.replace(/\./g,'-')+(propertiesTable?"-props":""); var className = ""; if (node.z||propertiesTable) { - className = "node-diff-selectbox-tab-"+(propertiesTable?node.id:node.z).replace(/\./g,'-'); + className = "red-ui-diff-selectbox-tab-"+(propertiesTable?node.id:node.z).replace(/\./g,'-'); } var titleRow = !propertiesTable && (node.type === 'tab' || node.type === 'subflow'); var changeHandler = function(evt) { @@ -1001,44 +1000,44 @@ RED.diff = (function() { if (node.type === undefined) { // TODO: handle globals } else if (titleRow) { - className = "node-diff-selectbox-tab-"+node.id.replace(/\./g,'-'); + className = "red-ui-diff-selectbox-tab-"+node.id.replace(/\./g,'-'); $("."+className+"-"+this.value).prop('checked',true); if (this.value === 'local') { - $("."+className+"-"+this.value).closest(".node-diff-node-entry").addClass("node-diff-select-local"); - $("."+className+"-"+this.value).closest(".node-diff-node-entry").removeClass("node-diff-select-remote"); + $("."+className+"-"+this.value).closest(".red-ui-diff-list-node").addClass("red-ui-diff-select-local"); + $("."+className+"-"+this.value).closest(".red-ui-diff-list-node").removeClass("red-ui-diff-select-remote"); } else { - $("."+className+"-"+this.value).closest(".node-diff-node-entry").removeClass("node-diff-select-local"); - $("."+className+"-"+this.value).closest(".node-diff-node-entry").addClass("node-diff-select-remote"); + $("."+className+"-"+this.value).closest(".red-ui-diff-list-node").removeClass("red-ui-diff-select-local"); + $("."+className+"-"+this.value).closest(".red-ui-diff-list-node").addClass("red-ui-diff-select-remote"); } } else { // Individual node or properties table - var parentId = "node-diff-selectbox-"+(propertiesTable?node.id:node.z).replace(/\./g,'-'); + var parentId = "red-ui-diff-selectbox-"+(propertiesTable?node.id:node.z).replace(/\./g,'-'); $('#'+parentId+"-local").prop('checked',false); $('#'+parentId+"-remote").prop('checked',false); - var titleRowDiv = $('#'+parentId+"-local").closest(".node-diff-tab").find(".node-diff-tab-title"); - titleRowDiv.removeClass("node-diff-select-local"); - titleRowDiv.removeClass("node-diff-select-remote"); + var titleRowDiv = $('#'+parentId+"-local").closest(".red-ui-diff-list-flow").find(".red-ui-diff-list-flow-title"); + titleRowDiv.removeClass("red-ui-diff-select-local"); + titleRowDiv.removeClass("red-ui-diff-select-remote"); } if (this.value === 'local') { - row.removeClass("node-diff-select-remote"); - row.addClass("node-diff-select-local"); + row.removeClass("red-ui-diff-select-remote"); + row.addClass("red-ui-diff-select-local"); } else if (this.value === 'remote') { - row.addClass("node-diff-select-remote"); - row.removeClass("node-diff-select-local"); + row.addClass("red-ui-diff-select-remote"); + row.removeClass("red-ui-diff-select-local"); } refreshConflictHeader(diff); } - var localSelectDiv = $(' |