Files
pathfinder/js/app/ui/dialog/api_status.js
Mark Friedrich d45fa9b527 - New "Sovereignty" and "Faction warfare" data added, closed #853
- New ESI data import for wormhole type data from _ESI_, closed #852
- New ESI data import static wormholes, closed #852
- Improved performance for character authorization (PHP). Reduced number of _SQL_ queries.
- Improved HTTP cache header for `api/map/initData`, 'api/user/getEveServerStatus' ajax requests
2019-09-10 18:14:53 +02:00

76 lines
2.4 KiB
JavaScript

/**
* changelog dialog (GitHub API repository information)
*/
define([
'jquery',
'app/init',
'app/util',
'bootbox'
], ($, Init, Util, bootbox) => {
'use strict';
let config = {
apiStatusDialogClass: 'pf-api-status-dialog' // class for "api status" dialog
};
/**
* show api status dialog
* @param apiData
*/
$.fn.apiStatusDialog = function(apiData){
let data = {
apiData: apiData,
methodFormat: () => {
return (val, render) => {
switch(render(val)){
case 'get': return 'txt-color-blue';
case 'post': return 'txt-color-green';
case 'put': return 'txt-color-yellow';
case 'delete': return 'txt-color-red';
default: return '';
}
};
},
statusTitle: () => {
return (val, render) => {
switch(render(val)){
case 'green': return 'ok';
case 'yellow': return 'degraded: Slow or potentially dropping requests';
case 'orange': return 'bad: Most requests are not succeeding and/or are very slow (5s+) on average';
case 'red': return 'error: Status data not available. Either offline or any other fatal error';
default: return 'unknown';
}
};
},
secondsFormat: () => {
return (val, render) => {
return parseFloat(render(val)).toFixed(2) + 's';
};
}
};
requirejs(['text!templates/dialog/api_status.html', 'mustache'], (template, Mustache) => {
let apiStatusDialog = bootbox.dialog({
className: config.apiStatusDialogClass,
title: 'API status',
message: Mustache.render(template, data),
show: false,
buttons: {
close: {
label: 'cancel',
className: 'btn-default'
}
}
});
apiStatusDialog.initTooltips();
// show dialog
apiStatusDialog.modal('show');
});
};
});