feat : update agent 2
Some checks failed
Build and Push Docker Images / docker (push) Failing after 8s

This commit is contained in:
jeanotx32
2026-05-18 23:29:18 -04:00
parent a235116669
commit dfca25ab03
9 changed files with 226 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react'
import { fetchAllStatus, containerAction, addVps, deleteVps, fetchLogs, authStatus, getToken, setToken } from './api/client'
import { fetchAllStatus, containerAction, addVps, deleteVps, fetchLogs, authStatus, getToken, setToken, composeUpdate } from './api/client'
import Header from './components/Header'
import VpsCard from './components/VpsCard'
import LogsModal from './components/LogsModal'
@@ -24,6 +24,10 @@ export default function App() {
const [logsLoading, setLogsLoading] = useState(false)
const [showAddVps, setShowAddVps] = useState(false)
const [updateModal, setUpdateModal] = useState(null) // { vpsId, project }
const [updateContent, setUpdateContent] = useState('')
const [updateLoading, setUpdateLoading] = useState(false)
// Vérifie si des utilisateurs existent (pour afficher login ou register)
useEffect(() => {
authStatus()
@@ -114,6 +118,21 @@ export default function App() {
await refresh()
}
const handleUpdate = async (vpsId, project) => {
setUpdateModal({ vpsId, project })
setUpdateLoading(true)
setUpdateContent('')
try {
const data = await composeUpdate(vpsId, project)
setUpdateContent(data.output || '(aucune sortie)')
} catch (e) {
setUpdateContent(`Erreur lors de la mise à jour :\n${e.message}`)
} finally {
setUpdateLoading(false)
await refresh()
}
}
const handleAddVps = async (formData) => {
await addVps(formData)
setShowAddVps(false)
@@ -214,6 +233,7 @@ export default function App() {
onAction={handleAction}
onLogs={openLogs}
onDelete={handleDeleteVps}
onUpdate={handleUpdate}
/>
))}
</div>
@@ -230,6 +250,16 @@ export default function App() {
/>
)}
{/* Modal mise à jour compose */}
{updateModal && (
<LogsModal
name={`🔄 Update — ${updateModal.project}`}
logs={updateContent}
loading={updateLoading}
onClose={() => setUpdateModal(null)}
/>
)}
{/* Modal ajout VPS */}
{showAddVps && (
<AddVpsModal