<template>
    <div @click="() => showViewPopup = true">
        <p class="grid-element cursor">{{ ingress.metadata.name }}</p>
        <p class="grid-element">{{ ingress.metadata.namespace }}</p>
        <p class="grid-element">{{ calcAge(ingress.metadata.creationTimestamp) }}</p>
        <p class="grid-element">{{ ingress.spec.ingressClassName }}</p>
        <p class="grid-element">{{ ingress.spec.rules.length }}</p>
        <IngressViewPopup v-if="showViewPopup" :ingress="ingress" ref="viewIngressPopup" @close="showViewPopup = false"></IngressViewPopup>
    </div>
</template>

<script setup lang="ts">
import type { Ingress } from '~/classes/Ingress';
import IngressViewPopup from './view/IngressViewPopup.vue';
import { calcAge } from '~/classes/Pod';

defineProps<{
    ingress: Ingress
}>();

const showViewPopup = ref(false);
</script>