Skip to content

Commit 19415c9

Browse files
committed
Add support for defaul sort order for project lists.
1 parent 773ea55 commit 19415c9

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/main/java/com/parallax/server/blocklyprop/rest/RestSharedProject.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ public Response get(
148148

149149
// Sort flag evaluation
150150
if (!restProjectUtils.ValidateSortType(sort)) {
151-
LOG.warn("{} Sort parameter failed", endPoint);
152-
return Response.status(Response.Status.NOT_ACCEPTABLE).build();
151+
LOG.warn("{} Sort parameter failed. Defaulting to sort by project name", endPoint);
152+
sort = TableSort.name;
153153
}
154154

155155
// Sort order evaluation
156156
if (!restProjectUtils.ValidateSortOrder(order)) {
157-
LOG.warn("{} Sort order parameter failed", endPoint);
158-
return Response.status(Response.Status.NOT_ACCEPTABLE).build();
157+
LOG.warn("{} Sort order parameter failed. Defaulting to ascending order", endPoint);
158+
order = TableOrder.asc;
159159
}
160160

161161
// Limit result set value

src/main/java/com/parallax/server/blocklyprop/utils/RestProjectUtils.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,23 @@
2727
public class RestProjectUtils {
2828

2929

30+
/**
31+
*
32+
* @param sort
33+
* @return
34+
* Return true if the provided sort is a valid item, otherwise return false
35+
*/
3036
public boolean ValidateSortType(TableSort sort) {
3137

32-
boolean parametersValid = false;
33-
3438
if (sort != null) {
3539
for (TableSort t : TableSort.values()) {
36-
3740
if (sort == t) {
38-
parametersValid = true;
39-
break;
41+
return true;
4042
}
4143
}
4244
}
4345

44-
return parametersValid;
46+
return false;
4547
}
4648

4749
public boolean ValidateSortOrder(TableOrder order) {

src/main/resources/com/parallax/server/blocklyprop/internationalization/translations.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ footer.clientdownloadlink = BlocklyProp-client
2828
# Application version numbers.
2929
application.major = 1
3030
application.minor = 1
31-
application.build = 451
31+
application.build = 452
3232

3333
html.content_missing = Content missing
3434

0 commit comments

Comments
 (0)