accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjw...@apache.org
Subject [accumulo] branch master updated: Fixes #918 - Fixed Validation regexes in Promblems REST object and cleaned up rest calls in web gui (#959)
Date Thu, 07 Mar 2019 20:58:02 GMT
This is an automated email from the ASF dual-hosted git repository.

mjwall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a40f1c  Fixes #918 - Fixed Validation regexes in Promblems REST object and cleaned
up rest calls in web gui (#959)
1a40f1c is described below

commit 1a40f1c06d5792675705fce435e64a486221b13f
Author: Jeffrey Zeiberg <jzeiberg@gmail.com>
AuthorDate: Thu Mar 7 15:57:57 2019 -0500

    Fixes #918 - Fixed Validation regexes in Promblems REST object and cleaned up rest calls
in web gui (#959)
---
 .../apache/accumulo/monitor/rest/problems/ProblemsResource.java  | 9 +++++----
 .../org/apache/accumulo/monitor/util/ParameterValidator.java     | 5 ++---
 .../org/apache/accumulo/monitor/resources/js/problems.js         | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
index cc90a9a..f79ad80 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemsResource.java
@@ -16,7 +16,8 @@
  */
 package org.apache.accumulo.monitor.rest.problems;
 
-import static org.apache.accumulo.monitor.util.ParameterValidator.ALPHA_NUM_REGEX;
+import static org.apache.accumulo.monitor.util.ParameterValidator.ALPHA_NUM_REGEX_TABLE_ID;
+import static org.apache.accumulo.monitor.util.ParameterValidator.PROBLEM_TYPE_REGEX;
 import static org.apache.accumulo.monitor.util.ParameterValidator.RESOURCE_REGEX;
 
 import java.util.ArrayList;
@@ -98,7 +99,7 @@ public class ProblemsResource {
   @Consumes(MediaType.TEXT_PLAIN)
   @Path("summary")
   public void clearTableProblems(
-      @QueryParam("s") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX) String tableID) {
+      @QueryParam("s") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX_TABLE_ID) String tableID)
{
     Logger log = LoggerFactory.getLogger(Monitor.class);
     try {
       ProblemReports.getInstance(Monitor.getContext()).deleteProblemReports(TableId.of(tableID));
@@ -154,9 +155,9 @@ public class ProblemsResource {
   @Consumes(MediaType.TEXT_PLAIN)
   @Path("details")
   public void clearDetailsProblems(
-      @QueryParam("table") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX) String tableID,
+      @QueryParam("table") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX_TABLE_ID) String tableID,
       @QueryParam("resource") @NotNull @Pattern(regexp = RESOURCE_REGEX) String resource,
-      @QueryParam("ptype") @NotNull @Pattern(regexp = ALPHA_NUM_REGEX) String ptype) {
+      @QueryParam("ptype") @NotNull @Pattern(regexp = PROBLEM_TYPE_REGEX) String ptype) {
     Logger log = LoggerFactory.getLogger(Monitor.class);
     try {
       ProblemReports.getInstance(Monitor.getContext()).deleteProblemReport(TableId.of(tableID),
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/ParameterValidator.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/ParameterValidator.java
index 1726cbf..3cf65c1 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/ParameterValidator.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/ParameterValidator.java
@@ -25,9 +25,8 @@ public interface ParameterValidator {
   // Allow the special default table IDs
   String ALPHA_NUM_REGEX_TABLE_ID = "[!+]?\\w+";
   String ALPHA_NUM_REGEX_BLANK_OK = "\\w*";
-
-  String RESOURCE_REGEX = "(?:\\w|:)+";
-
+  String PROBLEM_TYPE_REGEX = "FILE_READ|FILE_WRITE|TABLET_LOAD";
+  String RESOURCE_REGEX = "(?:)(.*)";
   // host name and port
   String HOSTNAME_PORT_REGEX = "[a-zA-Z0-9.-]+:[0-9]{2,5}";
 }
diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/problems.js
b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/problems.js
index a9d86c2..dde0c22 100644
--- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/problems.js
+++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/problems.js
@@ -130,7 +130,7 @@ function refreshProblemDetailsTable() {
 
         items.push(createLeftCell('', 
             '<a href="javascript:clearDetailsProblemsTable(\'' +
-            val.tableID + '\', \'' + val.resource + '\', \'' + val.type +
+            val.tableID + '\',\'' + val.resource + '\',\'' + val.type +
             '\')">clear this problem</a>'));
       }
 


Mime
View raw message