Save current BZZZ config-ui state before CHORUS branding update

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-19 00:19:00 +10:00
parent 6a6a49b7b1
commit c177363a19
16410 changed files with 1789161 additions and 230 deletions

View File

@@ -2,22 +2,42 @@
import { useState, useEffect } from 'react'
import { ChevronRightIcon, CheckCircleIcon } from '@heroicons/react/24/outline'
import TermsAndConditions from './components/TermsAndConditions'
import LicenseValidation from './components/LicenseValidation'
import SystemDetection from './components/SystemDetection'
import RepositoryConfiguration from './components/RepositoryConfiguration'
import NetworkConfiguration from './components/NetworkConfiguration'
import SecuritySetup from './components/SecuritySetup'
import AIConfiguration from './components/AIConfiguration'
import ResourceAllocation from './components/ResourceAllocation'
import ServiceDeployment from './components/ServiceDeployment'
import ClusterFormation from './components/ClusterFormation'
import TestingValidation from './components/TestingValidation'
const SETUP_STEPS = [
{
id: 'terms',
title: 'Terms & Conditions',
description: 'Review and accept the software license agreement',
component: TermsAndConditions,
},
{
id: 'license',
title: 'License Validation',
description: 'Validate your BZZZ license key and email',
component: LicenseValidation,
},
{
id: 'detection',
title: 'System Detection',
description: 'Detect hardware and validate installation',
component: SystemDetection,
},
{
id: 'repository',
title: 'Repository Setup',
description: 'Configure Git repository for task management',
component: RepositoryConfiguration,
},
{
id: 'network',
title: 'Network Configuration',
@@ -36,22 +56,16 @@ const SETUP_STEPS = [
description: 'Configure OpenAI and Ollama/Parallama',
component: AIConfiguration,
},
{
id: 'resources',
title: 'Resource Allocation',
description: 'Allocate CPU, memory, and storage',
component: ResourceAllocation,
},
{
id: 'deployment',
title: 'Service Deployment',
description: 'Deploy and configure BZZZ services',
description: 'Deploy and configure CHORUS:agents services',
component: ServiceDeployment,
},
{
id: 'cluster',
title: 'Cluster Formation',
description: 'Join or create BZZZ cluster',
description: 'Join or create CHORUS:agents cluster',
component: ClusterFormation,
},
{
@@ -72,17 +86,63 @@ export default function SetupPage() {
const [configData, setConfigData] = useState<ConfigData>({})
const [systemInfo, setSystemInfo] = useState<any>(null)
// Load system information on mount
// Load persisted data and system information on mount
useEffect(() => {
loadPersistedData()
fetchSystemInfo()
}, [])
// Save setup state to localStorage whenever it changes
useEffect(() => {
saveSetupState()
}, [currentStep, completedSteps, configData])
const loadPersistedData = () => {
try {
const savedState = localStorage.getItem('bzzz-setup-state')
if (savedState) {
const state = JSON.parse(savedState)
setCurrentStep(state.currentStep || 0)
setCompletedSteps(new Set(state.completedSteps || []))
setConfigData(state.configData || {})
}
} catch (error) {
console.error('Failed to load persisted setup data:', error)
}
}
const saveSetupState = () => {
try {
const state = {
currentStep,
completedSteps: Array.from(completedSteps),
configData,
timestamp: new Date().toISOString()
}
localStorage.setItem('bzzz-setup-state', JSON.stringify(state))
} catch (error) {
console.error('Failed to save setup state:', error)
}
}
const clearPersistedData = () => {
try {
localStorage.removeItem('bzzz-setup-state')
// Reset state to initial values
setCurrentStep(0)
setCompletedSteps(new Set<number>())
setConfigData({})
} catch (error) {
console.error('Failed to clear persisted data:', error)
}
}
const fetchSystemInfo = async () => {
try {
const response = await fetch('/api/system/info')
const response = await fetch('/api/setup/system')
if (response.ok) {
const info = await response.json()
setSystemInfo(info)
const result = await response.json()
setSystemInfo(result.system_info)
}
} catch (error) {
console.error('Failed to fetch system info:', error)
@@ -90,12 +150,22 @@ export default function SetupPage() {
}
const handleStepComplete = (stepIndex: number, data: any) => {
console.log('Setup Page: Step complete', { stepIndex, data, currentConfigData: configData })
setCompletedSteps(prev => new Set([...prev, stepIndex]))
setConfigData(prev => ({ ...prev, ...data }))
setConfigData(prev => {
const newConfigData = { ...prev, ...data }
console.log('Setup Page: Updated configData', { prev, data, newConfigData })
return newConfigData
})
// Auto-advance to next step
if (stepIndex < SETUP_STEPS.length - 1) {
setCurrentStep(stepIndex + 1)
} else {
// Setup is complete, clear persisted data after a delay
setTimeout(() => {
clearPersistedData()
}, 2000)
}
}
@@ -107,17 +177,50 @@ export default function SetupPage() {
const CurrentStepComponent = SETUP_STEPS[currentStep].component
// Check if we're resuming from saved data
const isResuming = currentStep > 0 || completedSteps.size > 0 || Object.keys(configData).length > 0
return (
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="mb-8">
<h1 className="text-3xl font-bold text-gray-900 mb-2">
Welcome to BZZZ Setup
Welcome to CHORUS:agents Setup
</h1>
<p className="text-lg text-gray-600">
Let's configure your distributed AI coordination cluster in {SETUP_STEPS.length} simple steps.
Let's configure your distributed AI agent coordination cluster in {SETUP_STEPS.length} simple steps.
</p>
</div>
{/* Resume Setup Notification */}
{isResuming && (
<div className="mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4">
<div className="flex items-start justify-between">
<div className="flex items-start">
<div className="flex-shrink-0">
<svg className="h-5 w-5 text-blue-500 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div className="ml-3">
<h3 className="text-sm font-medium text-blue-800">
Setup Progress Restored
</h3>
<p className="text-sm text-blue-700 mt-1">
Your previous setup progress has been restored. You're currently on step {currentStep + 1} of {SETUP_STEPS.length}.
{completedSteps.size > 0 && ` You've completed ${completedSteps.size} step${completedSteps.size !== 1 ? 's' : ''}.`}
</p>
</div>
</div>
<button
onClick={clearPersistedData}
className="text-blue-500 hover:text-blue-700 text-sm font-medium"
>
Start Over
</button>
</div>
</div>
)}
<div className="grid grid-cols-1 lg:grid-cols-4 gap-8">
{/* Progress Sidebar */}
<div className="lg:col-span-1">