You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/26 01:27:55 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2735: Fix async bug when clearing logs in monitor

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


##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js:
##########
@@ -323,7 +323,8 @@ function doLoggedPostCall(call, callback, sanitize) {
   // Make the rest call, passing success function callback
   $.post(call, function () {
     console.debug("REST POST call to " + call + ": success");
-    if (callback !== null) {
+    if (callback !== null && callback !== undefined) {

Review Comment:
   It seems this could be simplified:
   ```suggestion
       if (callback != null) {
   ```
   At the very least, it would have to be strictly defined in order to be strictly non-null, so checking if it's defined first might make more sense:
   ```suggestion
       if (callback !== undefined && callback !== null) {
   ```



##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js:
##########
@@ -478,8 +479,8 @@ function getLogs() {
 /**
  * REST POST call to clear logs
  */
-function clearLogs() {
-  doLoggedPostCall('/rest/logs/clear', null, false);
+function clearLogs(callback) {
+  doLoggedPostCall('/rest/logs/clear', callback, false);

Review Comment:
   Would it be possible to just do this, that way you don't need to pass in the refresh method when calling `clearLogs()`?
   
   ```suggestion
   function clearLogs() {
     doLoggedPostCall('/rest/logs/clear', refresh, false);
   ```



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org