All files / features/devices/components DeviceConnectionBadge.vue

100% Statements 11/11
100% Branches 6/6
100% Functions 3/3
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  4x             4x             4x 4x 4x 1x     3x 1x     2x      
<template>
  <GnBadge :variant="variant">{{ label }}</GnBadge>
</template>
 
<script setup>
import { computed } from "vue";
import { GnBadge } from "gnexus-ui-kit/vue";
 
const props = defineProps({
  status: {
    type: String,
    default: "unknown",
  },
});
 
const label = computed(() => props.status || "unknown");
const variant = computed(() => {
  if (props.status === "active") {
    return "success";
  }
 
  if (props.status === "lost") {
    return "danger";
  }
 
  return "secondary";
});
</script>