<template>
    <PopupTemplate :heading="StringUtils.format('%s/%s', configMap.metadata.namespace, configMap.metadata.name)" @close="emits('close')">
        <div class="content-m">
            <h3>Data</h3>
            <p class="tile-m" v-if="configMap.data" v-for="[key, value] in Object.entries(configMap.data)">{{ key }}: {{ value }}</p>
            <UiPompt v-else :prompt="new Prompt('This config map contains no data.', PromptType.INFO)"></UiPompt>
        </div>
    </PopupTemplate>
</template>

<script setup lang="ts">
import type { ConfigMap } from '~/classes/ConfigMap';
import PopupTemplate from '~/components/popup/PopupTemplate.vue';
import { Prompt, PromptType } from '~/components/ui/Prompt';

defineProps<{
    configMap: ConfigMap
}>();

const emits = defineEmits<{
    (e: 'close'): void
}>()
</script>