mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -07:00
properly calculate percent
This commit is contained in:
parent
fab56443ef
commit
916716b589
1 changed files with 6 additions and 2 deletions
|
@ -16,6 +16,7 @@ import { onBeforeUnmount, onMounted } from "vue";
|
||||||
import bytes from "@/filters/bytes";
|
import bytes from "@/filters/bytes";
|
||||||
import XPie from "./pie.vue";
|
import XPie from "./pie.vue";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
import * as os from "@/os";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
connection: any;
|
connection: any;
|
||||||
|
@ -23,7 +24,7 @@ const props = defineProps<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let progress: number = $ref(0);
|
let progress: number = $ref(0);
|
||||||
|
let serverStats = $ref(null);
|
||||||
let total_size: number = $ref(0);
|
let total_size: number = $ref(0);
|
||||||
let index_count: number = $ref(0);
|
let index_count: number = $ref(0);
|
||||||
let available: string = $ref("unavailable");
|
let available: string = $ref("unavailable");
|
||||||
|
@ -32,10 +33,13 @@ function onStats(stats) {
|
||||||
total_size = stats.meilisearch.size;
|
total_size = stats.meilisearch.size;
|
||||||
index_count = stats.meilisearch.indexed_count;
|
index_count = stats.meilisearch.indexed_count;
|
||||||
available = stats.meilisearch.health;
|
available = stats.meilisearch.health;
|
||||||
progress = Math.floor((index_count / total_size) * 100);
|
progress = Math.floor((index_count / serverStats.notesCount) * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
os.api("stats", {}).then((res) => {
|
||||||
|
serverStats = res;
|
||||||
|
});
|
||||||
props.connection.on("stats", onStats);
|
props.connection.on("stats", onStats);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue