mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Better handling of empty projects and lifecycle
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
text: "Setup project files",
|
||||
click: function() {
|
||||
persistentNotifications[notificationId].close();
|
||||
delete persistentNotifications[notificationId];
|
||||
RED.projects.showFilesPrompt();
|
||||
}
|
||||
}
|
||||
@@ -128,11 +129,13 @@
|
||||
text: "No thanks",
|
||||
click: function() {
|
||||
persistentNotifications[notificationId].close();
|
||||
delete persistentNotifications[notificationId];
|
||||
}
|
||||
}, {
|
||||
text: "Create default project files",
|
||||
click: function() {
|
||||
persistentNotifications[notificationId].close();
|
||||
delete persistentNotifications[notificationId];
|
||||
RED.projects.createDefaultFileSet();
|
||||
}
|
||||
}
|
||||
@@ -142,7 +145,7 @@
|
||||
if (!persistentNotifications.hasOwnProperty(notificationId)) {
|
||||
persistentNotifications[notificationId] = RED.notify(text,options);
|
||||
} else {
|
||||
persistentNotifications[notificationId].update(text,msg.timeout);
|
||||
persistentNotifications[notificationId].update(text,options);
|
||||
}
|
||||
} else if (persistentNotifications.hasOwnProperty(notificationId)) {
|
||||
persistentNotifications[notificationId].close();
|
||||
|
@@ -85,18 +85,34 @@ RED.notify = (function() {
|
||||
|
||||
n.update = (function() {
|
||||
var nn = n;
|
||||
return function(msg,timeout) {
|
||||
return function(msg,options) {
|
||||
if (typeof msg === "string") {
|
||||
nn.innerHTML = msg;
|
||||
} else {
|
||||
$(nn).empty().append(msg);
|
||||
}
|
||||
var timeout;
|
||||
if (typeof options === 'number') {
|
||||
timeout = options;
|
||||
} else if (options !== undefined) {
|
||||
timeout = options.timeout;
|
||||
if (options.buttons) {
|
||||
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn)
|
||||
options.buttons.forEach(function(buttonDef) {
|
||||
var b = $('<button>').html(buttonDef.text).click(buttonDef.click).appendTo(buttonSet);
|
||||
if (buttonDef.class) {
|
||||
b.addClass(buttonDef.class);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (timeout !== undefined && timeout > 0) {
|
||||
window.clearTimeout(nn.timeoutid);
|
||||
nn.timeoutid = window.setTimeout(nn.close,timeout);
|
||||
} else {
|
||||
window.clearTimeout(nn.timeoutid);
|
||||
}
|
||||
|
||||
}
|
||||
})();
|
||||
|
||||
|
@@ -1067,7 +1067,7 @@ RED.projects = (function() {
|
||||
'open': (function() {
|
||||
var selectedProject;
|
||||
return {
|
||||
title: "Open a project", // TODO: NLS
|
||||
title: "Select a project to open", // TODO: NLS
|
||||
content: function() {
|
||||
return createProjectList({
|
||||
canSelectActive: false,
|
||||
@@ -1111,6 +1111,7 @@ RED.projects = (function() {
|
||||
'delete': (function() {
|
||||
var selectedProject;
|
||||
return {
|
||||
title: "Select a project to delete", // TODO: NLS
|
||||
content: function() {
|
||||
return createProjectList({
|
||||
canSelectActive: false,
|
||||
|
@@ -55,7 +55,7 @@ RED.sidebar.info = (function() {
|
||||
});
|
||||
nodeSection.expand();
|
||||
infoSection = sections.add({
|
||||
title: RED._("sidebar.info.help"),
|
||||
title: RED._("sidebar.info.nodeHelp"),
|
||||
collapsible: true
|
||||
});
|
||||
infoSection.expand();
|
||||
|
@@ -34,6 +34,10 @@
|
||||
border-left-width: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.notification p:first-child {
|
||||
font-size: 1.1em;
|
||||
font-weight: 500;
|
||||
}
|
||||
.notification a {
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
|
@@ -214,8 +214,8 @@
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background: #f3f3f3;
|
||||
border-left-color: #aaa;
|
||||
border-right-color: #aaa;
|
||||
// border-left-color: #aaa;
|
||||
// border-right-color: #aaa;
|
||||
}
|
||||
}
|
||||
i {
|
||||
|
Reference in New Issue
Block a user