Skip to content

The Unified and Autonomous Development Platform

Add depot code comments page and pull request code comments page

robin shine9a2510bba793
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
index 7c01cee477..525d173d6d 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/assets/common.css
@@ -69,72 +69,16 @@
user-select: none;
}
-/* Table navigator */
-table .navigator {
- border-radius: 4px 4px 4px 4px;
- margin-bottom: 0px;
- margin-left: 0;
- float: right;
-}
-table thead .navigatorLabel, table tfoot .navigatorLabel {
- padding-top: 2px;
- padding-right: 8px;
- float: left;
-}
-table thead tr.navigation td, table tfoot tr.navigation td {
- vertical-align: middle;
- padding-top: 12px;
- text-align: right;
- min-width: 500px;
-}
-table .navigator>div a, table .navigator>div em {
- -moz-border-bottom-colors: none;
- -moz-border-left-colors: none;
- -moz-border-right-colors: none;
- -moz-border-top-colors: none;
- background-color: #FFFFFF;
- border-color: #DDDDDD;
- border-image: none;
- border-style: solid;
- border-width: 1px 1px 1px 0;
- line-height: 18px;
- padding: 4px 8px;
- text-decoration: none;
- float: left;
-}
-table .navigator>div .first em, table .navigator>div a.first {
- border-bottom-left-radius: 4px;
- border-left-width: 1px;
- border-top-left-radius: 4px;
-}
-table .navigator>div .last em, table .navigator>div a.last {
- border-bottom-right-radius: 4px;
- border-top-right-radius: 4px;
-}
-table .navigator>div em {
- font-style: normal;
- cursor: default;
-}
-table .navigator>div .first, table .navigator>div .last, table .navigator>div .prev, table .navigator>div .next {
- font-family: monospace inherit;
-}
-table .navigator>div a:hover, table .navigator>div a:focus,
-table .navigator>div em:hover, table .navigator>div em:focus,
-table .navigator>div .goto em {
- background-color: #F5F5F5;
-}
-table .navigator>div .goto em, table .navigator>div>span>em {
- color: #999999;
- cursor: default;
-}
-table .navigator>div>span>em, table .navigator>div>span>em:hover, table .navigator>div>span>em:focus {
- background-color: transparent;
-}
+/* TABLE COMPONENTS */
table .row-selector {
width: 24px;
}
-
-/* TABLE SORTER */
+.navigator {
+ text-align: center;
+}
+.navigatorLabel {
+ display: none;
+}
a.wicket_orderUp:after, a.wicket_orderDown:after, a.wicket_orderNone:after {
font-family: FontAwesome;
font-weight: normal;
@@ -144,7 +88,6 @@ a.wicket_orderUp:after, a.wicket_orderDown:after, a.wicket_orderNone:after {
color: #666;
margin-left: 8px;
}
-
a.wicket_orderUp:AFTER {
content: "\f062";
}
@@ -152,22 +95,6 @@ a.wicket_orderDown:AFTER {
content: "\f063";
}
-.pagination {
- margin: 0;
-}
-.pagination em {
- font-style: normal;
-}
-.pagination .first, .pagination .last, .pagination .prev, .pagination .next {
- font-family: monospace inherit;
-}
-.pagination>li>span>em {
- color: #BBB;
-}
-.pagination>li.active>span>em {
- color: white;
-}
-
/* TREE */
.tree-theme-windows .tree-node span.tree-content a {
color: #444444;
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/datatable/AjaxNavigationToolbar.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/datatable/AjaxNavigationToolbar.java
index a4d69d2167..1ad8523af9 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/datatable/AjaxNavigationToolbar.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/datatable/AjaxNavigationToolbar.java
@@ -4,7 +4,6 @@ import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigation;
import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigationIncrementLink;
import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigationLink;
-import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.Link;
@@ -15,6 +14,8 @@ import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import com.pmease.commons.wicket.ajaxlistener.AjaxLoadingOverlay;
+import de.agilecoders.wicket.core.markup.html.bootstrap.navigation.ajax.BootstrapAjaxPagingNavigator;
+
@SuppressWarnings("serial")
public class AjaxNavigationToolbar extends org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxNavigationToolbar {
@@ -25,7 +26,7 @@ public class AjaxNavigationToolbar extends org.apache.wicket.extensions.ajax.mar
@Override
protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?, ?> table) {
- return new AjaxPagingNavigator(navigatorId, table) {
+ return new BootstrapAjaxPagingNavigator(navigatorId, table) {
@Override
protected AbstractLink newPagingNavigationLink(String id, IPageable pageable, int increment) {
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/EditableUtils.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/EditableUtils.java
index 51d0f71ad3..3f9a8d1dc4 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/EditableUtils.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/EditableUtils.java
@@ -1,168 +1,184 @@
-package com.pmease.commons.wicket.editable;
-
-import java.io.Serializable;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.List;
-
-import javax.annotation.Nullable;
-import javax.validation.Validator;
-
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.util.BeanUtils;
-import com.pmease.commons.util.ClassUtils;
-import com.pmease.commons.util.GeneralException;
-import com.pmease.commons.util.ReflectionUtils;
-import com.pmease.commons.util.StringUtils;
-import com.pmease.commons.util.WordUtils;
-import com.pmease.commons.wicket.editable.annotation.Editable;
-
-public class EditableUtils {
-
- /**
- * Get display name of specified element from name parameter of {@link Editable} annotation.
- * If the annotation is not defined or name parameter is not available in the annotation, the
- * element name itself will be transferred to non-camel case and returned.
- *
- * @param element
- * annotated element to get name from
- * @return
- * display name of the element
- */
- public static String getName(AnnotatedElement element) {
- Editable editable = element.getAnnotation(Editable.class);
- if (editable != null && editable.name().trim().length() != 0)
- return editable.name();
- else if (element instanceof Class)
- return WordUtils.uncamel(((Class<?>)element).getSimpleName());
- else if (element instanceof Field)
- return WordUtils.uncamel(WordUtils.capitalize(((Field)element).getName()));
- else if (element instanceof Method)
- return StringUtils.substringAfter(WordUtils.uncamel(((Method)element).getName()), " ");
- else if (element instanceof Package)
- return ((Package)element).getName();
- else
- throw new GeneralException("Invalid element type: " + element.getClass().getName());
- }
-
- /**
- * Get category of specified element from category parameter of {@link Editable} annotation.
- *
- * @param element
- * annotated element to get category from
- * @return
- * category name of specified element, or <tt>null</tt> if not defined
- */
- public static @Nullable String getCategory(AnnotatedElement element) {
- Editable editable = element.getAnnotation(Editable.class);
- if (editable != null && editable.category().trim().length() != 0)
- return editable.category();
- else
- return null;
- }
-
- /**
- * Get icon of specified element from icon parameter of {@link Editable} annotation.
- *
- * @param element
- * annotated element to get icon from
- * @return
- * icon name of specified element, or <tt>null</tt> if not defined
- */
- public static @Nullable String getIcon(AnnotatedElement element) {
- Editable editable = element.getAnnotation(Editable.class);
- if (editable != null && editable.icon().trim().length() != 0)
- return editable.icon();
- else
- return null;
- }
-
- /**
- * Get description of specified element from description parameter of {@link Editable} annotation
- *
- * @param element
- * annotated element to get description from
- * @return
- * defined description, or <tt>null</tt> if description can not be found
- */
- public static @Nullable String getDescription(AnnotatedElement element) {
- Editable editable = element.getAnnotation(Editable.class);
- if (editable != null) {
- if (editable.description().length() != 0)
- return editable.description();
- if (editable.descriptionProvider().length() != 0) {
- Class<?> clazz;
- if (element instanceof Method)
- clazz = ((Method) element).getDeclaringClass();
- else if (element instanceof Class)
- clazz = (Class<?>) element;
- else
- clazz = ((Field) element).getDeclaringClass();
- return (String) ReflectionUtils.invokeStaticMethod(clazz, editable.descriptionProvider());
- }
- }
- return null;
- }
-
- /**
- * Get display order parameter defined in {@link Editable} annotation of specified element.
- *
- * @param element
- * annotated element to get order from
- * @return
- * defined order, or {@link Integer#MAX_VALUE} if Editable annotation is not found
- */
- public static int getOrder(AnnotatedElement element) {
- Editable editable = element.getAnnotation(Editable.class);
- if (editable != null)
- return editable.order();
- else
- return Integer.MAX_VALUE;
- }
-
- /**
- * Sort specified elements by order parameter defined in {@link Editable} annotation.
- *
- * @param annotatedElements
- * annotated elements to be sorted
- */
- public static <T extends AnnotatedElement> void sortAnnotatedElements(List<T> annotatedElements) {
- annotatedElements.sort((element1, element2) -> getOrder(element1) - getOrder(element2));
- }
-
- public static Class<?> getElementClass(Type listType) {
- if (listType instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)listType;
- Type rawType = parameterizedType.getRawType();
- if (rawType instanceof Class<?>) {
- Class<?> rawClazz = (Class<?>) rawType;
- if (List.class.isAssignableFrom(rawClazz)) {
- Type elementType = parameterizedType.getActualTypeArguments()[0];
- if (elementType instanceof Class<?>) {
- return (Class<?>) elementType;
- }
- }
- }
- }
- return null;
- }
-
- public static boolean hasEditableProperties(Class<?> beanClass) {
- for (Method getter: BeanUtils.findGetters(ClassUtils.unproxy(beanClass))) {
- Method setter = BeanUtils.findSetter(getter);
- if (setter != null && getter.getAnnotation(Editable.class) != null) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean isDefaultInstanceValid(Class<? extends Serializable> beanClass) {
- Serializable bean = ReflectionUtils.instantiateClass(beanClass);
- return AppLoader.getInstance(Validator.class).validate(bean).isEmpty();
- }
-
-}
+package com.pmease.commons.wicket.editable;
+
+import java.io.Serializable;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.annotation.Nullable;
+import javax.validation.Validator;
+
+import com.pmease.commons.loader.AppLoader;
+import com.pmease.commons.util.BeanUtils;
+import com.pmease.commons.util.ClassUtils;
+import com.pmease.commons.util.GeneralException;
+import com.pmease.commons.util.ReflectionUtils;
+import com.pmease.commons.util.StringUtils;
+import com.pmease.commons.util.WordUtils;
+import com.pmease.commons.wicket.editable.annotation.Editable;
+
+public class EditableUtils {
+
+ /**
+ * Get display name of specified element from name parameter of {@link Editable} annotation.
+ * If the annotation is not defined or name parameter is not available in the annotation, the
+ * element name itself will be transferred to non-camel case and returned.
+ *
+ * @param element
+ * annotated element to get name from
+ * @return
+ * display name of the element
+ */
+ public static String getName(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null && editable.name().trim().length() != 0)
+ return editable.name();
+ else if (element instanceof Class)
+ return WordUtils.uncamel(((Class<?>)element).getSimpleName());
+ else if (element instanceof Field)
+ return WordUtils.uncamel(WordUtils.capitalize(((Field)element).getName()));
+ else if (element instanceof Method)
+ return StringUtils.substringAfter(WordUtils.uncamel(((Method)element).getName()), " ");
+ else if (element instanceof Package)
+ return ((Package)element).getName();
+ else
+ throw new GeneralException("Invalid element type: " + element.getClass().getName());
+ }
+
+ /**
+ * Get category of specified element from category parameter of {@link Editable} annotation.
+ *
+ * @param element
+ * annotated element to get category from
+ * @return
+ * category name of specified element, or <tt>null</tt> if not defined
+ */
+ public static @Nullable String getCategory(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null && editable.category().trim().length() != 0)
+ return editable.category();
+ else
+ return null;
+ }
+
+ /**
+ * Get autocomplete attribute of specified element from autocomplete parameter of {@link Editable} annotation.
+ *
+ * @param element
+ * annotated element to get autocomplete from
+ * @return
+ * autocomplete attribute of specified element, or <tt>null</tt> if not defined
+ */
+ public static @Nullable String getAutocomplete(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null && editable.autocomplete().trim().length() != 0)
+ return editable.autocomplete();
+ else
+ return null;
+ }
+
+ /**
+ * Get icon of specified element from icon parameter of {@link Editable} annotation.
+ *
+ * @param element
+ * annotated element to get icon from
+ * @return
+ * icon name of specified element, or <tt>null</tt> if not defined
+ */
+ public static @Nullable String getIcon(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null && editable.icon().trim().length() != 0)
+ return editable.icon();
+ else
+ return null;
+ }
+
+ /**
+ * Get description of specified element from description parameter of {@link Editable} annotation
+ *
+ * @param element
+ * annotated element to get description from
+ * @return
+ * defined description, or <tt>null</tt> if description can not be found
+ */
+ public static @Nullable String getDescription(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null) {
+ if (editable.description().length() != 0)
+ return editable.description();
+ if (editable.descriptionProvider().length() != 0) {
+ Class<?> clazz;
+ if (element instanceof Method)
+ clazz = ((Method) element).getDeclaringClass();
+ else if (element instanceof Class)
+ clazz = (Class<?>) element;
+ else
+ clazz = ((Field) element).getDeclaringClass();
+ return (String) ReflectionUtils.invokeStaticMethod(clazz, editable.descriptionProvider());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get display order parameter defined in {@link Editable} annotation of specified element.
+ *
+ * @param element
+ * annotated element to get order from
+ * @return
+ * defined order, or {@link Integer#MAX_VALUE} if Editable annotation is not found
+ */
+ public static int getOrder(AnnotatedElement element) {
+ Editable editable = element.getAnnotation(Editable.class);
+ if (editable != null)
+ return editable.order();
+ else
+ return Integer.MAX_VALUE;
+ }
+
+ /**
+ * Sort specified elements by order parameter defined in {@link Editable} annotation.
+ *
+ * @param annotatedElements
+ * annotated elements to be sorted
+ */
+ public static <T extends AnnotatedElement> void sortAnnotatedElements(List<T> annotatedElements) {
+ annotatedElements.sort((element1, element2) -> getOrder(element1) - getOrder(element2));
+ }
+
+ public static Class<?> getElementClass(Type listType) {
+ if (listType instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)listType;
+ Type rawType = parameterizedType.getRawType();
+ if (rawType instanceof Class<?>) {
+ Class<?> rawClazz = (Class<?>) rawType;
+ if (List.class.isAssignableFrom(rawClazz)) {
+ Type elementType = parameterizedType.getActualTypeArguments()[0];
+ if (elementType instanceof Class<?>) {
+ return (Class<?>) elementType;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static boolean hasEditableProperties(Class<?> beanClass) {
+ for (Method getter: BeanUtils.findGetters(ClassUtils.unproxy(beanClass))) {
+ Method setter = BeanUtils.findSetter(getter);
+ if (setter != null && getter.getAnnotation(Editable.class) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean isDefaultInstanceValid(Class<? extends Serializable> beanClass) {
+ Serializable bean = ReflectionUtils.instantiateClass(beanClass);
+ return AppLoader.getInstance(Validator.class).validate(bean).isEmpty();
+ }
+
+}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/annotation/Editable.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/annotation/Editable.java
index 9d18c0bd63..58d698d15e 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/annotation/Editable.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/annotation/Editable.java
@@ -19,4 +19,6 @@ public @interface Editable {
String description() default "";
String descriptionProvider() default "";
+
+ String autocomplete() default "";
}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.html b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.html
index 1e9b2ce357..ee3b56efc8 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.html
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.html
@@ -1,8 +1,8 @@
<wicket:panel>
<div>
- <input wicket:id="input" type="password" class="form-control" placeholder="Type password here" autocomplete="off">
+ <input wicket:id="input" type="password" class="form-control" placeholder="Type password here">
</div>
<div class="password-confirm">
- <input wicket:id="inputAgain" type="password" class="form-control" placeholder="Confirm password here" autocomplete="off">
+ <input wicket:id="inputAgain" type="password" class="form-control" placeholder="Confirm password here">
</div>
</wicket:panel>
\ No newline at end of file
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.java
index 6ad3b9a028..6e58d79b7c 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/ConfirmativePasswordPropertyEditor.java
@@ -7,6 +7,7 @@ import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.convert.ConversionException;
+import com.pmease.commons.wicket.editable.EditableUtils;
import com.pmease.commons.wicket.editable.ErrorContext;
import com.pmease.commons.wicket.editable.PathSegment;
import com.pmease.commons.wicket.editable.PropertyDescriptor;
@@ -37,6 +38,12 @@ public class ConfirmativePasswordPropertyEditor extends PropertyEditor<String> {
inputAgain.setRequired(false);
add(inputAgain);
+ String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
+ if (autocomplete != null) {
+ input.add(AttributeAppender.append("autocomplete", autocomplete));
+ inputAgain.add(AttributeAppender.append("autocomplete", autocomplete));
+ }
+
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.html b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.html
index c9381784b0..7268c25c0e 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.html
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.html
@@ -1,3 +1,3 @@
<wicket:panel>
- <input wicket:id="input" type="password" class="form-control focusable" autocomplete="off"></input>
+ <input wicket:id="input" type="password" class="form-control focusable"></input>
</wicket:panel>
\ No newline at end of file
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.java
index 7709d5690b..fe90130751 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/password/PasswordPropertyEditor.java
@@ -7,6 +7,7 @@ import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.util.convert.ConversionException;
+import com.pmease.commons.wicket.editable.EditableUtils;
import com.pmease.commons.wicket.editable.ErrorContext;
import com.pmease.commons.wicket.editable.PathSegment;
import com.pmease.commons.wicket.editable.PropertyDescriptor;
@@ -30,6 +31,10 @@ public class PasswordPropertyEditor extends PropertyEditor<String> {
input.setResetPassword(false);
add(input);
+ String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
+ if (autocomplete != null)
+ input.add(AttributeAppender.append("autocomplete", autocomplete));
+
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/string/StringPropertyEditor.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/string/StringPropertyEditor.java
index 94d0ec6b7b..3e1a6ad372 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/string/StringPropertyEditor.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/editable/string/StringPropertyEditor.java
@@ -1,83 +1,87 @@
-package com.pmease.commons.wicket.editable.string;
-
-import java.lang.reflect.Method;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.form.TextArea;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.convert.ConversionException;
-
-import com.pmease.commons.wicket.behavior.markdown.MarkdownBehavior;
-import com.pmease.commons.wicket.editable.EditableUtils;
-import com.pmease.commons.wicket.editable.ErrorContext;
-import com.pmease.commons.wicket.editable.PathSegment;
-import com.pmease.commons.wicket.editable.PropertyDescriptor;
-import com.pmease.commons.wicket.editable.PropertyEditor;
-import com.pmease.commons.wicket.editable.annotation.Markdown;
-import com.pmease.commons.wicket.editable.annotation.Multiline;
-import com.pmease.commons.wicket.editable.annotation.OmitName;
-
-@SuppressWarnings("serial")
-public class StringPropertyEditor extends PropertyEditor<String> {
-
- private FormComponent<String> input;
-
- public StringPropertyEditor(String id, PropertyDescriptor propertyDescriptor, IModel<String> propertyModel) {
- super(id, propertyDescriptor, propertyModel);
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
-
- Method getter = getPropertyDescriptor().getPropertyGetter();
- if (getter.getAnnotation(Markdown.class) != null) {
- Fragment fragment = new Fragment("content", "multiLineFrag", this);
- fragment.add(input = new TextArea<String>("input", Model.of(getModelObject())));
- input.add(new MarkdownBehavior());
- add(fragment);
- } else if (getter.getAnnotation(Multiline.class) != null) {
- Fragment fragment = new Fragment("content", "multiLineFrag", this);
- fragment.add(input = new TextArea<String>("input", Model.of(getModelObject())));
- input.setType(getPropertyDescriptor().getPropertyClass());
- add(fragment);
- } else {
- Fragment fragment = new Fragment("content", "singleLineFrag", this);
- fragment.add(input = new TextField<String>("input", Model.of(getModelObject())));
- input.setType(getPropertyDescriptor().getPropertyClass());
- add(fragment);
- }
- Method propertyGetter = getPropertyDescriptor().getPropertyGetter();
- if (propertyGetter.getAnnotation(OmitName.class) != null)
- input.add(AttributeModifier.replace("placeholder", EditableUtils.getName(propertyGetter)));
-
- add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
-
- @Override
- protected String load() {
- if (hasError(true))
- return " has-error";
- else
- return "";
- }
-
- }));
- }
-
- @Override
- public ErrorContext getErrorContext(PathSegment pathSegment) {
- return null;
- }
-
- @Override
- protected String convertInputToValue() throws ConversionException {
- return input.getConvertedInput();
- }
-
-}
+package com.pmease.commons.wicket.editable.string;
+
+import java.lang.reflect.Method;
+
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.util.convert.ConversionException;
+
+import com.pmease.commons.wicket.behavior.markdown.MarkdownBehavior;
+import com.pmease.commons.wicket.editable.EditableUtils;
+import com.pmease.commons.wicket.editable.ErrorContext;
+import com.pmease.commons.wicket.editable.PathSegment;
+import com.pmease.commons.wicket.editable.PropertyDescriptor;
+import com.pmease.commons.wicket.editable.PropertyEditor;
+import com.pmease.commons.wicket.editable.annotation.Markdown;
+import com.pmease.commons.wicket.editable.annotation.Multiline;
+import com.pmease.commons.wicket.editable.annotation.OmitName;
+
+@SuppressWarnings("serial")
+public class StringPropertyEditor extends PropertyEditor<String> {
+
+ private FormComponent<String> input;
+
+ public StringPropertyEditor(String id, PropertyDescriptor propertyDescriptor, IModel<String> propertyModel) {
+ super(id, propertyDescriptor, propertyModel);
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ Method getter = getPropertyDescriptor().getPropertyGetter();
+ if (getter.getAnnotation(Markdown.class) != null) {
+ Fragment fragment = new Fragment("content", "multiLineFrag", this);
+ fragment.add(input = new TextArea<String>("input", Model.of(getModelObject())));
+ input.add(new MarkdownBehavior());
+ add(fragment);
+ } else if (getter.getAnnotation(Multiline.class) != null) {
+ Fragment fragment = new Fragment("content", "multiLineFrag", this);
+ fragment.add(input = new TextArea<String>("input", Model.of(getModelObject())));
+ input.setType(getPropertyDescriptor().getPropertyClass());
+ add(fragment);
+ } else {
+ Fragment fragment = new Fragment("content", "singleLineFrag", this);
+ fragment.add(input = new TextField<String>("input", Model.of(getModelObject())));
+ input.setType(getPropertyDescriptor().getPropertyClass());
+ add(fragment);
+ }
+ Method propertyGetter = getPropertyDescriptor().getPropertyGetter();
+ if (propertyGetter.getAnnotation(OmitName.class) != null)
+ input.add(AttributeModifier.replace("placeholder", EditableUtils.getName(propertyGetter)));
+
+ String autocomplete = EditableUtils.getAutocomplete(getter);
+ if (autocomplete != null)
+ input.add(AttributeAppender.append("autocomplete", autocomplete));
+
+ add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
+
+ @Override
+ protected String load() {
+ if (hasError(true))
+ return " has-error";
+ else
+ return "";
+ }
+
+ }));
+ }
+
+ @Override
+ public ErrorContext getErrorContext(PathSegment pathSegment) {
+ return null;
+ }
+
+ @Override
+ protected String convertInputToValue() throws ConversionException {
+ return input.getConvertedInput();
+ }
+
+}
diff --git a/commons.wicket/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigationToolbar.html b/commons.wicket/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigationToolbar.html
new file mode 100644
index 0000000000..20cc402c6b
--- /dev/null
+++ b/commons.wicket/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigationToolbar.html
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<wicket:panel xmlns:wicket="http://wicket.apache.org">
+ <tr class="navigation">
+ <td wicket:id="span">
+ <div class="navigatorLabel"><div wicket:id="navigatorLabel">[navigator-label]</div></div>
+ <div class="navigator"><ul wicket:id="navigator">[navigator]</ul></div>
+ </td>
+ </tr>
+</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
index 7362ffce0c..5a735730ba 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
@@ -60,6 +60,7 @@ import com.pmease.gitplex.core.manager.TeamManager;
import com.pmease.gitplex.core.manager.TeamMembershipManager;
import com.pmease.gitplex.core.manager.UserAuthorizationManager;
import com.pmease.gitplex.core.manager.VerificationManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
import com.pmease.gitplex.core.manager.WorkManager;
import com.pmease.gitplex.core.manager.impl.DefaultAccountManager;
import com.pmease.gitplex.core.manager.impl.DefaultAttachmentManager;
@@ -91,6 +92,7 @@ import com.pmease.gitplex.core.manager.impl.DefaultTeamManager;
import com.pmease.gitplex.core.manager.impl.DefaultTeamMembershipManager;
import com.pmease.gitplex.core.manager.impl.DefaultUserAuthorizationManager;
import com.pmease.gitplex.core.manager.impl.DefaultVerificationManager;
+import com.pmease.gitplex.core.manager.impl.DefaultVisitInfoManager;
import com.pmease.gitplex.core.manager.impl.DefaultWorkManager;
import com.pmease.gitplex.core.security.SecurityRealm;
import com.pmease.gitplex.core.setting.SpecifiedGit;
@@ -187,6 +189,7 @@ public class CoreModule extends AbstractPluginModule {
bind(CommitInfoManager.class).to(DefaultCommitInfoManager.class);
bind(PullRequestInfoManager.class).to(DefaultPullRequestInfoManager.class);
bind(CodeCommentInfoManager.class).to(DefaultCodeCommentInfoManager.class);
+ bind(VisitInfoManager.class).to(DefaultVisitInfoManager.class);
bind(WorkManager.class).to(DefaultWorkManager.class);
bind(SequentialWorkManager.class).to(DefaultSequentialWorkManager.class);
bind(TeamManager.class).to(DefaultTeamManager.class);
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Account.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Account.java
index 7ea91bf5e8..5fac9e9ca2 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Account.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Account.java
@@ -5,13 +5,13 @@ import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import javax.annotation.Nullable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
-import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Version;
@@ -20,7 +20,6 @@ import javax.validation.constraints.NotNull;
import org.eclipse.jgit.lib.PersonIdent;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.annotations.OptimisticLock;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@@ -34,7 +33,6 @@ import com.pmease.commons.wicket.editable.annotation.ExcludeValues;
import com.pmease.commons.wicket.editable.annotation.Markdown;
import com.pmease.commons.wicket.editable.annotation.Password;
import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.entity.component.DepotVisits;
import com.pmease.gitplex.core.manager.TeamAuthorizationManager;
import com.pmease.gitplex.core.manager.TeamMembershipManager;
import com.pmease.gitplex.core.manager.UserAuthorizationManager;
@@ -78,10 +76,9 @@ public class Account extends AbstractUser implements ProtectedObject {
private String noSpaceFullName;
private Date avatarUploadDate;
-
- @Lob
- @OptimisticLock(excluded=true)
- private DepotVisits depotVisits = new DepotVisits();
+
+ @Column(nullable=false)
+ private String uuid = UUID.randomUUID().toString();
/*
* Optimistic lock is necessary to ensure database integrity when update
@@ -147,7 +144,7 @@ public class Account extends AbstractUser implements ProtectedObject {
private transient Map<Account, OrganizationMembership> organizationMembersMap;
- @Editable(name="Name", order=100)
+ @Editable(name="Login Name", order=100)
@AccountName
@NotEmpty
@Override
@@ -161,6 +158,14 @@ public class Account extends AbstractUser implements ProtectedObject {
noSpaceName = StringUtils.deleteWhitespace(name);
}
+ @Editable(order=150, autocomplete="new-password")
+ @Password(confirmative=true)
+ @NotEmpty
+ @Length(min=5, message="Password length should not less than 5")
+ public String getPassword() {
+ return super.getPassword();
+ }
+
@Editable(order=200)
public String getFullName() {
return fullName;
@@ -218,14 +223,6 @@ public class Account extends AbstractUser implements ProtectedObject {
this.defaultPrivilege = defaultPrivilege;
}
- @Editable(order=400)
- @Password(confirmative=true)
- @NotEmpty
- @Length(min=5, message="Password length should not less than 5")
- public String getPassword() {
- return super.getPassword();
- }
-
public Date getAvatarUploadDate() {
return avatarUploadDate;
}
@@ -433,12 +430,12 @@ public class Account extends AbstractUser implements ProtectedObject {
return organizationMembersMap;
}
- public DepotVisits getDepotVisits() {
- return depotVisits;
+ public String getUUID() {
+ return uuid;
}
- public void setDepotVisits(DepotVisits depotVisits) {
- this.depotVisits = depotVisits;
+ public void setUUID(String uuid) {
+ this.uuid = uuid;
}
@Override
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java
index b0cb44936f..e198e5c78c 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeComment.java
@@ -2,7 +2,9 @@ package com.pmease.gitplex.core.entity;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.Date;
+import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
@@ -27,6 +29,8 @@ import com.pmease.commons.hibernate.dao.Dao;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.component.CompareContext;
import com.pmease.gitplex.core.entity.component.Mark;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+import com.pmease.gitplex.core.security.SecurityUtils;
/*
* @DynamicUpdate annotation here along with various @OptimisticLock annotations
@@ -91,6 +95,8 @@ public class CodeComment extends AbstractEntity {
@Column(nullable=false)
private String uuid = UUID.randomUUID().toString();
+ private transient List<CodeCommentReply> sortedReplies;
+
public Depot getDepot() {
return depot;
}
@@ -225,4 +231,21 @@ public class CodeComment extends AbstractEntity {
this.lastReplyUser = lastReplyUser;
}
+ public boolean isVisited(boolean includingReplies) {
+ Account user = SecurityUtils.getAccount();
+ if (user != null) {
+ Date visitDate = GitPlex.getInstance(VisitInfoManager.class).getVisitDate(user, this);
+ return visitDate != null && visitDate.after(includingReplies?getUpdateDate():getCreateDate());
+ } else {
+ return true;
+ }
+ }
+
+ public List<CodeCommentReply> getSortedReplies() {
+ if (sortedReplies == null) {
+ sortedReplies = new ArrayList<>(getReplies());
+ sortedReplies.sort(Comparator.comparing(CodeCommentReply::getId));
+ }
+ return sortedReplies;
+ }
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeCommentReply.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeCommentReply.java
index 0b86f55226..ce2738e156 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeCommentReply.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/CodeCommentReply.java
@@ -15,7 +15,10 @@ import javax.persistence.Version;
import org.hibernate.annotations.DynamicUpdate;
import com.pmease.commons.hibernate.AbstractEntity;
+import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.component.CompareContext;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+import com.pmease.gitplex.core.security.SecurityUtils;
/*
* @DynamicUpdate annotation here along with various @OptimisticLock annotations
@@ -97,4 +100,14 @@ public class CodeCommentReply extends AbstractEntity {
this.version = version;
}
+ public boolean isVisited() {
+ Account user = SecurityUtils.getAccount();
+ if (user != null) {
+ Date visitDate = GitPlex.getInstance(VisitInfoManager.class).getVisitDate(user, getComment());
+ return visitDate != null && visitDate.after(getDate());
+ } else {
+ return true;
+ }
+ }
+
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java
index 16769f8a50..0bef42b2b1 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/Depot.java
@@ -89,6 +89,8 @@ import com.pmease.gitplex.core.listener.RefListener;
import com.pmease.gitplex.core.manager.ConfigManager;
import com.pmease.gitplex.core.manager.DepotManager;
import com.pmease.gitplex.core.manager.StorageManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+import com.pmease.gitplex.core.security.SecurityUtils;
import com.pmease.gitplex.core.security.protectedobject.AccountBelonging;
import com.pmease.gitplex.core.security.protectedobject.ProtectedObject;
import com.pmease.gitplex.core.util.validation.DepotName;
@@ -725,7 +727,7 @@ public class Depot extends AbstractEntity implements AccountBelonging {
path = "";
final File cacheDir = new File(
- GitPlex.getInstance(StorageManager.class).getCacheDir(this),
+ GitPlex.getInstance(StorageManager.class).getInfoDir(this),
"last_commits/" + path + "/gitplex_last_commits");
final ReadWriteLock lock;
@@ -1021,4 +1023,24 @@ public class Depot extends AbstractEntity implements AccountBelonging {
}
}
+ public static int compareLastVisit(Depot depot1, Depot depot2) {
+ Account user = SecurityUtils.getAccount();
+ if (user != null) {
+ Date date1 = GitPlex.getInstance(VisitInfoManager.class).getVisitDate(user, depot1);
+ Date date2 = GitPlex.getInstance(VisitInfoManager.class).getVisitDate(user, depot2);
+ if (date1 != null) {
+ if (date2 != null)
+ return date2.compareTo(date1);
+ else
+ return -1;
+ } else {
+ if (date2 != null)
+ return 1;
+ else
+ return depot1.compareTo(depot2);
+ }
+ } else {
+ return depot1.compareTo(depot2);
+ }
+ }
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/DepotVisits.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/DepotVisits.java
deleted file mode 100644
index d491f404c8..0000000000
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/entity/component/DepotVisits.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.pmease.gitplex.core.entity.component;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.pmease.gitplex.core.entity.Depot;
-
-public class DepotVisits implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final int MAX_VISITED = 100;
-
- private List<Long> visited = new ArrayList<>();
-
- public void visit(Depot depot) {
- visited.remove(depot.getId());
- visited.add(0, depot.getId());
- if (visited.size() > MAX_VISITED) {
- for (int i=MAX_VISITED; i<visited.size(); i++) {
- visited.remove(i);
- }
- }
- }
-
- public Comparator<Depot> getComparator() {
- Map<Long, Integer> visitOrder = new HashMap<>();
- for (int i=0; i<visited.size(); i++) {
- visitOrder.put(visited.get(i), i);
- }
-
- return (depot1, depot2) -> {
- Integer order1 = visitOrder.get(depot1.getId());
- Integer order2 = visitOrder.get(depot2.getId());
- if (order1 != null && order2 != null) {
- return order1 - order2;
- } else if (order1 != null && order2 == null) {
- return -1;
- } else if (order1 == null && order2 != null) {
- return 1;
- } else {
- return depot1.compareTo(depot2);
- }
- };
- }
-}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentInfoManager.java
index a9f041c071..a5b585d3d1 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentInfoManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/CodeCommentInfoManager.java
@@ -1,5 +1,6 @@
package com.pmease.gitplex.core.manager;
+import java.util.List;
import java.util.Map;
import org.eclipse.jgit.lib.ObjectId;
@@ -18,6 +19,8 @@ public interface CodeCommentInfoManager {
*/
Map<String, String> getComments(Depot depot, ObjectId commit);
+ List<String> getCommentedFiles(Depot depot);
+
void removeComment(Depot depot, ObjectId commit, String comment);
-}
+}
\ No newline at end of file
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/StorageManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/StorageManager.java
index 27646b0948..f5ab4cad40 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/StorageManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/StorageManager.java
@@ -25,12 +25,12 @@ public interface StorageManager {
File getIndexDir(Depot depot);
/**
- * Get directory to store cache data of specified depot
+ * Get directory to store additional info of specified depot
*
* @return
- * directory to store cache data, the directory will be exist after calling this method
+ * directory to store additional info, the directory will be exist after calling this method
*/
- File getCacheDir(Depot depot);
+ File getInfoDir(Depot depot);
/**
* Get directory to store cache data of specified pull request
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/VisitInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/VisitInfoManager.java
new file mode 100644
index 0000000000..2f3a5dae0d
--- /dev/null
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/VisitInfoManager.java
@@ -0,0 +1,29 @@
+package com.pmease.gitplex.core.manager;
+
+import java.util.Date;
+
+import javax.annotation.Nullable;
+
+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;
+
+public interface VisitInfoManager {
+
+ void visit(Account user, Depot depot);
+
+ void visit(Account user, PullRequest request);
+
+ void visit(Account user, CodeComment comment);
+
+ @Nullable
+ Date getVisitDate(Account user, Depot depot);
+
+ @Nullable
+ Date getVisitDate(Account user, PullRequest request);
+
+ @Nullable
+ Date getVisitDate(Account user, CodeComment comment);
+
+}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentInfoManager.java
index 85d75d3aff..5703f6b24a 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentInfoManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentInfoManager.java
@@ -2,14 +2,18 @@ package com.pmease.gitplex.core.manager.impl;
import java.io.File;
import java.io.Serializable;
+import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
import javax.inject.Inject;
@@ -55,11 +59,13 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
private static final Logger logger = LoggerFactory.getLogger(DefaultCodeCommentInfoManager.class);
- private static final String INFO_DIR = "codeCommentInfo";
+ private static final String INFO_DIR = "codeComment";
private static final String DEFAULT_STORE = "default";
private static final ByteIterable LAST_COMMENT_KEY = new StringByteIterable("lastComment");
+
+ private static final ByteIterable FILES_KEY = new StringByteIterable("files");
private static final int PRIORITY = 100;
@@ -79,6 +85,8 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
private final Map<Long, Environment> envs = new HashMap<>();
+ private final Map<Long, List<String>> filesCache = new ConcurrentHashMap<>();
+
@Inject
public DefaultCodeCommentInfoManager(Dao dao, DepotManager depotManager, StorageManager storageManager,
CodeCommentManager codeCommentManager, WorkManager workManager,
@@ -109,7 +117,7 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
}
private File getInfoDir(Depot depot) {
- File infoDir = new File(storageManager.getCacheDir(depot), INFO_DIR);
+ File infoDir = new File(storageManager.getInfoDir(depot), INFO_DIR);
if (!infoDir.exists())
FileUtils.createDir(infoDir);
return infoDir;
@@ -130,6 +138,7 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
Environment env = envs.remove(depot.getId());
if (env != null)
env.close();
+ filesCache.remove(depot.getId());
FileUtils.deleteDir(getInfoDir(depot));
}
@@ -144,12 +153,6 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
return null;
}
- static class StringByteIterable extends ArrayByteIterable {
- StringByteIterable(String value) {
- super(value.getBytes());
- }
- }
-
@Override
public void systemStarting() {
}
@@ -194,18 +197,17 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
Environment env = getEnv(depot);
Store store = getStore(env, DEFAULT_STORE);
- AtomicReference<String> lastComment = new AtomicReference<>();
- env.executeInTransaction(new TransactionalExecutable() {
+ String lastComment = env.computeInTransaction(new TransactionalComputable<String>() {
@Override
- public void execute(final Transaction txn) {
+ public String compute(final Transaction txn) {
byte[] value = getBytes(store.get(txn, LAST_COMMENT_KEY));
- lastComment.set(value!=null?new String(value):null);
+ return value!=null?new String(value):null;
}
});
- for (CodeComment comment: codeCommentManager.queryAfter(depot, lastComment.get())) {
+ for (CodeComment comment: codeCommentManager.queryAfter(depot, lastComment)) {
env.executeInTransaction(new TransactionalExecutable() {
@SuppressWarnings("unchecked")
@@ -226,8 +228,22 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
comments.put(comment.getUUID(), comment.getCompareContext().getCompareCommit());
else
comments.put(comment.getUUID(), null);
- store.add(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) comments)));
- store.add(txn, LAST_COMMENT_KEY, key);
+ store.put(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) comments)));
+
+ if (comment.getPath() != null) {
+ Set<String> files;
+ valueBytes = getBytes(store.get(txn, FILES_KEY));
+ if (valueBytes != null)
+ files = (Set<String>) SerializationUtils.deserialize(valueBytes);
+ else
+ files = new HashSet<String>();
+ files.add(comment.getPath());
+ store.put(txn, FILES_KEY, new ArrayByteIterable(SerializationUtils.serialize((Serializable) files)));
+
+ filesCache.remove(depot.getId());
+ }
+
+ store.put(txn, LAST_COMMENT_KEY, key);
}
});
@@ -311,10 +327,43 @@ public class DefaultCodeCommentInfoManager implements CodeCommentInfoManager, De
else
storedComments = new HashSet<>();
storedComments.remove(comment);
- store.add(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) storedComments)));
+ store.put(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) storedComments)));
}
});
}
+ @Override
+ public List<String> getCommentedFiles(Depot depot) {
+ List<String> files = filesCache.get(depot.getId());
+ if (files == null) {
+ Environment env = getEnv(depot);
+ final Store store = getStore(env, DEFAULT_STORE);
+
+ files = env.computeInReadonlyTransaction(new TransactionalComputable<List<String>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> compute(Transaction txn) {
+ byte[] bytes = getBytes(store.get(txn, FILES_KEY));
+ if (bytes != null) {
+ List<String> files = new ArrayList<>((Set<String>)SerializationUtils.deserialize(bytes));
+ files.sort((file1, file2)->Paths.get(file1).compareTo(Paths.get(file2)));
+ return files;
+ } else {
+ return new ArrayList<>();
+ }
+ }
+ });
+ filesCache.put(depot.getId(), files);
+ }
+ return files;
+ }
+
+ static class StringByteIterable extends ArrayByteIterable {
+ StringByteIterable(String value) {
+ super(value.getBytes());
+ }
+ }
+
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java
index 82874ba734..c7cdb3c14e 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentManager.java
@@ -26,6 +26,8 @@ import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.listener.CodeCommentListener;
import com.pmease.gitplex.core.manager.CodeCommentManager;
import com.pmease.gitplex.core.manager.CodeCommentReplyManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+import com.pmease.gitplex.core.security.SecurityUtils;
@Singleton
public class DefaultCodeCommentManager extends AbstractEntityDao<CodeComment> implements CodeCommentManager {
@@ -34,12 +36,15 @@ public class DefaultCodeCommentManager extends AbstractEntityDao<CodeComment> im
private final CodeCommentReplyManager codeCommentReplyManager;
+ private final VisitInfoManager visitInfoManager;
+
@Inject
public DefaultCodeCommentManager(Dao dao, Provider<Set<CodeCommentListener>> listenersProvider,
- CodeCommentReplyManager codeCommentReplyManager) {
+ CodeCommentReplyManager codeCommentReplyManager, VisitInfoManager visitInfoManager) {
super(dao);
this.listenersProvider = listenersProvider;
this.codeCommentReplyManager = codeCommentReplyManager;
+ this.visitInfoManager = visitInfoManager;
}
@Sessional
@@ -74,6 +79,7 @@ public class DefaultCodeCommentManager extends AbstractEntityDao<CodeComment> im
for (CodeCommentListener listener: listenersProvider.get())
listener.onSaveComment(comment);
dao.persist(comment);
+ visitInfoManager.visit(SecurityUtils.getAccount(), comment);
}
@Transactional
@@ -111,6 +117,7 @@ public class DefaultCodeCommentManager extends AbstractEntityDao<CodeComment> im
public void save(CodeComment comment, CodeCommentReply reply) {
save(comment);
codeCommentReplyManager.save(reply);
+ visitInfoManager.visit(SecurityUtils.getAccount(), comment);
}
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentReplyManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentReplyManager.java
index 6fbc87dedd..eed7d3dee4 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentReplyManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCodeCommentReplyManager.java
@@ -17,6 +17,8 @@ import com.pmease.gitplex.core.entity.CodeCommentReply;
import com.pmease.gitplex.core.listener.CodeCommentReplyListener;
import com.pmease.gitplex.core.manager.CodeCommentManager;
import com.pmease.gitplex.core.manager.CodeCommentReplyManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+import com.pmease.gitplex.core.security.SecurityUtils;
@Singleton
public class DefaultCodeCommentReplyManager extends AbstractEntityDao<CodeCommentReply>
@@ -24,13 +26,16 @@ public class DefaultCodeCommentReplyManager extends AbstractEntityDao<CodeCommen
private final CodeCommentManager codeCommentManager;
+ private final VisitInfoManager visitInfoManager;
+
private final Provider<Set<CodeCommentReplyListener>> listenersProvider;
@Inject
public DefaultCodeCommentReplyManager(Dao dao, CodeCommentManager codeCommentManager,
- Provider<Set<CodeCommentReplyListener>> listenersProvider) {
+ VisitInfoManager visitInfoManager, Provider<Set<CodeCommentReplyListener>> listenersProvider) {
super(dao);
this.codeCommentManager = codeCommentManager;
+ this.visitInfoManager = visitInfoManager;
this.listenersProvider = listenersProvider;
}
@@ -43,6 +48,7 @@ public class DefaultCodeCommentReplyManager extends AbstractEntityDao<CodeCommen
reply.getComment().setUpdateDate(reply.getDate());
reply.getComment().setLastReplyUser(reply.getUser().getDisplayName());
codeCommentManager.save(reply.getComment());
+ visitInfoManager.visit(SecurityUtils.getAccount(), reply.getComment());
}
@Transactional
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommitInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommitInfoManager.java
index 2f37a68cd1..fc3885d5ee 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommitInfoManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultCommitInfoManager.java
@@ -3,7 +3,6 @@ package com.pmease.gitplex.core.manager.impl;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
-import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
@@ -21,9 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
import javax.inject.Inject;
@@ -76,7 +72,7 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
private static final Logger logger = LoggerFactory.getLogger(DefaultCommitInfoManager.class);
- private static final String INFO_DIR = "commitInfo";
+ private static final String INFO_DIR = "commit";
private static final String DEFAULT_STORE = "default";
@@ -131,60 +127,50 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
}
private void doCollect(Depot depot, ObjectId commit) {
- logger.info("Collecting commits information (repository: {}, until commit: {})",
+ logger.info("Collecting commit information (repository: {}, until commit: {})",
depot.getFQN(), commit.name());
Environment env = getEnv(depot);
- final Store defaultStore = getStore(env, DEFAULT_STORE);
- final Store commitsStore = getStore(env, COMMITS_STORE);
- final Store contributionsStore = getStore(env, CONTRIBUTIONS_STORE);
+ Store defaultStore = getStore(env, DEFAULT_STORE);
+ Store commitsStore = getStore(env, COMMITS_STORE);
+ Store contributionsStore = getStore(env, CONTRIBUTIONS_STORE);
- final AtomicReference<String> lastCommit = new AtomicReference<>();
- env.executeInTransaction(new TransactionalExecutable() {
-
- @Override
- public void execute(final Transaction txn) {
- byte[] value = getBytes(defaultStore.get(txn, LAST_COMMIT_KEY));
- lastCommit.set(value!=null?new String(value):null);
- }
- });
-
env.executeInTransaction(new TransactionalExecutable() {
@SuppressWarnings("unchecked")
@Override
public void execute(final Transaction txn) {
byte[] bytes = getBytes(defaultStore.get(txn, LAST_COMMIT_KEY));
- AtomicReference<String> lastCommit;
+ String lastCommit;
if (bytes != null)
- lastCommit = new AtomicReference<>(new String(bytes));
+ lastCommit = new String(bytes);
else
- lastCommit = new AtomicReference<>(null);
+ lastCommit = null;
bytes = getBytes(defaultStore.get(txn, COMMIT_COUNT_KEY));
- AtomicInteger commitCount;
+ int commitCount;
if (bytes != null)
- commitCount = new AtomicInteger((int) SerializationUtils.deserialize(bytes));
+ commitCount = (int) SerializationUtils.deserialize(bytes);
else
- commitCount = new AtomicInteger(0);
+ commitCount = 0;
- AtomicBoolean commitCountChanged = new AtomicBoolean(false);
+ boolean commitCountChanged = false;
Git git = depot.git();
LogCommand log = new LogCommand(git.depotDir());
List<String> revisions = new ArrayList<>();
- if (lastCommit.get() != null) {
- revisions.add(lastCommit.get() + ".." + commit.name());
- lastCommit.set(null);
+ if (lastCommit != null) {
+ revisions.add(lastCommit + ".." + commit.name());
+ lastCommit = null;
} else {
revisions.add(commit.name());
}
- AtomicReference<Set<NameAndEmail>> contributors = new AtomicReference<>(null);
- AtomicBoolean contributorsChanged = new AtomicBoolean(false);
+ Set<NameAndEmail> contributors = null;
+ boolean contributorsChanged = false;
- AtomicReference<Set<String>> files = new AtomicReference<>(null);
- AtomicBoolean filesChanged = new AtomicBoolean(false);
+ Set<String> files = null;
+ boolean filesChanged = false;
/*
* Use a synchronous queue to achieve below purpose:
@@ -254,8 +240,8 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
}
commitsStore.put(txn, key, new ArrayByteIterable(newValueBytes));
- commitCount.incrementAndGet();
- commitCountChanged.set(true);
+ commitCount++;
+ commitCountChanged = true;
for (String parentHash: commit.getParentHashes()) {
keyBytes = new byte[20];
@@ -271,28 +257,28 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
commitId.copyRawTo(newValueBytes, newValueBytes.length-20);
commitsStore.put(txn, key, new ArrayByteIterable(newValueBytes));
}
- if (contributors.get() == null) {
+ if (contributors == null) {
bytes = getBytes(defaultStore.get(txn, CONTRIBUTORS_KEY));
if (bytes != null)
- contributors.set((Set<NameAndEmail>) SerializationUtils.deserialize(bytes));
+ contributors = (Set<NameAndEmail>) SerializationUtils.deserialize(bytes);
else
- contributors.set(new HashSet<NameAndEmail>());
+ contributors = new HashSet<NameAndEmail>();
}
if (StringUtils.isNotBlank(commit.getAuthor().getName())
|| StringUtils.isNotBlank(commit.getAuthor().getEmailAddress())) {
NameAndEmail contributor = new NameAndEmail(commit.getAuthor());
- if (!contributors.get().contains(contributor)) {
- contributors.get().add(contributor);
- contributorsChanged.set(true);
+ if (!contributors.contains(contributor)) {
+ contributors.add(contributor);
+ contributorsChanged = true;
}
}
- if (files.get() == null) {
+ if (files == null) {
bytes = getBytes(defaultStore.get(txn, FILES_KEY));
if (bytes != null)
- files.set((Set<String>) SerializationUtils.deserialize(bytes));
+ files = (Set<String>) SerializationUtils.deserialize(bytes);
else
- files.set(new HashSet<String>());
+ files = new HashSet<String>();
}
for (String file: commit.getChangedFiles()) {
@@ -315,38 +301,38 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
bytes = SerializationUtils.serialize((Serializable) fileContributions);
contributionsStore.put(txn, fileKey, new ArrayByteIterable(bytes));
- if (!files.get().contains(file)) {
- files.get().add(file);
- filesChanged.set(true);
+ if (!files.contains(file)) {
+ files.add(file);
+ filesChanged = true;
}
}
- if (lastCommit.get() == null)
- lastCommit.set(commit.getHash());
+ if (lastCommit == null)
+ lastCommit = commit.getHash();
}
} catch (Exception e) {
logger.error("Error processing commit " + commit.getHash(), e);
}
}
- if (contributorsChanged.get()) {
- bytes = SerializationUtils.serialize((Serializable) contributors.get());
+ if (contributorsChanged) {
+ bytes = SerializationUtils.serialize((Serializable) contributors);
defaultStore.put(txn, CONTRIBUTORS_KEY, new ArrayByteIterable(bytes));
contributorsCache.remove(depot.getId());
}
- if (filesChanged.get()) {
- bytes = SerializationUtils.serialize((Serializable) files.get());
+ if (filesChanged) {
+ bytes = SerializationUtils.serialize((Serializable) files);
defaultStore.put(txn, FILES_KEY, new ArrayByteIterable(bytes));
filesCache.remove(depot.getId());
}
- if (lastCommit.get() != null) {
- bytes = lastCommit.get().getBytes();
+ if (lastCommit != null) {
+ bytes = lastCommit.getBytes();
defaultStore.put(txn, LAST_COMMIT_KEY, new ArrayByteIterable(bytes));
}
- if (commitCountChanged.get()) {
- bytes = SerializationUtils.serialize(commitCount.get());
+ if (commitCountChanged) {
+ bytes = SerializationUtils.serialize(commitCount);
defaultStore.put(txn, COMMIT_COUNT_KEY, new ArrayByteIterable(bytes));
- commitCountCache.put(depot.getId(), commitCount.get());
+ commitCountCache.put(depot.getId(), commitCount);
}
}
});
@@ -400,7 +386,7 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
}
private File getInfoDir(Depot depot) {
- File infoDir = new File(storageManager.getCacheDir(depot), INFO_DIR);
+ File infoDir = new File(storageManager.getInfoDir(depot), INFO_DIR);
if (!infoDir.exists())
FileUtils.createDir(infoDir);
return infoDir;
@@ -457,13 +443,8 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
public List<String> compute(Transaction txn) {
byte[] bytes = getBytes(store.get(txn, FILES_KEY));
if (bytes != null) {
- List<Path> paths = new ArrayList<>();
- for (String file: (Set<String>)SerializationUtils.deserialize(bytes))
- paths.add(Paths.get(file));
- paths.sort(Path::compareTo);
- List<String> files = new ArrayList<>();
- for (Path path: paths)
- files.add(path.toString().replace('\\', '/'));
+ List<String> files = new ArrayList<>((Set<String>)SerializationUtils.deserialize(bytes));
+ files.sort((file1, file2)->Paths.get(file1).compareTo(Paths.get(file2)));
return files;
} else {
return new ArrayList<>();
@@ -614,6 +595,8 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
if (env != null)
env.close();
filesCache.remove(depot.getId());
+ commitCountCache.remove(depot.getId());
+ contributorsCache.remove(depot.getId());
FileUtils.deleteDir(getInfoDir(depot));
}
@@ -628,12 +611,6 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
return null;
}
- static class StringByteIterable extends ArrayByteIterable {
- StringByteIterable(String value) {
- super(value.getBytes());
- }
- }
-
@Override
public void systemStarting() {
}
@@ -724,4 +701,10 @@ public class DefaultCommitInfoManager implements CommitInfoManager, DepotListene
public void onSaveDepot(Depot depot) {
}
+ static class StringByteIterable extends ArrayByteIterable {
+ StringByteIterable(String value) {
+ super(value.getBytes());
+ }
+ }
+
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestInfoManager.java
index 8aeb6ce959..c79193801b 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestInfoManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultPullRequestInfoManager.java
@@ -12,7 +12,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
import javax.inject.Inject;
@@ -59,7 +58,7 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
private static final Logger logger = LoggerFactory.getLogger(DefaultPullRequestInfoManager.class);
- private static final String INFO_DIR = "pullRequestInfo";
+ private static final String INFO_DIR = "pullRequest";
private static final String DEFAULT_STORE = "default";
@@ -113,7 +112,7 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
}
private File getInfoDir(Depot depot) {
- File infoDir = new File(storageManager.getCacheDir(depot), INFO_DIR);
+ File infoDir = new File(storageManager.getInfoDir(depot), INFO_DIR);
if (!infoDir.exists())
FileUtils.createDir(infoDir);
return infoDir;
@@ -148,12 +147,6 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
return null;
}
- static class StringByteIterable extends ArrayByteIterable {
- StringByteIterable(String value) {
- super(value.getBytes());
- }
- }
-
@Override
public void systemStarting() {
}
@@ -196,20 +189,19 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
private void doCollect(Depot depot) {
Environment env = getEnv(depot);
- Store defaultStore = getStore(env, DEFAULT_STORE);
+ Store store = getStore(env, DEFAULT_STORE);
- AtomicReference<String> lastUpdate = new AtomicReference<>();
- env.executeInTransaction(new TransactionalExecutable() {
+ String lastUpdate = env.computeInTransaction(new TransactionalComputable<String>() {
@Override
- public void execute(final Transaction txn) {
- byte[] value = getBytes(defaultStore.get(txn, LAST_UPDATE_KEY));
- lastUpdate.set(value!=null?new String(value):null);
+ public String compute(Transaction txn) {
+ byte[] value = getBytes(store.get(txn, LAST_UPDATE_KEY));
+ return value!=null?new String(value):null;
}
});
- for (PullRequestUpdate update: pullRequestUpdateManager.queryAfter(depot, lastUpdate.get())) {
+ for (PullRequestUpdate update: pullRequestUpdateManager.queryAfter(depot, lastUpdate)) {
try (RevWalk revWalk = new RevWalk(depot.getRepository())) {
List<ObjectId> commits = new ArrayList<>();
revWalk.markStart(revWalk.lookupCommit(ObjectId.fromString(update.getHeadCommitHash())));
@@ -225,16 +217,16 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
byte[] keyBytes = new byte[20];
commit.copyRawTo(keyBytes, 0);
ByteIterable commitKey = new ArrayByteIterable(keyBytes);
- byte[] valueBytes = getBytes(defaultStore.get(txn, commitKey));
+ byte[] valueBytes = getBytes(store.get(txn, commitKey));
Collection<String> requests;
if (valueBytes != null)
requests = (Collection<String>) SerializationUtils.deserialize(valueBytes);
else
requests = new HashSet<>();
requests.add(update.getRequest().getUUID());
- defaultStore.add(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) requests)));
+ store.put(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) requests)));
}
- defaultStore.add(txn, LAST_UPDATE_KEY, key);
+ store.put(txn, LAST_UPDATE_KEY, key);
}
});
@@ -318,11 +310,17 @@ public class DefaultPullRequestInfoManager implements PullRequestInfoManager, De
else
storedRequests = new HashSet<>();
storedRequests.remove(request);
- store.add(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) storedRequests)));
+ store.put(txn, commitKey, new ArrayByteIterable(SerializationUtils.serialize((Serializable) storedRequests)));
}
}
});
}
+ static class StringByteIterable extends ArrayByteIterable {
+ StringByteIterable(String value) {
+ super(value.getBytes());
+ }
+ }
+
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultStorageManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultStorageManager.java
index b1fddf19a2..d39731635c 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultStorageManager.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultStorageManager.java
@@ -43,8 +43,8 @@ public class DefaultStorageManager implements StorageManager {
}
@Override
- public File getCacheDir(Depot depot) {
- File cacheDir = new File(getDepotDir(depot), "cache");
+ public File getInfoDir(Depot depot) {
+ File cacheDir = new File(getDepotDir(depot), "info");
FileUtils.createDir(cacheDir);
return cacheDir;
}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultVisitInfoManager.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultVisitInfoManager.java
new file mode 100644
index 0000000000..9df9b5c0fc
--- /dev/null
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/manager/impl/DefaultVisitInfoManager.java
@@ -0,0 +1,220 @@
+package com.pmease.gitplex.core.manager.impl;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Nullable;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.pmease.commons.util.FileUtils;
+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.manager.StorageManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
+
+import jetbrains.exodus.ArrayByteIterable;
+import jetbrains.exodus.ByteIterable;
+import jetbrains.exodus.env.Environment;
+import jetbrains.exodus.env.EnvironmentConfig;
+import jetbrains.exodus.env.Environments;
+import jetbrains.exodus.env.Store;
+import jetbrains.exodus.env.StoreConfig;
+import jetbrains.exodus.env.Transaction;
+import jetbrains.exodus.env.TransactionalComputable;
+import jetbrains.exodus.env.TransactionalExecutable;
+
+@Singleton
+public class DefaultVisitInfoManager implements VisitInfoManager {
+
+ private static final String INFO_DIR = "visit";
+
+ private static final String DEFAULT_STORE = "default";
+
+ private static final String PULL_REQUEST_STORE = "pullRequest";
+
+ private static final String CODE_COMMENT_STORE = "codeComment";
+
+ private final Map<Long, Environment> envs = new HashMap<>();
+
+ private final StorageManager storageManager;
+
+ @Inject
+ public DefaultVisitInfoManager(StorageManager storageManager) {
+ this.storageManager = storageManager;
+ }
+
+ private synchronized Environment getEnv(Depot depot) {
+ Environment env = envs.get(depot.getId());
+ if (env == null) {
+ EnvironmentConfig config = new EnvironmentConfig();
+ config.setLogCacheShared(false);
+ config.setMemoryUsage(1024*1024*16);
+ env = Environments.newInstance(getInfoDir(depot), config);
+ envs.put(depot.getId(), env);
+ }
+ return env;
+ }
+
+ private File getInfoDir(Depot depot) {
+ File infoDir = new File(storageManager.getInfoDir(depot), INFO_DIR);
+ if (!infoDir.exists())
+ FileUtils.createDir(infoDir);
+ return infoDir;
+ }
+
+ private Store getStore(Environment env, String storeName) {
+ return env.computeInTransaction(new TransactionalComputable<Store>() {
+ @Override
+ public Store compute(Transaction txn) {
+ return env.openStore(storeName, StoreConfig.WITHOUT_DUPLICATES, txn);
+ }
+ });
+ }
+
+ private byte[] getBytes(@Nullable ByteIterable byteIterable) {
+ if (byteIterable != null)
+ return Arrays.copyOf(byteIterable.getBytesUnsafe(), byteIterable.getLength());
+ else
+ return null;
+ }
+
+ @Override
+ public void visit(Account user, Depot depot) {
+ Environment env = getEnv(depot);
+ Store store = getStore(env, DEFAULT_STORE);
+ env.executeInTransaction(new TransactionalExecutable() {
+
+ @Override
+ public void execute(Transaction txn) {
+ store.put(txn, new StringByteIterable(user.getUUID()),
+ new ArrayByteIterable(longToBytes(System.currentTimeMillis())));
+ }
+
+ });
+ }
+
+ @Override
+ public void visit(Account user, PullRequest request) {
+ Environment env = getEnv(request.getTargetDepot());
+ Store store = getStore(env, PULL_REQUEST_STORE);
+ env.executeInTransaction(new TransactionalExecutable() {
+
+ @Override
+ public void execute(Transaction txn) {
+ store.put(txn, new StringPairByteIterable(user.getUUID(), request.getUUID()),
+ new ArrayByteIterable(longToBytes(System.currentTimeMillis())));
+ }
+
+ });
+ }
+
+ @Override
+ public void visit(Account user, CodeComment comment) {
+ Environment env = getEnv(comment.getDepot());
+ Store store = getStore(env, CODE_COMMENT_STORE);
+ env.executeInTransaction(new TransactionalExecutable() {
+
+ @Override
+ public void execute(Transaction txn) {
+ store.put(txn, new StringPairByteIterable(user.getUUID(), comment.getUUID()),
+ new ArrayByteIterable(longToBytes(System.currentTimeMillis())));
+ }
+
+ });
+ }
+
+ @Override
+ public Date getVisitDate(Account user, Depot depot) {
+ Environment env = getEnv(depot);
+ Store store = getStore(env, DEFAULT_STORE);
+ return env.computeInTransaction(new TransactionalComputable<Date>() {
+
+ @Override
+ public Date compute(Transaction txn) {
+ byte[] bytes = getBytes(store.get(txn, new StringByteIterable(user.getUUID())));
+ if (bytes != null)
+ return new Date(bytesToLong(bytes));
+ else
+ return null;
+ }
+
+ });
+ }
+
+ @Override
+ public Date getVisitDate(Account user, PullRequest request) {
+ Environment env = getEnv(request.getTargetDepot());
+ Store store = getStore(env, PULL_REQUEST_STORE);
+ return env.computeInTransaction(new TransactionalComputable<Date>() {
+
+ @Override
+ public Date compute(Transaction txn) {
+ byte[] bytes = getBytes(store.get(txn, new StringPairByteIterable(user.getUUID(), request.getUUID())));
+ if (bytes != null)
+ return new Date(bytesToLong(bytes));
+ else
+ return null;
+ }
+
+ });
+ }
+
+ @Override
+ public Date getVisitDate(Account user, CodeComment comment) {
+ Environment env = getEnv(comment.getDepot());
+ Store store = getStore(env, CODE_COMMENT_STORE);
+ return env.computeInTransaction(new TransactionalComputable<Date>() {
+
+ @Override
+ public Date compute(Transaction txn) {
+ byte[] bytes = getBytes(store.get(txn, new StringPairByteIterable(user.getUUID(), comment.getUUID())));
+ if (bytes != null)
+ return new Date(bytesToLong(bytes));
+ else
+ return null;
+ }
+
+ });
+ }
+
+ private byte[] longToBytes(long value) {
+ ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
+ buffer.putLong(value);
+ return buffer.array();
+ }
+
+ private long bytesToLong(byte[] bytes) {
+ ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
+ buffer.put(bytes);
+ buffer.flip();
+ return buffer.getLong();
+ }
+
+ static class StringByteIterable extends ArrayByteIterable {
+ StringByteIterable(String value) {
+ super(value.getBytes());
+ }
+ }
+
+ static class StringPairByteIterable extends ArrayByteIterable {
+ StringPairByteIterable(String uuid1, String uuid2) {
+ super(getBytes(uuid1, uuid2));
+ }
+
+ private static byte[] getBytes(String uuid1, String uuid2) {
+ byte[] bytes1 = uuid1.getBytes();
+ byte[] bytes2 = uuid2.getBytes();
+ byte[] bytes = new byte[bytes1.length+bytes2.length];
+ System.arraycopy(bytes1, 0, bytes, 0, bytes1.length);
+ System.arraycopy(bytes2, 0, bytes, bytes1.length, bytes2.length);
+ return bytes;
+ }
+ }
+}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/setting/MailSetting.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/setting/MailSetting.java
index 70e3436e43..347806d32f 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/setting/MailSetting.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/setting/MailSetting.java
@@ -93,7 +93,7 @@ public class MailSetting implements Serializable {
this.smtpUser = smtpUser;
}
- @Editable(order=400, name="SMTP Password", description=
+ @Editable(order=400, name="SMTP Password", autocomplete="new-password", description=
"Optionally specify password here if the SMTP host needs authentication"
)
@Password
diff --git a/gitplex.core/src/test/java/com/pmease/gitplex/core/model/PullRequestUpdateTest.java b/gitplex.core/src/test/java/com/pmease/gitplex/core/model/PullRequestUpdateTest.java
index 72e3cde9fc..989e65e7d2 100644
--- a/gitplex.core/src/test/java/com/pmease/gitplex/core/model/PullRequestUpdateTest.java
+++ b/gitplex.core/src/test/java/com/pmease/gitplex/core/model/PullRequestUpdateTest.java
@@ -77,7 +77,7 @@ public class PullRequestUpdateTest extends AbstractGitTest {
}
@Override
- public File getCacheDir(Depot depot) {
+ public File getInfoDir(Depot depot) {
throw new UnsupportedOperationException();
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebServletConfigurator.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebServletConfigurator.java
index 6d58caea41..d5e988660d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebServletConfigurator.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebServletConfigurator.java
@@ -1,60 +1,19 @@
package com.pmease.gitplex.web;
-import javax.inject.Inject;
import javax.inject.Singleton;
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-import org.apache.shiro.subject.SimplePrincipalCollection;
-import org.apache.shiro.subject.support.DefaultSubjectContext;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
-import com.pmease.commons.hibernate.UnitOfWork;
import com.pmease.commons.jetty.ClasspathAssetServlet;
import com.pmease.commons.jetty.ServletConfigurator;
-import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.entity.Account;
-import com.pmease.gitplex.core.manager.AccountManager;
import com.pmease.gitplex.web.assets.Assets;
@Singleton
public class WebServletConfigurator implements ServletConfigurator {
- private final UnitOfWork unitOfWork;
-
- @Inject
- public WebServletConfigurator(UnitOfWork unitOfWork) {
- this.unitOfWork = unitOfWork;
- }
-
@Override
public void configure(ServletContextHandler context) {
- context.getSessionHandler().addEventListener(new HttpSessionListener() {
-
- @Override
- public void sessionCreated(HttpSessionEvent se) {
- }
-
- @Override
- public void sessionDestroyed(HttpSessionEvent se) {
- SimplePrincipalCollection principals = (SimplePrincipalCollection) se.getSession().getAttribute(
- DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
- if (principals != null) {
- Long userId = (Long) principals.getPrimaryPrincipal();
- if (!userId.equals(0L)) {
- unitOfWork.begin();
- try {
- Account user = GitPlex.getInstance(AccountManager.class).load(userId);
- WebSession.from(se.getSession()).flushDepotVisits(user);
- } finally {
- unitOfWork.end();
- }
- }
- }
- }
-
- });
ServletHolder servletHolder = new ServletHolder(new ClasspathAssetServlet(Assets.class));
context.addServlet(servletHolder, "/assets/*");
context.addServlet(servletHolder, "/favicon.ico");
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebSession.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebSession.java
index 52c5acd459..e5a6ffa53c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/WebSession.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/WebSession.java
@@ -7,20 +7,13 @@ import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.apache.wicket.protocol.http.WicketServlet;
import org.apache.wicket.request.Request;
-import org.apache.wicket.request.cycle.RequestCycle;
-import com.google.common.base.Preconditions;
import com.pmease.gitplex.core.GitPlex;
-import com.pmease.gitplex.core.entity.Account;
-import com.pmease.gitplex.core.entity.component.DepotVisits;
-import com.pmease.gitplex.core.manager.AccountManager;
public class WebSession extends org.apache.wicket.protocol.http.WebSession {
private static final long serialVersionUID = 1L;
- private DepotVisits depotVisits;
-
public WebSession(Request request) {
super(request);
}
@@ -45,36 +38,11 @@ public class WebSession extends org.apache.wicket.protocol.http.WebSession {
}
public void logout() {
- Account user = com.pmease.gitplex.core.security.SecurityUtils.getAccount();
- if (user != null) {
- flushDepotVisits(user);
- }
SecurityUtils.getSubject().logout();
WebSession session = WebSession.get();
session.replaceSession();
}
- public void flushDepotVisits(Account user) {
- if (depotVisits != null) {
- user.setDepotVisits(depotVisits);
- GitPlex.getInstance(AccountManager.class).save(user, null);
- }
- }
-
- public DepotVisits getDepotVisits() {
- Preconditions.checkNotNull(RequestCycle.get());
-
- if (depotVisits == null) {
- Account user = com.pmease.gitplex.core.security.SecurityUtils.getAccount();
- if (user != null) {
- depotVisits = user.getDepotVisits();
- } else {
- depotVisits = new DepotVisits();
- }
- }
- return depotVisits;
- }
-
public static WebSession from(HttpSession session) {
String attributeName = "wicket:" + GitPlex.getInstance(WicketServlet.class).getServletName() + ":session";
return (WebSession) session.getAttribute(attributeName);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentFilterOption.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentFilterOption.java
index bbee6b07f7..276216c17d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentFilterOption.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentFilterOption.java
@@ -29,7 +29,7 @@ public class CodeCommentFilterOption implements Serializable {
private static final String PARAM_PATH = "path";
- private static final String PARAM_CONTENT = "content";
+ private static final String PARAM_TITLE = "title";
private static final String PARAM_BEFORE = "before";
@@ -41,7 +41,7 @@ public class CodeCommentFilterOption implements Serializable {
private String path;
- private String content;
+ private String title;
private Date before;
@@ -66,13 +66,13 @@ public class CodeCommentFilterOption implements Serializable {
this.unresolved = unresolved;
}
- @Editable(order=400, name="Content containing", description="Show comments with content containing specified string")
+ @Editable(order=400, name="Title containing", description="Show comments with title containing specified string")
public String getContent() {
- return content;
+ return title;
}
public void setContent(String content) {
- this.content = content;
+ this.title = content;
}
@Editable(order=500, name="Commented path", description="Show comments on specified path")
@@ -110,7 +110,7 @@ public class CodeCommentFilterOption implements Serializable {
userName = params.get(PARAM_USER).toString();
unresolved = "yes".equals(params.get(PARAM_UNRESOLVED).toString());
path = params.get(PARAM_PATH).toString();
- content = params.get(PARAM_CONTENT).toString();
+ title = params.get(PARAM_TITLE).toString();
String value = params.get(PARAM_BEFORE).toString();
if (value != null)
@@ -132,8 +132,8 @@ public class CodeCommentFilterOption implements Serializable {
pathQuery += "%";
criteria.add(Restrictions.ilike("path", pathQuery));
}
- if (content != null)
- criteria.add(Restrictions.ilike("content", "%" + content + "%"));
+ if (title != null)
+ criteria.add(Restrictions.ilike("title", "%" + title + "%"));
if (before != null)
criteria.add(Restrictions.le("createDate", before));
@@ -168,7 +168,7 @@ public class CodeCommentFilterOption implements Serializable {
}
}
}
- if (content != null && !comment.getContent().contains(content)) {
+ if (title != null && !comment.getTitle().contains(title)) {
it.remove();
continue;
}
@@ -188,8 +188,8 @@ public class CodeCommentFilterOption implements Serializable {
params.add(PARAM_USER, userName);
if (unresolved)
params.add(PARAM_UNRESOLVED, "yes");
- if (content != null)
- params.add(PARAM_CONTENT, content);
+ if (title != null)
+ params.add(PARAM_TITLE, title);
if (path != null)
params.add(PARAM_PATH, path);
if (before != null)
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.html
index 150faf350f..c2233ac27d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.html
@@ -18,6 +18,7 @@
</td>
<td class="spacing">&nbsp;</td>
<td class="result">
+ <div wicket:id="alert" class="alert alert-warning"></div>
<table wicket:id="comments"></table>
</td>
</tr>
@@ -26,7 +27,7 @@
<a wicket:id="link">
<div class="first-line">
<span wicket:id="title" class="title"></span>
- <span wicket:id="resolved" class="resolved fa fa-tick"></span>
+ <span wicket:id="resolved" title="This comment is resolved" class="resolved fa fa-check-circle"></span>
</div>
<div class="second-line">
Commented by
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.java
index 9ca49e2459..83a0a01f2c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentListPanel.java
@@ -19,6 +19,7 @@ import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
@@ -27,6 +28,7 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.resource.CssResourceReference;
+import org.eclipse.jgit.lib.FileMode;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@@ -35,13 +37,22 @@ import com.pmease.commons.hibernate.dao.EntityCriteria;
import com.pmease.commons.wicket.editable.BeanContext;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.CodeComment;
+import com.pmease.gitplex.core.entity.CodeCommentReply;
+import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.PullRequest;
+import com.pmease.gitplex.core.entity.component.CompareContext;
+import com.pmease.gitplex.core.entity.component.DepotAndRevision;
import com.pmease.gitplex.core.manager.CodeCommentManager;
import com.pmease.gitplex.core.security.SecurityUtils;
import com.pmease.gitplex.web.Constants;
+import com.pmease.gitplex.web.component.diff.revision.DiffMark;
import com.pmease.gitplex.web.page.depot.DepotPage;
+import com.pmease.gitplex.web.page.depot.compare.RevisionComparePage;
+import com.pmease.gitplex.web.page.depot.file.DepotFilePage;
import com.pmease.gitplex.web.util.DateUtils;
+import de.agilecoders.wicket.core.markup.html.bootstrap.navigation.BootstrapPagingNavigator;
+
@SuppressWarnings("serial")
public abstract class CodeCommentListPanel extends Panel {
@@ -131,6 +142,47 @@ public abstract class CodeCommentListPanel extends Panel {
@Override
public void onClick() {
+ Depot depot = ((DepotPage) getPage()).getDepot();
+
+ PullRequest request = getPullRequest();
+ if (request != null) {
+
+ } else {
+ CodeComment comment = rowModel.getObject();
+ List<CodeCommentReply> replies = comment.getSortedReplies();
+ CompareContext compareContext;
+ if (!replies.isEmpty()) {
+ CodeCommentReply lastReply = replies.get(replies.size()-1);
+ compareContext = lastReply.getCompareContext();
+ } else {
+ compareContext = comment.getCompareContext();
+ }
+ if (!compareContext.getCompareCommit().equals(comment.getCommit())) {
+ RevisionComparePage.State state = new RevisionComparePage.State();
+ state.commentId = comment.getId();
+ state.mark = new DiffMark(comment);
+ state.compareWithMergeBase = false;
+ if (compareContext.isLeftSide()) {
+ state.leftSide = new DepotAndRevision(depot, compareContext.getCompareCommit());
+ state.rightSide = new DepotAndRevision(depot, comment.getCommit());
+ } else {
+ state.leftSide = new DepotAndRevision(depot, comment.getCommit());
+ state.rightSide = new DepotAndRevision(depot, compareContext.getCompareCommit());
+ }
+ state.tabPanel = RevisionComparePage.TabPanel.CHANGES;
+ state.whitespaceOption = compareContext.getWhitespaceOption();
+ state.pathFilter = compareContext.getPathFilter();
+ setResponsePage(RevisionComparePage.class, RevisionComparePage.paramsOf(depot, state));
+ } else {
+ DepotFilePage.State state = new DepotFilePage.State();
+ state.blobIdent.revision = comment.getCommit();
+ state.blobIdent.path = comment.getPath();
+ state.blobIdent.mode = FileMode.TYPE_FILE;
+ state.commentId = comment.getId();
+ state.mark = comment.getMark();
+ setResponsePage(DepotFilePage.class, DepotFilePage.paramsOf(depot, state));
+ }
+ }
}
};
@@ -151,7 +203,8 @@ public abstract class CodeCommentListPanel extends Panel {
fragment.add(link);
cellItem.add(fragment);
- cellItem.add(AttributeAppender.append("class", "comment"));
+
+ cellItem.add(AttributeAppender.append("class", comment.isVisited(true)?"comment":"comment new"));
}
});
@@ -189,7 +242,6 @@ public abstract class CodeCommentListPanel extends Panel {
EntityCriteria<CodeComment> criteria = EntityCriteria.of(CodeComment.class);
criteria.add(Restrictions.eq("depot", page.getDepot()));
filterOptionModel.getObject().fill(criteria);
- criteria.addOrder(Order.desc("id"));
return GitPlex.getInstance(Dao.class).count(criteria);
}
}
@@ -211,8 +263,21 @@ public abstract class CodeCommentListPanel extends Panel {
DataTable<CodeComment, Void> dataTable = new DataTable<>("comments", columns,
dataProvider, getPullRequest()!=null?Integer.MAX_VALUE:Constants.DEFAULT_PAGE_SIZE);
dataTable.addBottomToolbar(new NoRecordsToolbar(dataTable));
- dataTable.addBottomToolbar(new NavigationToolbar(dataTable));
+ dataTable.addBottomToolbar(new NavigationToolbar(dataTable) {
+
+ @Override
+ protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?, ?> table) {
+ return new BootstrapPagingNavigator(navigatorId, dataTable);
+ }
+
+ });
add(dataTable);
+
+ if (getPullRequest() != null && dataTable.getItemCount() > PullRequest.MAX_CODE_COMMENTS) {
+ add(new Label("alert", "Too many code comments, only displaying " + PullRequest.MAX_CODE_COMMENTS));
+ } else {
+ add(new WebMarkupContainer("alert").setVisible(false));
+ }
}
@Override
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java
index 663fc3dbce..834bc958d2 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/CodeCommentPanel.java
@@ -1,7 +1,5 @@
package com.pmease.gitplex.web.component.comment;
-import java.util.ArrayList;
-import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.Nullable;
@@ -22,6 +20,7 @@ import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.GenericPanel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -34,6 +33,7 @@ import com.pmease.commons.wicket.ajaxlistener.ConfirmListener;
import com.pmease.commons.wicket.behavior.markdown.AttachmentSupport;
import com.pmease.commons.wicket.component.markdownviewer.MarkdownViewer;
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.CodeCommentReply;
import com.pmease.gitplex.core.entity.Depot;
@@ -41,6 +41,7 @@ import com.pmease.gitplex.core.entity.component.CompareContext;
import com.pmease.gitplex.core.entity.component.DepotAndRevision;
import com.pmease.gitplex.core.manager.CodeCommentManager;
import com.pmease.gitplex.core.manager.CodeCommentReplyManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
import com.pmease.gitplex.core.security.SecurityUtils;
import com.pmease.gitplex.web.component.AccountLink;
import com.pmease.gitplex.web.component.avatar.AvatarLink;
@@ -59,10 +60,27 @@ public abstract class CodeCommentPanel extends GenericPanel<CodeComment> {
super(id, commentModel);
}
+ @Override
+ protected void onAfterRender() {
+ super.onAfterRender();
+ Account user = SecurityUtils.getAccount();
+ if (user != null)
+ GitPlex.getInstance(VisitInfoManager.class).visit(user, getComment());
+ }
+
private WebMarkupContainer newCommentContainer() {
WebMarkupContainer commentContainer = new Fragment("comment", "viewFrag", this);
commentContainer.setOutputMarkupId(true);
+ commentContainer.add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
+
+ @Override
+ protected String load() {
+ return getComment().isVisited(false)?"": "new";
+ }
+
+ }));
+
commentContainer.add(new AvatarLink("authorAvatar", getComment().getUser()));
commentContainer.add(new AccountLink("authorName", getComment().getUser()));
commentContainer.add(new Label("authorDate", DateUtils.formatAge(getComment().getCreateDate())));
@@ -266,6 +284,15 @@ public abstract class CodeCommentPanel extends GenericPanel<CodeComment> {
Fragment replyContainer = new Fragment(componentId, "viewFrag", this);
replyContainer.setOutputMarkupId(true);
+ replyContainer.add(AttributeAppender.append("class", new LoadableDetachableModel<String>() {
+
+ @Override
+ protected String load() {
+ return getReply(replyId).isVisited()?"":"new";
+ }
+
+ }));
+
replyContainer.add(new AvatarLink("authorAvatar", getReply(replyId).getUser()));
replyContainer.add(new AccountLink("authorName", getReply(replyId).getUser()));
replyContainer.add(new Label("authorDate", DateUtils.formatAge(getReply(replyId).getDate())));
@@ -483,9 +510,7 @@ public abstract class CodeCommentPanel extends GenericPanel<CodeComment> {
add(newCommentContainer());
repliesView = new RepeatingView("replies");
- List<CodeCommentReply> replies = new ArrayList<>(getComment().getReplies());
- replies.sort((reply1, reply2)->(int)(reply1.getId()-reply2.getId()));
- for (CodeCommentReply reply: replies) {
+ for (CodeCommentReply reply: getComment().getSortedReplies()) {
repliesView.add(newReplyContainer(repliesView.newChildId(), reply.getId()));
}
add(repliesView);
@@ -551,6 +576,12 @@ public abstract class CodeCommentPanel extends GenericPanel<CodeComment> {
AjaxButton saveButton = new AjaxButton("save") {
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ super.onError(target, form);
+ target.add(feedback);
+ }
+
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment-list.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment-list.css
index e61b121f25..ed1c0704f7 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment-list.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment-list.css
@@ -19,29 +19,50 @@
}
.code-comments td.result {
border: 1px solid #DDD;
- white-space: nowrap;
overflow: hidden;
}
-.code-comments td.result a {
+.code-comments td.comment>div>a {
display: block;
text-decoration: none;
color: #999;
font-size: 12px;
padding: 8px;
}
-.code-comments td.result a:hover {
+.code-comments td.comment {
+ border-left: 4px solid white;
+}
+.code-comments td.comment:hover {
+ border-left: 4px solid #F2F2F2;
+}
+.code-comments td.comment.new {
+ border-left: 4px solid #4667EE;
+}
+.code-comments td.comment>div>a:hover {
background: #F2F2F2;
}
-.code-comments td.result a .title {
+.code-comments td.comment>div>a .title {
font-weight: bold;
- font-size: 14px;
+ font-size: 16px;
color: #444;
- text-overflow: ellipsis;
}
-.code-comments td.result a .user, .code-comments td.result a .what {
+.code-comments td.comment>div>a .resolved {
+ font-size: 16px;
+ color: #24BE10;
+ margin-left: 4px;
+}
+.code-comments td.comment>div>a .user, .code-comments td.comment>div>a .what {
font-weight: bold;
- color: #666;
+ color: #777;
}
-.code-comments td.result .second-line, .code-comments td.result .third-line {
+.code-comments td.comment .second-line, .code-comments td.comment .third-line {
margin-top: 2px;
}
+.code-comments td.result .norecords-td {
+ padding: 20px;
+ font-size: 20px;
+ text-align: center;
+ font-style: italic;
+}
+.code-comments .alert {
+ border-radius: 0;
+}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css
index 4ee9cfd1a0..a2831d4b17 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/comment/code-comment.css
@@ -3,14 +3,22 @@
line-height: inherit;
}
.code-comment>.post {
- border-bottom: 1px solid #EEE;
position: relative;
+ margin-left: -12px;
+ padding-left: 12px;
+ border-left: 4px solid white;
+}
+.code-comment>.post>.detail {
padding-bottom: 8px;
margin-bottom: 8px;
+ border-bottom: 1px solid #EEE;
+}
+.code-comment>.post.new {
+ border-left: 4px solid #4667EE;
}
.code-comment>.post>.author-avatar {
position: absolute;
- left: 0;
+ left: 12px;
top: 0;
}
.code-comment>.post>.author-avatar img {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css
index 2dfa8ad308..3789306f3c 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/commithash/commit-hash.css
@@ -1,4 +1,4 @@
-.commit-hash {
+input.commit-hash {
font-size: 13px;
width: 65px;
color: #666;
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.css
index 29f40e7fb4..ea1eb85728 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotfile/blobview/source/source-view.css
@@ -54,7 +54,7 @@
.source-view>.comment>.content>.body {
overflow: auto;
}
-.source-view>.comment>.content>.body>div {
+.source-view>.comment>.content>.body>* {
margin: 12px;
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotselector/DepotSelector.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotselector/DepotSelector.java
index e473870ac0..2ad268171e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotselector/DepotSelector.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/depotselector/DepotSelector.java
@@ -37,7 +37,6 @@ import com.pmease.commons.wicket.component.PreventDefaultAjaxLink;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.manager.DepotManager;
-import com.pmease.gitplex.web.WebSession;
import com.pmease.gitplex.web.page.depot.overview.DepotOverviewPage;
@SuppressWarnings("serial")
@@ -127,7 +126,7 @@ public abstract class DepotSelector extends Panel {
depots.add(depot);
}
}
- depots.sort(WebSession.get().getDepotVisits().getComparator());
+ depots.sort(Depot::compareLastVisit);
return depots;
}
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 72a666828c..39e2ad9842 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
@@ -136,6 +136,6 @@
border-left: 3px solid #F2F2F2;
border-bottom: 3px solid #F2F2F2;
}
-.revision-diff>.body>.detail>.comment>.content>.body>div {
+.revision-diff>.body>.detail>.comment>.content>.body>* {
margin: 12px;
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html
index b51db3c102..ee6b0a37fc 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/HashAndCodePanel.html
@@ -1,6 +1,8 @@
-<wicket:panel>
- <span class="hash-and-code">
- <span wicket:id="hash"></span>
- <a wicket:id="code" title="Browse code at this point" class="browse-code btn btn-xs btn-default"><span class="fa fa-code"></span></a>
- </span>
+<wicket:panel>
+ <div class="hash-and-code clearfix">
+ <div wicket:id="hash" class="commit-hash pull-left"></div>
+ <div class="pull-left browse-code">
+ <a wicket:id="code" title="Browse code at this point" class="btn btn-xs btn-default"><span class="fa fa-code"></span></a>
+ </div>
+ </div>
</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css
index 80961fe5c5..f274d58536 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/hashandcode/hash-and-code.css
@@ -1,11 +1,11 @@
-.hash-and-code .commit-hash {
- border: 1px solid #CCC;
- font-size: 13px;
- height: 22px;
- border-radius: 3px 0 0 3px;
- margin-right: -5px;
-}
-.hash-and-code .browse-code {
- border-radius: 0 3px 3px 0 !important;
- margin-top: -1px;
+.hash-and-code {
+ line-height: normal;
+}
+.hash-and-code input.commit-hash {
+ font-size: 13px;
+ border-radius: 3px 0 0 3px;
+ margin-right: -1px;
+}
+.hash-and-code>.browse-code>a {
+ border-radius: 0 3px 3px 0 !important;
}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/UrlMapper.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/UrlMapper.java
index 80639cb9c5..2a904b7e8f 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/UrlMapper.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/mapper/UrlMapper.java
@@ -33,6 +33,7 @@ import com.pmease.gitplex.web.page.admin.account.AccountListPage;
import com.pmease.gitplex.web.page.admin.account.NewUserPage;
import com.pmease.gitplex.web.page.depot.NoCommitsPage;
import com.pmease.gitplex.web.page.depot.branches.DepotBranchesPage;
+import com.pmease.gitplex.web.page.depot.comments.DepotCommentsPage;
import com.pmease.gitplex.web.page.depot.commit.CommitDetailPage;
import com.pmease.gitplex.web.page.depot.commit.DepotCommitsPage;
import com.pmease.gitplex.web.page.depot.compare.RevisionComparePage;
@@ -180,6 +181,7 @@ public class UrlMapper extends CompoundRequestMapper {
"${account}/${depot}/pulls/${request}/changes", RequestChangesPage.class));
add(new DepotMapper(
"${account}/${depot}/pulls/${request}/integration-preview", IntegrationPreviewPage.class));
+ add(new DepotMapper("${account}/${depot}/comments", DepotCommentsPage.class));
add(new DepotMapper("${account}/${depot}/settings/general", GeneralSettingPage.class));
add(new DepotMapper("${account}/${depot}/settings/teams", DepotTeamListPage.class));
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css
index 032a641d55..73e296e1ee 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/base/base.css
@@ -47,9 +47,6 @@ form>.actions>.btn {
.nav-tabs>li>a {
color: #777;
}
-ul.pagination {
- margin: 0;
-}
div.center {
text-align: center;
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/DepotPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/DepotPage.java
index f774436337..5faec60396 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/DepotPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/DepotPage.java
@@ -37,14 +37,13 @@ import com.pmease.commons.wicket.component.tabbable.Tabbable;
import com.pmease.gitplex.core.GitPlex;
import com.pmease.gitplex.core.entity.Account;
import com.pmease.gitplex.core.entity.Depot;
-import com.pmease.gitplex.core.manager.CommitInfoManager;
import com.pmease.gitplex.core.manager.DepotManager;
-import com.pmease.gitplex.core.manager.PullRequestManager;
+import com.pmease.gitplex.core.manager.VisitInfoManager;
import com.pmease.gitplex.core.security.SecurityUtils;
-import com.pmease.gitplex.web.WebSession;
import com.pmease.gitplex.web.page.account.AccountPage;
import com.pmease.gitplex.web.page.account.overview.AccountOverviewPage;
import com.pmease.gitplex.web.page.depot.branches.DepotBranchesPage;
+import com.pmease.gitplex.web.page.depot.comments.DepotCommentsPage;
import com.pmease.gitplex.web.page.depot.commit.CommitDetailPage;
import com.pmease.gitplex.web.page.depot.commit.DepotCommitsPage;
import com.pmease.gitplex.web.page.depot.compare.RevisionComparePage;
@@ -122,10 +121,10 @@ public abstract class DepotPage extends AccountPage {
}
@Override
- protected void onBeforeRender() {
- WebSession.get().getDepotVisits().visit(getDepot());
-
- super.onBeforeRender();
+ protected void onAfterRender() {
+ super.onAfterRender();
+ if (getLoginUser() != null)
+ GitPlex.getInstance(VisitInfoManager.class).visit(getLoginUser(), getDepot());
}
@Override
@@ -135,17 +134,18 @@ public abstract class DepotPage extends AccountPage {
List<PageTab> tabs = new ArrayList<>();
tabs.add(new DepotTab(Model.of("Overview"), "fa fa-fw fa-list-alt", 0, DepotOverviewPage.class));
tabs.add(new DepotTab(Model.of("Files"), "fa fa-fw fa-file-text-o", 0, DepotFilePage.class));
- tabs.add(new DepotTab(Model.of("Commits"), "fa fa-fw fa-ext fa-commit",
- GitPlex.getInstance(CommitInfoManager.class).getCommitCount(getDepot()),
+ tabs.add(new DepotTab(Model.of("Commits"), "fa fa-fw fa-ext fa-commit", 0,
DepotCommitsPage.class, CommitDetailPage.class));
tabs.add(new DepotTab(Model.of("Branches"), "fa fa-fw fa-code-fork",
- getDepot().getRefs(Constants.R_HEADS).size(), DepotBranchesPage.class));
+ 0, DepotBranchesPage.class));
tabs.add(new DepotTab(Model.of("Tags"), "fa fa-fw fa-tag",
- getDepot().getRefs(Constants.R_TAGS).size(), DepotTagsPage.class));
+ 0, DepotTagsPage.class));
- int openRequests = GitPlex.getInstance(PullRequestManager.class).countOpen(getDepot());
tabs.add(new DepotTab(Model.of("Pull Requests"), "fa fa-fw fa-ext fa-branch-compare",
- openRequests, RequestListPage.class, PullRequestPage.class));
+ 0, RequestListPage.class, PullRequestPage.class));
+
+ tabs.add(new DepotTab(Model.of("Code Comments"), "fa fa-fw fa-commenting",
+ 0, DepotCommentsPage.class, DepotCommentsPage.class));
tabs.add(new DepotTab(Model.of("Compare"), "fa fa-fw fa-ext fa-file-diff", 0, RevisionComparePage.class));
if (SecurityUtils.canManage(getDepot()))
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.html
new file mode 100644
index 0000000000..23c8c00c1b
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.html
@@ -0,0 +1,3 @@
+<wicket:extend>
+ <div wicket:id="codeComments" id="depot-comments"></div>
+</wicket:extend>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.java
new file mode 100644
index 0000000000..ae411dab47
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/DepotCommentsPage.java
@@ -0,0 +1,77 @@
+package com.pmease.gitplex.web.page.depot.comments;
+
+import java.util.List;
+
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.request.resource.CssResourceReference;
+
+import com.pmease.gitplex.core.GitPlex;
+import com.pmease.gitplex.core.entity.PullRequest;
+import com.pmease.gitplex.core.manager.CodeCommentInfoManager;
+import com.pmease.gitplex.web.component.comment.CodeCommentAware;
+import com.pmease.gitplex.web.component.comment.CodeCommentFilterOption;
+import com.pmease.gitplex.web.component.comment.CodeCommentListPanel;
+import com.pmease.gitplex.web.page.depot.DepotPage;
+
+@SuppressWarnings("serial")
+public class DepotCommentsPage extends DepotPage implements CodeCommentAware {
+
+ private final CodeCommentFilterOption filterOption;
+
+ private final List<String> commentedFiles;
+
+ public DepotCommentsPage(PageParameters params) {
+ super(params);
+
+ filterOption = new CodeCommentFilterOption(params);
+
+ commentedFiles = GitPlex.getInstance(CodeCommentInfoManager.class).getCommentedFiles(getDepot());
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(new CodeCommentListPanel("codeComments", new IModel<CodeCommentFilterOption>() {
+
+ @Override
+ public void detach() {
+ }
+
+ @Override
+ public CodeCommentFilterOption getObject() {
+ return filterOption;
+ }
+
+ @Override
+ public void setObject(CodeCommentFilterOption object) {
+ PageParameters params = paramsOf(getDepot());
+ object.fillPageParams(params);
+ setResponsePage(DepotCommentsPage.class, params);
+ }
+
+ }) {
+
+ @Override
+ protected PullRequest getPullRequest() {
+ return null;
+ }
+
+ });
+ }
+
+ @Override
+ public List<String> getCommentedFiles() {
+ return commentedFiles;
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(new CssResourceReference(DepotCommentsPage.class, "depot-comments.css")));
+ }
+
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/depot-comments.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/depot-comments.css
new file mode 100644
index 0000000000..609c4bfd63
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/comments/depot-comments.css
@@ -0,0 +1,3 @@
+#depot-comments {
+ padding: 20px;
+}
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/UpdateActivityPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/UpdateActivityPanel.html
index a7b4836d80..f0f4e94d17 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/UpdateActivityPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/UpdateActivityPanel.html
@@ -1,18 +1,18 @@
-<wicket:panel>
- <div class="update">
- <div wicket:id="tooManyCommits" class="alert alert-warning"></div>
- <table>
- <tr wicket:id="commits">
- <td class="icon"><i class="fa fa-ext fa-commit"></i></td>
- <td class="detail">
- <span wicket:id="author"></span>
- <span wicket:id="message"></span>
- </td>
- <td class="status">
- <span wicket:id="verification"></span>
- <span wicket:id="hashAndCode"></span>
- </td>
- </tr>
- </table>
- </div>
+<wicket:panel>
+ <div class="update">
+ <div wicket:id="tooManyCommits" class="alert alert-warning"></div>
+ <table>
+ <tr wicket:id="commits">
+ <td class="icon"><i class="fa fa-ext fa-commit"></i></td>
+ <td class="detail">
+ <span wicket:id="author"></span>
+ <span wicket:id="message"></span>
+ </td>
+ <td class="status clearfix">
+ <div wicket:id="hashAndCode" class="pull-right"></div>
+ <div wicket:id="verification" class="pull-right"></div >
+ </td>
+ </tr>
+ </table>
+ </div>
</wicket:panel>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/request-overview.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/request-overview.css
index 416bb5ba60..c055f7096e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/request-overview.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestdetail/overview/request-overview.css
@@ -1,291 +1,294 @@
-#request-detail>.overview>tbody>tr>td.activities {
- width: 75%;
- padding-right: 16px;
-}
-#request-detail .activities>table {
- margin-bottom: 20px;
- table-layout: fixed;
- border-bottom: 1px solid #CCC;
-}
-#request-detail .activities>table>tbody>tr.activity>td.spacer {
- border-right: 1px solid #E8E8E8;
-}
-#request-detail .activities>table>tbody>tr.activity.discussion>td.spacer {
- border-right: none;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.avatar {
- width: 40px;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.spacer {
- width: 35px;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div {
- position: relative;
- border: 1px solid #CCC;
- border-radius: 4px;
- background: white;
- margin-left: -15px;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>div:before {
- display: inline-block;
- position: absolute;
- top: 10px;
- left: -8px;
- border-top: 8px solid transparent;
- border-bottom: 8px solid transparent;
- border-right: 8px solid #CBCBCB;
- content: "";
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>div:after {
- display: inline-block;
- position: absolute;
- top: 11px;
- left: -7px;
- border-top: 7px solid transparent;
- border-bottom: 7px solid transparent;
- border-right: 7px solid #F5F5F5;
- content: "";
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail .add-reply a:hover {
- border-radius: 0 0 4px 4px;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.head,
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.comment>.head {
- padding: 10px;
- border-radius: 4px 4px 0 0;
- background: #F5F5F5;
-}
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.body,
-#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.comment>.body {
- padding: 10px 24px;
-}
-#request-detail .activities .comment .replies {
- padding: 0 10px 10px 10px;
-}
-
-#request-detail .activities>table>tbody>tr.discussion+tr.discussion>td {
- padding-top: 30px;
-}
-#request-detail .activities>table>tbody>tr.discussion+tr.discussion>td.spacer {
- border-right: 1px solid #E8E8E8;
-}
-#request-detail .activities>table>tbody>tr.discussion:last-child>td {
- padding-bottom: 20px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion:last-child>td.detail {
- padding-bottom: 20px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion>td.detail {
- border-top: 1px solid #EEE;
-}
-#request-detail .activities>table>tbody>tr.discussion+tr.non-discussion>td.detail,
-#request-detail .activities>table>tbody>tr.update+tr.update>td.detail {
- border-top: none;
-}
-#request-detail .activities>table>tbody>tr.discussion:last-child>td.spacer {
- border-right: 1px solid #E8E8E8;
-}
-#request-detail .activities>table>tbody>tr.discussion>.avatar img {
- width: 40px;
- height: 40px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion>td.detail {
- font-size: 13px;
- padding: 10px 0;
-}
-#request-detail .activities>table>tbody>tr.non-discussion .activity-summary {
- margin-left: -14px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion .activity-summary .icon {
- border-radius: 13px;
- background: #5CA7F8;
- width: 26px;
- height: 26px;
- color: white;
- padding: 6px;
- margin-right: 4px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion>td.avatar img {
- display: none;
-}
-#request-detail .activities>table>tbody>tr.non-discussion .activity-summary .user a {
- font-weight: normal;
-}
-#request-detail .activities .activity>.detail>.update {
- color: #777;
- margin-left: -7px;
-}
-#request-detail .activities .activity>.detail>.update>.alert {
- margin: 0 0 8px 28px;
-}
-#request-detail .activities .activity>.detail>.update a {
- color: #555;
-}
-#request-detail .activities .activity>.detail>.update td {
- padding: 4px 0;
-}
-#request-detail .activities>table>tbody>tr.update+tr.update>td.detail>div {
- margin-top: -16px;
-}
-#request-detail .activities>table>tbody>tr.update+tr.update>td.detail>div>.alert {
- margin-top: 16px;
-}
-#request-detail .activities>table>tbody>tr.discussion+tr.non-discussion>td.detail {
- padding-top: 16px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion+tr.discussion>td {
- padding-top: 8px;
-}
-#request-detail .activities>table>tbody>tr.non-discussion+tr.discussion>td.spacer {
- border-right: 1px solid #E8E8E8;
-}
-
-#request-detail .activities .activity>.detail>.update td.detail {
- padding-left: 13px;
- padding-right: 8px;
-}
-#request-detail .activities .activity>.detail>.update td.detail .commit-message {
- padding-left: 4px;
-}
-#request-detail .activities .activity>.detail>.update td.icon {
- width: 1px;
- padding-top: 7px;
-}
-#request-detail .activities .activity>.detail>.update td.status {
- text-align: right;
- white-space: nowrap;
-}
-#request-detail .activities .activity>.detail>.update tr:hover td {
- background: #F5F5F5;
-}
-#request-detail .activities .activity>.detail>.update tr.integrated td.icon .fa {
- color: #35A612;
-}
-#request-detail .activities .activity>.detail>.update tr.rebased td a {
- color: #AAA;
-}
-#request-detail .activities .activity>.detail>.update tr.rebased td.icon .fa {
- color: #CCC;
-}
-#request-detail .activities .activity>.detail>.update tr.rebased img.avatar {
- opacity: 0.5;
-}
-#request-detail .activities .activity>.detail>.update td.status .successful {
- color: #35A612;
-}
-#request-detail .activities .activity>.detail>.update td.status .failed {
- color: #F93333;
-}
-#request-detail .activities .activity>.detail>.update td.status .running {
- color: #AFAD1F;
-}
-#request-detail .activities .activity-summary a.file {
- color: #666;
- font-weight: bold;
-}
-#request-detail .activities .activity.new>.avatar {
- background: #FCF6D6;
-}
-
-#request-detail .activities .activity>.detail>.discard>.icon {
- background: #F93333;
- padding-left: 7px;
-}
-#request-detail .activities .activity>.detail>.integrate>.icon {
- background: #35A612;
-}
-#request-detail .activities .activity>.detail>.approve>.icon {
- background: #35A612;
-}
-#request-detail .activities .activity>.detail>.disapprove>.icon {
- background: #F93333;
-}
-#request-detail .activities .activity>.detail>.undo-review>.icon {
- padding-left: 8px;
- padding-top: 7px;
-}
-#request-detail .activities .activity>.detail>.delete-source-branch>.icon,
-#request-detail .activities .activity>.detail>.restore-source-branch>.icon {
- padding-top: 7px;
- padding-left: 8px;
-}
-#request-detail .activities .activity>.detail>.delete-source-branch .branch,
-#request-detail .activities .activity>.detail>.restore-source-branch .branch {
- color: #666;
-}
-#request-detail .activities .activity>.detail>.reopen>.icon {
- padding-left: 7px;
-}
-#request-detail .activities .activity>.detail>.reference>.head>.icon {
- padding-left: 8px;
-}
-#request-detail .activities .activity>.detail>.reference>.head {
- margin-bottom: 10px;
-}
-#request-detail .activities .activity>.detail>.reference>.body {
- margin-left: 20px;
- font-size: 15px;
-}
-#request-detail .activities .activity>.detail>.reference>.body a {
- color: #333;
-}
-#request-detail .activities .activity>.detail>.reference>.body a .id {
- color: #999;
-}
-#request-detail .activities .activity>.detail>.reference>.body .status .help {
- display: none;
-}
-#request-detail .activities .activity>.detail>.open .feedback .alert {
- margin-bottom: 8px;
-}
-
-#request-detail .info>div>div {
- border-bottom: 1px dotted #BBB;
- margin-bottom: 16px;
- padding-bottom: 16px;
- color: #666;
-}
-#request-detail .info>div>div:last-child {
- border-bottom: none;
- margin-bottom: 0;
- padding-bottom: 0;
-}
-#request-detail .info .help-block {
- margin-bottom: 0;
- color: #888;
-}
-#request-detail .info .fa.small {
- font-size: 14px;
- vertical-align: middle;
-}
-#request-detail .info label {
- margin-right: 4px;
- font-weight: normal;
-}
-#request-detail .info .select2-container {
- width: 100%;
-}
-#request-detail .info .avatar {
- width: 24px;
- height: 24px;
-}
-#request-detail .info .select2-container .avatar {
- width: 20px;
- height: 20px;
-}
-
-#request-detail .info .reviewers ul {
- margin-bottom: 0;
-}
-#request-detail .info .reviewers li {
- margin-right: 20px;
- margin-bottom: 10px;
- position: relative;
-}
-#request-detail .info .reviewers li a:hover {
- text-decoration: none;
-}
-
-#request-detail .info .reviewers .review-result {
- top: -4px;
-}
+#request-detail>.overview>tbody>tr>td.activities {
+ width: 75%;
+ padding-right: 16px;
+}
+#request-detail .activities>table {
+ margin-bottom: 20px;
+ table-layout: fixed;
+ border-bottom: 1px solid #CCC;
+}
+#request-detail .activities>table>tbody>tr.activity>td.spacer {
+ border-right: 1px solid #E8E8E8;
+}
+#request-detail .activities>table>tbody>tr.activity.discussion>td.spacer {
+ border-right: none;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.avatar {
+ width: 40px;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.spacer {
+ width: 35px;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div {
+ position: relative;
+ border: 1px solid #CCC;
+ border-radius: 4px;
+ background: white;
+ margin-left: -15px;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>div:before {
+ display: inline-block;
+ position: absolute;
+ top: 10px;
+ left: -8px;
+ border-top: 8px solid transparent;
+ border-bottom: 8px solid transparent;
+ border-right: 8px solid #CBCBCB;
+ content: "";
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>div:after {
+ display: inline-block;
+ position: absolute;
+ top: 11px;
+ left: -7px;
+ border-top: 7px solid transparent;
+ border-bottom: 7px solid transparent;
+ border-right: 7px solid #F5F5F5;
+ content: "";
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail .add-reply a:hover {
+ border-radius: 0 0 4px 4px;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.head,
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.comment>.head {
+ padding: 10px;
+ border-radius: 4px 4px 0 0;
+ background: #F5F5F5;
+}
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.body,
+#request-detail .activities>table>tbody>tr.discussion>td.detail>div>.comment>.body {
+ padding: 10px 24px;
+}
+#request-detail .activities .comment .replies {
+ padding: 0 10px 10px 10px;
+}
+
+#request-detail .activities>table>tbody>tr.discussion+tr.discussion>td {
+ padding-top: 30px;
+}
+#request-detail .activities>table>tbody>tr.discussion+tr.discussion>td.spacer {
+ border-right: 1px solid #E8E8E8;
+}
+#request-detail .activities>table>tbody>tr.discussion:last-child>td {
+ padding-bottom: 20px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion:last-child>td.detail {
+ padding-bottom: 20px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion>td.detail {
+ border-top: 1px solid #EEE;
+}
+#request-detail .activities>table>tbody>tr.discussion+tr.non-discussion>td.detail,
+#request-detail .activities>table>tbody>tr.update+tr.update>td.detail {
+ border-top: none;
+}
+#request-detail .activities>table>tbody>tr.discussion:last-child>td.spacer {
+ border-right: 1px solid #E8E8E8;
+}
+#request-detail .activities>table>tbody>tr.discussion>.avatar img {
+ width: 40px;
+ height: 40px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion>td.detail {
+ font-size: 13px;
+ padding: 10px 0;
+}
+#request-detail .activities>table>tbody>tr.non-discussion .activity-summary {
+ margin-left: -14px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion .activity-summary .icon {
+ border-radius: 13px;
+ background: #5CA7F8;
+ width: 26px;
+ height: 26px;
+ color: white;
+ padding: 6px;
+ margin-right: 4px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion>td.avatar img {
+ display: none;
+}
+#request-detail .activities>table>tbody>tr.non-discussion .activity-summary .user a {
+ font-weight: normal;
+}
+#request-detail .activities .activity>.detail>.update {
+ color: #777;
+ margin-left: -7px;
+}
+#request-detail .activities .activity>.detail>.update>.alert {
+ margin: 0 0 8px 28px;
+}
+#request-detail .activities .activity>.detail>.update a {
+ color: #555;
+}
+#request-detail .activities .activity>.detail>.update td {
+ padding: 4px 0;
+}
+#request-detail .activities .activity>.detail>.update td.status {
+ width: 120px;
+}
+#request-detail .activities>table>tbody>tr.update+tr.update>td.detail>div {
+ margin-top: -16px;
+}
+#request-detail .activities>table>tbody>tr.update+tr.update>td.detail>div>.alert {
+ margin-top: 16px;
+}
+#request-detail .activities>table>tbody>tr.discussion+tr.non-discussion>td.detail {
+ padding-top: 16px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion+tr.discussion>td {
+ padding-top: 8px;
+}
+#request-detail .activities>table>tbody>tr.non-discussion+tr.discussion>td.spacer {
+ border-right: 1px solid #E8E8E8;
+}
+
+#request-detail .activities .activity>.detail>.update td.detail {
+ padding-left: 13px;
+ padding-right: 8px;
+}
+#request-detail .activities .activity>.detail>.update td.detail .commit-message {
+ padding-left: 4px;
+}
+#request-detail .activities .activity>.detail>.update td.icon {
+ width: 1px;
+ padding-top: 7px;
+}
+#request-detail .activities .activity>.detail>.update td.status {
+ text-align: right;
+ white-space: nowrap;
+}
+#request-detail .activities .activity>.detail>.update tr:hover td {
+ background: #F5F5F5;
+}
+#request-detail .activities .activity>.detail>.update tr.integrated td.icon .fa {
+ color: #35A612;
+}
+#request-detail .activities .activity>.detail>.update tr.rebased td a {
+ color: #AAA;
+}
+#request-detail .activities .activity>.detail>.update tr.rebased td.icon .fa {
+ color: #CCC;
+}
+#request-detail .activities .activity>.detail>.update tr.rebased img.avatar {
+ opacity: 0.5;
+}
+#request-detail .activities .activity>.detail>.update td.status .successful {
+ color: #35A612;
+}
+#request-detail .activities .activity>.detail>.update td.status .failed {
+ color: #F93333;
+}
+#request-detail .activities .activity>.detail>.update td.status .running {
+ color: #AFAD1F;
+}
+#request-detail .activities .activity-summary a.file {
+ color: #666;
+ font-weight: bold;
+}
+#request-detail .activities .activity.new>.avatar {
+ background: #FCF6D6;
+}
+
+#request-detail .activities .activity>.detail>.discard>.icon {
+ background: #F93333;
+ padding-left: 7px;
+}
+#request-detail .activities .activity>.detail>.integrate>.icon {
+ background: #35A612;
+}
+#request-detail .activities .activity>.detail>.approve>.icon {
+ background: #35A612;
+}
+#request-detail .activities .activity>.detail>.disapprove>.icon {
+ background: #F93333;
+}
+#request-detail .activities .activity>.detail>.undo-review>.icon {
+ padding-left: 8px;
+ padding-top: 7px;
+}
+#request-detail .activities .activity>.detail>.delete-source-branch>.icon,
+#request-detail .activities .activity>.detail>.restore-source-branch>.icon {
+ padding-top: 7px;
+ padding-left: 8px;
+}
+#request-detail .activities .activity>.detail>.delete-source-branch .branch,
+#request-detail .activities .activity>.detail>.restore-source-branch .branch {
+ color: #666;
+}
+#request-detail .activities .activity>.detail>.reopen>.icon {
+ padding-left: 7px;
+}
+#request-detail .activities .activity>.detail>.reference>.head>.icon {
+ padding-left: 8px;
+}
+#request-detail .activities .activity>.detail>.reference>.head {
+ margin-bottom: 10px;
+}
+#request-detail .activities .activity>.detail>.reference>.body {
+ margin-left: 20px;
+ font-size: 15px;
+}
+#request-detail .activities .activity>.detail>.reference>.body a {
+ color: #333;
+}
+#request-detail .activities .activity>.detail>.reference>.body a .id {
+ color: #999;
+}
+#request-detail .activities .activity>.detail>.reference>.body .status .help {
+ display: none;
+}
+#request-detail .activities .activity>.detail>.open .feedback .alert {
+ margin-bottom: 8px;
+}
+
+#request-detail .info>div>div {
+ border-bottom: 1px dotted #BBB;
+ margin-bottom: 16px;
+ padding-bottom: 16px;
+ color: #666;
+}
+#request-detail .info>div>div:last-child {
+ border-bottom: none;
+ margin-bottom: 0;
+ padding-bottom: 0;
+}
+#request-detail .info .help-block {
+ margin-bottom: 0;
+ color: #888;
+}
+#request-detail .info .fa.small {
+ font-size: 14px;
+ vertical-align: middle;
+}
+#request-detail .info label {
+ margin-right: 4px;
+ font-weight: normal;
+}
+#request-detail .info .select2-container {
+ width: 100%;
+}
+#request-detail .info .avatar {
+ width: 24px;
+ height: 24px;
+}
+#request-detail .info .select2-container .avatar {
+ width: 20px;
+ height: 20px;
+}
+
+#request-detail .info .reviewers ul {
+ margin-bottom: 0;
+}
+#request-detail .info .reviewers li {
+ margin-right: 20px;
+ margin-bottom: 10px;
+ position: relative;
+}
+#request-detail .info .reviewers li a:hover {
+ text-decoration: none;
+}
+
+#request-detail .info .reviewers .review-result {
+ top: -4px;
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestlist/RequestListPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestlist/RequestListPage.java
index 060d4366a9..be2b79b57f 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestlist/RequestListPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/pullrequest/requestlist/RequestListPage.java
@@ -20,6 +20,7 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.IDataProvider;
@@ -50,6 +51,8 @@ import com.pmease.gitplex.web.page.depot.pullrequest.newrequest.NewRequestPage;
import com.pmease.gitplex.web.page.depot.pullrequest.requestlist.SearchOption.Status;
import com.pmease.gitplex.web.util.DateUtils;
+import de.agilecoders.wicket.core.markup.html.bootstrap.navigation.BootstrapPagingNavigator;
+
@SuppressWarnings("serial")
public class RequestListPage extends PullRequestPage {
@@ -336,7 +339,14 @@ public class RequestListPage extends PullRequestPage {
DataTable<PullRequest, Void> dataTable = new DataTable<>("pullRequests", columns,
dataProvider, Constants.DEFAULT_PAGE_SIZE);
dataTable.addBottomToolbar(new NoRecordsToolbar(dataTable));
- dataTable.addBottomToolbar(new NavigationToolbar(dataTable));
+ dataTable.addBottomToolbar(new NavigationToolbar(dataTable) {
+
+ @Override
+ protected PagingNavigator newPagingNavigator(String navigatorId, DataTable<?, ?> table) {
+ return new BootstrapPagingNavigator(navigatorId, dataTable);
+ }
+
+ });
add(dataTable);
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/DashboardPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/DashboardPage.java
index 0b9a914f4c..82c39f9fb2 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/DashboardPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/home/DashboardPage.java
@@ -27,7 +27,6 @@ import com.pmease.gitplex.core.entity.Depot;
import com.pmease.gitplex.core.entity.OrganizationMembership;
import com.pmease.gitplex.core.manager.DepotManager;
import com.pmease.gitplex.web.Constants;
-import com.pmease.gitplex.web.WebSession;
import com.pmease.gitplex.web.component.avatar.Avatar;
import com.pmease.gitplex.web.page.account.overview.AccountOverviewPage;
import com.pmease.gitplex.web.page.depot.overview.DepotOverviewPage;
@@ -162,7 +161,7 @@ public class DashboardPage extends LayoutPage {
depots.add(depot);
}
}
- Collections.sort(depots, WebSession.get().getDepotVisits().getComparator());
+ depots.sort(Depot::compareLastVisit);
return depots;
}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/LoginPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/LoginPage.html
index 8f3ebe5a5f..3d623ad336 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/LoginPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/security/LoginPage.html
@@ -1,31 +1,31 @@
-<wicket:extend>
- <div id="login" class="center-box">
- <h1><i class="fa fa-ext fa-gitplex-logo"></i> GitPlex Login</h1>
- <div wicket:id="feedback"></div>
- <form wicket:id="form" method="post">
- <div class="input-group username">
- <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
- <input wicket:id="userName" type="text" class="form-control input-lg focusable" placeholder="User name" />
- </div>
- <div class="input-group password">
- <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
- <input wicket:id="password" type="password" class="form-control input-lg" placeholder="Password" />
- </div>
- <div class="row">
- <div class="col-sm-6">
- <div class="checkbox">
- <label><input wicket:id="rememberMe" type="checkbox"> Remember me on this computer</label>
- </div>
- </div>
- <div class="col-sm-6">
- <button class="btn btn-primary dirty-aware" type="submit">Sign in</button>
- </div>
- </div>
- </form>
- <hr />
- <p class="text-right">
- <wicket:enclosure child="forgetPassword"><a wicket:id="forgetPassword">Forgot your password?</a> -</wicket:enclosure>
- <a wicket:id="registerAccount" class="register">Register an account</a>
- </p>
- </div>
+<wicket:extend>
+ <div id="login" class="center-box">
+ <h1><i class="fa fa-ext fa-gitplex-logo"></i> GitPlex Login</h1>
+ <div wicket:id="feedback"></div>
+ <form wicket:id="form" method="post">
+ <div class="input-group username">
+ <span class="input-group-addon"><i class="fa fa-user fa-fw"></i></span>
+ <input wicket:id="userName" autocomplete="username" type="text" class="form-control input-lg focusable" placeholder="User name" />
+ </div>
+ <div class="input-group password">
+ <span class="input-group-addon"><i class="fa fa-key fa-fw"></i></span>
+ <input wicket:id="password" autocomplete="current-password" type="password" class="form-control input-lg" placeholder="Password" />
+ </div>
+ <div class="row">
+ <div class="col-sm-6">
+ <div class="checkbox">
+ <label><input wicket:id="rememberMe" type="checkbox"> Remember me on this computer</label>
+ </div>
+ </div>
+ <div class="col-sm-6">
+ <button class="btn btn-primary dirty-aware" type="submit">Sign in</button>
+ </div>
+ </div>
+ </form>
+ <hr />
+ <p class="text-right">
+ <wicket:enclosure child="forgetPassword"><a wicket:id="forgetPassword">Forgot your password?</a> -</wicket:enclosure>
+ <a wicket:id="registerAccount" class="register">Register an account</a>
+ </p>
+ </div>
</wicket:extend>
\ No newline at end of file