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:
@@ -43,9 +43,7 @@ const { maxResults: resultLimit = 20 } = defineProps<{
|
|||||||
maxResults?: number;
|
maxResults?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const close = defineEmit();
|
||||||
(e: "close"): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const query = ref("");
|
const query = ref("");
|
||||||
const autocomplete = ref<HTMLElement>();
|
const autocomplete = ref<HTMLElement>();
|
||||||
@@ -91,11 +89,11 @@ watchOnce(autocomplete, () => autocomplete.value?.focus());
|
|||||||
|
|
||||||
function selected({ id }: { id: string }) {
|
function selected({ id }: { id: string }) {
|
||||||
router.push({ name: "container-id", params: { id } });
|
router.push({ name: "container-id", params: { id } });
|
||||||
emit("close");
|
close();
|
||||||
}
|
}
|
||||||
function addColumn(container: Container) {
|
function addColumn(container: Container) {
|
||||||
store.appendActiveContainer(container);
|
store.appendActiveContainer(container);
|
||||||
emit("close");
|
close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<log-actions-toolbar @clear="onClearClicked()" />
|
<log-actions-toolbar @clear="onClearClicked()" />
|
||||||
</div>
|
</div>
|
||||||
<div class="mr-2 column is-narrow is-paddingless" v-if="closable">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,9 +38,7 @@ const {
|
|||||||
closable?: boolean;
|
closable?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const close = defineEmit();
|
||||||
(event: "close"): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const store = useContainerStore();
|
const store = useContainerStore();
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,14 @@
|
|||||||
import { Container } from "@/models/Container";
|
import { Container } from "@/models/Container";
|
||||||
import { type ComputedRef } from "vue";
|
import { type ComputedRef } from "vue";
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const loadingMore = defineEmit<[value: boolean]>();
|
||||||
(e: "loading-more", value: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const container = inject("container") as ComputedRef<Container>;
|
const container = inject("container") as ComputedRef<Container>;
|
||||||
const config = inject("stream-config") as { stdout: boolean; stderr: boolean };
|
const config = inject("stream-config") as { stdout: boolean; stderr: boolean };
|
||||||
const { messages, loadOlderLogs } = useLogStream(container, config);
|
const { messages, loadOlderLogs } = useLogStream(container, config);
|
||||||
|
|
||||||
const beforeLoading = () => emit("loading-more", true);
|
const beforeLoading = () => loadingMore(true);
|
||||||
const afterLoading = () => emit("loading-more", false);
|
const afterLoading = () => loadingMore(false);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
clear: () => (messages.value = []),
|
clear: () => (messages.value = []),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<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-viewer :messages="messages"></log-viewer>
|
||||||
</log-event-source>
|
</log-event-source>
|
||||||
</template>
|
</template>
|
||||||
@@ -7,10 +7,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import LogEventSource from "./LogEventSource.vue";
|
import LogEventSource from "./LogEventSource.vue";
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const loadingMore = defineEmit<[value: boolean]>();
|
||||||
(e: "loading-more", value: boolean): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const source = $ref<InstanceType<typeof LogEventSource>>();
|
const source = $ref<InstanceType<typeof LogEventSource>>();
|
||||||
function clear() {
|
function clear() {
|
||||||
source?.clear();
|
source?.clear();
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ const { data, width = 150, height = 30 } = defineProps<{ data: Point<unknown>[];
|
|||||||
const x = d3.scaleLinear().range([width, 0]);
|
const x = d3.scaleLinear().range([width, 0]);
|
||||||
const y = d3.scaleLinear().range([height, 0]);
|
const y = d3.scaleLinear().range([height, 0]);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const selectedPoint = defineEmit<[value: Point<unknown>]>();
|
||||||
(event: "selected-point", value: Point<unknown>): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const shape = d3
|
const shape = d3
|
||||||
.area<Point<unknown>>()
|
.area<Point<unknown>>()
|
||||||
@@ -41,7 +39,7 @@ function onMove(e: MouseEvent) {
|
|||||||
const index = Math.round(xValue);
|
const index = Math.round(xValue);
|
||||||
lineX = x(index);
|
lineX = x(index);
|
||||||
const point = data[index];
|
const point = data[index];
|
||||||
emit("selected-point", point);
|
selectedPoint(point);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user