Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine7f949a3131aa
diff --git a/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java b/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java
index 8f8a045526..779095a046 100644
--- a/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java
+++ b/commons.git/src/main/java/com/pmease/commons/git/GitUtils.java
@@ -26,7 +26,7 @@ public class GitUtils {
public static final Pattern PATTERN_HASH = Pattern.compile("[a-z0-9]{40}");
- public static final int SHORT_SHA_LENGTH = 10;
+ public static final int SHORT_SHA_LENGTH = 8;
public static boolean isHash(String sha) {
return PATTERN_HASH.matcher(sha).matches();
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.html
index bf81ace1bc..9fcf4f7fd7 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/RevisionDiffPanel.html
@@ -1,23 +1,7 @@
<wicket:panel>
<div class="revision-diff">
- <div class="head clearfix">
- <div class="pull-left">
- <span wicket:id="path" class="btn btn-sm btn-default" title="Filter changes by path">
- <span wicket:id="label"></span>
- <i class="fa fa-caret-down"></i>
- </span>
- <a wicket:id="clear" title="Clear path filter"><i class="fa fa-close"></i></a>
- <div wicket:id="pathDropdown"></div>
- </div>
- <div wicket:id="lineProcessor" class="line-process btn btn-sm btn-default pull-left" title="Line process options">White space <i class="caret"></i></div>
- <div wicket:id="lineProcessorMenu"></div>
- <div class="title pull-left">
- Total <a onclick="$(this).closest('.revision-diff').find('.diff-stats').toggle();$(document.body).trigger('sticky_kit:recalc');return false;"><span wicket:id="totalChanged"></span> changed files</a>
- </div>
- <div class="btn-group pull-right">
- <a wicket:id="unified" class="btn btn-sm btn-default">Unified</a>
- <a wicket:id="split" class="btn btn-sm btn-default">Split</a>
- </div>
+ <div class="title">
+ Total <a onclick="$(this).closest('.revision-diff').find('.diff-stats').toggle();$(document.body).trigger('sticky_kit:recalc');return false;"><span wicket:id="totalChanged"></span> changed files</a>
</div>
<div wicket:id="tooManyChanges" class="alert alert-warning">Sorry we are unable to display the full diff as there are too many changes</div>
<ul class="diff-stats list-unstyled">
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 30dda1d9a2..bb9381b35b 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
@@ -11,13 +11,8 @@ import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
-import javax.servlet.http.Cookie;
import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
@@ -29,9 +24,6 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.http.WebRequest;
-import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.CssResourceReference;
import org.apache.wicket.util.lang.Objects;
import org.eclipse.jgit.diff.DiffEntry;
@@ -39,7 +31,6 @@ import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.DiffFormatter;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.lib.AnyObjectId;
-import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.treewalk.filter.PathFilter;
import org.eclipse.jgit.util.io.NullOutputStream;
@@ -48,41 +39,30 @@ import com.pmease.commons.git.BlobChange;
import com.pmease.commons.git.BlobIdent;
import com.pmease.commons.git.LineProcessor;
import com.pmease.commons.lang.diff.DiffUtils;
-import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;
-import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;
-import com.pmease.commons.wicket.behavior.menu.CheckItem;
-import com.pmease.commons.wicket.behavior.menu.MenuBehavior;
-import com.pmease.commons.wicket.behavior.menu.MenuItem;
-import com.pmease.commons.wicket.behavior.menu.MenuPanel;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.comment.InlineCommentSupport;
import com.pmease.gitplex.core.model.Repository;
import com.pmease.gitplex.web.Constants;
import com.pmease.gitplex.web.component.diff.blob.BlobDiffPanel;
import com.pmease.gitplex.web.component.diff.diffstat.DiffStatBar;
-import com.pmease.gitplex.web.component.pathselector.PathSelector;
@SuppressWarnings("serial")
-public abstract class RevisionDiffPanel extends Panel {
+public class RevisionDiffPanel extends Panel {
- private static final String COOKIE_DIFF_MODE = "gitplex.diff.mode";
-
private final IModel<Repository> repoModel;
- @Nullable
- private String path;
-
private final String oldRev;
private final String newRev;
- @Nullable
- private final InlineCommentSupport commentSupport;
+ private final String filterPath;
- private LineProcessor lineProcessor = LineProcessOption.IGNORE_NOTHING;
+ private final LineProcessor lineProcessor;
- private DiffMode diffMode;
+ private final DiffMode diffMode;
+
+ @Nullable
+ private final InlineCommentSupport commentSupport;
private IModel<ChangesAndCount> changesAndCountModel = new LoadableDetachableModel<ChangesAndCount>() {
@@ -93,8 +73,8 @@ public abstract class RevisionDiffPanel extends Panel {
diffFormatter.setRepository(jgitRepo);
diffFormatter.setDetectRenames(true);
- if (path != null)
- diffFormatter.setPathFilter(PathFilter.create(path));
+ if (filterPath != null)
+ diffFormatter.setPathFilter(PathFilter.create(filterPath));
AnyObjectId oldCommitId = repoModel.getObject().getObjectId(oldRev);
AnyObjectId newCommitId = repoModel.getObject().getObjectId(newRev);
List<DiffEntry> entries = diffFormatter.scan(oldCommitId, newCommitId);
@@ -191,130 +171,23 @@ public abstract class RevisionDiffPanel extends Panel {
};
public RevisionDiffPanel(String id, IModel<Repository> repoModel, String oldRev, String newRev,
- @Nullable String path, @Nullable InlineCommentSupport commentSupport) {
+ @Nullable String filterPath, LineProcessor lineProcessor, DiffMode diffMode,
+ @Nullable InlineCommentSupport commentSupport) {
super(id);
this.repoModel = repoModel;
this.oldRev = oldRev;
this.newRev = newRev;
- this.path = path;
+ this.filterPath = filterPath;
+ this.lineProcessor = lineProcessor;
+ this.diffMode = diffMode;
this.commentSupport = commentSupport;
-
- WebRequest request = (WebRequest) RequestCycle.get().getRequest();
- Cookie cookie = request.getCookie(COOKIE_DIFF_MODE);
- if (cookie == null)
- diffMode = DiffMode.UNIFIED;
- else
- diffMode = DiffMode.valueOf(cookie.getValue());
}
@Override
protected void onInitialize() {
super.onInitialize();
- DropdownPanel pathDropdown = new DropdownPanel("pathDropdown", true) {
-
- @Override
- protected Component newContent(String id) {
- return new PathSelector(id, repoModel, newRev, FileMode.TYPE_TREE,
- FileMode.TYPE_FILE, FileMode.TYPE_GITLINK, FileMode.TYPE_SYMLINK) {
-
- @Override
- protected void onSelect(AjaxRequestTarget target, BlobIdent blobIdent) {
- path = blobIdent.path;
- hide(target);
- target.add(RevisionDiffPanel.this);
- onPathChange(target, path);
- }
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
- }
-
- };
- }
-
- };
- add(pathDropdown);
- WebMarkupContainer pathContainer = new WebMarkupContainer("path");
- pathContainer.add(new DropdownBehavior(pathDropdown));
- pathContainer.add(new Label("label", new AbstractReadOnlyModel<String>() {
-
- @Override
- public String getObject() {
- if (path != null)
- return path;
- else
- return "Filter by";
- }
-
- }));
- add(new AjaxLink<Void>("clear") {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- path = null;
- target.add(RevisionDiffPanel.this);
- onPathChange(target, path);
- }
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
- }
-
- @Override
- protected void onConfigure() {
- super.onConfigure();
- setVisible(path != null);
- }
-
- });
- add(pathContainer);
-
- MenuPanel lineProcessorMenu = new MenuPanel("lineProcessorMenu") {
-
- @Override
- protected List<MenuItem> getMenuItems() {
- List<MenuItem> menuItems = new ArrayList<>();
-
- for (final LineProcessOption option: LineProcessOption.values()) {
- menuItems.add(new CheckItem() {
-
- @Override
- protected String getLabel() {
- return option.getName();
- }
-
- @Override
- protected boolean isChecked() {
- return lineProcessor == option;
- }
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
- }
-
- @Override
- protected void onClick(AjaxRequestTarget target) {
- lineProcessor = option;
- target.add(RevisionDiffPanel.this);
- }
-
- });
- }
-
- return menuItems;
- }
-
- };
- add(lineProcessorMenu);
- add(new WebMarkupContainer("lineProcessor").add(new MenuBehavior(lineProcessorMenu)));
-
add(new Label("totalChanged", new AbstractReadOnlyModel<Integer>() {
@Override
@@ -324,37 +197,6 @@ public abstract class RevisionDiffPanel extends Panel {
}));
- for (final DiffMode each: DiffMode.values()) {
- add(new AjaxLink<Void>(each.name().toLowerCase()) {
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
- }
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- diffMode = each;
- WebResponse response = (WebResponse) RequestCycle.get().getResponse();
- Cookie cookie = new Cookie(COOKIE_DIFF_MODE, diffMode.name());
- cookie.setMaxAge(Integer.MAX_VALUE);
- response.addCookie(cookie);
-
- target.add(RevisionDiffPanel.this);
- target.focusComponent(null);
- }
-
- }.add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- return each==diffMode?" active":"";
- }
-
- })));
- }
-
add(new WebMarkupContainer("tooManyChanges") {
@Override
@@ -438,8 +280,6 @@ public abstract class RevisionDiffPanel extends Panel {
setOutputMarkupId(true);
}
- protected abstract void onPathChange(AjaxRequestTarget target, String path);
-
private List<BlobChange> getChanges() {
return changesAndCountModel.getObject().getChanges();
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.html
new file mode 100644
index 0000000000..500d0ffd96
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.html
@@ -0,0 +1,16 @@
+<wicket:panel>
+ <span class="diff-option clearfix">
+ <span class="pull-left">
+ <span wicket:id="filterBy" class="btn btn-sm btn-default" title="Filter changes by path">
+ Filter by <i class="fa fa-caret-down"></i>
+ </span>
+ <div wicket:id="filterByDropdown"></div>
+ </span>
+ <span wicket:id="lineProcessor" class="line-process btn btn-sm btn-default pull-left" title="Line process options">White space <i class="caret"></i></span>
+ <div wicket:id="lineProcessorMenu"></div>
+ <span class="btn-group pull-right">
+ <a wicket:id="unified" class="btn btn-sm btn-default">Unified</a>
+ <a wicket:id="split" class="btn btn-sm btn-default">Split</a>
+ </span>
+ </span>
+</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java
new file mode 100644
index 0000000000..614069552e
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/DiffOptionPanel.java
@@ -0,0 +1,205 @@
+package com.pmease.gitplex.web.component.diff.revision.option;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.Cookie;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.request.http.WebResponse;
+import org.apache.wicket.request.resource.CssResourceReference;
+import org.eclipse.jgit.lib.FileMode;
+
+import com.pmease.commons.git.BlobIdent;
+import com.pmease.commons.git.LineProcessor;
+import com.pmease.commons.wicket.ajaxlistener.IndicateLoadingListener;
+import com.pmease.commons.wicket.behavior.dropdown.DropdownBehavior;
+import com.pmease.commons.wicket.behavior.dropdown.DropdownPanel;
+import com.pmease.commons.wicket.behavior.menu.CheckItem;
+import com.pmease.commons.wicket.behavior.menu.MenuBehavior;
+import com.pmease.commons.wicket.behavior.menu.MenuItem;
+import com.pmease.commons.wicket.behavior.menu.MenuPanel;
+import com.pmease.gitplex.core.model.Repository;
+import com.pmease.gitplex.web.component.diff.revision.DiffMode;
+import com.pmease.gitplex.web.component.diff.revision.LineProcessOption;
+import com.pmease.gitplex.web.component.pathselector.PathSelector;
+
+@SuppressWarnings("serial")
+public abstract class DiffOptionPanel extends Panel {
+
+ private static final String COOKIE_DIFF_MODE = "gitplex.diff.mode";
+
+ private final IModel<Repository> repoModel;
+
+ private final String newRev;
+
+ private LineProcessor lineProcessor = LineProcessOption.IGNORE_NOTHING;
+
+ private DiffMode diffMode;
+
+ private String filterPath;
+
+ public DiffOptionPanel(String id, IModel<Repository> repoModel, String newRev) {
+ super(id);
+
+ this.repoModel = repoModel;
+ this.newRev = newRev;
+
+ WebRequest request = (WebRequest) RequestCycle.get().getRequest();
+ Cookie cookie = request.getCookie(COOKIE_DIFF_MODE);
+ if (cookie == null)
+ diffMode = DiffMode.UNIFIED;
+ else
+ diffMode = DiffMode.valueOf(cookie.getValue());
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ DropdownPanel filterByDropdown = new DropdownPanel("filterByDropdown", true) {
+
+ @Override
+ protected Component newContent(String id) {
+ return new PathSelector(id, repoModel, newRev, FileMode.TYPE_TREE,
+ FileMode.TYPE_FILE, FileMode.TYPE_GITLINK, FileMode.TYPE_SYMLINK) {
+
+ @Override
+ protected void onSelect(AjaxRequestTarget target, BlobIdent blobIdent) {
+ filterPath = blobIdent.path;
+ hide(target);
+ onFilterPathChange(target);
+ }
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
+ }
+
+ };
+ }
+
+ };
+ add(filterByDropdown);
+ add(new WebMarkupContainer("filterBy").add(new DropdownBehavior(filterByDropdown)));
+
+ MenuPanel lineProcessorMenu = new MenuPanel("lineProcessorMenu") {
+
+ @Override
+ protected List<MenuItem> getMenuItems() {
+ List<MenuItem> menuItems = new ArrayList<>();
+
+ for (final LineProcessOption option: LineProcessOption.values()) {
+ menuItems.add(new CheckItem() {
+
+ @Override
+ protected String getLabel() {
+ return option.getName();
+ }
+
+ @Override
+ protected boolean isChecked() {
+ return lineProcessor == option;
+ }
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ super.updateAjaxAttributes(attributes);
+ attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
+ }
+
+ @Override
+ protected void onClick(AjaxRequestTarget target) {
+ lineProcessor = option;
+ onLineProcessorChange(target);
+ }
+
+ });
+ }
+
+ return menuItems;
+ }
+
+ };
+ add(lineProcessorMenu);
+ add(new WebMarkupContainer("lineProcessor").add(new MenuBehavior(lineProcessorMenu)));
+
+ for (final DiffMode each: DiffMode.values()) {
+ add(new AjaxLink<Void>(each.name().toLowerCase()) {
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ super.updateAjaxAttributes(attributes);
+ attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
+ }
+
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ diffMode = each;
+ WebResponse response = (WebResponse) RequestCycle.get().getResponse();
+ Cookie cookie = new Cookie(COOKIE_DIFF_MODE, diffMode.name());
+ cookie.setMaxAge(Integer.MAX_VALUE);
+ response.addCookie(cookie);
+
+ target.focusComponent(null);
+ onDiffModeChange(target);
+ }
+
+ }.add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
+
+ @Override
+ protected String load() {
+ return each==diffMode?" active":"";
+ }
+
+ })));
+ }
+
+ setOutputMarkupId(true);
+ }
+
+ @Override
+ protected void onDetach() {
+ repoModel.detach();
+
+ super.onDetach();
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+
+ response.render(CssHeaderItem.forReference(
+ new CssResourceReference(DiffOptionPanel.class, "diff-option.css")));
+ }
+
+ protected abstract void onFilterPathChange(AjaxRequestTarget target);
+
+ protected abstract void onLineProcessorChange(AjaxRequestTarget target);
+
+ protected abstract void onDiffModeChange(AjaxRequestTarget target);
+
+ public LineProcessor getLineProcessor() {
+ return lineProcessor;
+ }
+
+ public DiffMode getDiffMode() {
+ return diffMode;
+ }
+
+ public String getFilterPath() {
+ return filterPath;
+ }
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/diff-option.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/diff-option.css
new file mode 100644
index 0000000000..a9276b30d8
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/diff/revision/option/diff-option.css
@@ -0,0 +1,3 @@
+.diff-option>.pull-left {
+ margin-right: 8px;
+}
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 125f3ace49..a8e0dc6af5 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
@@ -1,19 +1,13 @@
-.revision-diff>.head {
- margin: 16px 0;
-}
-.revision-diff>.head>.pull-left {
- margin-right: 16px;
-}
-.revision-diff>.head>.title {
- margin-top: 4px;
+.revision-diff>.title {
font-size: 16px;
+ margin-bottom: 16px;
+}
+.revision-diff>.title .fa {
+ color: #BBB;
}
.revision-diff>.alert {
margin-bottom: 16px;
}
-.revision-diff>.head>.title .fa {
- color: #BBB;
-}
.revision-diff li.diff-stat {
font-size: 13px;
}
@@ -55,7 +49,5 @@
margin-top: 2px;
}
.revision-diff .changes>.change {
- padding-top: 48px;
- margin-top: -48px;
margin-bottom: 16px;
}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.html
index 97258687d5..9cd5b0b59c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.html
@@ -109,13 +109,7 @@
</div>
</wicket:fragment>
<wicket:fragment wicket:id="changedFilesFrag">
- <div class="changed-files">
- <div class="head clearfix">
- <div wicket:id="lineProcessOptionMenuTrigger" class="line-process btn btn-sm btn-default pull-left" title="Line process options">White space <i class="caret"></i></div>
- <div wicket:id="lineProcessOptionMenu"></div>
- <div wicket:id="diffMode" class="pull-left"></div>
- </div>
- <div wicket:id="revisionDiff"></div>
- </div>
+ <div wicket:id="diffOption"></div>
+ <div wicket:id="revisionDiff"></div>
</wicket:fragment>
</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.java
index c5d5ad9ecf..231a0380cb 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/newrequest/NewRequestPage.java
@@ -60,6 +60,7 @@ import com.pmease.gitplex.web.component.branchlink.BranchLink;
import com.pmease.gitplex.web.component.comment.CommentInput;
import com.pmease.gitplex.web.component.commitlist.CommitListPanel;
import com.pmease.gitplex.web.component.diff.revision.RevisionDiffPanel;
+import com.pmease.gitplex.web.component.diff.revision.option.DiffOptionPanel;
import com.pmease.gitplex.web.component.pullrequest.requestassignee.AssigneeChoice;
import com.pmease.gitplex.web.component.pullrequest.requestreviewer.ReviewerAvatar;
import com.pmease.gitplex.web.component.pullrequest.requestreviewer.ReviewerChoice;
@@ -83,6 +84,8 @@ public class NewRequestPage extends PullRequestPage {
private IModel<PullRequest> requestModel;
+ private DiffOptionPanel diffOption;
+
public static PageParameters paramsOf(Repository repository, RepoAndBranch source, RepoAndBranch target) {
PageParameters params = paramsOf(repository);
params.set("source", source.getId());
@@ -324,17 +327,37 @@ public class NewRequestPage extends PullRequestPage {
}
private Component newDiffPanel() {
+ Fragment fragment = new Fragment(TAB_PANEL_ID, "changedFilesFrag", this);
+
PullRequest request = getPullRequest();
- String oldRev = request.getBaseCommitHash();
String newRev = request.getLatestUpdate().getHeadCommitHash();
- return new RevisionDiffPanel(TAB_PANEL_ID, repoModel, oldRev, newRev, null, null) {
+ diffOption = new DiffOptionPanel("diffOption", repoModel, newRev) {
+
+ @Override
+ protected void onFilterPathChange(AjaxRequestTarget target) {
+ }
+
+ @Override
+ protected void onLineProcessorChange(AjaxRequestTarget target) {
+ }
@Override
- protected void onPathChange(AjaxRequestTarget target, String path) {
+ protected void onDiffModeChange(AjaxRequestTarget target) {
}
};
+ fragment.add(newRevDiffPanel());
+
+ return fragment;
+ }
+
+ protected RevisionDiffPanel newRevDiffPanel() {
+ PullRequest request = getPullRequest();
+ String oldRev = request.getBaseCommitHash();
+ String newRev = request.getLatestUpdate().getHeadCommitHash();
+ return new RevisionDiffPanel("revisionDiff", repoModel, oldRev, newRev, diffOption.getFilterPath(),
+ diffOption.getLineProcessor(), diffOption.getDiffMode(), null);
}
private Fragment newOpenedFrag() {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.java
index 77d94f0f51..2cc283c1bf 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.java
@@ -69,7 +69,7 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig
@SuppressWarnings("serial")
public class RequestComparePage extends RequestDetailPage {
- private static final String TARGET_BRANCH_HEAD = "Head of Target Branch";
+ private static final String TARGET_BRANCH_HEAD = "Target Branch Head";
private static final String INTEGRATION_PREVIEW = "Integration Preview";
@@ -101,7 +101,7 @@ public class RequestComparePage extends RequestDetailPage {
LinkedHashMap<String, CommitDescription> choices = new LinkedHashMap<>();
PullRequest request = getPullRequest();
- String name = "Base of Pull Request";
+ String name = "Pull Request Base";
CommitDescription description = new CommitDescription(name, request.getBaseCommit().getSubject());
choices.put(request.getBaseCommitHash(), description);
@@ -110,9 +110,9 @@ public class RequestComparePage extends RequestDetailPage {
Commit commit = update.getHeadCommit();
int updateNo = i+1;
if (i == request.getSortedUpdates().size()-1)
- name = "Head of Latest Update";
+ name = "Latest Update Head";
else
- name = "Head of Update #" + updateNo;
+ name = "Head of Update " + updateNo;
description = new CommitDescription(name, commit.getSubject());
choices.put(commit.getHash(), description);
}
@@ -155,7 +155,7 @@ public class RequestComparePage extends RequestDetailPage {
if (event.getPayload() instanceof PullRequestChanged) {
PullRequestChanged pullRequestChanged = (PullRequestChanged) event.getPayload();
AjaxRequestTarget target = pullRequestChanged.getTarget();
- refreshCompareOptions(target);
+ target.add(compareOptions);
PageParameters params = getPageParameters();
if (params.get(PARAM_NEW).toString() == null) {
@@ -312,7 +312,7 @@ public class RequestComparePage extends RequestDetailPage {
int index = i+1;
String oldLabel;
if (index > 1)
- oldLabel = "Update #" + (index-1);
+ oldLabel = "Update " + (index-1);
else
oldLabel = "Request Base";
@@ -320,7 +320,7 @@ public class RequestComparePage extends RequestDetailPage {
if (index == getPullRequest().getSortedUpdates().size())
newLabel = "Latest Update";
else
- newLabel = "Update #" + index;
+ newLabel = "Update " + index;
items.add(new ComparisonChoiceItem(oldLabel, newLabel) {
@Override
@@ -537,14 +537,8 @@ public class RequestComparePage extends RequestDetailPage {
initState((PageParameters) data);
- refreshCompareOptions(target);
- newCompareResult(target);
- }
-
- private void refreshCompareOptions(AjaxRequestTarget target) {
- for (StickyBehavior behavior: compareOptions.getBehaviors(StickyBehavior.class))
- behavior.unstick(target);
target.add(compareOptions);
+ newCompareResult(target);
}
@Override
@@ -561,7 +555,7 @@ public class RequestComparePage extends RequestDetailPage {
private void onStateChange(AjaxRequestTarget target) {
pushState(target);
- refreshCompareOptions(target);
+ target.add(compareOptions);
newCompareResult(target);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/request-compare.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/request-compare.css
index 97a77e394f..854ae896d2 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/request-compare.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/request-compare.css
@@ -3,6 +3,11 @@
z-index: 90;
padding: 8px;
border: 1px solid #DDD;
+ border-bottom: none;
+}
+#request-detail>.compare .revision-diff>.options {
+ border-top: none;
+ padding-top: 0;
}
.content>.commit-choice {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/UpdateActivityPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/UpdateActivityPanel.html
index 558fb8cf73..6cfabfdb15 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/UpdateActivityPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/overview/UpdateActivityPanel.html
@@ -2,7 +2,7 @@
<div class="update">
<div class="head activity-summary">
<span class="icon fa fa-ext fa-repo-push"></span>
- <span class="update-no">Update #<span wicket:id="updateNo"></span></span> was pushed <span wicket:id="age"></span>
+ <span class="update-no">Update <span wicket:id="updateNo"></span></span> was pushed <span wicket:id="age"></span>
<span class="operations"><a wicket:id="changes" title="Changes of this update"></a></span>
</div>
<div class="body">
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/RequestUpdatesPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/RequestUpdatesPage.html
index 0e76bcc0d9..0d412cf318 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/RequestUpdatesPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/updates/RequestUpdatesPage.html
@@ -2,7 +2,7 @@
<ul wicket:id="requestUpdatesContainer" class="updates list-unstyled">
<li wicket:id="updates" class="update">
<div class="summary">
- <span class="update-no">Update #<span wicket:id="updateNo"></span></span>, pushed <span wicket:id="age"></span>
+ <span class="update-no">Update <span wicket:id="updateNo"></span></span>, pushed <span wicket:id="age"></span>
<span class="operations">
<a wicket:id="changes" title="Changes of this update"></a>
</span>
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 a45f0d2144..6954d92d01 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
@@ -2,9 +2,6 @@ package com.pmease.gitplex.web.page.test;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.request.resource.CssResourceReference;
import com.pmease.gitplex.web.page.base.BasePage;