Skip to content
Snippets Groups Projects
Commit a65ee6e4 authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Display error if requested schema was not found

parent 12d1701b
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@ import {html, LitElement} from 'lit-element';
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
import JSONLD from 'vpu-common/jsonld';
import commonUtils from 'vpu-common/utils';
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
dt(window, $);
resp(window, $);
......@@ -64,21 +63,28 @@ class DataTableView extends LitElement {
JSONLD.initialize(this.entryPointUrl, function (jsonld) {
that.jsonld = jsonld;
that.apiUrl = that.jsonld.getApiUrlForIdentifier("http://schema.org/" + that.value);
that.table_columns = that.jsonld.entities[that.value]['hydra:supportedProperty'].map(obj => obj['hydra:title']);
try {
that.apiUrl = that.jsonld.getApiUrlForIdentifier("http://schema.org/" + that.value);
that.table_columns = that.jsonld.entities[that.value]['hydra:supportedProperty'].map(obj => obj['hydra:title']);
// display empty table
that.setup_columns();
let columns = [];
for (let i = 0; i < that.display_columns.length; ++i) {
columns[i] = {
title: that.display_columns[i],
visible: that.show_columns.indexOf(that.display_columns[i]) > -1
};
}
that.set_datatable(columns);
if (that.filter) {
that.loadWebPageElement();
// display empty table
that.setup_columns();
let columns = [];
for (let i = 0; i < that.display_columns.length; ++i) {
columns[i] = {
title: that.display_columns[i],
visible: that.show_columns.indexOf(that.display_columns[i]) > -1
};
}
that.set_datatable(columns);
if (that.filter) {
that.loadWebPageElement();
}
} catch (e) {
that.table_columns = ['message from server'];
that.setup_columns();
that.set_datatable([{title: 'message from server', visible: true}]);
that.table.row.add(['<span style="color:red;background:lightgray;">' + e.toString() + '</span>']);
}
});
......
......@@ -51,6 +51,11 @@ class DataTableViewDemo extends LitElement {
padding: 10px;
border: 1px solid green;
}
.box3 {
margin: 10px;
padding: 10px;
border: 1px solid blue;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
......@@ -85,9 +90,10 @@ class DataTableViewDemo extends LitElement {
</div>
</div>
</section>
<!--
<section class="section">
<div class="content">
<h4>DataTable: no paging, no searching</h4>
<h4>DataTable: no paging, no searching</h4>
<div class="box2">
<vpu-data-table-view
lang="${this.lang}"
......@@ -101,6 +107,24 @@ class DataTableViewDemo extends LitElement {
</div>
</div>
</section>
-->
<section class="section">
<h4>DataTable: nonexistant Entity</h4>
<div class="box3">
<vpu-data-table-view
lang="${this.lang}"
value="nonExistantEntity"
filter="*"
whitelisted-columns="*"
blacklisted-columns=""
id="dt4"
wait-until-all-loaded
paging
searching
></vpu-data-table-view>
</div>
</div>
</section>
`;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment