<template>
    <TableComponent :loading="node == null">
        <div class="resource-container node-container">
            <div class="header">
                <p>Name</p>
                <p>Alter</p>
                <p>Pods</p>
                <p>Status</p>
                <p>CPU</p>
                <p>RAM</p>
            </div>
            <NodeComponent :node-stats="ns" v-for="ns, index in node" class="resource" :class="{ even: index % 2 }"></NodeComponent>
        </div>
    </TableComponent>
</template>

<script setup lang="ts">
import type { NodeStats } from '~/classes/Node';
import { ResourceRepo } from '~/classes/ResourceRepo';
import NodeComponent from '~/components/NodeComponent.vue';

const node = ResourceRepo.init<NodeStats>().load('nodes').get();
</script>

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