<template>
    <TableComponent :loading="customResourceDefinitions == null">
        <div class="resource-container crd-container">
            <div class="header">
                <p>Name</p>
                <p>Gruppe</p>
            </div>
            <div v-for="customResourceDefinition, index in customResourceDefinitions" class="resource" :class="{ even: index % 2 }">
                <p class="grid-element">{{ customResourceDefinition.metadata.name }}</p>
                <p class="grid-element">{{ customResourceDefinition.spec.group }}</p>
            </div>
        </div>
    </TableComponent>
</template>

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

const customResourceDefinitions = ResourceRepo.init<CustomResourceDefinition>().load('custom-resource-definitions').get();
</script>

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