Files
ray/webui/src/ray-errors.html
T
Richard Liaw ced13ca5b1 Error Messages - UI display (#360)
* backend ui work

* instll block

* easy mvp

* Small changes.
2017-03-11 18:43:06 -08:00

47 lines
1.2 KiB
HTML

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="shared-styles.html">
<dom-module id="ray-errors">
<template>
<style include="shared-styles">
:host {
display: block;
padding: 10px;
}
</style>
<div class="card">
<h1>Errors</h1>
<vaadin-grid id="errors">
<table>
<colgroup>
<col name="driver_id" sortable="" sort-direction="desc"/>
<col name="task_id" sortable="" sort-direction="desc"/>
<col name="error" sortable="" sort-direction="desc"/>
</colgroup>
</table>
</vaadin-grid>
</div>
</template>
<script>
var backend_address = "ws://127.0.0.1:8888";
Polymer({
is: 'ray-errors',
ready: function() {
var eventSocket = new WebSocket(backend_address);
var errors = Polymer.dom(this.root).querySelector("#errors");
eventSocket.onopen = function() {
eventSocket.send(JSON.stringify({"command": "get-errors"}));
}
eventSocket.onmessage = function(answer) {
console.dir(answer.data);
errors.items = JSON.parse(answer.data);
}
}
});
</script>
</dom-module>