import React, { useState } from "react"; import { ShieldCheck, Key, FileCode, CheckCircle2, Plus, Clock, GitCommit, Save, Lock, Code, } from "lucide-react"; import { CredentialRef, AuditLogEntry, SiteConfig } from "../types"; interface ConfigAndAuditTabProps { credentials: CredentialRef[]; auditLogs: AuditLogEntry[]; siteConfig: SiteConfig; onAddCredential: ( name: string, type: CredentialRef["type"], val: string, ) => Promise; onSaveSiteConfig: (rawYaml: string) => Promise; } export const ConfigAndAuditTab: React.FC = ({ credentials, auditLogs, siteConfig, onAddCredential, onSaveSiteConfig, }) => { const [activeSubTab, setActiveSubTab] = useState< "credentials" | "audit" | "yaml" >("yaml"); const [yamlContent, setYamlContent] = useState(siteConfig.rawYaml); const [yamlSavedMsg, setYamlSavedMsg] = useState(null); // New Credential Form const [showAddCredModal, setShowAddCredModal] = useState(false); const [credName, setCredName] = useState(""); const [credType, setCredType] = useState("ssh_key"); const [credVal, setCredVal] = useState(""); const handleSaveYaml = async () => { try { await onSaveSiteConfig(yamlContent); setYamlSavedMsg( "Updated site.yaml successfully! Created Git commit on site-definition repository.", ); setTimeout(() => setYamlSavedMsg(null), 4000); } catch (err: any) { alert(`YAML Save Error: ${err.message}`); } }; const handleCreateCred = async (e: React.FormEvent) => { e.preventDefault(); if (!credName || !credVal) return; await onAddCredential(credName, credType, credVal); setShowAddCredModal(false); setCredName(""); setCredVal(""); }; return (
{/* HEADER */}

System Settings & Audit

Control Plane Configuration

Manage global site.yaml settings, secret credential references, and view system audit logs.

{/* SUB-TAB NAV */}
{activeSubTab === "yaml" ? (
{yamlSavedMsg && (
{yamlSavedMsg}
)}
/site.yaml Canonical Protocol Model