@friggframework/devtools 2.0.0--canary.400.bed3308.0 → 2.0.0--canary.404.e9d4980.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.
Files changed (182) hide show
  1. package/frigg-cli/build-command/index.js +3 -18
  2. package/frigg-cli/deploy-command/index.js +3 -19
  3. package/frigg-cli/index.js +1 -73
  4. package/frigg-cli/install-command/index.js +2 -15
  5. package/frigg-cli/start-command/index.js +2 -17
  6. package/infrastructure/create-frigg-infrastructure.js +2 -2
  7. package/infrastructure/serverless-template.js +79 -529
  8. package/package.json +5 -9
  9. package/frigg-cli/.eslintrc.js +0 -141
  10. package/frigg-cli/__tests__/jest.config.js +0 -102
  11. package/frigg-cli/__tests__/unit/commands/build.test.js +0 -483
  12. package/frigg-cli/__tests__/unit/commands/install.test.js +0 -418
  13. package/frigg-cli/__tests__/unit/commands/ui.test.js +0 -592
  14. package/frigg-cli/__tests__/utils/command-tester.js +0 -170
  15. package/frigg-cli/__tests__/utils/mock-factory.js +0 -270
  16. package/frigg-cli/__tests__/utils/test-fixtures.js +0 -463
  17. package/frigg-cli/__tests__/utils/test-setup.js +0 -286
  18. package/frigg-cli/generate-command/__tests__/generate-command.test.js +0 -312
  19. package/frigg-cli/generate-command/azure-generator.js +0 -43
  20. package/frigg-cli/generate-command/gcp-generator.js +0 -47
  21. package/frigg-cli/generate-command/index.js +0 -350
  22. package/frigg-cli/generate-command/terraform-generator.js +0 -555
  23. package/frigg-cli/generate-iam-command.js +0 -115
  24. package/frigg-cli/package.json +0 -75
  25. package/frigg-cli/ui-command/index.js +0 -167
  26. package/frigg-cli/utils/app-resolver.js +0 -319
  27. package/frigg-cli/utils/backend-path.js +0 -38
  28. package/frigg-cli/utils/process-manager.js +0 -199
  29. package/frigg-cli/utils/repo-detection.js +0 -405
  30. package/infrastructure/AWS-DISCOVERY-TROUBLESHOOTING.md +0 -245
  31. package/infrastructure/AWS-IAM-CREDENTIAL-NEEDS.md +0 -620
  32. package/infrastructure/DEPLOYMENT-INSTRUCTIONS.md +0 -268
  33. package/infrastructure/GENERATE-IAM-DOCS.md +0 -253
  34. package/infrastructure/IAM-POLICY-TEMPLATES.md +0 -176
  35. package/infrastructure/README-TESTING.md +0 -332
  36. package/infrastructure/README.md +0 -421
  37. package/infrastructure/WEBSOCKET-CONFIGURATION.md +0 -105
  38. package/infrastructure/__tests__/fixtures/mock-aws-resources.js +0 -391
  39. package/infrastructure/__tests__/helpers/test-utils.js +0 -277
  40. package/infrastructure/aws-discovery.js +0 -568
  41. package/infrastructure/aws-discovery.test.js +0 -373
  42. package/infrastructure/build-time-discovery.js +0 -206
  43. package/infrastructure/build-time-discovery.test.js +0 -375
  44. package/infrastructure/frigg-deployment-iam-stack.yaml +0 -393
  45. package/infrastructure/iam-generator.js +0 -810
  46. package/infrastructure/iam-generator.test.js +0 -169
  47. package/infrastructure/iam-policy-basic.json +0 -236
  48. package/infrastructure/iam-policy-full.json +0 -305
  49. package/infrastructure/integration.test.js +0 -383
  50. package/infrastructure/run-discovery.js +0 -110
  51. package/infrastructure/serverless-template.test.js +0 -553
  52. package/management-ui/.eslintrc.js +0 -22
  53. package/management-ui/README.md +0 -203
  54. package/management-ui/components.json +0 -21
  55. package/management-ui/index.html +0 -13
  56. package/management-ui/merge-conflict-cleaner.py +0 -371
  57. package/management-ui/package-lock.json +0 -10997
  58. package/management-ui/package.json +0 -76
  59. package/management-ui/postcss.config.js +0 -6
  60. package/management-ui/server/api/backend.js +0 -256
  61. package/management-ui/server/api/cli.js +0 -315
  62. package/management-ui/server/api/codegen.js +0 -663
  63. package/management-ui/server/api/connections.js +0 -857
  64. package/management-ui/server/api/discovery.js +0 -185
  65. package/management-ui/server/api/environment/index.js +0 -1
  66. package/management-ui/server/api/environment/router.js +0 -378
  67. package/management-ui/server/api/environment.js +0 -328
  68. package/management-ui/server/api/integrations.js +0 -479
  69. package/management-ui/server/api/logs.js +0 -248
  70. package/management-ui/server/api/monitoring.js +0 -282
  71. package/management-ui/server/api/open-ide.js +0 -31
  72. package/management-ui/server/api/project.js +0 -553
  73. package/management-ui/server/api/users/sessions.js +0 -371
  74. package/management-ui/server/api/users/simulation.js +0 -254
  75. package/management-ui/server/api/users.js +0 -362
  76. package/management-ui/server/api-contract.md +0 -275
  77. package/management-ui/server/index.js +0 -428
  78. package/management-ui/server/middleware/errorHandler.js +0 -70
  79. package/management-ui/server/middleware/security.js +0 -32
  80. package/management-ui/server/processManager.js +0 -296
  81. package/management-ui/server/server.js +0 -188
  82. package/management-ui/server/services/aws-monitor.js +0 -413
  83. package/management-ui/server/services/npm-registry.js +0 -347
  84. package/management-ui/server/services/template-engine.js +0 -538
  85. package/management-ui/server/utils/cliIntegration.js +0 -220
  86. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  87. package/management-ui/server/utils/environment/awsParameterStore.js +0 -264
  88. package/management-ui/server/utils/environment/encryption.js +0 -278
  89. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  90. package/management-ui/server/utils/import-commonjs.js +0 -28
  91. package/management-ui/server/utils/response.js +0 -83
  92. package/management-ui/server/websocket/handler.js +0 -325
  93. package/management-ui/src/App.jsx +0 -51
  94. package/management-ui/src/assets/FriggLogo.svg +0 -1
  95. package/management-ui/src/components/AppRouter.jsx +0 -65
  96. package/management-ui/src/components/Button.jsx +0 -2
  97. package/management-ui/src/components/Card.jsx +0 -9
  98. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  99. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  100. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  101. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  102. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  103. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  104. package/management-ui/src/components/IntegrationCard.jsx +0 -199
  105. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -490
  106. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  107. package/management-ui/src/components/IntegrationStatus.jsx +0 -235
  108. package/management-ui/src/components/Layout.jsx +0 -250
  109. package/management-ui/src/components/LoadingSpinner.jsx +0 -45
  110. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  111. package/management-ui/src/components/SessionMonitor.jsx +0 -255
  112. package/management-ui/src/components/StatusBadge.jsx +0 -70
  113. package/management-ui/src/components/UserContextSwitcher.jsx +0 -154
  114. package/management-ui/src/components/UserSimulation.jsx +0 -299
  115. package/management-ui/src/components/Welcome.jsx +0 -434
  116. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  117. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  118. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  119. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  120. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  121. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  122. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  123. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  124. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  125. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  126. package/management-ui/src/components/codegen/index.js +0 -10
  127. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  128. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  129. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  130. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  131. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  132. package/management-ui/src/components/connections/index.js +0 -5
  133. package/management-ui/src/components/index.js +0 -21
  134. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  135. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  136. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  137. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  138. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  139. package/management-ui/src/components/monitoring/index.js +0 -6
  140. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  141. package/management-ui/src/components/theme-provider.jsx +0 -52
  142. package/management-ui/src/components/theme-toggle.jsx +0 -39
  143. package/management-ui/src/components/ui/badge.tsx +0 -36
  144. package/management-ui/src/components/ui/button.test.jsx +0 -56
  145. package/management-ui/src/components/ui/button.tsx +0 -57
  146. package/management-ui/src/components/ui/card.tsx +0 -76
  147. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  148. package/management-ui/src/components/ui/select.tsx +0 -157
  149. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  150. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  151. package/management-ui/src/hooks/useSocket.jsx +0 -58
  152. package/management-ui/src/index.css +0 -194
  153. package/management-ui/src/lib/utils.ts +0 -6
  154. package/management-ui/src/main.jsx +0 -10
  155. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  156. package/management-ui/src/pages/Connections.jsx +0 -252
  157. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -427
  158. package/management-ui/src/pages/Dashboard.jsx +0 -311
  159. package/management-ui/src/pages/Environment.jsx +0 -314
  160. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -544
  161. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -479
  162. package/management-ui/src/pages/IntegrationTest.jsx +0 -494
  163. package/management-ui/src/pages/Integrations.jsx +0 -254
  164. package/management-ui/src/pages/Monitoring.jsx +0 -17
  165. package/management-ui/src/pages/Simulation.jsx +0 -155
  166. package/management-ui/src/pages/Users.jsx +0 -492
  167. package/management-ui/src/services/api.js +0 -41
  168. package/management-ui/src/services/apiModuleService.js +0 -193
  169. package/management-ui/src/services/websocket-handlers.js +0 -120
  170. package/management-ui/src/test/api/project.test.js +0 -273
  171. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  172. package/management-ui/src/test/mocks/server.js +0 -178
  173. package/management-ui/src/test/setup.js +0 -61
  174. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  175. package/management-ui/src/utils/repository.js +0 -98
  176. package/management-ui/src/utils/repository.test.js +0 -118
  177. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  178. package/management-ui/tailwind.config.js +0 -63
  179. package/management-ui/tsconfig.json +0 -37
  180. package/management-ui/tsconfig.node.json +0 -10
  181. package/management-ui/vite.config.js +0 -26
  182. package/management-ui/vitest.config.js +0 -38
@@ -1,362 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { Button } from '../Button'
3
- import api from '../../services/api'
4
-
5
- const ConnectionConfigForm = ({ connection, integration, onSave, onCancel }) => {
6
- const [config, setConfig] = useState({
7
- name: '',
8
- description: '',
9
- syncInterval: 'hourly',
10
- autoSync: true,
11
- webhookEnabled: false,
12
- webhookUrl: '',
13
- rateLimitOverride: '',
14
- customHeaders: {},
15
- entityMappings: [],
16
- advanced: {}
17
- })
18
- const [loading, setLoading] = useState(false)
19
- const [error, setError] = useState(null)
20
-
21
- useEffect(() => {
22
- if (connection) {
23
- // Load existing configuration
24
- setConfig({
25
- name: connection.name || '',
26
- description: connection.description || '',
27
- syncInterval: connection.syncInterval || 'hourly',
28
- autoSync: connection.autoSync !== false,
29
- webhookEnabled: connection.webhookEnabled || false,
30
- webhookUrl: connection.webhookUrl || '',
31
- rateLimitOverride: connection.rateLimitOverride || '',
32
- customHeaders: connection.customHeaders || {},
33
- entityMappings: connection.entityMappings || [],
34
- advanced: connection.advanced || {}
35
- })
36
- }
37
- }, [connection])
38
-
39
- const handleSubmit = async (e) => {
40
- e.preventDefault()
41
- setLoading(true)
42
- setError(null)
43
-
44
- try {
45
- const endpoint = connection
46
- ? `/api/connections/${connection.id}/config`
47
- : '/api/connections/config'
48
-
49
- const method = connection ? 'put' : 'post'
50
-
51
- const response = await api[method](endpoint, {
52
- ...config,
53
- integrationId: integration.id
54
- })
55
-
56
- onSave(response.data)
57
- } catch (err) {
58
- setError(err.response?.data?.error || 'Failed to save configuration')
59
- } finally {
60
- setLoading(false)
61
- }
62
- }
63
-
64
- const addCustomHeader = () => {
65
- const key = prompt('Header name:')
66
- if (key) {
67
- const value = prompt('Header value:')
68
- if (value) {
69
- setConfig(prev => ({
70
- ...prev,
71
- customHeaders: {
72
- ...prev.customHeaders,
73
- [key]: value
74
- }
75
- }))
76
- }
77
- }
78
- }
79
-
80
- const removeCustomHeader = (key) => {
81
- setConfig(prev => {
82
- const { [key]: _, ...rest } = prev.customHeaders
83
- return { ...prev, customHeaders: rest }
84
- })
85
- }
86
-
87
- const addEntityMapping = () => {
88
- setConfig(prev => ({
89
- ...prev,
90
- entityMappings: [
91
- ...prev.entityMappings,
92
- {
93
- id: Date.now(),
94
- sourceType: '',
95
- targetType: '',
96
- fieldMappings: {}
97
- }
98
- ]
99
- }))
100
- }
101
-
102
- const updateEntityMapping = (id, updates) => {
103
- setConfig(prev => ({
104
- ...prev,
105
- entityMappings: prev.entityMappings.map(mapping =>
106
- mapping.id === id ? { ...mapping, ...updates } : mapping
107
- )
108
- }))
109
- }
110
-
111
- const removeEntityMapping = (id) => {
112
- setConfig(prev => ({
113
- ...prev,
114
- entityMappings: prev.entityMappings.filter(mapping => mapping.id !== id)
115
- }))
116
- }
117
-
118
- return (
119
- <form onSubmit={handleSubmit} className="space-y-6">
120
- {error && (
121
- <div className="p-3 bg-destructive/10 border border-destructive/20 rounded-md">
122
- <p className="text-sm text-destructive">{error}</p>
123
- </div>
124
- )}
125
-
126
- {/* Basic Configuration */}
127
- <div className="bg-card rounded-lg shadow p-6 border border-border">
128
- <h3 className="text-lg font-semibold text-card-foreground mb-4">Basic Configuration</h3>
129
-
130
- <div className="space-y-4">
131
- <div>
132
- <label htmlFor="name" className="block text-sm font-medium text-foreground">
133
- Connection Name
134
- </label>
135
- <input
136
- type="text"
137
- id="name"
138
- value={config.name}
139
- onChange={(e) => setConfig(prev => ({ ...prev, name: e.target.value }))}
140
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
141
- placeholder={`My ${integration.displayName} Connection`}
142
- />
143
- </div>
144
-
145
- <div>
146
- <label htmlFor="description" className="block text-sm font-medium text-foreground">
147
- Description
148
- </label>
149
- <textarea
150
- id="description"
151
- value={config.description}
152
- onChange={(e) => setConfig(prev => ({ ...prev, description: e.target.value }))}
153
- rows={3}
154
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
155
- placeholder="Optional description for this connection"
156
- />
157
- </div>
158
- </div>
159
- </div>
160
-
161
- {/* Sync Configuration */}
162
- <div className="bg-card rounded-lg shadow p-6 border border-border">
163
- <h3 className="text-lg font-semibold text-card-foreground mb-4">Sync Configuration</h3>
164
-
165
- <div className="space-y-4">
166
- <div>
167
- <label className="flex items-center">
168
- <input
169
- type="checkbox"
170
- checked={config.autoSync}
171
- onChange={(e) => setConfig(prev => ({ ...prev, autoSync: e.target.checked }))}
172
- className="rounded border-input text-primary shadow-sm focus:border-ring focus:ring-ring"
173
- />
174
- <span className="ml-2 text-sm text-foreground">Enable automatic synchronization</span>
175
- </label>
176
- </div>
177
-
178
- {config.autoSync && (
179
- <div>
180
- <label htmlFor="syncInterval" className="block text-sm font-medium text-foreground">
181
- Sync Interval
182
- </label>
183
- <select
184
- id="syncInterval"
185
- value={config.syncInterval}
186
- onChange={(e) => setConfig(prev => ({ ...prev, syncInterval: e.target.value }))}
187
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
188
- >
189
- <option value="realtime">Real-time</option>
190
- <option value="5min">Every 5 minutes</option>
191
- <option value="15min">Every 15 minutes</option>
192
- <option value="hourly">Hourly</option>
193
- <option value="daily">Daily</option>
194
- <option value="weekly">Weekly</option>
195
- </select>
196
- </div>
197
- )}
198
- </div>
199
- </div>
200
-
201
- {/* Webhook Configuration */}
202
- <div className="bg-card rounded-lg shadow p-6 border border-border">
203
- <h3 className="text-lg font-semibold text-card-foreground mb-4">Webhook Configuration</h3>
204
-
205
- <div className="space-y-4">
206
- <div>
207
- <label className="flex items-center">
208
- <input
209
- type="checkbox"
210
- checked={config.webhookEnabled}
211
- onChange={(e) => setConfig(prev => ({ ...prev, webhookEnabled: e.target.checked }))}
212
- className="rounded border-input text-primary shadow-sm focus:border-ring focus:ring-ring"
213
- />
214
- <span className="ml-2 text-sm text-foreground">Enable webhooks for real-time updates</span>
215
- </label>
216
- </div>
217
-
218
- {config.webhookEnabled && (
219
- <div>
220
- <label htmlFor="webhookUrl" className="block text-sm font-medium text-foreground">
221
- Webhook URL
222
- </label>
223
- <div className="mt-1 flex rounded-md shadow-sm">
224
- <span className="inline-flex items-center px-3 rounded-l-md border border-r-0 border-input bg-muted text-muted-foreground text-sm">
225
- {window.location.origin}/api/webhooks/
226
- </span>
227
- <input
228
- type="text"
229
- id="webhookUrl"
230
- value={config.webhookUrl}
231
- onChange={(e) => setConfig(prev => ({ ...prev, webhookUrl: e.target.value }))}
232
- className="flex-1 block w-full rounded-none rounded-r-md border-input bg-background text-foreground focus:border-ring focus:ring-ring sm:text-sm"
233
- placeholder="connection-id"
234
- disabled
235
- />
236
- </div>
237
- <p className="mt-2 text-sm text-muted-foreground">
238
- This URL will be automatically generated when the connection is created.
239
- </p>
240
- </div>
241
- )}
242
- </div>
243
- </div>
244
-
245
- {/* Advanced Configuration */}
246
- <div className="bg-card rounded-lg shadow p-6 border border-border">
247
- <h3 className="text-lg font-semibold text-card-foreground mb-4">Advanced Configuration</h3>
248
-
249
- <div className="space-y-4">
250
- <div>
251
- <label htmlFor="rateLimitOverride" className="block text-sm font-medium text-foreground">
252
- Rate Limit Override (requests per minute)
253
- </label>
254
- <input
255
- type="number"
256
- id="rateLimitOverride"
257
- value={config.rateLimitOverride}
258
- onChange={(e) => setConfig(prev => ({ ...prev, rateLimitOverride: e.target.value }))}
259
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
260
- placeholder="Leave empty to use default"
261
- />
262
- </div>
263
-
264
- <div>
265
- <div className="flex items-center justify-between mb-2">
266
- <label className="block text-sm font-medium text-foreground">
267
- Custom Headers
268
- </label>
269
- <Button type="button" onClick={addCustomHeader} size="sm" variant="secondary">
270
- Add Header
271
- </Button>
272
- </div>
273
- {Object.keys(config.customHeaders).length > 0 ? (
274
- <div className="space-y-2">
275
- {Object.entries(config.customHeaders).map(([key, value]) => (
276
- <div key={key} className="flex items-center space-x-2 p-2 bg-muted/50 rounded">
277
- <code className="text-sm font-mono flex-1">{key}: {value}</code>
278
- <button
279
- type="button"
280
- onClick={() => removeCustomHeader(key)}
281
- className="text-destructive hover:text-destructive/80"
282
- >
283
- Remove
284
- </button>
285
- </div>
286
- ))}
287
- </div>
288
- ) : (
289
- <p className="text-sm text-muted-foreground">No custom headers configured</p>
290
- )}
291
- </div>
292
- </div>
293
- </div>
294
-
295
- {/* Entity Mappings */}
296
- <div className="bg-card rounded-lg shadow p-6 border border-border">
297
- <div className="flex items-center justify-between mb-4">
298
- <h3 className="text-lg font-semibold text-gray-900">Entity Mappings</h3>
299
- <Button type="button" onClick={addEntityMapping} size="sm" variant="secondary">
300
- Add Mapping
301
- </Button>
302
- </div>
303
-
304
- {config.entityMappings.length > 0 ? (
305
- <div className="space-y-4">
306
- {config.entityMappings.map((mapping) => (
307
- <div key={mapping.id} className="border border-gray-200 rounded-lg p-4">
308
- <div className="grid grid-cols-2 gap-4">
309
- <div>
310
- <label className="block text-sm font-medium text-foreground">
311
- Source Type
312
- </label>
313
- <input
314
- type="text"
315
- value={mapping.sourceType}
316
- onChange={(e) => updateEntityMapping(mapping.id, { sourceType: e.target.value })}
317
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
318
- placeholder="e.g., Contact"
319
- />
320
- </div>
321
- <div>
322
- <label className="block text-sm font-medium text-foreground">
323
- Target Type
324
- </label>
325
- <input
326
- type="text"
327
- value={mapping.targetType}
328
- onChange={(e) => updateEntityMapping(mapping.id, { targetType: e.target.value })}
329
- className="mt-1 block w-full rounded-md border-input bg-background text-foreground shadow-sm focus:border-ring focus:ring-ring sm:text-sm"
330
- placeholder="e.g., User"
331
- />
332
- </div>
333
- </div>
334
- <button
335
- type="button"
336
- onClick={() => removeEntityMapping(mapping.id)}
337
- className="mt-2 text-sm text-red-600 hover:text-red-800"
338
- >
339
- Remove Mapping
340
- </button>
341
- </div>
342
- ))}
343
- </div>
344
- ) : (
345
- <p className="text-sm text-gray-500">No entity mappings configured</p>
346
- )}
347
- </div>
348
-
349
- {/* Form Actions */}
350
- <div className="flex justify-end space-x-3">
351
- <Button type="button" onClick={onCancel} variant="secondary">
352
- Cancel
353
- </Button>
354
- <Button type="submit" variant="primary" disabled={loading}>
355
- {loading ? 'Saving...' : 'Save Configuration'}
356
- </Button>
357
- </div>
358
- </form>
359
- )
360
- }
361
-
362
- export default ConnectionConfigForm
@@ -1,182 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { useSocket } from '../../hooks/useSocket'
3
- import StatusBadge from '../StatusBadge'
4
- import api from '../../services/api'
5
-
6
- const ConnectionHealthMonitor = ({ connectionId, compact = false }) => {
7
- const socket = useSocket()
8
- const [health, setHealth] = useState({
9
- status: 'unknown',
10
- lastCheck: null,
11
- uptime: 0,
12
- latency: null,
13
- errorRate: 0,
14
- apiCalls: {
15
- total: 0,
16
- successful: 0,
17
- failed: 0
18
- }
19
- })
20
- const [loading, setLoading] = useState(true)
21
-
22
- useEffect(() => {
23
- // Fetch initial health data
24
- fetchHealthData()
25
-
26
- // Subscribe to real-time health updates
27
- if (socket) {
28
- socket.on(`connection-health-${connectionId}`, handleHealthUpdate)
29
- socket.emit('subscribe', { topics: [`connection-health-${connectionId}`] })
30
- }
31
-
32
- // Set up periodic health checks
33
- const interval = setInterval(fetchHealthData, 60000) // Check every minute
34
-
35
- return () => {
36
- if (socket) {
37
- socket.off(`connection-health-${connectionId}`, handleHealthUpdate)
38
- socket.emit('unsubscribe', { topics: [`connection-health-${connectionId}`] })
39
- }
40
- clearInterval(interval)
41
- }
42
- }, [connectionId, socket])
43
-
44
- const fetchHealthData = async () => {
45
- try {
46
- const response = await api.get(`/api/connections/${connectionId}/health`)
47
- setHealth(response.data)
48
- setLoading(false)
49
- } catch (error) {
50
- console.error('Failed to fetch health data:', error)
51
- setHealth(prev => ({ ...prev, status: 'error' }))
52
- setLoading(false)
53
- }
54
- }
55
-
56
- const handleHealthUpdate = (data) => {
57
- setHealth(prev => ({
58
- ...prev,
59
- ...data,
60
- lastCheck: new Date().toISOString()
61
- }))
62
- }
63
-
64
- const getHealthStatus = () => {
65
- if (health.status === 'healthy' && health.errorRate < 5) {
66
- return { color: 'success', text: 'Healthy' }
67
- } else if (health.status === 'healthy' && health.errorRate < 20) {
68
- return { color: 'warning', text: 'Degraded' }
69
- } else if (health.status === 'error' || health.errorRate >= 20) {
70
- return { color: 'error', text: 'Unhealthy' }
71
- }
72
- return { color: 'default', text: 'Unknown' }
73
- }
74
-
75
- const formatUptime = (seconds) => {
76
- const days = Math.floor(seconds / 86400)
77
- const hours = Math.floor((seconds % 86400) / 3600)
78
- const minutes = Math.floor((seconds % 3600) / 60)
79
-
80
- if (days > 0) {
81
- return `${days}d ${hours}h`
82
- } else if (hours > 0) {
83
- return `${hours}h ${minutes}m`
84
- }
85
- return `${minutes}m`
86
- }
87
-
88
- const healthStatus = getHealthStatus()
89
-
90
- if (loading) {
91
- return (
92
- <div className="animate-pulse">
93
- <div className="h-4 bg-gray-200 rounded w-24"></div>
94
- </div>
95
- )
96
- }
97
-
98
- if (compact) {
99
- return (
100
- <div className="flex items-center space-x-2">
101
- <StatusBadge status={healthStatus.color} text={healthStatus.text} />
102
- {health.latency && (
103
- <span className="text-xs text-gray-500">{health.latency}ms</span>
104
- )}
105
- </div>
106
- )
107
- }
108
-
109
- return (
110
- <div className="bg-white rounded-lg shadow p-6">
111
- <div className="flex items-center justify-between mb-4">
112
- <h3 className="text-lg font-semibold text-gray-900">Connection Health</h3>
113
- <StatusBadge status={healthStatus.color} text={healthStatus.text} />
114
- </div>
115
-
116
- <div className="grid grid-cols-2 gap-4">
117
- <div>
118
- <p className="text-sm text-gray-500">Uptime</p>
119
- <p className="text-lg font-medium text-gray-900">
120
- {formatUptime(health.uptime)}
121
- </p>
122
- </div>
123
-
124
- <div>
125
- <p className="text-sm text-gray-500">Response Time</p>
126
- <p className="text-lg font-medium text-gray-900">
127
- {health.latency ? `${health.latency}ms` : 'N/A'}
128
- </p>
129
- </div>
130
-
131
- <div>
132
- <p className="text-sm text-gray-500">Success Rate</p>
133
- <p className="text-lg font-medium text-gray-900">
134
- {health.apiCalls.total > 0
135
- ? `${Math.round((health.apiCalls.successful / health.apiCalls.total) * 100)}%`
136
- : 'N/A'}
137
- </p>
138
- </div>
139
-
140
- <div>
141
- <p className="text-sm text-gray-500">Total API Calls</p>
142
- <p className="text-lg font-medium text-gray-900">
143
- {health.apiCalls.total.toLocaleString()}
144
- </p>
145
- </div>
146
- </div>
147
-
148
- {health.apiCalls.failed > 0 && (
149
- <div className="mt-4 p-3 bg-red-50 border border-red-200 rounded-md">
150
- <p className="text-sm text-red-800">
151
- {health.apiCalls.failed} failed API calls in the last 24 hours
152
- </p>
153
- </div>
154
- )}
155
-
156
- {health.lastCheck && (
157
- <p className="mt-4 text-xs text-gray-500">
158
- Last checked: {new Date(health.lastCheck).toLocaleTimeString()}
159
- </p>
160
- )}
161
-
162
- <div className="mt-6 pt-4 border-t border-gray-200">
163
- <h4 className="text-sm font-semibold text-gray-900 mb-3">Recent Activity</h4>
164
-
165
- <div className="space-y-2">
166
- {health.recentEvents?.map((event, index) => (
167
- <div key={index} className="flex items-center justify-between text-sm">
168
- <span className="text-gray-600">{event.type}</span>
169
- <span className="text-gray-500 text-xs">
170
- {new Date(event.timestamp).toLocaleTimeString()}
171
- </span>
172
- </div>
173
- )) || (
174
- <p className="text-sm text-gray-500">No recent activity</p>
175
- )}
176
- </div>
177
- </div>
178
- </div>
179
- )
180
- }
181
-
182
- export default ConnectionHealthMonitor