summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMalgorzata Janczarska2011-05-23 10:51:05 (EDT)
committer Malgorzata Janczarska2011-05-23 10:51:05 (EDT)
commit2ececa19c69a95094ea43756dd463db26fe5a297 (patch)
treecd13c6f39dc8642fe8d13fee2f15aa4dde021f3a
parent31d43dcda610ec1d62cacae9201b73ae5411c9c8 (diff)
downloadorg.eclipse.orion.client-2ececa19c69a95094ea43756dd463db26fe5a297.zip
org.eclipse.orion.client-2ececa19c69a95094ea43756dd463db26fe5a297.tar.gz
org.eclipse.orion.client-2ececa19c69a95094ea43756dd463db26fe5a297.tar.bz2
Bug 345919 - [client][git] Change Git clone UI for new API
-rw-r--r--bundles/org.eclipse.orion.client.git/static/js/gitClient.js18
-rw-r--r--bundles/org.eclipse.orion.client.git/static/js/gitCommands.js32
2 files changed, 47 insertions, 3 deletions
diff --git a/bundles/org.eclipse.orion.client.git/static/js/gitClient.js b/bundles/org.eclipse.orion.client.git/static/js/gitClient.js
index 1851a15..ed08fe5 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/gitClient.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/gitClient.js
@@ -81,6 +81,24 @@ eclipse.GitService = (function() {
console.error("Not implemented yet");
},
+ removeGitRepository : function(repositoryLocation){
+ return dojo.xhrDelete({
+ url : repositoryLocation,
+ headers : {
+ "Orion-Version" : "1"
+ },
+ handleAs : "json",
+ timeout : 5000,
+ load : function(jsonData, secondArg) {
+ return jsonData;
+ },
+ error : function(error, ioArgs) {
+ handleGetAuthenticationError(this, ioArgs);
+ console.error("HTTP status code: ", ioArgs.xhr.status);
+ }
+ });
+ },
+
getDiffContent: function(diffURI , onLoad , onError){
var service = this;
dojo.xhrGet({
diff --git a/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js b/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
index 92af23e..53dfee4 100644
--- a/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
+++ b/bundles/org.eclipse.orion.client.git/static/js/gitCommands.js
@@ -525,14 +525,40 @@ dojo.require("widgets.GitCredentialsDialog");
return false;
}
for (var i=0; i < items.length; i++) {
- if (!items[i].Location) {
+ if (!items[i].ContentLocation) {
return false;
}
}
- return false; //TODO enable this command when deleting clones is implemented
+ return true;
},
callback: function(item) {
- window.alert("Cannot delete " + item.name + ", deleting is not implented yet!");
+ if(dojo.isArray(item)){
+ if(confirm("Are you sure you want do delete " + item.length + " repositories?")){
+ var alreadyDeleted = 0;
+ for(var i=0; i<item.length; i++){
+ serviceRegistry.getService("IGitService").then(function(gitService) {
+ gitService.removeGitRepository(item[i].Location).then(
+ function(jsonData){
+ alreadyDeleted++;
+ if(alreadyDeleted >= item.length && explorer.redisplayClonesList){
+ dojo.hitch(explorer, explorer.redisplayClonesList)();
+ }
+ });
+ });
+ }
+ }
+ } else {
+ if(confirm("Are you sure you want to delete " + item.Name + "?"))
+ serviceRegistry.getService("IGitService").then(function(gitService) {
+ gitService.removeGitRepository(item.Location).then(
+ function(jsonData){
+ if(explorer.redisplayClonesList){
+ dojo.hitch(explorer, explorer.redisplayClonesList)();
+ }
+ });
+ });
+ }
+
}});
commandService.addCommand(deleteCommand, "object");
commandService.addCommand(deleteCommand, "dom");