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

Add placeholder when a repo has no local branches

This commit is contained in:
Nick O'Leary 2017-12-21 22:28:26 +00:00
parent 207d3d3340
commit 6013e186ed
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -964,6 +964,11 @@ RED.projects.settings = (function() {
scrollOnAdd: false, scrollOnAdd: false,
addItem: function(row,index,entry) { addItem: function(row,index,entry) {
var container = $('<div class="projects-dialog-list-entry">').appendTo(row); var container = $('<div class="projects-dialog-list-entry">').appendTo(row);
if (entry.empty) {
container.addClass('red-ui-search-empty');
container.text("No branches");
return;
}
if (entry.current) { if (entry.current) {
container.addClass("current"); container.addClass("current");
} }
@ -1064,6 +1069,7 @@ RED.projects.settings = (function() {
$.getJSON("projects/"+activeProject.name+"/branches",function(result) { $.getJSON("projects/"+activeProject.name+"/branches",function(result) {
if (result.branches) { if (result.branches) {
if (result.branches.length > 0) {
result.branches.sort(function(A,B) { result.branches.sort(function(A,B) {
if (A.current) { return -1 } if (A.current) { return -1 }
if (B.current) { return 1 } if (B.current) { return 1 }
@ -1072,6 +1078,9 @@ RED.projects.settings = (function() {
result.branches.forEach(function(branch) { result.branches.forEach(function(branch) {
branchList.editableList('addItem',branch); branchList.editableList('addItem',branch);
}) })
} else {
branchList.editableList('addItem',{empty:true});
}
} }
}) })
} }