mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Return more detailed information on /project/branches api
This commit is contained in:
@@ -581,7 +581,7 @@ RED.projects = (function() {
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -852,7 +852,6 @@ RED.projects = (function() {
|
||||
var branchFilterTerm = "";
|
||||
var branchFilterCreateItem;
|
||||
var branches = [];
|
||||
var currentBranch;
|
||||
var branchPrefix = "";
|
||||
var container = $('<div class="projects-branch-list">').appendTo(options.container);
|
||||
|
||||
@@ -882,15 +881,15 @@ RED.projects = (function() {
|
||||
scrollOnAdd: false,
|
||||
addItem: function(row,index,entry) {
|
||||
var container = $('<div class="sidebar-version-control-branch-list-entry">').appendTo(row);
|
||||
if (typeof entry !== "string") {
|
||||
if (!entry.hasOwnProperty('commit')) {
|
||||
branchFilterCreateItem = container;
|
||||
$('<i class="fa fa-code-fork"></i>').appendTo(container);
|
||||
$('<span>').text("Create branch:").appendTo(container);
|
||||
$('<div class="sidebar-version-control-branch-list-entry-create-name" style="margin-left: 10px;">').text(entry.name).appendTo(container);
|
||||
} else {
|
||||
$('<i class="fa fa-code-fork"></i>').appendTo(container);
|
||||
$('<span>').text(entry).appendTo(container);
|
||||
if (currentBranch === entry) {
|
||||
$('<span>').text(entry.name).appendTo(container);
|
||||
if (entry.current) {
|
||||
container.addClass("selected");
|
||||
$('<span class="current"></span>').text(options.currentLabel||"current").appendTo(container);
|
||||
}
|
||||
@@ -901,7 +900,7 @@ RED.projects = (function() {
|
||||
return;
|
||||
}
|
||||
var body = {};
|
||||
if (typeof entry !== "string") {
|
||||
if (!entry.hasOwnProperty('commit')) {
|
||||
body.name = branchFilter.val();
|
||||
body.create = true;
|
||||
if (options.remote) {
|
||||
@@ -911,7 +910,7 @@ RED.projects = (function() {
|
||||
if ($(this).hasClass('selected')) {
|
||||
body.current = true;
|
||||
}
|
||||
body.name = entry;
|
||||
body.name = entry.name;
|
||||
}
|
||||
if (options.onselect) {
|
||||
options.onselect(body);
|
||||
@@ -919,7 +918,7 @@ RED.projects = (function() {
|
||||
});
|
||||
},
|
||||
filter: function(data) {
|
||||
var isCreateEntry = (typeof data !=="string");
|
||||
var isCreateEntry = (!data.hasOwnProperty('commit'));
|
||||
return (
|
||||
isCreateEntry &&
|
||||
(
|
||||
@@ -929,7 +928,7 @@ RED.projects = (function() {
|
||||
) ||
|
||||
(
|
||||
!isCreateEntry &&
|
||||
data.indexOf(branchFilterTerm) !== -1
|
||||
data.name.indexOf(branchFilterTerm) !== -1
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -939,14 +938,12 @@ RED.projects = (function() {
|
||||
branchList.editableList('empty');
|
||||
var start = Date.now();
|
||||
var spinner = addSpinnerOverlay(container).addClass("projects-dialog-spinner-contain");
|
||||
currentBranch = options.current();
|
||||
if (options.remote) {
|
||||
branchPrefix = options.remote()+"/";
|
||||
} else {
|
||||
branchPrefix = "";
|
||||
}
|
||||
|
||||
|
||||
sendRequest({
|
||||
url: url,
|
||||
type: "GET",
|
||||
@@ -972,7 +969,7 @@ RED.projects = (function() {
|
||||
}
|
||||
})
|
||||
},
|
||||
addItem: function(data) { branchList.editableList('addItem',data) },
|
||||
// addItem: function(data) { branchList.editableList('addItem',data) },
|
||||
filter: function() { branchList.editableList('filter') },
|
||||
focus: function() { branchFilter.focus() }
|
||||
}
|
||||
|
@@ -571,9 +571,6 @@ RED.sidebar.versionControl = (function() {
|
||||
$('<div class="sidebar-version-control-slide-box-header"></div>').text("Change local branch").appendTo(localBranchBox);
|
||||
|
||||
var localBranchList = utils.createBranchList({
|
||||
current: function() {
|
||||
return RED.projects.getActiveProject().git.branches.local
|
||||
},
|
||||
placeholder: "Find or create a branch",
|
||||
container: localBranchBox,
|
||||
onselect: function(body) {
|
||||
@@ -711,9 +708,6 @@ RED.sidebar.versionControl = (function() {
|
||||
|
||||
var remoteBranchSubRow = $('<div style="height: 0;overflow:hidden; transition: height 0.2s ease-in-out;"></div>').hide().appendTo(remoteBranchRow);
|
||||
var remoteBranchList = utils.createBranchList({
|
||||
current: function() {
|
||||
return RED.projects.getActiveProject().git.branches.remote
|
||||
},
|
||||
placeholder: "Find or create a remote branch",
|
||||
currentLabel: "upstream",
|
||||
remote: function() {
|
||||
|
Reference in New Issue
Block a user