Skip to content

The Unified and Autonomous Development Platform

Add comment container inside revision diff panel

robin shined34218831f72
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_55_fbf9ee_1x400.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644
index 0000000000..a375c54147
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_55_fbf9ee_1x400.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_65_ffffff_1x400.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644
index 0000000000..b07f8f39b9
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_65_ffffff_1x400.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_dadada_1x400.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644
index 0000000000..a72059ec14
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_dadada_1x400.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_e6e6e6_1x400.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100644
index 0000000000..623c05648c
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_75_e6e6e6_1x400.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_95_fef1ec_1x400.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100644
index 0000000000..b014e9c758
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_glass_95_fef1ec_1x400.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100644
index 0000000000..07825a586b
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_222222_256x240.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_222222_256x240.png
new file mode 100644
index 0000000000..e9c8e16ac5
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_222222_256x240.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_2e83ff_256x240.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_2e83ff_256x240.png
new file mode 100644
index 0000000000..f2bf838837
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_2e83ff_256x240.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_454545_256x240.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_454545_256x240.png
new file mode 100644
index 0000000000..d6169e8bf9
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_454545_256x240.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_888888_256x240.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_888888_256x240.png
new file mode 100644
index 0000000000..d3e6e02a03
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_888888_256x240.png differ
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_cd0a0a_256x240.png b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_cd0a0a_256x240.png
new file mode 100644
index 0000000000..4937018923
Binary files /dev/null and b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/jqueryui/images/ui-icons_cd0a0a_256x240.png differ
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
index be5bdcb05f..8a154cba74 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.java
@@ -64,6 +64,7 @@ import com.pmease.commons.wicket.behavior.inputassist.InputAssistBehavior;
import com.pmease.commons.wicket.component.menu.MenuItem;
import com.pmease.commons.wicket.component.menu.MenuLink;
import com.pmease.gitplex.core.GitPlex;
+import com.pmease.gitplex.core.entity.CodeComment;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.web.Constants;
@@ -96,6 +97,8 @@ public abstract class RevisionDiffPanel extends Panel {
private DiffViewMode diffMode;
+ private Long commentId;
+
private IModel<List<DiffEntry>> diffEntriesModel = new LoadableDetachableModel<List<DiffEntry>>() {
@Override
@@ -216,9 +219,11 @@ public abstract class RevisionDiffPanel extends Panel {
}
};
+ private WebMarkupContainer commentContainer;
+
public RevisionDiffPanel(String id, IModel<Depot> depotModel, IModel<PullRequest> requestModel,
String oldRev, String newRev, @Nullable String pathFilter,
- WhitespaceOption whitespaceOption) {
+ WhitespaceOption whitespaceOption, @Nullable Long commentId) {
super(id);
this.depotModel = depotModel;
@@ -227,6 +232,7 @@ public abstract class RevisionDiffPanel extends Panel {
this.newRev = newRev;
this.pathFilter = pathFilter;
this.whitespaceOption = whitespaceOption;
+ this.commentId = commentId;
WebRequest request = (WebRequest) RequestCycle.get().getRequest();
Cookie cookie = request.getCookie(COOKIE_VIEW_MODE);
@@ -429,7 +435,7 @@ public abstract class RevisionDiffPanel extends Panel {
});
add(form);
- WebMarkupContainer commentContainer = new WebMarkupContainer("comment") {
+ commentContainer = new WebMarkupContainer("comment") {
@Override
public void renderHead(IHeaderResponse response) {
@@ -450,9 +456,16 @@ public abstract class RevisionDiffPanel extends Panel {
});
commentContainer.add(new AjaxLink<Void>("close") {
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ super.updateAjaxAttributes(attributes);
+ attributes.getAjaxCallListeners().add(new ConfirmLeaveListener(commentContainer));
+ }
+
@Override
public void onClick(AjaxRequestTarget target) {
-
+ hideComment(target);
+ onOpenComment(target, null);
}
});
@@ -560,6 +573,13 @@ public abstract class RevisionDiffPanel extends Panel {
setOutputMarkupId(true);
}
+ private void hideComment(AjaxRequestTarget target) {
+ commentContainer.replace(new WebMarkupContainer("body"));
+ commentContainer.setVisible(false);
+ target.add(commentContainer);
+ target.appendJavaScript("gitplex.revisionDiff.onOpenComment();");
+ }
+
@Override
protected void onDetach() {
diffEntriesModel.detach();
@@ -590,6 +610,8 @@ public abstract class RevisionDiffPanel extends Panel {
protected abstract void onWhitespaceOptionChange(AjaxRequestTarget target,
WhitespaceOption whitespaceOption);
+ protected abstract void onOpenComment(AjaxRequestTarget target, @Nullable CodeComment comment);
+
private static class ChangesAndCount {
private final List<BlobChange> changes;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css
index 961886cbcd..dd9fc9b676 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.css
@@ -80,6 +80,8 @@
left: 0;
margin-right: 12px;
padding-right: 4px;
+ background: white;
+ z-index: 12;
}
.revision-diff>.body>.detail>.comment>.content>.head .locate {
margin-right: 8px;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.js
index 0ebabd866c..aff3797da9 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.js
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/revision-diff.js
@@ -28,35 +28,44 @@ gitplex.revisionDiff = {
});
});
- function onWindowResizeOrScroll() {
+ function onWindowResizeOrScroll(e) {
+ if (e && e.target && $(e.target).hasClass("ui-resizable"))
+ return;
+
var $detail = $body.children(".detail");
- var $comment = $detail.children(".comment");
- var $diffs = $detail.children(".diffs");
$detail.show();
$body.children(".loading").hide();
- $diffs.css("left", $comment.outerWidth(true));
- $diffs.outerWidth($detail.width() - $comment.outerWidth(true));
-
- var scrollTop = $(window).scrollTop();
- var commentOffset = scrollTop - $diffs.offset().top;
- if (commentOffset > 0) {
- $comment.css("top", commentOffset);
+
+ var $comment = $detail.children(".comment");
+ var $diffs = $detail.children(".diffs");
+ var diffsHeight = $diffs.outerHeight();
+ if ($comment.is(":visible")) {
+ $diffs.css("left", $comment.outerWidth(true));
+ $diffs.outerWidth($detail.width() - $comment.outerWidth(true));
+
+ var scrollTop = $(window).scrollTop();
+ var commentOffset = scrollTop - $diffs.offset().top;
+ if (commentOffset > 0) {
+ $comment.css("top", commentOffset);
+ } else {
+ $comment.css("top", 0);
+ }
+ var $lastDiff = $diffs.children().last();
+ var commentHeight = $lastDiff.offset().top + $lastDiff.height() - scrollTop;
+ var windowHeight = $(window).height();
+ var minCommentHeight = windowHeight - 100;
+ if (commentHeight < minCommentHeight)
+ commentHeight = minCommentHeight;
+ else if (commentHeight > windowHeight)
+ commentHeight = windowHeight;
+ var $commentResizeHandle = $comment.children(".ui-resizable-handle");
+ $commentResizeHandle.outerHeight(commentHeight - 2);
+ var $commentHead = $comment.find(">.content>.head");
+ $comment.find(">.content>.body").outerHeight(commentHeight-2-$commentHead.outerHeight());
} else {
- $comment.css("top", 0);
+ $diffs.css("left", "0");
+ $diffs.outerWidth($detail.width());
}
- var $lastDiff = $diffs.children().last();
- var diffsHeight = $diffs.outerHeight();
- var commentHeight = $lastDiff.offset().top + $lastDiff.height() - scrollTop;
- var windowHeight = $(window).height();
- var minCommentHeight = windowHeight - 100;
- if (commentHeight < minCommentHeight)
- commentHeight = minCommentHeight;
- else if (commentHeight > windowHeight)
- commentHeight = windowHeight;
- var $commentResizeHandle = $comment.children(".ui-resizable-handle");
- $commentResizeHandle.outerHeight(commentHeight - 2);
- var $commentHead = $comment.find(">.content>.head");
- $comment.find(">.content>.body").outerHeight(commentHeight-2-$commentHead.outerHeight());
$detail.height(commentHeight>diffsHeight?commentHeight:diffsHeight);
}
@@ -64,30 +73,35 @@ gitplex.revisionDiff = {
$(window).on("scroll resize", onWindowResizeOrScroll);
},
initComment: function() {
- var commentWidthCookieKey = "revisionDiff.comment.width";
var $comment = $(".revision-diff>.body>.detail>.comment");
- var commentWidth = Cookies.get(commentWidthCookieKey);
- if (!commentWidth)
- commentWidth = 400;
- $comment.outerWidth(commentWidth);
- var $commentResizeHandle = $comment.children(".ui-resizable-handle");
- var $diffs = $(".revision-diff>.body>.detail>.diffs");
- /*
- $comment.resizable({
- autoHide: false,
- handles: {"e": $commentResizeHandle},
- minWidth: 200,
- resize: function(e, ui) {
- var diffsWidth = $diffs.outerWidth();
- if(diffsWidth < 300)
- $(this).resizable({maxWidth: ui.size.width});
- },
- stop: function(e, ui) {
- $(this).resizable({maxWidth: undefined});
- Cookies.set(commentWidthCookieKey, ui.size.width, {expires: Infinity});
- }
- });
- */
+
+ // we do not use $comment.is(":visible") here as comment can also be invisible
+ // when its parent is not visible initially (in order not to display a weild
+ // page before we adjust the width and height of comment and diffs)
+ if ($comment.css("display") != "none") {
+ var commentWidthCookieKey = "revisionDiff.comment.width";
+ var commentWidth = Cookies.get(commentWidthCookieKey);
+ if (!commentWidth)
+ commentWidth = 400;
+ $comment.outerWidth(commentWidth);
+ var $commentResizeHandle = $comment.children(".ui-resizable-handle");
+ var $diffs = $(".revision-diff>.body>.detail>.diffs");
+ $comment.resizable({
+ autoHide: false,
+ handles: {"e": $commentResizeHandle},
+ minWidth: 200,
+ resize: function(e, ui) {
+ var diffsWidth = $diffs.outerWidth();
+ if(diffsWidth < 300)
+ $(this).resizable({maxWidth: ui.size.width});
+ },
+ stop: function(e, ui) {
+ $(this).resizable({maxWidth: undefined});
+ Cookies.set(commentWidthCookieKey, ui.size.width, {expires: Infinity});
+ $(window).resize();
+ }
+ });
+ }
},
scroll: function() {
var uri = URI(window.location.href);
@@ -100,5 +114,8 @@ gitplex.revisionDiff = {
var $fileDiff = $detail.find('li[data-file="' + file.escape() + '"]');
$(window).scrollTop($fileDiff.offset().top);
return false;
- }
+ },
+ onOpenComment: function(commentInfo) {
+ $(window).resize();
+ }
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
index de9c990195..dbc24a2fc3 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/branches/DepotBranchesPage.java
@@ -51,7 +51,6 @@ import org.eclipse.jgit.revwalk.RevWalk;
import com.google.common.base.Preconditions;
import com.pmease.commons.git.GitUtils;
import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.lang.diff.WhitespaceOption;
import com.pmease.commons.util.StringUtils;
import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;
import com.pmease.commons.wicket.behavior.OnTypingDoneBehavior;
@@ -480,13 +479,10 @@ public class DepotBranchesPage extends DepotPage {
if (request != null) {
setResponsePage(RequestOverviewPage.class, RequestOverviewPage.paramsOf(request));
} else {
- PageParameters params = RevisionComparePage.paramsOf(
- getDepot(),
- new DepotAndBranch(getDepot(), branch),
- new DepotAndBranch(getDepot(), getBaseBranch()),
- true,
- WhitespaceOption.DEFAULT,
- null);
+ RevisionComparePage.HistoryState state = new RevisionComparePage.HistoryState();
+ state.leftSide = new DepotAndBranch(getDepot(), branch);
+ state.rightSide = new DepotAndBranch(getDepot(), getBaseBranch());
+ PageParameters params = RevisionComparePage.paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
}
}
@@ -542,13 +538,10 @@ public class DepotBranchesPage extends DepotPage {
if (request != null) {
setResponsePage(RequestOverviewPage.class, RequestOverviewPage.paramsOf(request));
} else {
- PageParameters params = RevisionComparePage.paramsOf(
- getDepot(),
- new DepotAndBranch(getDepot(), getBaseBranch()),
- new DepotAndBranch(getDepot(), branch),
- true,
- WhitespaceOption.DEFAULT,
- null);
+ RevisionComparePage.HistoryState state = new RevisionComparePage.HistoryState();
+ state.leftSide = new DepotAndBranch(getDepot(), getBaseBranch());
+ state.rightSide = new DepotAndBranch(getDepot(), branch);
+ PageParameters params = RevisionComparePage.paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/CommitDetailPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/CommitDetailPage.java
index 5adacc37ee..b106ad9c03 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/CommitDetailPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/CommitDetailPage.java
@@ -42,6 +42,7 @@ import com.pmease.commons.git.GitUtils;
import com.pmease.commons.lang.diff.WhitespaceOption;
import com.pmease.commons.wicket.assets.oneline.OnelineResourceReference;
import com.pmease.gitplex.core.GitPlex;
+import com.pmease.gitplex.core.entity.CodeComment;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.core.manager.AuxiliaryManager;
@@ -69,6 +70,8 @@ public class CommitDetailPage extends DepotPage {
private static final String PARAM_PATH_FILTER = "path-filter";
+ private static final String PARAM_COMMENT = "comment";
+
protected String revision;
private HistoryState state;
@@ -295,7 +298,7 @@ public class CommitDetailPage extends DepotPage {
private void newRevisionDiff(@Nullable AjaxRequestTarget target) {
revisionDiff = new RevisionDiffPanel("revisionDiff", depotModel,
Model.of((PullRequest)null), getCompareWith(),
- getCommit().name(), state.pathFilter, state.whitespaceOption) {
+ getCommit().name(), state.pathFilter, state.whitespaceOption, state.commentId) {
@Override
protected void onPathFilterChange(AjaxRequestTarget target, String pathFilter) {
@@ -309,6 +312,12 @@ public class CommitDetailPage extends DepotPage {
state.whitespaceOption = whitespaceOption;
pushState(target);
}
+
+ @Override
+ protected void onOpenComment(AjaxRequestTarget target, CodeComment comment) {
+ state.commentId = CodeComment.idOf(comment);
+ pushState(target);
+ }
};
revisionDiff.setOutputMarkupId(true);
@@ -343,6 +352,8 @@ public class CommitDetailPage extends DepotPage {
params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
if (state.pathFilter != null)
params.set(PARAM_PATH_FILTER, state.pathFilter);
+ if (state.commentId != null)
+ params.set(PARAM_COMMENT, state.commentId);
return params;
}
@@ -378,6 +389,8 @@ public class CommitDetailPage extends DepotPage {
public String compareWith;
+ public Long commentId;
+
public WhitespaceOption whitespaceOption = WhitespaceOption.DEFAULT;
public String pathFilter;
@@ -389,6 +402,7 @@ public class CommitDetailPage extends DepotPage {
compareWith = params.get(PARAM_COMPARE_WITH).toString();
whitespaceOption = WhitespaceOption.of(params.get(PARAM_WHITESPACE_OPTION).toString());
pathFilter = params.get(PARAM_PATH_FILTER).toString();
+ commentId = params.get(PARAM_COMMENT).toOptionalLong();
}
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java
index 1ee74d2cb2..55a117bc45 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/commit/DepotCommitsPage.java
@@ -42,7 +42,6 @@ import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.pmease.commons.git.Commit;
import com.pmease.commons.git.command.LogCommand;
-import com.pmease.commons.lang.diff.WhitespaceOption;
import com.pmease.commons.util.StringUtils;
import com.pmease.commons.util.concurrent.PrioritizedCallable;
import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;
@@ -428,10 +427,12 @@ public class DepotCommitsPage extends DepotPage {
}
}
if (state.getCompareWith() != null) {
- PageParameters params = RevisionComparePage.paramsOf(getDepot(),
- new DepotAndRevision(getDepot(), commit.getHash()),
- new DepotAndRevision(getDepot(), state.getCompareWith()),
- true, WhitespaceOption.DEFAULT, path);
+ RevisionComparePage.HistoryState state = new RevisionComparePage.HistoryState();
+ state.leftSide = new DepotAndRevision(getDepot(), commit.getHash());
+ state.rightSide = new DepotAndRevision(getDepot(), DepotCommitsPage.this.state.getCompareWith());
+ state.pathFilter = path;
+
+ PageParameters params = RevisionComparePage.paramsOf(getDepot(), state);
item.add(new BookmarkablePageLink<Void>("compare", RevisionComparePage.class, params));
} else {
item.add(new WebMarkupContainer("compare").setVisible(false));
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java
index 5d73bd3852..c0ea00ff56 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/compare/RevisionComparePage.java
@@ -36,6 +36,7 @@ import com.pmease.commons.wicket.component.tabbable.AjaxActionTab;
import com.pmease.commons.wicket.component.tabbable.Tab;
import com.pmease.commons.wicket.component.tabbable.Tabbable;
import com.pmease.gitplex.core.GitPlex;
+import com.pmease.gitplex.core.entity.CodeComment;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.core.entity.component.DepotAndBranch;
@@ -61,6 +62,8 @@ public class RevisionComparePage extends DepotPage {
private static final String PARAM_WHITESPACE_OPTION = "whitespace-option";
+ private static final String PARAM_COMMENT = "comment";
+
private static final String PARAM_PATH_FILTER = "path-filter";
private static final String TAB_PANEL_ID = "tabPanel";
@@ -71,31 +74,23 @@ public class RevisionComparePage extends DepotPage {
private IModel<String> mergeBaseModel;
- private DepotAndRevision leftSide;
-
- private DepotAndRevision rightSide;
-
private AjaxActionTab commitsTab;
private AjaxActionTab filesTab;
- private boolean compareWithMergeBase;
-
- private WhitespaceOption whitespaceOption = WhitespaceOption.DEFAULT;
+ private HistoryState state = new HistoryState();
- private String pathFilter;
-
- public static PageParameters paramsOf(Depot depot, DepotAndRevision leftSide,
- DepotAndRevision rightSide, boolean compareWithMergeBase,
- WhitespaceOption whitespaceOption, @Nullable String pathFilter) {
+ public static PageParameters paramsOf(Depot depot, HistoryState state) {
PageParameters params = paramsOf(depot);
- params.set(PARAM_LEFT, leftSide.toString());
- params.set(PARAM_RIGHT, rightSide.toString());
- params.set(PARAM_COMPARE_WITH_MERGE_BASE, compareWithMergeBase);
- if (whitespaceOption != WhitespaceOption.DEFAULT)
- params.set(PARAM_WHITESPACE_OPTION, whitespaceOption.name());
- if (pathFilter != null)
- params.set(PARAM_PATH_FILTER, pathFilter);
+ params.set(PARAM_LEFT, state.leftSide.toString());
+ params.set(PARAM_RIGHT, state.rightSide.toString());
+ params.set(PARAM_COMPARE_WITH_MERGE_BASE, state.compareWithMergeBase);
+ if (state.whitespaceOption != WhitespaceOption.DEFAULT)
+ params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
+ if (state.pathFilter != null)
+ params.set(PARAM_PATH_FILTER, state.pathFilter);
+ if (state.commentId != null)
+ params.set(PARAM_COMMENT, state.commentId);
return params;
}
@@ -107,29 +102,29 @@ public class RevisionComparePage extends DepotPage {
String str = params.get(PARAM_RIGHT).toString();
if (str != null) {
- rightSide = new DepotAndRevision(str);
+ state.rightSide = new DepotAndRevision(str);
} else {
- rightSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());
+ state.rightSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());
}
str = params.get(PARAM_LEFT).toString();
if (str != null) {
- leftSide = new DepotAndRevision(str);
+ state.leftSide = new DepotAndRevision(str);
} else {
- leftSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());
+ state.leftSide = new DepotAndRevision(getDepot(), getDepot().getDefaultBranch());
}
- compareWithMergeBase = params.get(PARAM_COMPARE_WITH_MERGE_BASE).toBoolean(false);
+ state.compareWithMergeBase = params.get(PARAM_COMPARE_WITH_MERGE_BASE).toBoolean(false);
- pathFilter = params.get(PARAM_PATH_FILTER).toString();
- whitespaceOption = WhitespaceOption.of(params.get(PARAM_WHITESPACE_OPTION).toString());
+ state.pathFilter = params.get(PARAM_PATH_FILTER).toString();
+ state.whitespaceOption = WhitespaceOption.of(params.get(PARAM_WHITESPACE_OPTION).toString());
requestModel = new LoadableDetachableModel<PullRequest>() {
@Override
protected PullRequest load() {
- DepotAndBranch left = new DepotAndBranch(leftSide.toString());
- DepotAndBranch right = new DepotAndBranch(rightSide.toString());
+ DepotAndBranch left = new DepotAndBranch(state.leftSide.toString());
+ DepotAndBranch right = new DepotAndBranch(state.rightSide.toString());
return GitPlex.getInstance(PullRequestManager.class).findOpen(left, right);
}
@@ -139,20 +134,20 @@ public class RevisionComparePage extends DepotPage {
@Override
protected String load() {
- Depot leftDepot = leftSide.getDepot();
- Depot rightDepot = rightSide.getDepot();
+ Depot leftDepot = state.leftSide.getDepot();
+ Depot rightDepot = state.rightSide.getDepot();
if (!leftDepot.equals(rightDepot)) {
Git sandbox = new Git(FileUtils.createTempDir());
try {
- sandbox.clone(leftDepot.git(), false, true, true, leftSide.getRevision());
+ sandbox.clone(leftDepot.git(), false, true, true, state.leftSide.getRevision());
sandbox.reset(null, null);
- sandbox.fetch(rightDepot.git(), rightSide.getRevision());
- return sandbox.calcMergeBase(leftSide.getCommit().name(), rightSide.getCommit().name());
+ sandbox.fetch(rightDepot.git(), state.rightSide.getRevision());
+ return sandbox.calcMergeBase(state.leftSide.getCommit().name(), state.rightSide.getCommit().name());
} finally {
FileUtils.deleteDir(sandbox.depotDir());
}
} else {
- return leftDepot.getMergeBase(leftSide.getRevision(), rightSide.getRevision()).name();
+ return leftDepot.getMergeBase(state.leftSide.getRevision(), state.rightSide.getRevision()).name();
}
}
@@ -162,15 +157,15 @@ public class RevisionComparePage extends DepotPage {
@Override
protected List<Commit> load() {
- Depot sourceDepot = leftSide.getDepot();
+ Depot sourceDepot = state.leftSide.getDepot();
LogCommand log = new LogCommand(sourceDepot.git().depotDir());
List<Commit> commits;
- if (!compareWithMergeBase) {
- String revisions = leftSide.getRevision() + "..." + rightSide.getRevision();
+ if (!state.compareWithMergeBase) {
+ String revisions = state.leftSide.getRevision() + "..." + state.rightSide.getRevision();
commits = log.revisions(Lists.newArrayList(revisions)).call();
commits.add(sourceDepot.git().showRevision(mergeBaseModel.getObject()));
} else {
- commits = sourceDepot.git().log(leftSide.getRevision(), rightSide.getRevision(), null, 0, 0, false);
+ commits = sourceDepot.git().log(state.leftSide.getRevision(), state.rightSide.getRevision(), null, 0, 0, false);
}
return commits;
}
@@ -185,22 +180,26 @@ public class RevisionComparePage extends DepotPage {
setOutputMarkupId(true);
- add(new AffinalRevisionPicker("leftSide", leftSide.getDepotId(), leftSide.getRevision()) {
+ add(new AffinalRevisionPicker("leftSide", state.leftSide.getDepotId(), state.leftSide.getRevision()) {
@Override
protected void onSelect(AjaxRequestTarget target, Depot depot, String revision) {
- PageParameters params = paramsOf(getDepot(), new DepotAndRevision(depot, revision),
- rightSide, compareWithMergeBase, whitespaceOption, pathFilter);
+ HistoryState state = new HistoryState(RevisionComparePage.this.state);
+ state.leftSide = new DepotAndRevision(depot, revision);
+
+ PageParameters params = paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
}
});
- add(new CheckBox("compareWithMergeBase", Model.of(compareWithMergeBase)).add(new OnChangeAjaxBehavior() {
+ add(new CheckBox("compareWithMergeBase", Model.of(state.compareWithMergeBase)).add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
- PageParameters params = RevisionComparePage.paramsOf(depotModel.getObject(),
- leftSide, rightSide, !compareWithMergeBase, whitespaceOption, pathFilter);
+ HistoryState state = new HistoryState(RevisionComparePage.this.state);
+ state.compareWithMergeBase = !state.compareWithMergeBase;
+
+ PageParameters params = RevisionComparePage.paramsOf(depotModel.getObject(), state);
setResponsePage(RevisionComparePage.class, params);
}
@@ -208,13 +207,14 @@ public class RevisionComparePage extends DepotPage {
String tooltip = "Check this to compare \"right side\" with common ancestor of left and right";
add(new WebMarkupContainer("tooltip").add(new TooltipBehavior(Model.of(tooltip))));
- add(new AffinalRevisionPicker("rightSide", rightSide.getDepotId(), rightSide.getRevision()) {
+ add(new AffinalRevisionPicker("rightSide", state.rightSide.getDepotId(), state.rightSide.getRevision()) {
@Override
protected void onSelect(AjaxRequestTarget target, Depot depot, String revision) {
- PageParameters params = paramsOf(getDepot(), leftSide,
- new DepotAndRevision(depot, revision), compareWithMergeBase,
- whitespaceOption, pathFilter);
+ HistoryState state = new HistoryState(RevisionComparePage.this.state);
+ state.rightSide = new DepotAndRevision(depot, revision);
+
+ PageParameters params = paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
}
@@ -224,8 +224,10 @@ public class RevisionComparePage extends DepotPage {
@Override
public void onClick() {
- setResponsePage(RevisionComparePage.class,paramsOf(getDepot(), rightSide, leftSide,
- compareWithMergeBase, whitespaceOption, pathFilter));
+ HistoryState state = new HistoryState(RevisionComparePage.this.state);
+ state.leftSide = RevisionComparePage.this.state.rightSide;
+ state.rightSide = RevisionComparePage.this.state.leftSide;
+ setResponsePage(RevisionComparePage.class,paramsOf(getDepot(), state));
}
});
@@ -234,8 +236,8 @@ public class RevisionComparePage extends DepotPage {
@Override
public void onClick() {
- DepotAndBranch left = new DepotAndBranch(leftSide.toString());
- DepotAndBranch right = new DepotAndBranch(rightSide.toString());
+ DepotAndBranch left = new DepotAndBranch(state.leftSide.toString());
+ DepotAndBranch right = new DepotAndBranch(state.rightSide.toString());
setResponsePage(NewRequestPage.class, NewRequestPage.paramsOf(left.getDepot(), left, right));
}
@@ -243,9 +245,11 @@ public class RevisionComparePage extends DepotPage {
protected void onConfigure() {
super.onConfigure();
- if (leftSide.getBranch()!=null && rightSide.getBranch()!=null && compareWithMergeBase) {
+ if (state.leftSide.getBranch()!=null
+ && state.rightSide.getBranch()!=null
+ && state.compareWithMergeBase) {
PullRequest request = requestModel.getObject();
- setVisible(request == null && !mergeBaseModel.getObject().equals(rightSide.getCommit().name()));
+ setVisible(request == null && !mergeBaseModel.getObject().equals(state.rightSide.getCommit().name()));
} else {
setVisible(false);
}
@@ -259,7 +263,7 @@ public class RevisionComparePage extends DepotPage {
protected void onConfigure() {
super.onConfigure();
- if (compareWithMergeBase) {
+ if (state.compareWithMergeBase) {
PullRequest request = requestModel.getObject();
setVisible(request != null);
} else {
@@ -323,8 +327,9 @@ public class RevisionComparePage extends DepotPage {
@Override
public void onClick() {
- PageParameters params = paramsOf(getDepot(), leftSide, rightSide, true,
- whitespaceOption, pathFilter);
+ HistoryState state = new HistoryState(RevisionComparePage.this.state);
+ state.compareWithMergeBase = true;
+ PageParameters params = paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
}
@@ -335,8 +340,8 @@ public class RevisionComparePage extends DepotPage {
protected void onConfigure() {
super.onConfigure();
- setVisible(!compareWithMergeBase
- && !mergeBaseModel.getObject().equals(leftSide.getCommit().name()));
+ setVisible(!state.compareWithMergeBase
+ && !mergeBaseModel.getObject().equals(state.leftSide.getCommit().name()));
}
});
@@ -347,7 +352,7 @@ public class RevisionComparePage extends DepotPage {
@Override
protected void onSelect(AjaxRequestTarget target, Component tabLink) {
- pathFilter = null;
+ state.pathFilter = null;
newTabPanel(target);
pushState(target);
}
@@ -358,7 +363,7 @@ public class RevisionComparePage extends DepotPage {
@Override
protected void onSelect(AjaxRequestTarget target, Component tabLink) {
- pathFilter = "";
+ state.pathFilter = "";
newTabPanel(target);
pushState(target);
}
@@ -381,10 +386,10 @@ public class RevisionComparePage extends DepotPage {
}
private boolean hasChanges() {
- if (compareWithMergeBase) {
- return !mergeBaseModel.getObject().equals(rightSide.getCommit().name());
+ if (state.compareWithMergeBase) {
+ return !mergeBaseModel.getObject().equals(state.rightSide.getCommit().name());
} else {
- return !leftSide.getCommit().name().equals(rightSide.getCommit().name());
+ return !state.leftSide.getCommit().name().equals(state.rightSide.getCommit().name());
}
}
@@ -397,22 +402,23 @@ public class RevisionComparePage extends DepotPage {
private void newTabPanel(@Nullable AjaxRequestTarget target) {
WebMarkupContainer tabPanel;
- if (pathFilter != null) {
+ if (state.pathFilter != null) {
tabPanel = new RevisionDiffPanel(TAB_PANEL_ID, depotModel,
new Model<PullRequest>(null),
- compareWithMergeBase?mergeBaseModel.getObject():leftSide.getRevision(),
- rightSide.getRevision(), pathFilter, whitespaceOption) {
+ state.compareWithMergeBase?mergeBaseModel.getObject():state.leftSide.getRevision(),
+ state.rightSide.getRevision(), state.pathFilter,
+ state.whitespaceOption, state.commentId) {
@Override
protected void onPathFilterChange(AjaxRequestTarget target, String pathFilter) {
- RevisionComparePage.this.pathFilter = pathFilter;
+ state.pathFilter = pathFilter;
pushState(target);
}
@Override
protected void onWhitespaceOptionChange(AjaxRequestTarget target,
WhitespaceOption whitespaceOption) {
- RevisionComparePage.this.whitespaceOption = whitespaceOption;
+ state.whitespaceOption = whitespaceOption;
pushState(target);
}
@@ -421,6 +427,12 @@ public class RevisionComparePage extends DepotPage {
super.onConfigure();
setVisible(hasChanges());
}
+
+ @Override
+ protected void onOpenComment(AjaxRequestTarget target, CodeComment comment) {
+ state.commentId = CodeComment.idOf(comment);
+ pushState(target);
+ }
};
commitsTab.setSelected(false);
@@ -448,17 +460,16 @@ public class RevisionComparePage extends DepotPage {
}
private void pushState(AjaxRequestTarget target) {
- PageParameters params = paramsOf(getDepot(), leftSide,
- rightSide, compareWithMergeBase, whitespaceOption, pathFilter);
+ PageParameters params = paramsOf(getDepot(), state);
CharSequence url = RequestCycle.get().urlFor(RevisionComparePage.class, params);
- pushState(target, url.toString(), pathFilter);
+ pushState(target, url.toString(), state);
}
@Override
protected void onPopState(AjaxRequestTarget target, Serializable data) {
super.onPopState(target, data);
- pathFilter = (String) data;
+ state = (HistoryState) data;
newTabPanel(target);
}
@@ -476,4 +487,36 @@ public class RevisionComparePage extends DepotPage {
setResponsePage(RevisionComparePage.class, paramsOf(depot));
}
+ public static class HistoryState implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public HistoryState() {
+ }
+
+ public HistoryState(HistoryState copy) {
+ leftSide = copy.leftSide;
+ rightSide = copy.rightSide;
+ compareWithMergeBase = copy.compareWithMergeBase;
+ whitespaceOption = copy.whitespaceOption;
+ pathFilter = copy.pathFilter;
+ commentId = copy.commentId;
+ }
+
+ public DepotAndRevision leftSide;
+
+ public DepotAndRevision rightSide;
+
+ public boolean compareWithMergeBase = true;
+
+ public WhitespaceOption whitespaceOption = WhitespaceOption.DEFAULT;
+
+ @Nullable
+ public String pathFilter;
+
+ @Nullable
+ public Long commentId;
+
+ }
+
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/newrequest/NewRequestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/newrequest/NewRequestPage.java
index 307c3fd706..680f5e1352 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/newrequest/NewRequestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/newrequest/NewRequestPage.java
@@ -46,6 +46,7 @@ import com.pmease.commons.wicket.component.tabbable.Tabbable;
import com.pmease.commons.wicket.websocket.WebSocketRenderBehavior.PageId;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.Account;
+import com.pmease.gitplex.core.entity.CodeComment;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.core.entity.PullRequest.IntegrationStrategy;
@@ -313,7 +314,7 @@ public class NewRequestPage extends PullRequestPage {
String newRev = request.getLatestUpdate().getHeadCommitHash();
RevisionDiffPanel diffPanel = new RevisionDiffPanel("revisionDiff", depotModel,
- new Model<PullRequest>(null), oldRev, newRev, null, null) {
+ new Model<PullRequest>(null), oldRev, newRev, null, WhitespaceOption.DEFAULT, null) {
@Override
protected void onPathFilterChange(AjaxRequestTarget target, String pathFilter) {
@@ -323,6 +324,10 @@ public class NewRequestPage extends PullRequestPage {
protected void onWhitespaceOptionChange(AjaxRequestTarget target,
WhitespaceOption whitespaceOption) {
}
+
+ @Override
+ protected void onOpenComment(AjaxRequestTarget target, CodeComment comment) {
+ }
};
diffPanel.setOutputMarkupId(true);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/HistoryState.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/HistoryState.java
index d45085c9be..2ba8b17d89 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/HistoryState.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/HistoryState.java
@@ -4,7 +4,7 @@ import java.io.Serializable;
import com.pmease.commons.lang.diff.WhitespaceOption;
-class HistoryState implements Serializable {
+public class HistoryState implements Serializable {
private static final long serialVersionUID = 1L;
@@ -16,4 +16,6 @@ class HistoryState implements Serializable {
public String pathFilter;
+ public Long commentId;
+
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java
index d642634efd..8a8363fd95 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/compare/RequestComparePage.java
@@ -44,6 +44,7 @@ import com.pmease.commons.wicket.component.floating.AlignPlacement;
import com.pmease.commons.wicket.component.floating.FloatingPanel;
import com.pmease.commons.wicket.component.menu.MenuItem;
import com.pmease.commons.wicket.component.menu.MenuLink;
+import com.pmease.gitplex.core.entity.CodeComment;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.core.entity.PullRequestUpdate;
@@ -64,6 +65,8 @@ public class RequestComparePage extends RequestDetailPage {
private static final String PARAM_PATH_FILTER = "path-filter";
+ private static final String PARAM_COMMENT = "comment";
+
public static final String REV_BASE = "base";
public static final String REV_UPDATE_PREFIX = "update";
@@ -90,6 +93,8 @@ public class RequestComparePage extends RequestDetailPage {
private String pathFilter;
+ private Long commentId;
+
private WebMarkupContainer compareHead;
private Component revisionDiff;
@@ -146,6 +151,7 @@ public class RequestComparePage extends RequestDetailPage {
state.newRev = params.get(PARAM_NEW_REV).toString();
state.pathFilter = params.get(PARAM_PATH_FILTER).toString();
state.whitespaceOption = WhitespaceOption.of(params.get(PARAM_WHITESPACE_OPTION).toString());
+ state.commentId = params.get(PARAM_COMMENT).toOptionalLong();
initFromState(state);
}
@@ -155,6 +161,7 @@ public class RequestComparePage extends RequestDetailPage {
newCommitHash = getCommitHash(state.newRev);
whitespaceOption = state.whitespaceOption;
pathFilter = state.pathFilter;
+ commentId = state.commentId;
}
private String getRevision(String commitHash) {
@@ -460,21 +467,25 @@ public class RequestComparePage extends RequestDetailPage {
}
public static PageParameters paramsOf(PullRequest request, String oldRev, String newRev) {
- return paramsOf(request, oldRev, newRev, WhitespaceOption.DEFAULT, null);
+ HistoryState state = new HistoryState();
+ state.oldRev = oldRev;
+ state.newRev = newRev;
+ return paramsOf(request, state);
}
- public static PageParameters paramsOf(PullRequest request, @Nullable String oldRev, @Nullable String newRev,
- WhitespaceOption whitespaceOption, @Nullable String pathFilter) {
+ public static PageParameters paramsOf(PullRequest request, HistoryState state) {
PageParameters params = RequestDetailPage.paramsOf(request);
- if (oldRev != null)
- params.set(PARAM_OLD_REV, oldRev);
- if (newRev != null)
- params.set(PARAM_NEW_REV, newRev);
- if (whitespaceOption != WhitespaceOption.DEFAULT)
- params.set(PARAM_WHITESPACE_OPTION, whitespaceOption.name());
- if (pathFilter != null)
- params.set(PARAM_PATH_FILTER, pathFilter);
+ if (state.oldRev != null)
+ params.set(PARAM_OLD_REV, state.oldRev);
+ if (state.newRev != null)
+ params.set(PARAM_NEW_REV, state.newRev);
+ if (state.whitespaceOption != WhitespaceOption.DEFAULT)
+ params.set(PARAM_WHITESPACE_OPTION, state.whitespaceOption.name());
+ if (state.pathFilter != null)
+ params.set(PARAM_PATH_FILTER, state.pathFilter);
+ if (state.commentId != null)
+ params.set(PARAM_COMMENT, state.commentId);
return params;
}
@@ -618,8 +629,7 @@ public class RequestComparePage extends RequestDetailPage {
}
private void pushState(IPartialPageRequestHandler partialPageRequestHandler) {
- PageParameters params = paramsOf(getPullRequest(), state.oldRev, state.newRev,
- state.whitespaceOption, state.pathFilter);
+ PageParameters params = paramsOf(getPullRequest(), state);
CharSequence url = RequestCycle.get().urlFor(RequestComparePage.class, params);
pushState(partialPageRequestHandler, url.toString(), state);
}
@@ -634,7 +644,7 @@ public class RequestComparePage extends RequestDetailPage {
private void newCompareResult(@Nullable IPartialPageRequestHandler partialPageRequestHandler) {
revisionDiff = new RevisionDiffPanel("revisionDiff", depotModel,
requestModel, oldCommitHash, newCommitHash, pathFilter,
- whitespaceOption) {
+ whitespaceOption, commentId) {
@Override
protected void onPathFilterChange(AjaxRequestTarget target, String pathFilter) {
@@ -648,6 +658,11 @@ public class RequestComparePage extends RequestDetailPage {
whitespaceOption = state.whitespaceOption = whitespaceOption;
pushState(target);
}
+
+ @Override
+ protected void onOpenComment(AjaxRequestTarget target, CodeComment comment) {
+ commentId = state.commentId = CodeComment.idOf(comment);
+ }
};
revisionDiff.setOutputMarkupId(true);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/SinceChangesLink.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/SinceChangesLink.java
index 609e1b2c3f..2c36f136fd 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/SinceChangesLink.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/SinceChangesLink.java
@@ -11,9 +11,9 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import com.pmease.commons.lang.diff.WhitespaceOption;
import com.pmease.gitplex.core.entity.PullRequest;
import com.pmease.gitplex.core.entity.PullRequestUpdate;
+import com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.compare.HistoryState;
import com.pmease.gitplex.web.page.depot.pullrequest.requestdetail.compare.RequestComparePage;
import com.pmease.gitplex.web.websocket.PullRequestChanged;
@@ -61,8 +61,10 @@ class SinceChangesLink extends Panel {
@Override
public void onClick() {
PullRequest request = requestModel.getObject();
- PageParameters params = RequestComparePage.paramsOf(request, oldRevModel.getObject(),
- RequestComparePage.REV_LAST_UPDATE_PREFIX+1, WhitespaceOption.DEFAULT, null);
+ HistoryState state = new HistoryState();
+ state.oldRev = oldRevModel.getObject();
+ state.newRev = RequestComparePage.REV_LAST_UPDATE_PREFIX+1;
+ PageParameters params = RequestComparePage.paramsOf(request, state);
setResponsePage(RequestComparePage.class, params);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
index 22154368da..2126cc76fd 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/tags/DepotTagsPage.java
@@ -41,7 +41,6 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.revwalk.filter.RevFilter;
import com.pmease.commons.git.GitUtils;
-import com.pmease.commons.lang.diff.WhitespaceOption;
import com.pmease.commons.util.StringUtils;
import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;
import com.pmease.commons.wicket.behavior.OnTypingDoneBehavior;
@@ -336,8 +335,11 @@ public class DepotTagsPage extends DepotPage {
}
DepotAndRevision source = new DepotAndRevision(getDepot(),
GitUtils.ref2tag(item.getModelObject().getName()));
- PageParameters params = RevisionComparePage.paramsOf(getDepot(), target, source, true,
- WhitespaceOption.DEFAULT, "");
+ RevisionComparePage.HistoryState state = new RevisionComparePage.HistoryState();
+ state.leftSide = target;
+ state.rightSide = source;
+ state.pathFilter = "";
+ PageParameters params = RevisionComparePage.paramsOf(getDepot(), state);
setResponsePage(RevisionComparePage.class, params);
} catch (IOException e) {
throw new RuntimeException(e);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
index b47194918b..0d9854548d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
@@ -1,2 +1,16 @@
<wicket:extend>
+ <div class="content" style="width: 200px; border: 1px solid red;">
+ hello world
+ </div>
+ <script type="text/javascript">
+ $(".content").resizable({
+ autoHide: false,
+ minWidth: 200,
+ resize: function(e, ui) {
+ },
+ stop: function(e, ui) {
+ $(window).resize();
+ }
+ });
+ </script>
</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
index 6c2f385168..0ceb7952ae 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
@@ -1,10 +1,9 @@
package com.pmease.gitplex.web.page.test;
-import java.io.File;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.commons.io.FileUtils;
-
-import com.pmease.commons.lang.extractors.java.JavaExtractor;
+import com.pmease.commons.wicket.assets.jqueryui.JQueryUIResourceReference;
import com.pmease.gitplex.web.page.base.BasePage;
@SuppressWarnings("serial")
@@ -13,12 +12,12 @@ public class TestPage extends BasePage {
@Override
protected void onInitialize() {
super.onInitialize();
+ }
- JavaExtractor extractor = new JavaExtractor();
- try {
- extractor.extract(FileUtils.readFileToString(new File("w:\\linux\\MAINTAINERS")));
- } catch (Exception e) {
- }
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(JavaScriptHeaderItem.forReference(JQueryUIResourceReference.INSTANCE));
}
}