OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

cluster_form.php

6 KB
<?php
$this->layout('layouts/main', [
    'page_title'    => $page_title,
    'current_route' => 'vms',
    'full_width'    => true,
]);

$cluster    = $cluster    ?? null;
$can_manage = $can_manage ?? false;
$isEdit     = $cluster !== null;
?>

<div class="vcf-wrap">

    <div class="content-header">
        <div>
            <h1><?= $this->e($page_title) ?></h1>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
                <li class="breadcrumb-item"><a href="/vms"><?= $this->te('Virtualisierung') ?></a></li>
                <li class="breadcrumb-item"><a href="/vms/clusters"><?= $this->te('Cluster') ?></a></li>
                <?php if ($isEdit): ?>
                    <li class="breadcrumb-item active"><?= $this->te('Bearbeiten') ?></li>
                <?php else: ?>
                    <li class="breadcrumb-item active"><?= $this->te('Neuer Cluster') ?></li>
                <?php endif; ?>
            </ol>
        </div>
    </div>

    <form action="<?= $this->e($form_action) ?>" method="POST" class="vcf-layout">
        <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">

        <!-- Hauptspalte -->
        <div class="vcf-main">

            <section class="vcf-card">
                <h2 class="vcf-section-head">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><circle cx="12" cy="5" r="3"/><circle cx="5" cy="19" r="3"/><circle cx="19" cy="19" r="3"/><line x1="12" y1="8" x2="5" y2="16"/><line x1="12" y1="8" x2="19" y2="16"/></svg>
                    <?= $this->te('Stammdaten') ?>
                </h2>
                <div class="vcf-card-body">
                    <div class="vcf-field">
                        <label for="vcf_name"><?= $this->te('Cluster-Name') ?> <span class="vcf-req">*</span></label>
                        <input type="text" id="vcf_name" name="name" required autofocus maxlength="255"
                               value="<?= $this->e($cluster['name'] ?? '') ?>"
                               placeholder="<?= $this->te('z.B. Proxmox-Cluster-01') ?>">
                        <span class="vcf-hint"><?= $this->te('Eindeutiger Name zur Identifikation des Clusters.') ?></span>
                    </div>
                    <div class="vcf-field">
                        <label for="vcf_desc"><?= $this->te('Beschreibung') ?></label>
                        <textarea id="vcf_desc" name="description" rows="5"
                                  placeholder="<?= $this->te('Kurze Beschreibung des Clusters, z.B. Standort, Zweck, enthaltene Hosts…') ?>"><?= $this->e($cluster['description'] ?? '') ?></textarea>
                    </div>
                </div>
            </section>

        </div>

        <!-- Sidebar -->
        <aside class="vcf-sidebar">

            <section class="vcf-card">
                <h2 class="vcf-section-head">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
                    <?= $this->te('Hinweis') ?>
                </h2>
                <div class="vcf-card-body">
                    <p class="vcf-info-text">
                        <?= $this->te('Cluster fassen mehrere physische Hosts zusammen. Hosts können einem Cluster zugeordnet werden und ermöglichen eine übergreifende Ressourcen-Auswertung.') ?>
                    </p>
                    <p class="vcf-info-text">
                        <?= $this->t('Hosts werden im <a href="/vms/hosts">Host-Bereich</a> einem Cluster zugewiesen.') ?>
                    </p>
                </div>
            </section>

            <div class="vcf-actions">
                <button type="submit" class="btn btn-primary">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="15" height="15"><polyline points="20 6 9 17 4 12"/></svg>
                    <?= $isEdit ? 'Änderungen speichern' : 'Cluster erstellen' ?>
                </button>
                <a href="/vms/clusters" class="btn btn-default"><?= $this->te('Abbrechen') ?></a>
            </div>

        </aside>
    </form>

</div>

<style>
/* ====================================================
   Cluster-Formular  ·  Prefix: vcf-
   ==================================================== */
.vcf-wrap { display:flex; flex-direction:column; }

.vcf-layout {
    display:grid; grid-template-columns:1fr 310px; gap:1.5rem;
    padding:1.5rem 1rem 3rem; background:var(--gray-50);
}
.vcf-main { display:flex; flex-direction:column; gap:1.25rem; }
.vcf-sidebar { display:flex; flex-direction:column; gap:1rem; }

.vcf-card { background:var(--color-bg); border-radius:0.25rem; box-shadow:0 1px 3px rgba(0,0,0,0.06); overflow:hidden; }
.vcf-section-head {
    display:flex; align-items:center; gap:0.5rem;
    font-size:0.8rem; font-weight:700; color:var(--gray-700);
    text-transform:uppercase; letter-spacing:0.04em;
    padding:0.875rem 1.25rem; border-bottom:1px solid var(--gray-100); margin:0; background:var(--gray-50);
}
.vcf-section-head svg { color:var(--gray-400); flex-shrink:0; }
.vcf-card-body { padding:1.25rem; display:flex; flex-direction:column; gap:0.875rem; }

.vcf-field { display:flex; flex-direction:column; gap:0.35rem; }
.vcf-field label { font-size:0.8rem; font-weight:600; color:var(--gray-700); }
.vcf-field input, .vcf-field textarea {
    width:100%; padding:0.5rem 0.75rem; border:1px solid var(--gray-300);
    border-radius:0.25rem; font-size:0.875rem; color:var(--gray-900);
    background:var(--color-bg); transition:border-color .15s; font-family:inherit;
}
.vcf-field input:focus, .vcf-field textarea:focus {
    outline:none; border-color:var(--color-primary); box-shadow:0 0 0 2px rgba(var(--color-primary-rgb), 0.15);
}
.vcf-field textarea { resize:vertical; }
.vcf-hint { font-size:0.75rem; color:var(--gray-400); }
.vcf-req { color:var(--red-600); }

.vcf-info-text { font-size:0.82rem; color:var(--gray-500); margin:0 0 0.5rem; line-height:1.5; }
.vcf-info-text a { color:var(--color-primary); }
.vcf-info-text:last-child { margin-bottom:0; }

.vcf-actions { display:flex; flex-direction:column; gap:0.5rem; }
@media (max-width:900px) { .vcf-layout { grid-template-columns:1fr; padding:1rem; } }
</style>