Skip to content

Commit

Permalink
[Evaluation tool] Optimize "Error and warning messages" layout
Browse files Browse the repository at this point in the history
  • Loading branch information
KristjanESPERANTO committed Jan 3, 2025
1 parent 0d2e2f7 commit 4eaa6cb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ Changed

* Hungarian

* [Evaluation tool] Optimize "Error and warning messages" layout

Fixed
~~~~~

Expand Down
7 changes: 4 additions & 3 deletions site/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ p.value_explanation {
padding: 6px 10px;
border-radius: 5px;
}
/* See http://clrs.cc/ */
.error { background: #ff851b } /* Orange */
.warning { background: #ffdc00 } /* Yellow */
/* See https://clrs.cc/ */
.error { background: #ff851b; padding: 3px; } /* Orange */
.warning { background: #ffdc00; padding: 3px; } /* Yellow */
div.warning_error_message { margin: 5px 0 0 0; padding: 5px; background-color : white; opacity: 0.8; font-family: monospace;}
span.year { background: #ff851b } /* Orange */
span.week { background: #ffdc00 } /* Yellow */
span.month { background: #88ff88 }
Expand Down
24 changes: 15 additions & 9 deletions site/js/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global $, , default_lat, default_lon, i18next, jQuery, mapCountryToLanguage, opening_hours, OpeningHoursTable, specification_url, YoHoursChecker */

/* Constants {{{ */
var nominatim_api_url = 'https://nominatim.openstreetmap.org/reverse';
// var nominatim_api_url = 'https://open.mapquestapi.com/nominatim/v1/reverse.php';
Expand Down Expand Up @@ -189,9 +191,10 @@ function Evaluate (offset, reset) {
var it = oh.getIterator(date);
} catch (err) {
crashed = err;
show_warnings_or_errors.innerHTML = '<p class="error">' + i18next.t('texts.filter.error') + ':<br />'
+ '<textarea rows="' + crashed.split('\n').length + 1 + '" style="width: 100%" name="WarnErrors" readonly="readonly">' + crashed
+ '</textarea></p>';
show_warnings_or_errors.innerHTML = `
<div class="error"> ${i18next.t('texts.filter.error')}
<div class="warning_error_message"> ${crashed} </div>
</div>`;
show_time_table.innerHTML = '';
show_results.innerHTML = '';
}
Expand Down Expand Up @@ -331,15 +334,18 @@ function Evaluate (offset, reset) {

var warnings = oh.getWarnings();
if (warnings.length > 0) {
show_warnings_or_errors.innerHTML += '<p class="warning">' + i18next.t('texts.filter.error') + ':<br />'
+ '<textarea rows="' + (warnings.length + 1)
+ '" style="width: 100%" name="WarnErrors" readonly="readonly">' + warnings.join('\n')
+ '</textarea></p>';
show_warnings_or_errors.innerHTML += `
<div class="warning"> ${i18next.t('texts.filter.error')}
<div class="warning_error_message"> ${warnings.join('\n')} </div>
</div>`;
}

if (prettified.length > 255) {
show_warnings_or_errors.innerHTML += '<p>' + i18next.t('texts.value to long for osm',
{ pretLength: prettified.length, valLength: value.length, maxLength: 255 }) + '</p>';
show_warnings_or_errors.innerHTML += `
<div class="warning"> ${i18next.t('texts.filter.error')}
<div class="warning_error_message"> ${i18next.t('texts.value to long for osm',
{ pretLength: prettified.length, valLength: value.length, maxLength: 255 })} </div>
</div>`;
}

show_time_table.innerHTML += OpeningHoursTable.drawTableAndComments(oh, it);
Expand Down

0 comments on commit 4eaa6cb

Please sign in to comment.