Correctly propagate frontend call warnings (fixes #211)
Change-Id: Ia571b8e6b0ba0a4edbf0501254ce2bc115f18cf6
diff --git a/Changes b/Changes
index ac459ff..b67d33e 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.55 2024-06-11
+ - Correctly propagate warnings in frontend calls. (diewald)
+
0.54 2024-06-10
- Remove deprecated 'matchInfo' API path. (diewald, margaretha)
- Improve footer responsiveness. (diewald)
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index 80391d8..3b3b821 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -169,10 +169,16 @@
return;
};
- if (retJSObj !== undefined && retJSObj["errors"] !== undefined) {
- retJSObj["errors"].forEach(
- e => KorAP.log(e[0], e[1] || "Unknown")
- );
+ if (retJSObj !== undefined) {
+ if (retJSObj["errors"] !== undefined) {
+ retJSObj["errors"].forEach(
+ e => KorAP.log(e[0], e[1] || "Unknown")
+ );
+ } else if (retJSObj["warnings"] !== undefined) {
+ retJSObj["warnings"].forEach(
+ e => KorAP.log(e[0], e[1] || "Unknown", null, 'warn')
+ );
+ }
}
else if (this.status !== 200) {
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 6243bc7..6e6b4f1 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -56,7 +56,7 @@
// Override KorAP.log
window.alertify = alertifyClass;
- KorAP.log = function (code, msg, src) {
+ KorAP.log = function (code, msg, src, type) {
if (src) {
msg += '<code class="src">'+src+'</code>';
@@ -66,7 +66,7 @@
alertifyClass.log(
(code === 0 ? '' : code + ': ') +
msg,
- 'error',
+ (type ? type : 'error'),
10000
);
};
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 31cefb6..2afe546 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -8,7 +8,7 @@
use List::Util qw!none uniq!;
# Minor version - may be patched from package.json
-our $VERSION = '0.54';
+our $VERSION = '0.55';
# Supported version of Backend API
our $API_VERSION = '1.0';
diff --git a/package.json b/package.json
index 2a83165..500c24a 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
"license": "BSD-2-Clause",
- "version": "0.54.0",
+ "version": "0.55.0",
"pluginVersion": "0.2.2",
"engines": {
"node": ">=6.0.0"