mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
* WIP vue3 * WIP vue3 * WIP vue3 * Migrates to vitejs * Fixes js tests and removes not needed modules * Fixes unmount * Updates to use css instead for space * Fixes tests and rebases one more time * Uses orgua * Fixes migrations bugs with oruga and fixes scroll * Fixes v-deep * Fixes icons to prod * Fixes icons to prod * Adds favicon back * Transitions some to composition api * Updates another component to comp api * Cleans defineProps * Updates log messages * Moves more to compose api * Cleans up styles and rewrites event source * Tries to fix DOMPurify * Removes postcss * WIP typescript * Improves importing * Converts all to ts * Converts main to ts * Makes changes for tsconfig * Moves more to ts * Adds typing to store * More typing * Updates to ts * Updates the rest to ts * Fixes computes * Fixes unmount * Adds cypress with custom base fixed * Fixes jest tests * Fixes golang tests * Adds gitignore for cypress * Removes int in favor of e2e with cypress * Tries to fix int tests again * Adds title * Updates e2e tests * Uses vue for isMobile * Removes app spec * Cleans up docker * Adds drop down for settings * Fixes bug with restart * Fixes scroll up bug * Adds tests for light mode
121 lines
2.6 KiB
Vue
121 lines
2.6 KiB
Vue
<template>
|
|
<ul class="events" :class="settings.size">
|
|
<li v-for="item in filtered" :key="item.key" :data-event="item.event">
|
|
<span class="date" v-if="settings.showTimestamp"> <relative-time :date="item.date"></relative-time></span>
|
|
<span class="text" v-html="colorize(item.message)"></span>
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from "vue";
|
|
import { useStore } from "vuex";
|
|
|
|
import RelativeTime from "./RelativeTime.vue";
|
|
|
|
import AnsiConvertor from "ansi-to-html";
|
|
|
|
const props = defineProps({
|
|
messages: Array,
|
|
});
|
|
|
|
const store = useStore();
|
|
const ansiConvertor = new AnsiConvertor({ escapeXML: true });
|
|
function colorize(value) {
|
|
return ansiConvertor.toHtml(value).replace("<mark>", "<mark>").replace("</mark>", "</mark>");
|
|
}
|
|
|
|
const settings = computed(() => store.state.settings);
|
|
const searchFilter = computed(() => store.state.searchFilter);
|
|
const filtered = computed(() => {
|
|
if (searchFilter && searchFilter.value) {
|
|
const isSmartCase = searchFilter.value === searchFilter.value.toLowerCase();
|
|
try {
|
|
const regex = isSmartCase ? new RegExp(searchFilter.value, "i") : new RegExp(searchFilter.value);
|
|
return props.messages
|
|
.filter((d) => d.message.match(regex))
|
|
.map((d) => ({
|
|
...d,
|
|
message: d.message.replace(regex, "<mark>$&</mark>"),
|
|
}));
|
|
} catch (e) {
|
|
if (e instanceof SyntaxError) {
|
|
console.info(`Ignoring SytaxError from search.`, e);
|
|
return props.messages;
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
return props.messages;
|
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.events {
|
|
padding: 1em;
|
|
font-family: SFMono-Regular, Consolas, Liberation Mono, monaco, Menlo, monospace;
|
|
|
|
& > li {
|
|
word-wrap: break-word;
|
|
line-height: 130%;
|
|
&:last-child {
|
|
scroll-snap-align: end;
|
|
scroll-margin-block-end: 5rem;
|
|
}
|
|
&[data-event="container-stopped"] {
|
|
color: #f14668;
|
|
}
|
|
&[data-event="container-started"] {
|
|
color: hsl(141, 53%, 53%);
|
|
}
|
|
}
|
|
|
|
&.small {
|
|
font-size: 60%;
|
|
}
|
|
|
|
&.medium {
|
|
font-size: 80%;
|
|
}
|
|
|
|
&.large {
|
|
font-size: 120%;
|
|
}
|
|
}
|
|
|
|
.date {
|
|
background-color: #262626;
|
|
color: #258ccd;
|
|
|
|
[data-theme="light"] & {
|
|
background-color: #f0f0f0;
|
|
color: #009900;
|
|
padding-left: 5px;
|
|
padding-right: 5px;
|
|
}
|
|
}
|
|
|
|
.text {
|
|
white-space: pre-wrap;
|
|
&::before {
|
|
content: " ";
|
|
}
|
|
}
|
|
|
|
:deep(mark) {
|
|
border-radius: 2px;
|
|
background-color: var(--secondary-color);
|
|
animation: pops 200ms ease-out;
|
|
display: inline-block;
|
|
}
|
|
|
|
@keyframes pops {
|
|
0% {
|
|
transform: scale(1.5);
|
|
}
|
|
100% {
|
|
transform: scale(1.05);
|
|
}
|
|
}
|
|
</style>
|