Commit ce996edd authored by Luna Riegel's avatar Luna Riegel
Browse files

Add dynamic color for converter status

parent d9be535d
<template>
<v-row no-gutters class="justify-center">
<VcsLabel> Konverterservice Status: </VcsLabel>
<VcsLabel class="status" v-text="status"/>
<VcsLabel class="status" :class="status" v-text="status"/>
<VcsFormButton id="refreshBtn" icon="mdi-refresh" @click="checkHealth()" />
</v-row>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
import {ref, computed, onMounted, inject} from 'vue';
import {VcsFormButton, VcsLabel} from "@vcmap/ui";
import {VRow} from "vuetify/components";
const app = inject('vcsApp');
const isHealthy = ref(null);
const status = computed(() => {
......@@ -20,8 +22,14 @@ const status = computed(() => {
async function checkHealth() {
try {
const res = await fetch('/health');
isHealthy.value = res.ok;
if (app){
const { config } = app.plugins.getByKey(name);
const res = await fetch(config.convertLink + '/health');
isHealthy.value = res.ok;
} else {
isHealthy.value = null;
console.warn("Plugin config couldn't be loaded");
}
} catch {
isHealthy.value = false;
}
......@@ -30,3 +38,11 @@ async function checkHealth() {
onMounted(checkHealth);
</script>
<style scoped>
.status.Online {
color: green;
}
.status.Offline {
color: red;
}
</style>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment