ctubbsii commented on code in PR #2679:
URL: https://github.com/apache/accumulo/pull/2679#discussion_r870639422


##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js:
##########
@@ -299,19 +320,15 @@ function getNamespaceTables(namespaces) {
     namespaceList = namespaces.toString();
 
     var call = '/rest/tables/namespaces/' + namespaceList;
-    return $.getJSON(call, function(data) {
-      sessionStorage.tables = JSON.stringify(data);
-    });
+    return getJSONForTable(call, 'tables');

Review Comment:
   It probably doesn't really matter, but some of these that create the 
variable, and only use it once inside the function call, could just inline the 
variable to turn these into one-liners:
   
   ```javascript
       return getJSONForTable('/rest/tables/namespaces/' + namespaceList, 
'tables');
   ```
   
   There are several such occurrences in this PR that could be changed like 
this.



##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js:
##########
@@ -460,6 +456,7 @@ function clearTableProblems(tableID) {
   call = sanitize(call);
   // make the rest call, passing success function callback
   $.post(call, function () {
+    console.info("REST POST call to " + call);
     refreshProblems();
   });

Review Comment:
   I think this pattern shows up a couple of times and could be put into it's 
own function (the following is only pseudo-code, so I don't expect it to work 
as-is):
   
   ```javascript
   function doLoggedPostCall(endpoint, callback) {
     console.info("POST call to " + endpoint);
     $.post(endpoint, function() {
       console.debug("POST call to " + endpoint + " : success"); // not sure 
the appropriate message here
       if (callback != null) {
         // execute callback; for example, refreshProblems() in this case... 
could be something else in other cases.
       }
     }
   }
   ```
   
   Then, This becomes:
   ```javascript
     doLoggedPostCall(call, refreshProblems);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to