1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
This commit is contained in:
Dave Conway-Jones 2021-04-27 11:12:10 +01:00
commit 0e02d03d9a
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
6 changed files with 51 additions and 7 deletions

View File

@ -15,7 +15,7 @@
**/ **/
(function($) { (function($) {
var contextParse = function(v,defaultStore) { var contextParse = function(v,defaultStore) {
var parts = RED.utils.parseContextKey(v, defaultStore); var parts = RED.utils.parseContextKey(v, defaultStore&&defaultStore.value);
return { return {
option: parts.store, option: parts.store,
value: parts.key value: parts.key
@ -279,6 +279,14 @@
var contextStores = RED.settings.context.stores; var contextStores = RED.settings.context.stores;
var contextOptions = contextStores.map(function(store) { var contextOptions = contextStores.map(function(store) {
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database"></i>'} return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database"></i>'}
}).sort(function(A,B) {
if (A.value === RED.settings.context.default) {
return -1;
} else if (B.value === RED.settings.context.default) {
return 1;
} else {
return A.value.localeCompare(B.value);
}
}) })
if (contextOptions.length < 2) { if (contextOptions.length < 2) {
allOptions.flow.options = []; allOptions.flow.options = [];

View File

@ -1751,7 +1751,6 @@ RED.view = (function() {
} }
} }
if (mouse_mode == RED.state.IMPORT_DRAGGING) { if (mouse_mode == RED.state.IMPORT_DRAGGING) {
RED.keyboard.remove("escape");
updateActiveNodes(); updateActiveNodes();
RED.nodes.dirty(true); RED.nodes.dirty(true);
} }
@ -1786,6 +1785,9 @@ RED.view = (function() {
} }
function selectNone() { function selectNone() {
if (mouse_mode === RED.state.MOVING || mouse_mode === RED.state.MOVING_ACTIVE) {
return;
}
if (mouse_mode === RED.state.IMPORT_DRAGGING) { if (mouse_mode === RED.state.IMPORT_DRAGGING) {
clearSelection(); clearSelection();
RED.history.pop(); RED.history.pop();

View File

@ -74,21 +74,21 @@
<div id="func-tab-init" style="display:none"> <div id="func-tab-init" style="display:none">
<div class="form-row node-text-editor-row" style="position:relative"> <div class="form-row node-text-editor-row" style="position:relative">
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-init-editor" ></div> <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-init-editor" ></div>
<div style="position: absolute; right:0; bottom: calc(100% - 20px);"><button id="node-init-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div> <div style="position: absolute; right:0; bottom: calc(100% - 20px); z-Index: 10;"><button id="node-init-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div>
</div> </div>
</div> </div>
<div id="func-tab-body" style="display:none"> <div id="func-tab-body" style="display:none">
<div class="form-row node-text-editor-row" style="position:relative"> <div class="form-row node-text-editor-row" style="position:relative">
<div style="height: 220px; min-height:150px;" class="node-text-editor" id="node-input-func-editor" ></div> <div style="height: 220px; min-height:150px;" class="node-text-editor" id="node-input-func-editor" ></div>
<div style="position: absolute; right:0; bottom: calc(100% - 20px);"><button id="node-function-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div> <div style="position: absolute; right:0; bottom: calc(100% - 20px); z-Index: 10;"><button id="node-function-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div>
</div> </div>
</div> </div>
<div id="func-tab-finalize" style="display:none"> <div id="func-tab-finalize" style="display:none">
<div class="form-row node-text-editor-row" style="position:relative"> <div class="form-row node-text-editor-row" style="position:relative">
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-finalize-editor" ></div> <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-finalize-editor" ></div>
<div style="position: absolute; right:0; bottom: calc(100% - 20px);"><button id="node-finalize-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div> <div style="position: absolute; right:0; bottom: calc(100% - 20px); z-Index: 10;"><button id="node-finalize-expand-js" class="red-ui-button red-ui-button-small"><i class="fa fa-expand"></i></button></div>
</div> </div>
</div> </div>

View File

@ -64,6 +64,27 @@ var server;
*/ */
function init(userSettings,httpServer,_adminApi) { function init(userSettings,httpServer,_adminApi) {
server = httpServer; server = httpServer;
if (server && server.on) {
// Add a listener to the upgrade event so that we can properly timeout connection
// attempts that do not get handled by any nodes in the user's flow.
// See #2956
server.on('upgrade',(request, socket, head) => {
// Add a no-op handler to the error event in case nothing upgrades this socket
// before the remote end closes it. This ensures we don't get as uncaughtException
socket.on("error", err => {})
setTimeout(function() {
// If this request has been handled elsewhere, the upgrade will have
// been completed and bytes written back to the client.
// If nothing has been written on the socket, nothing has handled the
// upgrade, so we can consider this an unhandled upgrade.
if (socket.bytesWritten === 0) {
socket.destroy();
}
},userSettings.inboundWebSocketTimeout || 5000)
});
}
userSettings.version = getVersion(); userSettings.version = getVersion();
settings.init(userSettings); settings.init(userSettings);

View File

@ -608,8 +608,15 @@ async function saveFlows(flows, user) {
var workflowMode = (gitSettings.workflow||{}).mode || settings.editorTheme.projects.workflow.mode; var workflowMode = (gitSettings.workflow||{}).mode || settings.editorTheme.projects.workflow.mode;
if (workflowMode === 'auto') { if (workflowMode === 'auto') {
return activeProject.stageFile([flowsFullPath, credentialsFile]).then(() => { return activeProject.stageFile([flowsFullPath, credentialsFile]).then(() => {
return activeProject.status(user, false).then((result) => {
const items = Object.values(result.files || {});
// check if saved flow make modification to repository
if (items.findIndex((item) => (item.status === "M ")) < 0) {
return Promise.resolve();
}
return activeProject.commit(user,{message:"Update flow files"}) return activeProject.commit(user,{message:"Update flow files"})
}) });
});
} }
} }
}); });

View File

@ -46,6 +46,12 @@ module.exports = {
// defaults to 10Mb // defaults to 10Mb
//execMaxBufferSize: 10000000, //execMaxBufferSize: 10000000,
// Timeout in milliseconds for inbound WebSocket connections that do not
// match any configured node.
// defaults to 5000
//inboundWebSocketTimeout: 5000
// The maximum length, in characters, of any message sent to the debug sidebar tab // The maximum length, in characters, of any message sent to the debug sidebar tab
debugMaxLength: 1000, debugMaxLength: 1000,