소스 검색

[core] Don't cache any assist API response that contains the "code" attribute

For successful calls there's no code attribute so if it's present prevent caching and call the error callback
Johan Ahlen 10 년 전
부모
커밋
1fa67ed
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      desktop/core/src/desktop/static/desktop/js/assistHelper.js
  2. 1 1
      desktop/core/src/desktop/templates/ko_components.mako

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/assistHelper.js

@@ -156,7 +156,7 @@ AssistHelper.prototype.fetchAssistData = function (url, successCallback, errorCa
       type: "GET",
       url: url + "?" + Math.random(),
       success: function (data) {
-        if (data.code === 500){
+        if (typeof data.code != "undefined" && data.code != null) {
           errorCallback(data.error);
         } else {
           cachedData[url] = {

+ 1 - 1
desktop/core/src/desktop/templates/ko_components.mako

@@ -194,7 +194,7 @@ from desktop.views import _ko
           <span>${ _('The database list cannot be loaded.') }</span>
         </li>
 
-        <li class="nav-header" style="margin-top:10px;" data-bind="visible: ! loadingDatabases()">
+        <li class="nav-header" style="margin-top:10px;" data-bind="visible: ! loadingDatabases() && ! hasErrors()">
           ${_('tables')}
           <div class="pull-right" data-bind="visible: selectedDatabase() != null && selectedDatabase().hasEntries(), css: { 'hover-actions': ! filter(), 'blue': filter }">
             <a href="javascript:void(0)" data-bind="click: toggleSearch"><i class="pointer fa fa-search" title="${_('Search')}"></i></a>