mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
fix incorrect path for VRF display text
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
iconLoading, iconError, iconTimeout, iconSuccess, tagGroup, tagLabel, resultsTitle, outputBlock,
|
iconLoading,
|
||||||
|
iconError,
|
||||||
|
iconTimeout,
|
||||||
|
iconSuccess,
|
||||||
|
tagGroup,
|
||||||
|
tagLabel,
|
||||||
|
resultsTitle,
|
||||||
|
outputBlock,
|
||||||
} from './components.es6';
|
} from './components.es6';
|
||||||
import jQuery from '../node_modules/jquery';
|
import jQuery from '../node_modules/jquery';
|
||||||
import hgConf from './frontend.json';
|
import hgConf from './frontend.json';
|
||||||
@@ -36,15 +43,13 @@ function queryApp(queryType, queryTypeName, locationList, queryTarget, queryVrf)
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
$('#hg-results-title').html(
|
$('#hg-results-title').html(
|
||||||
resultsTitle(
|
resultsTitle(queryTarget, queryTypeName, queryVrf, hgConf.config.branding.text.query_vrf),
|
||||||
queryTarget,
|
|
||||||
queryTypeName,
|
|
||||||
queryVrf,
|
|
||||||
hgConf.config.branding.text.vrf,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$('#hg-submit-icon').empty().removeClass('hg-loading').html('<i class="remixicon-search-line"></i>');
|
$('#hg-submit-icon')
|
||||||
|
.empty()
|
||||||
|
.removeClass('hg-loading')
|
||||||
|
.html('<i class="remixicon-search-line"></i>');
|
||||||
|
|
||||||
$.each(locationList, (n, loc) => {
|
$.each(locationList, (n, loc) => {
|
||||||
const locationName = $(`#${loc}`).data('display-name');
|
const locationName = $(`#${loc}`).data('display-name');
|
||||||
@@ -65,8 +70,13 @@ function queryApp(queryType, queryTypeName, locationList, queryTarget, queryVrf)
|
|||||||
.html(iconLoading(loc));
|
.html(iconLoading(loc));
|
||||||
|
|
||||||
const generateError = (errorClass, locError, text) => {
|
const generateError = (errorClass, locError, text) => {
|
||||||
$(`#${locError}-heading`).removeClass('bg-overlay').addClass(`bg-${errorClass}`);
|
$(`#${locError}-heading`)
|
||||||
$(`#${locError}-heading`).find('.hg-menu-btn').removeClass('btn-loading').addClass(`btn-${errorClass}`);
|
.removeClass('bg-overlay')
|
||||||
|
.addClass(`bg-${errorClass}`);
|
||||||
|
$(`#${locError}-heading`)
|
||||||
|
.find('.hg-menu-btn')
|
||||||
|
.removeClass('btn-loading')
|
||||||
|
.addClass(`btn-${errorClass}`);
|
||||||
$(`#${locError}-status-container`)
|
$(`#${locError}-status-container`)
|
||||||
.removeClass('hg-loading')
|
.removeClass('hg-loading')
|
||||||
.find('.hg-status-btn')
|
.find('.hg-status-btn')
|
||||||
@@ -77,12 +87,22 @@ function queryApp(queryType, queryTypeName, locationList, queryTarget, queryVrf)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const timeoutError = (locError, text) => {
|
const timeoutError = (locError, text) => {
|
||||||
$(`#${locError}-heading`).removeClass('bg-overlay').addClass('bg-warning');
|
$(`#${locError}-heading`)
|
||||||
$(`#${locError}-heading`).find('.hg-menu-btn').removeClass('btn-loading').addClass('btn-warning');
|
.removeClass('bg-overlay')
|
||||||
$(`#${locError}-status-container`).removeClass('hg-loading').find('.hg-status-btn').empty()
|
.addClass('bg-warning');
|
||||||
|
$(`#${locError}-heading`)
|
||||||
|
.find('.hg-menu-btn')
|
||||||
|
.removeClass('btn-loading')
|
||||||
|
.addClass('btn-warning');
|
||||||
|
$(`#${locError}-status-container`)
|
||||||
|
.removeClass('hg-loading')
|
||||||
|
.find('.hg-status-btn')
|
||||||
|
.empty()
|
||||||
.html(iconTimeout)
|
.html(iconTimeout)
|
||||||
.addClass('hg-done');
|
.addClass('hg-done');
|
||||||
$(`#${locError}-text`).empty().html(text);
|
$(`#${locError}-text`)
|
||||||
|
.empty()
|
||||||
|
.html(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -102,15 +122,22 @@ function queryApp(queryType, queryTypeName, locationList, queryTarget, queryVrf)
|
|||||||
})
|
})
|
||||||
.done((data, textStatus, jqXHR) => {
|
.done((data, textStatus, jqXHR) => {
|
||||||
const displayHtml = `<pre>${data.output}</pre>`;
|
const displayHtml = `<pre>${data.output}</pre>`;
|
||||||
$(`#${loc}-heading`).removeClass('bg-overlay').addClass('bg-primary');
|
$(`#${loc}-heading`)
|
||||||
$(`#${loc}-heading`).find('.hg-menu-btn').removeClass('btn-loading').addClass('btn-primary');
|
.removeClass('bg-overlay')
|
||||||
|
.addClass('bg-primary');
|
||||||
|
$(`#${loc}-heading`)
|
||||||
|
.find('.hg-menu-btn')
|
||||||
|
.removeClass('btn-loading')
|
||||||
|
.addClass('btn-primary');
|
||||||
$(`#${loc}-status-container`)
|
$(`#${loc}-status-container`)
|
||||||
.removeClass('hg-loading')
|
.removeClass('hg-loading')
|
||||||
.find('.hg-status-btn')
|
.find('.hg-status-btn')
|
||||||
.empty()
|
.empty()
|
||||||
.html(iconSuccess)
|
.html(iconSuccess)
|
||||||
.addClass('hg-done');
|
.addClass('hg-done');
|
||||||
$(`#${loc}-text`).empty().html(displayHtml);
|
$(`#${loc}-text`)
|
||||||
|
.empty()
|
||||||
|
.html(displayHtml);
|
||||||
})
|
})
|
||||||
.fail((jqXHR, textStatus, errorThrown) => {
|
.fail((jqXHR, textStatus, errorThrown) => {
|
||||||
const statusCode = jqXHR.status;
|
const statusCode = jqXHR.status;
|
||||||
@@ -121,7 +148,10 @@ function queryApp(queryType, queryTypeName, locationList, queryTarget, queryVrf)
|
|||||||
$('#hg-ratelimit-query').modal('show');
|
$('#hg-ratelimit-query').modal('show');
|
||||||
} else if (statusCode === 500 && textStatus !== 'timeout') {
|
} else if (statusCode === 500 && textStatus !== 'timeout') {
|
||||||
timeoutError(loc, hgConf.config.messages.request_timeout);
|
timeoutError(loc, hgConf.config.messages.request_timeout);
|
||||||
} else if ((jqXHR.responseJSON.alert === 'danger') || (jqXHR.responseJSON.alert === 'warning')) {
|
} else if (
|
||||||
|
jqXHR.responseJSON.alert === 'danger'
|
||||||
|
|| jqXHR.responseJSON.alert === 'warning'
|
||||||
|
) {
|
||||||
generateError(jqXHR.responseJSON.alert, loc, jqXHR.responseJSON.output);
|
generateError(jqXHR.responseJSON.alert, loc, jqXHR.responseJSON.output);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user