import React, { useState, useEffect } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/index'; import { Button } from '@/components/ui/index'; import { Textarea } from '@/components/ui/index'; import { Edit, Save, X } from 'lucide-react'; import { getClusterNotes, updateClusterNotes, listProxmoxClusters } from '@/lib/proxmoxClient'; export function ProxmoxNotesPage() { const [notes, setNotes] = useState(''); const [editMode, setEditMode] = useState(false); const [draft, setDraft] = useState(''); const [clusterId, setClusterId] = useState(''); const [saving, setSaving] = useState(false); const [error, setError] = useState(null); useEffect(() => { const init = async () => { try { const clusters = await listProxmoxClusters(); if (clusters.length > 0) { setClusterId(clusters[0].id); const n = await getClusterNotes(clusters[0].id); setNotes(n); } } catch (e) { setError(String(e)); } }; void init(); }, []); const handleEdit = () => { setDraft(notes); setEditMode(true); }; const handleCancel = () => setEditMode(false); const handleSave = async () => { setSaving(true); try { await updateClusterNotes(clusterId, draft); setNotes(draft); setEditMode(false); } catch (e) { setError(String(e)); } finally { setSaving(false); } }; return (

Notes

Cluster notes and documentation

{!editMode ? ( ) : (
)}
{error &&
{error}
} Cluster Notes {!editMode ? (
              {notes || (
                
                  No notes yet. Click Edit to add notes.
                
              )}
            
) : (