Changeset - 616b22296156
[Not reviewed]
default
0 2 0
Drew Perttula - 8 years ago 2017-06-03 19:59:45
drewp@bigasterisk.com
collector web view use resource-display
Ignore-this: 5c0ee3c970bcd4160069e10009f34b0c
2 files changed with 15 insertions and 14 deletions:
0 comments (0 inline, 0 general)
light9/collector/web/index.html
Show inline comments
 
@@ -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>
light9/web/resource-display.html
Show inline comments
 
@@ -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() {
0 comments (0 inline, 0 general)