summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEdyta Przymus2012-08-14 07:03:44 (EDT)
committer Szymon Brandys2012-08-17 06:28:39 (EDT)
commit00bf9d6eccee1913f4079fa4af0b2dd955fb275e (patch)
tree236a7aab79d491a0145e0174512a74c39a7c2770
parent146f9214d56fd04fd2b568659018784e9d3b2a63 (diff)
downloadorg.eclipse.orion.client-00bf9d6eccee1913f4079fa4af0b2dd955fb275e.zip
org.eclipse.orion.client-00bf9d6eccee1913f4079fa4af0b2dd955fb275e.tar.gz
org.eclipse.orion.client-00bf9d6eccee1913f4079fa4af0b2dd955fb275e.tar.bz2
Bug 386825 - Merge 'Pull Request Url' and 'Ask for review' actionsv20120817-1028
-rw-r--r--bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js8
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js91
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/widgets/GetPullRequestUrlDialog.js11
-rw-r--r--bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/GetPullRequestUrlDialog.html15
4 files changed, 64 insertions, 61 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js b/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js
index 43748b3..489c600 100644
--- a/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js
+++ b/bundles/org.eclipse.orion.client.git/web/git/nls/root/gitmessages.js
@@ -346,9 +346,7 @@ define({
"Merge Squash": "Merge Squash",
"Squash the content of the branch to the index" : "Squash the content of the branch to the index",
"Local Branch Name:" : "Local Branch Name:",
- "Pull Request url for this commit" : "Pull Request url for this commit",
- "Pull Request" : "Pull Request",
- "Pull Request Url" : "Pull Request Url",
+ "Paste link in email or IM" : "Paste link in email or IM",
"Show Commit in GitHub" : "Show Commit in GitHub",
"Show Repository in GitHub" : "Show Repository in GitHub",
"Show this commit in GitHub": "Show this commit in GitHub",
@@ -358,5 +356,7 @@ define({
"Show this repository in eclipse.org":"Show this repository in eclipse.org",
"Ask for review" : "Ask for review",
"Ask for review tooltip" : "Send email with request for commit review",
- "Reviewer name" : "Reviewer name"
+ "Reviewer name" : "Reviewer name",
+ "Contribution Review Request" : "Contribution Review Request",
+ "or sent the link to the reviewer" : "or sent the link to the reviewer"
});
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 b12de47..e0a5591 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
@@ -1689,7 +1689,7 @@ var exports = {};
});
commandService.addCommand(removeTagCommand);
- var notificationParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter('reviewer', 'text', messages["Reviewer name"])]); //$NON-NLS-1$ //$NON-NLS-0$
+ var notificationParameters = new mCommands.ParametersDescription([new mCommands.CommandParameter('reviewer', 'text', messages["Reviewer name"])], {hasOptionalParameters: true}); //$NON-NLS-1$ //$NON-NLS-0$
var askForReviewCommand = new mCommands.Command({
name: messages["Ask for review"],
@@ -1698,31 +1698,47 @@ var exports = {};
id: "eclipse.orion.git.askForReviewCommand", //$NON-NLS-0$
parameters: notificationParameters,
callback: function(data) {
+ var sendNotificationFunction = function(reviewerName){
+ var item = data.items;
+ var headLocation = item.Location.replace(item.Name, "HEAD");
+ var authorName = item.AuthorName;
+ var commitName = item.Name;
+ var commitMessage = item.Message;
+ serviceRegistry.getService("orion.git.provider").getGitClone(item.CloneLocation).then(
+ function(clone){
+ var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
+ var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length);
+ var pullRequestUrl = orionHome + "/git/pullRequest.html#" + clone.Children[0].GitUrl + "_" + item.Name;
+ serviceRegistry.getService("orion.git.provider").sendCommitReviewRequest(commitName, headLocation, reviewerName, pullRequestUrl, authorName, commitMessage).then(
+ function(result) {
+ var display = {};
+ display.Severity = "Ok"; //$NON-NLS-0$
+ display.HTML = false;
+ display.Message = result.Result;
+ serviceRegistry.getService("orion.page.message").setProgressResult(display);
+ }, displayErrorOnStatus
+ );
+ }
+ );
+ };
+ if (data.parameters.valueFor("reviewer") && !data.parameters.optionsRequested) { //$NON-NLS-0$
+ sendNotificationFunction(data.parameters.valueFor("reviewer")); //$NON-NLS-0$
+ } else {
var item = data.items;
-
- var headLocation = item.Location.replace(item.Name, "HEAD");
- var authorName = item.AuthorName;
- var commitName = item.Name;
- var commitMessage = item.Message;
- var reviewerName = data.parameters.valueFor("reviewer");
-
serviceRegistry.getService("orion.git.provider").getGitClone(item.CloneLocation).then(
function(clone){
- var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
+ var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length);
var pullRequestUrl = orionHome + "/git/pullRequest.html#" + clone.Children[0].GitUrl + "_" + item.Name;
-
- serviceRegistry.getService("orion.git.provider").sendCommitReviewRequest(commitName, headLocation, reviewerName, pullRequestUrl, authorName, commitMessage).then(
- function(result) {
- var display = {};
- display.Severity = "Ok"; //$NON-NLS-0$
- display.HTML = false;
- display.Message = result.Result;
- serviceRegistry.getService("orion.page.message").setProgressResult(display);
- }, displayErrorOnStatus
- );
- }
- );
+ var dialog = new orion.git.widgets.GetPullRequestUrlDialog({
+ title: messages["Contribution Review Request"],
+ url: pullRequestUrl,
+ func: sendNotificationFunction
+ });
+ dialog.startup();
+ dialog.show();
+ },displayErrorOnStatus);
+ }
},
visibleWhen: function(item) {
return item.Type === "Commit"; //$NON-NLS-0$
@@ -1809,39 +1825,6 @@ var exports = {};
}
});
commandService.addCommand(cherryPickCommand);
-
- var getPullRequestUrlCommand = new mCommands.Command({
- name : messages["Pull Request Url"],
- tooltip: messages["Pull Request url for this commit"],
- id : "eclipse.orion.git.getPullRequestUrl", //$NON-NLS-0$
- imageClass: "git-sprite-cherry_pick", //$NON-NLS-0$
- spriteClass: "gitCommandSprite", //$NON-NLS-0$
- callback: function(data) {
- var service = serviceRegistry.getService("orion.git.provider");
- service.getGitClone(data.items.CloneLocation).then(
- function(clone){
- var url = clone.Children[0].GitUrl;
- var sha1 = data.items.Name;
-
- var nonHash = window.location.href.split('#')[0]; //$NON-NLS-0$
- var orionHome = nonHash.substring(0, nonHash.length - window.location.pathname.length);
-
- var pullRequestUrl = orionHome + "/git/pullRequest.html#" + url + "_" + sha1;
- var dialog = new orion.git.widgets.GetPullRequestUrlDialog({
- title: messages["Pull Request"],
- url: pullRequestUrl
- });
- dialog.startup();
- dialog.show();
- }
- );
- },
- visibleWhen : function(item) {
- return item.Type === "Commit"; //$NON-NLS-0$
- }
- });
-
- commandService.addCommand(getPullRequestUrlCommand);
};
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/GetPullRequestUrlDialog.js b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/GetPullRequestUrlDialog.js
index 78fb4c1..976e234 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/GetPullRequestUrlDialog.js
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/GetPullRequestUrlDialog.js
@@ -42,8 +42,9 @@ var GetPullRequestUrlDialog = dojo.declare("orion.git.widgets.GetPullRequestUrlD
/** @private */
postMixInProperties : function() {
- this.options.title = this.options.title || messages["Pull Request"];
- this.selectFile = messages["Pull Request url for this commit"];
+ this.options.title = this.options.title || messages["Contribution Review Request"];
+ this.selectFile = messages["Paste link in email or IM"];
+ this.reviewerName = messages["or sent the link to the reviewer"];
this.inherited(arguments);
},
@@ -67,6 +68,12 @@ var GetPullRequestUrlDialog = dojo.declare("orion.git.widgets.GetPullRequestUrlD
onHide: function() {
clearTimeout(this.timeoutId);
this.inherited(arguments);
+ },
+
+ execute: function() {
+ if(this.options.func)
+ this.options.func(this.ReviewerName.value);
+ delete this.options.func; //prevent performing this action twice (IE)
}
});
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/GetPullRequestUrlDialog.html b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/GetPullRequestUrlDialog.html
index 17027db..190a674 100644
--- a/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/GetPullRequestUrlDialog.html
+++ b/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/templates/GetPullRequestUrlDialog.html
@@ -15,9 +15,22 @@
<div style="display:table-row">
<div style="display:table-cell; padding:5;">
<input type="text" dojoType="dijit.form.TextBox" dojoAttachPoint="PullReqUrl"
- style="width:80em;">
+ style="width:30em;">
</div>
</div>
+ <br>
+ <div style="display:table-row">
+ <div style="display:table-cell; padding:5;">
+ <label for="ReviewerName" style="padding-right:10">${reviewerName}</label>
+ </div>
+ </div>
+ <div style="display: block; padding: 5; clear: both; text-align: left">
+ <input type="text" dojoType="dijit.form.TextBox" dojoAttachPoint="ReviewerName"
+ style="width:15em;" placeholder="Reviewer name">
+ </div>
+ <button dojoAttachPoint="AskForReview" dojoType="dijit.form.Button" type="submit" value="OK" style="padding: 20 0 10 0; float: right; clear: both;">Submit
+ </button>
+ <br>
</div>
</div>
</div> \ No newline at end of file