Repository: storm
Updated Branches:
  refs/heads/master 12b06df72 -> 47a441673


[STORM-2644] Show message when result not found on deep search page


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b5a1a177
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b5a1a177
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b5a1a177

Branch: refs/heads/master
Commit: b5a1a177c1cf0f1c2e488f9ff07ce83fcdc68dcb
Parents: 8814bfa
Author: Ethan Li <[email protected]>
Authored: Wed Jul 19 20:57:02 2017 +0000
Committer: Ethan Li <[email protected]>
Committed: Thu Jul 20 15:27:19 2017 +0000

----------------------------------------------------------------------
 storm-core/src/ui/public/deep_search_result.html   | 17 ++++++++++++++++-
 .../deep-search-result-page-template.html          |  8 +++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/b5a1a177/storm-core/src/ui/public/deep_search_result.html
----------------------------------------------------------------------
diff --git a/storm-core/src/ui/public/deep_search_result.html 
b/storm-core/src/ui/public/deep_search_result.html
index 874073a..9a559f4 100644
--- a/storm-core/src/ui/public/deep_search_result.html
+++ b/storm-core/src/ui/public/deep_search_result.html
@@ -97,11 +97,26 @@ $(document).ready(function() {
             file.count = count;
             file.logviewerPort = logviewerPort;
             file.search_archived = search_archived;
+            if (file.matches == 0) {
+               file.resultNotFound = true;
+            }
             var searchTemplate = 
$(template).filter("#search-result-identified-template").html();
             var rendered = Mustache.render(searchTemplate, file);
             var elemId = elem_id_for_host(host);
             $("#"+elemId).remove();
-            $("#search-result-table > tbody").append(rendered);
+            if (file.resultNotFound) {
+                // if no result found,
+                // and there is no "aResult" or "noResult" element exists,
+                // append "resultNotFound" element
+                if (!$("#aResult").length && !$("#noResult").length) {
+                    $("#search-result-table > tbody").append(rendered);
+                }
+            } else {
+              // if a result found, remove "noResult" element,
+              // and append the result
+              $("#noResult").remove();
+              $("#search-result-table > tbody").append(rendered);
+            }
         }
 
 

http://git-wip-us.apache.org/repos/asf/storm/blob/b5a1a177/storm-core/src/ui/public/templates/deep-search-result-page-template.html
----------------------------------------------------------------------
diff --git 
a/storm-core/src/ui/public/templates/deep-search-result-page-template.html 
b/storm-core/src/ui/public/templates/deep-search-result-page-template.html
index a658e5c..c9a0844 100644
--- a/storm-core/src/ui/public/templates/deep-search-result-page-template.html
+++ b/storm-core/src/ui/public/templates/deep-search-result-page-template.html
@@ -29,11 +29,17 @@
 </script>
 <script id="search-result-identified-template" type="text/html">
     {{#matches}}
-    <tr>
+    <tr id="aResult">
       <td><a 
href="http://{{host}}:{{logviewerPort}}/logviewer_search.html?file={{fileName}}&search={{searchString}}";>{{host}}:{{port}}</a></td>
       <td><pre>{{beforeString}}<b><a 
href="{{logviewerURL}}">{{matchString}}</a></b>{{afterString}}</pre></td>
     </tr>
     {{/matches}}
+    {{#resultNotFound}}
+    <tr id="noResult">
+      <td>Result Not Found</td>
+      <td></td>
+    </tr>
+    {{/resultNotFound}}
 </script>
 <script id="search-form-template" type="text/html">
   <div id="search-form-container" class="search-box">

Reply via email to