1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-03 11:35:00 +01:00

It works!

This commit is contained in:
Amir Raminfar
2018-10-30 12:31:34 -07:00
parent 7568312b28
commit dbf24db594
10 changed files with 826 additions and 87 deletions

View File

@@ -0,0 +1,34 @@
<template lang="html">
<ul ref="logs">
</ul>
</template>
<script>
let ws;
export default {
props: ["id"],
name: "Container",
mounted() {
ws = new WebSocket(`ws://${window.location.host}/api/logs?id=${this.id}`);
ws.onopen = e => console.log("Connection opened.");
ws.onclose = e => console.log("Connection closed.");
ws.onerror = e => console.error("Connection error: " + e.data);
ws.onmessage = e => {
const parent = this.$refs.logs;
const item = document.createElement("li");
item.innerHTML = e.data;
parent.appendChild(item);
};
}
};
</script>
<style>
ul {
padding: 0;
margin: 0;
}
ul li {
list-style-type: none;
}
</style>

26
assets/pages/Index.vue Normal file
View File

@@ -0,0 +1,26 @@
<template lang="html">
<div>
<ul>
<li v-for="item in containers">
<router-link :to="{name: 'container', params: {id: item.Id}}">{{ item.Names[0] }} {{ item.Status}}</router-link>
</li>
</ul>
</div>
</template>
<script>
export default {
name: "Index",
data() {
return {
containers: []
};
},
async created() {
this.containers = await (await fetch(`/api/containers.json`)).json();
}
};
</script>
<style lang="css">
</style>