Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 369283 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.client.git/web/git/git-repository.js (-4 / +3 lines)
Lines 70-75 Link Here
70
	commandService.registerCommandContribution("eclipse.orion.git.rebase", 1000);
70
	commandService.registerCommandContribution("eclipse.orion.git.rebase", 1000);
71
	commandService.registerCommandContribution("eclipse.orion.git.resetIndex", 1000);
71
	commandService.registerCommandContribution("eclipse.orion.git.resetIndex", 1000);
72
	commandService.registerCommandContribution("eclipse.removeRemote", 1000);
72
	commandService.registerCommandContribution("eclipse.removeRemote", 1000);
73
	commandService.registerCommandContribution("eclipse.orion.git.deleteConfigEntryCommand", 1000);
74
	commandService.registerCommandContribution("eclipse.orion.git.editConfigEntryCommand", 1000);
73
	
75
	
74
	// add commands specific for the page	
76
	// add commands specific for the page	
75
	var viewAllCommand = new mCommands.Command({
77
	var viewAllCommand = new mCommands.Command({
Lines 86-95 Link Here
86
		}
88
		}
87
	});
89
	});
88
	commandService.addCommand(viewAllCommand, "dom");
90
	commandService.addCommand(viewAllCommand, "dom");
89
	
91
		
90
//	// render commands
91
//	mGitCommands.updateNavTools(serviceRegistry, explorer, "pageActions", "selectionTools", {});
92
	
93
	// process the URL to find our bindings, since we can't be sure these bindings were defined when the URL was first processed.
92
	// process the URL to find our bindings, since we can't be sure these bindings were defined when the URL was first processed.
94
	commandService.processURL(window.location.href);
93
	commandService.processURL(window.location.href);
95
	
94
	
(-)a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js (+95 lines)
Lines 1664-1669 Link Here
1664
	};
1664
	};
1665
1665
1666
	exports.createGitClonesCommands = function(serviceRegistry, commandService, explorer, toolbarId, selectionTools, fileClient) {
1666
	exports.createGitClonesCommands = function(serviceRegistry, commandService, explorer, toolbarId, selectionTools, fileClient) {
1667
		
1668
		function displayErrorOnStatus(error) {
1669
			
1670
			if (error.status === 401 || error.status === 403)
1671
				return;
1672
			
1673
			var display = [];
1674
			
1675
			display.Severity = "Error";
1676
			display.HTML = false;
1677
			
1678
			try {
1679
				var resp = JSON.parse(error.responseText);
1680
				display.Message = resp.DetailedMessage ? resp.DetailedMessage : resp.Message;
1681
			} catch (Exception) {
1682
				display.Message = error.message;
1683
			}
1684
			
1685
			serviceRegistry.getService("orion.page.message").setProgressResult(display);
1686
		}
1687
		
1688
		// Git repository configuration
1689
		
1690
		var addConfigParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter('key', 'text', 'Key:'), 
1691
		                                                               new mCommands.CommandParameter('value', 'text', 'Value:')], false);
1692
		
1693
		var addConfigEntryCommand = new mCommands.Command({
1694
			name: "New Configuration Entry",
1695
			tooltip: "Add a new entry to the repository configuration",
1696
			imageClass: "core-sprite-add",
1697
			id: "eclipse.orion.git.addConfigEntryCommand",
1698
			parameters: addConfigParameters,
1699
			callback: function(data) {
1700
				var item = data.items;
1701
				var gitService = serviceRegistry.getService("orion.git.provider");
1702
				if (data.parameters.valueFor("key") && data.parameters.valueFor("value")){
1703
					gitService.addCloneConfigurationProperty(item.Location, data.parameters.valueFor("key"), data.parameters.valueFor("value")).then(
1704
						function(jsonData){
1705
							dojo.hitch(explorer, explorer.changedItem)(item);
1706
						}, displayErrorOnStatus
1707
					);
1708
				}
1709
			}
1710
		});
1711
		commandService.addCommand(addConfigEntryCommand, "dom");
1712
		
1713
		var editConfigParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter('value', 'text', 'Value:')], false);
1714
		
1715
		var editConfigEntryCommand = new mCommands.Command({
1716
			name: "Edit",
1717
			tooltip: "Edit the configuration entry",
1718
			imageClass: "core-sprite-edit",
1719
			id: "eclipse.orion.git.editConfigEntryCommand",
1720
			parameters: editConfigParameters,
1721
			callback: function(data) {
1722
				var item = data.items;
1723
				var gitService = serviceRegistry.getService("orion.git.provider");
1724
				if (data.parameters.valueFor("value")){
1725
					gitService.editCloneConfigurationProperty(item.Location, data.parameters.valueFor("value")).then(
1726
						function(jsonData){
1727
							dojo.hitch(explorer, explorer.changedItem)(item);
1728
						}, displayErrorOnStatus
1729
					);
1730
				}
1731
			},
1732
			visibleWhen: function(item) {
1733
				return (item.Key && item.Value && item.Location);
1734
			}
1735
		});
1736
		commandService.addCommand(editConfigEntryCommand, "object");
1737
		
1738
		var deleteConfigEntryCommand = new mCommands.Command({
1739
			name: "Delete",
1740
			tooltip: "Delete the configuration entry",
1741
			imageClass: "core-sprite-delete",
1742
			id: "eclipse.orion.git.deleteConfigEntryCommand",
1743
			callback: dojo.hitch(this, function(data) {
1744
				var item = data.items;
1745
				var gitService = serviceRegistry.getService("orion.git.provider");
1746
				if (confirm("Are you sure you want to delete " + item.Key + "?")) {
1747
					gitService.deleteCloneConfigurationProperty(item.Location).then(
1748
						function(jsonData) {
1749
							dojo.hitch(explorer, explorer.changedItem)(item);
1750
						}, displayErrorOnStatus
1751
					);
1752
				}
1753
			}),
1754
			visibleWhen: function(item) {
1755
				return (item.Key && item.Value && item.Location);
1756
			}
1757
		});
1758
		commandService.addCommand(deleteConfigEntryCommand, "object");
1759
		
1760
		//
1761
		
1667
		var cloneParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter("url", "url", "Repository URL:")], true);
1762
		var cloneParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter("url", "url", "Repository URL:")], true);
1668
1763
1669
		function forceSingleItem(item) {
1764
		function forceSingleItem(item) {
(-)a/bundles/org.eclipse.orion.client.git/web/orion/git/gitRepositoryExplorer.js (-2 / +96 lines)
Lines 56-62 Link Here
56
	};
56
	};
57
	
57
	
58
	GitRepositoryExplorer.prototype.changedItem = function(parent, children) {
58
	GitRepositoryExplorer.prototype.changedItem = function(parent, children) {
59
		console.info("item changed: " + parent + " " + children);
60
		this.redisplayClonesList();
59
		this.redisplayClonesList();
61
	};
60
	};
62
	
61
	
Lines 95-101 Link Here
95
					that.displayCommits(repositories[0]);
94
					that.displayCommits(repositories[0]);
96
					that.displayBranches(repositories[0]);
95
					that.displayBranches(repositories[0]);
97
					that.displayTags(repositories[0]);
96
					that.displayTags(repositories[0]);
98
					that.displayRemotes(repositories[0]);	
97
					that.displayRemotes(repositories[0]);
98
					that.displayConfig(repositories[0]);
99
				} else if (resp.Children[0].Type === "Clone"){
99
				} else if (resp.Children[0].Type === "Clone"){
100
					var repositories = resp.Children;
100
					var repositories = resp.Children;
101
					
101
					
Lines 128-133 Link Here
128
							
128
							
129
							that.displayRepositories(repositories, "mini", true);
129
							that.displayRepositories(repositories, "mini", true);
130
							that.displayTags(repositories[0], "full");
130
							that.displayTags(repositories[0], "full");
131
						}, function () {
132
							dojo.hitch(that, that.handleError)(error);
133
						}
134
					);
135
				} else if (resp.Children[0].Type === "Config"){
136
					that.registry.getService("orion.git.provider").getGitClone(resp.CloneLocation).then(
137
						function(resp){
138
							var repositories = resp.Children;
139
							
140
							that.initTitleBar(repositories[0], "Configuration");
141
							
142
							that.displayRepositories(repositories, "mini", true);
143
							that.displayConfig(repositories[0], "full");
131
						}, function () {
144
						}, function () {
132
							dojo.hitch(that, that.handleError)(error);
145
							dojo.hitch(that, that.handleError)(error);
133
						}
146
						}
Lines 995-1000 Link Here
995
1008
996
	};
1009
	};
997
	
1010
	
1011
	// Git Config
1012
	
1013
	GitRepositoryExplorer.prototype.displayConfig = function(repository, mode){
1014
		
1015
		var configLocation = repository.ConfigLocation;
1016
	
1017
		var that = this;
1018
		
1019
		var tableNode = dojo.byId( 'table' );
1020
1021
		var titleWrapper = dojo.create( "div", {"class":"auxpaneHeading sectionWrapper toolComposite", "id":"configSectionHeader"}, tableNode );
1022
		
1023
		dojo.create( "div", { id: "configSectionTitle", "class":"layoutLeft", innerHTML: "Configuration" }, titleWrapper );
1024
		dojo.create( "div", { id: "configSectionActionsArea", "class":"layoutRight sectionActions"}, titleWrapper );
1025
		dojo.create( "div", { id: "viewAllConfigSectionActionsArea", "class":"layoutRight sectionActions"}, titleWrapper );
1026
1027
		var parentId = "configSectionHeader";
1028
		
1029
		var slideout = 
1030
			'<div id="' + parentId + 'slideContainer" class="layoutBlock slideParameters slideContainer">' +
1031
				'<span id="' + parentId + 'slideOut" class="slide">' +
1032
				   '<span id="' + parentId + 'pageCommandParameters" class="parameters"></span>' +
1033
				   '<span id="' + parentId + 'pageCommandDismiss" class="parametersDismiss"></span>' +
1034
				'</span>' +
1035
			'</div>';
1036
	
1037
	
1038
		dojo.place( slideout, titleWrapper );
1039
		
1040
		if (mode === "full"){
1041
			this.commandService.registerCommandContribution("eclipse.orion.git.addConfigEntryCommand", 1000, "configSectionActionsArea");
1042
			this.commandService.renderCommands(dojo.byId("configSectionActionsArea"), "dom", repository, this, "button");
1043
		}
1044
		
1045
		var content =	
1046
			'<div class="git-table">' +
1047
				'<div class="plugin-settings">' +
1048
					'<list id="configNode" class="plugin-settings-list"></list>' +
1049
				'</div>' +
1050
			'</div>';
1051
		
1052
		dojo.place( content, tableNode );
1053
				
1054
		this.registry.getService("orion.git.provider").getGitCloneConfig(configLocation).then(
1055
			function(resp){
1056
				var configurationEntries = resp.Children;
1057
				
1058
				if (mode !== "full" && configurationEntries.length !== 0){
1059
					that.commandService.registerCommandContribution("eclipse.orion.git.repositories.viewAllCommand", 10, "viewAllConfigSectionActionsArea");
1060
					that.commandService.renderCommands(dojo.byId("viewAllConfigSectionActionsArea"), "dom", 
1061
						{"ViewAllLink":"/git/git-repository.html#" + configLocation, "ViewAllLabel":"View All", "ViewAllTooltip":"View all configuration entries"}, that, "button");
1062
				}
1063
				
1064
				if (configurationEntries.length === 0){
1065
					dojo.byId("configSectionTitle").innerHTML = "No Configuration";
1066
					return;
1067
				}
1068
				
1069
				for(var i=0; i<configurationEntries.length ;i++){
1070
					if (mode === "full" || configurationEntries[i].Key.indexOf("user.") !== -1)
1071
						that.renderConfigEntry(configurationEntries[i], i);
1072
				};
1073
			}, function(error){
1074
				dojo.hitch(that, that.handleError)(error);
1075
			}
1076
		);
1077
	};
1078
	
1079
	GitRepositoryExplorer.prototype.renderConfigEntry = function(configEntry, index){
1080
		var extensionListItem = dojo.create( "div", { "class":"git-list-item " + ((index % 2) ? "darkTreeTableRow" : "lightTreeTableRow")  }, dojo.byId("configNode") );
1081
		var horizontalBox = dojo.create( "div", null, extensionListItem );
1082
		
1083
		var detailsView = dojo.create( "div", { "class":"stretch"}, horizontalBox );
1084
		dojo.create( "span", { "class":"gitMainDescription", innerHTML: configEntry.Key }, detailsView );
1085
		dojo.create( "span", { "class":"gitSecondaryDescription", "style":"margin-left:20px", innerHTML: configEntry.Value}, detailsView );
1086
1087
		var actionsArea = dojo.create( "div", {"id":"configActionsArea", "class":"git-action-area" }, horizontalBox );
1088
		this.commandService.renderCommands(actionsArea, "object", configEntry, this, "tool");
1089
1090
	};
1091
	
998
	return GitRepositoryExplorer;
1092
	return GitRepositoryExplorer;
999
}());
1093
}());
1000
1094

Return to bug 369283