Syncing the timeout param from backend (#3329)

* Syncing the timeout param from backend

* Linting
This commit is contained in:
Maxime Beauchemin
2017-08-18 15:49:47 -07:00
committed by GitHub
parent 527572c3eb
commit 2923a125db
8 changed files with 36 additions and 25 deletions

View File

@@ -4,13 +4,13 @@ import Mustache from 'mustache';
import vizMap from '../../visualizations/main';
import { getExploreUrl } from '../explore/exploreUtils';
import { applyDefaultFormData } from '../explore/stores/store';
import { QUERY_TIMEOUT_THRESHOLD } from '../constants';
const utils = require('./utils');
/* eslint wrap-iife: 0 */
const px = function () {
const px = function (state) {
let slice;
const timeout = state.common.conf.SUPERSET_WEBSERVER_TIMEOUT;
function getParam(name) {
/* eslint no-useless-escape: 0 */
const formattedName = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
@@ -157,8 +157,10 @@ const px = function () {
}
if (xhr) {
if (xhr.statusText === 'timeout') {
errHtml += '<div class="alert alert-warning">' +
`Query timeout - visualization query are set to time out at ${QUERY_TIMEOUT_THRESHOLD / 1000} seconds.</div>`;
errHtml += (
'<div class="alert alert-warning">' +
'Query timeout - visualization query are set to time out ' +
`at ${timeout} seconds.</div>`);
} else {
const extendedMsg = this.getErrorMsg(xhr);
if (extendedMsg) {
@@ -210,7 +212,7 @@ const px = function () {
container.css('height', this.height());
$.ajax({
url: this.jsonEndpoint(),
timeout: QUERY_TIMEOUT_THRESHOLD,
timeout: timeout * 1000,
success: (queryResponse) => {
try {
vizMap[formData.viz_type](this, queryResponse);
@@ -251,5 +253,5 @@ const px = function () {
initFavStars,
Slice,
};
}();
};
module.exports = px;