Finished meta data endpoint support and dump version number
Change-Id: I3b2fd0485a36978125b7d8f0353bfc651f501a5a
diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index b87eb1f..9d4fd80 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -63,7 +63,8 @@
// doc is a KorAP.Match object
var url = KorAP.URL;
- url += '/' + match.textSigle;
+ url += '/corpus';
+ url += '/' + doc.textSigle;
if (param['fields'] !== undefined) {
url += '?fields='; // TODO!
@@ -102,7 +103,16 @@
*/
if (this.readyState == 4) {
- var json = JSON.parse(this.responseText);
+ var json;
+ try {
+ json = JSON.parse(this.responseText);
+ }
+ catch (e) {
+ KorAP.log(0, e);
+ console.log(e);
+ onload(undefined);
+ return;
+ };
if (json !== null && json["errors"] !== null) {
for (var i in json["errors"]) {
KorAP.log(json["errors"][i][0], json["errors"][i][1] || "Unknown");
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index e88bf98..605b9e0 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -193,7 +193,6 @@
ops.classList.add('action', 'bottom', 'button-group');
/*
- Temporarily disabled
var meta = ops.addE('span');
meta.addT('Meta');
meta.setAttribute('title', loc.SHOW_META);
diff --git a/dev/js/src/match/info.js b/dev/js/src/match/info.js
index ed8facc..f30287b 100644
--- a/dev/js/src/match/info.js
+++ b/dev/js/src/match/info.js
@@ -151,10 +151,13 @@
* Receive meta data from server.
*/
getMetaData : function (cb) {
+
+ var match = this._match;
+
try {
KorAP.API.getTextInfo(
- this._match, {}, function (textResponse) {
-
+ match, {}, function (textResponse) {
+
if (textResponse === undefined) {
cb(null);
return;
@@ -175,7 +178,7 @@
// Add metainfo to matchview
cb(matchMetaClass.create(
- this._match, fields
+ match, fields
));
}
);
@@ -345,6 +348,10 @@
var that = this;
this.getMetaData(function (meta) {
+
+ if (meta === null)
+ return;
+
// Load data
metaTable.classList.remove('loading');
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 05e1f3b..2edae65 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -1,30 +1,5 @@
define(['util'], function () {
- /*
- author, editor title, subTitle textSigle
- in corpusAuthor (corpusEditor), corpusTitle, corpusSubTitle, corpusSigle
- in docAuthor (docEditor), docTitle, docSubTitle, docSigle
- publisher
- reference
- creationDate
- foundries
- keywords
- textClass
- textColumn
- textDomain
- textType
- textTypeArt
- textTypeRef
- language
- license
- pages
- pubDate
- layerInfo
- tokenSource
- biblEditionStatement
- fileEditionStatement
-*/
-
// Localization values
const loc = KorAP.Locale;
loc.METADATA = loc.METADATA || 'Metadata';