<template>
    <TableComponent :loading="node == null">
        <div class="resource-container node-container">
            <div class="header">
                <p>Name</p>
                <p>Age</p>
                <p>Pods</p>
                <p>Status</p>
                <p>CPU</p>
                <p>Memory</p>
                <p>Disk Usage</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 { Node } from '~/classes/node/Node';
import { ResourceRepo } from '~/classes/repo/ResourceRepo';
import NodeComponent from '~/components/NodeComponent.vue';

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

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