@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,1651 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
RED.projects.settings = (function() {
|
|
4
|
+
|
|
5
|
+
var trayWidth = 700;
|
|
6
|
+
var settingsVisible = false;
|
|
7
|
+
|
|
8
|
+
var panes = [];
|
|
9
|
+
|
|
10
|
+
function addPane(options) {
|
|
11
|
+
panes.push(options);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// TODO: DRY - tab-info.js
|
|
15
|
+
function addTargetToExternalLinks(el) {
|
|
16
|
+
$(el).find("a").each(function(el) {
|
|
17
|
+
var href = $(this).attr('href');
|
|
18
|
+
if (/^https?:/.test(href)) {
|
|
19
|
+
$(this).attr('target','_blank');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return el;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function show(initialTab) {
|
|
26
|
+
if (settingsVisible) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!RED.user.hasPermission("projects.write")) {
|
|
30
|
+
RED.notify(RED._("user.errors.notAuthorized"),"error");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
settingsVisible = true;
|
|
35
|
+
var tabContainer;
|
|
36
|
+
|
|
37
|
+
var trayOptions = {
|
|
38
|
+
title: RED._("sidebar.project.projectSettings.title"),
|
|
39
|
+
buttons: [
|
|
40
|
+
{
|
|
41
|
+
id: "node-dialog-ok",
|
|
42
|
+
text: RED._("common.label.close"),
|
|
43
|
+
class: "primary",
|
|
44
|
+
click: function() {
|
|
45
|
+
RED.tray.close();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
resize: function(dimensions) {
|
|
50
|
+
trayWidth = dimensions.width;
|
|
51
|
+
},
|
|
52
|
+
open: function(tray) {
|
|
53
|
+
var project = RED.projects.getActiveProject();
|
|
54
|
+
|
|
55
|
+
var trayBody = tray.find('.editor-tray-body');
|
|
56
|
+
var settingsContent = $('<div></div>').appendTo(trayBody);
|
|
57
|
+
var tabContainer = $('<div></div>',{id:"user-settings-tabs-container"}).appendTo(settingsContent);
|
|
58
|
+
|
|
59
|
+
$('<ul></ul>',{id:"user-settings-tabs"}).appendTo(tabContainer);
|
|
60
|
+
var settingsTabs = RED.tabs.create({
|
|
61
|
+
id: "user-settings-tabs",
|
|
62
|
+
vertical: true,
|
|
63
|
+
onchange: function(tab) {
|
|
64
|
+
setTimeout(function() {
|
|
65
|
+
$("#user-settings-tabs-content").children().hide();
|
|
66
|
+
$("#" + tab.id).show();
|
|
67
|
+
if (tab.pane.focus) {
|
|
68
|
+
tab.pane.focus();
|
|
69
|
+
}
|
|
70
|
+
},50);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
var tabContents = $('<div></div>',{id:"user-settings-tabs-content"}).appendTo(settingsContent);
|
|
74
|
+
|
|
75
|
+
panes.forEach(function(pane) {
|
|
76
|
+
settingsTabs.addTab({
|
|
77
|
+
id: "project-settings-tab-"+pane.id,
|
|
78
|
+
label: pane.title,
|
|
79
|
+
pane: pane
|
|
80
|
+
});
|
|
81
|
+
pane.get(project).hide().appendTo(tabContents);
|
|
82
|
+
});
|
|
83
|
+
settingsContent.i18n();
|
|
84
|
+
settingsTabs.activateTab("project-settings-tab-"+(initialTab||'main'))
|
|
85
|
+
$("#sidebar-shade").show();
|
|
86
|
+
},
|
|
87
|
+
close: function() {
|
|
88
|
+
settingsVisible = false;
|
|
89
|
+
panes.forEach(function(pane) {
|
|
90
|
+
if (pane.close) {
|
|
91
|
+
pane.close();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
$("#sidebar-shade").hide();
|
|
95
|
+
|
|
96
|
+
},
|
|
97
|
+
show: function() {}
|
|
98
|
+
}
|
|
99
|
+
if (trayWidth !== null) {
|
|
100
|
+
trayOptions.width = trayWidth;
|
|
101
|
+
}
|
|
102
|
+
RED.tray.show(trayOptions);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function editDescription(activeProject, container) {
|
|
106
|
+
RED.editor.editMarkdown({
|
|
107
|
+
title: RED._('sidebar.project.editDescription'),
|
|
108
|
+
header: $('<span><i class="fa fa-book"></i> README.md</span>'),
|
|
109
|
+
value: activeProject.description,
|
|
110
|
+
complete: function(v) {
|
|
111
|
+
container.empty();
|
|
112
|
+
var spinner = utils.addSpinnerOverlay(container);
|
|
113
|
+
var done = function(err,res) {
|
|
114
|
+
if (err) {
|
|
115
|
+
return editDescription(activeProject, container);
|
|
116
|
+
}
|
|
117
|
+
activeProject.description = v;
|
|
118
|
+
updateProjectDescription(activeProject, container);
|
|
119
|
+
}
|
|
120
|
+
utils.sendRequest({
|
|
121
|
+
url: "projects/"+activeProject.name,
|
|
122
|
+
type: "PUT",
|
|
123
|
+
responses: {
|
|
124
|
+
0: function(error) {
|
|
125
|
+
done(error,null);
|
|
126
|
+
},
|
|
127
|
+
200: function(data) {
|
|
128
|
+
done(null,data);
|
|
129
|
+
RED.sidebar.versionControl.refresh(true);
|
|
130
|
+
},
|
|
131
|
+
400: {
|
|
132
|
+
'*': function(error) {
|
|
133
|
+
utils.reportUnexpectedError(error);
|
|
134
|
+
done(error,null);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
},{description:v}).always(function() {
|
|
139
|
+
spinner.remove();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function updateProjectDescription(activeProject, container) {
|
|
145
|
+
container.empty();
|
|
146
|
+
var desc;
|
|
147
|
+
if (activeProject.description) {
|
|
148
|
+
desc = marked(activeProject.description);
|
|
149
|
+
} else {
|
|
150
|
+
desc = '<span class="node-info-none">'+'No description available'+'</span>';
|
|
151
|
+
}
|
|
152
|
+
var description = addTargetToExternalLinks($('<span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(desc)+'">'+desc+'</span>')).appendTo(container);
|
|
153
|
+
description.find(".bidiAware").contents().filter(function() { return this.nodeType === 3 && this.textContent.trim() !== "" }).wrap( "<span></span>" );
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function editSummary(activeProject, summary, container) {
|
|
157
|
+
var editButton = container.prev();
|
|
158
|
+
editButton.hide();
|
|
159
|
+
container.empty();
|
|
160
|
+
var bg = $('<span class="button-row" style="position: relative; float: right; margin-right:0;"></span>').appendTo(container);
|
|
161
|
+
var input = $('<input type="text" style="width: calc(100% - 150px); margin-right: 10px;">').val(summary||"").appendTo(container);
|
|
162
|
+
$('<button class="editor-button">' + RED._("common.label.cancel") + '</button>')
|
|
163
|
+
.appendTo(bg)
|
|
164
|
+
.click(function(evt) {
|
|
165
|
+
evt.preventDefault();
|
|
166
|
+
updateProjectSummary(activeProject.summary, container);
|
|
167
|
+
editButton.show();
|
|
168
|
+
});
|
|
169
|
+
$('<button class="editor-button">' + RED._("common.label.save") + '</button>')
|
|
170
|
+
.appendTo(bg)
|
|
171
|
+
.click(function(evt) {
|
|
172
|
+
evt.preventDefault();
|
|
173
|
+
var v = input.val();
|
|
174
|
+
updateProjectSummary(v, container);
|
|
175
|
+
var spinner = utils.addSpinnerOverlay(container);
|
|
176
|
+
var done = function(err,res) {
|
|
177
|
+
if (err) {
|
|
178
|
+
spinner.remove();
|
|
179
|
+
return editSummary(activeProject, summary, container);
|
|
180
|
+
}
|
|
181
|
+
activeProject.summary = v;
|
|
182
|
+
spinner.remove();
|
|
183
|
+
updateProjectSummary(activeProject.summary, container);
|
|
184
|
+
editButton.show();
|
|
185
|
+
}
|
|
186
|
+
utils.sendRequest({
|
|
187
|
+
url: "projects/"+activeProject.name,
|
|
188
|
+
type: "PUT",
|
|
189
|
+
responses: {
|
|
190
|
+
0: function(error) {
|
|
191
|
+
done(error,null);
|
|
192
|
+
},
|
|
193
|
+
200: function(data) {
|
|
194
|
+
RED.sidebar.versionControl.refresh(true);
|
|
195
|
+
done(null,data);
|
|
196
|
+
},
|
|
197
|
+
400: {
|
|
198
|
+
'*': function(error) {
|
|
199
|
+
utils.reportUnexpectedError(error);
|
|
200
|
+
done(error,null);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
},{summary:v});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function updateProjectSummary(summary, container) {
|
|
208
|
+
container.empty();
|
|
209
|
+
if (summary) {
|
|
210
|
+
container.text(summary).removeClass('node-info-node');
|
|
211
|
+
} else {
|
|
212
|
+
container.text(RED._("sidebar.project.projectSettings.noSummaryAvailable")).addClass('node-info-none');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function createMainPane(activeProject) {
|
|
217
|
+
|
|
218
|
+
var pane = $('<div id="project-settings-tab-main" class="project-settings-tab-pane node-help"></div>');
|
|
219
|
+
$('<h1>').text(activeProject.name).appendTo(pane);
|
|
220
|
+
var summary = $('<div style="position: relative">').appendTo(pane);
|
|
221
|
+
var summaryContent = $('<div></div>',{style:"color: #999"}).appendTo(summary);
|
|
222
|
+
updateProjectSummary(activeProject.summary, summaryContent);
|
|
223
|
+
if (RED.user.hasPermission("projects.write")) {
|
|
224
|
+
$('<button class="editor-button editor-button-small" style="float: right;">' + RED._('sidebar.project.editDescription') + '</button>')
|
|
225
|
+
.prependTo(summary)
|
|
226
|
+
.click(function(evt) {
|
|
227
|
+
evt.preventDefault();
|
|
228
|
+
editSummary(activeProject, activeProject.summary, summaryContent);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
$('<hr>').appendTo(pane);
|
|
232
|
+
|
|
233
|
+
var description = $('<div class="node-help" style="position: relative"></div>').appendTo(pane);
|
|
234
|
+
var descriptionContent = $('<div>',{style:"min-height: 200px"}).appendTo(description);
|
|
235
|
+
|
|
236
|
+
updateProjectDescription(activeProject, descriptionContent);
|
|
237
|
+
|
|
238
|
+
if (RED.user.hasPermission("projects.write")) {
|
|
239
|
+
$('<button class="editor-button editor-button-small" style="float: right;">' + RED._('sidebar.project.editReadme') + '</button>')
|
|
240
|
+
.prependTo(description)
|
|
241
|
+
.click(function(evt) {
|
|
242
|
+
evt.preventDefault();
|
|
243
|
+
editDescription(activeProject, descriptionContent);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return pane;
|
|
247
|
+
}
|
|
248
|
+
function updateProjectDependencies(activeProject,depsList) {
|
|
249
|
+
depsList.editableList('empty');
|
|
250
|
+
|
|
251
|
+
var totalCount = 0;
|
|
252
|
+
var unknownCount = 0;
|
|
253
|
+
var unusedCount = 0;
|
|
254
|
+
var notInstalledCount = 0;
|
|
255
|
+
|
|
256
|
+
for (var m in modulesInUse) {
|
|
257
|
+
if (modulesInUse.hasOwnProperty(m)) {
|
|
258
|
+
depsList.editableList('addItem',{
|
|
259
|
+
id: modulesInUse[m].module,
|
|
260
|
+
version: modulesInUse[m].version,
|
|
261
|
+
count: modulesInUse[m].count,
|
|
262
|
+
known: activeProject.dependencies.hasOwnProperty(m),
|
|
263
|
+
installed: true
|
|
264
|
+
});
|
|
265
|
+
totalCount++;
|
|
266
|
+
if (modulesInUse[m].count === 0) {
|
|
267
|
+
unusedCount++;
|
|
268
|
+
}
|
|
269
|
+
if (!activeProject.dependencies.hasOwnProperty(m)) {
|
|
270
|
+
unknownCount++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (activeProject.dependencies) {
|
|
276
|
+
for (var m in activeProject.dependencies) {
|
|
277
|
+
if (activeProject.dependencies.hasOwnProperty(m) && !modulesInUse.hasOwnProperty(m)) {
|
|
278
|
+
var installed = !!RED.nodes.registry.getModule(m);
|
|
279
|
+
depsList.editableList('addItem',{
|
|
280
|
+
id: m,
|
|
281
|
+
version: activeProject.dependencies[m], //RED.nodes.registry.getModule(module).version,
|
|
282
|
+
count: 0,
|
|
283
|
+
known: true,
|
|
284
|
+
installed: installed
|
|
285
|
+
});
|
|
286
|
+
totalCount++;
|
|
287
|
+
if (installed) {
|
|
288
|
+
unusedCount++;
|
|
289
|
+
} else {
|
|
290
|
+
notInstalledCount++;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// if (notInstalledCount > 0) {
|
|
296
|
+
// depsList.editableList('addItem',{index:1, label:"Missing dependencies"}); // TODO: nls
|
|
297
|
+
// }
|
|
298
|
+
// if (unknownCount > 0) {
|
|
299
|
+
// depsList.editableList('addItem',{index:1, label:"Unlisted dependencies"}); // TODO: nls
|
|
300
|
+
// }
|
|
301
|
+
// if (unusedCount > 0) {
|
|
302
|
+
// depsList.editableList('addItem',{index:3, label:"Unused dependencies"}); // TODO: nls
|
|
303
|
+
// }
|
|
304
|
+
if (totalCount === 0) {
|
|
305
|
+
depsList.editableList('addItem',{index:0, label:RED._("sidebar.project.projectSettings.none")});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function saveDependencies(depsList,container,dependencies,complete) {
|
|
311
|
+
var activeProject = RED.projects.getActiveProject();
|
|
312
|
+
var spinner = utils.addSpinnerOverlay(container).addClass('projects-dialog-spinner-contain');
|
|
313
|
+
var done = function(err,res) {
|
|
314
|
+
spinner.remove();
|
|
315
|
+
if (err) {
|
|
316
|
+
return complete(err);
|
|
317
|
+
}
|
|
318
|
+
activeProject.dependencies = dependencies;
|
|
319
|
+
RED.sidebar.versionControl.refresh(true);
|
|
320
|
+
complete();
|
|
321
|
+
}
|
|
322
|
+
utils.sendRequest({
|
|
323
|
+
url: "projects/"+activeProject.name,
|
|
324
|
+
type: "PUT",
|
|
325
|
+
responses: {
|
|
326
|
+
0: function(error) {
|
|
327
|
+
done(error,null);
|
|
328
|
+
},
|
|
329
|
+
200: function(data) {
|
|
330
|
+
RED.sidebar.versionControl.refresh(true);
|
|
331
|
+
done(null,data);
|
|
332
|
+
},
|
|
333
|
+
400: {
|
|
334
|
+
'*': function(error) {
|
|
335
|
+
done(error,null);
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
}
|
|
339
|
+
},{dependencies:dependencies});
|
|
340
|
+
}
|
|
341
|
+
function editDependencies(activeProject,depsJSON,container,depsList) {
|
|
342
|
+
var json = depsJSON||JSON.stringify(activeProject.dependencies||{},"",4);
|
|
343
|
+
if (json === "{}") {
|
|
344
|
+
json = "{\n\n}";
|
|
345
|
+
}
|
|
346
|
+
RED.editor.editJSON({
|
|
347
|
+
title: RED._('sidebar.project.editDependencies'),
|
|
348
|
+
value: json,
|
|
349
|
+
requireValid: true,
|
|
350
|
+
complete: function(v) {
|
|
351
|
+
try {
|
|
352
|
+
var parsed = JSON.parse(v);
|
|
353
|
+
saveDependencies(depsList,container,parsed,function(err) {
|
|
354
|
+
if (err) {
|
|
355
|
+
return editDependencies(activeProject,v,container,depsList);
|
|
356
|
+
}
|
|
357
|
+
activeProject.dependencies = parsed;
|
|
358
|
+
updateProjectDependencies(activeProject,depsList);
|
|
359
|
+
});
|
|
360
|
+
} catch(err) {
|
|
361
|
+
editDependencies(activeProject,v,container,depsList);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function createDependenciesPane(activeProject) {
|
|
368
|
+
var pane = $('<div id="project-settings-tab-deps" class="project-settings-tab-pane node-help"></div>');
|
|
369
|
+
if (RED.user.hasPermission("projects.write")) {
|
|
370
|
+
$('<button class="editor-button editor-button-small" style="margin-top:10px;float: right;">' + RED._("sidebar.project.projectSettings.edit") + '</button>')
|
|
371
|
+
.appendTo(pane)
|
|
372
|
+
.click(function(evt) {
|
|
373
|
+
evt.preventDefault();
|
|
374
|
+
editDependencies(activeProject,null,pane,depsList)
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
var depsList = $("<ol>",{style:"position: absolute;top: 60px;bottom: 20px;left: 20px;right: 20px;"}).appendTo(pane);
|
|
378
|
+
depsList.editableList({
|
|
379
|
+
addButton: false,
|
|
380
|
+
addItem: function(row,index,entry) {
|
|
381
|
+
// console.log(entry);
|
|
382
|
+
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(row);
|
|
383
|
+
if (entry.label) {
|
|
384
|
+
if (entry.index === 0) {
|
|
385
|
+
headerRow.addClass("red-ui-search-empty")
|
|
386
|
+
} else {
|
|
387
|
+
row.parent().addClass("palette-module-section");
|
|
388
|
+
}
|
|
389
|
+
headerRow.text(entry.label);
|
|
390
|
+
// if (RED.user.hasPermission("projects.write")) {
|
|
391
|
+
// if (entry.index === 1) {
|
|
392
|
+
// var addButton = $('<button class="editor-button editor-button-small palette-module-button">add to project</button>').appendTo(headerRow).click(function(evt) {
|
|
393
|
+
// evt.preventDefault();
|
|
394
|
+
// var deps = $.extend(true, {}, activeProject.dependencies);
|
|
395
|
+
// for (var m in modulesInUse) {
|
|
396
|
+
// if (modulesInUse.hasOwnProperty(m) && !modulesInUse[m].known) {
|
|
397
|
+
// deps[m] = modulesInUse[m].version;
|
|
398
|
+
// }
|
|
399
|
+
// }
|
|
400
|
+
// editDependencies(activeProject,JSON.stringify(deps,"",4),pane,depsList);
|
|
401
|
+
// });
|
|
402
|
+
// } else if (entry.index === 3) {
|
|
403
|
+
// var removeButton = $('<button class="editor-button editor-button-small palette-module-button">remove from project</button>').appendTo(headerRow).click(function(evt) {
|
|
404
|
+
// evt.preventDefault();
|
|
405
|
+
// var deps = $.extend(true, {}, activeProject.dependencies);
|
|
406
|
+
// for (var m in activeProject.dependencies) {
|
|
407
|
+
// if (activeProject.dependencies.hasOwnProperty(m) && !modulesInUse.hasOwnProperty(m)) {
|
|
408
|
+
// delete deps[m];
|
|
409
|
+
// }
|
|
410
|
+
// }
|
|
411
|
+
// editDependencies(activeProject,JSON.stringify(deps,"",4),pane,depsList);
|
|
412
|
+
// });
|
|
413
|
+
// }
|
|
414
|
+
// }
|
|
415
|
+
} else {
|
|
416
|
+
headerRow.addClass("palette-module-header");
|
|
417
|
+
if (!entry.installed) {
|
|
418
|
+
headerRow.addClass("palette-module-not-installed");
|
|
419
|
+
} else if (entry.count === 0) {
|
|
420
|
+
headerRow.addClass("palette-module-unused");
|
|
421
|
+
} else if (!entry.known) {
|
|
422
|
+
headerRow.addClass("palette-module-unknown");
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
entry.element = headerRow;
|
|
426
|
+
var titleRow = $('<div class="palette-module-meta palette-module-name"></div>').appendTo(headerRow);
|
|
427
|
+
var iconClass = "fa-cube";
|
|
428
|
+
if (!entry.installed) {
|
|
429
|
+
iconClass = "fa-warning";
|
|
430
|
+
}
|
|
431
|
+
var icon = $('<i class="fa '+iconClass+'"></i>').appendTo(titleRow);
|
|
432
|
+
entry.icon = icon;
|
|
433
|
+
$('<span>').text(entry.id).appendTo(titleRow);
|
|
434
|
+
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
|
|
435
|
+
var versionSpan = $('<span>').text(entry.version).appendTo(metaRow);
|
|
436
|
+
metaRow = $('<div class="palette-module-meta"></div>').appendTo(headerRow);
|
|
437
|
+
var buttons = $('<div class="palette-module-button-group"></div>').appendTo(metaRow);
|
|
438
|
+
if (RED.user.hasPermission("projects.write")) {
|
|
439
|
+
if (!entry.installed && RED.settings.theme('palette.editable') !== false) {
|
|
440
|
+
$('<a href="#" class="editor-button editor-button-small">' + RED._("sidebar.project.projectSettings.install") + '</a>').appendTo(buttons)
|
|
441
|
+
.click(function(evt) {
|
|
442
|
+
evt.preventDefault();
|
|
443
|
+
RED.palette.editor.install(entry,row,function(err) {
|
|
444
|
+
if (!err) {
|
|
445
|
+
entry.installed = true;
|
|
446
|
+
var spinner = RED.utils.addSpinnerOverlay(row,true);
|
|
447
|
+
setTimeout(function() {
|
|
448
|
+
depsList.editableList('removeItem',entry);
|
|
449
|
+
refreshModuleInUseCounts();
|
|
450
|
+
if (modulesInUse.hasOwnProperty(entry.id)) {
|
|
451
|
+
entry.count = modulesInUse[entry.id].count;
|
|
452
|
+
} else {
|
|
453
|
+
entry.count = 0;
|
|
454
|
+
}
|
|
455
|
+
depsList.editableList('addItem',entry);
|
|
456
|
+
},500);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
})
|
|
460
|
+
} else if (entry.known && entry.count === 0) {
|
|
461
|
+
$('<a href="#" class="editor-button editor-button-small">' + RED._("sidebar.project.projectSettings.removeFromProject") + '</a>').appendTo(buttons)
|
|
462
|
+
.click(function(evt) {
|
|
463
|
+
evt.preventDefault();
|
|
464
|
+
var deps = $.extend(true, {}, activeProject.dependencies);
|
|
465
|
+
delete deps[entry.id];
|
|
466
|
+
saveDependencies(depsList,row,deps,function(err) {
|
|
467
|
+
if (!err) {
|
|
468
|
+
row.fadeOut(200,function() {
|
|
469
|
+
depsList.editableList('removeItem',entry);
|
|
470
|
+
});
|
|
471
|
+
} else {
|
|
472
|
+
console.log(err);
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
} else if (!entry.known) {
|
|
477
|
+
$('<a href="#" class="editor-button editor-button-small">' + RED._("sidebar.project.projectSettings.addToProject") + '</a>').appendTo(buttons)
|
|
478
|
+
.click(function(evt) {
|
|
479
|
+
evt.preventDefault();
|
|
480
|
+
var deps = $.extend(true, {}, activeProject.dependencies);
|
|
481
|
+
deps[entry.id] = modulesInUse[entry.id].version;
|
|
482
|
+
saveDependencies(depsList,row,deps,function(err) {
|
|
483
|
+
if (!err) {
|
|
484
|
+
buttons.remove();
|
|
485
|
+
headerRow.removeClass("palette-module-unknown");
|
|
486
|
+
} else {
|
|
487
|
+
console.log(err);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
sort: function(A,B) {
|
|
496
|
+
return A.id.localeCompare(B.id);
|
|
497
|
+
// if (A.index && B.index) {
|
|
498
|
+
// return A.index - B.index;
|
|
499
|
+
// }
|
|
500
|
+
// var Acategory = A.index?A.index:(A.known?(A.count>0?0:4):2);
|
|
501
|
+
// var Bcategory = B.index?B.index:(B.known?(B.count>0?0:4):2);
|
|
502
|
+
// if (Acategory === Bcategory) {
|
|
503
|
+
// return A.id.localeCompare(B.id);
|
|
504
|
+
// } else {
|
|
505
|
+
// return Acategory - Bcategory;
|
|
506
|
+
// }
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
updateProjectDependencies(activeProject,depsList);
|
|
511
|
+
return pane;
|
|
512
|
+
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function showProjectFileListing(row,activeProject,current,selectFilter,done) {
|
|
516
|
+
var dialog;
|
|
517
|
+
var dialogBody;
|
|
518
|
+
var filesList;
|
|
519
|
+
var selected;
|
|
520
|
+
var container = $('<div class="project-file-listing-container"></div>',{style:"position: relative; min-height: 175px; height: 175px;"}).hide().appendTo(row);
|
|
521
|
+
var spinner = utils.addSpinnerOverlay(container);
|
|
522
|
+
$.getJSON("projects/"+activeProject.name+"/files",function(result) {
|
|
523
|
+
var fileNames = Object.keys(result);
|
|
524
|
+
fileNames = fileNames.filter(function(fn) {
|
|
525
|
+
return !result[fn].status || !/D/.test(result[fn].status);
|
|
526
|
+
})
|
|
527
|
+
var files = {};
|
|
528
|
+
fileNames.sort();
|
|
529
|
+
fileNames.forEach(function(file) {
|
|
530
|
+
file.split("/").reduce(function(r,v,i,arr) { if (v) { if (i<arr.length-1) { r[v] = r[v]||{};} else { r[v] = true }return r[v];}},files);
|
|
531
|
+
});
|
|
532
|
+
var sortFiles = function(key,value,fullPath) {
|
|
533
|
+
var result = {
|
|
534
|
+
name: key||"/",
|
|
535
|
+
path: fullPath+(fullPath?"/":"")+key,
|
|
536
|
+
};
|
|
537
|
+
if (value === true) {
|
|
538
|
+
result.type = 'f';
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
result.type = 'd';
|
|
542
|
+
result.children = [];
|
|
543
|
+
result.path = result.path;
|
|
544
|
+
var files = Object.keys(value);
|
|
545
|
+
files.forEach(function(file) {
|
|
546
|
+
result.children.push(sortFiles(file,value[file],result.path));
|
|
547
|
+
})
|
|
548
|
+
result.children.sort(function(A,B) {
|
|
549
|
+
if (A.hasOwnProperty("children") && !B.hasOwnProperty("children")) {
|
|
550
|
+
return -1;
|
|
551
|
+
} else if (!A.hasOwnProperty("children") && B.hasOwnProperty("children")) {
|
|
552
|
+
return 1;
|
|
553
|
+
}
|
|
554
|
+
return A.name.localeCompare(B.name);
|
|
555
|
+
})
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
var files = sortFiles("",files,"")
|
|
559
|
+
|
|
560
|
+
createFileSubList(container,files.children,current,selectFilter,done,"height: 175px");
|
|
561
|
+
spinner.remove();
|
|
562
|
+
});
|
|
563
|
+
return container;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
function createFileSubList(container, files, current, selectFilter, onselect, style) {
|
|
567
|
+
style = style || "";
|
|
568
|
+
var list = $('<ol>',{class:"projects-dialog-file-list", style:style}).appendTo(container).editableList({
|
|
569
|
+
addButton: false,
|
|
570
|
+
scrollOnAdd: false,
|
|
571
|
+
addItem: function(row,index,entry) {
|
|
572
|
+
var header = $('<div></div>',{class:"projects-dialog-file-list-entry"}).appendTo(row);
|
|
573
|
+
if (entry.children) {
|
|
574
|
+
$('<span class="projects-dialog-file-list-entry-folder"><i class="fa fa-angle-right"></i> <i class="fa fa-folder-o"></i></span>').appendTo(header);
|
|
575
|
+
if (entry.children.length > 0) {
|
|
576
|
+
var children = $('<div></div>',{style:"padding-left: 20px;"}).appendTo(row);
|
|
577
|
+
if (current.indexOf(entry.path+"/") === 0) {
|
|
578
|
+
header.addClass("expanded");
|
|
579
|
+
} else {
|
|
580
|
+
children.hide();
|
|
581
|
+
}
|
|
582
|
+
createFileSubList(children,entry.children,current,selectFilter,onselect);
|
|
583
|
+
header.addClass("selectable");
|
|
584
|
+
header.click(function(e) {
|
|
585
|
+
if ($(this).hasClass("expanded")) {
|
|
586
|
+
$(this).removeClass("expanded");
|
|
587
|
+
children.slideUp(200);
|
|
588
|
+
} else {
|
|
589
|
+
$(this).addClass("expanded");
|
|
590
|
+
children.slideDown(200);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
var fileIcon = "fa-file-o";
|
|
598
|
+
var fileClass = "";
|
|
599
|
+
if (/\.json$/i.test(entry.name)) {
|
|
600
|
+
fileIcon = "fa-file-code-o"
|
|
601
|
+
} else if (/\.md$/i.test(entry.name)) {
|
|
602
|
+
fileIcon = "fa-book";
|
|
603
|
+
} else if (/^\.git/i.test(entry.name)) {
|
|
604
|
+
fileIcon = "fa-code-fork";
|
|
605
|
+
header.addClass("projects-dialog-file-list-entry-file-type-git");
|
|
606
|
+
}
|
|
607
|
+
$('<span class="projects-dialog-file-list-entry-file"> <i class="fa '+fileIcon+'"></i></span>').appendTo(header);
|
|
608
|
+
if (selectFilter(entry)) {
|
|
609
|
+
header.addClass("selectable");
|
|
610
|
+
if (entry.path === current) {
|
|
611
|
+
header.addClass("selected");
|
|
612
|
+
}
|
|
613
|
+
header.click(function(e) {
|
|
614
|
+
$(".projects-dialog-file-list-entry.selected").removeClass("selected");
|
|
615
|
+
$(this).addClass("selected");
|
|
616
|
+
onselect(entry.path,true);
|
|
617
|
+
})
|
|
618
|
+
header.dblclick(function(e) {
|
|
619
|
+
e.preventDefault();
|
|
620
|
+
onselect(entry.path,true);
|
|
621
|
+
})
|
|
622
|
+
} else {
|
|
623
|
+
header.addClass("unselectable");
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
$('<span class="projects-dialog-file-list-entry-name" style=""></span>').text(entry.name).appendTo(header);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
if (!style) {
|
|
630
|
+
list.parent().css("overflow-y","");
|
|
631
|
+
}
|
|
632
|
+
files.forEach(function(f) {
|
|
633
|
+
list.editableList('addItem',f);
|
|
634
|
+
})
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// function editFiles(activeProject, container,flowFile, flowFileLabel) {
|
|
638
|
+
// var editButton = container.children().first();
|
|
639
|
+
// editButton.hide();
|
|
640
|
+
//
|
|
641
|
+
// var flowFileInput = $('<input id="" type="text" style="width: calc(100% - 300px);">').val(flowFile).insertAfter(flowFileLabel);
|
|
642
|
+
//
|
|
643
|
+
// var flowFileInputSearch = $('<button class="editor-button" style="margin-left: 10px"><i class="fa fa-folder-open-o"></i></button>')
|
|
644
|
+
// .insertAfter(flowFileInput)
|
|
645
|
+
// .click(function(e) {
|
|
646
|
+
// showProjectFileListing(activeProject,'Select flow file',flowFileInput.val(),function(result) {
|
|
647
|
+
// flowFileInput.val(result);
|
|
648
|
+
// checkFiles();
|
|
649
|
+
// })
|
|
650
|
+
// })
|
|
651
|
+
//
|
|
652
|
+
// var checkFiles = function() {
|
|
653
|
+
// saveButton.toggleClass('disabled',flowFileInput.val()==="");
|
|
654
|
+
// saveButton.prop('disabled',flowFileInput.val()==="");
|
|
655
|
+
// }
|
|
656
|
+
// flowFileInput.on("change keyup paste",checkFiles);
|
|
657
|
+
// flowFileLabel.hide();
|
|
658
|
+
//
|
|
659
|
+
// var bg = $('<span class="button-group" style="position: relative; float: right; margin-right:0;"></span>').prependTo(container);
|
|
660
|
+
// $('<button class="editor-button">Cancel</button>')
|
|
661
|
+
// .appendTo(bg)
|
|
662
|
+
// .click(function(evt) {
|
|
663
|
+
// evt.preventDefault();
|
|
664
|
+
//
|
|
665
|
+
// flowFileLabel.show();
|
|
666
|
+
// flowFileInput.remove();
|
|
667
|
+
// flowFileInputSearch.remove();
|
|
668
|
+
// bg.remove();
|
|
669
|
+
// editButton.show();
|
|
670
|
+
// });
|
|
671
|
+
// var saveButton = $('<button class="editor-button">Save</button>')
|
|
672
|
+
// .appendTo(bg)
|
|
673
|
+
// .click(function(evt) {
|
|
674
|
+
// evt.preventDefault();
|
|
675
|
+
// var newFlowFile = flowFileInput.val();
|
|
676
|
+
// var newCredsFile = credentialsFileInput.val();
|
|
677
|
+
// var spinner = utils.addSpinnerOverlay(container);
|
|
678
|
+
// var done = function(err,res) {
|
|
679
|
+
// if (err) {
|
|
680
|
+
// spinner.remove();
|
|
681
|
+
// return;
|
|
682
|
+
// }
|
|
683
|
+
// activeProject.summary = v;
|
|
684
|
+
// spinner.remove();
|
|
685
|
+
// flowFileLabel.text(newFlowFile);
|
|
686
|
+
// flowFileLabel.show();
|
|
687
|
+
// flowFileInput.remove();
|
|
688
|
+
// flowFileInputSearch.remove();
|
|
689
|
+
// bg.remove();
|
|
690
|
+
// editButton.show();
|
|
691
|
+
// }
|
|
692
|
+
// // utils.sendRequest({
|
|
693
|
+
// // url: "projects/"+activeProject.name,
|
|
694
|
+
// // type: "PUT",
|
|
695
|
+
// // responses: {
|
|
696
|
+
// // 0: function(error) {
|
|
697
|
+
// // done(error,null);
|
|
698
|
+
// // },
|
|
699
|
+
// // 200: function(data) {
|
|
700
|
+
// // done(null,data);
|
|
701
|
+
// // },
|
|
702
|
+
// // 400: {
|
|
703
|
+
// // 'unexpected_error': function(error) {
|
|
704
|
+
// // done(error,null);
|
|
705
|
+
// // }
|
|
706
|
+
// // },
|
|
707
|
+
// // }
|
|
708
|
+
// // },{summary:v});
|
|
709
|
+
// });
|
|
710
|
+
//
|
|
711
|
+
//
|
|
712
|
+
// checkFiles();
|
|
713
|
+
//
|
|
714
|
+
// }
|
|
715
|
+
|
|
716
|
+
function createFilesSection(activeProject,pane) {
|
|
717
|
+
var title = $('<h3></h3>').text(RED._("sidebar.project.projectSettings.files")).appendTo(pane);
|
|
718
|
+
var filesContainer = $('<div class="user-settings-section"></div>').appendTo(pane);
|
|
719
|
+
if (RED.user.hasPermission("projects.write")) {
|
|
720
|
+
var editFilesButton = $('<button type="button" id="project-settings-tab-settings-file-edit" class="editor-button editor-button-small" style="float: right;">' + RED._('sidebar.project.projectSettings.edit') + '</button>')
|
|
721
|
+
.appendTo(title)
|
|
722
|
+
.click(function(evt) {
|
|
723
|
+
evt.preventDefault();
|
|
724
|
+
formButtons.show();
|
|
725
|
+
editFilesButton.hide();
|
|
726
|
+
// packageFileLabelText.hide();
|
|
727
|
+
|
|
728
|
+
if (!activeProject.files.package) {
|
|
729
|
+
packageFileSubLabel.find(".projects-edit-form-sublabel-text").text(RED._("sidebar.project.projectSettings.packageCreate"));
|
|
730
|
+
packageFileSubLabel.show();
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
packageFileInputSearch.show();
|
|
734
|
+
// packageFileInputCreate.show();
|
|
735
|
+
flowFileLabelText.hide();
|
|
736
|
+
flowFileInput.show();
|
|
737
|
+
flowFileInputSearch.show();
|
|
738
|
+
|
|
739
|
+
flowFileInputResize();
|
|
740
|
+
|
|
741
|
+
// credentialStateLabel.parent().hide();
|
|
742
|
+
credentialStateLabel.addClass("uneditable-input");
|
|
743
|
+
$(".user-settings-row-credentials").show();
|
|
744
|
+
credentialStateLabel.css('height','auto');
|
|
745
|
+
credentialFormRows.hide();
|
|
746
|
+
credentialSecretButtons.show();
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
var row;
|
|
750
|
+
|
|
751
|
+
// Flow files
|
|
752
|
+
row = $('<div class="user-settings-row"></div>').appendTo(filesContainer);
|
|
753
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.package")).appendTo(row);
|
|
754
|
+
var packageFileLabel = $('<div class="uneditable-input" style="padding:0">').appendTo(row);
|
|
755
|
+
var packageFileLabelText = $('<span style="display:inline-block; padding: 6px">').text(activeProject.files.package||"package.json").appendTo(packageFileLabel);
|
|
756
|
+
var packageFileInput = $('<input type="hidden">').val(activeProject.files.package||"package.json").appendTo(packageFileLabel);
|
|
757
|
+
|
|
758
|
+
var packageFileInputSearch = $('<button type="button" class="editor-button toggle single" style="border-top-right-radius: 4px; border-bottom-right-radius: 4px; width: 36px; height: 34px; position: absolute; top: -1px; right: -1px;"><i class="fa fa-folder-open-o"></i></button>')
|
|
759
|
+
.hide()
|
|
760
|
+
.appendTo(packageFileLabel)
|
|
761
|
+
.click(function(e) {
|
|
762
|
+
if ($(this).hasClass('selected')) {
|
|
763
|
+
$(this).removeClass('selected');
|
|
764
|
+
packageFileLabel.find('.project-file-listing-container').slideUp(200,function() {
|
|
765
|
+
$(this).remove();
|
|
766
|
+
packageFileLabel.css('height','');
|
|
767
|
+
});
|
|
768
|
+
packageFileLabel.css('color','');
|
|
769
|
+
} else {
|
|
770
|
+
$(this).addClass('selected');
|
|
771
|
+
packageFileLabel.css('color','inherit');
|
|
772
|
+
var fileList = showProjectFileListing(packageFileLabel,activeProject,packageFileInput.val(),
|
|
773
|
+
function(entry) { return entry.children || /package\.json$/.test(entry.path); },
|
|
774
|
+
function(result,close) {
|
|
775
|
+
if (result) {
|
|
776
|
+
packageFileInput.val(result);
|
|
777
|
+
packageFileLabelText.text(result);
|
|
778
|
+
var rootDir = result.substring(0,result.length - 12);
|
|
779
|
+
flowFileLabelPrefixText.text(rootDir);
|
|
780
|
+
credFileLabelPrefixText.text(rootDir);
|
|
781
|
+
flowFileInputResize();
|
|
782
|
+
packageFileSubLabel.hide();
|
|
783
|
+
}
|
|
784
|
+
if (close) {
|
|
785
|
+
$(packageFileInputSearch).click();
|
|
786
|
+
}
|
|
787
|
+
checkFiles();
|
|
788
|
+
});
|
|
789
|
+
packageFileLabel.css('height','auto');
|
|
790
|
+
setTimeout(function() {
|
|
791
|
+
fileList.slideDown(200);
|
|
792
|
+
},50);
|
|
793
|
+
|
|
794
|
+
}
|
|
795
|
+
})
|
|
796
|
+
RED.popover.tooltip(packageFileInputSearch,RED._("sidebar.project.projectSettings.selectFile"));
|
|
797
|
+
var packageFileSubLabel = $('<label style="margin-left: 110px" class="projects-edit-form-sublabel"><small><span class="form-warning"><i class="fa fa-warning"></i> <span class="projects-edit-form-sublabel-text"></span></small></label>').appendTo(row).hide();
|
|
798
|
+
if (!activeProject.files.package) {
|
|
799
|
+
packageFileSubLabel.find(".projects-edit-form-sublabel-text").text(RED._("sidebar.project.projectSettings.fileNotExist"));
|
|
800
|
+
packageFileSubLabel.show();
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
var projectPackage = activeProject.files.package||"package.json";
|
|
805
|
+
var projectRoot = projectPackage.substring(0,projectPackage.length - 12);
|
|
806
|
+
|
|
807
|
+
// Flow files
|
|
808
|
+
row = $('<div class="user-settings-row"></div>').appendTo(filesContainer);
|
|
809
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.flow")).appendTo(row);
|
|
810
|
+
var flowFileLabel = $('<div class="uneditable-input" style="padding:0">').appendTo(row);
|
|
811
|
+
var flowFileLabelPrefixText = $('<span style="display:inline-block; padding: 6px 0 6px 6px">').text(projectRoot).appendTo(flowFileLabel);
|
|
812
|
+
var flowFileName = "flows.json";
|
|
813
|
+
if (activeProject.files.flow) {
|
|
814
|
+
if (activeProject.files.flow.indexOf(projectRoot) === 0) {
|
|
815
|
+
flowFileName = activeProject.files.flow.substring(projectRoot.length);
|
|
816
|
+
} else {
|
|
817
|
+
flowFileName = activeProject.files.flow;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
var flowFileLabelText = $('<span style="display:inline-block; padding: 6px 6px 6px 0">').text(flowFileName).appendTo(flowFileLabel);
|
|
821
|
+
var flowFileInputResize = function() {
|
|
822
|
+
flowFileInput.css({
|
|
823
|
+
"width": "calc(100% - "+(flowFileInputSearch.width() + flowFileLabelPrefixText.width())+"px)"
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
var flowFileInput = $('<input type="text" style="padding-left:1px; margin-top: -2px; margin-bottom: 0;border: none;">').val(flowFileName).hide().appendTo(flowFileLabel);
|
|
827
|
+
var flowFileInputSearch = $('<button type="button" class="editor-button toggle single" style="border-top-right-radius: 4px; border-bottom-right-radius: 4px; width: 36px; height: 34px; position: absolute; top: -1px; right: -1px;"><i class="fa fa-folder-open-o"></i></button>')
|
|
828
|
+
.hide()
|
|
829
|
+
.appendTo(flowFileLabel)
|
|
830
|
+
.click(function(e) {
|
|
831
|
+
if ($(this).hasClass('selected')) {
|
|
832
|
+
$(this).removeClass('selected');
|
|
833
|
+
flowFileLabel.find('.project-file-listing-container').slideUp(200,function() {
|
|
834
|
+
$(this).remove();
|
|
835
|
+
flowFileLabel.css('height','');
|
|
836
|
+
});
|
|
837
|
+
flowFileLabel.css('color','');
|
|
838
|
+
} else {
|
|
839
|
+
$(this).addClass('selected');
|
|
840
|
+
flowFileLabel.css('color','inherit');
|
|
841
|
+
var packageFile = packageFileInput.val();
|
|
842
|
+
var packagePrefix = packageFile.substring(0,packageFile.length - 12);
|
|
843
|
+
var re = new RegExp("^"+packagePrefix+".*\.json$");
|
|
844
|
+
var fileList = showProjectFileListing(flowFileLabel,
|
|
845
|
+
activeProject,
|
|
846
|
+
flowFileInput.val(),
|
|
847
|
+
function(entry) { return !/package.json$/.test(entry.path) && re.test(entry.path) && !/_cred\.json$/.test(entry.path) },
|
|
848
|
+
function(result,isDblClick) {
|
|
849
|
+
if (result) {
|
|
850
|
+
flowFileInput.val(result.substring(packagePrefix.length));
|
|
851
|
+
|
|
852
|
+
}
|
|
853
|
+
if (isDblClick) {
|
|
854
|
+
$(flowFileInputSearch).click();
|
|
855
|
+
}
|
|
856
|
+
checkFiles();
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
flowFileLabel.css('height','auto');
|
|
860
|
+
setTimeout(function() {
|
|
861
|
+
fileList.slideDown(200);
|
|
862
|
+
},50);
|
|
863
|
+
|
|
864
|
+
}
|
|
865
|
+
})
|
|
866
|
+
RED.popover.tooltip(flowFileInputSearch,RED._("sidebar.project.projectSettings.selectFile"));
|
|
867
|
+
|
|
868
|
+
row = $('<div class="user-settings-row"></div>').appendTo(filesContainer);
|
|
869
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.credentials")).appendTo(row);
|
|
870
|
+
|
|
871
|
+
var credFileName = "flows_cred.json";
|
|
872
|
+
if (activeProject.files.credentials) {
|
|
873
|
+
if (activeProject.files.flow.indexOf(projectRoot) === 0) {
|
|
874
|
+
credFileName = activeProject.files.credentials.substring(projectRoot.length);
|
|
875
|
+
} else {
|
|
876
|
+
credFileName = activeProject.files.credentials;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
var credFileLabel = $('<div class="uneditable-input" style="padding:0">').appendTo(row);
|
|
881
|
+
var credFileLabelPrefixText = $('<span style="display:inline-block;padding: 6px 0 6px 6px">').text(projectRoot).appendTo(credFileLabel);
|
|
882
|
+
var credFileLabelText = $('<span style="display:inline-block; padding: 6px 6px 6px 0">').text(credFileName).appendTo(credFileLabel);
|
|
883
|
+
|
|
884
|
+
var credFileInput = $('<input type="hidden">').val(credFileName).insertAfter(credFileLabel);
|
|
885
|
+
|
|
886
|
+
var checkFiles = function() {
|
|
887
|
+
var saveDisabled;
|
|
888
|
+
var currentFlowValue = flowFileInput.val();
|
|
889
|
+
var m = /^(.+?)(\.[^.]*)?$/.exec(currentFlowValue);
|
|
890
|
+
if (m) {
|
|
891
|
+
credFileLabelText.text(m[1]+"_cred"+(m[2]||".json"));
|
|
892
|
+
} else if (currentFlowValue === "") {
|
|
893
|
+
credFileLabelText.text("");
|
|
894
|
+
}
|
|
895
|
+
credFileInput.val(credFileLabelText.text());
|
|
896
|
+
var isFlowInvalid = currentFlowValue==="" ||
|
|
897
|
+
/\.\./.test(currentFlowValue) ||
|
|
898
|
+
/\/$/.test(currentFlowValue);
|
|
899
|
+
|
|
900
|
+
saveDisabled = isFlowInvalid || credFileLabelText.text()==="";
|
|
901
|
+
|
|
902
|
+
if (credentialSecretExistingInput.is(":visible")) {
|
|
903
|
+
credentialSecretExistingInput.toggleClass("input-error", credentialSecretExistingInput.val() === "");
|
|
904
|
+
saveDisabled = saveDisabled || credentialSecretExistingInput.val() === "";
|
|
905
|
+
}
|
|
906
|
+
if (credentialSecretNewInput.is(":visible")) {
|
|
907
|
+
credentialSecretNewInput.toggleClass("input-error", credentialSecretNewInput.val() === "");
|
|
908
|
+
saveDisabled = saveDisabled || credentialSecretNewInput.val() === "";
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
flowFileInput.toggleClass("input-error", isFlowInvalid);
|
|
913
|
+
// credFileInput.toggleClass("input-error",credFileInput.text()==="");
|
|
914
|
+
saveButton.toggleClass('disabled',saveDisabled);
|
|
915
|
+
saveButton.prop('disabled',saveDisabled);
|
|
916
|
+
}
|
|
917
|
+
flowFileInput.on("change keyup paste",checkFiles);
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
// if (!activeProject.files.package) {
|
|
921
|
+
// $('<span class="form-warning"><i class="fa fa-warning"></i> Missing</span>').appendTo(packageFileLabelText);
|
|
922
|
+
// }
|
|
923
|
+
// if (!activeProject.files.flow) {
|
|
924
|
+
// $('<span class="form-warning"><i class="fa fa-warning"></i> Missing</span>').appendTo(flowFileLabelText);
|
|
925
|
+
// }
|
|
926
|
+
// if (!activeProject.files.credentials) {
|
|
927
|
+
// $('<span class="form-warning"><i class="fa fa-warning"></i> Missing</span>').appendTo(credFileLabel);
|
|
928
|
+
// }
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
row = $('<div class="user-settings-row"></div>').appendTo(filesContainer);
|
|
932
|
+
|
|
933
|
+
$('<label></label>').appendTo(row);
|
|
934
|
+
var credentialStateLabel = $('<span><i class="user-settings-credentials-state-icon fa"></i> <span class="user-settings-credentials-state"></span></span>').appendTo(row);
|
|
935
|
+
var credentialSecretButtons = $('<span class="button-group" style="margin-left: -72px;">').hide().appendTo(row);
|
|
936
|
+
|
|
937
|
+
credentialStateLabel.css('color','#666');
|
|
938
|
+
credentialSecretButtons.css('vertical-align','top');
|
|
939
|
+
var credentialSecretResetButton = $('<button type="button" class="editor-button" style="vertical-align: top; width: 36px; margin-bottom: 10px"><i class="fa fa-trash-o"></i></button>')
|
|
940
|
+
.appendTo(credentialSecretButtons)
|
|
941
|
+
.click(function(e) {
|
|
942
|
+
e.preventDefault();
|
|
943
|
+
if (!$(this).hasClass('selected')) {
|
|
944
|
+
credentialSecretNewInput.val("");
|
|
945
|
+
credentialSecretExistingRow.hide();
|
|
946
|
+
credentialSecretNewRow.show();
|
|
947
|
+
$(this).addClass("selected");
|
|
948
|
+
credentialSecretEditButton.removeClass("selected");
|
|
949
|
+
credentialResetLabel.show();
|
|
950
|
+
credentialResetWarning.show();
|
|
951
|
+
credentialSetLabel.hide();
|
|
952
|
+
credentialChangeLabel.hide();
|
|
953
|
+
|
|
954
|
+
credentialFormRows.show();
|
|
955
|
+
} else {
|
|
956
|
+
$(this).removeClass("selected");
|
|
957
|
+
credentialFormRows.hide();
|
|
958
|
+
}
|
|
959
|
+
checkFiles();
|
|
960
|
+
});
|
|
961
|
+
RED.popover.tooltip(credentialSecretResetButton,RED._("sidebar.project.projectSettings.resetTheEncryptionKey"));
|
|
962
|
+
|
|
963
|
+
var credentialSecretEditButton = $('<button type="button" class="editor-button" style="border-top-right-radius: 4px; border-bottom-right-radius: 4px; vertical-align: top; width: 36px; margin-bottom: 10px"><i class="fa fa-pencil"></i></button>')
|
|
964
|
+
.appendTo(credentialSecretButtons)
|
|
965
|
+
.click(function(e) {
|
|
966
|
+
e.preventDefault();
|
|
967
|
+
if (!$(this).hasClass('selected')) {
|
|
968
|
+
credentialSecretExistingInput.val("");
|
|
969
|
+
credentialSecretNewInput.val("");
|
|
970
|
+
if (activeProject.settings.credentialSecretInvalid || !activeProject.settings.credentialsEncrypted) {
|
|
971
|
+
credentialSetLabel.show();
|
|
972
|
+
credentialChangeLabel.hide();
|
|
973
|
+
credentialSecretExistingRow.hide();
|
|
974
|
+
} else {
|
|
975
|
+
credentialSecretExistingRow.show();
|
|
976
|
+
credentialSetLabel.hide();
|
|
977
|
+
credentialChangeLabel.show();
|
|
978
|
+
}
|
|
979
|
+
credentialSecretNewRow.show();
|
|
980
|
+
credentialSecretEditButton.addClass("selected");
|
|
981
|
+
credentialSecretResetButton.removeClass("selected");
|
|
982
|
+
|
|
983
|
+
credentialResetLabel.hide();
|
|
984
|
+
credentialResetWarning.hide();
|
|
985
|
+
credentialFormRows.show();
|
|
986
|
+
} else {
|
|
987
|
+
$(this).removeClass("selected");
|
|
988
|
+
credentialFormRows.hide();
|
|
989
|
+
}
|
|
990
|
+
checkFiles();
|
|
991
|
+
})
|
|
992
|
+
|
|
993
|
+
RED.popover.tooltip(credentialSecretEditButton,RED._("sidebar.project.projectSettings.changeTheEncryptionKey"));
|
|
994
|
+
|
|
995
|
+
row = $('<div class="user-settings-row user-settings-row-credentials"></div>').hide().appendTo(filesContainer);
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
var credentialFormRows = $('<div>',{style:"margin-top:10px"}).hide().appendTo(credentialStateLabel);
|
|
1000
|
+
|
|
1001
|
+
var credentialSetLabel = $('<div style="margin: 20px 0 10px 5px;">' + RED._("sidebar.project.projectSettings.setTheEncryptionKey") + '</div>').hide().appendTo(credentialFormRows);
|
|
1002
|
+
var credentialChangeLabel = $('<div style="margin: 20px 0 10px 5px;">' + RED._("sidebar.project.projectSettings.changeTheEncryptionKey") + '</div>').hide().appendTo(credentialFormRows);
|
|
1003
|
+
var credentialResetLabel = $('<div style="margin: 20px 0 10px 5px;">' + RED._("sidebar.project.projectSettings.resetTheEncryptionKey") + '</div>').hide().appendTo(credentialFormRows);
|
|
1004
|
+
|
|
1005
|
+
var credentialSecretExistingRow = $('<div class="user-settings-row user-settings-row-credentials"></div>').appendTo(credentialFormRows);
|
|
1006
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.currentKey")).appendTo(credentialSecretExistingRow);
|
|
1007
|
+
var credentialSecretExistingInput = $('<input type="password">').appendTo(credentialSecretExistingRow)
|
|
1008
|
+
.on("change keyup paste",function() {
|
|
1009
|
+
if (popover) {
|
|
1010
|
+
popover.close();
|
|
1011
|
+
popover = null;
|
|
1012
|
+
}
|
|
1013
|
+
checkFiles();
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
var credentialSecretNewRow = $('<div class="user-settings-row user-settings-row-credentials"></div>').appendTo(credentialFormRows);
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.newKey")).appendTo(credentialSecretNewRow);
|
|
1020
|
+
var credentialSecretNewInput = $('<input type="password">').appendTo(credentialSecretNewRow).on("change keyup paste",checkFiles);
|
|
1021
|
+
|
|
1022
|
+
var credentialResetWarning = $('<div class="form-tips form-warning" style="margin: 10px;"><i class="fa fa-warning"></i>' + RED._("sidebar.project.projectSettings.credentialsAlert") + '</div>').hide().appendTo(credentialFormRows);
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
var hideEditForm = function() {
|
|
1026
|
+
editFilesButton.show();
|
|
1027
|
+
formButtons.hide();
|
|
1028
|
+
// packageFileLabelText.show();
|
|
1029
|
+
packageFileInputSearch.hide();
|
|
1030
|
+
// packageFileInputCreate.hide();
|
|
1031
|
+
flowFileLabelText.show();
|
|
1032
|
+
flowFileInput.hide();
|
|
1033
|
+
flowFileInputSearch.hide();
|
|
1034
|
+
|
|
1035
|
+
// credentialStateLabel.parent().show();
|
|
1036
|
+
credentialStateLabel.removeClass("uneditable-input");
|
|
1037
|
+
credentialStateLabel.css('height','');
|
|
1038
|
+
|
|
1039
|
+
flowFileInputSearch.removeClass('selected');
|
|
1040
|
+
flowFileLabel.find('.project-file-listing-container').remove();
|
|
1041
|
+
flowFileLabel.css('height','');
|
|
1042
|
+
flowFileLabel.css('color','');
|
|
1043
|
+
|
|
1044
|
+
$(".user-settings-row-credentials").hide();
|
|
1045
|
+
credentialFormRows.hide();
|
|
1046
|
+
credentialSecretButtons.hide();
|
|
1047
|
+
credentialSecretResetButton.removeClass("selected");
|
|
1048
|
+
credentialSecretEditButton.removeClass("selected");
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
var formButtons = $('<span class="button-row" style="position: relative; float: right; margin-right:0;"></span>').hide().appendTo(filesContainer);
|
|
1054
|
+
$('<button type="button" class="editor-button">' + RED._("common.label.cancel") + '</button>')
|
|
1055
|
+
.appendTo(formButtons)
|
|
1056
|
+
.click(function(evt) {
|
|
1057
|
+
evt.preventDefault();
|
|
1058
|
+
var projectPackage = activeProject.files.package||"package.json";
|
|
1059
|
+
var projectRoot = projectPackage.substring(0,projectPackage.length - 12);
|
|
1060
|
+
flowFileLabelPrefixText.text(projectRoot);
|
|
1061
|
+
credFileLabelPrefixText.text(projectRoot);
|
|
1062
|
+
packageFileLabelText.text(activeProject.files.package||"package.json");
|
|
1063
|
+
if (!activeProject.files.package) {
|
|
1064
|
+
packageFileSubLabel.find(".projects-edit-form-sublabel-text").text(RED._("sidebar.project.projectSettings.fileNotExist"));
|
|
1065
|
+
packageFileSubLabel.show();
|
|
1066
|
+
} else {
|
|
1067
|
+
packageFileSubLabel.hide();
|
|
1068
|
+
}
|
|
1069
|
+
flowFileInput.val(flowFileLabelText.text());
|
|
1070
|
+
credFileLabelText.text(credFileName);
|
|
1071
|
+
hideEditForm();
|
|
1072
|
+
});
|
|
1073
|
+
var saveButton = $('<button type="button" class="editor-button">' + RED._("common.label.save") + '</button>')
|
|
1074
|
+
.appendTo(formButtons)
|
|
1075
|
+
.click(function(evt) {
|
|
1076
|
+
evt.preventDefault();
|
|
1077
|
+
var spinner = utils.addSpinnerOverlay(filesContainer);
|
|
1078
|
+
var done = function(err) {
|
|
1079
|
+
spinner.remove();
|
|
1080
|
+
if (err) {
|
|
1081
|
+
utils.reportUnexpectedError(err);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
flowFileLabelText.text(flowFileInput.val());
|
|
1085
|
+
credFileLabelText.text(credFileInput.val());
|
|
1086
|
+
packageFileSubLabel.hide();
|
|
1087
|
+
hideEditForm();
|
|
1088
|
+
}
|
|
1089
|
+
var rootPath = packageFileInput.val();
|
|
1090
|
+
rootPath = rootPath.substring(0,rootPath.length-12);
|
|
1091
|
+
var payload = {
|
|
1092
|
+
files: {
|
|
1093
|
+
package: packageFileInput.val(),
|
|
1094
|
+
flow: rootPath+flowFileInput.val(),
|
|
1095
|
+
credentials: rootPath+credFileInput.val()
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
if (credentialSecretResetButton.hasClass('selected')) {
|
|
1100
|
+
payload.resetCredentialSecret = true;
|
|
1101
|
+
}
|
|
1102
|
+
if (credentialSecretResetButton.hasClass('selected') || credentialSecretEditButton.hasClass('selected')) {
|
|
1103
|
+
payload.credentialSecret = credentialSecretNewInput.val();
|
|
1104
|
+
if (credentialSecretExistingInput.is(":visible")) {
|
|
1105
|
+
payload.currentCredentialSecret = credentialSecretExistingInput.val();
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
RED.deploy.setDeployInflight(true);
|
|
1109
|
+
utils.sendRequest({
|
|
1110
|
+
url: "projects/"+activeProject.name,
|
|
1111
|
+
type: "PUT",
|
|
1112
|
+
responses: {
|
|
1113
|
+
0: function(error) {
|
|
1114
|
+
done(error);
|
|
1115
|
+
},
|
|
1116
|
+
200: function(data) {
|
|
1117
|
+
activeProject = data;
|
|
1118
|
+
RED.sidebar.versionControl.refresh(true);
|
|
1119
|
+
updateForm();
|
|
1120
|
+
done();
|
|
1121
|
+
},
|
|
1122
|
+
400: {
|
|
1123
|
+
'credentials_load_failed': function(error) {
|
|
1124
|
+
done(error);
|
|
1125
|
+
},
|
|
1126
|
+
'missing_current_credential_key': function(error) {
|
|
1127
|
+
credentialSecretExistingInput.addClass("input-error");
|
|
1128
|
+
popover = RED.popover.create({
|
|
1129
|
+
target: credentialSecretExistingInput,
|
|
1130
|
+
direction: 'right',
|
|
1131
|
+
size: 'small',
|
|
1132
|
+
content: "Incorrect key",
|
|
1133
|
+
autoClose: 3000
|
|
1134
|
+
}).open();
|
|
1135
|
+
done(error);
|
|
1136
|
+
},
|
|
1137
|
+
'*': function(error) {
|
|
1138
|
+
done(error);
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
}
|
|
1142
|
+
},payload).always(function() {
|
|
1143
|
+
setTimeout(function() {
|
|
1144
|
+
RED.deploy.setDeployInflight(false);
|
|
1145
|
+
},500);
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
var updateForm = function() {
|
|
1149
|
+
if (activeProject.settings.credentialSecretInvalid) {
|
|
1150
|
+
credentialStateLabel.find(".user-settings-credentials-state-icon").removeClass().addClass("user-settings-credentials-state-icon fa fa-warning");
|
|
1151
|
+
credentialStateLabel.find(".user-settings-credentials-state").text(RED._("sidebar.project.projectSettings.invalidEncryptionKey"));
|
|
1152
|
+
} else if (activeProject.settings.credentialsEncrypted) {
|
|
1153
|
+
credentialStateLabel.find(".user-settings-credentials-state-icon").removeClass().addClass("user-settings-credentials-state-icon fa fa-lock");
|
|
1154
|
+
credentialStateLabel.find(".user-settings-credentials-state").text(RED._("sidebar.project.projectSettings.encryptionEnabled"));
|
|
1155
|
+
} else {
|
|
1156
|
+
credentialStateLabel.find(".user-settings-credentials-state-icon").removeClass().addClass("user-settings-credentials-state-icon fa fa-unlock");
|
|
1157
|
+
credentialStateLabel.find(".user-settings-credentials-state").text(RED._("sidebar.project.projectSettings.encryptionDisabled"));
|
|
1158
|
+
}
|
|
1159
|
+
credentialSecretResetButton.toggleClass('disabled',!activeProject.settings.credentialSecretInvalid && !activeProject.settings.credentialsEncrypted);
|
|
1160
|
+
credentialSecretResetButton.prop('disabled',!activeProject.settings.credentialSecretInvalid && !activeProject.settings.credentialsEncrypted);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
checkFiles();
|
|
1164
|
+
updateForm();
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
function createLocalBranchListSection(activeProject,pane) {
|
|
1168
|
+
var localBranchContainer = $('<div class="user-settings-section"></div>').appendTo(pane);
|
|
1169
|
+
$('<h4></h4>').text(RED._("sidebar.project.projectSettings.branches")).appendTo(localBranchContainer);
|
|
1170
|
+
|
|
1171
|
+
var row = $('<div class="user-settings-row projects-dialog-list"></div>').appendTo(localBranchContainer);
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
var branchList = $('<ol>').appendTo(row).editableList({
|
|
1175
|
+
height: 'auto',
|
|
1176
|
+
addButton: false,
|
|
1177
|
+
scrollOnAdd: false,
|
|
1178
|
+
addItem: function(row,index,entry) {
|
|
1179
|
+
var container = $('<div class="projects-dialog-list-entry">').appendTo(row);
|
|
1180
|
+
if (entry.empty) {
|
|
1181
|
+
container.addClass('red-ui-search-empty');
|
|
1182
|
+
container.text(RED._("sidebar.project.projectSettings.noBranches"));
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (entry.current) {
|
|
1186
|
+
container.addClass("current");
|
|
1187
|
+
}
|
|
1188
|
+
$('<span class="entry-icon"><i class="fa fa-code-fork"></i></span>').appendTo(container);
|
|
1189
|
+
var content = $('<span>').appendTo(container);
|
|
1190
|
+
var topRow = $('<div>').appendTo(content);
|
|
1191
|
+
$('<span class="entry-name">').text(entry.name).appendTo(topRow);
|
|
1192
|
+
if (entry.commit) {
|
|
1193
|
+
$('<span class="entry-detail">').text(entry.commit.sha).appendTo(topRow);
|
|
1194
|
+
}
|
|
1195
|
+
if (entry.remote) {
|
|
1196
|
+
var bottomRow = $('<div>').appendTo(content);
|
|
1197
|
+
|
|
1198
|
+
$('<span class="entry-detail entry-remote-name">').text(entry.remote||"").appendTo(bottomRow);
|
|
1199
|
+
if (entry.status.ahead+entry.status.behind > 0) {
|
|
1200
|
+
$('<span class="entry-detail">'+
|
|
1201
|
+
'<i class="fa fa-long-arrow-up"></i> <span>'+entry.status.ahead+'</span> '+
|
|
1202
|
+
'<i class="fa fa-long-arrow-down"></i> <span>'+entry.status.behind+'</span>'+
|
|
1203
|
+
'</span>').appendTo(bottomRow);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
if (!entry.current) {
|
|
1208
|
+
var tools = $('<span class="entry-tools">').appendTo(container);
|
|
1209
|
+
$('<button class="editor-button editor-button-small"><i class="fa fa-trash"></i></button>')
|
|
1210
|
+
.appendTo(tools)
|
|
1211
|
+
.click(function(e) {
|
|
1212
|
+
e.preventDefault();
|
|
1213
|
+
var spinner = utils.addSpinnerOverlay(row).addClass('projects-dialog-spinner-contain');
|
|
1214
|
+
var notification = RED.notify(RED._("sidebar.project.projectSettings.deleteConfirm", { name: entry.name }), {
|
|
1215
|
+
type: "warning",
|
|
1216
|
+
modal: true,
|
|
1217
|
+
fixed: true,
|
|
1218
|
+
buttons: [
|
|
1219
|
+
{
|
|
1220
|
+
text: RED._("common.label.cancel"),
|
|
1221
|
+
click: function() {
|
|
1222
|
+
spinner.remove();
|
|
1223
|
+
notification.close();
|
|
1224
|
+
}
|
|
1225
|
+
},{
|
|
1226
|
+
text: 'Delete branch',
|
|
1227
|
+
click: function() {
|
|
1228
|
+
notification.close();
|
|
1229
|
+
var url = "projects/"+activeProject.name+"/branches/"+entry.name;
|
|
1230
|
+
var options = {
|
|
1231
|
+
url: url,
|
|
1232
|
+
type: "DELETE",
|
|
1233
|
+
responses: {
|
|
1234
|
+
200: function(data) {
|
|
1235
|
+
row.fadeOut(200,function() {
|
|
1236
|
+
branchList.editableList('removeItem',entry);
|
|
1237
|
+
spinner.remove();
|
|
1238
|
+
});
|
|
1239
|
+
},
|
|
1240
|
+
400: {
|
|
1241
|
+
'git_delete_branch_unmerged': function(error) {
|
|
1242
|
+
notification = RED.notify(RED._("sidebar.project.projectSettings.unmergedConfirm", { name: entry.name }), {
|
|
1243
|
+
type: "warning",
|
|
1244
|
+
modal: true,
|
|
1245
|
+
fixed: true,
|
|
1246
|
+
buttons: [
|
|
1247
|
+
{
|
|
1248
|
+
text: RED._("common.label.cancel"),
|
|
1249
|
+
click: function() {
|
|
1250
|
+
spinner.remove();
|
|
1251
|
+
notification.close();
|
|
1252
|
+
}
|
|
1253
|
+
},{
|
|
1254
|
+
text: RED._("sidebar.project.projectSettings.deleteUnmergedBranch"),
|
|
1255
|
+
click: function() {
|
|
1256
|
+
options.url += "?force=true";
|
|
1257
|
+
notification.close();
|
|
1258
|
+
utils.sendRequest(options);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
]
|
|
1262
|
+
});
|
|
1263
|
+
},
|
|
1264
|
+
'*': function(error) {
|
|
1265
|
+
utils.reportUnexpectedError(error);
|
|
1266
|
+
spinner.remove();
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
utils.sendRequest(options);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
]
|
|
1276
|
+
})
|
|
1277
|
+
})
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1283
|
+
$.getJSON("projects/"+activeProject.name+"/branches",function(result) {
|
|
1284
|
+
if (result.branches) {
|
|
1285
|
+
if (result.branches.length > 0) {
|
|
1286
|
+
result.branches.sort(function(A,B) {
|
|
1287
|
+
if (A.current) { return -1 }
|
|
1288
|
+
if (B.current) { return 1 }
|
|
1289
|
+
return A.name.localeCompare(B.name);
|
|
1290
|
+
});
|
|
1291
|
+
result.branches.forEach(function(branch) {
|
|
1292
|
+
branchList.editableList('addItem',branch);
|
|
1293
|
+
})
|
|
1294
|
+
} else {
|
|
1295
|
+
branchList.editableList('addItem',{empty:true});
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
})
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function createRemoteRepositorySection(activeProject,pane) {
|
|
1302
|
+
$('<h3></h3>').text(RED._("sidebar.project.projectSettings.versionControl")).appendTo(pane);
|
|
1303
|
+
|
|
1304
|
+
createLocalBranchListSection(activeProject,pane);
|
|
1305
|
+
|
|
1306
|
+
var repoContainer = $('<div class="user-settings-section"></div>').appendTo(pane);
|
|
1307
|
+
var title = $('<h4></h4>').text(RED._("sidebar.project.projectSettings.gitRemotes")).appendTo(repoContainer);
|
|
1308
|
+
|
|
1309
|
+
var editRepoButton = $('<button class="editor-button editor-button-small" style="float: right; margin-right: 10px;">' + RED._("sidebar.project.projectSettings.addRemote") + '</button>')
|
|
1310
|
+
.appendTo(title)
|
|
1311
|
+
.click(function(evt) {
|
|
1312
|
+
editRepoButton.attr('disabled',true);
|
|
1313
|
+
addRemoteDialog.slideDown(200, function() {
|
|
1314
|
+
addRemoteDialog[0].scrollIntoView();
|
|
1315
|
+
if (isEmpty) {
|
|
1316
|
+
remoteNameInput.val('origin');
|
|
1317
|
+
remoteURLInput.focus();
|
|
1318
|
+
} else {
|
|
1319
|
+
remoteNameInput.focus();
|
|
1320
|
+
}
|
|
1321
|
+
validateForm();
|
|
1322
|
+
});
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
var emptyItem = { empty: true };
|
|
1327
|
+
var isEmpty = true;
|
|
1328
|
+
var row = $('<div class="user-settings-row"></div>').appendTo(repoContainer);
|
|
1329
|
+
var addRemoteDialog = $('<div class="projects-dialog-list-dialog"></div>').hide().appendTo(row);
|
|
1330
|
+
row = $('<div class="user-settings-row projects-dialog-list"></div>').appendTo(repoContainer);
|
|
1331
|
+
var remotesList = $('<ol>').appendTo(row);
|
|
1332
|
+
remotesList.editableList({
|
|
1333
|
+
addButton: false,
|
|
1334
|
+
height: 'auto',
|
|
1335
|
+
addItem: function(row,index,entry) {
|
|
1336
|
+
|
|
1337
|
+
var container = $('<div class="projects-dialog-list-entry">').appendTo(row);
|
|
1338
|
+
if (entry.empty) {
|
|
1339
|
+
container.addClass('red-ui-search-empty');
|
|
1340
|
+
container.text(RED._("sidebar.project.projectSettings.noRemotes"));
|
|
1341
|
+
return;
|
|
1342
|
+
} else {
|
|
1343
|
+
$('<span class="entry-icon"><i class="fa fa-globe"></i></span>').appendTo(container);
|
|
1344
|
+
var content = $('<span>').appendTo(container);
|
|
1345
|
+
$('<div class="entry-name">').text(entry.name).appendTo(content);
|
|
1346
|
+
if (entry.urls.fetch === entry.urls.push) {
|
|
1347
|
+
$('<div class="entry-detail">').text(entry.urls.fetch).appendTo(content);
|
|
1348
|
+
} else {
|
|
1349
|
+
$('<div class="entry-detail">').text("fetch: "+entry.urls.fetch).appendTo(content);
|
|
1350
|
+
$('<div class="entry-detail">').text("push: "+entry.urls.push).appendTo(content);
|
|
1351
|
+
|
|
1352
|
+
}
|
|
1353
|
+
var tools = $('<span class="entry-tools">').appendTo(container);
|
|
1354
|
+
$('<button class="editor-button editor-button-small"><i class="fa fa-trash"></i></button>')
|
|
1355
|
+
.appendTo(tools)
|
|
1356
|
+
.click(function(e) {
|
|
1357
|
+
e.preventDefault();
|
|
1358
|
+
var spinner = utils.addSpinnerOverlay(row).addClass('projects-dialog-spinner-contain');
|
|
1359
|
+
var notification = RED.notify(RED._("sidebar.project.projectSettings.deleteRemoteConfrim", { name: entry.name }), {
|
|
1360
|
+
type: "warning",
|
|
1361
|
+
modal: true,
|
|
1362
|
+
fixed: true,
|
|
1363
|
+
buttons: [
|
|
1364
|
+
{
|
|
1365
|
+
text: RED._("common.label.cancel"),
|
|
1366
|
+
click: function() {
|
|
1367
|
+
spinner.remove();
|
|
1368
|
+
notification.close();
|
|
1369
|
+
}
|
|
1370
|
+
},{
|
|
1371
|
+
text: RED._("sidebar.project.projectSettings.deleteRemote"),
|
|
1372
|
+
click: function() {
|
|
1373
|
+
notification.close();
|
|
1374
|
+
|
|
1375
|
+
if (activeProject.git.branches.remote && activeProject.git.branches.remote.indexOf(entry.name+"/") === 0) {
|
|
1376
|
+
delete activeProject.git.branches.remote;
|
|
1377
|
+
}
|
|
1378
|
+
if (activeProject.git.branches.remoteAlt && activeProject.git.branches.remoteAlt.indexOf(entry.name+"/") === 0) {
|
|
1379
|
+
delete activeProject.git.branches.remoteAlt;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
var url = "projects/"+activeProject.name+"/remotes/"+entry.name;
|
|
1383
|
+
var options = {
|
|
1384
|
+
url: url,
|
|
1385
|
+
type: "DELETE",
|
|
1386
|
+
responses: {
|
|
1387
|
+
200: function(data) {
|
|
1388
|
+
row.fadeOut(200,function() {
|
|
1389
|
+
remotesList.editableList('removeItem',entry);
|
|
1390
|
+
setTimeout(spinner.remove, 100);
|
|
1391
|
+
if (data.remotes.length === 0) {
|
|
1392
|
+
delete activeProject.git.remotes;
|
|
1393
|
+
isEmpty = true;
|
|
1394
|
+
remotesList.editableList('addItem',emptyItem);
|
|
1395
|
+
} else {
|
|
1396
|
+
activeProject.git.remotes = {};
|
|
1397
|
+
data.remotes.forEach(function(remote) {
|
|
1398
|
+
var name = remote.name;
|
|
1399
|
+
delete remote.name;
|
|
1400
|
+
activeProject.git.remotes[name] = remote;
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
delete activeProject.git.branches.remoteAlt;
|
|
1404
|
+
RED.sidebar.versionControl.refresh();
|
|
1405
|
+
});
|
|
1406
|
+
},
|
|
1407
|
+
400: {
|
|
1408
|
+
'*': function(error) {
|
|
1409
|
+
utils.reportUnexpectedError(error);
|
|
1410
|
+
spinner.remove();
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
utils.sendRequest(options);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
]
|
|
1420
|
+
})
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
}
|
|
1426
|
+
});
|
|
1427
|
+
|
|
1428
|
+
var validateForm = function() {
|
|
1429
|
+
var validName = /^[a-zA-Z0-9\-_]+$/.test(remoteNameInput.val());
|
|
1430
|
+
var repo = remoteURLInput.val();
|
|
1431
|
+
// var validRepo = /^(?:file|git|ssh|https?|[\d\w\.\-_]+@[\w\.]+):(?:\/\/)?[\w\.@:\/~_-]+(?:\.git)?(?:\/?|\#[\d\w\.\-_]+?)$/.test(remoteURLInput.val());
|
|
1432
|
+
var validRepo = repo.length > 0 && !/\s/.test(repo);
|
|
1433
|
+
if (/^https?:\/\/[^/]+@/i.test(repo)) {
|
|
1434
|
+
remoteURLLabel.text(RED._("sidebar.project.projectSettings.urlRule2"));
|
|
1435
|
+
validRepo = false;
|
|
1436
|
+
} else {
|
|
1437
|
+
remoteURLLabel.text(RED._("sidebar.project.projectSettings.urlRule"));
|
|
1438
|
+
}
|
|
1439
|
+
saveButton.attr('disabled',(!validName || !validRepo))
|
|
1440
|
+
remoteNameInput.toggleClass('input-error',remoteNameInputChanged&&!validName);
|
|
1441
|
+
remoteURLInput.toggleClass('input-error',remoteURLInputChanged&&!validRepo);
|
|
1442
|
+
if (popover) {
|
|
1443
|
+
popover.close();
|
|
1444
|
+
popover = null;
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
var popover;
|
|
1448
|
+
var remoteNameInputChanged = false;
|
|
1449
|
+
var remoteURLInputChanged = false;
|
|
1450
|
+
|
|
1451
|
+
$('<div class="projects-dialog-list-dialog-header">').text(RED._('sidebar.project.projectSettings.addRemote2')).appendTo(addRemoteDialog);
|
|
1452
|
+
|
|
1453
|
+
row = $('<div class="user-settings-row"></div>').appendTo(addRemoteDialog);
|
|
1454
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.remoteName")).appendTo(row);
|
|
1455
|
+
var remoteNameInput = $('<input type="text">').appendTo(row).on("change keyup paste",function() {
|
|
1456
|
+
remoteNameInputChanged = true;
|
|
1457
|
+
validateForm();
|
|
1458
|
+
});
|
|
1459
|
+
$('<label class="projects-edit-form-sublabel"><small>' + RED._("sidebar.project.projectSettings.nameRule") + '</small></label>').appendTo(row).find("small");
|
|
1460
|
+
row = $('<div class="user-settings-row"></div>').appendTo(addRemoteDialog);
|
|
1461
|
+
$('<label for=""></label>').text(RED._("sidebar.project.projectSettings.url")).appendTo(row);
|
|
1462
|
+
var remoteURLInput = $('<input type="text">').appendTo(row).on("change keyup paste",function() {
|
|
1463
|
+
remoteURLInputChanged = true;
|
|
1464
|
+
validateForm()
|
|
1465
|
+
});
|
|
1466
|
+
var remoteURLLabel = $('<label class="projects-edit-form-sublabel"><small>' + RED._("sidebar.project.projectSettings.urlRule") +'</small></label>').appendTo(row).find("small");
|
|
1467
|
+
|
|
1468
|
+
var hideEditForm = function() {
|
|
1469
|
+
editRepoButton.attr('disabled',false);
|
|
1470
|
+
addRemoteDialog.hide();
|
|
1471
|
+
remoteNameInput.val("");
|
|
1472
|
+
remoteURLInput.val("");
|
|
1473
|
+
if (popover) {
|
|
1474
|
+
popover.close();
|
|
1475
|
+
popover = null;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
var formButtons = $('<span class="button-row" style="position: relative; float: right; margin: 10px;"></span>')
|
|
1479
|
+
.appendTo(addRemoteDialog);
|
|
1480
|
+
$('<button class="editor-button">' + RED._("common.label.cancel") + '</button>')
|
|
1481
|
+
.appendTo(formButtons)
|
|
1482
|
+
.click(function(evt) {
|
|
1483
|
+
evt.preventDefault();
|
|
1484
|
+
hideEditForm();
|
|
1485
|
+
});
|
|
1486
|
+
var saveButton = $('<button class="editor-button">' + RED._("sidebar.project.projectSettings.addRemote2") + '</button>')
|
|
1487
|
+
.appendTo(formButtons)
|
|
1488
|
+
.click(function(evt) {
|
|
1489
|
+
evt.preventDefault();
|
|
1490
|
+
var spinner = utils.addSpinnerOverlay(addRemoteDialog).addClass('projects-dialog-spinner-contain');
|
|
1491
|
+
|
|
1492
|
+
var payload = {
|
|
1493
|
+
name: remoteNameInput.val(),
|
|
1494
|
+
url: remoteURLInput.val()
|
|
1495
|
+
}
|
|
1496
|
+
var done = function(err) {
|
|
1497
|
+
spinner.remove();
|
|
1498
|
+
if (err) {
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
hideEditForm();
|
|
1502
|
+
}
|
|
1503
|
+
// console.log(JSON.stringify(payload,null,4));
|
|
1504
|
+
RED.deploy.setDeployInflight(true);
|
|
1505
|
+
utils.sendRequest({
|
|
1506
|
+
url: "projects/"+activeProject.name+"/remotes",
|
|
1507
|
+
type: "POST",
|
|
1508
|
+
responses: {
|
|
1509
|
+
0: function(error) {
|
|
1510
|
+
done(error);
|
|
1511
|
+
},
|
|
1512
|
+
200: function(data) {
|
|
1513
|
+
activeProject.git.remotes = {};
|
|
1514
|
+
data.remotes.forEach(function(remote) {
|
|
1515
|
+
var name = remote.name;
|
|
1516
|
+
delete remote.name;
|
|
1517
|
+
activeProject.git.remotes[name] = remote;
|
|
1518
|
+
});
|
|
1519
|
+
updateForm();
|
|
1520
|
+
RED.sidebar.versionControl.refresh();
|
|
1521
|
+
done();
|
|
1522
|
+
},
|
|
1523
|
+
400: {
|
|
1524
|
+
'git_remote_already_exists': function(error) {
|
|
1525
|
+
popover = RED.popover.create({
|
|
1526
|
+
target: remoteNameInput,
|
|
1527
|
+
direction: 'right',
|
|
1528
|
+
size: 'small',
|
|
1529
|
+
content: "Remote already exists",
|
|
1530
|
+
autoClose: 6000
|
|
1531
|
+
}).open();
|
|
1532
|
+
remoteNameInput.addClass('input-error');
|
|
1533
|
+
done(error);
|
|
1534
|
+
},
|
|
1535
|
+
'*': function(error) {
|
|
1536
|
+
utils.reportUnexpectedError(error);
|
|
1537
|
+
done(error);
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
}
|
|
1541
|
+
},payload);
|
|
1542
|
+
});
|
|
1543
|
+
|
|
1544
|
+
var updateForm = function() {
|
|
1545
|
+
remotesList.editableList('empty');
|
|
1546
|
+
var count = 0;
|
|
1547
|
+
if (activeProject.git.hasOwnProperty('remotes')) {
|
|
1548
|
+
for (var name in activeProject.git.remotes) {
|
|
1549
|
+
if (activeProject.git.remotes.hasOwnProperty(name)) {
|
|
1550
|
+
count++;
|
|
1551
|
+
remotesList.editableList('addItem',{name:name,urls:activeProject.git.remotes[name]});
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
isEmpty = (count === 0);
|
|
1556
|
+
if (isEmpty) {
|
|
1557
|
+
remotesList.editableList('addItem',emptyItem);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
updateForm();
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
function createSettingsPane(activeProject) {
|
|
1566
|
+
var pane = $('<div id="project-settings-tab-settings" class="project-settings-tab-pane node-help"></div>');
|
|
1567
|
+
createFilesSection(activeProject,pane);
|
|
1568
|
+
// createLocalRepositorySection(activeProject,pane);
|
|
1569
|
+
createRemoteRepositorySection(activeProject,pane);
|
|
1570
|
+
return pane;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
function refreshModuleInUseCounts() {
|
|
1574
|
+
modulesInUse = {};
|
|
1575
|
+
RED.nodes.eachNode(_updateModulesInUse);
|
|
1576
|
+
RED.nodes.eachConfig(_updateModulesInUse);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
function _updateModulesInUse(n) {
|
|
1580
|
+
if (!/^subflow:/.test(n.type)) {
|
|
1581
|
+
var module = RED.nodes.registry.getNodeSetForType(n.type).module;
|
|
1582
|
+
if (module !== 'kumologica-core') {
|
|
1583
|
+
if (!modulesInUse.hasOwnProperty(module)) {
|
|
1584
|
+
modulesInUse[module] = {
|
|
1585
|
+
module: module,
|
|
1586
|
+
version: RED.nodes.registry.getModule(module).version,
|
|
1587
|
+
count: 0,
|
|
1588
|
+
known: false
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
modulesInUse[module].count++;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
var popover;
|
|
1597
|
+
var utils;
|
|
1598
|
+
var modulesInUse = {};
|
|
1599
|
+
function init(_utils) {
|
|
1600
|
+
utils = _utils;
|
|
1601
|
+
addPane({
|
|
1602
|
+
id:'main',
|
|
1603
|
+
title: RED._("sidebar.project.name"),
|
|
1604
|
+
get: createMainPane,
|
|
1605
|
+
close: function() { }
|
|
1606
|
+
});
|
|
1607
|
+
addPane({
|
|
1608
|
+
id:'deps',
|
|
1609
|
+
title: RED._("sidebar.project.dependencies"),
|
|
1610
|
+
get: createDependenciesPane,
|
|
1611
|
+
close: function() { }
|
|
1612
|
+
});
|
|
1613
|
+
addPane({
|
|
1614
|
+
id:'settings',
|
|
1615
|
+
title: RED._("sidebar.project.settings"),
|
|
1616
|
+
get: createSettingsPane,
|
|
1617
|
+
close: function() {
|
|
1618
|
+
if (popover) {
|
|
1619
|
+
popover.close();
|
|
1620
|
+
popover = null;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
RED.events.on('nodes:add', _updateModulesInUse);
|
|
1626
|
+
RED.events.on('nodes:remove', function(n) {
|
|
1627
|
+
if (!/^subflow:/.test(n.type)) {
|
|
1628
|
+
var module = RED.nodes.registry.getNodeSetForType(n.type).module;
|
|
1629
|
+
if (module !== 'kumologica-core' && modulesInUse.hasOwnProperty(module)) {
|
|
1630
|
+
modulesInUse[module].count--;
|
|
1631
|
+
if (modulesInUse[module].count === 0) {
|
|
1632
|
+
if (!modulesInUse[module].known) {
|
|
1633
|
+
delete modulesInUse[module];
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
})
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
}
|
|
1643
|
+
return {
|
|
1644
|
+
init: init,
|
|
1645
|
+
show: show,
|
|
1646
|
+
switchProject: function(name) {
|
|
1647
|
+
// TODO: not ideal way to trigger this; should there be an editor-wide event?
|
|
1648
|
+
modulesInUse = {};
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
})();
|