mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 23:31:13 -05:00
fix issue with restarting via web
replace some hard coded string in javascript with localization break things to fix things
This commit is contained in:
@ -105,6 +105,7 @@ namespace WebfrontCore.Controllers
|
||||
ViewBag.SocialLink = SocialLink ?? "";
|
||||
ViewBag.SocialTitle = SocialTitle;
|
||||
ViewBag.Pages = Pages;
|
||||
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||
|
||||
base.OnActionExecuting(context);
|
||||
}
|
||||
|
@ -52,26 +52,42 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
Manager.GetEventHandler().AddEvent(remoteEvent);
|
||||
List<CommandResponseInfo> response;
|
||||
// wait for the event to process
|
||||
if (!(await remoteEvent.WaitAsync(Utilities.DefaultCommandTimeout, server.Manager.CancellationToken)).Failed)
|
||||
{
|
||||
response = server.CommandResult.Where(c => c.ClientId == client.ClientId).ToList();
|
||||
|
||||
// remove the added command response
|
||||
for (int i = 0; i < response.Count; i++)
|
||||
try
|
||||
{
|
||||
// wait for the event to process
|
||||
if (!(await remoteEvent.WaitAsync(Utilities.DefaultCommandTimeout, server.Manager.CancellationToken)).Failed)
|
||||
{
|
||||
server.CommandResult.Remove(response[i]);
|
||||
response = server.CommandResult.Where(c => c.ClientId == client.ClientId).ToList();
|
||||
|
||||
// remove the added command response
|
||||
for (int i = 0; i < response.Count; i++)
|
||||
{
|
||||
server.CommandResult.Remove(response[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
response = new List<CommandResponseInfo>()
|
||||
{
|
||||
new CommandResponseInfo()
|
||||
{
|
||||
ClientId = client.ClientId,
|
||||
Response = Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMAND_TIMEOUT"]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
catch (System.OperationCanceledException)
|
||||
{
|
||||
response = new List<CommandResponseInfo>()
|
||||
{
|
||||
new CommandResponseInfo()
|
||||
{
|
||||
ClientId = client.ClientId,
|
||||
Response = Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMAND_TIMEOUT"]
|
||||
Response = Utilities.CurrentLocalization.LocalizationIndex["COMMADS_RESTART_SUCCESS"]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -156,6 +156,13 @@
|
||||
<environment include="Production">
|
||||
<script type="text/javascript" src="~/js/global.min.js"></script>
|
||||
</environment>
|
||||
<script>
|
||||
let _localizationTmp = @Html.Raw(Json.Serialize(ViewBag.Localization));
|
||||
const _localization = [];
|
||||
$.each(_localizationTmp.set, function (key, value) {
|
||||
_localization[key] = value;
|
||||
});
|
||||
</script>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
@ -7,7 +7,7 @@
|
||||
}
|
||||
|
||||
if (command[0] !== '!') {
|
||||
$('#console_command_response').text('All commands must start with !').addClass('text-danger');
|
||||
$('#console_command_response').text(_localization['WEBFRONT_CONSOLE_COMMAND']).addClass('text-danger');
|
||||
return false;
|
||||
}
|
||||
showLoader();
|
||||
@ -20,7 +20,7 @@
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
errorLoader();
|
||||
hideLoader();
|
||||
$('#console_command_response').text('Could not execute command: ' + error).addClass('text-danger');
|
||||
$('#console_command_response').text(_localization['WEBFRONT_CONSOLE_ERROR'] + error).addClass('text-danger');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ if ($('#penalty_table').length === 1) {
|
||||
$('#penalty_filter_selection').change(function() {
|
||||
location = location.href.split('?')[0] + "?showOnly=" + $('#penalty_filter_selection').val();
|
||||
});
|
||||
|
||||
/*
|
||||
https://stackoverflow.com/questions/19731730/jquery-js-detect-users-scroll-attempt-without-any-window-overflow-to-scroll
|
||||
*/
|
||||
|
||||
$('html').bind('mousewheel DOMMouseScroll', function (e) {
|
||||
var delta = (e.originalEvent.wheelDelta || -e.originalEvent.detail);
|
||||
|
||||
@ -44,7 +44,6 @@ if ($('#penalty_table').length === 1) {
|
||||
/*
|
||||
https://stackoverflow.com/questions/3898130/check-if-a-user-has-scrolled-to-the-bottom
|
||||
*/
|
||||
|
||||
var _throttleTimer = null;
|
||||
var _throttleDelay = 100;
|
||||
var $window = $(window);
|
||||
|
@ -60,33 +60,33 @@
|
||||
$.getJSON('https://extreme-ip-lookup.com/json/' + ip)
|
||||
.done(function (response) {
|
||||
$('#mainModal .modal-title').text(ip);
|
||||
$('#mainModal .modal-body').text("");
|
||||
$('#mainModal .modal-body').text('');
|
||||
if (response.ipName.length > 0) {
|
||||
$('#mainModal .modal-body').append("Hostname — " + response.ipName + '<br/>');
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_HOSTNAME']} — ${response.ipName}<br/>`);
|
||||
}
|
||||
if (response.isp.length > 0) {
|
||||
$('#mainModal .modal-body').append("ISP — " + response.isp + '<br/>');
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ISP']} — ${response.isp}<br/>`);
|
||||
}
|
||||
if (response.org.length > 0) {
|
||||
$('#mainModal .modal-body').append("Organization — " + response.org + '<br/>');
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_ORG']} — ${response.org}<br/>`);
|
||||
}
|
||||
if (response['businessName'].length > 0) {
|
||||
$('#mainModal .modal-body').append("Business — " + response.businessName + '<br/>');
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_BUSINESS']} — ${response.businessName}<br/>`);
|
||||
}
|
||||
if (response['businessWebsite'].length > 0) {
|
||||
$('#mainModal .modal-body').append("Website — " + response.businessWebsite + '<br/>');
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_WEBSITE']} — ${response.businessWebsite}<br/>`);
|
||||
}
|
||||
if (response.city.length > 0 || response.region.length > 0 || response.country.length > 0) {
|
||||
$('#mainModal .modal-body').append("Location — ");
|
||||
$('#mainModal .modal-body').append(`${_localization['WEBFRONT_PROFILE_LOOKUP_LOCATION']} — `);
|
||||
}
|
||||
if (response.city.length > 0) {
|
||||
$('#mainModal .modal-body').append(response.city);
|
||||
}
|
||||
if (response.region.length > 0) {
|
||||
$('#mainModal .modal-body').append(', ' + response.region);
|
||||
$('#mainModal .modal-body').append((response.city.length > 0 ? ', ' : '') + response.region);
|
||||
}
|
||||
if (response.country.length > 0) {
|
||||
$('#mainModal .modal-body').append(', ' + response.country);
|
||||
$('#mainModal .modal-body').append((response.country.length > 0 ? ', ' : '') + response.country);
|
||||
}
|
||||
|
||||
$('#mainModal').modal();
|
||||
|
@ -84,7 +84,7 @@ function refreshClientActivity() {
|
||||
$('#server_clientactivity_' + serverId).html(response);
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#server_clientactivity_' + serverId).html(" Could not load client activity - " + error);
|
||||
$('#server_clientactivity_' + serverId).html('');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
}
|
||||
},
|
||||
title: {
|
||||
text: "Performance History",
|
||||
text: _localization['WEBFRONT_STATS_PERFORMANCE_HISTORY'],
|
||||
fontSize: 14
|
||||
},
|
||||
axisX: {
|
||||
@ -39,14 +39,14 @@
|
||||
lineThickness: 0,
|
||||
tickThickness: 0,
|
||||
margin: 0,
|
||||
valueFormatString: " ",
|
||||
valueFormatString: ' ',
|
||||
},
|
||||
axisY: {
|
||||
labelFontSize: 12,
|
||||
interval: interval,
|
||||
gridThickness: 0,
|
||||
lineThickness: 0.5,
|
||||
valueFormatString: "#,##0",
|
||||
valueFormatString: '#,##0',
|
||||
minimum: min,
|
||||
maximum: max
|
||||
},
|
||||
@ -54,7 +54,7 @@
|
||||
dockInsidePlotArea: true
|
||||
},
|
||||
data: [{
|
||||
type: "splineArea",
|
||||
type: 'splineArea',
|
||||
color: 'rgba(0, 122, 204, 0.25)',
|
||||
markerSize: 3.5,
|
||||
dataPoints: fixedData
|
||||
|
Reference in New Issue
Block a user