mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Avoid git fetch when refreshing local status
This commit is contained in:
parent
06a6a4408f
commit
aa1cf0b228
@ -521,7 +521,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
.appendTo(bg)
|
.appendTo(bg)
|
||||||
.click(function(evt) {
|
.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
refresh(true);
|
refresh(true,true);
|
||||||
})
|
})
|
||||||
|
|
||||||
var localBranchToolbar = $('<div class="sidebar-version-control-change-header" style="text-align: right;"></div>').appendTo(localHistory.content);
|
var localBranchToolbar = $('<div class="sidebar-version-control-change-header" style="text-align: right;"></div>').appendTo(localHistory.content);
|
||||||
@ -909,6 +909,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
},
|
},
|
||||||
'git_pull_merge_conflict': function(err) {
|
'git_pull_merge_conflict': function(err) {
|
||||||
refresh(true);
|
refresh(true);
|
||||||
|
closeRemoteBox();
|
||||||
},
|
},
|
||||||
'git_connection_failed': function(err) {
|
'git_connection_failed': function(err) {
|
||||||
RED.notify("Could not connect to remote repository: "+err.toString(),"warning")
|
RED.notify("Could not connect to remote repository: "+err.toString(),"warning")
|
||||||
@ -1226,7 +1227,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh(full) {
|
function refresh(full, includeRemote) {
|
||||||
if (refreshInProgress) {
|
if (refreshInProgress) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1246,7 +1247,11 @@ RED.sidebar.versionControl = (function() {
|
|||||||
|
|
||||||
var activeProject = RED.projects.getActiveProject();
|
var activeProject = RED.projects.getActiveProject();
|
||||||
if (activeProject) {
|
if (activeProject) {
|
||||||
$.getJSON("projects/"+activeProject.name+"/status",function(result) {
|
var url = "projects/"+activeProject.name+"/status";
|
||||||
|
if (includeRemote) {
|
||||||
|
url += "?remote=true"
|
||||||
|
}
|
||||||
|
$.getJSON(url,function(result) {
|
||||||
refreshFiles(result);
|
refreshFiles(result);
|
||||||
|
|
||||||
$('#sidebar-version-control-local-branch').text(result.branches.local);
|
$('#sidebar-version-control-local-branch').text(result.branches.local);
|
||||||
|
@ -149,7 +149,9 @@ module.exports = {
|
|||||||
|
|
||||||
// Get project status - files, commit counts, branch info
|
// Get project status - files, commit counts, branch info
|
||||||
app.get("/:id/status", needsPermission("projects.read"), function(req,res) {
|
app.get("/:id/status", needsPermission("projects.read"), function(req,res) {
|
||||||
runtime.storage.projects.getStatus(req.user, req.params.id).then(function(data) {
|
var includeRemote = req.query.remote;
|
||||||
|
|
||||||
|
runtime.storage.projects.getStatus(req.user, req.params.id, includeRemote).then(function(data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
res.json(data);
|
res.json(data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -410,11 +410,11 @@ Project.prototype.revertFile = function (filePath) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Project.prototype.status = function(user) {
|
Project.prototype.status = function(user, includeRemote) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var fetchPromise;
|
var fetchPromise;
|
||||||
if (this.remotes) {
|
if (this.remotes && includeRemote) {
|
||||||
fetchPromise = gitTools.getRemoteBranch(self.path).then(function(remoteBranch) {
|
fetchPromise = gitTools.getRemoteBranch(self.path).then(function(remoteBranch) {
|
||||||
if (remoteBranch) {
|
if (remoteBranch) {
|
||||||
var allRemotes = Object.keys(self.remotes);
|
var allRemotes = Object.keys(self.remotes);
|
||||||
|
@ -247,9 +247,9 @@ function pull(user, project,remoteBranchName,setRemote,allowUnrelatedHistories)
|
|||||||
return reloadActiveProject("pull");
|
return reloadActiveProject("pull");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getStatus(user, project) {
|
function getStatus(user, project, includeRemote) {
|
||||||
checkActiveProject(project);
|
checkActiveProject(project);
|
||||||
return activeProject.status(user);
|
return activeProject.status(user, includeRemote);
|
||||||
}
|
}
|
||||||
function resolveMerge(user, project,file,resolution) {
|
function resolveMerge(user, project,file,resolution) {
|
||||||
checkActiveProject(project);
|
checkActiveProject(project);
|
||||||
|
Loading…
Reference in New Issue
Block a user