Преглед изворни кода

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

Johan Ahlen пре 8 година
родитељ
комит
28e0d9d
1 измењених фајлова са 6 додато и 0 уклоњено
  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,
             sources: ko.mapping.toJSON([self.assistPanel.visiblePanel().type])
           }).done(function (data) {
+            if (typeof data === 'undefined' || data === null) {
+              data = {};
+            }
+            if (typeof data.entities === 'undefined') {
+              data.entities = [];
+            }
             data.entities.forEach(function (entity) {
               entity.statsVisible = ko.observable(false);
               entity.showNavContextPopoverDelayed = showNavContextPopoverDelayed;