mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-24 06:28:42 +01:00
Adds the ability to split panes and view multiple logs (#186)
* Fixes css to have full containers * Adds split panes * Fixes background color * Fixes splitter * Fixes tests * Adds more tests * Updates tests * Adds vuex * Moves splitpane to app * Moves the panes to app * Fixes columns with min-width * Update packages * Updates html to have better components * Updates npm packages * Fixes scrollar * Creates a scrollable view * Fixes App specs * Adds vuex for component * Updates to use splitpanes * Styles splitter * Removes fetch-mock
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
<template lang="html">
|
||||
<span>
|
||||
<div>
|
||||
<slot v-bind:messages="messages"></slot>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let nextId = 0;
|
||||
let es = null;
|
||||
function parseMessage(data) {
|
||||
const date = new Date(data.substring(0, 30));
|
||||
const message = data.substring(30);
|
||||
@@ -27,18 +26,22 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.es = null;
|
||||
this.loadLogs(this.id);
|
||||
},
|
||||
methods: {
|
||||
loadLogs(id) {
|
||||
if (es) {
|
||||
es.close();
|
||||
if (this.es) {
|
||||
this.es.close();
|
||||
this.messages = [];
|
||||
es = null;
|
||||
this.es = null;
|
||||
}
|
||||
es = new EventSource(`${BASE_PATH}/api/logs/stream?id=${this.id}`);
|
||||
es.onmessage = e => this.messages.push(parseMessage(e.data));
|
||||
this.$once("hook:beforeDestroy", () => es.close());
|
||||
this.es = new EventSource(`${BASE_PATH}/api/logs/stream?id=${this.id}`);
|
||||
this.es.onmessage = e => this.messages.push(parseMessage(e.data));
|
||||
this.es.onerror = function(e) {
|
||||
console.log("EventSource failed." + e);
|
||||
};
|
||||
this.$once("hook:beforeDestroy", () => this.es.close());
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user