Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push, pull and fetch features #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/share/git-webui/webui/css/git-webui.less
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ body {
content: url(/img/daemon.svg);
}

#sidebar-sync h4:before {
content: url(/img/mail-send-receive-symbolic.svg);
}

#sidebar-local-branches, #sidebar-remote-branches {
h4:before {
content: url(/img/branch.svg);
Expand Down Expand Up @@ -611,6 +615,7 @@ body {
}
}


#commit-explorer-view {
#commit-explorer-navigator-view {
.panel {
Expand Down
34 changes: 34 additions & 0 deletions src/share/git-webui/webui/img/folder-download-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/share/git-webui/webui/img/mail-send-receive-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions src/share/git-webui/webui/img/pull.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions src/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ webui.SideBarView = function(mainView) {
'<section id="sidebar-remote">' +
'<h4>Remote access</h4>' +
'</section>' +
'<section id="sidebar-sync">' +
'<h4>Remote sync</h4>' +
'</section>' +
'<section id="sidebar-local-branches">' +
'<h4>Local Branches</h4>' +
'</section>' +
Expand All @@ -323,13 +326,20 @@ webui.SideBarView = function(mainView) {

if (webui.viewonly) {
$("#sidebar-workspace", self.element).remove();
$("#sidebar-sync", self.element).remove();
} else {
var workspaceElement = $("#sidebar-workspace h4", self.element);
workspaceElement.click(function (event) {
$("*", self.element).removeClass("active");
workspaceElement.addClass("active");
self.mainView.workspaceView.update("stage");
});
var syncElement = $("#sidebar-sync h4", self.element);
syncElement.click(function (event) {
$("*", self.element).removeClass("active");
syncElement.addClass("active");
self.mainView.syncView.update();
});
}

var remoteElement = $("#sidebar-remote h4", self.element);
Expand Down Expand Up @@ -1710,6 +1720,49 @@ webui.RemoteView = function(mainView) {
$(".git-pull", self.element).text("git pull http://" + webui.hostname + ":" + document.location.port + "/");
};

/*
* == SyncView =======================================================
*/
webui.SyncView = function(mainView) {

var self = this;

self.show = function() {
mainView.switchTo(self.element);
};

self.update = function() {
self.show();
};

self.onPush = function() {
webui.git("push");
self.update();
}

self.onFetch = function() {
webui.git("fetch");
self.update();
}

self.onPull = function() {
webui.git("pull");
self.update();
}

self.element = $( '<div class="jumbotron">' +
'<h1>Sync between local and remote</h1>' +
'<div>' +
'<button type="button" class="btn btn-sm btn-default sync-pull"><img src="img/pull.svg" />Pull</button>' +
'<button type="button" class="btn btn-sm btn-default sync-push"><img src="img/pull.svg" style="transform: scaleY(-1);" />Push</button>' +
'<button type="button" class="btn btn-sm btn-default sync-fetch"><img src="img/folder-download-symbolic.svg" />Fetch</button>' +
'</div>' +
'</div>')[0];
$(".sync-pull", self.element).click(self.onPull);
$(".sync-push", self.element).click(self.onPush);
$(".sync-fetch", self.element).click(self.onFetch);
};

/*
* == Initialization =========================================================
*/
Expand Down Expand Up @@ -1744,6 +1797,7 @@ function MainUi() {
self.historyView = new webui.HistoryView(self);
self.remoteView = new webui.RemoteView(self);
if (!webui.viewonly) {
self.syncView = new webui.SyncView(self);
self.workspaceView = new webui.WorkspaceView(self);
}
});
Expand Down