diff --git a/assets/js/sections/hrdlog.js b/assets/js/sections/hrdlog.js
index bf7779d26..4d63ae162 100644
--- a/assets/js/sections/hrdlog.js
+++ b/assets/js/sections/hrdlog.js
@@ -12,9 +12,14 @@ function ExportHrd(station_id) {
url: base_url + 'index.php/hrdlog/upload_station',
type: 'post',
data: {'station_id': station_id},
+ dataType: 'json',
success: function (data) {
+
+ //modify running state
$(".ld-ext-right-"+station_id).removeClass('running');
$(".ld-ext-right-"+station_id).prop('disabled', false);
+
+ //react to success
if (data.status == 'OK') {
$.each(data.info, function(index, value){
$('#modcount'+value.station_id).html(value.modcount);
@@ -22,29 +27,39 @@ function ExportHrd(station_id) {
$('#totcount'+value.station_id).html(value.totcount);
});
$(".card-body").append('
' + data.infomessage + '
');
- }
- else {
- $(".card-body").append('' + data.info + '
');
+ return;
}
- if (data.errormessages.length > 0) {
- $("#hrdlog_export").append(
- '\n' +
- '
\n' +
- ' \n' +
- '
\n' +
- '
\n' +
- '
'
- );
- $.each(data.errormessages, function (index, value) {
- $(".errors").append('' + value);
- });
+ //react to errors during upload
+ if (data.status == 'Error') {
+ $(".card-body").append('' + data.info + '
');
+
+ if (data.errormessages.length > 0) {
+ $("#hrdlog_export").append(
+ '\n' +
+ '
\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
'
+ );
+ $.each(data.errormessages, function (index, value) {
+ $(".errors").append('' + value);
+ });
+ }
+ return;
}
-
+
+ //react to errors due to credentials or disabled upload
+ if (data.status == 'Credential_Error'){
+ $(".card-body").append('' + data.infomessage + '
');
+ return;
+ }
+
}
});
}