Files
ray/webui/src/ray-objects.html
T
Philipp MoritzandRobert Nishihara 33d7004914 New web UI. (#176)
* remove node.js webui

* temp commit

* flesh out web ui

* add documentation

* add ray timeline

* Small changes to documentation and formatting.
2017-01-06 00:13:22 -08:00

68 lines
2.3 KiB
HTML

<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="shared-styles.html">
<dom-module id="ray-objects">
<template>
<style include="shared-styles">
:host {
display: block;
padding: 10px;
}
</style>
<div class="card">
<h1>Objects</h1>
<vaadin-grid id="objects">
<table>
<colgroup>
<col name="object_id" sortable="" sort-direction="desc"/>
<col name="data_size" sortable="" sort-direction="desc"/>
<col name="hash" sortable="" sort-direction="desc"/>
</colgroup>
</table>
</vaadin-grid>
</div>
</template>
<script>
var backend_address = "ws://127.0.0.1:8888";
Polymer({
is: 'ray-objects',
ready: function() {
var objectSocket = new WebSocket(backend_address);
var objectInfoSocket = new WebSocket(backend_address);
var objects = Polymer.dom(this.root).querySelector("#objects");
objectSocket.onopen = function() {
objectSocket.send(JSON.stringify({"command": "get-objects"}));
}
objectSocket.onmessage = function(answer) {
objects.items = JSON.parse(answer.data);
}
objects.addEventListener('selected-items-changed', function() {
var index = this.selection.selected();
if (index != undefined && this.items != undefined && this.items[index] != undefined) {
var id = this.items[index]["object_id"];
objectInfoSocket.send(JSON.stringify({"command": "get-object-info", "object_id": id}));
objectInfoSocket.onmessage = function(answer) {
console.log(answer.data);
}
}
}.bind(objects));
}
});
</script>
</dom-module>