소스 검색

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;