]> source.dussan.org Git - sonarqube.git/commitdiff
Automatic merge from branch-5.6
authorssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>
Tue, 13 Sep 2016 06:02:01 +0000 (08:02 +0200)
committerssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>
Tue, 13 Sep 2016 06:02:01 +0000 (08:02 +0200)
* origin/branch-5.6:
  SONAR-8049 Drilldown on issues introduced since last analysis is not using correct date from project dashboard
  SONAR-7941 When l10n bundle is corrupted or missing UI fails to render

1  2 
server/sonar-web/src/main/js/helpers/l10n.js

index f2ea4d2b3367efb82a59c09e1083bf5ed3fc4950,89954667d93493c3b588019316167bdc00d9761a..3f7d48da597f768e3f9323b5daa2cf9714bc6236
@@@ -46,22 -41,34 +46,37 @@@ function getCurrentLocale () 
  }
  
  function makeRequest (params) {
 -  const url = `${window.baseUrl}/api/l10n/index?${stringify(params)}`;
 +  const url = '/api/l10n/index';
  
 -  return fetch(url, { credentials: 'same-origin' }).then(response => {
 -    if (response.status === 304) {
 -      return JSON.parse(localStorage.getItem('l10n.bundle'));
 -    } else if (response.status === 200) {
 -      return response.json();
 -    } else {
 -      throw new Error(response.status);
 -    }
 -  });
 +  return request(url)
 +      .setData(params)
 +      .submit()
 +      .then(response => {
 +        if (response.status === 304) {
 +          return JSON.parse(localStorage.getItem('l10n.bundle'));
 +        } else if (response.status === 200) {
 +          return response.json();
 +        } else {
 +          throw new Error(response.status);
 +        }
 +      });
  }
  
+ function checkCachedBundle () {
+   const cached = localStorage.getItem('l10n.bundle');
+   if (!cached) {
+     return false;
+   }
+   try {
+     const parsed = JSON.parse(cached);
+     return parsed != null && typeof parsed === 'object';
+   } catch (e) {
+     return false;
+   }
+ }
  export function requestMessages () {
    const currentLocale = getCurrentLocale();
    const cachedLocale = localStorage.getItem('l10n.locale');