Procházet zdrojové kódy

[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 před 10 roky
rodič
revize
1fa67ed

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