mirror of
https://github.com/amir20/dozzle.git
synced 2026-01-03 11:35:00 +01:00
It works!
This commit is contained in:
34
assets/pages/Container.vue
Normal file
34
assets/pages/Container.vue
Normal 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
26
assets/pages/Index.vue
Normal 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>
|
||||
Reference in New Issue
Block a user