<template>
    <TableComponent :loading="services == null" v-for="services in [repo.get().value]">
        <div class="resource-container service-container">
            <div class="header">
                <p>Service</p>
                <p>Namespace</p>
                <p>Age</p>
                <p>Type</p>
                <p>Actions</p>
            </div>
            <ServiceComponent :service="service" v-for="(service, index) in services" class="resource" :class="{ even: index % 2 }"></ServiceComponent>
        </div>
    </TableComponent>
</template>

<script setup lang="ts">
import { ResourceRepo } from '~/classes/repo/ResourceRepo';
import type { Service } from '~/classes/Service';

const repo = ResourceRepo.init<Service>();
onMounted(() => {
    repo.listen("services");
});
onUnmounted(() => {
    repo.clear();
});
</script>

<style>
.service-container {
    grid-template-columns: auto auto auto 1fr auto;
}
</style>