Browse Source

HUE-6024 [assist] Avoid js error on assist search with no entities in the response

Johan Ahlen 8 years ago
parent
commit
28e0d9d
1 changed files with 6 additions and 0 deletions
  1. 6 0
      desktop/core/src/desktop/templates/assist_search.mako

+ 6 - 0
desktop/core/src/desktop/templates/assist_search.mako

@@ -259,6 +259,12 @@ from notebook.conf import ENABLE_QUERY_BUILDER
             limit: 25,
             limit: 25,
             sources: ko.mapping.toJSON([self.assistPanel.visiblePanel().type])
             sources: ko.mapping.toJSON([self.assistPanel.visiblePanel().type])
           }).done(function (data) {
           }).done(function (data) {
+            if (typeof data === 'undefined' || data === null) {
+              data = {};
+            }
+            if (typeof data.entities === 'undefined') {
+              data.entities = [];
+            }
             data.entities.forEach(function (entity) {
             data.entities.forEach(function (entity) {
               entity.statsVisible = ko.observable(false);
               entity.statsVisible = ko.observable(false);
               entity.showNavContextPopoverDelayed = showNavContextPopoverDelayed;
               entity.showNavContextPopoverDelayed = showNavContextPopoverDelayed;