@kumologica/sdk 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/kl.js +3 -0
- package/cli/cli.js +6 -0
- package/cli/commands/build-commands/aws.js +49 -0
- package/cli/commands/build-commands/azure.js +43 -0
- package/cli/commands/build-commands/kumohub.js +7 -0
- package/cli/commands/build.js +6 -0
- package/cli/commands/create.js +32 -0
- package/cli/commands/deploy-commands/kumohub.js +114 -0
- package/cli/commands/deploy.js +6 -0
- package/cli/commands/doc-commands/html.js +61 -0
- package/cli/commands/doc.js +6 -0
- package/cli/commands/export-commands/cloudformation.js +338 -0
- package/cli/commands/export-commands/serverless.js +164 -0
- package/cli/commands/export-commands/terraform-commands/aws.js +193 -0
- package/cli/commands/export-commands/terraform-commands/azure.js +148 -0
- package/cli/commands/export-commands/terraform.js +6 -0
- package/cli/commands/export-commands/utils/validator.js +152 -0
- package/cli/commands/export.js +6 -0
- package/cli/commands/import-commands/mulesoft.js +61 -0
- package/cli/commands/import.js +6 -0
- package/cli/commands/open.js +46 -0
- package/cli/commands/test-utils/TestSuiteController.js +359 -0
- package/cli/commands/test-utils/TestSuiteController.test.js +171 -0
- package/cli/commands/test-utils/fixtures/example3-flow.json +148 -0
- package/cli/commands/test-utils/fixtures/package.json +6 -0
- package/cli/commands/test-utils/fixtures/s3-event.js +43 -0
- package/cli/commands/test-utils/util/output.js +14 -0
- package/cli/commands/test-utils/util/updates/index.js +17 -0
- package/cli/commands/test-utils/util/updates/pkg.js +13 -0
- package/cli/commands/test-utils/util/updates/templates/default-settings.js +209 -0
- package/cli/commands/test.js +66 -0
- package/cli/commands/utils.js +14 -0
- package/package.json +158 -0
- package/src/app/lib/aws/aws-profile.js +43 -0
- package/src/app/lib/aws/ca-alexa-api.js +29 -0
- package/src/app/lib/aws/ca-apigw-api.js +216 -0
- package/src/app/lib/aws/ca-cloudwatch-api.js +78 -0
- package/src/app/lib/aws/ca-codecommit-api.js +63 -0
- package/src/app/lib/aws/ca-dynamodb-api.js +27 -0
- package/src/app/lib/aws/ca-elb-api.js +44 -0
- package/src/app/lib/aws/ca-events-api.js +27 -0
- package/src/app/lib/aws/ca-iot-api.js +105 -0
- package/src/app/lib/aws/ca-s3-api.js +115 -0
- package/src/app/lib/aws/ca-sns-api.js +38 -0
- package/src/app/lib/aws/ca-sqs-api.js +51 -0
- package/src/app/lib/aws/cf.js +439 -0
- package/src/app/lib/aws/index.js +970 -0
- package/src/app/lib/aws/kl-iam-api.js +27 -0
- package/src/app/lib/aws/kl-rekognition-api.js +66 -0
- package/src/app/lib/aws/kl-ssm-api.js +24 -0
- package/src/app/lib/azure/index.js +80 -0
- package/src/app/lib/dependencies.js +50 -0
- package/src/app/lib/kumohub/index.js +201 -0
- package/src/app/lib/runtime-loader/index.js +42 -0
- package/src/app/lib/serverless/index.js +318 -0
- package/src/app/lib/stores/aws-cloud-config-store.js +35 -0
- package/src/app/lib/stores/azure-config-store.js +24 -0
- package/src/app/lib/stores/kumohub-config-store.js +24 -0
- package/src/app/lib/stores/project-info-config-store.js +26 -0
- package/src/app/lib/stores/settings-cloud-store.js +117 -0
- package/src/app/lib/stores/settings-cloud-store.spec.js +26 -0
- package/src/app/lib/stores/settings-network-store.js +119 -0
- package/src/app/lib/stores/settings-network-store.spec.js +27 -0
- package/src/app/lib/stores/store.js +97 -0
- package/src/app/lib/stores/test-config-store.js +26 -0
- package/src/app/lib/stores/user-preference-store.js +44 -0
- package/src/app/lib/utils/editor.js +98 -0
- package/src/app/lib/utils/fix-path.js +15 -0
- package/src/app/main-process/favicon.ico +0 -0
- package/src/app/main-process/main-window.js +209 -0
- package/src/app/main-process/menu.js +219 -0
- package/src/app/main-process/modal-home.js +118 -0
- package/src/app/main-process/modal-newproject.js +119 -0
- package/src/app/main-process/modal-nodelibrary.js +90 -0
- package/src/app/main-process/modal-welcome.js +114 -0
- package/src/app/main-process/runtime-manager.js +141 -0
- package/src/app/main.js +590 -0
- package/src/app/preload.js +633 -0
- package/src/app/ui/editor-api/lib/admin/context.js +42 -0
- package/src/app/ui/editor-api/lib/admin/flow.js +55 -0
- package/src/app/ui/editor-api/lib/admin/flows.js +53 -0
- package/src/app/ui/editor-api/lib/admin/index.js +155 -0
- package/src/app/ui/editor-api/lib/admin/nodes.js +164 -0
- package/src/app/ui/editor-api/lib/auth/clients.js +17 -0
- package/src/app/ui/editor-api/lib/auth/index.js +267 -0
- package/src/app/ui/editor-api/lib/auth/permissions.js +51 -0
- package/src/app/ui/editor-api/lib/auth/strategies.js +144 -0
- package/src/app/ui/editor-api/lib/auth/tokens.js +138 -0
- package/src/app/ui/editor-api/lib/auth/users.js +122 -0
- package/src/app/ui/editor-api/lib/editor/comms.js +247 -0
- package/src/app/ui/editor-api/lib/editor/credentials.js +22 -0
- package/src/app/ui/editor-api/lib/editor/index.js +234 -0
- package/src/app/ui/editor-api/lib/editor/library.js +69 -0
- package/src/app/ui/editor-api/lib/editor/locales.js +37 -0
- package/src/app/ui/editor-api/lib/editor/projects.js +497 -0
- package/src/app/ui/editor-api/lib/editor/settings.js +118 -0
- package/src/app/ui/editor-api/lib/editor/sshkeys.js +87 -0
- package/src/app/ui/editor-api/lib/editor/theme.js +184 -0
- package/src/app/ui/editor-api/lib/editor/ui.js +149 -0
- package/src/app/ui/editor-api/lib/index.js +149 -0
- package/src/app/ui/editor-api/lib/runner/index.js +81 -0
- package/src/app/ui/editor-api/lib/util.js +51 -0
- package/src/app/ui/editor-client/README.md +10 -0
- package/src/app/ui/editor-client/constants.js +5 -0
- package/src/app/ui/editor-client/index.js +3 -0
- package/src/app/ui/editor-client/public/favicon.ico +0 -0
- package/src/app/ui/editor-client/public/red/images/bolt.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/continue-full.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/continue-outline.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/pause.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/restart.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/stepover.png +0 -0
- package/src/app/ui/editor-client/public/red/images/debugger/stop.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-flows-o.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-flows.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-full-o.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-full.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-nodes-o.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-nodes.png +0 -0
- package/src/app/ui/editor-client/public/red/images/deploy-reload.png +0 -0
- package/src/app/ui/editor-client/public/red/images/grip.png +0 -0
- package/src/app/ui/editor-client/public/red/images/icons/arrow-in.png +0 -0
- package/src/app/ui/editor-client/public/red/images/icons/bolt.png +0 -0
- package/src/app/ui/editor-client/public/red/images/icons/node-changed.png +0 -0
- package/src/app/ui/editor-client/public/red/images/icons/node-error.png +0 -0
- package/src/app/ui/editor-client/public/red/images/icons/node-play.png +0 -0
- package/src/app/ui/editor-client/public/red/images/kumologica-app.png +0 -0
- package/src/app/ui/editor-client/public/red/images/node-red-256.png +0 -0
- package/src/app/ui/editor-client/public/red/images/node-red-icon-black.svg +9 -0
- package/src/app/ui/editor-client/public/red/images/node-red-icon.svg +33 -0
- package/src/app/ui/editor-client/public/red/images/node-red.png +0 -0
- package/src/app/ui/editor-client/public/red/images/pw_maze_white.png +0 -0
- package/src/app/ui/editor-client/public/red/images/spin.svg +41 -0
- package/src/app/ui/editor-client/public/red/images/spinner.gif +0 -0
- package/src/app/ui/editor-client/public/red/images/subflow_tab.png +0 -0
- package/src/app/ui/editor-client/public/red/images/test-icon.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/09.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/az.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/bin.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/bool.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/env.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/expr.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/json.png +0 -0
- package/src/app/ui/editor-client/public/red/images/typedInput/re.png +0 -0
- package/src/app/ui/editor-client/public/red/keymap.json +54 -0
- package/src/app/ui/editor-client/public/red/main-modals.js +14 -0
- package/src/app/ui/editor-client/public/red/main-modals.min.js +16 -0
- package/src/app/ui/editor-client/public/red/main.js +10 -0
- package/src/app/ui/editor-client/public/red/main.min.js +16 -0
- package/src/app/ui/editor-client/public/red/red.js +44903 -0
- package/src/app/ui/editor-client/public/red/red.min.js +16 -0
- package/src/app/ui/editor-client/public/red/style.min.css +24 -0
- package/src/app/ui/editor-client/public/vendor/ace/LICENSE +24 -0
- package/src/app/ui/editor-client/public/vendor/ace/ace.js +17 -0
- package/src/app/ui/editor-client/public/vendor/ace/ext-language_tools.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/ext-searchbox.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-css.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-handlebars.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-html.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-javascript.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-json.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-markdown.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-properties.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-python.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-sql.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-swift.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-text.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-xml.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/mode-yaml.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/css.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/handlebars.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/html.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/javascript.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/json.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/markdown.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/properties.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/python.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/sql.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/swift.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/text.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/xml.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/snippets/yaml.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/theme-chrome.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/theme-tomorrow.js +8 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-css.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-html.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-javascript.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-json.js +1 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-jsonata.js +2140 -0
- package/src/app/ui/editor-client/public/vendor/ace/worker-xml.js +1 -0
- package/src/app/ui/editor-client/public/vendor/beautifyjs/beautify.min.js +1 -0
- package/src/app/ui/editor-client/public/vendor/bootstrap/css/bootstrap.min.css +9 -0
- package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/active-line.js +72 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-hint.js +157 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-lint.js +63 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/jshint.js +29591 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.css +73 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.js +252 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.css +36 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.js +460 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/addon/sql-hint.js +304 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.css +350 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.js +9800 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/mode/javascript.js +927 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/mode/sql.js +494 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/theme/base16-dark.css +38 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/theme/monokai.css +42 -0
- package/src/app/ui/editor-client/public/vendor/code-mirror/theme/solarized.css +168 -0
- package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.css +43 -0
- package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.js +87 -0
- package/src/app/ui/editor-client/public/vendor/easy-json-schema/index.js +88 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/css/font-awesome.min.css +4 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.eot +0 -0
- package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.svg +2105 -0
- package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.ttf +0 -0
- package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff +0 -0
- package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff2 +0 -0
- package/src/app/ui/editor-client/public/vendor/icofont/icofont.min.css +7 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
- package/src/app/ui/editor-client/public/vendor/jsonata/jsonata.min.js +183 -0
- package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.css +181 -0
- package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.js +48 -0
- package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +7 -0
- package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +15 -0
- package/src/app/ui/editor-client/public/vendor/vendor.css +0 -0
- package/src/app/ui/editor-client/public/vendor/vendor.js +125 -0
- package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +2 -0
- package/src/app/ui/editor-client/src/ace/README.md +50 -0
- package/src/app/ui/editor-client/src/ace/mode/nrjavascript.js +35 -0
- package/src/app/ui/editor-client/src/ace/mode/nrjavascript_worker.js +189 -0
- package/src/app/ui/editor-client/src/favicon.ico +0 -0
- package/src/app/ui/editor-client/src/images/bolt.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/continue-full.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/continue-outline.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/pause.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/restart.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/stepover.png +0 -0
- package/src/app/ui/editor-client/src/images/debugger/stop.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-flows-o.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-flows.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-full-o.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-full.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-nodes-o.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-nodes.png +0 -0
- package/src/app/ui/editor-client/src/images/deploy-reload.png +0 -0
- package/src/app/ui/editor-client/src/images/grip.png +0 -0
- package/src/app/ui/editor-client/src/images/icons/arrow-in.png +0 -0
- package/src/app/ui/editor-client/src/images/icons/bolt.png +0 -0
- package/src/app/ui/editor-client/src/images/icons/node-changed.png +0 -0
- package/src/app/ui/editor-client/src/images/icons/node-error.png +0 -0
- package/src/app/ui/editor-client/src/images/icons/node-play.png +0 -0
- package/src/app/ui/editor-client/src/images/kumologica-app.png +0 -0
- package/src/app/ui/editor-client/src/images/node-red-256.png +0 -0
- package/src/app/ui/editor-client/src/images/node-red-icon-black.svg +9 -0
- package/src/app/ui/editor-client/src/images/node-red-icon.svg +33 -0
- package/src/app/ui/editor-client/src/images/node-red.png +0 -0
- package/src/app/ui/editor-client/src/images/pw_maze_white.png +0 -0
- package/src/app/ui/editor-client/src/images/spin.svg +41 -0
- package/src/app/ui/editor-client/src/images/spinner.gif +0 -0
- package/src/app/ui/editor-client/src/images/subflow_tab.png +0 -0
- package/src/app/ui/editor-client/src/images/test-icon.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/09.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/az.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/bin.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/bool.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/env.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/expr.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/json.png +0 -0
- package/src/app/ui/editor-client/src/images/typedInput/re.png +0 -0
- package/src/app/ui/editor-client/src/js/comms.js +174 -0
- package/src/app/ui/editor-client/src/js/events.js +39 -0
- package/src/app/ui/editor-client/src/js/font-awesome.js +818 -0
- package/src/app/ui/editor-client/src/js/history.js +337 -0
- package/src/app/ui/editor-client/src/js/i18n.js +81 -0
- package/src/app/ui/editor-client/src/js/jquery-addons.js +21 -0
- package/src/app/ui/editor-client/src/js/keymap.json +54 -0
- package/src/app/ui/editor-client/src/js/main-modals.js +14 -0
- package/src/app/ui/editor-client/src/js/main.js +10 -0
- package/src/app/ui/editor-client/src/js/modals/modal-home.js +162 -0
- package/src/app/ui/editor-client/src/js/modals/modal-new-project.js +86 -0
- package/src/app/ui/editor-client/src/js/modals/modal-node-library.js +255 -0
- package/src/app/ui/editor-client/src/js/modals/modal-welcome.js +102 -0
- package/src/app/ui/editor-client/src/js/nodes.js +1736 -0
- package/src/app/ui/editor-client/src/js/red.js +704 -0
- package/src/app/ui/editor-client/src/js/settings.js +275 -0
- package/src/app/ui/editor-client/src/js/text/bidi.js +116 -0
- package/src/app/ui/editor-client/src/js/text/format.js +1316 -0
- package/src/app/ui/editor-client/src/js/ui/actions.js +39 -0
- package/src/app/ui/editor-client/src/js/ui/clipboard.js +510 -0
- package/src/app/ui/editor-client/src/js/ui/common/checkboxSet.js +117 -0
- package/src/app/ui/editor-client/src/js/ui/common/editableList.js +322 -0
- package/src/app/ui/editor-client/src/js/ui/common/menu.js +277 -0
- package/src/app/ui/editor-client/src/js/ui/common/panels.js +104 -0
- package/src/app/ui/editor-client/src/js/ui/common/popover.js +268 -0
- package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +98 -0
- package/src/app/ui/editor-client/src/js/ui/common/stack.js +184 -0
- package/src/app/ui/editor-client/src/js/ui/common/tabs.js +730 -0
- package/src/app/ui/editor-client/src/js/ui/common/treeList.js +170 -0
- package/src/app/ui/editor-client/src/js/ui/common/typedInput.js +819 -0
- package/src/app/ui/editor-client/src/js/ui/common/typedInputLong.js +829 -0
- package/src/app/ui/editor-client/src/js/ui/deploy.js +422 -0
- package/src/app/ui/editor-client/src/js/ui/diff.js +2225 -0
- package/src/app/ui/editor-client/src/js/ui/editor.js +3020 -0
- package/src/app/ui/editor-client/src/js/ui/editors/buffer.js +195 -0
- package/src/app/ui/editor-client/src/js/ui/editors/expression.js +627 -0
- package/src/app/ui/editor-client/src/js/ui/editors/js.js +89 -0
- package/src/app/ui/editor-client/src/js/ui/editors/json.js +107 -0
- package/src/app/ui/editor-client/src/js/ui/editors/markdown.js +267 -0
- package/src/app/ui/editor-client/src/js/ui/editors/string.js +75 -0
- package/src/app/ui/editor-client/src/js/ui/event-log.js +107 -0
- package/src/app/ui/editor-client/src/js/ui/header.js +372 -0
- package/src/app/ui/editor-client/src/js/ui/keyboard.js +565 -0
- package/src/app/ui/editor-client/src/js/ui/library.js +570 -0
- package/src/app/ui/editor-client/src/js/ui/logviewer.js +116 -0
- package/src/app/ui/editor-client/src/js/ui/notifications.js +282 -0
- package/src/app/ui/editor-client/src/js/ui/palette-editor.js +1061 -0
- package/src/app/ui/editor-client/src/js/ui/palette.js +788 -0
- package/src/app/ui/editor-client/src/js/ui/project-info.js +232 -0
- package/src/app/ui/editor-client/src/js/ui/projects/projectSettings.js +1651 -0
- package/src/app/ui/editor-client/src/js/ui/projects/projectUserSettings.js +404 -0
- package/src/app/ui/editor-client/src/js/ui/projects/projects.js +2395 -0
- package/src/app/ui/editor-client/src/js/ui/projects/tab-versionControl.js +1383 -0
- package/src/app/ui/editor-client/src/js/ui/search.js +366 -0
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +409 -0
- package/src/app/ui/editor-client/src/js/ui/state.js +14 -0
- package/src/app/ui/editor-client/src/js/ui/subflow.js +748 -0
- package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1427 -0
- package/src/app/ui/editor-client/src/js/ui/tab-azure.js +852 -0
- package/src/app/ui/editor-client/src/js/ui/tab-config.js +452 -0
- package/src/app/ui/editor-client/src/js/ui/tab-context.js +406 -0
- package/src/app/ui/editor-client/src/js/ui/tab-info.js +661 -0
- package/src/app/ui/editor-client/src/js/ui/tab-kumohub.js +800 -0
- package/src/app/ui/editor-client/src/js/ui/tab-nodeInfo.js +60 -0
- package/src/app/ui/editor-client/src/js/ui/tab-test.js +915 -0
- package/src/app/ui/editor-client/src/js/ui/terminal.js +240 -0
- package/src/app/ui/editor-client/src/js/ui/touch/radialMenu.js +170 -0
- package/src/app/ui/editor-client/src/js/ui/tray.js +411 -0
- package/src/app/ui/editor-client/src/js/ui/typeSearch.js +411 -0
- package/src/app/ui/editor-client/src/js/ui/ui-settings.js +422 -0
- package/src/app/ui/editor-client/src/js/ui/update-panel.js +84 -0
- package/src/app/ui/editor-client/src/js/ui/userSettings.js +673 -0
- package/src/app/ui/editor-client/src/js/ui/utils.js +1287 -0
- package/src/app/ui/editor-client/src/js/ui/view-navigator.js +169 -0
- package/src/app/ui/editor-client/src/js/ui/view-tools.js +123 -0
- package/src/app/ui/editor-client/src/js/ui/view.js +5333 -0
- package/src/app/ui/editor-client/src/js/ui/workspaces.js +498 -0
- package/src/app/ui/editor-client/src/js/user.js +282 -0
- package/src/app/ui/editor-client/src/js/validators.js +54 -0
- package/src/app/ui/editor-client/src/kumologica-app.png +0 -0
- package/src/app/ui/editor-client/src/sass/ace.scss +29 -0
- package/src/app/ui/editor-client/src/sass/bootstrap.scss +21 -0
- package/src/app/ui/editor-client/src/sass/colors.scss +76 -0
- package/src/app/ui/editor-client/src/sass/debug.scss +383 -0
- package/src/app/ui/editor-client/src/sass/diff.scss +695 -0
- package/src/app/ui/editor-client/src/sass/dragdrop.scss +37 -0
- package/src/app/ui/editor-client/src/sass/dropdownMenu.scss +93 -0
- package/src/app/ui/editor-client/src/sass/editor.scss +683 -0
- package/src/app/ui/editor-client/src/sass/flow.scss +330 -0
- package/src/app/ui/editor-client/src/sass/forms.scss +1093 -0
- package/src/app/ui/editor-client/src/sass/header.scss +502 -0
- package/src/app/ui/editor-client/src/sass/jquery.scss +152 -0
- package/src/app/ui/editor-client/src/sass/keyboard.scss +136 -0
- package/src/app/ui/editor-client/src/sass/library.scss +54 -0
- package/src/app/ui/editor-client/src/sass/mixins.scss +283 -0
- package/src/app/ui/editor-client/src/sass/modals/modalHome.scss +138 -0
- package/src/app/ui/editor-client/src/sass/modals/modalNewProject.scss +96 -0
- package/src/app/ui/editor-client/src/sass/modals/modalNodeLibrary.scss +131 -0
- package/src/app/ui/editor-client/src/sass/modals/modalWelcome.scss +102 -0
- package/src/app/ui/editor-client/src/sass/notifications.scss +118 -0
- package/src/app/ui/editor-client/src/sass/palette-editor.scss +275 -0
- package/src/app/ui/editor-client/src/sass/palette.scss +279 -0
- package/src/app/ui/editor-client/src/sass/panels.scss +61 -0
- package/src/app/ui/editor-client/src/sass/popover.scss +166 -0
- package/src/app/ui/editor-client/src/sass/project-info.scss +74 -0
- package/src/app/ui/editor-client/src/sass/projects.scss +875 -0
- package/src/app/ui/editor-client/src/sass/search.scss +201 -0
- package/src/app/ui/editor-client/src/sass/sidebar.scss +201 -0
- package/src/app/ui/editor-client/src/sass/style.scss +170 -0
- package/src/app/ui/editor-client/src/sass/tab-azure.scss +68 -0
- package/src/app/ui/editor-client/src/sass/tab-cloud.scss +67 -0
- package/src/app/ui/editor-client/src/sass/tab-config.scss +100 -0
- package/src/app/ui/editor-client/src/sass/tab-context.scss +54 -0
- package/src/app/ui/editor-client/src/sass/tab-info.scss +307 -0
- package/src/app/ui/editor-client/src/sass/tab-kumohub.scss +68 -0
- package/src/app/ui/editor-client/src/sass/tab-test.scss +257 -0
- package/src/app/ui/editor-client/src/sass/tabs.scss +395 -0
- package/src/app/ui/editor-client/src/sass/terminal.scss +246 -0
- package/src/app/ui/editor-client/src/sass/ui/common/checkboxSet.scss +29 -0
- package/src/app/ui/editor-client/src/sass/ui/common/editableList.scss +81 -0
- package/src/app/ui/editor-client/src/sass/ui/common/nodeList.scss +65 -0
- package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +77 -0
- package/src/app/ui/editor-client/src/sass/ui/common/stack.scss +26 -0
- package/src/app/ui/editor-client/src/sass/ui/common/treeList.scss +108 -0
- package/src/app/ui/editor-client/src/sass/ui/common/typedInput.scss +181 -0
- package/src/app/ui/editor-client/src/sass/ui/common/typedInputLong.scss +183 -0
- package/src/app/ui/editor-client/src/sass/ui-settings.scss +119 -0
- package/src/app/ui/editor-client/src/sass/update-panel.scss +18 -0
- package/src/app/ui/editor-client/src/sass/userSettings.scss +93 -0
- package/src/app/ui/editor-client/src/sass/widgetStyle.scss +23 -0
- package/src/app/ui/editor-client/src/sass/workspace.scss +123 -0
- package/src/app/ui/editor-client/src/sass/workspaceToolbar.scss +85 -0
- package/src/app/ui/editor-client/src/vendor/ace/LICENSE +24 -0
- package/src/app/ui/editor-client/src/vendor/ace/ace.js +17 -0
- package/src/app/ui/editor-client/src/vendor/ace/ext-language_tools.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/ext-searchbox.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-css.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-handlebars.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-html.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-javascript.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-json.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-markdown.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-properties.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-python.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-sql.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-swift.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-text.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-xml.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/mode-yaml.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/css.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/handlebars.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/html.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/javascript.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/json.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/markdown.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/properties.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/python.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/sql.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/swift.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/text.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/xml.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/snippets/yaml.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/theme-chrome.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/theme-tomorrow.js +8 -0
- package/src/app/ui/editor-client/src/vendor/ace/worker-css.js +1 -0
- package/src/app/ui/editor-client/src/vendor/ace/worker-html.js +1 -0
- package/src/app/ui/editor-client/src/vendor/ace/worker-javascript.js +1 -0
- package/src/app/ui/editor-client/src/vendor/ace/worker-json.js +1 -0
- package/src/app/ui/editor-client/src/vendor/ace/worker-xml.js +1 -0
- package/src/app/ui/editor-client/src/vendor/beautifyjs/beautify.min.js +1 -0
- package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.css +5406 -0
- package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.min.css +9 -0
- package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
- package/src/app/ui/editor-client/src/vendor/bootstrap/js/bootstrap.min.js +6 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/active-line.js +72 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-hint.js +157 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-lint.js +63 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/jshint.js +29591 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.css +73 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.js +252 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.css +36 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.js +460 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/addon/sql-hint.js +304 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.css +350 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.js +9800 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/mode/javascript.js +927 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/mode/sql.js +494 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/theme/base16-dark.css +38 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/theme/monokai.css +42 -0
- package/src/app/ui/editor-client/src/vendor/code-mirror/theme/solarized.css +168 -0
- package/src/app/ui/editor-client/src/vendor/d3/d3.v3.min.js +4 -0
- package/src/app/ui/editor-client/src/vendor/d3/d3.v4.min.js +2 -0
- package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.css +43 -0
- package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.js +87 -0
- package/src/app/ui/editor-client/src/vendor/easy-json-schema/index.js +88 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/css/font-awesome.min.css +4 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/src/app/ui/editor-client/src/vendor/i18next/i18next.min.js +5 -0
- package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.eot +0 -0
- package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.svg +2105 -0
- package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.ttf +0 -0
- package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff +0 -0
- package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff2 +0 -0
- package/src/app/ui/editor-client/src/vendor/icofont/icofont.min.css +7 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
- package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js +5 -0
- package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js +7 -0
- package/src/app/ui/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js +11 -0
- package/src/app/ui/editor-client/src/vendor/jsonata/formatter.js +183 -0
- package/src/app/ui/editor-client/src/vendor/jsonata/mode-jsonata.js +134 -0
- package/src/app/ui/editor-client/src/vendor/jsonata/snippets-jsonata.js +11 -0
- package/src/app/ui/editor-client/src/vendor/jsonata/worker-jsonata.js +2140 -0
- package/src/app/ui/editor-client/src/vendor/marked/marked.min.js +6 -0
- package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.css +181 -0
- package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.js +48 -0
- package/src/app/ui/editor-client/templates/index.mst +314 -0
- package/src/app/ui/editor-client/templates/modals/modalHome.mst +107 -0
- package/src/app/ui/editor-client/templates/modals/modalNewProject.mst +104 -0
- package/src/app/ui/editor-client/templates/modals/modalNodeLibrary.mst +72 -0
- package/src/app/ui/editor-client/templates/modals/modalWelcome.mst +111 -0
- package/src/assets/eula.txt +170 -0
- package/src/assets/icon.icns +0 -0
- package/src/assets/kumologica-app.png +0 -0
- package/src/assets/license_en.txt +170 -0
|
@@ -0,0 +1,1061 @@
|
|
|
1
|
+
|
|
2
|
+
RED.palette.editor = (function() {
|
|
3
|
+
|
|
4
|
+
var disabled = false;
|
|
5
|
+
|
|
6
|
+
var editorTabs;
|
|
7
|
+
var filterInput;
|
|
8
|
+
var searchInput;
|
|
9
|
+
var nodeList;
|
|
10
|
+
var packageList;
|
|
11
|
+
var loadedList = [];
|
|
12
|
+
var filteredList = [];
|
|
13
|
+
var loadedIndex = {};
|
|
14
|
+
|
|
15
|
+
var typesInUse = {};
|
|
16
|
+
var nodeEntries = {};
|
|
17
|
+
var eventTimers = {};
|
|
18
|
+
var activeFilter = "";
|
|
19
|
+
|
|
20
|
+
function semVerCompare(A,B) {
|
|
21
|
+
var aParts = A.split(".").map(function(m) { return parseInt(m);});
|
|
22
|
+
var bParts = B.split(".").map(function(m) { return parseInt(m);});
|
|
23
|
+
for (var i=0;i<3;i++) {
|
|
24
|
+
var j = aParts[i]-bParts[i];
|
|
25
|
+
if (j<0) { return -1 }
|
|
26
|
+
if (j>0) { return 1 }
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function delayCallback(start,callback) {
|
|
32
|
+
var delta = Date.now() - start;
|
|
33
|
+
if (delta < 300) {
|
|
34
|
+
delta = 300;
|
|
35
|
+
} else {
|
|
36
|
+
delta = 0;
|
|
37
|
+
}
|
|
38
|
+
setTimeout(function() {
|
|
39
|
+
callback();
|
|
40
|
+
},delta);
|
|
41
|
+
}
|
|
42
|
+
function changeNodeState(id,state,shade,callback) {
|
|
43
|
+
shade.show();
|
|
44
|
+
var start = Date.now();
|
|
45
|
+
$.ajax({
|
|
46
|
+
url:"nodes/"+id,
|
|
47
|
+
type: "PUT",
|
|
48
|
+
data: JSON.stringify({
|
|
49
|
+
enabled: state
|
|
50
|
+
}),
|
|
51
|
+
contentType: "application/json; charset=utf-8"
|
|
52
|
+
}).done(function(data,textStatus,xhr) {
|
|
53
|
+
delayCallback(start,function() {
|
|
54
|
+
shade.hide();
|
|
55
|
+
callback();
|
|
56
|
+
});
|
|
57
|
+
}).fail(function(xhr,textStatus,err) {
|
|
58
|
+
delayCallback(start,function() {
|
|
59
|
+
shade.hide();
|
|
60
|
+
callback(xhr);
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
function installNodeModule(id,version,callback) {
|
|
65
|
+
var requestBody = {
|
|
66
|
+
module: id
|
|
67
|
+
};
|
|
68
|
+
if (version) {
|
|
69
|
+
requestBody.version = version;
|
|
70
|
+
}
|
|
71
|
+
$.ajax({
|
|
72
|
+
url:"nodes",
|
|
73
|
+
type: "POST",
|
|
74
|
+
data: JSON.stringify(requestBody),
|
|
75
|
+
contentType: "application/json; charset=utf-8"
|
|
76
|
+
}).done(function(data,textStatus,xhr) {
|
|
77
|
+
callback();
|
|
78
|
+
}).fail(function(xhr,textStatus,err) {
|
|
79
|
+
callback(xhr);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function removeNodeModule(id,callback) {
|
|
83
|
+
$.ajax({
|
|
84
|
+
url:"nodes/"+id,
|
|
85
|
+
type: "DELETE"
|
|
86
|
+
}).done(function(data,textStatus,xhr) {
|
|
87
|
+
callback();
|
|
88
|
+
}).fail(function(xhr,textStatus,err) {
|
|
89
|
+
callback(xhr);
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function refreshNodeModuleList() {
|
|
94
|
+
for (var id in nodeEntries) {
|
|
95
|
+
if (nodeEntries.hasOwnProperty(id)) {
|
|
96
|
+
_refreshNodeModule(id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function refreshNodeModule(module) {
|
|
102
|
+
if (!eventTimers.hasOwnProperty(module)) {
|
|
103
|
+
eventTimers[module] = setTimeout(function() {
|
|
104
|
+
delete eventTimers[module];
|
|
105
|
+
_refreshNodeModule(module);
|
|
106
|
+
},100);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
function getContrastingBorder(rgbColor){
|
|
112
|
+
var parts = /^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)[,)]/.exec(rgbColor);
|
|
113
|
+
if (parts) {
|
|
114
|
+
var r = parseInt(parts[1]);
|
|
115
|
+
var g = parseInt(parts[2]);
|
|
116
|
+
var b = parseInt(parts[3]);
|
|
117
|
+
var yiq = ((r*299)+(g*587)+(b*114))/1000;
|
|
118
|
+
if (yiq > 160) {
|
|
119
|
+
r = Math.floor(r*0.8);
|
|
120
|
+
g = Math.floor(g*0.8);
|
|
121
|
+
b = Math.floor(b*0.8);
|
|
122
|
+
return "rgb("+r+","+g+","+b+")";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return rgbColor;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function formatUpdatedAt(dateString) {
|
|
129
|
+
var now = new Date();
|
|
130
|
+
var d = new Date(dateString);
|
|
131
|
+
var delta = (Date.now() - new Date(dateString).getTime())/1000;
|
|
132
|
+
|
|
133
|
+
if (delta < 60) {
|
|
134
|
+
return 'seconds ago';
|
|
135
|
+
}
|
|
136
|
+
delta = Math.floor(delta/60);
|
|
137
|
+
if (delta < 10) {
|
|
138
|
+
return 'minutes ago';
|
|
139
|
+
}
|
|
140
|
+
if (delta < 60) {
|
|
141
|
+
return `${delta} minutes ago`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
delta = Math.floor(delta/60);
|
|
145
|
+
|
|
146
|
+
if (delta < 24) {
|
|
147
|
+
return `${delta} hour ago`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
delta = Math.floor(delta/24);
|
|
151
|
+
|
|
152
|
+
if (delta < 7) {
|
|
153
|
+
return `${delta} day ago`;
|
|
154
|
+
}
|
|
155
|
+
var weeks = Math.floor(delta/7);
|
|
156
|
+
var days = delta%7;
|
|
157
|
+
|
|
158
|
+
if (weeks < 4) {
|
|
159
|
+
return `${weeks} week ago`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
var months = Math.floor(weeks/4);
|
|
163
|
+
weeks = weeks%4;
|
|
164
|
+
|
|
165
|
+
if (months < 12) {
|
|
166
|
+
return `${months} months ago`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var years = Math.floor(months/12);
|
|
170
|
+
months = months%12;
|
|
171
|
+
|
|
172
|
+
if (months === 0) {
|
|
173
|
+
return `${years} year(s) ago`;
|
|
174
|
+
} else {
|
|
175
|
+
return `${years} year(s) ${months} month(s) ago`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
function _refreshNodeModule(module) {
|
|
181
|
+
if (!nodeEntries.hasOwnProperty(module)) {
|
|
182
|
+
nodeEntries[module] = {info:RED.nodes.registry.getModule(module)};
|
|
183
|
+
var index = [module];
|
|
184
|
+
for (var s in nodeEntries[module].info.sets) {
|
|
185
|
+
if (nodeEntries[module].info.sets.hasOwnProperty(s)) {
|
|
186
|
+
index.push(s);
|
|
187
|
+
index = index.concat(nodeEntries[module].info.sets[s].types)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
nodeEntries[module].index = index.join(",").toLowerCase();
|
|
191
|
+
nodeList.editableList('addItem', nodeEntries[module]);
|
|
192
|
+
} else {
|
|
193
|
+
var moduleInfo = nodeEntries[module].info;
|
|
194
|
+
var nodeEntry = nodeEntries[module].elements;
|
|
195
|
+
if (nodeEntry) {
|
|
196
|
+
var activeTypeCount = 0;
|
|
197
|
+
var typeCount = 0;
|
|
198
|
+
var errorCount = 0;
|
|
199
|
+
nodeEntry.errorList.empty();
|
|
200
|
+
nodeEntries[module].totalUseCount = 0;
|
|
201
|
+
nodeEntries[module].setUseCount = {};
|
|
202
|
+
|
|
203
|
+
for (var setName in moduleInfo.sets) {
|
|
204
|
+
if (moduleInfo.sets.hasOwnProperty(setName)) {
|
|
205
|
+
var inUseCount = 0;
|
|
206
|
+
var set = moduleInfo.sets[setName];
|
|
207
|
+
var setElements = nodeEntry.sets[setName];
|
|
208
|
+
if (set.err) {
|
|
209
|
+
errorCount++;
|
|
210
|
+
$("<li>").text(set.err).appendTo(nodeEntry.errorList);
|
|
211
|
+
}
|
|
212
|
+
if (set.enabled) {
|
|
213
|
+
activeTypeCount += set.types.length;
|
|
214
|
+
}
|
|
215
|
+
typeCount += set.types.length;
|
|
216
|
+
for (var i=0;i<moduleInfo.sets[setName].types.length;i++) {
|
|
217
|
+
var t = moduleInfo.sets[setName].types[i];
|
|
218
|
+
inUseCount += (typesInUse[t]||0);
|
|
219
|
+
var swatch = setElements.swatches[t];
|
|
220
|
+
if (set.enabled) {
|
|
221
|
+
var def = RED.nodes.getType(t);
|
|
222
|
+
if (def && def.color) {
|
|
223
|
+
swatch.css({background:RED.utils.getNodeColor(t,def)});
|
|
224
|
+
swatch.css({border: "1px solid "+getContrastingBorder(swatch.css('backgroundColor'))})
|
|
225
|
+
|
|
226
|
+
} else {
|
|
227
|
+
swatch.css({background:"#eee",border:"1px dashed #999"})
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
swatch.css({background:"#eee",border:"1px dashed #999"})
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
nodeEntries[module].setUseCount[setName] = inUseCount;
|
|
234
|
+
nodeEntries[module].totalUseCount += inUseCount;
|
|
235
|
+
|
|
236
|
+
if (inUseCount > 0) {
|
|
237
|
+
setElements.enableButton.text('in use');
|
|
238
|
+
setElements.enableButton.addClass('disabled');
|
|
239
|
+
} else {
|
|
240
|
+
setElements.enableButton.removeClass('disabled');
|
|
241
|
+
if (set.enabled) {
|
|
242
|
+
setElements.enableButton.text('disable');
|
|
243
|
+
} else {
|
|
244
|
+
setElements.enableButton.text('enable');
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (errorCount === 0) {
|
|
252
|
+
nodeEntry.errorRow.hide()
|
|
253
|
+
} else {
|
|
254
|
+
nodeEntry.errorRow.show();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
|
|
258
|
+
nodeEntry.setCount.text(`${nodeCount} node`);
|
|
259
|
+
|
|
260
|
+
if (nodeEntries[module].totalUseCount > 0) {
|
|
261
|
+
nodeEntry.enableButton.text('in use');
|
|
262
|
+
nodeEntry.enableButton.addClass('disabled');
|
|
263
|
+
nodeEntry.removeButton.hide();
|
|
264
|
+
} else {
|
|
265
|
+
nodeEntry.enableButton.removeClass('disabled');
|
|
266
|
+
if (moduleInfo.local) {
|
|
267
|
+
nodeEntry.removeButton.css('display', 'inline-block');
|
|
268
|
+
}
|
|
269
|
+
if (activeTypeCount === 0) {
|
|
270
|
+
nodeEntry.enableButton.text('enable all');
|
|
271
|
+
} else {
|
|
272
|
+
nodeEntry.enableButton.text('disable all');
|
|
273
|
+
}
|
|
274
|
+
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (moduleInfo.pending_version) {
|
|
278
|
+
nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow)
|
|
279
|
+
nodeEntry.updateButton.text('updated').addClass('disabled').css('display', 'inline-block');
|
|
280
|
+
} else if (loadedIndex.hasOwnProperty(module)) {
|
|
281
|
+
if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) {
|
|
282
|
+
nodeEntry.updateButton.show();
|
|
283
|
+
nodeEntry.updateButton.text(`Updated version: ${loadedIndex[module].version}`);
|
|
284
|
+
} else {
|
|
285
|
+
nodeEntry.updateButton.hide();
|
|
286
|
+
}
|
|
287
|
+
} else {
|
|
288
|
+
nodeEntry.updateButton.hide();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function filterChange(val) {
|
|
295
|
+
activeFilter = val.toLowerCase();
|
|
296
|
+
var visible = nodeList.editableList('filter');
|
|
297
|
+
var size = nodeList.editableList('length');
|
|
298
|
+
if (val === "") {
|
|
299
|
+
filterInput.searchBox('count');
|
|
300
|
+
} else {
|
|
301
|
+
filterInput.searchBox('count',visible+" / "+size);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
var catalogueCount;
|
|
307
|
+
var catalogueLoadStatus = [];
|
|
308
|
+
var catalogueLoadStart;
|
|
309
|
+
var catalogueLoadErrors = false;
|
|
310
|
+
|
|
311
|
+
var activeSort = sortModulesRelevance;
|
|
312
|
+
|
|
313
|
+
function handleCatalogResponse(err,catalog,index,v) {
|
|
314
|
+
catalogueLoadStatus.push(err||v);
|
|
315
|
+
if (!err) {
|
|
316
|
+
if (v.modules) {
|
|
317
|
+
v.modules.forEach(function(m) {
|
|
318
|
+
loadedIndex[m.id] = m;
|
|
319
|
+
m.index = [m.id];
|
|
320
|
+
if (m.keywords) {
|
|
321
|
+
m.index = m.index.concat(m.keywords);
|
|
322
|
+
}
|
|
323
|
+
if (m.types) {
|
|
324
|
+
m.index = m.index.concat(m.types);
|
|
325
|
+
}
|
|
326
|
+
if (m.updated_at) {
|
|
327
|
+
m.timestamp = new Date(m.updated_at).getTime();
|
|
328
|
+
} else {
|
|
329
|
+
m.timestamp = 0;
|
|
330
|
+
}
|
|
331
|
+
m.index = m.index.join(",").toLowerCase();
|
|
332
|
+
})
|
|
333
|
+
loadedList = loadedList.concat(v.modules);
|
|
334
|
+
}
|
|
335
|
+
searchInput.searchBox('count',loadedList.length);
|
|
336
|
+
} else {
|
|
337
|
+
catalogueLoadErrors = true;
|
|
338
|
+
}
|
|
339
|
+
if (catalogueCount > 1) {
|
|
340
|
+
$(".palette-module-shade-status").html('Loading catalogues...') + "<br>"+catalogueLoadStatus.length+"/"+catalogueCount;
|
|
341
|
+
}
|
|
342
|
+
if (catalogueLoadStatus.length === catalogueCount) {
|
|
343
|
+
if (catalogueLoadErrors) {
|
|
344
|
+
RED.notify(`<p>Failed to load node catalogue.</p><p>Check the browser console for more information</p>`, "error", false, 8000);
|
|
345
|
+
}
|
|
346
|
+
var delta = 250-(Date.now() - catalogueLoadStart);
|
|
347
|
+
setTimeout(function() {
|
|
348
|
+
$("#palette-module-install-shade").hide();
|
|
349
|
+
},Math.max(delta,0));
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function initInstallTab() {
|
|
355
|
+
// if (loadedList.length === 0) {
|
|
356
|
+
// loadedList = [];
|
|
357
|
+
// loadedIndex = {};
|
|
358
|
+
// packageList.editableList('empty');
|
|
359
|
+
|
|
360
|
+
// $(".palette-module-shade-status").text('Loading catalogues...');
|
|
361
|
+
// var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
|
362
|
+
// catalogueLoadStatus = [];
|
|
363
|
+
// catalogueLoadErrors = false;
|
|
364
|
+
// catalogueCount = catalogues.length;
|
|
365
|
+
// if (catalogues.length > 1) {
|
|
366
|
+
// $(".palette-module-shade-status").html(RED._('palette.editor.loading')+"<br>0/"+catalogues.length);
|
|
367
|
+
// }
|
|
368
|
+
// $("#palette-module-install-shade").show();
|
|
369
|
+
// catalogueLoadStart = Date.now();
|
|
370
|
+
// var handled = 0;
|
|
371
|
+
// catalogues.forEach(function(catalog,index) {
|
|
372
|
+
// $.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
|
373
|
+
// handleCatalogResponse(null,catalog,index,v);
|
|
374
|
+
// refreshNodeModuleList();
|
|
375
|
+
// }).fail(function(jqxhr, textStatus, error) {
|
|
376
|
+
// handleCatalogResponse(jqxhr,catalog,index);
|
|
377
|
+
// }).always(function() {
|
|
378
|
+
// handled++;
|
|
379
|
+
// if (handled === catalogueCount) {
|
|
380
|
+
// searchInput.searchBox('change');
|
|
381
|
+
// }
|
|
382
|
+
// })
|
|
383
|
+
// });
|
|
384
|
+
// }
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function refreshFilteredItems() {
|
|
388
|
+
packageList.editableList('empty');
|
|
389
|
+
var currentFilter = searchInput.searchBox('value').trim();
|
|
390
|
+
if (currentFilter === ""){
|
|
391
|
+
packageList.editableList('addItem',{count:loadedList.length})
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
filteredList.sort(activeSort);
|
|
395
|
+
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
|
396
|
+
packageList.editableList('addItem',filteredList[i]);
|
|
397
|
+
}
|
|
398
|
+
if (filteredList.length === 0) {
|
|
399
|
+
packageList.editableList('addItem',{});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (filteredList.length > 10) {
|
|
403
|
+
packageList.editableList('addItem',{start:10,more:filteredList.length-10})
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function sortModulesRelevance(A,B) {
|
|
407
|
+
var currentFilter = searchInput.searchBox('value').trim();
|
|
408
|
+
if (currentFilter === "") {
|
|
409
|
+
return sortModulesAZ(A,B);
|
|
410
|
+
}
|
|
411
|
+
var i = A.info.index.indexOf(currentFilter) - B.info.index.indexOf(currentFilter);
|
|
412
|
+
if (i === 0) {
|
|
413
|
+
return sortModulesAZ(A,B);
|
|
414
|
+
}
|
|
415
|
+
return i;
|
|
416
|
+
}
|
|
417
|
+
function sortModulesAZ(A,B) {
|
|
418
|
+
return A.info.id.localeCompare(B.info.id);
|
|
419
|
+
}
|
|
420
|
+
function sortModulesRecent(A,B) {
|
|
421
|
+
return -1 * (A.info.timestamp-B.info.timestamp);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
function init() {
|
|
426
|
+
if (RED.settings.theme('palette.editable') === false) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
createSettingsPane();
|
|
430
|
+
|
|
431
|
+
RED.userSettings.add({
|
|
432
|
+
id:'palette',
|
|
433
|
+
title: 'Palette',
|
|
434
|
+
get: getSettingsPane,
|
|
435
|
+
close: function() {
|
|
436
|
+
settingsPane.detach();
|
|
437
|
+
},
|
|
438
|
+
focus: function() {
|
|
439
|
+
editorTabs.resize();
|
|
440
|
+
setTimeout(function() {
|
|
441
|
+
filterInput.focus();
|
|
442
|
+
},200);
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
RED.actions.add("core:manage-palette",function() {
|
|
447
|
+
RED.userSettings.show('palette');
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
RED.events.on('registry:module-updated', function(ns) {
|
|
451
|
+
refreshNodeModule(ns.module);
|
|
452
|
+
});
|
|
453
|
+
RED.events.on('registry:node-set-enabled', function(ns) {
|
|
454
|
+
refreshNodeModule(ns.module);
|
|
455
|
+
});
|
|
456
|
+
RED.events.on('registry:node-set-disabled', function(ns) {
|
|
457
|
+
refreshNodeModule(ns.module);
|
|
458
|
+
});
|
|
459
|
+
RED.events.on('registry:node-type-added', function(nodeType) {
|
|
460
|
+
if (!/^subflow:/.test(nodeType)) {
|
|
461
|
+
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
|
462
|
+
refreshNodeModule(ns.module);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
RED.events.on('registry:node-type-removed', function(nodeType) {
|
|
466
|
+
if (!/^subflow:/.test(nodeType)) {
|
|
467
|
+
var ns = RED.nodes.registry.getNodeSetForType(nodeType);
|
|
468
|
+
refreshNodeModule(ns.module);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
RED.events.on('registry:node-set-added', function(ns) {
|
|
472
|
+
refreshNodeModule(ns.module);
|
|
473
|
+
for (var i=0;i<filteredList.length;i++) {
|
|
474
|
+
if (filteredList[i].info.id === ns.module) {
|
|
475
|
+
var installButton = filteredList[i].elements.installButton;
|
|
476
|
+
installButton.addClass('disabled');
|
|
477
|
+
installButton.text('Installed');
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
RED.events.on('registry:node-set-removed', function(ns) {
|
|
483
|
+
var module = RED.nodes.registry.getModule(ns.module);
|
|
484
|
+
if (!module) {
|
|
485
|
+
var entry = nodeEntries[ns.module];
|
|
486
|
+
if (entry) {
|
|
487
|
+
nodeList.editableList('removeItem', entry);
|
|
488
|
+
delete nodeEntries[ns.module];
|
|
489
|
+
for (var i=0;i<filteredList.length;i++) {
|
|
490
|
+
if (filteredList[i].info.id === ns.module) {
|
|
491
|
+
var installButton = filteredList[i].elements.installButton;
|
|
492
|
+
installButton.removeClass('disabled');
|
|
493
|
+
installButton.text('Install');
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
RED.events.on('nodes:add', function(n) {
|
|
501
|
+
if (!/^subflow:/.test(n.type)) {
|
|
502
|
+
typesInUse[n.type] = (typesInUse[n.type]||0)+1;
|
|
503
|
+
if (typesInUse[n.type] === 1) {
|
|
504
|
+
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
|
505
|
+
refreshNodeModule(ns.module);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
})
|
|
509
|
+
RED.events.on('nodes:remove', function(n) {
|
|
510
|
+
if (typesInUse.hasOwnProperty(n.type)) {
|
|
511
|
+
typesInUse[n.type]--;
|
|
512
|
+
if (typesInUse[n.type] === 0) {
|
|
513
|
+
delete typesInUse[n.type];
|
|
514
|
+
var ns = RED.nodes.registry.getNodeSetForType(n.type);
|
|
515
|
+
refreshNodeModule(ns.module);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
})
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
var settingsPane;
|
|
522
|
+
|
|
523
|
+
function getSettingsPane() {
|
|
524
|
+
initInstallTab();
|
|
525
|
+
editorTabs.activateTab('nodes');
|
|
526
|
+
return settingsPane;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
function createSettingsPane() {
|
|
532
|
+
settingsPane = $('<div id="user-settings-tab-palette"></div>');
|
|
533
|
+
var content = $('<div id="palette-editor">'+
|
|
534
|
+
'<ul id="palette-editor-tabs"></ul>'+
|
|
535
|
+
'</div>').appendTo(settingsPane);
|
|
536
|
+
|
|
537
|
+
editorTabs = RED.tabs.create({
|
|
538
|
+
element: settingsPane.find('#palette-editor-tabs'),
|
|
539
|
+
onchange:function(tab) {
|
|
540
|
+
content.find(".palette-editor-tab").hide();
|
|
541
|
+
tab.content.show();
|
|
542
|
+
if (filterInput) {
|
|
543
|
+
filterInput.searchBox('value',"");
|
|
544
|
+
}
|
|
545
|
+
if (searchInput) {
|
|
546
|
+
searchInput.searchBox('value',"");
|
|
547
|
+
}
|
|
548
|
+
if (tab.id === 'install') {
|
|
549
|
+
if (searchInput) {
|
|
550
|
+
searchInput.focus();
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
if (filterInput) {
|
|
554
|
+
filterInput.focus();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
minimumActiveTabWidth: 110
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
var modulesTab = $('<div>',{class:"palette-editor-tab"}).appendTo(content);
|
|
563
|
+
|
|
564
|
+
editorTabs.addTab({
|
|
565
|
+
id: 'nodes',
|
|
566
|
+
label: 'Nodes',
|
|
567
|
+
content: modulesTab
|
|
568
|
+
})
|
|
569
|
+
|
|
570
|
+
var filterDiv = $('<div>',{class:"palette-search"}).appendTo(modulesTab);
|
|
571
|
+
filterInput = $('<input type="text" placeholder="Filter nodes"></input>')
|
|
572
|
+
.appendTo(filterDiv)
|
|
573
|
+
.searchBox({
|
|
574
|
+
delay: 200,
|
|
575
|
+
change: function() {
|
|
576
|
+
filterChange($(this).val());
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
nodeList = $('<ol>',{id:"palette-module-list", style:"position: absolute;top: 35px;bottom: 0;left: 0;right: 0px;"}).appendTo(modulesTab).editableList({
|
|
582
|
+
addButton: false,
|
|
583
|
+
scrollOnAdd: false,
|
|
584
|
+
sort: function(A,B) {
|
|
585
|
+
return A.info.name.localeCompare(B.info.name);
|
|
586
|
+
},
|
|
587
|
+
filter: function(data) {
|
|
588
|
+
if (activeFilter === "" ) {
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return (activeFilter==="")||(data.index.indexOf(activeFilter) > -1);
|
|
593
|
+
},
|
|
594
|
+
addItem: function(container,i,object) {
|
|
595
|
+
var entry = object.info;
|
|
596
|
+
if (entry) {
|
|
597
|
+
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
|
598
|
+
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
|
599
|
+
$('<span>').text(entry.name).appendTo(titleRow);
|
|
600
|
+
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
|
|
601
|
+
var versionSpan = $('<span>').text(entry.version).appendTo(metaRow);
|
|
602
|
+
|
|
603
|
+
var errorRow = $('<div class="palette-module-meta palette-module-errors"><i class="fa fa-warning"></i></div>').hide().appendTo(headerRow);
|
|
604
|
+
var errorList = $('<ul class="palette-module-error-list"></ul>').appendTo(errorRow);
|
|
605
|
+
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
|
606
|
+
var setButton = $('<a href="#" class="editor-button editor-button-small palette-module-set-button"><i class="fa fa-angle-right palette-module-node-chevron"></i> </a>').appendTo(buttonRow);
|
|
607
|
+
var setCount = $('<span>').appendTo(setButton);
|
|
608
|
+
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
|
609
|
+
|
|
610
|
+
var updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').text('Update').appendTo(buttonGroup);
|
|
611
|
+
updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
|
612
|
+
updateButton.click(function(evt) {
|
|
613
|
+
evt.preventDefault();
|
|
614
|
+
if ($(this).hasClass('disabled')) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
update(entry,loadedIndex[entry.name].version,container,function(err){});
|
|
618
|
+
})
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').text('Remove').appendTo(buttonGroup);
|
|
622
|
+
removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000));
|
|
623
|
+
removeButton.click(function(evt) {
|
|
624
|
+
evt.preventDefault();
|
|
625
|
+
remove(entry,container,function(err){});
|
|
626
|
+
})
|
|
627
|
+
if (!entry.local) {
|
|
628
|
+
removeButton.hide();
|
|
629
|
+
}
|
|
630
|
+
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').text('disable all').appendTo(buttonGroup);
|
|
631
|
+
|
|
632
|
+
var contentRow = $('<div>',{class:"palette-module-content"}).appendTo(container);
|
|
633
|
+
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
|
634
|
+
|
|
635
|
+
object.elements = {
|
|
636
|
+
updateButton: updateButton,
|
|
637
|
+
removeButton: removeButton,
|
|
638
|
+
enableButton: enableButton,
|
|
639
|
+
errorRow: errorRow,
|
|
640
|
+
errorList: errorList,
|
|
641
|
+
setCount: setCount,
|
|
642
|
+
container: container,
|
|
643
|
+
shade: shade,
|
|
644
|
+
versionSpan: versionSpan,
|
|
645
|
+
sets: {}
|
|
646
|
+
}
|
|
647
|
+
setButton.click(function(evt) {
|
|
648
|
+
evt.preventDefault();
|
|
649
|
+
if (container.hasClass('expanded')) {
|
|
650
|
+
container.removeClass('expanded');
|
|
651
|
+
contentRow.slideUp();
|
|
652
|
+
} else {
|
|
653
|
+
container.addClass('expanded');
|
|
654
|
+
contentRow.slideDown();
|
|
655
|
+
}
|
|
656
|
+
})
|
|
657
|
+
|
|
658
|
+
var setList = Object.keys(entry.sets)
|
|
659
|
+
setList.sort(function(A,B) {
|
|
660
|
+
return A.toLowerCase().localeCompare(B.toLowerCase());
|
|
661
|
+
});
|
|
662
|
+
setList.forEach(function(setName) {
|
|
663
|
+
var set = entry.sets[setName];
|
|
664
|
+
var setRow = $('<div>',{class:"palette-module-set"}).appendTo(contentRow);
|
|
665
|
+
var buttonGroup = $('<div>',{class:"palette-module-set-button-group"}).appendTo(setRow);
|
|
666
|
+
var typeSwatches = {};
|
|
667
|
+
set.types.forEach(function(t) {
|
|
668
|
+
var typeDiv = $('<div>',{class:"palette-module-type"}).appendTo(setRow);
|
|
669
|
+
typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv);
|
|
670
|
+
$('<span>',{class:"palette-module-type-node"}).text(t).appendTo(typeDiv);
|
|
671
|
+
})
|
|
672
|
+
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
|
|
673
|
+
enableButton.click(function(evt) {
|
|
674
|
+
evt.preventDefault();
|
|
675
|
+
if (object.setUseCount[setName] === 0) {
|
|
676
|
+
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
|
677
|
+
shade.show();
|
|
678
|
+
var newState = !currentSet.enabled
|
|
679
|
+
changeNodeState(set.id,newState,shade,function(xhr){
|
|
680
|
+
if (xhr) {
|
|
681
|
+
if (xhr.responseJSON) {
|
|
682
|
+
RED.notify(`Error found when enabling/disabling node: ${xhr.responseJSON.message}`)
|
|
683
|
+
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
})
|
|
689
|
+
|
|
690
|
+
object.elements.sets[set.name] = {
|
|
691
|
+
setRow: setRow,
|
|
692
|
+
enableButton: enableButton,
|
|
693
|
+
swatches: typeSwatches
|
|
694
|
+
};
|
|
695
|
+
});
|
|
696
|
+
enableButton.click(function(evt) {
|
|
697
|
+
evt.preventDefault();
|
|
698
|
+
if (object.totalUseCount === 0) {
|
|
699
|
+
changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){
|
|
700
|
+
if (xhr) {
|
|
701
|
+
if (xhr.responseJSON) {
|
|
702
|
+
RED.notify(`Installation '${id}' failed: ${xhr.responseJSON.message}`);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
})
|
|
708
|
+
refreshNodeModule(entry.name);
|
|
709
|
+
} else {
|
|
710
|
+
$('<div>',{class:"red-ui-search-empty"}).text('No matches found').appendTo(container);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
var installTab = $('<div>',{class:"palette-editor-tab hide"}).appendTo(content);
|
|
718
|
+
|
|
719
|
+
editorTabs.addTab({
|
|
720
|
+
id: 'install',
|
|
721
|
+
label: 'Install',
|
|
722
|
+
content: installTab
|
|
723
|
+
})
|
|
724
|
+
|
|
725
|
+
var toolBar = $('<div>',{class:"palette-editor-toolbar"}).appendTo(installTab);
|
|
726
|
+
|
|
727
|
+
var searchDiv = $('<div>',{class:"palette-search"}).appendTo(installTab);
|
|
728
|
+
searchInput = $('<input type="text" data-i18n="[placeholder]palette.search"></input>')
|
|
729
|
+
.appendTo(searchDiv)
|
|
730
|
+
.searchBox({
|
|
731
|
+
delay: 300,
|
|
732
|
+
change: function() {
|
|
733
|
+
var searchTerm = $(this).val().trim().toLowerCase();
|
|
734
|
+
if (searchTerm.length > 0) {
|
|
735
|
+
filteredList = loadedList.filter(function(m) {
|
|
736
|
+
return (m.index.indexOf(searchTerm) > -1);
|
|
737
|
+
}).map(function(f) { return {info:f}});
|
|
738
|
+
refreshFilteredItems();
|
|
739
|
+
searchInput.searchBox('count',filteredList.length+" / "+loadedList.length);
|
|
740
|
+
} else {
|
|
741
|
+
searchInput.searchBox('count',loadedList.length);
|
|
742
|
+
packageList.editableList('empty');
|
|
743
|
+
packageList.editableList('addItem',{count:loadedList.length});
|
|
744
|
+
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
$('<span>').text('sort ').appendTo(toolBar);
|
|
751
|
+
var sortGroup = $('<span class="button-group"></span>').appendTo(toolBar);
|
|
752
|
+
var sortRelevance = $('<a href="#" class="palette-editor-install-sort-option sidebar-header-button-toggle selected"><i class="fa fa-sort-amount-desc"></i></a>').appendTo(sortGroup);
|
|
753
|
+
var sortAZ = $('<a href="#" class="palette-editor-install-sort-option sidebar-header-button-toggle" data-i18n="palette.editor.sortAZ"></a>').appendTo(sortGroup);
|
|
754
|
+
var sortRecent = $('<a href="#" class="palette-editor-install-sort-option sidebar-header-button-toggle" data-i18n="palette.editor.sortRecent"></a>').appendTo(sortGroup);
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
var sortOpts = [
|
|
758
|
+
{button: sortRelevance, func: sortModulesRelevance},
|
|
759
|
+
{button: sortAZ, func: sortModulesAZ},
|
|
760
|
+
{button: sortRecent, func: sortModulesRecent}
|
|
761
|
+
]
|
|
762
|
+
sortOpts.forEach(function(opt) {
|
|
763
|
+
opt.button.click(function(e) {
|
|
764
|
+
e.preventDefault();
|
|
765
|
+
if ($(this).hasClass("selected")) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
$(".palette-editor-install-sort-option").removeClass("selected");
|
|
769
|
+
$(this).addClass("selected");
|
|
770
|
+
activeSort = opt.func;
|
|
771
|
+
refreshFilteredItems();
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
var refreshSpan = $('<span>').appendTo(toolBar);
|
|
776
|
+
var refreshButton = $('<a href="#" class="sidebar-header-button"><i class="fa fa-refresh"></i></a>').appendTo(refreshSpan);
|
|
777
|
+
refreshButton.click(function(e) {
|
|
778
|
+
e.preventDefault();
|
|
779
|
+
loadedList = [];
|
|
780
|
+
loadedIndex = {};
|
|
781
|
+
initInstallTab();
|
|
782
|
+
})
|
|
783
|
+
|
|
784
|
+
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
|
785
|
+
addButton: false,
|
|
786
|
+
scrollOnAdd: false,
|
|
787
|
+
addItem: function(container,i,object) {
|
|
788
|
+
if (object.count) {
|
|
789
|
+
$('<div>',{class:"red-ui-search-empty"}).text(`${object.count} module available`).appendTo(container);
|
|
790
|
+
return
|
|
791
|
+
}
|
|
792
|
+
if (object.more) {
|
|
793
|
+
container.addClass('palette-module-more');
|
|
794
|
+
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
|
795
|
+
var moreLink = $('<a href="#"></a>').text(`+ ${object.more} more`).appendTo(moreRow);
|
|
796
|
+
moreLink.click(function(e) {
|
|
797
|
+
e.preventDefault();
|
|
798
|
+
packageList.editableList('removeItem',object);
|
|
799
|
+
for (var i=object.start;i<Math.min(object.start+10,object.start+object.more);i++) {
|
|
800
|
+
packageList.editableList('addItem',filteredList[i]);
|
|
801
|
+
}
|
|
802
|
+
if (object.more > 10) {
|
|
803
|
+
packageList.editableList('addItem',{start:object.start+10, more:object.more-10})
|
|
804
|
+
}
|
|
805
|
+
})
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (object.info) {
|
|
809
|
+
var entry = object.info;
|
|
810
|
+
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
|
811
|
+
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
|
812
|
+
$('<span>',{class:"palette-module-name"}).text(entry.name||entry.id).appendTo(titleRow);
|
|
813
|
+
$('<a target="_blank" class="palette-module-link"><i class="fa fa-external-link"></i></a>').attr('href',entry.url).appendTo(titleRow);
|
|
814
|
+
var descRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
|
815
|
+
$('<div>',{class:"palette-module-description"}).text(entry.description).appendTo(descRow);
|
|
816
|
+
var metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
|
817
|
+
$('<span class="palette-module-version"><i class="fa fa-tag"></i> '+entry.version+'</span>').appendTo(metaRow);
|
|
818
|
+
$('<span class="palette-module-updated"><i class="fa fa-calendar"></i> '+formatUpdatedAt(entry.updated_at)+'</span>').appendTo(metaRow);
|
|
819
|
+
|
|
820
|
+
var duplicateType = false;
|
|
821
|
+
if (entry.types && entry.types.length > 0) {
|
|
822
|
+
|
|
823
|
+
for (var i=0;i<entry.types.length;i++) {
|
|
824
|
+
var nodeset = RED.nodes.registry.getNodeSetForType(entry.types[i]);
|
|
825
|
+
if (nodeset) {
|
|
826
|
+
duplicateType = nodeset.module;
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
// $('<div>',{class:"palette-module-meta"}).text(entry.types.join(",")).appendTo(headerRow);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
|
|
834
|
+
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
|
835
|
+
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').text('Install').appendTo(buttonGroup);
|
|
836
|
+
installButton.click(function(e) {
|
|
837
|
+
e.preventDefault();
|
|
838
|
+
if (!$(this).hasClass('disabled')) {
|
|
839
|
+
install(entry,container,function(xhr) {});
|
|
840
|
+
}
|
|
841
|
+
})
|
|
842
|
+
if (nodeEntries.hasOwnProperty(entry.id)) {
|
|
843
|
+
installButton.addClass('disabled');
|
|
844
|
+
installButton.text('Installed');
|
|
845
|
+
} else if (duplicateType) {
|
|
846
|
+
installButton.addClass('disabled');
|
|
847
|
+
installButton.text('Conflict');
|
|
848
|
+
RED.popover.create({
|
|
849
|
+
target:installButton,
|
|
850
|
+
content: `<p>This module cannot be installed as it includes a<br/>node type that has already been installed</p><p>Conflicts with <code>${duplicateType}</code></p>"`,
|
|
851
|
+
trigger:"hover",
|
|
852
|
+
direction:"bottom",
|
|
853
|
+
delay:{show:750,hide:50}
|
|
854
|
+
})
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
object.elements = {
|
|
858
|
+
installButton:installButton
|
|
859
|
+
}
|
|
860
|
+
} else {
|
|
861
|
+
$('<div>',{class:"red-ui-search-empty"}).text('No matches found').appendTo(container);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
$('<div id="palette-module-install-shade" class="palette-module-shade hide"><div class="palette-module-shade-status"></div><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(installTab);
|
|
867
|
+
}
|
|
868
|
+
function update(entry,version,container,done) {
|
|
869
|
+
if (RED.settings.theme('palette.editable') === false) {
|
|
870
|
+
done(new Error('Palette not editable'));
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
var notification = RED.notify(`<p>Updating '${entry.name}'</p><p>Updating the node will require a restart of kumologica to complete the update. This must be done manually.</p>"`, {
|
|
874
|
+
modal: true,
|
|
875
|
+
fixed: true,
|
|
876
|
+
buttons: [
|
|
877
|
+
{
|
|
878
|
+
text: 'Cancel',
|
|
879
|
+
click: function() {
|
|
880
|
+
notification.close();
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
text: 'Update',
|
|
885
|
+
class: "primary palette-module-install-confirm-button-update",
|
|
886
|
+
click: function() {
|
|
887
|
+
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
|
888
|
+
var buttonRow = $('<div style="position: relative;bottom: calc(50% + 17px); padding-right: 10px;text-align: right;"></div>').appendTo(spinner);
|
|
889
|
+
$('<button class="editor-button"></button>').text('View log').appendTo(buttonRow).click(function(evt) {
|
|
890
|
+
evt.preventDefault();
|
|
891
|
+
RED.actions.invoke("core:show-event-log");
|
|
892
|
+
});
|
|
893
|
+
RED.eventLog.startEvent('Install ' +" : "+entry.name+" "+version);
|
|
894
|
+
installNodeModule(entry.name,version,function(xhr) {
|
|
895
|
+
spinner.remove();
|
|
896
|
+
if (xhr) {
|
|
897
|
+
if (xhr.responseJSON) {
|
|
898
|
+
var notification = RED.notify(`<p>Failed to update: ${entry.name}</p><p>${xhr.responseJSON.message}</p><p>Check the log for more information</p>`, {
|
|
899
|
+
type: 'error',
|
|
900
|
+
modal: true,
|
|
901
|
+
fixed: true,
|
|
902
|
+
buttons: [
|
|
903
|
+
{
|
|
904
|
+
text: 'Close',
|
|
905
|
+
click: function() {
|
|
906
|
+
notification.close();
|
|
907
|
+
}
|
|
908
|
+
},{
|
|
909
|
+
text: 'View log',
|
|
910
|
+
click: function() {
|
|
911
|
+
notification.close();
|
|
912
|
+
RED.actions.invoke("core:show-event-log");
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
]
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
done(xhr);
|
|
920
|
+
});
|
|
921
|
+
notification.close();
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
]
|
|
925
|
+
})
|
|
926
|
+
}
|
|
927
|
+
function remove(entry,container,done) {
|
|
928
|
+
if (RED.settings.theme('palette.editable') === false) {
|
|
929
|
+
done(new Error('Palette not editable'));
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
var notification = RED.notify(`<p>Removing '${entry.name}'</p><p>Removing the node will uninstall it from kumologica. The node may continue to use resources until kumologica is restarted.</p>`,{
|
|
933
|
+
modal: true,
|
|
934
|
+
fixed: true,
|
|
935
|
+
buttons: [
|
|
936
|
+
{
|
|
937
|
+
text: 'Cancel',
|
|
938
|
+
click: function() {
|
|
939
|
+
notification.close();
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
text: 'Remove',
|
|
944
|
+
class: "primary palette-module-install-confirm-button-remove",
|
|
945
|
+
click: function() {
|
|
946
|
+
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
|
947
|
+
var buttonRow = $('<div style="position: relative;bottom: calc(50% + 17px); padding-right: 10px;text-align: right;"></div>').appendTo(spinner);
|
|
948
|
+
$('<button class="editor-button"></button>').text('View log').appendTo(buttonRow).click(function(evt) {
|
|
949
|
+
evt.preventDefault();
|
|
950
|
+
RED.actions.invoke("core:show-event-log");
|
|
951
|
+
});
|
|
952
|
+
RED.eventLog.startEvent('Remove'+" : "+entry.name);
|
|
953
|
+
removeNodeModule(entry.name, function(xhr) {
|
|
954
|
+
spinner.remove();
|
|
955
|
+
if (xhr) {
|
|
956
|
+
if (xhr.responseJSON) {
|
|
957
|
+
var notification = RED.notify(`<p>Failed to remove: ${entry.name} </p><p>${xhr.responseJSON.message}</p><p>Check the log for more information</p>`,{
|
|
958
|
+
type: 'error',
|
|
959
|
+
modal: true,
|
|
960
|
+
fixed: true,
|
|
961
|
+
buttons: [
|
|
962
|
+
{
|
|
963
|
+
text: 'Close',
|
|
964
|
+
click: function() {
|
|
965
|
+
notification.close();
|
|
966
|
+
}
|
|
967
|
+
},{
|
|
968
|
+
text: 'View log',
|
|
969
|
+
click: function() {
|
|
970
|
+
notification.close();
|
|
971
|
+
RED.actions.invoke("core:show-event-log");
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
]
|
|
975
|
+
}); }
|
|
976
|
+
}
|
|
977
|
+
})
|
|
978
|
+
notification.close();
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
]
|
|
982
|
+
})
|
|
983
|
+
}
|
|
984
|
+
function install(entry,container,done) {
|
|
985
|
+
if (RED.settings.theme('palette.editable') === false) {
|
|
986
|
+
done(new Error('Palette not editable'));
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
var buttons = [
|
|
990
|
+
{
|
|
991
|
+
text: 'Cancel',
|
|
992
|
+
click: function() {
|
|
993
|
+
notification.close();
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
];
|
|
997
|
+
if (entry.url) {
|
|
998
|
+
buttons.push({
|
|
999
|
+
text: 'Review',
|
|
1000
|
+
class: "primary palette-module-install-confirm-button-install",
|
|
1001
|
+
click: function() {
|
|
1002
|
+
var url = entry.url||"";
|
|
1003
|
+
window.open(url);
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
buttons.push({
|
|
1008
|
+
text: 'Install',
|
|
1009
|
+
class: "primary palette-module-install-confirm-button-install",
|
|
1010
|
+
click: function() {
|
|
1011
|
+
var spinner = RED.utils.addSpinnerOverlay(container, true);
|
|
1012
|
+
|
|
1013
|
+
var buttonRow = $('<div style="position: relative;bottom: calc(50% + 17px); padding-right: 10px;text-align: right;"></div>').appendTo(spinner);
|
|
1014
|
+
$('<button class="editor-button"></button>').text('View log').appendTo(buttonRow).click(function(evt) {
|
|
1015
|
+
evt.preventDefault();
|
|
1016
|
+
RED.actions.invoke("core:show-event-log");
|
|
1017
|
+
});
|
|
1018
|
+
RED.eventLog.startEvent('Install'+" : "+entry.id+" "+entry.version);
|
|
1019
|
+
installNodeModule(entry.id,entry.version,function(xhr) {
|
|
1020
|
+
spinner.remove();
|
|
1021
|
+
if (xhr) {
|
|
1022
|
+
if (xhr.responseJSON) {
|
|
1023
|
+
var notification = RED.notify(`<p>Failed to install: ${entry.id}</p><p>${xhr.responseJSON.message}</p><p>Check the log for more information</p>`, {
|
|
1024
|
+
type: 'error',
|
|
1025
|
+
modal: true,
|
|
1026
|
+
fixed: true,
|
|
1027
|
+
buttons: [
|
|
1028
|
+
{
|
|
1029
|
+
text: 'Close',
|
|
1030
|
+
click: function() {
|
|
1031
|
+
notification.close();
|
|
1032
|
+
}
|
|
1033
|
+
},{
|
|
1034
|
+
text: 'View log',
|
|
1035
|
+
click: function() {
|
|
1036
|
+
notification.close();
|
|
1037
|
+
RED.actions.invoke("core:show-event-log");
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
]
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
done(xhr);
|
|
1045
|
+
});
|
|
1046
|
+
notification.close();
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
var notification = RED.notify(`<p>Installing '${entry.id}'</p><p>Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of kumologica.</p>`, {
|
|
1051
|
+
modal: true,
|
|
1052
|
+
fixed: true,
|
|
1053
|
+
buttons: buttons
|
|
1054
|
+
})
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return {
|
|
1058
|
+
init: init,
|
|
1059
|
+
install: install
|
|
1060
|
+
}
|
|
1061
|
+
})();
|