1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Tidy up project first-run experience

This commit is contained in:
Nick O'Leary 2018-01-23 11:26:05 +00:00
parent 1337831061
commit cf34716a57
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 32 additions and 23 deletions

View File

@ -198,7 +198,8 @@ RED.projects = (function() {
},50); },50);
return container; return container;
}, },
buttons: [ buttons: function(options) {
return [
{ {
text: "Back", text: "Back",
click: function() { click: function() {
@ -213,10 +214,11 @@ RED.projects = (function() {
click: function() { click: function() {
createProjectOptions.name = projectNameInput.val(); createProjectOptions.name = projectNameInput.val();
createProjectOptions.summary = projectSummaryInput.val(); createProjectOptions.summary = projectSummaryInput.val();
show('default-files'); show('default-files', options);
} }
} }
] ]
}
}; };
})(), })(),
'default-files': (function() { 'default-files': (function() {
@ -341,9 +343,9 @@ RED.projects = (function() {
if (RED.settings.flowEncryptionType === 'user') { if (RED.settings.flowEncryptionType === 'user') {
$('<p>').text("Your flow credentials file is currently encrypted using the credentialSecret property from your settings file as the key.").appendTo(body); $('<p>').text("Your flow credentials file is currently encrypted using the credentialSecret property from your settings file as the key.").appendTo(body);
} else if (RED.settings.flowEncryptionType === 'system') { } else if (RED.settings.flowEncryptionType === 'system') {
$('<p>').text("Your flow credentials file is currently encrypted using a system-generated secret as the key. You should provide a new secret key for this project.").appendTo(body); $('<p>').text("Your flow credentials file is currently encrypted using a system-generated key. You should provide a new secret key for this project.").appendTo(body);
} }
$('<p>').text("The secret will be copied into the settings for your new project. You can then manage the secret within the editor.").appendTo(body); $('<p>').text("The key will be stored separately from your project files. You will need to provide the key to use this project in another instance of Node-RED.").appendTo(body);
} }
} }
@ -523,7 +525,9 @@ RED.projects = (function() {
} }
} }
},createProjectOptions).always(function() { },createProjectOptions).always(function() {
setTimeout(function() {
RED.deploy.setDeployInflight(false); RED.deploy.setDeployInflight(false);
},500);
}) })
} }
} }
@ -1160,12 +1164,12 @@ RED.projects = (function() {
RED.projects.init(); RED.projects.init();
} }
var screen = screens[s]; var screen = screens[s];
var container = screen.content(options); var container = screen.content(options||{});
dialogBody.empty(); dialogBody.empty();
var buttons = screen.buttons; var buttons = screen.buttons;
if (typeof buttons === 'function') { if (typeof buttons === 'function') {
buttons = buttons(options); buttons = buttons(options||{});
} }
dialog.dialog('option','buttons',buttons); dialog.dialog('option','buttons',buttons);
dialogBody.append(container); dialogBody.append(container);

View File

@ -862,6 +862,11 @@ function createProject(user, metadata) {
} }
createProjectDirectory(project).then(function() { createProjectDirectory(project).then(function() {
var projects = settings.get('projects'); var projects = settings.get('projects');
if (!projects) {
projects = {
projects:{}
}
}
projects.projects[project] = {}; projects.projects[project] = {};
if (metadata.hasOwnProperty('credentialSecret')) { if (metadata.hasOwnProperty('credentialSecret')) {
projects.projects[project].credentialSecret = metadata.credentialSecret; projects.projects[project].credentialSecret = metadata.credentialSecret;