Format geoip error messages

This commit is contained in:
JonnyWong16 2016-07-01 09:30:31 -07:00
parent 1df6dadbdd
commit f5ba168172
5 changed files with 13 additions and 6 deletions

View file

@ -102,7 +102,8 @@ DOCUMENTATION :: END
$(document).ready(function () { $(document).ready(function () {
$("#install_geoip_db, #reinstall_geoip_db").click(function () { $("#install_geoip_db, #reinstall_geoip_db").click(function () {
var msg = 'Are you sure you want to install the GeoLite2 database?<br /><br />' + var msg = 'Are you sure you want to install the GeoLite2 database?<br /><br />' +
'The database uses ~65MB in your PlexPy directory.'; 'The database is used to lookup IP address geolocation info.<br/>' +
'The database uses <strong>~65MB</strong> in your PlexPy directory.';
var url = 'install_geoip_db'; var url = 'install_geoip_db';
confirmAjaxCall(url, msg, 'Installing GeoLite2 database.', getConfigurationTable); confirmAjaxCall(url, msg, 'Installing GeoLite2 database.', getConfigurationTable);
}); });

View file

@ -3005,6 +3005,8 @@ a:hover .overlay-refresh-image {
a:hover .overlay-refresh-image:hover { a:hover .overlay-refresh-image:hover {
opacity: .9; opacity: .9;
} }
#ip_error a { #ip_error {
color: #e9a049; color: #aaa;
display: none;
text-align: center;
} }

View file

@ -13,7 +13,7 @@
</h4> </h4>
</div> </div>
<div class="modal-body" id="modal-text"> <div class="modal-body" id="modal-text">
<div id="ip_error" style="display: none; text-align: center;"></div> <div id="ip_error" class="text-muted"></div>
<div class="col-sm-12"> <div class="col-sm-12">
<h4><strong>Location Details</strong></h4> <h4><strong>Location Details</strong></h4>
</div> </div>

View file

@ -2067,6 +2067,8 @@
$("#plexpy-configuration-table").html(xhr.responseText); $("#plexpy-configuration-table").html(xhr.responseText);
if ("${kwargs.get('install_geoip')}" == 'true') { if ("${kwargs.get('install_geoip')}" == 'true') {
$('#install_geoip_db').removeClass('no-highlight').css('color','#e9a049'); $('#install_geoip_db').removeClass('no-highlight').css('color','#e9a049');
} else if ("${kwargs.get('reinstall_geoip')}" == 'true') {
$('#reinstall_geoip_db').removeClass('no-highlight').css('color','#e9a049');
} }
} }
}); });

View file

@ -593,9 +593,11 @@ def geoip_lookup(ip_address):
return 'Missing GeoLite2 database. Please reinstall from the ' \ return 'Missing GeoLite2 database. Please reinstall from the ' \
'<a href="settings?install_geoip=true">Settings</a> page.' '<a href="settings?install_geoip=true">Settings</a> page.'
except ValueError as e: except ValueError as e:
return 'Unable to read GeoLite2 database: %s' % e return 'Unable to read GeoLite2 database. Please reinstall from the ' \
'<a href="settings?reinstall_geoip=true">Settings</a> page.'
except maxminddb.InvalidDatabaseError as e: except maxminddb.InvalidDatabaseError as e:
return 'Invalid GeoLite2 database.' return 'Invalid GeoLite2 database. Please reinstall from the ' \
'<a href="settings?reinstall_geoip=true">Settings</a> page.'
except geoip2.errors.AddressNotFoundError as e: except geoip2.errors.AddressNotFoundError as e:
return '%s' % e return '%s' % e
except Exception as e: except Exception as e: