* feat(ui): New status page UI * docs: Rename labels to extra-labels * Fix domain expiration test * feat(ui): Add ui.default-sort-by and ui.default-filter-by * Change ui.header default value to Gatus * Re-use EndpointCard in Details.vue as well to avoid duplicate code * Fix flaky metrics test * Add subtle green color to "Gatus" * Remove duplicate title (tooltip is sufficient, no need for title on top of that) * Fix collapsed group user preferences * Update status page screenshots
58 lines
1.2 KiB
Vue
58 lines
1.2 KiB
Vue
<template>
|
|
<Badge :variant="variant" class="flex items-center gap-1">
|
|
<span :class="['w-2 h-2 rounded-full', dotClass]"></span>
|
|
{{ label }}
|
|
</Badge>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { Badge } from '@/components/ui/badge'
|
|
|
|
const props = defineProps({
|
|
status: {
|
|
type: String,
|
|
required: true,
|
|
validator: (value) => ['healthy', 'unhealthy', 'degraded', 'unknown'].includes(value)
|
|
}
|
|
})
|
|
|
|
const variant = computed(() => {
|
|
switch (props.status) {
|
|
case 'healthy':
|
|
return 'success'
|
|
case 'unhealthy':
|
|
return 'destructive'
|
|
case 'degraded':
|
|
return 'warning'
|
|
default:
|
|
return 'secondary'
|
|
}
|
|
})
|
|
|
|
const label = computed(() => {
|
|
switch (props.status) {
|
|
case 'healthy':
|
|
return 'Healthy'
|
|
case 'unhealthy':
|
|
return 'Unhealthy'
|
|
case 'degraded':
|
|
return 'Degraded'
|
|
default:
|
|
return 'Unknown'
|
|
}
|
|
})
|
|
|
|
const dotClass = computed(() => {
|
|
switch (props.status) {
|
|
case 'healthy':
|
|
return 'bg-green-400'
|
|
case 'unhealthy':
|
|
return 'bg-red-400'
|
|
case 'degraded':
|
|
return 'bg-yellow-400'
|
|
default:
|
|
return 'bg-gray-400'
|
|
}
|
|
})
|
|
</script> |