Skip to content

The Unified and Autonomous Development Platform

Outdated alert for request compare page.

robin shine6d0e389671aa
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
index 008f02dd32..b2228ec7f9 100644
--- 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
@@ -64,41 +64,6 @@ public abstract class DiffOptionPanel extends Panel {
diffMode = DiffMode.valueOf(cookie.getValue());
}
- @Override
- protected void onBeforeRender() {
- // replace filter dropdown at render time in order to update it for instance
- // when pull request is updated with new commit in request compare page
- DropdownPanel filterDropdown = new DropdownPanel("filterDropdown", true) {
-
- @Override
- protected Component newContent(String id) {
- return new PathSelector(id, repoModel, newRevModel.getObject(), FileMode.TYPE_TREE,
- FileMode.TYPE_FILE, FileMode.TYPE_GITLINK, FileMode.TYPE_SYMLINK) {
-
- @Override
- protected void onSelect(AjaxRequestTarget target, BlobIdent blobIdent) {
- hide(target);
- target.add(DiffOptionPanel.this);
- onSelectPath(target, blobIdent.path);
- }
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
- if (getDirtyContainer() != null)
- attributes.getAjaxCallListeners().add(new ConfirmLeaveListener(getDirtyContainer()));
- }
-
- };
- }
-
- };
- addOrReplace(filterDropdown);
- addOrReplace(new WebMarkupContainer("filter").add(new DropdownBehavior(filterDropdown)));
-
- super.onBeforeRender();
- }
-
@Override
protected void onInitialize() {
super.onInitialize();
@@ -180,6 +145,34 @@ public abstract class DiffOptionPanel extends Panel {
})));
}
+ DropdownPanel filterDropdown = new DropdownPanel("filterDropdown", true) {
+
+ @Override
+ protected Component newContent(String id) {
+ return new PathSelector(id, repoModel, newRevModel.getObject(), FileMode.TYPE_TREE,
+ FileMode.TYPE_FILE, FileMode.TYPE_GITLINK, FileMode.TYPE_SYMLINK) {
+
+ @Override
+ protected void onSelect(AjaxRequestTarget target, BlobIdent blobIdent) {
+ hide(target);
+ target.add(DiffOptionPanel.this);
+ onSelectPath(target, blobIdent.path);
+ }
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ attributes.getAjaxCallListeners().add(new IndicateLoadingListener());
+ if (getDirtyContainer() != null)
+ attributes.getAjaxCallListeners().add(new ConfirmLeaveListener(getDirtyContainer()));
+ }
+
+ };
+ }
+
+ };
+ add(filterDropdown);
+ add(new WebMarkupContainer("filter").add(new DropdownBehavior(filterDropdown)));
+
setOutputMarkupId(true);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.html
index b5d6673ef6..2f6d5f42e0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/pullrequest/requestdetail/compare/RequestComparePage.html
@@ -17,6 +17,11 @@
<div wicket:id="comparisonChoices"></div>
<div wicket:id="diffOption" class="pull-right"></div>
</div>
+ <div wicket:id="outdatedAlert" class="outdated alert alert-warning">
+ <a onclick="location.reload();">
+ <i class="fa fa-warning"></i> Page is outdated, click to refresh
+ </a>
+ </div>
<div wicket:id="compareResult" class="body"></div>
</div>
<wicket:fragment wicket:id="commitChoiceFrag">
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 97f18fcc10..448de66ebc 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
@@ -156,26 +156,7 @@ public class RequestComparePage extends RequestDetailPage {
protected void onInitialize() {
super.onInitialize();
- compareOptions = new WebMarkupContainer("compareOptions") {
-
- @Override
- public void onEvent(IEvent<?> event) {
- super.onEvent(event);
-
- if (event.getPayload() instanceof PullRequestChanged) {
- PullRequestChanged pullRequestChanged = (PullRequestChanged) event.getPayload();
- AjaxRequestTarget target = pullRequestChanged.getTarget();
- target.add(compareOptions);
-
- PageParameters params = getPageParameters();
- if (params.get(PARAM_NEW_COMMIT).toString() == null) {
- newCommitHash = getPullRequest().getLatestUpdate().getHeadCommitHash();
- newCompareResult(target);
- }
- }
- }
-
- };
+ compareOptions = new WebMarkupContainer("compareOptions");
compareOptions.add(new StickyBehavior());
add(compareOptions);
@@ -401,6 +382,34 @@ public class RequestComparePage extends RequestDetailPage {
}
});
+
+ add(new WebMarkupContainer("outdatedAlert") {
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof PullRequestChanged) {
+ PageParameters params = getPageParameters();
+ if (params.get(PARAM_NEW_COMMIT).toString() == null) {
+ setVisible(true);
+ PullRequestChanged pullRequestChanged = (PullRequestChanged) event.getPayload();
+ pullRequestChanged.getTarget().add(this);
+ }
+
+ }
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ setVisible(false);
+ setOutputMarkupPlaceholderTag(true);
+ }
+
+ });
+
newCompareResult(null);
}
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 9c4dcc9745..d7a91e7d6f 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
@@ -5,6 +5,12 @@
border: 1px solid #DDD;
margin-bottom: 16px;
}
+#request-detail>.compare>.outdated {
+ margin-bottom: 12px;;
+}
+#request-detail>.compare>.outdated>a {
+ color: #8a6d3b;
+}
.content>.commit-choice {
max-height: 400px;
padding: 8px 0;