mirror of https://github.com/node-red/node-red.git
Show lock on deploy if user is read-only
parent
c5ae0be7b1
commit
5494c167fc
|
@ -63,7 +63,7 @@ RED.deploy = (function() {
|
||||||
'<img src="red/images/spin.svg"/>'+
|
'<img src="red/images/spin.svg"/>'+
|
||||||
'</span>'+
|
'</span>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i><i class="fa fa-lock"></i></a>'+
|
||||||
'</span></li>').prependTo(".red-ui-header-toolbar");
|
'</span></li>').prependTo(".red-ui-header-toolbar");
|
||||||
const mainMenuItems = [
|
const mainMenuItems = [
|
||||||
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.svg",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
|
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.svg",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
|
||||||
|
@ -124,6 +124,9 @@ RED.deploy = (function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
RED.events.on('workspace:dirty',function(state) {
|
RED.events.on('workspace:dirty',function(state) {
|
||||||
|
if (RED.settings.user?.permissions === 'read') {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (state.dirty) {
|
if (state.dirty) {
|
||||||
// window.onbeforeunload = function() {
|
// window.onbeforeunload = function() {
|
||||||
// return
|
// return
|
||||||
|
@ -169,6 +172,22 @@ RED.deploy = (function() {
|
||||||
activeBackgroundDeployNotification.update(message, options)
|
activeBackgroundDeployNotification.update(message, options)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
updateLockedState()
|
||||||
|
RED.events.on('login', updateLockedState)
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateLockedState() {
|
||||||
|
if (RED.settings.user?.permissions === 'read') {
|
||||||
|
$(".red-ui-deploy-button-group").addClass("readOnly");
|
||||||
|
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||||
|
} else {
|
||||||
|
$(".red-ui-deploy-button-group").removeClass("readOnly");
|
||||||
|
if (RED.nodes.dirty()) {
|
||||||
|
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeInfo(node) {
|
function getNodeInfo(node) {
|
||||||
|
|
|
@ -186,6 +186,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.red-ui-deploy-button-group.readOnly {
|
||||||
|
.fa-caret-down { display: none; }
|
||||||
|
.fa-lock { display: inline-block; }
|
||||||
|
}
|
||||||
|
.red-ui-deploy-button-group:not(.readOnly) {
|
||||||
|
.fa-caret-down { display: inline-block; }
|
||||||
|
.fa-lock { display: none; }
|
||||||
|
}
|
||||||
|
.red-ui-deploy-button-group.readOnly {
|
||||||
|
a {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
li.open .button {
|
li.open .button {
|
||||||
background: var(--red-ui-header-button-background-active);
|
background: var(--red-ui-header-button-background-active);
|
||||||
border-color: var(--red-ui-header-button-background-active);
|
border-color: var(--red-ui-header-button-background-active);
|
||||||
|
|
Loading…
Reference in New Issue