Mercurial > code > home > repos > light9
changeset 1597:616b22296156
collector web view use resource-display
Ignore-this: 5c0ee3c970bcd4160069e10009f34b0c
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sat, 03 Jun 2017 19:59:45 +0000 |
parents | 7d5d6e7bc526 |
children | 669c4892a1ff |
files | light9/collector/web/index.html light9/web/resource-display.html |
diffstat | 2 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/collector/web/index.html Sat Jun 03 19:58:42 2017 +0000 +++ b/light9/collector/web/index.html Sat Jun 03 19:59:45 2017 +0000 @@ -7,6 +7,7 @@ <link rel="import" href="/lib/polymer/polymer.html"> <link rel="import" href="/lib/iron-ajax/iron-ajax.html"> <link rel="import" href="../rdfdb-synced-graph.html"> + <link rel="import" href="../resource-display.html"> <script src="/lib/N3.js-pull61/browser/n3-browser.js"></script> <script src="/lib/async/dist/async.js"></script> <script src="/lib/underscore/underscore-min.js"></script> @@ -25,6 +26,10 @@ display: block; break-inside: avoid-column; } + h3 { + margin-top: 2px; + margin-bottom: 0; + } td.nonzero { background: #310202; color: #e25757; @@ -35,7 +40,7 @@ font-weight: bold; } </style> - <h3>{{label}}</h3> + <h3><resource-display graph="{{graph}}" uri="{{uri}}"></resource-display></h3> <table class="borders"> <tr> <th>output attr</th> @@ -58,11 +63,9 @@ properties: { graph: {type: Object, notify: true}, uri: {type: String, notify: true}, - label: {type: String, notify: true}, attrs: {type: Array, notify: true}, }, observers: [ - "setLabel(graph, uri)", "initUpdates(updates)", ], initUpdates: function(updates) { @@ -75,12 +78,6 @@ } }.bind(this)); }, - setLabel: function(graph, uri) { - this.label = uri.replace(/.*\//, ''); - graph.runHandler(function() { - this.label = graph.stringValue(uri, graph.Uri('rdfs:label')); - }.bind(this), 'setLabel'); - } }); }); </script>
--- a/light9/web/resource-display.html Sat Jun 03 19:58:42 2017 +0000 +++ b/light9/web/resource-display.html Sat Jun 03 19:59:45 2017 +0000 @@ -38,8 +38,8 @@ Polymer({ is: "resource-display", properties: { - graph: { type: Object, notify: true }, - uri: { type: String, notify: true }, + graph: { type: Object }, + uri: { type: String }, label: { type: String }, rename: { type: Boolean }, renameTo: { type: String, notify: true }, @@ -48,14 +48,18 @@ this.graph.runHandler(this.setLabel.bind(this), `label ${this.uri}`); }, setLabel: function() { + if (!this.uri) { + this.label = "<no uri>"; + return; + } try { - this.label = this.graph.stringValue(this.uri, - this.graph.Uri('rdfs:label')); + this.label = this.graph.stringValue(this.uri, + this.graph.Uri('rdfs:label')); } catch(e) { this.label = null; } if (!this.label) { - this.label = this.uri || "<no uri>"; + this.label = this.uri.replace(/.*\//, ''); } }, onRename: function() {