mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-28 23:08:12 +09:00
Fix Meilisearch widget reactivity
This commit is contained in:
parent
40b9f87bef
commit
01ce43e6ad
@ -11,17 +11,32 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {} from "vue";
|
||||
import {onBeforeUnmount, onMounted} from "vue";
|
||||
import bytes from "@/filters/bytes";
|
||||
import {i18n} from "@/i18n";
|
||||
|
||||
const props = defineProps<{
|
||||
meta: any; // TODO
|
||||
connection: any;
|
||||
meta: any;
|
||||
}>();
|
||||
|
||||
const total_size = $computed(() => props.meta.meilisearch.size);
|
||||
const index_count = $computed(() => props.meta.meilisearch.indexed_count);
|
||||
const available = $computed(() => props.meta.meilisearch.health);
|
||||
let total_size: number = $ref(0);
|
||||
let index_count: number = $ref(0);
|
||||
let available: string = $ref("unavailable");
|
||||
|
||||
function onStats(stats) {
|
||||
total_size = stats.meilisearch.size;
|
||||
index_count = stats.meilisearch.indexed_count;
|
||||
available = stats.meilisearch.available;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
props.connection.on("stats", onStats);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
props.connection.off("stats", onStats);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user