Merge pull request #5030 from matiseni51/add-editorTheme-custom-label-default-deploy-button

feat: Add custom label for default deploy button in settings.editorTheme
This commit is contained in:
Nick O'Leary 2025-02-10 16:51:45 +00:00 committed by GitHub
commit 4605f01c5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,7 @@ RED.deploy = (function() {
/** /**
* options: * options:
* type: "default" - Button with drop-down options - no further customisation available * type: "default" - Button with drop-down options - no further customisation available
* label: the text to display - default: "Deploy"
* type: "simple" - Button without dropdown. Customisations: * type: "simple" - Button without dropdown. Customisations:
* label: the text to display - default: "Deploy" * label: the text to display - default: "Deploy"
* icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.svg" * icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.svg"
@ -51,13 +52,14 @@ RED.deploy = (function() {
function init(options) { function init(options) {
options = options || {}; options = options || {};
var type = options.type || "default"; var type = options.type || "default";
var label = options.label || RED._("deploy.deploy");
if (type == "default") { if (type == "default") {
$('<li><span class="red-ui-deploy-button-group button-group">'+ $('<li><span class="red-ui-deploy-button-group button-group">'+
'<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+ '<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+
'<span class="red-ui-deploy-button-content">'+ '<span class="red-ui-deploy-button-content">'+
'<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.svg"> '+ '<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.svg"> '+
'<span>'+RED._("deploy.deploy")+'</span>'+ '<span>'+label+'</span>'+
'</span>'+ '</span>'+
'<span class="red-ui-deploy-button-spinner hide">'+ '<span class="red-ui-deploy-button-spinner hide">'+
'<img src="red/images/spin.svg"/>'+ '<img src="red/images/spin.svg"/>'+
@ -78,7 +80,6 @@ RED.deploy = (function() {
mainMenuItems.push({id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"}) mainMenuItems.push({id:"deploymenu-item-reload", icon:"red/images/deploy-reload.svg",label:RED._("deploy.restartFlows"),sublabel:RED._("deploy.restartFlowsDesc"),onselect:"core:restart-flows"})
RED.menu.init({id:"red-ui-header-button-deploy-options", options: mainMenuItems }); RED.menu.init({id:"red-ui-header-button-deploy-options", options: mainMenuItems });
} else if (type == "simple") { } else if (type == "simple") {
var label = options.label || RED._("deploy.deploy");
var icon = 'red/images/deploy-full-o.svg'; var icon = 'red/images/deploy-full-o.svg';
if (options.hasOwnProperty('icon')) { if (options.hasOwnProperty('icon')) {
icon = options.icon; icon = options.icon;