mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add force-deploy option when conflict detected
This commit is contained in:
parent
6b07f58e8e
commit
401d386812
@ -140,7 +140,16 @@ RED.deploy = (function() {
|
|||||||
if (ignoreChecked) {
|
if (ignoreChecked) {
|
||||||
ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true;
|
ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true;
|
||||||
}
|
}
|
||||||
save(true,$( "#node-dialog-confirm-deploy-type" ).val() === "conflict");
|
save(true,/conflict/.test($("#node-dialog-confirm-deploy-type" ).val()));
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "node-dialog-confirm-deploy-overwrite",
|
||||||
|
text: RED._("deploy.confirm.button.overwrite"),
|
||||||
|
class: "primary",
|
||||||
|
click: function() {
|
||||||
|
save(true,/conflict/.test($("#node-dialog-confirm-deploy-type" ).val()));
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,11 +163,13 @@ RED.deploy = (function() {
|
|||||||
'</div>');
|
'</div>');
|
||||||
},
|
},
|
||||||
open: function() {
|
open: function() {
|
||||||
if ($( "#node-dialog-confirm-deploy-type" ).val() === "conflict") {
|
var deployType = $("#node-dialog-confirm-deploy-type" ).val();
|
||||||
|
if (/conflict/.test(deployType)) {
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.review'));
|
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.review'));
|
||||||
$("#node-dialog-confirm-deploy-deploy").hide();
|
$("#node-dialog-confirm-deploy-deploy").hide();
|
||||||
$("#node-dialog-confirm-deploy-review").addClass('disabled').show();
|
$("#node-dialog-confirm-deploy-review").addClass('disabled').show();
|
||||||
$("#node-dialog-confirm-deploy-merge").addClass('disabled').show();
|
$("#node-dialog-confirm-deploy-merge").addClass('disabled').show();
|
||||||
|
$("#node-dialog-confirm-deploy-overwrite").toggle(deployType === "deploy-conflict");
|
||||||
currentDiff = null;
|
currentDiff = null;
|
||||||
$("#node-dialog-confirm-deploy-conflict-checking").show();
|
$("#node-dialog-confirm-deploy-conflict-checking").show();
|
||||||
$("#node-dialog-confirm-deploy-conflict-auto-merge").hide();
|
$("#node-dialog-confirm-deploy-conflict-auto-merge").hide();
|
||||||
@ -186,6 +197,7 @@ RED.deploy = (function() {
|
|||||||
} else {
|
} else {
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.confirm'));
|
$( "#node-dialog-confirm-deploy" ).dialog('option','title', RED._('deploy.confirm.button.confirm'));
|
||||||
$("#node-dialog-confirm-deploy-deploy").show();
|
$("#node-dialog-confirm-deploy-deploy").show();
|
||||||
|
$("#node-dialog-confirm-deploy-overwrite").hide();
|
||||||
$("#node-dialog-confirm-deploy-review").hide();
|
$("#node-dialog-confirm-deploy-review").hide();
|
||||||
$("#node-dialog-confirm-deploy-merge").hide();
|
$("#node-dialog-confirm-deploy-merge").hide();
|
||||||
$("#node-dialog-confirm-deploy-hide").parent().show();
|
$("#node-dialog-confirm-deploy-hide").parent().show();
|
||||||
@ -226,7 +238,7 @@ RED.deploy = (function() {
|
|||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
activeNotifyMessage.close();
|
activeNotifyMessage.close();
|
||||||
var nns = RED.nodes.createCompleteNodeSet();
|
var nns = RED.nodes.createCompleteNodeSet();
|
||||||
resolveConflict(nns);
|
resolveConflict(nns,false);
|
||||||
activeNotifyMessage = null;
|
activeNotifyMessage = null;
|
||||||
})
|
})
|
||||||
activeNotifyMessage = RED.notify(message,null,true);
|
activeNotifyMessage = RED.notify(message,null,true);
|
||||||
@ -258,12 +270,12 @@ RED.deploy = (function() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveConflict(currentNodes) {
|
function resolveConflict(currentNodes, activeDeploy) {
|
||||||
$( "#node-dialog-confirm-deploy-config" ).hide();
|
$( "#node-dialog-confirm-deploy-config" ).hide();
|
||||||
$( "#node-dialog-confirm-deploy-unknown" ).hide();
|
$( "#node-dialog-confirm-deploy-unknown" ).hide();
|
||||||
$( "#node-dialog-confirm-deploy-unused" ).hide();
|
$( "#node-dialog-confirm-deploy-unused" ).hide();
|
||||||
$( "#node-dialog-confirm-deploy-conflict" ).show();
|
$( "#node-dialog-confirm-deploy-conflict" ).show();
|
||||||
$( "#node-dialog-confirm-deploy-type" ).val("conflict");
|
$( "#node-dialog-confirm-deploy-type" ).val(activeDeploy?"deploy-conflict":"background-conflict");
|
||||||
$( "#node-dialog-confirm-deploy" ).dialog( "open" );
|
$( "#node-dialog-confirm-deploy" ).dialog( "open" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +408,7 @@ RED.deploy = (function() {
|
|||||||
if (xhr.status === 401) {
|
if (xhr.status === 401) {
|
||||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||||
} else if (xhr.status === 409) {
|
} else if (xhr.status === 409) {
|
||||||
resolveConflict(nns);
|
resolveConflict(nns, true);
|
||||||
} else if (xhr.responseText) {
|
} else if (xhr.responseText) {
|
||||||
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,9 +133,10 @@
|
|||||||
"button": {
|
"button": {
|
||||||
"ignore": "Ignore",
|
"ignore": "Ignore",
|
||||||
"confirm": "Confirm deploy",
|
"confirm": "Confirm deploy",
|
||||||
"review": "Review differences",
|
"review": "Review changes",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"merge": "Merge changes"
|
"merge": "Merge",
|
||||||
|
"overwrite": "Ignore & deploy"
|
||||||
},
|
},
|
||||||
"undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.",
|
"undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.",
|
||||||
"improperlyConfigured": "The workspace contains some nodes that are not properly configured:",
|
"improperlyConfigured": "The workspace contains some nodes that are not properly configured:",
|
||||||
|
Loading…
Reference in New Issue
Block a user