@friggframework/devtools 2.0.0--canary.398.7664c46.0 → 2.0.0--canary.400.bed3308.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/frigg-cli/.eslintrc.js +141 -0
- package/frigg-cli/__tests__/jest.config.js +102 -0
- package/frigg-cli/__tests__/unit/commands/build.test.js +483 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +418 -0
- package/frigg-cli/__tests__/unit/commands/ui.test.js +592 -0
- package/frigg-cli/__tests__/utils/command-tester.js +170 -0
- package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
- package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
- package/frigg-cli/__tests__/utils/test-setup.js +286 -0
- package/frigg-cli/build-command/index.js +15 -2
- package/frigg-cli/deploy-command/index.js +15 -2
- package/frigg-cli/generate-command/__tests__/generate-command.test.js +312 -0
- package/frigg-cli/generate-command/azure-generator.js +43 -0
- package/frigg-cli/generate-command/gcp-generator.js +47 -0
- package/frigg-cli/generate-command/index.js +350 -0
- package/frigg-cli/generate-command/terraform-generator.js +555 -0
- package/frigg-cli/index.js +66 -4
- package/frigg-cli/install-command/index.js +15 -2
- package/frigg-cli/package.json +75 -0
- package/frigg-cli/start-command/index.js +17 -2
- package/frigg-cli/ui-command/index.js +167 -0
- package/frigg-cli/utils/app-resolver.js +319 -0
- package/frigg-cli/utils/backend-path.js +38 -0
- package/frigg-cli/utils/process-manager.js +199 -0
- package/frigg-cli/utils/repo-detection.js +405 -0
- package/infrastructure/AWS-IAM-CREDENTIAL-NEEDS.md +43 -19
- package/infrastructure/IAM-POLICY-TEMPLATES.md +1 -1
- package/infrastructure/frigg-deployment-iam-stack.yaml +16 -2
- package/infrastructure/iam-generator.js +129 -6
- package/infrastructure/iam-policy-basic.json +29 -5
- package/infrastructure/iam-policy-full.json +28 -5
- package/infrastructure/serverless-template.js +209 -3
- package/infrastructure/serverless-template.test.js +12 -0
- package/management-ui/.eslintrc.js +22 -0
- package/management-ui/README.md +203 -0
- package/management-ui/components.json +21 -0
- package/management-ui/{dist/index.html → index.html} +1 -2
- package/management-ui/merge-conflict-cleaner.py +371 -0
- package/management-ui/package-lock.json +10997 -0
- package/management-ui/package.json +76 -0
- package/management-ui/postcss.config.js +6 -0
- package/management-ui/server/api/backend.js +256 -0
- package/management-ui/server/api/cli.js +315 -0
- package/management-ui/server/api/codegen.js +663 -0
- package/management-ui/server/api/connections.js +857 -0
- package/management-ui/server/api/discovery.js +185 -0
- package/management-ui/server/api/environment/index.js +1 -0
- package/management-ui/server/api/environment/router.js +378 -0
- package/management-ui/server/api/environment.js +328 -0
- package/management-ui/server/api/integrations.js +479 -0
- package/management-ui/server/api/logs.js +248 -0
- package/management-ui/server/api/monitoring.js +282 -0
- package/management-ui/server/api/open-ide.js +31 -0
- package/management-ui/server/api/project.js +553 -0
- package/management-ui/server/api/users/sessions.js +371 -0
- package/management-ui/server/api/users/simulation.js +254 -0
- package/management-ui/server/api/users.js +362 -0
- package/management-ui/server/api-contract.md +275 -0
- package/management-ui/server/index.js +428 -0
- package/management-ui/server/middleware/errorHandler.js +70 -0
- package/management-ui/server/middleware/security.js +32 -0
- package/management-ui/server/processManager.js +296 -0
- package/management-ui/server/server.js +188 -0
- package/management-ui/server/services/aws-monitor.js +413 -0
- package/management-ui/server/services/npm-registry.js +347 -0
- package/management-ui/server/services/template-engine.js +538 -0
- package/management-ui/server/utils/cliIntegration.js +220 -0
- package/management-ui/server/utils/environment/auditLogger.js +471 -0
- package/management-ui/server/utils/environment/awsParameterStore.js +264 -0
- package/management-ui/server/utils/environment/encryption.js +278 -0
- package/management-ui/server/utils/environment/envFileManager.js +286 -0
- package/management-ui/server/utils/import-commonjs.js +28 -0
- package/management-ui/server/utils/response.js +83 -0
- package/management-ui/server/websocket/handler.js +325 -0
- package/management-ui/src/App.jsx +51 -0
- package/management-ui/src/components/AppRouter.jsx +65 -0
- package/management-ui/src/components/Button.jsx +2 -0
- package/management-ui/src/components/Card.jsx +9 -0
- package/management-ui/src/components/EnvironmentCompare.jsx +400 -0
- package/management-ui/src/components/EnvironmentEditor.jsx +372 -0
- package/management-ui/src/components/EnvironmentImportExport.jsx +469 -0
- package/management-ui/src/components/EnvironmentSchema.jsx +491 -0
- package/management-ui/src/components/EnvironmentSecurity.jsx +463 -0
- package/management-ui/src/components/ErrorBoundary.jsx +73 -0
- package/management-ui/src/components/IntegrationCard.jsx +199 -0
- package/management-ui/src/components/IntegrationCardEnhanced.jsx +490 -0
- package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
- package/management-ui/src/components/IntegrationStatus.jsx +235 -0
- package/management-ui/src/components/Layout.jsx +250 -0
- package/management-ui/src/components/LoadingSpinner.jsx +45 -0
- package/management-ui/src/components/RepositoryPicker.jsx +248 -0
- package/management-ui/src/components/SessionMonitor.jsx +255 -0
- package/management-ui/src/components/StatusBadge.jsx +70 -0
- package/management-ui/src/components/UserContextSwitcher.jsx +154 -0
- package/management-ui/src/components/UserSimulation.jsx +299 -0
- package/management-ui/src/components/Welcome.jsx +434 -0
- package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +637 -0
- package/management-ui/src/components/codegen/APIModuleSelector.jsx +227 -0
- package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +247 -0
- package/management-ui/src/components/codegen/CodePreviewEditor.jsx +316 -0
- package/management-ui/src/components/codegen/DynamicModuleForm.jsx +271 -0
- package/management-ui/src/components/codegen/FormBuilder.jsx +737 -0
- package/management-ui/src/components/codegen/IntegrationGenerator.jsx +855 -0
- package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +797 -0
- package/management-ui/src/components/codegen/SchemaBuilder.jsx +303 -0
- package/management-ui/src/components/codegen/TemplateSelector.jsx +586 -0
- package/management-ui/src/components/codegen/index.js +10 -0
- package/management-ui/src/components/connections/ConnectionConfigForm.jsx +362 -0
- package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +182 -0
- package/management-ui/src/components/connections/ConnectionTester.jsx +200 -0
- package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +292 -0
- package/management-ui/src/components/connections/OAuthFlow.jsx +204 -0
- package/management-ui/src/components/connections/index.js +5 -0
- package/management-ui/src/components/index.js +21 -0
- package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +222 -0
- package/management-ui/src/components/monitoring/LambdaMetrics.jsx +169 -0
- package/management-ui/src/components/monitoring/MetricsChart.jsx +197 -0
- package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +393 -0
- package/management-ui/src/components/monitoring/SQSMetrics.jsx +246 -0
- package/management-ui/src/components/monitoring/index.js +6 -0
- package/management-ui/src/components/monitoring/monitoring.css +218 -0
- package/management-ui/src/components/theme-provider.jsx +52 -0
- package/management-ui/src/components/theme-toggle.jsx +39 -0
- package/management-ui/src/components/ui/badge.tsx +36 -0
- package/management-ui/src/components/ui/button.test.jsx +56 -0
- package/management-ui/src/components/ui/button.tsx +57 -0
- package/management-ui/src/components/ui/card.tsx +76 -0
- package/management-ui/src/components/ui/dropdown-menu.tsx +199 -0
- package/management-ui/src/components/ui/select.tsx +157 -0
- package/management-ui/src/components/ui/skeleton.jsx +15 -0
- package/management-ui/src/hooks/useFrigg.jsx +387 -0
- package/management-ui/src/hooks/useSocket.jsx +58 -0
- package/management-ui/src/index.css +194 -0
- package/management-ui/src/lib/utils.ts +6 -0
- package/management-ui/src/main.jsx +10 -0
- package/management-ui/src/pages/CodeGeneration.jsx +14 -0
- package/management-ui/src/pages/Connections.jsx +252 -0
- package/management-ui/src/pages/ConnectionsEnhanced.jsx +427 -0
- package/management-ui/src/pages/Dashboard.jsx +311 -0
- package/management-ui/src/pages/Environment.jsx +314 -0
- package/management-ui/src/pages/IntegrationConfigure.jsx +544 -0
- package/management-ui/src/pages/IntegrationDiscovery.jsx +479 -0
- package/management-ui/src/pages/IntegrationTest.jsx +494 -0
- package/management-ui/src/pages/Integrations.jsx +254 -0
- package/management-ui/src/pages/Monitoring.jsx +17 -0
- package/management-ui/src/pages/Simulation.jsx +155 -0
- package/management-ui/src/pages/Users.jsx +492 -0
- package/management-ui/src/services/api.js +41 -0
- package/management-ui/src/services/apiModuleService.js +193 -0
- package/management-ui/src/services/websocket-handlers.js +120 -0
- package/management-ui/src/test/api/project.test.js +273 -0
- package/management-ui/src/test/components/Welcome.test.jsx +378 -0
- package/management-ui/src/test/mocks/server.js +178 -0
- package/management-ui/src/test/setup.js +61 -0
- package/management-ui/src/test/utils/test-utils.jsx +134 -0
- package/management-ui/src/utils/repository.js +98 -0
- package/management-ui/src/utils/repository.test.js +118 -0
- package/management-ui/src/workflows/phase2-integration-workflows.js +884 -0
- package/management-ui/tailwind.config.js +63 -0
- package/management-ui/tsconfig.json +37 -0
- package/management-ui/tsconfig.node.json +10 -0
- package/management-ui/vite.config.js +26 -0
- package/management-ui/vitest.config.js +38 -0
- package/package.json +5 -5
- package/management-ui/dist/assets/index-CbM64Oba.js +0 -1221
- package/management-ui/dist/assets/index-CkvseXTC.css +0 -1
- /package/management-ui/{dist/assets/FriggLogo-B7Xx8ZW1.svg → src/assets/FriggLogo.svg} +0 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { motion, AnimatePresence } from 'framer-motion'
|
|
3
|
+
import { Search, Filter, Package, Code, GitBranch, ExternalLink, Download, Eye } from 'lucide-react'
|
|
4
|
+
import { RefreshCw } from 'lucide-react'
|
|
5
|
+
import { Card } from './ui/card'
|
|
6
|
+
import { Button } from './ui/button'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Visual Integration Explorer using @friggframework/ui-react components
|
|
10
|
+
* Shows available integrations, installed integrations, and code analysis
|
|
11
|
+
*/
|
|
12
|
+
export default function IntegrationExplorer({ mode = 'browse' }) {
|
|
13
|
+
const [integrations, setIntegrations] = useState([])
|
|
14
|
+
const [loading, setLoading] = useState(true)
|
|
15
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
16
|
+
const [selectedCategory, setSelectedCategory] = useState('all')
|
|
17
|
+
const [viewMode, setViewMode] = useState('grid') // 'grid', 'list', 'code'
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
fetchIntegrations()
|
|
21
|
+
}, [])
|
|
22
|
+
|
|
23
|
+
const fetchIntegrations = async () => {
|
|
24
|
+
try {
|
|
25
|
+
setLoading(true)
|
|
26
|
+
const response = await fetch('/api/integrations')
|
|
27
|
+
const data = await response.json()
|
|
28
|
+
|
|
29
|
+
// Combine installed integrations and available API modules
|
|
30
|
+
const allIntegrations = [
|
|
31
|
+
...data.integrations.map(int => ({ ...int, source: 'installed' })),
|
|
32
|
+
...data.availableApiModules.map(mod => ({ ...mod, source: 'available' }))
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
setIntegrations(allIntegrations)
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('Failed to fetch integrations:', error)
|
|
38
|
+
} finally {
|
|
39
|
+
setLoading(false)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const filteredIntegrations = integrations.filter(integration => {
|
|
44
|
+
const matchesSearch = integration.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
45
|
+
integration.displayName?.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
|
46
|
+
integration.description?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
47
|
+
|
|
48
|
+
const matchesCategory = selectedCategory === 'all' ||
|
|
49
|
+
integration.category?.toLowerCase() === selectedCategory.toLowerCase()
|
|
50
|
+
|
|
51
|
+
return matchesSearch && matchesCategory
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const categories = ['all', ...new Set(integrations.map(i => i.category).filter(Boolean))]
|
|
55
|
+
|
|
56
|
+
const handleInstall = async (integration) => {
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch('/api/integrations/install', {
|
|
59
|
+
method: 'POST',
|
|
60
|
+
headers: { 'Content-Type': 'application/json' },
|
|
61
|
+
body: JSON.stringify({ packageName: integration.name })
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
if (response.ok) {
|
|
65
|
+
await fetchIntegrations() // Refresh the list
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Failed to install integration:', error)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const handleViewCode = (integration) => {
|
|
73
|
+
// Open code view for this integration
|
|
74
|
+
setViewMode('code')
|
|
75
|
+
// In a real implementation, you'd fetch and display the integration's source code
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (loading) {
|
|
79
|
+
return (
|
|
80
|
+
<div className="flex items-center justify-center py-12">
|
|
81
|
+
<RefreshCw className="w-8 h-8 animate-spin text-primary" />
|
|
82
|
+
<span className="ml-3">Loading integrations...</span>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="space-y-6">
|
|
89
|
+
{/* Header with Search and Filters */}
|
|
90
|
+
<div className="flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between">
|
|
91
|
+
<div className="flex items-center gap-4">
|
|
92
|
+
<h3 className="text-xl font-semibold">Integration Explorer</h3>
|
|
93
|
+
<div className="flex gap-2">
|
|
94
|
+
<Button
|
|
95
|
+
variant={viewMode === 'grid' ? 'default' : 'outline'}
|
|
96
|
+
size="sm"
|
|
97
|
+
onClick={() => setViewMode('grid')}
|
|
98
|
+
>
|
|
99
|
+
Grid
|
|
100
|
+
</Button>
|
|
101
|
+
<Button
|
|
102
|
+
variant={viewMode === 'list' ? 'default' : 'outline'}
|
|
103
|
+
size="sm"
|
|
104
|
+
onClick={() => setViewMode('list')}
|
|
105
|
+
>
|
|
106
|
+
List
|
|
107
|
+
</Button>
|
|
108
|
+
<Button
|
|
109
|
+
variant={viewMode === 'code' ? 'default' : 'outline'}
|
|
110
|
+
size="sm"
|
|
111
|
+
onClick={() => setViewMode('code')}
|
|
112
|
+
>
|
|
113
|
+
Code
|
|
114
|
+
</Button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div className="flex gap-3">
|
|
119
|
+
{/* Search */}
|
|
120
|
+
<div className="relative">
|
|
121
|
+
<Search className="w-4 h-4 absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground" />
|
|
122
|
+
<input
|
|
123
|
+
type="text"
|
|
124
|
+
placeholder="Search integrations..."
|
|
125
|
+
value={searchTerm}
|
|
126
|
+
onChange={(e) => setSearchTerm(e.target.value)}
|
|
127
|
+
className="pl-10 pr-4 py-2 border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50"
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{/* Category Filter */}
|
|
132
|
+
<select
|
|
133
|
+
value={selectedCategory}
|
|
134
|
+
onChange={(e) => setSelectedCategory(e.target.value)}
|
|
135
|
+
className="px-3 py-2 border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50"
|
|
136
|
+
>
|
|
137
|
+
{categories.map(category => (
|
|
138
|
+
<option key={category} value={category}>
|
|
139
|
+
{category === 'all' ? 'All Categories' : category}
|
|
140
|
+
</option>
|
|
141
|
+
))}
|
|
142
|
+
</select>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{/* Results Summary */}
|
|
147
|
+
<div className="text-sm text-muted-foreground">
|
|
148
|
+
Found {filteredIntegrations.length} integrations
|
|
149
|
+
{searchTerm && ` matching "${searchTerm}"`}
|
|
150
|
+
{selectedCategory !== 'all' && ` in ${selectedCategory}`}
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
{/* Integration Views */}
|
|
154
|
+
<AnimatePresence mode="wait">
|
|
155
|
+
{viewMode === 'grid' && (
|
|
156
|
+
<motion.div
|
|
157
|
+
key="grid"
|
|
158
|
+
initial={{ opacity: 0, y: 20 }}
|
|
159
|
+
animate={{ opacity: 1, y: 0 }}
|
|
160
|
+
exit={{ opacity: 0, y: -20 }}
|
|
161
|
+
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"
|
|
162
|
+
>
|
|
163
|
+
{filteredIntegrations.map((integration, index) => (
|
|
164
|
+
<motion.div
|
|
165
|
+
key={integration.name}
|
|
166
|
+
initial={{ opacity: 0, y: 20 }}
|
|
167
|
+
animate={{ opacity: 1, y: 0 }}
|
|
168
|
+
transition={{ delay: index * 0.05 }}
|
|
169
|
+
>
|
|
170
|
+
<Card className="p-4 hover:shadow-lg transition-all">
|
|
171
|
+
<div className="flex items-center justify-between">
|
|
172
|
+
<div className="flex items-center gap-3">
|
|
173
|
+
<div className={`w-3 h-3 rounded-full ${
|
|
174
|
+
integration.source === 'installed' ? 'bg-green-500' : 'bg-gray-400'
|
|
175
|
+
}`} />
|
|
176
|
+
<div>
|
|
177
|
+
<h4 className="font-semibold">{integration.displayName || integration.name}</h4>
|
|
178
|
+
<p className="text-sm text-muted-foreground">{integration.description}</p>
|
|
179
|
+
<div className="flex items-center gap-2 mt-1">
|
|
180
|
+
<span className="text-xs bg-primary/10 text-primary px-2 py-1 rounded">
|
|
181
|
+
{integration.category}
|
|
182
|
+
</span>
|
|
183
|
+
<span className="text-xs text-muted-foreground">
|
|
184
|
+
{integration.source === 'installed' ? 'Installed' : 'Available'}
|
|
185
|
+
</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div className="flex gap-2">
|
|
191
|
+
<Button size="sm" variant="outline" onClick={() => handleViewCode(integration)}>
|
|
192
|
+
<Code className="w-4 h-4" />
|
|
193
|
+
</Button>
|
|
194
|
+
{integration.source === 'available' && (
|
|
195
|
+
<Button size="sm" onClick={() => handleInstall(integration)}>
|
|
196
|
+
<Download className="w-4 h-4" />
|
|
197
|
+
</Button>
|
|
198
|
+
)}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</Card>
|
|
202
|
+
</motion.div>
|
|
203
|
+
))}
|
|
204
|
+
</motion.div>
|
|
205
|
+
)}
|
|
206
|
+
|
|
207
|
+
{viewMode === 'list' && (
|
|
208
|
+
<motion.div
|
|
209
|
+
key="list"
|
|
210
|
+
initial={{ opacity: 0, y: 20 }}
|
|
211
|
+
animate={{ opacity: 1, y: 0 }}
|
|
212
|
+
exit={{ opacity: 0, y: -20 }}
|
|
213
|
+
className="space-y-3"
|
|
214
|
+
>
|
|
215
|
+
{filteredIntegrations.map((integration, index) => (
|
|
216
|
+
<motion.div
|
|
217
|
+
key={integration.name}
|
|
218
|
+
initial={{ opacity: 0, x: -20 }}
|
|
219
|
+
animate={{ opacity: 1, x: 0 }}
|
|
220
|
+
transition={{ delay: index * 0.03 }}
|
|
221
|
+
>
|
|
222
|
+
<Card className="p-4 hover:shadow-md transition-all">
|
|
223
|
+
<div className="flex items-center justify-between">
|
|
224
|
+
<div className="flex items-center gap-4">
|
|
225
|
+
<div className={`w-3 h-3 rounded-full ${
|
|
226
|
+
integration.source === 'installed' ? 'bg-green-500' : 'bg-gray-400'
|
|
227
|
+
}`} />
|
|
228
|
+
<div>
|
|
229
|
+
<h4 className="font-semibold">{integration.displayName || integration.name}</h4>
|
|
230
|
+
<p className="text-sm text-muted-foreground">{integration.description}</p>
|
|
231
|
+
<div className="flex items-center gap-2 mt-1">
|
|
232
|
+
<span className="text-xs bg-primary/10 text-primary px-2 py-1 rounded">
|
|
233
|
+
{integration.category}
|
|
234
|
+
</span>
|
|
235
|
+
<span className="text-xs text-muted-foreground">
|
|
236
|
+
{integration.source === 'installed' ? 'Installed' : 'Available'}
|
|
237
|
+
</span>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<div className="flex gap-2">
|
|
243
|
+
<Button size="sm" variant="outline" onClick={() => handleViewCode(integration)}>
|
|
244
|
+
<Eye className="w-4 h-4" />
|
|
245
|
+
View
|
|
246
|
+
</Button>
|
|
247
|
+
{integration.source === 'available' && (
|
|
248
|
+
<Button size="sm" onClick={() => handleInstall(integration)}>
|
|
249
|
+
<Download className="w-4 h-4" />
|
|
250
|
+
Install
|
|
251
|
+
</Button>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</Card>
|
|
256
|
+
</motion.div>
|
|
257
|
+
))}
|
|
258
|
+
</motion.div>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{viewMode === 'code' && (
|
|
262
|
+
<motion.div
|
|
263
|
+
key="code"
|
|
264
|
+
initial={{ opacity: 0, y: 20 }}
|
|
265
|
+
animate={{ opacity: 1, y: 0 }}
|
|
266
|
+
exit={{ opacity: 0, y: -20 }}
|
|
267
|
+
>
|
|
268
|
+
<CodeAnalysisView integrations={filteredIntegrations} />
|
|
269
|
+
</motion.div>
|
|
270
|
+
)}
|
|
271
|
+
</AnimatePresence>
|
|
272
|
+
|
|
273
|
+
{filteredIntegrations.length === 0 && (
|
|
274
|
+
<div className="text-center py-12">
|
|
275
|
+
<Package className="w-16 h-16 mx-auto text-muted-foreground mb-4" />
|
|
276
|
+
<h3 className="text-lg font-semibold mb-2">No integrations found</h3>
|
|
277
|
+
<p className="text-muted-foreground">
|
|
278
|
+
Try adjusting your search terms or category filter
|
|
279
|
+
</p>
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Code Analysis View showing integration structure and relationships
|
|
288
|
+
*/
|
|
289
|
+
function CodeAnalysisView({ integrations }) {
|
|
290
|
+
const installedIntegrations = integrations.filter(i => i.source === 'installed')
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<div className="space-y-6">
|
|
294
|
+
<div className="flex items-center gap-2">
|
|
295
|
+
<GitBranch className="w-5 h-5" />
|
|
296
|
+
<h4 className="text-lg font-semibold">Integration Code Structure</h4>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
{installedIntegrations.length === 0 ? (
|
|
300
|
+
<Card className="p-8 text-center">
|
|
301
|
+
<Code className="w-12 h-12 mx-auto text-muted-foreground mb-4" />
|
|
302
|
+
<h3 className="font-semibold mb-2">No Installed Integrations</h3>
|
|
303
|
+
<p className="text-muted-foreground">Install some integrations to analyze their code structure</p>
|
|
304
|
+
</Card>
|
|
305
|
+
) : (
|
|
306
|
+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
307
|
+
{installedIntegrations.map(integration => (
|
|
308
|
+
<Card key={integration.name} className="p-6">
|
|
309
|
+
<div className="flex items-center gap-3 mb-4">
|
|
310
|
+
<div className="w-8 h-8 bg-primary/10 rounded-lg flex items-center justify-center">
|
|
311
|
+
<Code className="w-4 h-4 text-primary" />
|
|
312
|
+
</div>
|
|
313
|
+
<div>
|
|
314
|
+
<h4 className="font-semibold">{integration.displayName}</h4>
|
|
315
|
+
<p className="text-sm text-muted-foreground">{integration.className}</p>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
<div className="space-y-3">
|
|
320
|
+
{integration.constructor && (
|
|
321
|
+
<div>
|
|
322
|
+
<h5 className="font-medium text-sm mb-2">Constructor Properties</h5>
|
|
323
|
+
<div className="space-y-1 text-sm">
|
|
324
|
+
<div className="flex justify-between">
|
|
325
|
+
<span>Has Config:</span>
|
|
326
|
+
<span className={integration.constructor.hasConfig ? 'text-green-600' : 'text-gray-500'}>
|
|
327
|
+
{integration.constructor.hasConfig ? 'Yes' : 'No'}
|
|
328
|
+
</span>
|
|
329
|
+
</div>
|
|
330
|
+
<div className="flex justify-between">
|
|
331
|
+
<span>Has Options:</span>
|
|
332
|
+
<span className={integration.constructor.hasOptions ? 'text-green-600' : 'text-gray-500'}>
|
|
333
|
+
{integration.constructor.hasOptions ? 'Yes' : 'No'}
|
|
334
|
+
</span>
|
|
335
|
+
</div>
|
|
336
|
+
<div className="flex justify-between">
|
|
337
|
+
<span>Has Modules:</span>
|
|
338
|
+
<span className={integration.constructor.hasModules ? 'text-green-600' : 'text-gray-500'}>
|
|
339
|
+
{integration.constructor.hasModules ? 'Yes' : 'No'}
|
|
340
|
+
</span>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
)}
|
|
345
|
+
|
|
346
|
+
{integration.apiModules && integration.apiModules.length > 0 && (
|
|
347
|
+
<div>
|
|
348
|
+
<h5 className="font-medium text-sm mb-2">API Modules</h5>
|
|
349
|
+
<div className="space-y-1">
|
|
350
|
+
{integration.apiModules.map(module => (
|
|
351
|
+
<div key={module.name} className="text-xs bg-gray-50 p-2 rounded">
|
|
352
|
+
<div className="font-medium">{module.name}</div>
|
|
353
|
+
<div className="text-muted-foreground">{module.description}</div>
|
|
354
|
+
</div>
|
|
355
|
+
))}
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
)}
|
|
359
|
+
|
|
360
|
+
{integration.events && integration.events.length > 0 && (
|
|
361
|
+
<div>
|
|
362
|
+
<h5 className="font-medium text-sm mb-2">Events</h5>
|
|
363
|
+
<div className="flex flex-wrap gap-1">
|
|
364
|
+
{integration.events.map(event => (
|
|
365
|
+
<span key={event} className="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">
|
|
366
|
+
{event}
|
|
367
|
+
</span>
|
|
368
|
+
))}
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
)}
|
|
372
|
+
</div>
|
|
373
|
+
</Card>
|
|
374
|
+
))}
|
|
375
|
+
</div>
|
|
376
|
+
)}
|
|
377
|
+
</div>
|
|
378
|
+
)
|
|
379
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { CheckCircle, AlertCircle, Clock, Activity, RefreshCw, Zap, Shield, AlertTriangle } from 'lucide-react'
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from './ui/card'
|
|
4
|
+
import { Button } from './ui/button'
|
|
5
|
+
import LoadingSpinner from './LoadingSpinner'
|
|
6
|
+
import { cn } from '../lib/utils'
|
|
7
|
+
import api from '../services/api'
|
|
8
|
+
import { useSocket } from '../hooks/useSocket'
|
|
9
|
+
|
|
10
|
+
const IntegrationStatus = ({ integrationName, className }) => {
|
|
11
|
+
const { on } = useSocket()
|
|
12
|
+
const [status, setStatus] = useState(null)
|
|
13
|
+
const [loading, setLoading] = useState(true)
|
|
14
|
+
const [refreshing, setRefreshing] = useState(false)
|
|
15
|
+
const [metrics, setMetrics] = useState(null)
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
fetchStatus()
|
|
19
|
+
// Subscribe to real-time updates
|
|
20
|
+
const unsubscribeHealth = on('integration:health:update', (data) => {
|
|
21
|
+
if (data.packageName === integrationName) {
|
|
22
|
+
setStatus(prevStatus => ({
|
|
23
|
+
...prevStatus,
|
|
24
|
+
health: data.health,
|
|
25
|
+
lastChecked: new Date().toISOString()
|
|
26
|
+
}))
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const unsubscribeMetrics = on('integration:metrics:update', (data) => {
|
|
31
|
+
if (data.packageName === integrationName) {
|
|
32
|
+
setMetrics(data.metrics)
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Poll for updates every 30 seconds
|
|
37
|
+
const interval = setInterval(fetchStatus, 30000)
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
unsubscribeHealth && unsubscribeHealth()
|
|
41
|
+
unsubscribeMetrics && unsubscribeMetrics()
|
|
42
|
+
clearInterval(interval)
|
|
43
|
+
}
|
|
44
|
+
}, [integrationName, on])
|
|
45
|
+
|
|
46
|
+
const fetchStatus = async () => {
|
|
47
|
+
try {
|
|
48
|
+
setLoading(true)
|
|
49
|
+
const [healthRes, metricsRes] = await Promise.all([
|
|
50
|
+
api.get(`/api/discovery/health/${integrationName}`),
|
|
51
|
+
api.get(`/api/integrations/${integrationName}/metrics`)
|
|
52
|
+
])
|
|
53
|
+
|
|
54
|
+
setStatus(healthRes.data.data)
|
|
55
|
+
setMetrics(metricsRes.data.metrics)
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.error('Failed to fetch integration status:', err)
|
|
58
|
+
setStatus({
|
|
59
|
+
installed: false,
|
|
60
|
+
available: false,
|
|
61
|
+
error: 'Failed to fetch status'
|
|
62
|
+
})
|
|
63
|
+
} finally {
|
|
64
|
+
setLoading(false)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleRefresh = async () => {
|
|
69
|
+
setRefreshing(true)
|
|
70
|
+
await fetchStatus()
|
|
71
|
+
setRefreshing(false)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const getStatusIcon = () => {
|
|
75
|
+
if (!status?.installed) return <AlertCircle className="text-gray-400" />
|
|
76
|
+
if (status.error) return <AlertCircle className="text-red-500" />
|
|
77
|
+
if (status.updateAvailable) return <AlertTriangle className="text-yellow-500" />
|
|
78
|
+
return <CheckCircle className="text-green-500" />
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const getStatusText = () => {
|
|
82
|
+
if (!status?.installed) return 'Not Installed'
|
|
83
|
+
if (status.error) return 'Error'
|
|
84
|
+
if (status.updateAvailable) return 'Update Available'
|
|
85
|
+
return 'Healthy'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const getStatusColor = () => {
|
|
89
|
+
if (!status?.installed) return 'text-gray-500'
|
|
90
|
+
if (status.error) return 'text-red-500'
|
|
91
|
+
if (status.updateAvailable) return 'text-yellow-600'
|
|
92
|
+
return 'text-green-600'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (loading && !status) {
|
|
96
|
+
return (
|
|
97
|
+
<Card className={className}>
|
|
98
|
+
<CardContent className="p-6 flex items-center justify-center">
|
|
99
|
+
<LoadingSpinner size="sm" />
|
|
100
|
+
</CardContent>
|
|
101
|
+
</Card>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<Card className={className}>
|
|
107
|
+
<CardHeader className="pb-3">
|
|
108
|
+
<CardTitle className="flex items-center justify-between">
|
|
109
|
+
<span className="flex items-center">
|
|
110
|
+
<Activity size={20} className="mr-2" />
|
|
111
|
+
Integration Status
|
|
112
|
+
</span>
|
|
113
|
+
<Button
|
|
114
|
+
size="sm"
|
|
115
|
+
variant="ghost"
|
|
116
|
+
onClick={handleRefresh}
|
|
117
|
+
disabled={refreshing}
|
|
118
|
+
>
|
|
119
|
+
<RefreshCw size={14} className={cn(refreshing && "animate-spin")} />
|
|
120
|
+
</Button>
|
|
121
|
+
</CardTitle>
|
|
122
|
+
</CardHeader>
|
|
123
|
+
<CardContent className="space-y-4">
|
|
124
|
+
{/* Overall Status */}
|
|
125
|
+
<div className="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
|
126
|
+
<div className="flex items-center">
|
|
127
|
+
{getStatusIcon()}
|
|
128
|
+
<div className="ml-3">
|
|
129
|
+
<p className={cn("font-medium", getStatusColor())}>
|
|
130
|
+
{getStatusText()}
|
|
131
|
+
</p>
|
|
132
|
+
{status?.lastChecked && (
|
|
133
|
+
<p className="text-xs text-gray-500">
|
|
134
|
+
Last checked: {new Date(status.lastChecked).toLocaleTimeString()}
|
|
135
|
+
</p>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
{status?.installed && (
|
|
140
|
+
<div className="text-right">
|
|
141
|
+
<p className="text-sm font-medium text-gray-700">
|
|
142
|
+
v{status.version}
|
|
143
|
+
</p>
|
|
144
|
+
{status.updateAvailable && (
|
|
145
|
+
<p className="text-xs text-blue-600">
|
|
146
|
+
v{status.latestVersion} available
|
|
147
|
+
</p>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
{/* Connection Metrics */}
|
|
154
|
+
{metrics && (
|
|
155
|
+
<div className="grid grid-cols-2 gap-3">
|
|
156
|
+
<div className="p-3 bg-blue-50 rounded-lg">
|
|
157
|
+
<div className="flex items-center justify-between">
|
|
158
|
+
<Zap size={16} className="text-blue-500" />
|
|
159
|
+
<span className="text-2xl font-bold text-blue-700">
|
|
160
|
+
{metrics.activeConnections || 0}
|
|
161
|
+
</span>
|
|
162
|
+
</div>
|
|
163
|
+
<p className="text-xs text-blue-600 mt-1">Active Connections</p>
|
|
164
|
+
</div>
|
|
165
|
+
<div className="p-3 bg-green-50 rounded-lg">
|
|
166
|
+
<div className="flex items-center justify-between">
|
|
167
|
+
<Activity size={16} className="text-green-500" />
|
|
168
|
+
<span className="text-2xl font-bold text-green-700">
|
|
169
|
+
{metrics.requestsToday || 0}
|
|
170
|
+
</span>
|
|
171
|
+
</div>
|
|
172
|
+
<p className="text-xs text-green-600 mt-1">Requests Today</p>
|
|
173
|
+
</div>
|
|
174
|
+
<div className="p-3 bg-purple-50 rounded-lg">
|
|
175
|
+
<div className="flex items-center justify-between">
|
|
176
|
+
<Clock size={16} className="text-purple-500" />
|
|
177
|
+
<span className="text-lg font-bold text-purple-700">
|
|
178
|
+
{metrics.avgResponseTime || 0}ms
|
|
179
|
+
</span>
|
|
180
|
+
</div>
|
|
181
|
+
<p className="text-xs text-purple-600 mt-1">Avg Response Time</p>
|
|
182
|
+
</div>
|
|
183
|
+
<div className="p-3 bg-orange-50 rounded-lg">
|
|
184
|
+
<div className="flex items-center justify-between">
|
|
185
|
+
<Shield size={16} className="text-orange-500" />
|
|
186
|
+
<span className="text-lg font-bold text-orange-700">
|
|
187
|
+
{metrics.successRate || 100}%
|
|
188
|
+
</span>
|
|
189
|
+
</div>
|
|
190
|
+
<p className="text-xs text-orange-600 mt-1">Success Rate</p>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
)}
|
|
194
|
+
|
|
195
|
+
{/* Recent Events */}
|
|
196
|
+
{metrics?.recentEvents && metrics.recentEvents.length > 0 && (
|
|
197
|
+
<div>
|
|
198
|
+
<h4 className="text-sm font-medium text-gray-700 mb-2">Recent Events</h4>
|
|
199
|
+
<div className="space-y-1">
|
|
200
|
+
{metrics.recentEvents.slice(0, 3).map((event, index) => (
|
|
201
|
+
<div key={index} className="flex items-center text-xs">
|
|
202
|
+
<span className={cn(
|
|
203
|
+
"w-2 h-2 rounded-full mr-2",
|
|
204
|
+
event.type === 'success' && "bg-green-500",
|
|
205
|
+
event.type === 'error' && "bg-red-500",
|
|
206
|
+
event.type === 'warning' && "bg-yellow-500"
|
|
207
|
+
)} />
|
|
208
|
+
<span className="text-gray-600 flex-1">{event.message}</span>
|
|
209
|
+
<span className="text-gray-400">
|
|
210
|
+
{new Date(event.timestamp).toLocaleTimeString()}
|
|
211
|
+
</span>
|
|
212
|
+
</div>
|
|
213
|
+
))}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
|
|
218
|
+
{/* Error Details */}
|
|
219
|
+
{status?.error && (
|
|
220
|
+
<div className="p-3 bg-red-50 rounded-lg">
|
|
221
|
+
<div className="flex items-start">
|
|
222
|
+
<AlertCircle size={16} className="text-red-500 mr-2 mt-0.5" />
|
|
223
|
+
<div>
|
|
224
|
+
<p className="text-sm font-medium text-red-800">Error Details</p>
|
|
225
|
+
<p className="text-xs text-red-600 mt-1">{status.error}</p>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
)}
|
|
230
|
+
</CardContent>
|
|
231
|
+
</Card>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export default IntegrationStatus
|