From 81f200641b4d15dd7c0abbc19605d71b77a7798e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 18 Nov 2020 12:02:45 +0000 Subject: [PATCH] Allow default project workflow to be set via settings --- .../src/js/ui/projects/projectUserSettings.js | 4 +++- .../src/js/ui/projects/tab-versionControl.js | 5 ++++- packages/node_modules/node-red/settings.js | 10 +++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectUserSettings.js b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectUserSettings.js index 31acbc1e4..7ca13a3cf 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectUserSettings.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/projectUserSettings.js @@ -43,9 +43,11 @@ RED.projects.userSettings = (function() { function createWorkflowSection(pane) { + var defaultWorkflowMode = RED.settings.theme("projects.workflow.mode","manual"); + var currentGitSettings = RED.settings.get('git') || {}; currentGitSettings.workflow = currentGitSettings.workflow || {}; - currentGitSettings.workflow.mode = currentGitSettings.workflow.mode || "manual"; + currentGitSettings.workflow.mode = currentGitSettings.workflow.mode || defaultWorkflowMode; var title = $('

').text(RED._("editor:sidebar.project.userSettings.workflow")).appendTo(pane); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/tab-versionControl.js b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/tab-versionControl.js index 8aede9c2b..5512926be 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/projects/tab-versionControl.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/projects/tab-versionControl.js @@ -294,7 +294,10 @@ RED.sidebar.versionControl = (function() { // TODO: this is a full refresh of the files - should be able to // just do an incremental refresh - var workflowMode = ((RED.settings.get('git') || {}).workflow || {}).mode || "manual"; + // Get the default workflow mode from theme settings + var defaultWorkflowMode = RED.settings.theme("projects.workflow.mode","manual"); + // Check for the user-defined choice of mode + var workflowMode = ((RED.settings.get('git') || {}).workflow || {}).mode || defaultWorkflowMode; if (workflowMode === 'auto') { refresh(true); } else { diff --git a/packages/node_modules/node-red/settings.js b/packages/node_modules/node-red/settings.js index fd07630f2..d13c2b195 100644 --- a/packages/node_modules/node-red/settings.js +++ b/packages/node_modules/node-red/settings.js @@ -290,7 +290,15 @@ module.exports = { editorTheme: { projects: { // To enable the Projects feature, set this value to true - enabled: false + enabled: false, + workflow: { + // Set the default projects workflow mode. + // - manual - you must manually commit changes + // - auto - changes are automatically committed + // This can be overridden per-user from the 'Git config' + // section of 'User Settings' within the editor + mode: "manual" + } } } }