@friggframework/devtools 2.0.0-next.3 → 2.0.0-next.30
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 +54 -0
- package/frigg-cli/deploy-command/index.js +36 -0
- 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 +332 -0
- package/frigg-cli/generate-command/terraform-generator.js +555 -0
- package/frigg-cli/generate-iam-command.js +115 -0
- package/frigg-cli/index.js +47 -1
- package/frigg-cli/index.test.js +1 -4
- package/frigg-cli/init-command/backend-first-handler.js +756 -0
- package/frigg-cli/init-command/index.js +93 -0
- package/frigg-cli/init-command/template-handler.js +143 -0
- package/frigg-cli/install-command/index.js +1 -4
- package/frigg-cli/package.json +51 -0
- package/frigg-cli/start-command/index.js +24 -4
- package/frigg-cli/test/init-command.test.js +180 -0
- package/frigg-cli/test/npm-registry.test.js +319 -0
- package/frigg-cli/ui-command/index.js +154 -0
- package/frigg-cli/utils/app-resolver.js +319 -0
- package/frigg-cli/utils/backend-path.js +16 -17
- package/frigg-cli/utils/npm-registry.js +167 -0
- package/frigg-cli/utils/process-manager.js +199 -0
- package/frigg-cli/utils/repo-detection.js +405 -0
- package/infrastructure/AWS-DISCOVERY-TROUBLESHOOTING.md +245 -0
- package/infrastructure/AWS-IAM-CREDENTIAL-NEEDS.md +596 -0
- package/infrastructure/DEPLOYMENT-INSTRUCTIONS.md +268 -0
- package/infrastructure/GENERATE-IAM-DOCS.md +253 -0
- package/infrastructure/IAM-POLICY-TEMPLATES.md +176 -0
- package/infrastructure/README-TESTING.md +332 -0
- package/infrastructure/README.md +421 -0
- package/infrastructure/WEBSOCKET-CONFIGURATION.md +105 -0
- package/infrastructure/__tests__/fixtures/mock-aws-resources.js +391 -0
- package/infrastructure/__tests__/helpers/test-utils.js +277 -0
- package/infrastructure/aws-discovery.js +568 -0
- package/infrastructure/aws-discovery.test.js +373 -0
- package/infrastructure/build-time-discovery.js +206 -0
- package/infrastructure/build-time-discovery.test.js +375 -0
- package/infrastructure/create-frigg-infrastructure.js +3 -5
- package/infrastructure/frigg-deployment-iam-stack.yaml +379 -0
- package/infrastructure/iam-generator.js +687 -0
- package/infrastructure/iam-generator.test.js +169 -0
- package/infrastructure/iam-policy-basic.json +212 -0
- package/infrastructure/iam-policy-full.json +282 -0
- package/infrastructure/integration.test.js +383 -0
- package/infrastructure/run-discovery.js +110 -0
- package/infrastructure/serverless-template.js +923 -113
- package/infrastructure/serverless-template.test.js +541 -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/docs/phase2-integration-guide.md +320 -0
- package/management-ui/index.html +13 -0
- package/management-ui/package-lock.json +16517 -0
- package/management-ui/package.json +76 -0
- package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +302 -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 +876 -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 +1029 -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 +873 -0
- package/management-ui/server/middleware/errorHandler.js +93 -0
- package/management-ui/server/middleware/security.js +32 -0
- package/management-ui/server/processManager.js +296 -0
- package/management-ui/server/server.js +346 -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 +109 -0
- package/management-ui/src/assets/FriggLogo.svg +1 -0
- package/management-ui/src/components/AppRouter.jsx +65 -0
- package/management-ui/src/components/Button.jsx +70 -0
- package/management-ui/src/components/Card.jsx +97 -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 +481 -0
- package/management-ui/src/components/IntegrationCardEnhanced.jsx +770 -0
- package/management-ui/src/components/IntegrationExplorer.jsx +379 -0
- package/management-ui/src/components/IntegrationStatus.jsx +336 -0
- package/management-ui/src/components/Layout.jsx +716 -0
- package/management-ui/src/components/LoadingSpinner.jsx +113 -0
- package/management-ui/src/components/RepositoryPicker.jsx +248 -0
- package/management-ui/src/components/SessionMonitor.jsx +350 -0
- package/management-ui/src/components/StatusBadge.jsx +208 -0
- package/management-ui/src/components/UserContextSwitcher.jsx +212 -0
- package/management-ui/src/components/UserSimulation.jsx +327 -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 +601 -0
- package/management-ui/src/hooks/useSocket.jsx +58 -0
- package/management-ui/src/index.css +193 -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 +633 -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 +669 -0
- package/management-ui/src/pages/IntegrationDiscovery.jsx +567 -0
- package/management-ui/src/pages/IntegrationTest.jsx +742 -0
- package/management-ui/src/pages/Integrations.jsx +253 -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 +16 -9
- package/infrastructure/app-handler-helpers.js +0 -57
- package/infrastructure/backend-utils.js +0 -90
- package/infrastructure/routers/auth.js +0 -26
- package/infrastructure/routers/integration-defined-routers.js +0 -37
- package/infrastructure/routers/middleware/loadUser.js +0 -15
- package/infrastructure/routers/middleware/requireLoggedInUser.js +0 -12
- package/infrastructure/routers/user.js +0 -41
- package/infrastructure/routers/websocket.js +0 -55
- package/infrastructure/workers/integration-defined-workers.js +0 -24
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { useParams, useNavigate } from 'react-router-dom'
|
|
3
|
+
import { ArrowLeft, Save, AlertCircle, CheckCircle, Info, TestTube, Key, Link2, Settings } from 'lucide-react'
|
|
4
|
+
import { Button } from '../components/Button'
|
|
5
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../components/Card'
|
|
6
|
+
import LoadingSpinner from '../components/LoadingSpinner'
|
|
7
|
+
import api from '../services/api'
|
|
8
|
+
<<<<<<< HEAD
|
|
9
|
+
<<<<<<< HEAD
|
|
10
|
+
import { cn } from '../lib/utils'
|
|
11
|
+
=======
|
|
12
|
+
<<<<<<< HEAD
|
|
13
|
+
<<<<<<< HEAD
|
|
14
|
+
import { cn } from '../lib/utils'
|
|
15
|
+
=======
|
|
16
|
+
import { cn } from '../utils/cn'
|
|
17
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
18
|
+
=======
|
|
19
|
+
import { cn } from '../lib/utils'
|
|
20
|
+
>>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
|
|
21
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
22
|
+
=======
|
|
23
|
+
import { cn } from '../lib/utils'
|
|
24
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
25
|
+
|
|
26
|
+
const IntegrationConfigure = () => {
|
|
27
|
+
const { integrationName } = useParams()
|
|
28
|
+
const navigate = useNavigate()
|
|
29
|
+
<<<<<<< HEAD
|
|
30
|
+
<<<<<<< HEAD
|
|
31
|
+
|
|
32
|
+
=======
|
|
33
|
+
<<<<<<< HEAD
|
|
34
|
+
|
|
35
|
+
=======
|
|
36
|
+
|
|
37
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
38
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
39
|
+
=======
|
|
40
|
+
|
|
41
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
42
|
+
const [loading, setLoading] = useState(true)
|
|
43
|
+
const [saving, setSaving] = useState(false)
|
|
44
|
+
const [testing, setTesting] = useState(false)
|
|
45
|
+
const [integration, setIntegration] = useState(null)
|
|
46
|
+
const [config, setConfig] = useState({})
|
|
47
|
+
const [errors, setErrors] = useState({})
|
|
48
|
+
const [testResult, setTestResult] = useState(null)
|
|
49
|
+
const [successMessage, setSuccessMessage] = useState('')
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
fetchIntegrationDetails()
|
|
53
|
+
}, [integrationName])
|
|
54
|
+
|
|
55
|
+
const fetchIntegrationDetails = async () => {
|
|
56
|
+
try {
|
|
57
|
+
setLoading(true)
|
|
58
|
+
<<<<<<< HEAD
|
|
59
|
+
<<<<<<< HEAD
|
|
60
|
+
|
|
61
|
+
=======
|
|
62
|
+
<<<<<<< HEAD
|
|
63
|
+
|
|
64
|
+
=======
|
|
65
|
+
|
|
66
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
67
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
68
|
+
=======
|
|
69
|
+
|
|
70
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
71
|
+
// Fetch integration details and current configuration
|
|
72
|
+
const [detailsRes, configRes] = await Promise.all([
|
|
73
|
+
api.get(`/api/discovery/integrations/${integrationName}`),
|
|
74
|
+
api.get(`/api/integrations/${integrationName}/config`)
|
|
75
|
+
])
|
|
76
|
+
<<<<<<< HEAD
|
|
77
|
+
<<<<<<< HEAD
|
|
78
|
+
=======
|
|
79
|
+
<<<<<<< HEAD
|
|
80
|
+
|
|
81
|
+
setIntegration(detailsRes.data.data)
|
|
82
|
+
setConfig(configRes.data.config || {})
|
|
83
|
+
|
|
84
|
+
=======
|
|
85
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
86
|
+
=======
|
|
87
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
88
|
+
|
|
89
|
+
setIntegration(detailsRes.data.data)
|
|
90
|
+
setConfig(configRes.data.config || {})
|
|
91
|
+
|
|
92
|
+
<<<<<<< HEAD
|
|
93
|
+
<<<<<<< HEAD
|
|
94
|
+
=======
|
|
95
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
96
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
97
|
+
=======
|
|
98
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
99
|
+
} catch (err) {
|
|
100
|
+
console.error('Failed to fetch integration details:', err)
|
|
101
|
+
setErrors({ general: 'Failed to load integration configuration' })
|
|
102
|
+
} finally {
|
|
103
|
+
setLoading(false)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const handleInputChange = (field, value) => {
|
|
108
|
+
setConfig(prev => ({ ...prev, [field]: value }))
|
|
109
|
+
setErrors(prev => ({ ...prev, [field]: '' }))
|
|
110
|
+
setSuccessMessage('')
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const validateConfig = () => {
|
|
114
|
+
const newErrors = {}
|
|
115
|
+
const authType = integration?.integrationMetadata?.authType
|
|
116
|
+
|
|
117
|
+
if (authType === 'oauth2') {
|
|
118
|
+
if (!config.clientId) newErrors.clientId = 'Client ID is required'
|
|
119
|
+
if (!config.clientSecret) newErrors.clientSecret = 'Client Secret is required'
|
|
120
|
+
if (!config.redirectUri) newErrors.redirectUri = 'Redirect URI is required'
|
|
121
|
+
} else if (authType === 'api-key') {
|
|
122
|
+
if (!config.apiKey) newErrors.apiKey = 'API Key is required'
|
|
123
|
+
} else if (authType === 'basic') {
|
|
124
|
+
if (!config.username) newErrors.username = 'Username is required'
|
|
125
|
+
if (!config.password) newErrors.password = 'Password is required'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Validate required scopes
|
|
129
|
+
const requiredScopes = integration?.integrationMetadata?.requiredScopes || []
|
|
130
|
+
if (requiredScopes.length > 0 && (!config.scopes || config.scopes.length === 0)) {
|
|
131
|
+
newErrors.scopes = 'Please select at least one scope'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
setErrors(newErrors)
|
|
135
|
+
return Object.keys(newErrors).length === 0
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const handleSave = async () => {
|
|
139
|
+
if (!validateConfig()) return
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
setSaving(true)
|
|
143
|
+
setSuccessMessage('')
|
|
144
|
+
<<<<<<< HEAD
|
|
145
|
+
<<<<<<< HEAD
|
|
146
|
+
=======
|
|
147
|
+
<<<<<<< HEAD
|
|
148
|
+
|
|
149
|
+
await api.post(`/api/integrations/${integrationName}/config`, {
|
|
150
|
+
config
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
setSuccessMessage('Configuration saved successfully!')
|
|
154
|
+
|
|
155
|
+
=======
|
|
156
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
157
|
+
=======
|
|
158
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
159
|
+
|
|
160
|
+
await api.post(`/api/integrations/${integrationName}/config`, {
|
|
161
|
+
config
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
setSuccessMessage('Configuration saved successfully!')
|
|
165
|
+
|
|
166
|
+
<<<<<<< HEAD
|
|
167
|
+
<<<<<<< HEAD
|
|
168
|
+
=======
|
|
169
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
170
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
171
|
+
=======
|
|
172
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
173
|
+
// Redirect after a delay
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
navigate('/integrations')
|
|
176
|
+
}, 2000)
|
|
177
|
+
<<<<<<< HEAD
|
|
178
|
+
<<<<<<< HEAD
|
|
179
|
+
|
|
180
|
+
=======
|
|
181
|
+
<<<<<<< HEAD
|
|
182
|
+
|
|
183
|
+
=======
|
|
184
|
+
|
|
185
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
186
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
187
|
+
=======
|
|
188
|
+
|
|
189
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
190
|
+
} catch (err) {
|
|
191
|
+
console.error('Failed to save configuration:', err)
|
|
192
|
+
setErrors({ general: err.response?.data?.message || 'Failed to save configuration' })
|
|
193
|
+
} finally {
|
|
194
|
+
setSaving(false)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const handleTest = async () => {
|
|
199
|
+
if (!validateConfig()) return
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
setTesting(true)
|
|
203
|
+
setTestResult(null)
|
|
204
|
+
<<<<<<< HEAD
|
|
205
|
+
<<<<<<< HEAD
|
|
206
|
+
=======
|
|
207
|
+
<<<<<<< HEAD
|
|
208
|
+
|
|
209
|
+
const response = await api.post(`/api/integrations/${integrationName}/test`, {
|
|
210
|
+
config
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
=======
|
|
214
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
215
|
+
=======
|
|
216
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
217
|
+
|
|
218
|
+
const response = await api.post(`/api/integrations/${integrationName}/test`, {
|
|
219
|
+
config
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
<<<<<<< HEAD
|
|
223
|
+
<<<<<<< HEAD
|
|
224
|
+
=======
|
|
225
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
226
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
227
|
+
=======
|
|
228
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
229
|
+
setTestResult({
|
|
230
|
+
success: response.data.success,
|
|
231
|
+
message: response.data.message,
|
|
232
|
+
details: response.data.details
|
|
233
|
+
})
|
|
234
|
+
<<<<<<< HEAD
|
|
235
|
+
<<<<<<< HEAD
|
|
236
|
+
|
|
237
|
+
=======
|
|
238
|
+
<<<<<<< HEAD
|
|
239
|
+
|
|
240
|
+
=======
|
|
241
|
+
|
|
242
|
+
>>>>>>> 652520a5 (Claude Flow RFC related development)
|
|
243
|
+
>>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
|
|
244
|
+
=======
|
|
245
|
+
|
|
246
|
+
>>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
|
|
247
|
+
} catch (err) {
|
|
248
|
+
console.error('Test failed:', err)
|
|
249
|
+
setTestResult({
|
|
250
|
+
success: false,
|
|
251
|
+
message: err.response?.data?.message || 'Connection test failed',
|
|
252
|
+
details: err.response?.data?.details
|
|
253
|
+
})
|
|
254
|
+
} finally {
|
|
255
|
+
setTesting(false)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const renderAuthFields = () => {
|
|
260
|
+
const authType = integration?.integrationMetadata?.authType
|
|
261
|
+
|
|
262
|
+
switch (authType) {
|
|
263
|
+
case 'oauth2':
|
|
264
|
+
return (
|
|
265
|
+
<>
|
|
266
|
+
<div>
|
|
267
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
268
|
+
Client ID
|
|
269
|
+
</label>
|
|
270
|
+
<input
|
|
271
|
+
type="text"
|
|
272
|
+
value={config.clientId || ''}
|
|
273
|
+
onChange={(e) => handleInputChange('clientId', e.target.value)}
|
|
274
|
+
className={cn(
|
|
275
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
276
|
+
errors.clientId ? "border-red-300" : "border-gray-300"
|
|
277
|
+
)}
|
|
278
|
+
placeholder="Enter your OAuth2 Client ID"
|
|
279
|
+
/>
|
|
280
|
+
{errors.clientId && (
|
|
281
|
+
<p className="mt-1 text-sm text-red-600">{errors.clientId}</p>
|
|
282
|
+
)}
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div>
|
|
286
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
287
|
+
Client Secret
|
|
288
|
+
</label>
|
|
289
|
+
<input
|
|
290
|
+
type="password"
|
|
291
|
+
value={config.clientSecret || ''}
|
|
292
|
+
onChange={(e) => handleInputChange('clientSecret', e.target.value)}
|
|
293
|
+
className={cn(
|
|
294
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
295
|
+
errors.clientSecret ? "border-red-300" : "border-gray-300"
|
|
296
|
+
)}
|
|
297
|
+
placeholder="Enter your OAuth2 Client Secret"
|
|
298
|
+
/>
|
|
299
|
+
{errors.clientSecret && (
|
|
300
|
+
<p className="mt-1 text-sm text-red-600">{errors.clientSecret}</p>
|
|
301
|
+
)}
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<div>
|
|
305
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
306
|
+
Redirect URI
|
|
307
|
+
</label>
|
|
308
|
+
<input
|
|
309
|
+
type="url"
|
|
310
|
+
value={config.redirectUri || ''}
|
|
311
|
+
onChange={(e) => handleInputChange('redirectUri', e.target.value)}
|
|
312
|
+
className={cn(
|
|
313
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
314
|
+
errors.redirectUri ? "border-red-300" : "border-gray-300"
|
|
315
|
+
)}
|
|
316
|
+
placeholder="https://your-app.com/auth/callback"
|
|
317
|
+
/>
|
|
318
|
+
{errors.redirectUri && (
|
|
319
|
+
<p className="mt-1 text-sm text-red-600">{errors.redirectUri}</p>
|
|
320
|
+
)}
|
|
321
|
+
<p className="mt-1 text-xs text-gray-500">
|
|
322
|
+
Add this URL to your OAuth app's allowed redirect URIs
|
|
323
|
+
</p>
|
|
324
|
+
</div>
|
|
325
|
+
</>
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
case 'api-key':
|
|
329
|
+
return (
|
|
330
|
+
<div>
|
|
331
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
332
|
+
API Key
|
|
333
|
+
</label>
|
|
334
|
+
<input
|
|
335
|
+
type="password"
|
|
336
|
+
value={config.apiKey || ''}
|
|
337
|
+
onChange={(e) => handleInputChange('apiKey', e.target.value)}
|
|
338
|
+
className={cn(
|
|
339
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
340
|
+
errors.apiKey ? "border-red-300" : "border-gray-300"
|
|
341
|
+
)}
|
|
342
|
+
placeholder="Enter your API key"
|
|
343
|
+
/>
|
|
344
|
+
{errors.apiKey && (
|
|
345
|
+
<p className="mt-1 text-sm text-red-600">{errors.apiKey}</p>
|
|
346
|
+
)}
|
|
347
|
+
<p className="mt-1 text-xs text-gray-500">
|
|
348
|
+
Keep your API key secure and never share it publicly
|
|
349
|
+
</p>
|
|
350
|
+
</div>
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
case 'basic':
|
|
354
|
+
return (
|
|
355
|
+
<>
|
|
356
|
+
<div>
|
|
357
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
358
|
+
Username
|
|
359
|
+
</label>
|
|
360
|
+
<input
|
|
361
|
+
type="text"
|
|
362
|
+
value={config.username || ''}
|
|
363
|
+
onChange={(e) => handleInputChange('username', e.target.value)}
|
|
364
|
+
className={cn(
|
|
365
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
366
|
+
errors.username ? "border-red-300" : "border-gray-300"
|
|
367
|
+
)}
|
|
368
|
+
placeholder="Enter username"
|
|
369
|
+
/>
|
|
370
|
+
{errors.username && (
|
|
371
|
+
<p className="mt-1 text-sm text-red-600">{errors.username}</p>
|
|
372
|
+
)}
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<div>
|
|
376
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
377
|
+
Password
|
|
378
|
+
</label>
|
|
379
|
+
<input
|
|
380
|
+
type="password"
|
|
381
|
+
value={config.password || ''}
|
|
382
|
+
onChange={(e) => handleInputChange('password', e.target.value)}
|
|
383
|
+
className={cn(
|
|
384
|
+
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
385
|
+
errors.password ? "border-red-300" : "border-gray-300"
|
|
386
|
+
)}
|
|
387
|
+
placeholder="Enter password"
|
|
388
|
+
/>
|
|
389
|
+
{errors.password && (
|
|
390
|
+
<p className="mt-1 text-sm text-red-600">{errors.password}</p>
|
|
391
|
+
)}
|
|
392
|
+
</div>
|
|
393
|
+
</>
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
default:
|
|
397
|
+
return (
|
|
398
|
+
<div className="text-gray-500">
|
|
399
|
+
<Info size={20} className="inline mr-2" />
|
|
400
|
+
No authentication configuration required for this integration.
|
|
401
|
+
</div>
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const renderScopesSelection = () => {
|
|
407
|
+
const requiredScopes = integration?.integrationMetadata?.requiredScopes || []
|
|
408
|
+
if (requiredScopes.length === 0) return null
|
|
409
|
+
|
|
410
|
+
return (
|
|
411
|
+
<div>
|
|
412
|
+
<label className="block text-sm font-medium text-gray-700 mb-2">
|
|
413
|
+
Required Scopes
|
|
414
|
+
</label>
|
|
415
|
+
<div className="space-y-2">
|
|
416
|
+
{requiredScopes.map((scope) => (
|
|
417
|
+
<label key={scope} className="flex items-center">
|
|
418
|
+
<input
|
|
419
|
+
type="checkbox"
|
|
420
|
+
checked={config.scopes?.includes(scope) || false}
|
|
421
|
+
onChange={(e) => {
|
|
422
|
+
const newScopes = e.target.checked
|
|
423
|
+
? [...(config.scopes || []), scope]
|
|
424
|
+
: (config.scopes || []).filter(s => s !== scope)
|
|
425
|
+
handleInputChange('scopes', newScopes)
|
|
426
|
+
}}
|
|
427
|
+
className="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"
|
|
428
|
+
/>
|
|
429
|
+
<span className="ml-2 text-sm text-gray-700">{scope}</span>
|
|
430
|
+
</label>
|
|
431
|
+
))}
|
|
432
|
+
</div>
|
|
433
|
+
{errors.scopes && (
|
|
434
|
+
<p className="mt-1 text-sm text-red-600">{errors.scopes}</p>
|
|
435
|
+
)}
|
|
436
|
+
</div>
|
|
437
|
+
)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (loading) {
|
|
441
|
+
return (
|
|
442
|
+
<div className="flex items-center justify-center min-h-screen">
|
|
443
|
+
<div className="text-center">
|
|
444
|
+
<LoadingSpinner size="lg" />
|
|
445
|
+
<p className="mt-4 text-gray-600">Loading configuration...</p>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (!integration) {
|
|
452
|
+
return (
|
|
453
|
+
<div className="text-center py-12">
|
|
454
|
+
<AlertCircle size={48} className="mx-auto text-gray-400 mb-4" />
|
|
455
|
+
<h3 className="text-lg font-medium text-gray-900 mb-2">Integration Not Found</h3>
|
|
456
|
+
<p className="text-gray-600 mb-4">The requested integration could not be found.</p>
|
|
457
|
+
<Button onClick={() => navigate('/integrations')}>
|
|
458
|
+
Back to Integrations
|
|
459
|
+
</Button>
|
|
460
|
+
</div>
|
|
461
|
+
)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return (
|
|
465
|
+
<div className="max-w-4xl mx-auto space-y-6">
|
|
466
|
+
{/* Header */}
|
|
467
|
+
<div className="flex items-center justify-between">
|
|
468
|
+
<div className="flex items-center">
|
|
469
|
+
<Button
|
|
470
|
+
variant="ghost"
|
|
471
|
+
onClick={() => navigate('/integrations')}
|
|
472
|
+
className="mr-4"
|
|
473
|
+
>
|
|
474
|
+
<ArrowLeft size={20} className="mr-2" />
|
|
475
|
+
Back
|
|
476
|
+
</Button>
|
|
477
|
+
<div>
|
|
478
|
+
<h2 className="text-2xl font-bold text-gray-900">
|
|
479
|
+
Configure {integration.displayName}
|
|
480
|
+
</h2>
|
|
481
|
+
<p className="text-gray-600 mt-1">
|
|
482
|
+
Set up authentication and connection settings
|
|
483
|
+
</p>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
{/* Error Alert */}
|
|
489
|
+
{errors.general && (
|
|
490
|
+
<div className="bg-red-50 border border-red-200 rounded-lg p-4 flex items-start">
|
|
491
|
+
<AlertCircle size={20} className="text-red-500 mr-2 flex-shrink-0 mt-0.5" />
|
|
492
|
+
<div>
|
|
493
|
+
<h4 className="text-sm font-medium text-red-800">Error</h4>
|
|
494
|
+
<p className="text-sm text-red-700 mt-1">{errors.general}</p>
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
)}
|
|
498
|
+
|
|
499
|
+
{/* Success Message */}
|
|
500
|
+
{successMessage && (
|
|
501
|
+
<div className="bg-green-50 border border-green-200 rounded-lg p-4 flex items-start">
|
|
502
|
+
<CheckCircle size={20} className="text-green-500 mr-2 flex-shrink-0 mt-0.5" />
|
|
503
|
+
<div>
|
|
504
|
+
<h4 className="text-sm font-medium text-green-800">Success</h4>
|
|
505
|
+
<p className="text-sm text-green-700 mt-1">{successMessage}</p>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
)}
|
|
509
|
+
|
|
510
|
+
{/* Authentication Configuration */}
|
|
511
|
+
<Card>
|
|
512
|
+
<CardHeader>
|
|
513
|
+
<CardTitle className="flex items-center">
|
|
514
|
+
<Key size={20} className="mr-2" />
|
|
515
|
+
Authentication
|
|
516
|
+
</CardTitle>
|
|
517
|
+
</CardHeader>
|
|
518
|
+
<CardContent className="space-y-4">
|
|
519
|
+
{renderAuthFields()}
|
|
520
|
+
</CardContent>
|
|
521
|
+
</Card>
|
|
522
|
+
|
|
523
|
+
{/* Scopes Configuration */}
|
|
524
|
+
{renderScopesSelection() && (
|
|
525
|
+
<Card>
|
|
526
|
+
<CardHeader>
|
|
527
|
+
<CardTitle className="flex items-center">
|
|
528
|
+
<Settings size={20} className="mr-2" />
|
|
529
|
+
Permissions
|
|
530
|
+
</CardTitle>
|
|
531
|
+
</CardHeader>
|
|
532
|
+
<CardContent>
|
|
533
|
+
{renderScopesSelection()}
|
|
534
|
+
</CardContent>
|
|
535
|
+
</Card>
|
|
536
|
+
)}
|
|
537
|
+
|
|
538
|
+
{/* Additional Settings */}
|
|
539
|
+
<Card>
|
|
540
|
+
<CardHeader>
|
|
541
|
+
<CardTitle className="flex items-center">
|
|
542
|
+
<Link2 size={20} className="mr-2" />
|
|
543
|
+
Connection Settings
|
|
544
|
+
</CardTitle>
|
|
545
|
+
</CardHeader>
|
|
546
|
+
<CardContent className="space-y-4">
|
|
547
|
+
<div>
|
|
548
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
549
|
+
Environment
|
|
550
|
+
</label>
|
|
551
|
+
<select
|
|
552
|
+
value={config.environment || 'production'}
|
|
553
|
+
onChange={(e) => handleInputChange('environment', e.target.value)}
|
|
554
|
+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
555
|
+
>
|
|
556
|
+
<option value="production">Production</option>
|
|
557
|
+
<option value="sandbox">Sandbox</option>
|
|
558
|
+
<option value="development">Development</option>
|
|
559
|
+
</select>
|
|
560
|
+
<p className="mt-1 text-xs text-gray-500">
|
|
561
|
+
Select the environment to connect to
|
|
562
|
+
</p>
|
|
563
|
+
</div>
|
|
564
|
+
|
|
565
|
+
<div>
|
|
566
|
+
<label className="block text-sm font-medium text-gray-700 mb-1">
|
|
567
|
+
Webhook URL (Optional)
|
|
568
|
+
</label>
|
|
569
|
+
<input
|
|
570
|
+
type="url"
|
|
571
|
+
value={config.webhookUrl || ''}
|
|
572
|
+
onChange={(e) => handleInputChange('webhookUrl', e.target.value)}
|
|
573
|
+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
574
|
+
placeholder="https://your-app.com/webhooks/integration"
|
|
575
|
+
/>
|
|
576
|
+
<p className="mt-1 text-xs text-gray-500">
|
|
577
|
+
Endpoint to receive webhook events from this integration
|
|
578
|
+
</p>
|
|
579
|
+
</div>
|
|
580
|
+
</CardContent>
|
|
581
|
+
</Card>
|
|
582
|
+
|
|
583
|
+
{/* Test Results */}
|
|
584
|
+
{testResult && (
|
|
585
|
+
<Card className={testResult.success ? 'border-green-300' : 'border-red-300'}>
|
|
586
|
+
<CardContent className="p-4">
|
|
587
|
+
<div className="flex items-start">
|
|
588
|
+
{testResult.success ? (
|
|
589
|
+
<CheckCircle size={20} className="text-green-500 mr-2 flex-shrink-0 mt-0.5" />
|
|
590
|
+
) : (
|
|
591
|
+
<AlertCircle size={20} className="text-red-500 mr-2 flex-shrink-0 mt-0.5" />
|
|
592
|
+
)}
|
|
593
|
+
<div className="flex-1">
|
|
594
|
+
<h4 className={cn(
|
|
595
|
+
"text-sm font-medium",
|
|
596
|
+
testResult.success ? "text-green-800" : "text-red-800"
|
|
597
|
+
)}>
|
|
598
|
+
{testResult.success ? 'Connection Test Passed' : 'Connection Test Failed'}
|
|
599
|
+
</h4>
|
|
600
|
+
<p className={cn(
|
|
601
|
+
"text-sm mt-1",
|
|
602
|
+
testResult.success ? "text-green-700" : "text-red-700"
|
|
603
|
+
)}>
|
|
604
|
+
{testResult.message}
|
|
605
|
+
</p>
|
|
606
|
+
{testResult.details && (
|
|
607
|
+
<pre className="mt-2 text-xs bg-gray-100 p-2 rounded overflow-x-auto">
|
|
608
|
+
{JSON.stringify(testResult.details, null, 2)}
|
|
609
|
+
</pre>
|
|
610
|
+
)}
|
|
611
|
+
</div>
|
|
612
|
+
</div>
|
|
613
|
+
</CardContent>
|
|
614
|
+
</Card>
|
|
615
|
+
)}
|
|
616
|
+
|
|
617
|
+
{/* Action Buttons */}
|
|
618
|
+
<div className="flex justify-between">
|
|
619
|
+
<Button
|
|
620
|
+
variant="outline"
|
|
621
|
+
onClick={handleTest}
|
|
622
|
+
disabled={saving || testing}
|
|
623
|
+
className="inline-flex items-center"
|
|
624
|
+
>
|
|
625
|
+
{testing ? (
|
|
626
|
+
<>
|
|
627
|
+
<LoadingSpinner size="sm" className="mr-2" />
|
|
628
|
+
Testing...
|
|
629
|
+
</>
|
|
630
|
+
) : (
|
|
631
|
+
<>
|
|
632
|
+
<TestTube size={16} className="mr-2" />
|
|
633
|
+
Test Connection
|
|
634
|
+
</>
|
|
635
|
+
)}
|
|
636
|
+
</Button>
|
|
637
|
+
|
|
638
|
+
<div className="flex gap-2">
|
|
639
|
+
<Button
|
|
640
|
+
variant="outline"
|
|
641
|
+
onClick={() => navigate('/integrations')}
|
|
642
|
+
disabled={saving}
|
|
643
|
+
>
|
|
644
|
+
Cancel
|
|
645
|
+
</Button>
|
|
646
|
+
<Button
|
|
647
|
+
onClick={handleSave}
|
|
648
|
+
disabled={saving || testing}
|
|
649
|
+
className="inline-flex items-center"
|
|
650
|
+
>
|
|
651
|
+
{saving ? (
|
|
652
|
+
<>
|
|
653
|
+
<LoadingSpinner size="sm" className="mr-2" />
|
|
654
|
+
Saving...
|
|
655
|
+
</>
|
|
656
|
+
) : (
|
|
657
|
+
<>
|
|
658
|
+
<Save size={16} className="mr-2" />
|
|
659
|
+
Save Configuration
|
|
660
|
+
</>
|
|
661
|
+
)}
|
|
662
|
+
</Button>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
</div>
|
|
666
|
+
)
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export default IntegrationConfigure
|