summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPiotr Janik2011-06-08 10:38:52 (EDT)
committer Szymon Brandys2011-06-08 10:38:52 (EDT)
commit4841ea05b633ccc15a94b9a6202c3f22479031bf (patch)
tree76250a1da9550e24ffef7abe2cd4a163164f55b3
parent27b7b3413b04163404e4f1edd59548f1fca5473b (diff)
downloadorg.eclipse.orion.client-4841ea05b633ccc15a94b9a6202c3f22479031bf.zip
org.eclipse.orion.client-4841ea05b633ccc15a94b9a6202c3f22479031bf.tar.gz
org.eclipse.orion.client-4841ea05b633ccc15a94b9a6202c3f22479031bf.tar.bz2
bug 347313 - [client] Add UI to change Git repo configuration
https://bugs.eclipse.org/bugs/show_bug.cgi?id=347313
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-clone.css4
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-clone.html17
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/git-clone.js44
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/git-clone-details.js84
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/git-clones-explorer.js19
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js18
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js15
7 files changed, 189 insertions, 12 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-clone.css b/bundles/org.eclipse.orion.client.git/web/git/git-clone.css
index d5a48c9..411c74a 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-clone.css
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-clone.css
@@ -8,10 +8,14 @@
@import "../org.dojotoolkit/dijit/themes/nihilo/form/Button.css";
+@import "../org.dojotoolkit/dojox/layout/resources/ToggleSplitter.css";
+
@import "../css/ide.css";
@import "css/git.css";
+@import "../css/customsplitter.css";
+
@import "../css/breadcrumbs.css";
@import "../css/commands.css"; \ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-clone.html b/bundles/org.eclipse.orion.client.git/web/git/git-clone.html
index be027cd..65572cd 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-clone.html
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-clone.html
@@ -51,10 +51,17 @@
<div class="toolbar" id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
</div>
- <div class="mainpane" style="margin-left: 44px; " id="rightPane" dojoType="dijit.layout.ContentPane" region="center" splitter="false">
- <div id="explorer-tree" class="navigator" style="margin-left: 16px">
- <div id="clonesList" style="min-width: 500px">
- <div id="clonesProgress">Loading git clones...</div>
+ <div id="orion.innerNavigator" dojoType="orion.widgets.eWebBorderContainerReverse" region="center" design="headline" liveSplitters="true" persist="true" gutters="false" style="overflow: hidden; margin-left: 44px; background: #c5c5c5;">
+ <div class="auxpane" id="detailsPane" dojoType="dijit.layout.ContentPane" region="trailing" style="width: 20%; overflow: auto" splitter="true">
+ <div id="cloneDetails" style="margin-left: 16px; min-width: 200px">
+ <div id="cloneDetailsPane"></div>
+ </div>
+ </div>
+ <div class="mainpane" id="rightPane" dojoType="dijit.layout.ContentPane" region="center" splitter="false">
+ <div id="explorer-tree" class="navigator" style="margin-left: 16px">
+ <div id="clonesList" style="min-width: 500px">
+ <div id="clonesProgress">Loading git clones...</div>
+ </div>
</div>
</div>
</div>
@@ -62,4 +69,4 @@
</div>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/bundles/org.eclipse.orion.client.git/web/git/git-clone.js b/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
index bb7e45c..afc4056 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
+++ b/bundles/org.eclipse.orion.client.git/web/git/git-clone.js
@@ -12,10 +12,10 @@ var eclipse;
/*browser:true*/
define(['dojo', 'orion/serviceregistry', 'orion/preferences', 'orion/pluginregistry', 'orion/status', 'orion/commands',
'orion/auth', 'orion/dialogs', 'orion/users', 'orion/selection', 'orion/fileClient', 'orion/searchClient', 'orion/globalCommands', 'orion/git/gitClient',
- 'orion/ssh/sshTools', 'orion/git/git-clones-explorer', 'orion/git/gitCommands',
- 'dojo/parser', 'dojo/hash', 'dijit/layout/BorderContainer', 'dijit/layout/ContentPane'],
+ 'orion/ssh/sshTools', 'orion/git/git-clone-details', 'orion/git/git-clones-explorer', 'orion/git/gitCommands',
+ 'dojo/parser', 'dojo/hash', 'dijit/layout/BorderContainer', 'dijit/layout/ContentPane', 'orion/widgets/eWebBorderContainer'],
function(dojo, mServiceregistry, mPreferences, mPluginRegistry, mStatus, mCommands, mAuth, mDialogs, mUsers, mSelection, mFileClient,
- mSearchClient, mGlobalCommands, mGitClient, mSshTools, mGitClonesExplorer, mGitCommands) {
+ mSearchClient, mGlobalCommands, mGitClient, mSshTools, mGitCloneDetails, mGitClonesExplorer, mGitCommands) {
dojo.addOnLoad(function() {
document.body.style.visibility = "visible";
@@ -54,13 +54,17 @@ dojo.addOnLoad(function() {
commandService.registerCommandContribution("eclipse.addRemote", 2);
commandService.registerCommandContribution("eclipse.removeRemote", 2);
commandService.registerCommandContribution("eclipse.openGitLog", 2);
+ commandService.registerCommandContribution("eclipse.openCloneContent", 2);
commandService.registerCommandContribution("eclipse.orion.git.fetch", 2);
commandService.registerCommandContribution("eclipse.orion.git.merge", 2);
commandService.registerCommandContribution("eclipse.orion.git.push", 2);
commandService.registerCommandContribution("eclipse.orion.git.pushto", 3);
commandService.registerCommandContribution("eclipse.orion.git.resetIndex", 4);
- var explorer = new mGitClonesExplorer.GitClonesExplorer(serviceRegistry, selection, "clonesList", "pageActions", "selectionTools");
+ // Clone details
+ var cloneDetails = new mGitCloneDetails.CloneDetails({parent: "cloneDetailsPane", serviceRegistry: serviceRegistry, detailsPane: dijit.byId("orion.innerNavigator")});
+
+ var explorer = new mGitClonesExplorer.GitClonesExplorer(serviceRegistry, selection, cloneDetails, "clonesList", "pageActions", "selectionTools");
mGlobalCommands.generateBanner("toolbar", serviceRegistry, commandService, preferenceService, searcher, explorer);
@@ -128,6 +132,36 @@ dojo.addOnLoad(function() {
});
-
+ makeRightPane(navigator);
});
+
+function makeRightPane(explorer){
+ // set up the splitter bar and its key binding
+ var splitArea = dijit.byId("orion.innerNavigator");
+
+ //by default the pane should be closed
+ if(splitArea.isRightPaneOpen()){
+ splitArea.toggle();
+ }
+
+ var bufferedSelection = [];
+
+ window.document.onkeydown = function (evt){
+ evt = evt || window.event;
+ var handled = false;
+ if(evt.ctrlKey && evt.keyCode === 79){ // Ctrl+o handler for toggling outline
+ splitArea.toggle();
+ handled = true;
+ }
+ if (handled) {
+ if (window.document.all) {
+ evt.keyCode = 0;
+ } else {
+ evt.preventDefault();
+ evt.stopPropagation();
+ }
+ }
+ };
+}
+
});
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/git-clone-details.js b/bundles/org.eclipse.orion.client.git/web/orion/git/git-clone-details.js
new file mode 100644
index 0000000..d7943a4
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/git-clone-details.js
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+/*global dijit dojo window document eclipse:true setTimeout */
+/*jslint forin:true*/
+
+define(['dojo', 'orion/commands'], function(dojo, mCommands) {
+
+var exports = {};
+
+exports.CloneDetails = (function() {
+ function CloneDetails(options) {
+ var parent = options.parent;
+ if (typeof(parent) === "string") {
+ parent = dojo.byId(parent);
+ }
+ if (!parent) { throw "no parent"; }
+ if (!options.serviceRegistry) {throw "no service registry"; }
+ this._parent = parent;
+ this._registry = options.serviceRegistry;
+ this._detailsPane = options.detailsPane;
+ }
+
+ CloneDetails.prototype = {
+ loadCloneDetails: function(configPath){
+
+ if(this._detailsPane){ //open details pane each time loading new details
+ if(!this._detailsPane.isRightPaneOpen()){
+ this._detailsPane.toggle();
+ }
+ this._detailsPane.style.overflow = "hidden";
+ }
+
+ var self = this;
+ this._registry.getService("orion.git.provider").then(function(service) {
+ service.getGitCloneConfig(configPath).then(function(item) {
+ self.render(item);
+ });
+ });
+ },
+
+ render: function(cloneDetails) {
+
+ // clone details table
+ var cloneMetaTable = dojo.create("table", {id: "cloneMetaTable"});
+ dojo.addClass(cloneMetaTable, "cloneMetaTable");
+
+ // heading
+ var thead = dojo.create("thead", null, cloneMetaTable);
+ var row = dojo.create("tr", null, thead);
+ var headCol = dojo.create("td", {colspan: 2}, row);
+ dojo.addClass(headCol, "paneHeadingContainer");
+ dojo.place("<span class='paneHeading'>Repository configuration</span>", headCol, "only");
+
+ if (cloneDetails != null){
+
+ // clone config
+ var tr, col1, col2;
+ var tbody = dojo.create("tbody", null, cloneMetaTable);
+
+ for (i in cloneDetails.Children) {
+ tr = dojo.create("tr");
+ col1 = dojo.create("td", {style: "padding-left: 5px; padding-right: 5px"}, tr, "last");
+ dojo.place(document.createTextNode(cloneDetails.Children[i].Key), col1, "only");
+ col2 = dojo.create("td", null, tr, "last");
+ dojo.place(document.createTextNode(cloneDetails.Children[i].Value), col2, "only");
+ dojo.place(tr, tbody, "last");
+ }
+ }
+
+ dojo.place(cloneMetaTable, this._parent, "only");
+ }
+ };
+ return CloneDetails;
+})();
+return exports;
+}); \ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/git-clones-explorer.js b/bundles/org.eclipse.orion.client.git/web/orion/git/git-clones-explorer.js
index 70b97c0..ab61b63 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/git-clones-explorer.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/git-clones-explorer.js
@@ -15,12 +15,13 @@ var exports = {};
exports.GitClonesExplorer = (function() {
- function GitClonesExplorer(registry, selection, parentId, toolbarId, selectionToolsId){
+ function GitClonesExplorer(registry, selection, cloneDetails, parentId, toolbarId, selectionToolsId){
this.parentId = parentId;
this.registry = registry;
this.selection = selection;
this.toolbarId = toolbarId;
this.selectionToolsId = selectionToolsId;
+ this.cloneDetails = cloneDetails;
this.renderer = new exports.GitClonesRenderer({checkbox: this.checkbox}, this);
}
@@ -74,6 +75,10 @@ exports.GitClonesExplorer = (function() {
dojo.hitch(self, self.createTree(self.parentId, new exports.GitClonesModel(service, gitPath, service.getGitClone)));
});
};
+
+ GitClonesExplorer.prototype.loadCloneDetails = function(clone) {
+ this.cloneDetails.loadCloneDetails(clone.ConfigLocation);
+ };
return GitClonesExplorer;
}());
@@ -207,7 +212,17 @@ exports.GitClonesRenderer = (function(){
// defined in ExplorerRenderer. Sets up the expand/collapse behavior
this.getExpandImage(tableRow, div, "/git/images/git-repository.gif");
- link = dojo.create("a", {innerHTML: item.Name, className: "navlinkonpage", href: "/navigate/table.html#" + item.ContentLocation+"?depth=1"}, div, "last");
+ //link = dojo.create("a", {innerHTML: item.Name, className: "navlinkonpage", href: "/navigate/table.html#" + item.ContentLocation+"?depth=1"}, div, "last");
+ link = dojo.create("a", {className: "navlinkonpage"}, div, "last");
+ dojo.connect(link, "onclick", link, dojo.hitch(this, function() {
+ this.explorer.loadCloneDetails(item);
+ }));
+ dojo.connect(link, "onmouseover", link, function() {
+ link.style.cursor = /*self._controller.loading ? 'wait' :*/"pointer";
+ });
+ dojo.connect(link, "onmouseout", link, function() {
+ link.style.cursor = /*self._controller.loading ? 'wait' :*/"default";
+ });
dojo.place(document.createTextNode(item.Name), link, "only");
} else if (item.GroupNode){
col = document.createElement('td');
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
index c41c17a..7a26786 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
@@ -348,6 +348,24 @@ eclipse.GitService = (function() {
}
});
},
+ getGitCloneConfig : function(gitCloneConfigURI) {
+ var service = this;
+ return dojo.xhrGet({
+ url : gitCloneConfigURI,
+ headers : {
+ "Orion-Version" : "1"
+ },
+ handleAs : "json",
+ timeout : 5000,
+ load : function(jsonData, secondArg) {
+ return jsonData;
+ },
+ error : function(error, ioArgs) {
+ mAuth.handleGetAuthenticationError(this, ioArgs);
+ console.error("HTTP status code: ", ioArgs.xhr.status);
+ }
+ });
+ },
getGitBranch : function(gitBranchURI) {
var service = this;
return dojo.xhrGet({
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
index 0add92a..8543c49 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
@@ -328,6 +328,21 @@ var exports = {};
commandService.addCommand(openGitLog, "object");
+ var openCloneContent = new mCommands.Command({
+ name : "Show in Navigator",
+ id : "eclipse.openCloneContent",
+ hrefCallback : function(item) {
+ return "/navigate/table.html#" + item.ContentLocation+"?depth=1";
+ },
+ visibleWhen : function(item) {
+ if (!item.ContentLocation)
+ return false;
+ return true;
+ }
+ });
+
+ commandService.addCommand(openCloneContent, "object");
+
var compareGitCommits = new mCommands.Command({
name : "Compare With Each Other",
image : "/git/images/compare-sbs.gif",