Browse Source

[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 years ago
parent
commit
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",
       type: "GET",
       url: url + "?" + Math.random(),
       url: url + "?" + Math.random(),
       success: function (data) {
       success: function (data) {
-        if (data.code === 500){
+        if (typeof data.code != "undefined" && data.code != null) {
           errorCallback(data.error);
           errorCallback(data.error);
         } else {
         } else {
           cachedData[url] = {
           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>
           <span>${ _('The database list cannot be loaded.') }</span>
         </li>
         </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')}
           ${_('tables')}
           <div class="pull-right" data-bind="visible: selectedDatabase() != null && selectedDatabase().hasEntries(), css: { 'hover-actions': ! filter(), 'blue': filter }">
           <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>
             <a href="javascript:void(0)" data-bind="click: toggleSearch"><i class="pointer fa fa-search" title="${_('Search')}"></i></a>