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

Handle delete of last remote in project settings

This commit is contained in:
Nick O'Leary 2018-02-01 11:25:56 +00:00
parent 44112a9d18
commit 750dd590c8
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 21 additions and 15 deletions

View File

@ -1254,14 +1254,16 @@ RED.projects.settings = (function() {
row.fadeOut(200,function() { row.fadeOut(200,function() {
remotesList.editableList('removeItem',entry); remotesList.editableList('removeItem',entry);
setTimeout(spinner.remove, 100); setTimeout(spinner.remove, 100);
activeProject.git.remotes = {};
data.remotes.forEach(function(remote) {
var name = remote.name;
delete remote.name;
activeProject.git.remotes[name] = remote;
});
if (data.remotes.length === 0) { if (data.remotes.length === 0) {
delete activeProject.git.remotes;
remotesList.editableList('addItem',emptyItem); remotesList.editableList('addItem',emptyItem);
} else {
activeProject.git.remotes = {};
data.remotes.forEach(function(remote) {
var name = remote.name;
delete remote.name;
activeProject.git.remotes[name] = remote;
});
} }
}); });
}, },

View File

@ -179,15 +179,19 @@ Project.prototype.loadRemotes = function() {
project.branches = {}; project.branches = {};
return project.status(); return project.status();
}).then(function() { }).then(function() {
var allRemotes = Object.keys(project.remotes); if (project.remotes) {
var match = ""; var allRemotes = Object.keys(project.remotes);
if (project.branches.remote) { var match = "";
allRemotes.forEach(function(remote) { if (project.branches.remote) {
if (project.branches.remote.indexOf(remote) === 0 && match.length < remote.length) { allRemotes.forEach(function(remote) {
match = remote; if (project.branches.remote.indexOf(remote) === 0 && match.length < remote.length) {
} match = remote;
}); }
project.currentRemote = project.parseRemoteBranch(project.branches.remote).remote; });
project.currentRemote = project.parseRemoteBranch(project.branches.remote).remote;
}
} else {
delete project.currentRemote;
} }
}); });
} }