Преглед на файлове

[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>