1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

chore: fixes typing for emits

This commit is contained in:
Amir Raminfar
2023-06-01 15:24:41 -07:00
parent c9bb793e9b
commit d7710f736f
5 changed files with 12 additions and 23 deletions

View File

@@ -43,9 +43,7 @@ const { maxResults: resultLimit = 20 } = defineProps<{
maxResults?: number;
}>();
const emit = defineEmits<{
(e: "close"): void;
}>();
const close = defineEmit();
const query = ref("");
const autocomplete = ref<HTMLElement>();
@@ -91,11 +89,11 @@ watchOnce(autocomplete, () => autocomplete.value?.focus());
function selected({ id }: { id: string }) {
router.push({ name: "container-id", params: { id } });
emit("close");
close();
}
function addColumn(container: Container) {
store.appendActiveContainer(container);
emit("close");
close();
}
</script>

View File

@@ -13,7 +13,7 @@
<log-actions-toolbar @clear="onClearClicked()" />
</div>
<div class="mr-2 column is-narrow is-paddingless" v-if="closable">
<button class="delete is-medium" @click="emit('close')"></button>
<button class="delete is-medium" @click="close()"></button>
</div>
</div>
</template>
@@ -38,9 +38,7 @@ const {
closable?: boolean;
}>();
const emit = defineEmits<{
(event: "close"): void;
}>();
const close = defineEmit();
const store = useContainerStore();

View File

@@ -7,16 +7,14 @@
import { Container } from "@/models/Container";
import { type ComputedRef } from "vue";
const emit = defineEmits<{
(e: "loading-more", value: boolean): void;
}>();
const loadingMore = defineEmit<[value: boolean]>();
const container = inject("container") as ComputedRef<Container>;
const config = inject("stream-config") as { stdout: boolean; stderr: boolean };
const { messages, loadOlderLogs } = useLogStream(container, config);
const beforeLoading = () => emit("loading-more", true);
const afterLoading = () => emit("loading-more", false);
const beforeLoading = () => loadingMore(true);
const afterLoading = () => loadingMore(false);
defineExpose({
clear: () => (messages.value = []),

View File

@@ -1,5 +1,5 @@
<template>
<log-event-source ref="source" #default="{ messages }" @loading-more="emit('loading-more', $event)">
<log-event-source ref="source" #default="{ messages }" @loading-more="loadingMore($event)">
<log-viewer :messages="messages"></log-viewer>
</log-event-source>
</template>
@@ -7,10 +7,7 @@
<script lang="ts" setup>
import LogEventSource from "./LogEventSource.vue";
const emit = defineEmits<{
(e: "loading-more", value: boolean): void;
}>();
const loadingMore = defineEmit<[value: boolean]>();
const source = $ref<InstanceType<typeof LogEventSource>>();
function clear() {
source?.clear();

View File

@@ -15,9 +15,7 @@ const { data, width = 150, height = 30 } = defineProps<{ data: Point<unknown>[];
const x = d3.scaleLinear().range([width, 0]);
const y = d3.scaleLinear().range([height, 0]);
const emit = defineEmits<{
(event: "selected-point", value: Point<unknown>): void;
}>();
const selectedPoint = defineEmit<[value: Point<unknown>]>();
const shape = d3
.area<Point<unknown>>()
@@ -41,7 +39,7 @@ function onMove(e: MouseEvent) {
const index = Math.round(xValue);
lineX = x(index);
const point = data[index];
emit("selected-point", point);
selectedPoint(point);
}
</script>