<template>
    <TableComponent :loading="statefulSets == null" v-for="statefulSets in [repo.get().value]">
        <div class="resource-container deployment-container">
            <div class="header">
                <p>Name</p>
                <p>Namespace</p>
                <p>Replicas</p>
                <p>Aktionen</p>
            </div>
            <StatefulSetComponent :stateful-set="statefulSet" v-for="statefulSet, index in statefulSets" class="resource" :class="{ even: index % 2 }"></StatefulSetComponent>
        </div>
    </TableComponent>
</template>

<script setup lang="ts">
import { ResourceRepo } from '~/classes/repo/ResourceRepo';
import type { StatefulSet } from '~/classes/StatefulSet';
import StatefulSetComponent from '~/components/statefulset/StatefulSetComponent.vue';

const repo = ResourceRepo.init<StatefulSet>();
onMounted(() => {
    repo.listen("stateful-sets");
});
onUnmounted(() => {
    repo.clear();
});
</script>

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