You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2021/01/24 21:47:45 UTC

[GitHub] [drill] vvysotskyi commented on a change in pull request #2154: DRILL-7849: Display error message when cannot enable storage plugin

vvysotskyi commented on a change in pull request #2154:
URL: https://github.com/apache/drill/pull/2154#discussion_r563373219



##########
File path: exec/java-exec/src/main/resources/rest/alertModals.ftl
##########
@@ -105,9 +108,13 @@
             msgHeader:"   ERROR: No Query to execute",
             msgBody:"Please provide a query. The query textbox cannot be empty."
         },
+        "pluginEnablingFailure": {
+            msgHeader:"   ERROR: Unable to enable/disable plugin",
+            msgBody:"<span style='font-family:courier;white-space:pre'>_pluginName_</span>: _errorMessage_"
+        },
         "errorId": {
             msgHeader:"~header~",
             msgBody:"Description unavailable"
         }
     }
-</script>
\ No newline at end of file
+</script>

Review comment:
       I've already added an empty line, so no need to add one more.

##########
File path: exec/java-exec/src/main/resources/rest/alertModals.ftl
##########
@@ -105,9 +108,13 @@
             msgHeader:"   ERROR: No Query to execute",
             msgBody:"Please provide a query. The query textbox cannot be empty."
         },
+        "pluginEnablingFailure": {
+            msgHeader:"   ERROR: Unable to enable/disable plugin",

Review comment:
       This message will be displayed in the modal header, and the actual error message from the storage plugin in the modal body (see the line below).

##########
File path: exec/java-exec/src/main/resources/rest/alertModals.ftl
##########
@@ -48,26 +48,29 @@
 <script>
     //Populate the alert modal with the right message params and show
     function populateAndShowAlert(errorMsg, inputValues) {
+      let errorModal=$('#errorModal');
+      let title;
+      let body;
       if (!(errorMsg in errorMap)) {
         //Using default errorId to represent message
-        modalHeader.innerHTML=errorMsg;
-        modalBody.innerHTML="[Auto Description] "+JSON.stringify(inputValues);
+        title=errorMsg;
+        body="[Auto Description] "+JSON.stringify(inputValues);
       } else {
-        modalHeader.innerHTML=errorMap[errorMsg].msgHeader;
-        modalBody.innerHTML=errorMap[errorMsg].msgBody;
+        title=errorMap[errorMsg].msgHeader;
+        body=errorMap[errorMsg].msgBody;
       }
       //Check if substitutions are needed
-      let updatedHtml=modalBody.innerHTML;
       if (inputValues != null) {
-        var inputValuesKeys = Object.keys(inputValues);
+        let inputValuesKeys = Object.keys(inputValues);
         for (i=0; i<inputValuesKeys.length; ++i) {
-            let currKey=inputValuesKeys[i];
-            updatedHtml=updatedHtml.replace(currKey, escapeHtml(inputValues[currKey]));
+          let currKey=inputValuesKeys[i];
+          body=body.replace(currKey, escapeHtml(inputValues[currKey]));
         }
-        modalBody.innerHTML=updatedHtml;
       }
+      errorModal.find('.modal-title').text(title);

Review comment:
       Sorry, I don't know how to do that depending on the content, since the same modal is used for all alerts.




----------------------------------------------------------------
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.

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