@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,1383 @@
|
|
|
1
|
+
|
|
2
|
+
RED.sidebar.versionControl = (function() {
|
|
3
|
+
|
|
4
|
+
var sidebarContent;
|
|
5
|
+
var sections;
|
|
6
|
+
|
|
7
|
+
var allChanges = {};
|
|
8
|
+
|
|
9
|
+
var unstagedChangesList;
|
|
10
|
+
var stageAllButton;
|
|
11
|
+
var stagedChangesList;
|
|
12
|
+
var unstageAllButton;
|
|
13
|
+
var unstagedChanges;
|
|
14
|
+
var stagedChanges;
|
|
15
|
+
var bulkChangeSpinner;
|
|
16
|
+
var unmergedContent;
|
|
17
|
+
var unmergedChangesList;
|
|
18
|
+
var commitButton;
|
|
19
|
+
var localChanges;
|
|
20
|
+
|
|
21
|
+
var localCommitList;
|
|
22
|
+
var localCommitListShade;
|
|
23
|
+
// var remoteCommitList;
|
|
24
|
+
|
|
25
|
+
var isMerging;
|
|
26
|
+
|
|
27
|
+
function viewFileDiff(entry,state) {
|
|
28
|
+
var activeProject = RED.projects.getActiveProject();
|
|
29
|
+
var diffTarget = (state === 'staged')?"index":"tree";
|
|
30
|
+
utils.sendRequest({
|
|
31
|
+
url: "projects/"+activeProject.name+"/diff/"+diffTarget+"/"+encodeURIComponent(entry.file),
|
|
32
|
+
type: "GET",
|
|
33
|
+
responses: {
|
|
34
|
+
0: function(error) {
|
|
35
|
+
console.log(error);
|
|
36
|
+
// done(error,null);
|
|
37
|
+
},
|
|
38
|
+
200: function(data) {
|
|
39
|
+
var title;
|
|
40
|
+
if (state === 'unstaged') {
|
|
41
|
+
title = RED._("sidebar.project.versionControl.unstagedChanges")+' : '+entry.file
|
|
42
|
+
} else if (state === 'staged') {
|
|
43
|
+
title = RED._("sidebar.project.versionControl.stagedChanges")+' : '+entry.file
|
|
44
|
+
} else {
|
|
45
|
+
title = RED._("sidebar.project.versionControl.resolveConflicts")+' : '+entry.file
|
|
46
|
+
}
|
|
47
|
+
var options = {
|
|
48
|
+
diff: data.diff,
|
|
49
|
+
title: title,
|
|
50
|
+
unmerged: state === 'unmerged',
|
|
51
|
+
project: activeProject
|
|
52
|
+
}
|
|
53
|
+
if (state == 'unstaged') {
|
|
54
|
+
options.oldRevTitle = entry.indexStatus === " "?RED._("sidebar.project.versionControl.head"):RED._("sidebar.project.versionControl.staged");
|
|
55
|
+
options.newRevTitle = RED._("sidebar.project.versionControl.unstaged");
|
|
56
|
+
options.oldRev = entry.indexStatus === " "?"@":":0";
|
|
57
|
+
options.newRev = "_";
|
|
58
|
+
} else if (state === 'staged') {
|
|
59
|
+
options.oldRevTitle = RED._("sidebar.project.versionControl.head");
|
|
60
|
+
options.newRevTitle = RED._("sidebar.project.versionControl.staged");
|
|
61
|
+
options.oldRev = "@";
|
|
62
|
+
options.newRev = ":0";
|
|
63
|
+
} else {
|
|
64
|
+
options.oldRevTitle = RED._("sidebar.project.versionControl.local");
|
|
65
|
+
options.newRevTitle = RED._("sidebar.project.versionControl.remote");
|
|
66
|
+
options.commonRev = ":1";
|
|
67
|
+
options.oldRev = ":2";
|
|
68
|
+
options.newRev = ":3";
|
|
69
|
+
options.onresolve = function(resolution) {
|
|
70
|
+
utils.sendRequest({
|
|
71
|
+
url: "projects/"+activeProject.name+"/resolve/"+encodeURIComponent(entry.file),
|
|
72
|
+
type: "POST",
|
|
73
|
+
responses: {
|
|
74
|
+
0: function(error) {
|
|
75
|
+
console.log(error);
|
|
76
|
+
// done(error,null);
|
|
77
|
+
},
|
|
78
|
+
200: function(data) {
|
|
79
|
+
refresh(true);
|
|
80
|
+
},
|
|
81
|
+
400: {
|
|
82
|
+
'unexpected_error': function(error) {
|
|
83
|
+
console.log(error);
|
|
84
|
+
// done(error,null);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
},{resolutions:resolution.resolutions[entry.file]});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
RED.diff.showUnifiedDiff(options);
|
|
92
|
+
},
|
|
93
|
+
400: {
|
|
94
|
+
'unexpected_error': function(error) {
|
|
95
|
+
console.log(error);
|
|
96
|
+
// done(error,null);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function createChangeEntry(row, entry, status, state) {
|
|
104
|
+
row.addClass("sidebar-version-control-change-entry");
|
|
105
|
+
var container = $('<div>').appendTo(row);
|
|
106
|
+
if (entry.label) {
|
|
107
|
+
row.addClass('node-info-none');
|
|
108
|
+
container.text(entry.label);
|
|
109
|
+
if (entry.button) {
|
|
110
|
+
container.css({
|
|
111
|
+
display: "inline-block",
|
|
112
|
+
maxWidth: "300px",
|
|
113
|
+
textAlign: "left"
|
|
114
|
+
})
|
|
115
|
+
var toolbar = $('<div style="float: right; margin: 5px; height: 50px;"></div>').appendTo(container);
|
|
116
|
+
|
|
117
|
+
$('<button class="editor-button editor-button-small"></button>').text(entry.button.label)
|
|
118
|
+
.appendTo(toolbar)
|
|
119
|
+
.click(entry.button.click);
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
var icon = $('<i class=""></i>').appendTo(container);
|
|
126
|
+
var entryLink = $('<a href="#">')
|
|
127
|
+
.appendTo(container)
|
|
128
|
+
.click(function(e) {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
viewFileDiff(entry,state);
|
|
131
|
+
});
|
|
132
|
+
var label = $('<span>').appendTo(entryLink);
|
|
133
|
+
|
|
134
|
+
var entryTools = $('<div class="sidebar-version-control-change-entry-tools">').appendTo(row);
|
|
135
|
+
var bg;
|
|
136
|
+
var revertButton;
|
|
137
|
+
if (state === 'unstaged') {
|
|
138
|
+
bg = $('<span class="button-group" style="margin-right: 5px;"></span>').appendTo(entryTools);
|
|
139
|
+
revertButton = $('<button class="editor-button editor-button-small"><i class="fa fa-reply"></i></button>')
|
|
140
|
+
.appendTo(bg)
|
|
141
|
+
.click(function(evt) {
|
|
142
|
+
evt.preventDefault();
|
|
143
|
+
|
|
144
|
+
var spinner = utils.addSpinnerOverlay(container).addClass('projects-dialog-spinner-contain');
|
|
145
|
+
var notification = RED.notify(RED._("sidebar.project.versionControl.revert",{file:entry.file}), {
|
|
146
|
+
type: "warning",
|
|
147
|
+
modal: true,
|
|
148
|
+
fixed: true,
|
|
149
|
+
buttons: [
|
|
150
|
+
{
|
|
151
|
+
text: RED._("common.label.cancel"),
|
|
152
|
+
click: function() {
|
|
153
|
+
spinner.remove();
|
|
154
|
+
notification.close();
|
|
155
|
+
}
|
|
156
|
+
},{
|
|
157
|
+
text: RED._("sidebar.project.versionControl.revertChanges"),
|
|
158
|
+
click: function() {
|
|
159
|
+
notification.close();
|
|
160
|
+
var activeProject = RED.projects.getActiveProject();
|
|
161
|
+
var url = "projects/"+activeProject.name+"/files/_/"+entry.file;
|
|
162
|
+
var options = {
|
|
163
|
+
url: url,
|
|
164
|
+
type: "DELETE",
|
|
165
|
+
responses: {
|
|
166
|
+
200: function(data) {
|
|
167
|
+
spinner.remove();
|
|
168
|
+
},
|
|
169
|
+
400: {
|
|
170
|
+
'unexpected_error': function(error) {
|
|
171
|
+
spinner.remove();
|
|
172
|
+
console.log(error);
|
|
173
|
+
// done(error,null);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
RED.deploy.setDeployInflight(true);
|
|
179
|
+
utils.sendRequest(options).always(function() {
|
|
180
|
+
setTimeout(function() {
|
|
181
|
+
RED.deploy.setDeployInflight(false);
|
|
182
|
+
},500);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
RED.popover.tooltip(revertButton,RED._("sidebar.project.versionControl.revertChanges"));
|
|
191
|
+
}
|
|
192
|
+
bg = $('<span class="button-group"></span>').appendTo(entryTools);
|
|
193
|
+
if (state !== 'unmerged') {
|
|
194
|
+
var stageButton = $('<button class="editor-button editor-button-small"><i class="fa fa-'+((state==='unstaged')?"plus":"minus")+'"></i></button>')
|
|
195
|
+
.appendTo(bg)
|
|
196
|
+
.click(function(evt) {
|
|
197
|
+
evt.preventDefault();
|
|
198
|
+
var activeProject = RED.projects.getActiveProject();
|
|
199
|
+
entry.spinner = utils.addSpinnerOverlay(row).addClass('projects-version-control-spinner-sidebar');
|
|
200
|
+
utils.sendRequest({
|
|
201
|
+
url: "projects/"+activeProject.name+"/stage/"+encodeURIComponent(entry.file),
|
|
202
|
+
type: (state==='unstaged')?"POST":"DELETE",
|
|
203
|
+
responses: {
|
|
204
|
+
0: function(error) {
|
|
205
|
+
console.log(error);
|
|
206
|
+
// done(error,null);
|
|
207
|
+
},
|
|
208
|
+
200: function(data) {
|
|
209
|
+
refreshFiles(data);
|
|
210
|
+
},
|
|
211
|
+
400: {
|
|
212
|
+
'unexpected_error': function(error) {
|
|
213
|
+
console.log(error);
|
|
214
|
+
// done(error,null);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
},{});
|
|
219
|
+
});
|
|
220
|
+
RED.popover.tooltip(stageButton,RED._("sidebar.project.versionControl."+((state==='unstaged')?"stage":"unstage")+"Change"));
|
|
221
|
+
}
|
|
222
|
+
entry["update"+((state==='unstaged')?"Unstaged":"Staged")] = function(entry,status) {
|
|
223
|
+
container.removeClass();
|
|
224
|
+
var iconClass = "";
|
|
225
|
+
if (status === 'A') {
|
|
226
|
+
container.addClass("node-diff-added");
|
|
227
|
+
iconClass = "fa-plus-square";
|
|
228
|
+
} else if (status === '?') {
|
|
229
|
+
container.addClass("node-diff-unchanged");
|
|
230
|
+
iconClass = "fa-question-circle-o";
|
|
231
|
+
} else if (status === 'D') {
|
|
232
|
+
container.addClass("node-diff-deleted");
|
|
233
|
+
iconClass = "fa-minus-square";
|
|
234
|
+
} else if (status === 'M') {
|
|
235
|
+
container.addClass("node-diff-changed");
|
|
236
|
+
iconClass = "fa-square";
|
|
237
|
+
} else if (status === 'R') {
|
|
238
|
+
container.addClass("node-diff-changed");
|
|
239
|
+
iconClass = "fa-toggle-right";
|
|
240
|
+
} else if (status === 'U') {
|
|
241
|
+
container.addClass("node-diff-conflicted");
|
|
242
|
+
iconClass = "fa-exclamation-triangle";
|
|
243
|
+
} else {
|
|
244
|
+
iconClass = "fa-exclamation-triangle"
|
|
245
|
+
}
|
|
246
|
+
label.empty();
|
|
247
|
+
$('<span>').text(entry.file.replace(/\\(.)/g,"$1")).appendTo(label);
|
|
248
|
+
|
|
249
|
+
if (entry.oldName) {
|
|
250
|
+
$('<i class="fa fa-long-arrow-right"></i>').prependTo(label);
|
|
251
|
+
$('<span>').text(entry.oldName.replace(/\\(.)/g,"$1")).prependTo(label);
|
|
252
|
+
// label.text(entry.oldName+" -> "+entry.file);
|
|
253
|
+
}
|
|
254
|
+
// console.log(entry.file,status,iconClass);
|
|
255
|
+
|
|
256
|
+
icon.removeClass();
|
|
257
|
+
icon.addClass("fa "+iconClass);
|
|
258
|
+
if (entry.spinner) {
|
|
259
|
+
entry.spinner.remove();
|
|
260
|
+
delete entry.spinner;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (revertButton) {
|
|
264
|
+
revertButton.toggle(status !== '?');
|
|
265
|
+
}
|
|
266
|
+
entryLink.toggleClass("disabled",(status === 'D' || status === '?'));
|
|
267
|
+
}
|
|
268
|
+
entry["update"+((state==='unstaged')?"Unstaged":"Staged")](entry, status);
|
|
269
|
+
}
|
|
270
|
+
var utils;
|
|
271
|
+
var emptyStagedItem;
|
|
272
|
+
var emptyMergedItem;
|
|
273
|
+
function init(_utils) {
|
|
274
|
+
utils = _utils;
|
|
275
|
+
|
|
276
|
+
RED.actions.add("core:show-version-control-tab",show);
|
|
277
|
+
RED.events.on("deploy", function() {
|
|
278
|
+
var activeProject = RED.projects.getActiveProject();
|
|
279
|
+
if (activeProject) {
|
|
280
|
+
// TODO: this is a full refresh of the files - should be able to
|
|
281
|
+
// just do an incremental refresh
|
|
282
|
+
allChanges = {};
|
|
283
|
+
unstagedChangesList.editableList('empty');
|
|
284
|
+
stagedChangesList.editableList('empty');
|
|
285
|
+
unmergedChangesList.editableList('empty');
|
|
286
|
+
|
|
287
|
+
$.getJSON("projects/"+activeProject.name+"/status",function(result) {
|
|
288
|
+
refreshFiles(result);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
RED.events.on("login",function() {
|
|
293
|
+
refresh(true);
|
|
294
|
+
});
|
|
295
|
+
sidebarContent = $('<div>', {class:"sidebar-version-control"});
|
|
296
|
+
var stackContainer = $("<div>",{class:"sidebar-version-control-stack"}).appendTo(sidebarContent);
|
|
297
|
+
sections = RED.stack.create({
|
|
298
|
+
container: stackContainer,
|
|
299
|
+
fill: true,
|
|
300
|
+
singleExpanded: true
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
localChanges = sections.add({
|
|
304
|
+
title: RED._("sidebar.project.versionControl.localChanges"),
|
|
305
|
+
collapsible: true
|
|
306
|
+
});
|
|
307
|
+
localChanges.expand();
|
|
308
|
+
localChanges.content.css({height:"100%"});
|
|
309
|
+
|
|
310
|
+
var bg = $('<div style="float: right"></div>').appendTo(localChanges.header);
|
|
311
|
+
var refreshButton = $('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
|
312
|
+
.appendTo(bg)
|
|
313
|
+
.click(function(evt) {
|
|
314
|
+
evt.preventDefault();
|
|
315
|
+
evt.stopPropagation();
|
|
316
|
+
refresh(true);
|
|
317
|
+
});
|
|
318
|
+
RED.popover.tooltip(refreshButton,RED._("sidebar.project.versionControl.refreshChanges"));
|
|
319
|
+
|
|
320
|
+
emptyStagedItem = { label: RED._("sidebar.project.versionControl.none") };
|
|
321
|
+
emptyMergedItem = { label: RED._("sidebar.project.versionControl.conflictResolve") };
|
|
322
|
+
|
|
323
|
+
var unstagedContent = $('<div class="sidebar-version-control-change-container"></div>').appendTo(localChanges.content);
|
|
324
|
+
var header = $('<div class="sidebar-version-control-change-header">'+RED._("sidebar.project.versionControl.localFiles")+'</div>').appendTo(unstagedContent);
|
|
325
|
+
stageAllButton = $('<button class="editor-button editor-button-small" style="float: right"><i class="fa fa-plus"></i> '+RED._("sidebar.project.versionControl.all")+'</button>')
|
|
326
|
+
.appendTo(header)
|
|
327
|
+
.click(function(evt) {
|
|
328
|
+
evt.preventDefault();
|
|
329
|
+
evt.stopPropagation();
|
|
330
|
+
var toStage = Object.keys(allChanges).filter(function(fn) {
|
|
331
|
+
return allChanges[fn].treeStatus !== ' ';
|
|
332
|
+
});
|
|
333
|
+
updateBulk(toStage,true);
|
|
334
|
+
});
|
|
335
|
+
RED.popover.tooltip(stageAllButton,RED._("sidebar.project.versionControl.stageAllChange"));
|
|
336
|
+
unstagedChangesList = $("<ol>",{style:"position: absolute; top: 30px; bottom: 0; right:0; left:0;"}).appendTo(unstagedContent);
|
|
337
|
+
unstagedChangesList.editableList({
|
|
338
|
+
addButton: false,
|
|
339
|
+
scrollOnAdd: false,
|
|
340
|
+
addItem: function(row,index,entry) {
|
|
341
|
+
createChangeEntry(row,entry,entry.treeStatus,'unstaged');
|
|
342
|
+
},
|
|
343
|
+
sort: function(A,B) {
|
|
344
|
+
if (A.treeStatus === '?' && B.treeStatus !== '?') {
|
|
345
|
+
return 1;
|
|
346
|
+
} else if (A.treeStatus !== '?' && B.treeStatus === '?') {
|
|
347
|
+
return -1;
|
|
348
|
+
}
|
|
349
|
+
return A.file.localeCompare(B.file);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
unmergedContent = $('<div class="sidebar-version-control-change-container"></div>').appendTo(localChanges.content);
|
|
355
|
+
|
|
356
|
+
header = $('<div class="sidebar-version-control-change-header">'+RED._("sidebar.project.versionControl.unmergedChanges")+'</div>').appendTo(unmergedContent);
|
|
357
|
+
bg = $('<div style="float: right"></div>').appendTo(header);
|
|
358
|
+
var abortMergeButton = $('<button class="editor-button editor-button-small" style="margin-right: 5px;">'+RED._("sidebar.project.versionControl.abortMerge")+'</button>')
|
|
359
|
+
.appendTo(bg)
|
|
360
|
+
.click(function(evt) {
|
|
361
|
+
evt.preventDefault();
|
|
362
|
+
evt.stopPropagation();
|
|
363
|
+
var spinner = utils.addSpinnerOverlay(unmergedContent);
|
|
364
|
+
var activeProject = RED.projects.getActiveProject();
|
|
365
|
+
RED.deploy.setDeployInflight(true);
|
|
366
|
+
utils.sendRequest({
|
|
367
|
+
url: "projects/"+activeProject.name+"/merge",
|
|
368
|
+
type: "DELETE",
|
|
369
|
+
responses: {
|
|
370
|
+
0: function(error) {
|
|
371
|
+
console.log(error);
|
|
372
|
+
},
|
|
373
|
+
200: function(data) {
|
|
374
|
+
spinner.remove();
|
|
375
|
+
refresh(true);
|
|
376
|
+
},
|
|
377
|
+
400: {
|
|
378
|
+
'unexpected_error': function(error) {
|
|
379
|
+
console.log(error);
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
}
|
|
383
|
+
}).always(function() {
|
|
384
|
+
setTimeout(function() {
|
|
385
|
+
RED.deploy.setDeployInflight(false);
|
|
386
|
+
},500);
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
unmergedChangesList = $("<ol>",{style:"position: absolute; top: 30px; bottom: 0; right:0; left:0;"}).appendTo(unmergedContent);
|
|
390
|
+
unmergedChangesList.editableList({
|
|
391
|
+
addButton: false,
|
|
392
|
+
scrollOnAdd: false,
|
|
393
|
+
addItem: function(row,index,entry) {
|
|
394
|
+
if (entry === emptyMergedItem) {
|
|
395
|
+
entry.button = {
|
|
396
|
+
label: RED._("sidebar.project.versionControl.commit"),
|
|
397
|
+
click: function(evt) {
|
|
398
|
+
evt.preventDefault();
|
|
399
|
+
evt.stopPropagation();
|
|
400
|
+
showCommitBox();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
createChangeEntry(row,entry,entry.treeStatus,'unmerged');
|
|
405
|
+
},
|
|
406
|
+
sort: function(A,B) {
|
|
407
|
+
if (A.treeStatus === '?' && B.treeStatus !== '?') {
|
|
408
|
+
return 1;
|
|
409
|
+
} else if (A.treeStatus !== '?' && B.treeStatus === '?') {
|
|
410
|
+
return -1;
|
|
411
|
+
}
|
|
412
|
+
return A.file.localeCompare(B.file);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
var stagedContent = $('<div class="sidebar-version-control-change-container"></div>').appendTo(localChanges.content);
|
|
419
|
+
|
|
420
|
+
header = $('<div class="sidebar-version-control-change-header">'+RED._("sidebar.project.versionControl.changeToCommit")+'</div>').appendTo(stagedContent);
|
|
421
|
+
|
|
422
|
+
bg = $('<div style="float: right"></div>').appendTo(header);
|
|
423
|
+
var showCommitBox = function() {
|
|
424
|
+
commitMessage.val("");
|
|
425
|
+
submitCommitButton.prop("disabled",true);
|
|
426
|
+
unstagedContent.css("height","30px");
|
|
427
|
+
if (unmergedContent.is(":visible")) {
|
|
428
|
+
unmergedContent.css("height","30px");
|
|
429
|
+
stagedContent.css("height","calc(100% - 60px - 175px)");
|
|
430
|
+
} else {
|
|
431
|
+
stagedContent.css("height","calc(100% - 30px - 175px)");
|
|
432
|
+
}
|
|
433
|
+
commitBox.show();
|
|
434
|
+
setTimeout(function() {
|
|
435
|
+
commitBox.css("height","175px");
|
|
436
|
+
},10);
|
|
437
|
+
stageAllButton.prop("disabled",true);
|
|
438
|
+
unstageAllButton.prop("disabled",true);
|
|
439
|
+
commitButton.prop("disabled",true);
|
|
440
|
+
abortMergeButton.prop("disabled",true);
|
|
441
|
+
commitMessage.focus();
|
|
442
|
+
}
|
|
443
|
+
commitButton = $('<button class="editor-button editor-button-small" style="margin-right: 5px;">'+RED._("sidebar.project.versionControl.commit")+'</button>')
|
|
444
|
+
.appendTo(bg)
|
|
445
|
+
.click(function(evt) {
|
|
446
|
+
evt.preventDefault();
|
|
447
|
+
evt.stopPropagation();
|
|
448
|
+
showCommitBox();
|
|
449
|
+
});
|
|
450
|
+
RED.popover.tooltip(commitButton,RED._("sidebar.project.versionControl.commitChanges"));
|
|
451
|
+
unstageAllButton = $('<button class="editor-button editor-button-small"><i class="fa fa-minus"></i> '+RED._("sidebar.project.versionControl.all")+'</button>')
|
|
452
|
+
.appendTo(bg)
|
|
453
|
+
.click(function(evt) {
|
|
454
|
+
evt.preventDefault();
|
|
455
|
+
evt.stopPropagation();
|
|
456
|
+
var toUnstage = Object.keys(allChanges).filter(function(fn) {
|
|
457
|
+
return allChanges[fn].indexStatus !== ' ' && allChanges[fn].indexStatus !== '?';
|
|
458
|
+
});
|
|
459
|
+
updateBulk(toUnstage,false);
|
|
460
|
+
|
|
461
|
+
});
|
|
462
|
+
RED.popover.tooltip(unstageAllButton,RED._("sidebar.project.versionControl.unstageAllChange"));
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
stagedChangesList = $("<ol>",{style:"position: absolute; top: 30px; bottom: 0; right:0; left:0;"}).appendTo(stagedContent);
|
|
466
|
+
stagedChangesList.editableList({
|
|
467
|
+
addButton: false,
|
|
468
|
+
scrollOnAdd: false,
|
|
469
|
+
addItem: function(row,index,entry) {
|
|
470
|
+
createChangeEntry(row,entry,entry.indexStatus,'staged');
|
|
471
|
+
},
|
|
472
|
+
sort: function(A,B) {
|
|
473
|
+
return A.file.localeCompare(B.file);
|
|
474
|
+
}
|
|
475
|
+
})
|
|
476
|
+
|
|
477
|
+
commitBox = $('<div class="sidebar-version-control-slide-box sidebar-version-control-slide-box-bottom"></div>').hide().appendTo(localChanges.content);
|
|
478
|
+
|
|
479
|
+
var commitMessage = $('<textarea placeholder='+RED._("sidebar.project.versionControl.commitPlaceholder")+'></textarea>')
|
|
480
|
+
.appendTo(commitBox)
|
|
481
|
+
.on("change keyup paste",function() {
|
|
482
|
+
submitCommitButton.prop('disabled',$(this).val().trim()==="");
|
|
483
|
+
});
|
|
484
|
+
var commitToolbar = $('<div class="sidebar-version-control-slide-box-toolbar button-group">').appendTo(commitBox);
|
|
485
|
+
|
|
486
|
+
var cancelCommitButton = $('<button class="editor-button">'+RED._("sidebar.project.versionControl.cancelCapital")+'</button>')
|
|
487
|
+
.appendTo(commitToolbar)
|
|
488
|
+
.click(function(evt) {
|
|
489
|
+
evt.preventDefault();
|
|
490
|
+
commitMessage.val("");
|
|
491
|
+
unstagedContent.css("height","");
|
|
492
|
+
unmergedContent.css("height","");
|
|
493
|
+
stagedContent.css("height","");
|
|
494
|
+
commitBox.css("height",0);
|
|
495
|
+
setTimeout(function() {
|
|
496
|
+
commitBox.hide();
|
|
497
|
+
},200);
|
|
498
|
+
stageAllButton.prop("disabled",false);
|
|
499
|
+
unstageAllButton.prop("disabled",false);
|
|
500
|
+
commitButton.prop("disabled",false);
|
|
501
|
+
abortMergeButton.prop("disabled",false);
|
|
502
|
+
|
|
503
|
+
})
|
|
504
|
+
var submitCommitButton = $('<button class="editor-button">'+RED._("sidebar.project.versionControl.commitCapital")+'</button>')
|
|
505
|
+
.appendTo(commitToolbar)
|
|
506
|
+
.click(function(evt) {
|
|
507
|
+
evt.preventDefault();
|
|
508
|
+
var spinner = utils.addSpinnerOverlay(submitCommitButton).addClass('projects-dialog-spinner-sidebar');
|
|
509
|
+
var activeProject = RED.projects.getActiveProject();
|
|
510
|
+
RED.deploy.setDeployInflight(true);
|
|
511
|
+
utils.sendRequest({
|
|
512
|
+
url: "projects/"+activeProject.name+"/commit",
|
|
513
|
+
type: "POST",
|
|
514
|
+
responses: {
|
|
515
|
+
0: function(error) {
|
|
516
|
+
console.log(error);
|
|
517
|
+
},
|
|
518
|
+
200: function(data) {
|
|
519
|
+
spinner.remove();
|
|
520
|
+
cancelCommitButton.click();
|
|
521
|
+
refresh(true);
|
|
522
|
+
},
|
|
523
|
+
400: {
|
|
524
|
+
'*': function(error) {
|
|
525
|
+
utils.reportUnexpectedError(error);
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
}
|
|
529
|
+
},{
|
|
530
|
+
message:commitMessage.val()
|
|
531
|
+
}).always(function() {
|
|
532
|
+
setTimeout(function() {
|
|
533
|
+
RED.deploy.setDeployInflight(false);
|
|
534
|
+
},500);
|
|
535
|
+
})
|
|
536
|
+
})
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
var localHistory = sections.add({
|
|
540
|
+
title: RED._("sidebar.project.versionControl.commitHistory"),
|
|
541
|
+
collapsible: true
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
bg = $('<div style="float: right"></div>').appendTo(localHistory.header);
|
|
545
|
+
refreshButton = $('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
|
546
|
+
.appendTo(bg)
|
|
547
|
+
.click(function(evt) {
|
|
548
|
+
evt.preventDefault();
|
|
549
|
+
evt.stopPropagation();
|
|
550
|
+
refresh(true,true);
|
|
551
|
+
})
|
|
552
|
+
RED.popover.tooltip(refreshButton,RED._("sidebar.project.versionControl.refreshCommitHistory"))
|
|
553
|
+
|
|
554
|
+
var localBranchToolbar = $('<div class="sidebar-version-control-change-header" style="text-align: right;"></div>').appendTo(localHistory.content);
|
|
555
|
+
|
|
556
|
+
var localBranchButton = $('<button class="editor-button editor-button-small"><i class="fa fa-code-fork"></i> '+RED._("sidebar.project.versionControl.branch")+' <span id="sidebar-version-control-local-branch"></span></button>')
|
|
557
|
+
.appendTo(localBranchToolbar)
|
|
558
|
+
.click(function(evt) {
|
|
559
|
+
evt.preventDefault();
|
|
560
|
+
if ($(this).hasClass('selected')) {
|
|
561
|
+
closeBranchBox();
|
|
562
|
+
} else {
|
|
563
|
+
closeRemoteBox();
|
|
564
|
+
localCommitListShade.show();
|
|
565
|
+
$(this).addClass('selected');
|
|
566
|
+
var activeProject = RED.projects.getActiveProject();
|
|
567
|
+
localBranchList.refresh("projects/"+activeProject.name+"/branches");
|
|
568
|
+
localBranchBox.show();
|
|
569
|
+
setTimeout(function() {
|
|
570
|
+
localBranchBox.css("height","215px");
|
|
571
|
+
localBranchList.focus();
|
|
572
|
+
},100);
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
RED.popover.tooltip(localBranchButton,RED._("sidebar.project.versionControl.changeLocalBranch"))
|
|
576
|
+
var repoStatusButton = $('<button class="editor-button editor-button-small" style="margin-left: 10px;" id="sidebar-version-control-repo-status-button">'+
|
|
577
|
+
'<span id="sidebar-version-control-repo-status-stats">'+
|
|
578
|
+
'<i class="fa fa-long-arrow-up"></i> <span id="sidebar-version-control-commits-ahead"></span> '+
|
|
579
|
+
'<i class="fa fa-long-arrow-down"></i> <span id="sidebar-version-control-commits-behind"></span>'+
|
|
580
|
+
'</span>'+
|
|
581
|
+
'<span id="sidebar-version-control-repo-status-auth-issue">'+
|
|
582
|
+
'<i class="fa fa-warning"></i>'+
|
|
583
|
+
'</span>'+
|
|
584
|
+
'</button>')
|
|
585
|
+
.appendTo(localBranchToolbar)
|
|
586
|
+
.click(function(evt) {
|
|
587
|
+
evt.preventDefault();
|
|
588
|
+
if ($(this).hasClass('selected')) {
|
|
589
|
+
closeRemoteBox();
|
|
590
|
+
} else {
|
|
591
|
+
closeBranchBox();
|
|
592
|
+
localCommitListShade.show();
|
|
593
|
+
$(this).addClass('selected');
|
|
594
|
+
var activeProject = RED.projects.getActiveProject();
|
|
595
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream-row").toggle(!!activeProject.git.branches.remoteAlt);
|
|
596
|
+
remoteBox.show();
|
|
597
|
+
|
|
598
|
+
setTimeout(function() {
|
|
599
|
+
remoteBox.css("height","265px");
|
|
600
|
+
},100);
|
|
601
|
+
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
RED.popover.tooltip(repoStatusButton,RED._("sidebar.project.versionControl.manageRemoteBranch"))
|
|
605
|
+
|
|
606
|
+
localCommitList = $("<ol>",{style:"position: absolute; top: 30px; bottom: 0px; right:0; left:0;"}).appendTo(localHistory.content);
|
|
607
|
+
localCommitListShade = $('<div class="component-shade" style="z-Index: 3"></div>').css('top',"30px").hide().appendTo(localHistory.content);
|
|
608
|
+
localCommitList.editableList({
|
|
609
|
+
addButton: false,
|
|
610
|
+
scrollOnAdd: false,
|
|
611
|
+
addItem: function(row,index,entry) {
|
|
612
|
+
row.addClass('sidebar-version-control-commit-entry');
|
|
613
|
+
if (entry.url) {
|
|
614
|
+
row.addClass('sidebar-version-control-commit-more');
|
|
615
|
+
row.text("+ "+(entry.total-entry.totalKnown)+RED._("sidebar.project.versionControl.moreCommits"));
|
|
616
|
+
row.click(function(e) {
|
|
617
|
+
e.preventDefault();
|
|
618
|
+
getCommits(entry.url,localCommitList,row,entry.limit,entry.before);
|
|
619
|
+
})
|
|
620
|
+
} else {
|
|
621
|
+
row.click(function(e) {
|
|
622
|
+
var activeProject = RED.projects.getActiveProject();
|
|
623
|
+
if (activeProject) {
|
|
624
|
+
$.getJSON("projects/"+activeProject.name+"/commits/"+entry.sha,function(result) {
|
|
625
|
+
result.project = activeProject;
|
|
626
|
+
result.parents = entry.parents;
|
|
627
|
+
result.oldRev = entry.sha+"~1";
|
|
628
|
+
result.newRev = entry.sha;
|
|
629
|
+
result.oldRevTitle = RED._("sidebar.project.versionControl.commitCapital")+" "+entry.sha.substring(0,7)+"~1";
|
|
630
|
+
result.newRevTitle = RED._("sidebar.project.versionControl.commitCapital")+" "+entry.sha.substring(0,7);
|
|
631
|
+
result.date = humanizeSinceDate(parseInt(entry.date));
|
|
632
|
+
RED.diff.showCommitDiff(result);
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
var container = $('<div>').appendTo(row);
|
|
637
|
+
$('<div class="sidebar-version-control-commit-subject">').text(entry.subject).appendTo(container);
|
|
638
|
+
if (entry.refs) {
|
|
639
|
+
var refDiv = $('<div class="sidebar-version-control-commit-refs">').appendTo(container);
|
|
640
|
+
entry.refs.forEach(function(ref) {
|
|
641
|
+
var label = ref;
|
|
642
|
+
if (/HEAD -> /.test(ref)) {
|
|
643
|
+
label = ref.substring(8);
|
|
644
|
+
}
|
|
645
|
+
$('<span class="sidebar-version-control-commit-ref">').text(label).appendTo(refDiv);
|
|
646
|
+
});
|
|
647
|
+
row.addClass('sidebar-version-control-commit-head');
|
|
648
|
+
}
|
|
649
|
+
$('<div class="sidebar-version-control-commit-sha">').text(entry.sha.substring(0,7)).appendTo(container);
|
|
650
|
+
// $('<div class="sidebar-version-control-commit-user">').text(entry.author).appendTo(container);
|
|
651
|
+
$('<div class="sidebar-version-control-commit-date">').text(humanizeSinceDate(parseInt(entry.date))).appendTo(container);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
var closeBranchBox = function(done) {
|
|
658
|
+
localBranchButton.removeClass('selected')
|
|
659
|
+
localBranchBox.css("height","0");
|
|
660
|
+
localCommitListShade.hide();
|
|
661
|
+
|
|
662
|
+
setTimeout(function() {
|
|
663
|
+
localBranchBox.hide();
|
|
664
|
+
if (done) { done() }
|
|
665
|
+
},200);
|
|
666
|
+
}
|
|
667
|
+
var localBranchBox = $('<div class="sidebar-version-control-slide-box sidebar-version-control-slide-box-top" style="top:30px;"></div>').hide().appendTo(localHistory.content);
|
|
668
|
+
|
|
669
|
+
$('<div class="sidebar-version-control-slide-box-header"></div>').text(RED._("sidebar.project.versionControl.changeLocalBranch")).appendTo(localBranchBox);
|
|
670
|
+
|
|
671
|
+
var localBranchList = utils.createBranchList({
|
|
672
|
+
placeholder: RED._("sidebar.project.versionControl.createBranchPlaceholder"),
|
|
673
|
+
container: localBranchBox,
|
|
674
|
+
onselect: function(body) {
|
|
675
|
+
if (body.current) {
|
|
676
|
+
return closeBranchBox();
|
|
677
|
+
}
|
|
678
|
+
var spinner = utils.addSpinnerOverlay(localBranchBox);
|
|
679
|
+
var activeProject = RED.projects.getActiveProject();
|
|
680
|
+
RED.deploy.setDeployInflight(true);
|
|
681
|
+
utils.sendRequest({
|
|
682
|
+
url: "projects/"+activeProject.name+"/branches",
|
|
683
|
+
type: "POST",
|
|
684
|
+
requireCleanWorkspace: true,
|
|
685
|
+
cancel: function() {
|
|
686
|
+
spinner.remove();
|
|
687
|
+
},
|
|
688
|
+
responses: {
|
|
689
|
+
0: function(error) {
|
|
690
|
+
spinner.remove();
|
|
691
|
+
console.log(error);
|
|
692
|
+
// done(error,null);
|
|
693
|
+
},
|
|
694
|
+
200: function(data) {
|
|
695
|
+
// Changing branch will trigger a runtime event
|
|
696
|
+
// that leads to a project refresh.
|
|
697
|
+
closeBranchBox(function() {
|
|
698
|
+
spinner.remove();
|
|
699
|
+
});
|
|
700
|
+
},
|
|
701
|
+
400: {
|
|
702
|
+
'git_local_overwrite': function(error) {
|
|
703
|
+
spinner.remove();
|
|
704
|
+
RED.notify(RED._("sidebar.project.versionControl.localOverwrite"),{
|
|
705
|
+
type:'error',
|
|
706
|
+
timeout: 8000
|
|
707
|
+
});
|
|
708
|
+
},
|
|
709
|
+
'unexpected_error': function(error) {
|
|
710
|
+
spinner.remove();
|
|
711
|
+
console.log(error);
|
|
712
|
+
// done(error,null);
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
}
|
|
716
|
+
},body).always(function(){
|
|
717
|
+
setTimeout(function() {
|
|
718
|
+
RED.deploy.setDeployInflight(false);
|
|
719
|
+
},500);
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
var remoteBox = $('<div class="sidebar-version-control-slide-box sidebar-version-control-slide-box-top" style="top:30px"></div>').hide().appendTo(localHistory.content);
|
|
725
|
+
var closeRemoteBox = function() {
|
|
726
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream").prop('checked',false);
|
|
727
|
+
repoStatusButton.removeClass('selected')
|
|
728
|
+
remoteBox.css("height","0");
|
|
729
|
+
localCommitListShade.hide();
|
|
730
|
+
setTimeout(function() {
|
|
731
|
+
remoteBox.hide();
|
|
732
|
+
closeRemoteBranchBox();
|
|
733
|
+
},200);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
var closeRemoteBranchBox = function(done) {
|
|
737
|
+
if (remoteBranchButton.hasClass('selected')) {
|
|
738
|
+
remoteBranchButton.removeClass('selected');
|
|
739
|
+
remoteBranchSubRow.height(0);
|
|
740
|
+
remoteBox.css("height","265px");
|
|
741
|
+
setTimeout(function() {
|
|
742
|
+
remoteBranchSubRow.hide();
|
|
743
|
+
if (done) { done(); }
|
|
744
|
+
},200);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
$('<div class="sidebar-version-control-slide-box-header"></div>').text(RED._("sidebar.project.versionControl.manageRemoteBranch")).appendTo(remoteBox);
|
|
748
|
+
|
|
749
|
+
var remoteBranchRow = $('<div style="margin-bottom: 5px;"></div>').appendTo(remoteBox);
|
|
750
|
+
var remoteBranchButton = $('<button id="sidebar-version-control-repo-branch" class="sidebar-version-control-repo-action editor-button"><i class="fa fa-code-fork"></i> '+RED._("sidebar.project.versionControl.remote")+': <span id="sidebar-version-control-remote-branch"></span></button>')
|
|
751
|
+
.appendTo(remoteBranchRow)
|
|
752
|
+
.click(function(evt) {
|
|
753
|
+
evt.preventDefault();
|
|
754
|
+
if ($(this).hasClass('selected')) {
|
|
755
|
+
closeRemoteBranchBox();
|
|
756
|
+
} else {
|
|
757
|
+
$(this).addClass('selected');
|
|
758
|
+
var activeProject = RED.projects.getActiveProject();
|
|
759
|
+
remoteBranchList.refresh("projects/"+activeProject.name+"/branches/remote");
|
|
760
|
+
remoteBranchSubRow.show();
|
|
761
|
+
setTimeout(function() {
|
|
762
|
+
remoteBranchSubRow.height(180);
|
|
763
|
+
remoteBox.css("height","445px");
|
|
764
|
+
remoteBranchList.focus();
|
|
765
|
+
},100);
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
$('<div id="sidebar-version-control-repo-toolbar-message" class="sidebar-version-control-slide-box-header" style="min-height: 100px;"></div>').appendTo(remoteBox);
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
var errorMessage = $('<div id="sidebar-version-control-repo-toolbar-error-message" class="sidebar-version-control-slide-box-header" style="min-height: 100px;"></div>').hide().appendTo(remoteBox);
|
|
773
|
+
$('<div style="margin-top: 10px;"><i class="fa fa-warning"></i> '+RED._("sidebar.project.versionControl.unableToAccess")+'</div>').appendTo(errorMessage)
|
|
774
|
+
var buttonRow = $('<div style="margin: 10px 30px; text-align: center"></div>').appendTo(errorMessage);
|
|
775
|
+
$('<button class="editor-button" style="width: 80%;"><i class="fa fa-refresh"></i> '+RED._("sidebar.project.versionControl.retry")+'</button>')
|
|
776
|
+
.appendTo(buttonRow)
|
|
777
|
+
.click(function(e) {
|
|
778
|
+
e.preventDefault();
|
|
779
|
+
var activeProject = RED.projects.getActiveProject();
|
|
780
|
+
var spinner = utils.addSpinnerOverlay(remoteBox).addClass("projects-dialog-spinner-contain");
|
|
781
|
+
utils.sendRequest({
|
|
782
|
+
url: "projects/"+activeProject.name+"/branches/remote",
|
|
783
|
+
type: "GET",
|
|
784
|
+
responses: {
|
|
785
|
+
0: function(error) {
|
|
786
|
+
console.log(error);
|
|
787
|
+
// done(error,null);
|
|
788
|
+
},
|
|
789
|
+
200: function(data) {
|
|
790
|
+
refresh(true);
|
|
791
|
+
},
|
|
792
|
+
400: {
|
|
793
|
+
'git_connection_failed': function(error) {
|
|
794
|
+
RED.notify(error.message,'error');
|
|
795
|
+
},
|
|
796
|
+
'git_not_a_repository': function(error) {
|
|
797
|
+
RED.notify(error.message,'error');
|
|
798
|
+
},
|
|
799
|
+
'git_repository_not_found': function(error) {
|
|
800
|
+
RED.notify(error.message,'error');
|
|
801
|
+
},
|
|
802
|
+
'unexpected_error': function(error) {
|
|
803
|
+
console.log(error);
|
|
804
|
+
// done(error,null);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}).always(function() {
|
|
809
|
+
spinner.remove();
|
|
810
|
+
});
|
|
811
|
+
})
|
|
812
|
+
|
|
813
|
+
$('<div class="sidebar-version-control-slide-box-header" style="height: 20px;"><label id="sidebar-version-control-repo-toolbar-set-upstream-row" for="sidebar-version-control-repo-toolbar-set-upstream" class="hide"><input type="checkbox" id="sidebar-version-control-repo-toolbar-set-upstream"> '+RED._("sidebar.project.versionControl.setUpstreamBranch")+'</label></div>').appendTo(remoteBox);
|
|
814
|
+
|
|
815
|
+
var remoteBranchSubRow = $('<div style="height: 0;overflow:hidden; transition: height 0.2s ease-in-out;"></div>').hide().appendTo(remoteBranchRow);
|
|
816
|
+
var remoteBranchList = utils.createBranchList({
|
|
817
|
+
placeholder: RED._("sidebar.project.versionControl.createRemoteBranchPlaceholder"),
|
|
818
|
+
currentLabel: RED._("sidebar.project.versionControl.upstream"),
|
|
819
|
+
remote: function() {
|
|
820
|
+
var project = RED.projects.getActiveProject();
|
|
821
|
+
var remotes = Object.keys(project.git.remotes);
|
|
822
|
+
return remotes[0];
|
|
823
|
+
},
|
|
824
|
+
container: remoteBranchSubRow,
|
|
825
|
+
onselect: function(body) {
|
|
826
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream").prop('checked',false);
|
|
827
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream").prop('disabled',false);
|
|
828
|
+
$("#sidebar-version-control-remote-branch").text(body.name+(body.create?" *":""));
|
|
829
|
+
var activeProject = RED.projects.getActiveProject();
|
|
830
|
+
if (activeProject.git.branches.remote === body.name) {
|
|
831
|
+
delete activeProject.git.branches.remoteAlt;
|
|
832
|
+
} else {
|
|
833
|
+
activeProject.git.branches.remoteAlt = body.name;
|
|
834
|
+
}
|
|
835
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream-row").toggle(!!activeProject.git.branches.remoteAlt);
|
|
836
|
+
closeRemoteBranchBox(function() {
|
|
837
|
+
if (!body.create) {
|
|
838
|
+
var start = Date.now();
|
|
839
|
+
var spinner = utils.addSpinnerOverlay($('#sidebar-version-control-repo-toolbar-message')).addClass("projects-dialog-spinner-contain");
|
|
840
|
+
$.getJSON("projects/"+activeProject.name+"/branches/remote/"+body.name+"/status", function(result) {
|
|
841
|
+
setTimeout(function() {
|
|
842
|
+
updateRemoteStatus(result.commits.ahead, result.commits.behind);
|
|
843
|
+
spinner.remove();
|
|
844
|
+
},Math.max(400-(Date.now() - start),0));
|
|
845
|
+
})
|
|
846
|
+
} else {
|
|
847
|
+
if (!activeProject.git.branches.remote) {
|
|
848
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.trackedUpstreamBranch"));
|
|
849
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream").prop('checked',true);
|
|
850
|
+
$("#sidebar-version-control-repo-toolbar-set-upstream").prop('disabled',true);
|
|
851
|
+
} else {
|
|
852
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.selectUpstreamBranch"));
|
|
853
|
+
}
|
|
854
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
855
|
+
$("#sidebar-version-control-repo-push").prop('disabled',false);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
var row = $('<div style="margin-bottom: 5px;"></div>').appendTo(remoteBox);
|
|
863
|
+
|
|
864
|
+
$('<button id="sidebar-version-control-repo-push" class="sidebar-version-control-repo-sub-action editor-button"><i class="fa fa-long-arrow-up"></i> <span data-i18n="sidebar.project.versionControl.push"></span></button>')
|
|
865
|
+
.appendTo(row)
|
|
866
|
+
.click(function(e) {
|
|
867
|
+
e.preventDefault();
|
|
868
|
+
var spinner = utils.addSpinnerOverlay(remoteBox).addClass("projects-dialog-spinner-contain");
|
|
869
|
+
var buttonRow = $('<div style="position: relative; bottom: 60px;"></div>').appendTo(spinner);
|
|
870
|
+
$('<button class="editor-button"></button>').text(RED._("eventLog.view")).appendTo(buttonRow).click(function(evt) {
|
|
871
|
+
evt.preventDefault();
|
|
872
|
+
RED.actions.invoke("core:show-event-log");
|
|
873
|
+
});
|
|
874
|
+
var activeProject = RED.projects.getActiveProject();
|
|
875
|
+
RED.eventLog.startEvent("Push changes"+(activeProject.git.branches.remoteAlt?(" : "+activeProject.git.branches.remoteAlt):""));
|
|
876
|
+
var url = "projects/"+activeProject.name+"/push";
|
|
877
|
+
if (activeProject.git.branches.remoteAlt) {
|
|
878
|
+
url+="/"+activeProject.git.branches.remoteAlt;
|
|
879
|
+
}
|
|
880
|
+
var setUpstream = $("#sidebar-version-control-repo-toolbar-set-upstream").prop('checked');
|
|
881
|
+
if (setUpstream) {
|
|
882
|
+
url+="?u=true"
|
|
883
|
+
}
|
|
884
|
+
utils.sendRequest({
|
|
885
|
+
url: url,
|
|
886
|
+
type: "POST",
|
|
887
|
+
responses: {
|
|
888
|
+
0: function(error) {
|
|
889
|
+
console.log(error);
|
|
890
|
+
// done(error,null);
|
|
891
|
+
},
|
|
892
|
+
200: function(data) {
|
|
893
|
+
if (setUpstream && activeProject.git.branches.remoteAlt) {
|
|
894
|
+
activeProject.git.branches.remote = activeProject.git.branches.remoteAlt;
|
|
895
|
+
delete activeProject.git.branches.remoteAlt;
|
|
896
|
+
}
|
|
897
|
+
refresh(true);
|
|
898
|
+
closeRemoteBox();
|
|
899
|
+
},
|
|
900
|
+
400: {
|
|
901
|
+
'git_push_failed': function(err) {
|
|
902
|
+
// TODO: better message
|
|
903
|
+
RED.notify(RED._("sidebar.project.versionControl.pushFailed"),"error");
|
|
904
|
+
},
|
|
905
|
+
'unexpected_error': function(error) {
|
|
906
|
+
console.log(error);
|
|
907
|
+
// done(error,null);
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
}
|
|
911
|
+
},{}).always(function() {
|
|
912
|
+
spinner.remove();
|
|
913
|
+
});
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
var pullRemote = function(options) {
|
|
917
|
+
options = options || {};
|
|
918
|
+
var spinner = utils.addSpinnerOverlay(remoteBox).addClass("projects-dialog-spinner-contain");
|
|
919
|
+
var buttonRow = $('<div style="position: relative; bottom: 60px;"></div>').appendTo(spinner);
|
|
920
|
+
$('<button class="editor-button"></button>').text(RED._("eventLog.view")).appendTo(buttonRow).click(function(evt) {
|
|
921
|
+
evt.preventDefault();
|
|
922
|
+
RED.actions.invoke("core:show-event-log");
|
|
923
|
+
});
|
|
924
|
+
var activeProject = RED.projects.getActiveProject();
|
|
925
|
+
RED.eventLog.startEvent("Pull changes"+(activeProject.git.branches.remoteAlt?(" : "+activeProject.git.branches.remoteAlt):""));
|
|
926
|
+
var url = "projects/"+activeProject.name+"/pull";
|
|
927
|
+
if (activeProject.git.branches.remoteAlt) {
|
|
928
|
+
url+="/"+activeProject.git.branches.remoteAlt;
|
|
929
|
+
}
|
|
930
|
+
if (options.setUpstream || options.allowUnrelatedHistories) {
|
|
931
|
+
url+="?";
|
|
932
|
+
}
|
|
933
|
+
if (options.setUpstream) {
|
|
934
|
+
url += "setUpstream=true"
|
|
935
|
+
if (options.allowUnrelatedHistories) {
|
|
936
|
+
url += "&";
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (options.allowUnrelatedHistories) {
|
|
940
|
+
url += "allowUnrelatedHistories=true"
|
|
941
|
+
}
|
|
942
|
+
utils.sendRequest({
|
|
943
|
+
url: url,
|
|
944
|
+
type: "POST",
|
|
945
|
+
responses: {
|
|
946
|
+
0: function(error) {
|
|
947
|
+
console.log(error);
|
|
948
|
+
// done(error,null);
|
|
949
|
+
},
|
|
950
|
+
200: function(data) {
|
|
951
|
+
if (options.setUpstream && activeProject.git.branches.remoteAlt) {
|
|
952
|
+
activeProject.git.branches.remote = activeProject.git.branches.remoteAlt;
|
|
953
|
+
delete activeProject.git.branches.remoteAlt;
|
|
954
|
+
}
|
|
955
|
+
refresh(true);
|
|
956
|
+
closeRemoteBox();
|
|
957
|
+
},
|
|
958
|
+
400: {
|
|
959
|
+
'git_local_overwrite': function(err) {
|
|
960
|
+
RED.notify(RED._("sidebar.project.versionControl.unablePull")+
|
|
961
|
+
'<p><a href="#" onclick="RED.sidebar.versionControl.showLocalChanges(); return false;">'+RED._("sidebar.project.versionControl.showUnstagedChanges")+'</a></p>',"error",false,10000000);
|
|
962
|
+
},
|
|
963
|
+
'git_pull_merge_conflict': function(err) {
|
|
964
|
+
refresh(true);
|
|
965
|
+
closeRemoteBox();
|
|
966
|
+
},
|
|
967
|
+
'git_connection_failed': function(err) {
|
|
968
|
+
RED.notify(RED._("sidebar.project.versionControl.connectionFailed")+err.toString(),"warning")
|
|
969
|
+
},
|
|
970
|
+
'git_pull_unrelated_history': function(error) {
|
|
971
|
+
var notification = RED.notify(RED._("sidebar.project.versionControl.pullUnrelatedHistory"),{
|
|
972
|
+
type: 'error',
|
|
973
|
+
modal: true,
|
|
974
|
+
fixed: true,
|
|
975
|
+
buttons: [
|
|
976
|
+
{
|
|
977
|
+
text: RED._("common.label.cancel"),
|
|
978
|
+
click: function() {
|
|
979
|
+
notification.close();
|
|
980
|
+
}
|
|
981
|
+
},{
|
|
982
|
+
text: RED._("sidebar.project.versionControl.pullChanges"),
|
|
983
|
+
click: function() {
|
|
984
|
+
notification.close();
|
|
985
|
+
options.allowUnrelatedHistories = true;
|
|
986
|
+
pullRemote(options)
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
]
|
|
990
|
+
});
|
|
991
|
+
},
|
|
992
|
+
'*': function(error) {
|
|
993
|
+
utils.reportUnexpectedError(error);
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
}
|
|
997
|
+
},{}).always(function() {
|
|
998
|
+
spinner.remove();
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
$('<button id="sidebar-version-control-repo-pull" class="sidebar-version-control-repo-sub-action editor-button"><i class="fa fa-long-arrow-down"></i> <span data-i18n="sidebar.project.versionControl.pull"></span></button>')
|
|
1002
|
+
.appendTo(row)
|
|
1003
|
+
.click(function(e) {
|
|
1004
|
+
e.preventDefault();
|
|
1005
|
+
pullRemote({
|
|
1006
|
+
setUpstream: $("#sidebar-version-control-repo-toolbar-set-upstream").prop('checked')
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
$('<div class="component-shade sidebar-version-control-shade">').appendTo(sidebarContent);
|
|
1011
|
+
|
|
1012
|
+
RED.sidebar.addTab({
|
|
1013
|
+
id: "version-control",
|
|
1014
|
+
label: RED._("sidebar.project.versionControl.history"),
|
|
1015
|
+
name: RED._("sidebar.project.versionControl.projectHistory"),
|
|
1016
|
+
content: sidebarContent,
|
|
1017
|
+
enableOnEdit: false,
|
|
1018
|
+
pinned: true,
|
|
1019
|
+
iconClass: "fa fa-code-fork",
|
|
1020
|
+
action: "core:show-version-control-tab",
|
|
1021
|
+
onchange: function() {
|
|
1022
|
+
setTimeout(function() {
|
|
1023
|
+
sections.resize();
|
|
1024
|
+
},10);
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function humanizeSinceDate(date) {
|
|
1031
|
+
var delta = (Date.now()/1000) - date;
|
|
1032
|
+
|
|
1033
|
+
var daysDelta = Math.floor(delta / (60*60*24));
|
|
1034
|
+
if (daysDelta > 30) {
|
|
1035
|
+
return (new Date(date*1000)).toLocaleDateString();
|
|
1036
|
+
} else if (daysDelta > 0) {
|
|
1037
|
+
return RED._("sidebar.project.versionControl.daysAgo", {count:daysDelta})
|
|
1038
|
+
}
|
|
1039
|
+
var hoursDelta = Math.floor(delta / (60*60));
|
|
1040
|
+
if (hoursDelta > 0) {
|
|
1041
|
+
return RED._("sidebar.project.versionControl.hoursAgo", {count:hoursDelta})
|
|
1042
|
+
}
|
|
1043
|
+
var minutesDelta = Math.floor(delta / 60);
|
|
1044
|
+
if (minutesDelta > 0) {
|
|
1045
|
+
return RED._("sidebar.project.versionControl.minsAgo", {count:minutesDelta})
|
|
1046
|
+
}
|
|
1047
|
+
return RED._("sidebar.project.versionControl.secondsAgo");
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function updateBulk(files,unstaged) {
|
|
1051
|
+
var activeProject = RED.projects.getActiveProject();
|
|
1052
|
+
if (unstaged) {
|
|
1053
|
+
bulkChangeSpinner = utils.addSpinnerOverlay(unstagedChangesList.parent());
|
|
1054
|
+
} else {
|
|
1055
|
+
bulkChangeSpinner = utils.addSpinnerOverlay(stagedChangesList.parent());
|
|
1056
|
+
}
|
|
1057
|
+
bulkChangeSpinner.addClass('projects-dialog-spinner-sidebar');
|
|
1058
|
+
var body = unstaged?{files:files}:undefined;
|
|
1059
|
+
utils.sendRequest({
|
|
1060
|
+
url: "projects/"+activeProject.name+"/stage",
|
|
1061
|
+
type: unstaged?"POST":"DELETE",
|
|
1062
|
+
responses: {
|
|
1063
|
+
0: function(error) {
|
|
1064
|
+
console.log(error);
|
|
1065
|
+
// done(error,null);
|
|
1066
|
+
},
|
|
1067
|
+
200: function(data) {
|
|
1068
|
+
refreshFiles(data);
|
|
1069
|
+
},
|
|
1070
|
+
400: {
|
|
1071
|
+
'unexpected_error': function(error) {
|
|
1072
|
+
console.log(error);
|
|
1073
|
+
// done(error,null);
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
}
|
|
1077
|
+
},body);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
var refreshInProgress = false;
|
|
1081
|
+
|
|
1082
|
+
function getCommits(url,targetList,spinnerTarget,limit,before) {
|
|
1083
|
+
var spinner = utils.addSpinnerOverlay(spinnerTarget);
|
|
1084
|
+
var fullUrl = url+"?limit="+(limit||20);
|
|
1085
|
+
if (before) {
|
|
1086
|
+
fullUrl+="&before="+before;
|
|
1087
|
+
}
|
|
1088
|
+
utils.sendRequest({
|
|
1089
|
+
url: fullUrl,
|
|
1090
|
+
type: "GET",
|
|
1091
|
+
responses: {
|
|
1092
|
+
0: function(error) {
|
|
1093
|
+
console.log(error);
|
|
1094
|
+
// done(error,null);
|
|
1095
|
+
},
|
|
1096
|
+
200: function(result) {
|
|
1097
|
+
var lastSha;
|
|
1098
|
+
result.commits.forEach(function(c) {
|
|
1099
|
+
targetList.editableList('addItem',c);
|
|
1100
|
+
lastSha = c.sha;
|
|
1101
|
+
})
|
|
1102
|
+
if (targetList.loadMoreItem) {
|
|
1103
|
+
targetList.editableList('removeItem',targetList.loadMoreItem);
|
|
1104
|
+
delete targetList.loadMoreItem;
|
|
1105
|
+
}
|
|
1106
|
+
var totalKnown = targetList.editableList('length');
|
|
1107
|
+
if (totalKnown < result.total) {
|
|
1108
|
+
targetList.loadMoreItem = {
|
|
1109
|
+
totalKnown: totalKnown,
|
|
1110
|
+
total: result.total,
|
|
1111
|
+
url: url,
|
|
1112
|
+
before: lastSha+"~1",
|
|
1113
|
+
limit: limit,
|
|
1114
|
+
};
|
|
1115
|
+
targetList.editableList('addItem',targetList.loadMoreItem);
|
|
1116
|
+
}
|
|
1117
|
+
spinner.remove();
|
|
1118
|
+
},
|
|
1119
|
+
400: {
|
|
1120
|
+
'unexpected_error': function(error) {
|
|
1121
|
+
console.log(error);
|
|
1122
|
+
// done(error,null);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function refreshLocalCommits() {
|
|
1129
|
+
localCommitList.editableList('empty');
|
|
1130
|
+
var activeProject = RED.projects.getActiveProject();
|
|
1131
|
+
if (activeProject) {
|
|
1132
|
+
getCommits("projects/"+activeProject.name+"/commits",localCommitList,localCommitList.parent());
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
// function refreshRemoteCommits() {
|
|
1136
|
+
// remoteCommitList.editableList('empty');
|
|
1137
|
+
// var spinner = utils.addSpinnerOverlay(remoteCommitList);
|
|
1138
|
+
// var activeProject = RED.projects.getActiveProject();
|
|
1139
|
+
// if (activeProject) {
|
|
1140
|
+
// getCommits("projects/"+activeProject.name+"/commits/origin",remoteCommitList,remoteCommitList.parent());
|
|
1141
|
+
// }
|
|
1142
|
+
// }
|
|
1143
|
+
|
|
1144
|
+
function refreshFiles(result) {
|
|
1145
|
+
var files = result.files;
|
|
1146
|
+
if (bulkChangeSpinner) {
|
|
1147
|
+
bulkChangeSpinner.remove();
|
|
1148
|
+
bulkChangeSpinner = null;
|
|
1149
|
+
}
|
|
1150
|
+
isMerging = !!result.merging;
|
|
1151
|
+
if (isMerging) {
|
|
1152
|
+
sidebarContent.addClass("sidebar-version-control-merging");
|
|
1153
|
+
unmergedContent.show();
|
|
1154
|
+
} else {
|
|
1155
|
+
sidebarContent.removeClass("sidebar-version-control-merging");
|
|
1156
|
+
unmergedContent.hide();
|
|
1157
|
+
}
|
|
1158
|
+
unstagedChangesList.editableList('removeItem',emptyStagedItem);
|
|
1159
|
+
stagedChangesList.editableList('removeItem',emptyStagedItem);
|
|
1160
|
+
unmergedChangesList.editableList('removeItem',emptyMergedItem);
|
|
1161
|
+
|
|
1162
|
+
var fileNames = Object.keys(files).filter(function(f) { return files[f].type === 'f'})
|
|
1163
|
+
fileNames.sort();
|
|
1164
|
+
var updateIndex = Date.now()+Math.floor(Math.random()*100);
|
|
1165
|
+
fileNames.forEach(function(fn) {
|
|
1166
|
+
var entry = files[fn];
|
|
1167
|
+
var addEntry = false;
|
|
1168
|
+
if (entry.status) {
|
|
1169
|
+
entry.file = fn;
|
|
1170
|
+
entry.indexStatus = entry.status[0];
|
|
1171
|
+
entry.treeStatus = entry.status[1];
|
|
1172
|
+
if ((entry.indexStatus === 'A' && /[AU]/.test(entry.treeStatus)) ||
|
|
1173
|
+
(entry.indexStatus === 'U' && /[DAU]/.test(entry.treeStatus)) ||
|
|
1174
|
+
(entry.indexStatus === 'D' && /[DU]/.test(entry.treeStatus))) {
|
|
1175
|
+
entry.unmerged = true;
|
|
1176
|
+
}
|
|
1177
|
+
if (allChanges[fn]) {
|
|
1178
|
+
if (allChanges[fn].unmerged && !entry.unmerged) {
|
|
1179
|
+
unmergedChangesList.editableList('removeItem', allChanges[fn])
|
|
1180
|
+
addEntry = true;
|
|
1181
|
+
} else if (!allChanges[fn].unmerged && entry.unmerged) {
|
|
1182
|
+
unstagedChangesList.editableList('removeItem', allChanges[fn])
|
|
1183
|
+
stagedChangesList.editableList('removeItem', allChanges[fn])
|
|
1184
|
+
}
|
|
1185
|
+
// Known file
|
|
1186
|
+
if (allChanges[fn].status !== entry.status) {
|
|
1187
|
+
// Status changed.
|
|
1188
|
+
if (allChanges[fn].treeStatus !== ' ') {
|
|
1189
|
+
// Already in the unstaged list
|
|
1190
|
+
if (entry.treeStatus === ' ') {
|
|
1191
|
+
unstagedChangesList.editableList('removeItem', allChanges[fn])
|
|
1192
|
+
} else if (entry.treeStatus !== allChanges[fn].treeStatus) {
|
|
1193
|
+
allChanges[fn].updateUnstaged(entry,entry.treeStatus);
|
|
1194
|
+
}
|
|
1195
|
+
} else {
|
|
1196
|
+
addEntry = true;
|
|
1197
|
+
}
|
|
1198
|
+
if (allChanges[fn].indexStatus !== ' ' && allChanges[fn].indexStatus !== '?') {
|
|
1199
|
+
// Already in the staged list
|
|
1200
|
+
if (entry.indexStatus === ' '||entry.indexStatus === '?') {
|
|
1201
|
+
stagedChangesList.editableList('removeItem', allChanges[fn])
|
|
1202
|
+
} else if (entry.indexStatus !== allChanges[fn].indexStatus) {
|
|
1203
|
+
allChanges[fn].updateStaged(entry,entry.indexStatus);
|
|
1204
|
+
}
|
|
1205
|
+
} else {
|
|
1206
|
+
addEntry = true;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
allChanges[fn].status = entry.status;
|
|
1210
|
+
allChanges[fn].indexStatus = entry.indexStatus;
|
|
1211
|
+
allChanges[fn].treeStatus = entry.treeStatus;
|
|
1212
|
+
allChanges[fn].oldName = entry.oldName;
|
|
1213
|
+
allChanges[fn].unmerged = entry.unmerged;
|
|
1214
|
+
|
|
1215
|
+
} else {
|
|
1216
|
+
addEntry = true;
|
|
1217
|
+
allChanges[fn] = entry;
|
|
1218
|
+
}
|
|
1219
|
+
allChanges[fn].updateIndex = updateIndex;
|
|
1220
|
+
if (addEntry) {
|
|
1221
|
+
if (entry.unmerged) {
|
|
1222
|
+
unmergedChangesList.editableList('addItem', allChanges[fn]);
|
|
1223
|
+
} else {
|
|
1224
|
+
if (entry.treeStatus !== ' ') {
|
|
1225
|
+
unstagedChangesList.editableList('addItem', allChanges[fn])
|
|
1226
|
+
}
|
|
1227
|
+
if (entry.indexStatus !== ' ' && entry.indexStatus !== '?') {
|
|
1228
|
+
stagedChangesList.editableList('addItem', allChanges[fn])
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
Object.keys(allChanges).forEach(function(fn) {
|
|
1235
|
+
if (allChanges[fn].updateIndex !== updateIndex) {
|
|
1236
|
+
unstagedChangesList.editableList('removeItem', allChanges[fn]);
|
|
1237
|
+
stagedChangesList.editableList('removeItem', allChanges[fn]);
|
|
1238
|
+
delete allChanges[fn];
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
var stagedCount = stagedChangesList.editableList('length');
|
|
1243
|
+
var unstagedCount = unstagedChangesList.editableList('length');
|
|
1244
|
+
var unmergedCount = unmergedChangesList.editableList('length');
|
|
1245
|
+
|
|
1246
|
+
commitButton.prop('disabled',(isMerging && unmergedCount > 0)||(!isMerging && stagedCount === 0));
|
|
1247
|
+
stageAllButton.prop('disabled',unstagedCount === 0);
|
|
1248
|
+
unstageAllButton.prop('disabled',stagedCount === 0);
|
|
1249
|
+
|
|
1250
|
+
if (stagedCount === 0) {
|
|
1251
|
+
stagedChangesList.editableList('addItem',emptyStagedItem);
|
|
1252
|
+
}
|
|
1253
|
+
if (unstagedCount === 0) {
|
|
1254
|
+
unstagedChangesList.editableList('addItem',emptyStagedItem);
|
|
1255
|
+
}
|
|
1256
|
+
if (unmergedCount === 0) {
|
|
1257
|
+
unmergedChangesList.editableList('addItem',emptyMergedItem);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function refresh(full, includeRemote) {
|
|
1262
|
+
if (refreshInProgress) {
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
if (full) {
|
|
1266
|
+
allChanges = {};
|
|
1267
|
+
unstagedChangesList.editableList('empty');
|
|
1268
|
+
stagedChangesList.editableList('empty');
|
|
1269
|
+
unmergedChangesList.editableList('empty');
|
|
1270
|
+
}
|
|
1271
|
+
if (!RED.user.hasPermission("projects.write")) {
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
refreshInProgress = true;
|
|
1277
|
+
refreshLocalCommits();
|
|
1278
|
+
|
|
1279
|
+
var activeProject = RED.projects.getActiveProject();
|
|
1280
|
+
if (activeProject) {
|
|
1281
|
+
var url = "projects/"+activeProject.name+"/status";
|
|
1282
|
+
if (includeRemote) {
|
|
1283
|
+
url += "?remote=true"
|
|
1284
|
+
}
|
|
1285
|
+
$.getJSON(url,function(result) {
|
|
1286
|
+
refreshFiles(result);
|
|
1287
|
+
|
|
1288
|
+
$('#sidebar-version-control-local-branch').text(result.branches.local);
|
|
1289
|
+
$('#sidebar-version-control-remote-branch').text(result.branches.remote||RED._("sidebar.project.versionControl.none"));
|
|
1290
|
+
|
|
1291
|
+
var commitsAhead = result.commits.ahead || 0;
|
|
1292
|
+
var commitsBehind = result.commits.behind || 0;
|
|
1293
|
+
|
|
1294
|
+
if (activeProject.git.hasOwnProperty('remotes')) {
|
|
1295
|
+
if (result.branches.hasOwnProperty("remoteError") && result.branches.remoteError.code !== 'git_remote_gone') {
|
|
1296
|
+
$("#sidebar-version-control-repo-status-auth-issue").show();
|
|
1297
|
+
$("#sidebar-version-control-repo-status-stats").hide();
|
|
1298
|
+
$('#sidebar-version-control-repo-branch').prop('disabled',true);
|
|
1299
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
1300
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1301
|
+
$('#sidebar-version-control-repo-toolbar-message').hide();
|
|
1302
|
+
$('#sidebar-version-control-repo-toolbar-error-message').show();
|
|
1303
|
+
} else {
|
|
1304
|
+
$('#sidebar-version-control-repo-toolbar-message').show();
|
|
1305
|
+
$('#sidebar-version-control-repo-toolbar-error-message').hide();
|
|
1306
|
+
|
|
1307
|
+
$("#sidebar-version-control-repo-status-auth-issue").hide();
|
|
1308
|
+
$("#sidebar-version-control-repo-status-stats").show();
|
|
1309
|
+
|
|
1310
|
+
$('#sidebar-version-control-repo-branch').prop('disabled',false);
|
|
1311
|
+
|
|
1312
|
+
$("#sidebar-version-control-repo-status-button").show();
|
|
1313
|
+
if (result.branches.hasOwnProperty('remote')) {
|
|
1314
|
+
updateRemoteStatus(commitsAhead, commitsBehind);
|
|
1315
|
+
} else {
|
|
1316
|
+
$('#sidebar-version-control-commits-ahead').text("");
|
|
1317
|
+
$('#sidebar-version-control-commits-behind').text("");
|
|
1318
|
+
|
|
1319
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.notTracking"));
|
|
1320
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
1321
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
} else {
|
|
1325
|
+
$("#sidebar-version-control-repo-status-button").hide();
|
|
1326
|
+
}
|
|
1327
|
+
refreshInProgress = false;
|
|
1328
|
+
$('.sidebar-version-control-shade').hide();
|
|
1329
|
+
}).fail(function() {
|
|
1330
|
+
refreshInProgress = false;
|
|
1331
|
+
});
|
|
1332
|
+
} else {
|
|
1333
|
+
$('.sidebar-version-control-shade').show();
|
|
1334
|
+
unstagedChangesList.editableList('empty');
|
|
1335
|
+
stagedChangesList.editableList('empty');
|
|
1336
|
+
unmergedChangesList.editableList('empty');
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
function updateRemoteStatus(commitsAhead, commitsBehind) {
|
|
1342
|
+
$('#sidebar-version-control-commits-ahead').text(commitsAhead);
|
|
1343
|
+
$('#sidebar-version-control-commits-behind').text(commitsBehind);
|
|
1344
|
+
if (isMerging) {
|
|
1345
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.statusUnmergedChanged"));
|
|
1346
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
1347
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1348
|
+
} else if (commitsAhead > 0 && commitsBehind === 0) {
|
|
1349
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.commitsAhead", {count:commitsAhead}));
|
|
1350
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
1351
|
+
$("#sidebar-version-control-repo-push").prop('disabled',false);
|
|
1352
|
+
} else if (commitsAhead === 0 && commitsBehind > 0) {
|
|
1353
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.commitsBehind",{ count: commitsBehind }));
|
|
1354
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',false);
|
|
1355
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1356
|
+
} else if (commitsAhead > 0 && commitsBehind > 0) {
|
|
1357
|
+
$('#sidebar-version-control-repo-toolbar-message').text(
|
|
1358
|
+
RED._("sidebar.project.versionControl.commitsAheadAndBehind1",{ count:commitsBehind })+
|
|
1359
|
+
RED._("sidebar.project.versionControl.commitsAheadAndBehind2",{ count:commitsAhead })+
|
|
1360
|
+
RED._("sidebar.project.versionControl.commitsAheadAndBehind3",{ count:commitsBehind }));
|
|
1361
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',false);
|
|
1362
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1363
|
+
} else if (commitsAhead === 0 && commitsBehind === 0) {
|
|
1364
|
+
$('#sidebar-version-control-repo-toolbar-message').text(RED._("sidebar.project.versionControl.repositoryUpToDate"));
|
|
1365
|
+
$("#sidebar-version-control-repo-pull").prop('disabled',true);
|
|
1366
|
+
$("#sidebar-version-control-repo-push").prop('disabled',true);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
function show() {
|
|
1370
|
+
refresh();
|
|
1371
|
+
RED.sidebar.show("version-control");
|
|
1372
|
+
}
|
|
1373
|
+
function showLocalChanges() {
|
|
1374
|
+
RED.sidebar.show("version-control");
|
|
1375
|
+
localChanges.expand();
|
|
1376
|
+
}
|
|
1377
|
+
return {
|
|
1378
|
+
init: init,
|
|
1379
|
+
show: show,
|
|
1380
|
+
refresh: refresh,
|
|
1381
|
+
showLocalChanges: showLocalChanges
|
|
1382
|
+
}
|
|
1383
|
+
})();
|