mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-23 22:18:26 +01:00
54 lines
1.3 KiB
Vue
54 lines
1.3 KiB
Vue
<template>
|
|
<scrollable-view :scrollable="scrollable" v-if="container">
|
|
<template #header v-if="showTitle">
|
|
<div class="mx-2 flex items-center gap-2 md:ml-4">
|
|
<container-title @close="$emit('close')" />
|
|
<container-stat class="ml-auto" />
|
|
|
|
<log-actions-toolbar @clear="onClearClicked()" class="mobile-hidden" />
|
|
<a class="btn btn-circle btn-xs" @click="close()" v-if="closable">
|
|
<mdi:close />
|
|
</a>
|
|
</div>
|
|
</template>
|
|
<template #default="{ setLoading }">
|
|
<log-viewer-with-source ref="viewer" @loading-more="setLoading($event)" />
|
|
</template>
|
|
</scrollable-view>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import LogViewerWithSource from "./LogViewerWithSource.vue";
|
|
|
|
const {
|
|
id,
|
|
showTitle = false,
|
|
scrollable = false,
|
|
closable = false,
|
|
} = defineProps<{
|
|
id: string;
|
|
showTitle?: boolean;
|
|
scrollable?: boolean;
|
|
closable?: boolean;
|
|
}>();
|
|
|
|
const close = defineEmit();
|
|
|
|
const store = useContainerStore();
|
|
const container = store.currentContainer($$(id));
|
|
provideContainerContext(container);
|
|
|
|
const viewer = ref<InstanceType<typeof LogViewerWithSource>>();
|
|
|
|
function onClearClicked() {
|
|
viewer.value?.clear();
|
|
}
|
|
|
|
onKeyStroke("k", (e) => {
|
|
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
onClearClicked();
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
</script>
|