kkhatua commented on a change in pull request #1644: DRILL-7036: Improve UI for alert and error messages URL: https://github.com/apache/drill/pull/1644#discussion_r258653031
########## File path: exec/java-exec/src/main/resources/rest/alertModals.ftl ########## @@ -0,0 +1,111 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<style> + .modalHeaderAlert, .closeX { + color:red !important; + text-align: center; + font-size: 16px; + } +</style> + <!-- + Alert Modal to use across templates. + By default, modal is hidden and expected to be populated and activated by relevant JavaScripts + --> + <div class="modal" id="errorModal" role="dialog" data-backdrop="static" data-keyboard="false" style="display: none;" aria-hidden="true"> + <div class="modal-dialog"> + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header modalHeaderAlert"> + <button type="button" class="close closeX" data-dismiss="modal" style="color:red;font-size:200%">×</button> + <h4 class="modal-title"><span class="glyphicon glyphicon-alert" style="font-size:125%"></span><span id="modalHeader" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;white-space:pre">~ErrorMessage~ Title</span></h4> + </div> + <div class="modal-body" id="modalBody" style="line-height:3"> + ~ErrorMessage Details~ + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-info btn-default" data-dismiss="modal">Close</button> + </div> + </div> + </div> + </div> +<script> + //Populate the alert modal with the right message params and show + function populateAndShowAlert(errorMsg, inputValues) { + //console.log("placeHolder -> "+ JSON.stringify(errorMap[errorMsg].placeHolder)); + //console.log("inputValues -> "+ JSON.stringify(inputValues)); + modalHeader.innerHTML=errorMap[errorMsg].msgHeader; + modalBody.innerHTML=errorMap[errorMsg].msgBody; + let substNames=[]; + let substValues=[]; + //Check if substitutions are needed + if (errorMap[errorMsg].placeHolder != null) { + //Check if input is an array of multiple substitutions + if (Array.isArray(errorMap[errorMsg].placeHolder)) { + substNames=errorMap[errorMsg].placeHolder; + substValues=inputValues; Review comment: The input values is expected to be an array, hence I didn't do the check, but will do it here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services