feat: add ScriptManagePage with routing and 'Manage Templates' link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { Terminal } from 'lucide-react'
|
import { Link } from 'react-router-dom'
|
||||||
|
import { Terminal, Settings } from 'lucide-react'
|
||||||
import { useScriptGeneratorStore } from '@/store/scriptGeneratorStore'
|
import { useScriptGeneratorStore } from '@/store/scriptGeneratorStore'
|
||||||
import { usePermissions } from '@/hooks/usePermissions'
|
import { usePermissions } from '@/hooks/usePermissions'
|
||||||
import { ScriptFilterBar } from '@/components/scripts/ScriptFilterBar'
|
import { ScriptFilterBar } from '@/components/scripts/ScriptFilterBar'
|
||||||
@@ -49,6 +50,15 @@ export default function ScriptLibraryPage() {
|
|||||||
<p className="text-sm text-muted-foreground mt-1">
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
Browse PowerShell templates, fill in parameters, and generate ready-to-run scripts.
|
Browse PowerShell templates, fill in parameters, and generate ready-to-run scripts.
|
||||||
</p>
|
</p>
|
||||||
|
{isEngineer && (
|
||||||
|
<Link
|
||||||
|
to="/scripts/manage"
|
||||||
|
className="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mt-2"
|
||||||
|
>
|
||||||
|
<Settings size={12} />
|
||||||
|
Manage Templates
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Two-column layout */}
|
{/* Two-column layout */}
|
||||||
|
|||||||
42
frontend/src/pages/ScriptManagePage.tsx
Normal file
42
frontend/src/pages/ScriptManagePage.tsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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="p-6 max-w-5xl mx-auto">
|
||||||
|
{mode === 'list' ? (
|
||||||
|
<ScriptTemplateListView onEdit={handleEdit} onCreate={handleCreate} />
|
||||||
|
) : (
|
||||||
|
<ScriptTemplateEditor
|
||||||
|
templateId={editingId}
|
||||||
|
onBack={handleBack}
|
||||||
|
onSaved={handleSaved}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@ const MyAnalyticsPage = lazy(() => import('@/pages/MyAnalyticsPage'))
|
|||||||
const FeedbackPage = lazy(() => import('@/pages/FeedbackPage'))
|
const FeedbackPage = lazy(() => import('@/pages/FeedbackPage'))
|
||||||
const StepLibraryPage = lazy(() => import('@/pages/StepLibraryPage'))
|
const StepLibraryPage = lazy(() => import('@/pages/StepLibraryPage'))
|
||||||
const ScriptLibraryPage = lazy(() => import('@/pages/ScriptLibraryPage'))
|
const ScriptLibraryPage = lazy(() => import('@/pages/ScriptLibraryPage'))
|
||||||
|
const ScriptManagePage = lazy(() => import('@/pages/ScriptManagePage'))
|
||||||
const AssistantChatPage = lazy(() => import('@/pages/AssistantChatPage'))
|
const AssistantChatPage = lazy(() => import('@/pages/AssistantChatPage'))
|
||||||
const KBAcceleratorPage = lazy(() => import('@/pages/KBAcceleratorPage'))
|
const KBAcceleratorPage = lazy(() => import('@/pages/KBAcceleratorPage'))
|
||||||
const GuidesHubPage = lazy(() => import('@/pages/GuidesHubPage'))
|
const GuidesHubPage = lazy(() => import('@/pages/GuidesHubPage'))
|
||||||
@@ -162,6 +163,7 @@ export const router = sentryCreateBrowserRouter([
|
|||||||
{ path: 'feedback', element: page(FeedbackPage) },
|
{ path: 'feedback', element: page(FeedbackPage) },
|
||||||
{ path: 'step-library', element: page(StepLibraryPage) },
|
{ path: 'step-library', element: page(StepLibraryPage) },
|
||||||
{ path: 'scripts', element: page(ScriptLibraryPage) },
|
{ path: 'scripts', element: page(ScriptLibraryPage) },
|
||||||
|
{ path: 'scripts/manage', element: page(ScriptManagePage) },
|
||||||
{ path: 'kb-accelerator', element: page(KBAcceleratorPage) },
|
{ path: 'kb-accelerator', element: page(KBAcceleratorPage) },
|
||||||
{ path: 'assistant', element: page(AssistantChatPage) },
|
{ path: 'assistant', element: page(AssistantChatPage) },
|
||||||
{ path: 'guides', element: page(GuidesHubPage) },
|
{ path: 'guides', element: page(GuidesHubPage) },
|
||||||
|
|||||||
Reference in New Issue
Block a user