Complete Script Generator feature including: Backend: - ScriptCategory, ScriptTemplate, ScriptGeneration models - ScriptTemplateEngine with substitution, filters, sanitization - CRUD + share API endpoints with permission checks - Integration tests for permissions and sharing - Migration 057 with AD User Management seed templates Frontend — Script Library: - Browse templates with category tabs and search - Configure pane with parameter form and script generation - Script preview with live substitution and copy/download - scriptGeneratorStore Zustand store Frontend — Template Editor: - Full CRUD form with metadata, script body (Monaco Editor), parameters - ParameterSchemaBuilder with visual builder + JSON toggle - ScriptManagePage with routing and nav link Frontend — Parameter Detector: - Client-side PowerShell parameter detection engine - Detects script-level param() blocks and variable assignments - Type inference from PS type annotations and value patterns - ParameterDetectorStepper one-by-one review UI with accept/skip Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { useState } from 'react'
|
|
import { ScriptTemplateListView } from '@/components/script-editor/ScriptTemplateListView'
|
|
import { ScriptTemplateEditor } from '@/components/script-editor/ScriptTemplateEditor'
|
|
|
|
export default function ScriptManagePage() {
|
|
const [mode, setMode] = useState<'list' | 'edit'>('list')
|
|
const [editingId, setEditingId] = useState<string | null>(null)
|
|
|
|
const handleEdit = (id: string) => {
|
|
setEditingId(id)
|
|
setMode('edit')
|
|
}
|
|
|
|
const handleCreate = () => {
|
|
setEditingId(null)
|
|
setMode('edit')
|
|
}
|
|
|
|
const handleBack = () => {
|
|
setEditingId(null)
|
|
setMode('list')
|
|
}
|
|
|
|
const handleSaved = () => {
|
|
setEditingId(null)
|
|
setMode('list')
|
|
}
|
|
|
|
return (
|
|
<div className="h-full overflow-y-auto">
|
|
<div className="p-6 max-w-5xl mx-auto">
|
|
{mode === 'list' ? (
|
|
<ScriptTemplateListView onEdit={handleEdit} onCreate={handleCreate} />
|
|
) : (
|
|
<ScriptTemplateEditor
|
|
templateId={editingId}
|
|
onBack={handleBack}
|
|
onSaved={handleSaved}
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|