@friggframework/devtools 2.0.0-next.61 → 2.0.0-next.63

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 (142) hide show
  1. package/infrastructure/domains/shared/utilities/base-definition-factory.js +15 -1
  2. package/package.json +15 -7
  3. package/.eslintrc.json +0 -3
  4. package/CHANGELOG.md +0 -132
  5. package/layers/prisma/.build-complete +0 -3
  6. package/layers/prisma/nodejs/package.json +0 -8
  7. package/management-ui/.eslintrc.js +0 -22
  8. package/management-ui/components.json +0 -21
  9. package/management-ui/docs/phase2-integration-guide.md +0 -320
  10. package/management-ui/index.html +0 -13
  11. package/management-ui/package.json +0 -76
  12. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +0 -302
  13. package/management-ui/postcss.config.js +0 -6
  14. package/management-ui/server/api/backend.js +0 -256
  15. package/management-ui/server/api/cli.js +0 -315
  16. package/management-ui/server/api/codegen.js +0 -663
  17. package/management-ui/server/api/connections.js +0 -857
  18. package/management-ui/server/api/discovery.js +0 -185
  19. package/management-ui/server/api/environment/index.js +0 -1
  20. package/management-ui/server/api/environment/router.js +0 -378
  21. package/management-ui/server/api/environment.js +0 -328
  22. package/management-ui/server/api/integrations.js +0 -876
  23. package/management-ui/server/api/logs.js +0 -248
  24. package/management-ui/server/api/monitoring.js +0 -282
  25. package/management-ui/server/api/open-ide.js +0 -31
  26. package/management-ui/server/api/project.js +0 -1029
  27. package/management-ui/server/api/users/sessions.js +0 -371
  28. package/management-ui/server/api/users/simulation.js +0 -254
  29. package/management-ui/server/api/users.js +0 -362
  30. package/management-ui/server/api-contract.md +0 -275
  31. package/management-ui/server/index.js +0 -873
  32. package/management-ui/server/middleware/errorHandler.js +0 -93
  33. package/management-ui/server/middleware/security.js +0 -32
  34. package/management-ui/server/processManager.js +0 -296
  35. package/management-ui/server/server.js +0 -346
  36. package/management-ui/server/services/aws-monitor.js +0 -413
  37. package/management-ui/server/services/npm-registry.js +0 -347
  38. package/management-ui/server/services/template-engine.js +0 -538
  39. package/management-ui/server/utils/cliIntegration.js +0 -220
  40. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  41. package/management-ui/server/utils/environment/awsParameterStore.js +0 -275
  42. package/management-ui/server/utils/environment/encryption.js +0 -278
  43. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  44. package/management-ui/server/utils/import-commonjs.js +0 -28
  45. package/management-ui/server/utils/response.js +0 -83
  46. package/management-ui/server/websocket/handler.js +0 -325
  47. package/management-ui/src/App.jsx +0 -25
  48. package/management-ui/src/assets/FriggLogo.svg +0 -1
  49. package/management-ui/src/components/AppRouter.jsx +0 -65
  50. package/management-ui/src/components/Button.jsx +0 -70
  51. package/management-ui/src/components/Card.jsx +0 -97
  52. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  53. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  54. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  55. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  56. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  57. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  58. package/management-ui/src/components/IntegrationCard.jsx +0 -481
  59. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -770
  60. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  61. package/management-ui/src/components/IntegrationStatus.jsx +0 -336
  62. package/management-ui/src/components/Layout.jsx +0 -716
  63. package/management-ui/src/components/LoadingSpinner.jsx +0 -113
  64. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  65. package/management-ui/src/components/SessionMonitor.jsx +0 -350
  66. package/management-ui/src/components/StatusBadge.jsx +0 -208
  67. package/management-ui/src/components/UserContextSwitcher.jsx +0 -212
  68. package/management-ui/src/components/UserSimulation.jsx +0 -327
  69. package/management-ui/src/components/Welcome.jsx +0 -434
  70. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  71. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  72. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  73. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  74. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  75. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  76. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  77. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  78. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  79. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  80. package/management-ui/src/components/codegen/index.js +0 -10
  81. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  82. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  83. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  84. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  85. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  86. package/management-ui/src/components/connections/index.js +0 -5
  87. package/management-ui/src/components/index.js +0 -21
  88. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  89. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  90. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  91. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  92. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  93. package/management-ui/src/components/monitoring/index.js +0 -6
  94. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  95. package/management-ui/src/components/theme-provider.jsx +0 -52
  96. package/management-ui/src/components/theme-toggle.jsx +0 -39
  97. package/management-ui/src/components/ui/badge.tsx +0 -36
  98. package/management-ui/src/components/ui/button.test.jsx +0 -56
  99. package/management-ui/src/components/ui/button.tsx +0 -57
  100. package/management-ui/src/components/ui/card.tsx +0 -76
  101. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  102. package/management-ui/src/components/ui/select.tsx +0 -157
  103. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  104. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  105. package/management-ui/src/hooks/useSocket.jsx +0 -58
  106. package/management-ui/src/index.css +0 -193
  107. package/management-ui/src/lib/utils.ts +0 -6
  108. package/management-ui/src/main.jsx +0 -10
  109. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  110. package/management-ui/src/pages/Connections.jsx +0 -252
  111. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -633
  112. package/management-ui/src/pages/Dashboard.jsx +0 -311
  113. package/management-ui/src/pages/Environment.jsx +0 -314
  114. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -669
  115. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -567
  116. package/management-ui/src/pages/IntegrationTest.jsx +0 -742
  117. package/management-ui/src/pages/Integrations.jsx +0 -253
  118. package/management-ui/src/pages/Monitoring.jsx +0 -17
  119. package/management-ui/src/pages/Simulation.jsx +0 -155
  120. package/management-ui/src/pages/Users.jsx +0 -492
  121. package/management-ui/src/services/api.js +0 -41
  122. package/management-ui/src/services/apiModuleService.js +0 -193
  123. package/management-ui/src/services/websocket-handlers.js +0 -120
  124. package/management-ui/src/test/api/project.test.js +0 -273
  125. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  126. package/management-ui/src/test/mocks/server.js +0 -178
  127. package/management-ui/src/test/setup.js +0 -61
  128. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  129. package/management-ui/src/utils/repository.js +0 -98
  130. package/management-ui/src/utils/repository.test.js +0 -118
  131. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  132. package/management-ui/tailwind.config.js +0 -63
  133. package/management-ui/tsconfig.json +0 -37
  134. package/management-ui/tsconfig.node.json +0 -10
  135. package/management-ui/vite.config.js +0 -26
  136. package/management-ui/vitest.config.js +0 -38
  137. package/test/auther-definition-method-tester.js +0 -45
  138. package/test/index.js +0 -9
  139. package/test/integration-validator.js +0 -2
  140. package/test/mock-api-readme.md +0 -102
  141. package/test/mock-api.js +0 -284
  142. package/test/mock-integration.js +0 -78
@@ -1,21 +0,0 @@
1
- // Layout components
2
- export { default as Layout } from './Layout'
3
- export { default as ErrorBoundary } from './ErrorBoundary'
4
-
5
- // UI components
6
- export { Card, CardHeader, CardContent, CardTitle, CardDescription } from './Card'
7
- export { Button } from './Button'
8
- export { default as StatusBadge } from './StatusBadge'
9
- export { default as LoadingSpinner } from './LoadingSpinner'
10
- export { default as IntegrationCard } from './IntegrationCard'
11
- export { default as UserContextSwitcher } from './UserContextSwitcher'
12
-
13
- // Connection components
14
- export * from './connections'
15
-
16
- // Environment components
17
- export { default as EnvironmentEditor } from './EnvironmentEditor'
18
- export { default as EnvironmentSchema } from './EnvironmentSchema'
19
- export { default as EnvironmentCompare } from './EnvironmentCompare'
20
- export { default as EnvironmentImportExport } from './EnvironmentImportExport'
21
- export { default as EnvironmentSecurity } from './EnvironmentSecurity'
@@ -1,222 +0,0 @@
1
- import React from 'react'
2
- import { Card } from '../Card'
3
- import { StatusBadge } from '../StatusBadge'
4
-
5
- /**
6
- * API Gateway Metrics Component
7
- * Displays detailed metrics for AWS API Gateway endpoints
8
- */
9
- function APIGatewayMetrics({ metrics }) {
10
- if (!metrics || metrics.error) {
11
- return (
12
- <Card>
13
- <div className="text-center py-8 text-gray-500">
14
- {metrics?.error || 'No API Gateway metrics available'}
15
- </div>
16
- </Card>
17
- )
18
- }
19
-
20
- const { apis = [] } = metrics
21
-
22
- const getStatusFromMetrics = (api) => {
23
- if (api.metrics?.['5xxerror'] > 0) return 'error'
24
- if (api.metrics?.['4xxerror'] > 0) return 'warning'
25
- if (api.metrics?.count > 0) return 'success'
26
- return 'inactive'
27
- }
28
-
29
- const formatLatency = (latency) => {
30
- if (!latency) return '0ms'
31
- return `${Math.round(latency)}ms`
32
- }
33
-
34
- return (
35
- <div className="space-y-4">
36
- <Card>
37
- <h3 className="text-lg font-semibold mb-4">
38
- API Gateways ({apis.length})
39
- </h3>
40
-
41
- {apis.length === 0 ? (
42
- <p className="text-gray-500">No API Gateways found for this service</p>
43
- ) : (
44
- <div className="space-y-4">
45
- {apis.map((api, index) => (
46
- <div key={index} className="border rounded-lg p-4">
47
- <div className="flex items-start justify-between mb-2">
48
- <div>
49
- <h4 className="font-semibold">{api.apiName}</h4>
50
- <div className="text-sm text-gray-600">
51
- <span>ID: {api.apiId}</span>
52
- {api.description && (
53
- <span className="ml-4">{api.description}</span>
54
- )}
55
- </div>
56
- </div>
57
- <StatusBadge
58
- status={getStatusFromMetrics(api)}
59
- text={getStatusFromMetrics(api)}
60
- />
61
- </div>
62
-
63
- {api.metrics && (
64
- <div className="grid grid-cols-2 md:grid-cols-6 gap-4 mt-4">
65
- <div>
66
- <div className="text-sm text-gray-600">Total Requests</div>
67
- <div className="text-xl font-mono">
68
- {api.metrics.count || 0}
69
- </div>
70
- </div>
71
- <div>
72
- <div className="text-sm text-gray-600">4XX Errors</div>
73
- <div className="text-xl font-mono text-yellow-600">
74
- {api.metrics['4xxerror'] || 0}
75
- </div>
76
- </div>
77
- <div>
78
- <div className="text-sm text-gray-600">5XX Errors</div>
79
- <div className="text-xl font-mono text-red-600">
80
- {api.metrics['5xxerror'] || 0}
81
- </div>
82
- </div>
83
- <div>
84
- <div className="text-sm text-gray-600">Error Rate</div>
85
- <div className="text-xl font-mono">
86
- {api.metrics.errorRate?.toFixed(2) || 0}%
87
- </div>
88
- </div>
89
- <div>
90
- <div className="text-sm text-gray-600">Avg Latency</div>
91
- <div className="text-xl font-mono">
92
- {formatLatency(api.metrics.latency)}
93
- </div>
94
- </div>
95
- <div>
96
- <div className="text-sm text-gray-600">Integration</div>
97
- <div className="text-xl font-mono">
98
- {formatLatency(api.metrics.integrationlatency)}
99
- </div>
100
- </div>
101
- </div>
102
- )}
103
-
104
- {api.metrics && (api.metrics['5xxerror'] > 0 || api.metrics.errorRate > 5) && (
105
- <div className="mt-3 p-3 bg-red-50 rounded text-sm">
106
- {api.metrics['5xxerror'] > 0 && (
107
- <div className="text-red-700">
108
- ⚠️ Server errors detected. Check Lambda function logs and API Gateway execution logs.
109
- </div>
110
- )}
111
- {api.metrics.errorRate > 5 && (
112
- <div className="text-yellow-700">
113
- ⚠️ High error rate detected ({api.metrics.errorRate.toFixed(2)}%). Review recent deployments.
114
- </div>
115
- )}
116
- </div>
117
- )}
118
-
119
- <div className="text-xs text-gray-500 mt-2">
120
- Created: {new Date(api.createdDate).toLocaleString()}
121
- </div>
122
- </div>
123
- ))}
124
- </div>
125
- )}
126
- </Card>
127
-
128
- {/* Performance Analysis */}
129
- {apis.length > 0 && apis.some(api => api.metrics?.count > 0) && (
130
- <Card>
131
- <h3 className="text-lg font-semibold mb-4">Performance Analysis</h3>
132
- <div className="space-y-4">
133
- {/* Latency Distribution */}
134
- <div>
135
- <h4 className="font-medium mb-2">Latency Breakdown</h4>
136
- <div className="space-y-2">
137
- {apis.filter(api => api.metrics?.latency > 0).map((api, index) => {
138
- const totalLatency = api.metrics.latency || 0
139
- const integrationLatency = api.metrics.integrationlatency || 0
140
- const gatewayLatency = totalLatency - integrationLatency
141
-
142
- return (
143
- <div key={index} className="flex items-center gap-2">
144
- <div className="w-32 text-sm truncate">{api.apiName}</div>
145
- <div className="flex-1 flex h-6 rounded overflow-hidden">
146
- <div
147
- className="bg-blue-500 flex items-center justify-center text-xs text-white"
148
- style={{ width: `${(gatewayLatency / totalLatency) * 100}%` }}
149
- >
150
- {formatLatency(gatewayLatency)}
151
- </div>
152
- <div
153
- className="bg-green-500 flex items-center justify-center text-xs text-white"
154
- style={{ width: `${(integrationLatency / totalLatency) * 100}%` }}
155
- >
156
- {formatLatency(integrationLatency)}
157
- </div>
158
- </div>
159
- <div className="text-sm font-mono w-20 text-right">
160
- {formatLatency(totalLatency)}
161
- </div>
162
- </div>
163
- )
164
- })}
165
- </div>
166
- <div className="flex gap-4 mt-2 text-xs">
167
- <div className="flex items-center gap-1">
168
- <div className="w-3 h-3 bg-blue-500 rounded"></div>
169
- <span>Gateway Overhead</span>
170
- </div>
171
- <div className="flex items-center gap-1">
172
- <div className="w-3 h-3 bg-green-500 rounded"></div>
173
- <span>Integration (Lambda)</span>
174
- </div>
175
- </div>
176
- </div>
177
-
178
- {/* Summary Statistics */}
179
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4 pt-4 border-t">
180
- <div>
181
- <div className="text-sm text-gray-600">Total Requests</div>
182
- <div className="text-2xl font-mono">
183
- {apis.reduce((sum, api) => sum + (api.metrics?.count || 0), 0)}
184
- </div>
185
- </div>
186
- <div>
187
- <div className="text-sm text-gray-600">Total Errors</div>
188
- <div className="text-2xl font-mono text-red-600">
189
- {apis.reduce((sum, api) => sum + (api.metrics?.['4xxerror'] || 0) + (api.metrics?.['5xxerror'] || 0), 0)}
190
- </div>
191
- </div>
192
- <div>
193
- <div className="text-sm text-gray-600">Avg Error Rate</div>
194
- <div className="text-2xl font-mono">
195
- {(() => {
196
- const validApis = apis.filter(api => api.metrics?.count > 0)
197
- if (validApis.length === 0) return '0%'
198
- const avgErrorRate = validApis.reduce((sum, api) => sum + (api.metrics.errorRate || 0), 0) / validApis.length
199
- return `${avgErrorRate.toFixed(2)}%`
200
- })()}
201
- </div>
202
- </div>
203
- <div>
204
- <div className="text-sm text-gray-600">Avg Latency</div>
205
- <div className="text-2xl font-mono">
206
- {(() => {
207
- const validApis = apis.filter(api => api.metrics?.latency > 0)
208
- if (validApis.length === 0) return '0ms'
209
- const avgLatency = validApis.reduce((sum, api) => sum + api.metrics.latency, 0) / validApis.length
210
- return formatLatency(avgLatency)
211
- })()}
212
- </div>
213
- </div>
214
- </div>
215
- </div>
216
- </Card>
217
- )}
218
- </div>
219
- )
220
- }
221
-
222
- export default APIGatewayMetrics
@@ -1,169 +0,0 @@
1
- import React from 'react'
2
- import { Card } from '../Card'
3
- import { StatusBadge } from '../StatusBadge'
4
-
5
- /**
6
- * Lambda Functions Metrics Component
7
- * Displays detailed metrics for AWS Lambda functions
8
- */
9
- function LambdaMetrics({ metrics }) {
10
- if (!metrics || metrics.error) {
11
- return (
12
- <Card>
13
- <div className="text-center py-8 text-gray-500">
14
- {metrics?.error || 'No Lambda metrics available'}
15
- </div>
16
- </Card>
17
- )
18
- }
19
-
20
- const { functions = [] } = metrics
21
-
22
- const getStatusFromMetrics = (fn) => {
23
- if (fn.metrics?.errors > 0) return 'error'
24
- if (fn.metrics?.throttles > 0) return 'warning'
25
- if (fn.metrics?.invocations > 0) return 'success'
26
- return 'inactive'
27
- }
28
-
29
- const formatDuration = (duration) => {
30
- if (!duration) return '0ms'
31
- if (duration < 1000) return `${Math.round(duration)}ms`
32
- return `${(duration / 1000).toFixed(2)}s`
33
- }
34
-
35
- return (
36
- <div className="space-y-4">
37
- <Card>
38
- <h3 className="text-lg font-semibold mb-4">
39
- Lambda Functions ({functions.length})
40
- </h3>
41
-
42
- {functions.length === 0 ? (
43
- <p className="text-gray-500">No Lambda functions found for this service</p>
44
- ) : (
45
- <div className="space-y-4">
46
- {functions.map((fn, index) => (
47
- <div key={index} className="border rounded-lg p-4">
48
- <div className="flex items-start justify-between mb-2">
49
- <div>
50
- <h4 className="font-semibold">{fn.functionName}</h4>
51
- <div className="text-sm text-gray-600 space-x-4">
52
- <span>Runtime: {fn.runtime}</span>
53
- <span>Memory: {fn.memorySize}MB</span>
54
- <span>Timeout: {fn.timeout}s</span>
55
- </div>
56
- </div>
57
- <StatusBadge
58
- status={getStatusFromMetrics(fn)}
59
- text={getStatusFromMetrics(fn)}
60
- />
61
- </div>
62
-
63
- {fn.metrics && (
64
- <div className="grid grid-cols-2 md:grid-cols-5 gap-4 mt-4">
65
- <div>
66
- <div className="text-sm text-gray-600">Invocations</div>
67
- <div className="text-xl font-mono">
68
- {fn.metrics.invocations || 0}
69
- </div>
70
- </div>
71
- <div>
72
- <div className="text-sm text-gray-600">Errors</div>
73
- <div className="text-xl font-mono text-red-600">
74
- {fn.metrics.errors || 0}
75
- </div>
76
- </div>
77
- <div>
78
- <div className="text-sm text-gray-600">Avg Duration</div>
79
- <div className="text-xl font-mono">
80
- {formatDuration(fn.metrics.duration)}
81
- </div>
82
- </div>
83
- <div>
84
- <div className="text-sm text-gray-600">Throttles</div>
85
- <div className="text-xl font-mono text-yellow-600">
86
- {fn.metrics.throttles || 0}
87
- </div>
88
- </div>
89
- <div>
90
- <div className="text-sm text-gray-600">Concurrent</div>
91
- <div className="text-xl font-mono">
92
- {Math.round(fn.metrics.concurrentexecutions || 0)}
93
- </div>
94
- </div>
95
- </div>
96
- )}
97
-
98
- {fn.metrics && (fn.metrics.errors > 0 || fn.metrics.throttles > 0) && (
99
- <div className="mt-3 p-3 bg-red-50 rounded text-sm">
100
- {fn.metrics.errors > 0 && (
101
- <div className="text-red-700">
102
- ⚠️ This function has errors. Check CloudWatch logs for details.
103
- </div>
104
- )}
105
- {fn.metrics.throttles > 0 && (
106
- <div className="text-yellow-700">
107
- ⚠️ This function is being throttled. Consider increasing reserved concurrency.
108
- </div>
109
- )}
110
- </div>
111
- )}
112
-
113
- <div className="text-xs text-gray-500 mt-2">
114
- Last modified: {new Date(fn.lastModified).toLocaleString()}
115
- </div>
116
- </div>
117
- ))}
118
- </div>
119
- )}
120
- </Card>
121
-
122
- {/* Summary Statistics */}
123
- {functions.length > 0 && (
124
- <Card>
125
- <h3 className="text-lg font-semibold mb-4">Summary Statistics</h3>
126
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
127
- <div>
128
- <div className="text-sm text-gray-600">Total Invocations</div>
129
- <div className="text-2xl font-mono">
130
- {functions.reduce((sum, fn) => sum + (fn.metrics?.invocations || 0), 0)}
131
- </div>
132
- </div>
133
- <div>
134
- <div className="text-sm text-gray-600">Total Errors</div>
135
- <div className="text-2xl font-mono text-red-600">
136
- {functions.reduce((sum, fn) => sum + (fn.metrics?.errors || 0), 0)}
137
- </div>
138
- </div>
139
- <div>
140
- <div className="text-sm text-gray-600">Error Rate</div>
141
- <div className="text-2xl font-mono">
142
- {(() => {
143
- const totalInvocations = functions.reduce((sum, fn) => sum + (fn.metrics?.invocations || 0), 0)
144
- const totalErrors = functions.reduce((sum, fn) => sum + (fn.metrics?.errors || 0), 0)
145
- return totalInvocations > 0
146
- ? `${((totalErrors / totalInvocations) * 100).toFixed(2)}%`
147
- : '0%'
148
- })()}
149
- </div>
150
- </div>
151
- <div>
152
- <div className="text-sm text-gray-600">Avg Duration</div>
153
- <div className="text-2xl font-mono">
154
- {(() => {
155
- const validFunctions = functions.filter(fn => fn.metrics?.duration > 0)
156
- if (validFunctions.length === 0) return '0ms'
157
- const avgDuration = validFunctions.reduce((sum, fn) => sum + fn.metrics.duration, 0) / validFunctions.length
158
- return formatDuration(avgDuration)
159
- })()}
160
- </div>
161
- </div>
162
- </div>
163
- </Card>
164
- )}
165
- </div>
166
- )
167
- }
168
-
169
- export default LambdaMetrics
@@ -1,197 +0,0 @@
1
- import React from 'react'
2
- import { Card } from '../Card'
3
-
4
- /**
5
- * Metrics Charts Component
6
- * Displays visual charts for metrics data
7
- * Note: This is a placeholder for future chart implementation
8
- */
9
- function MetricsChart({ metrics }) {
10
- if (!metrics) {
11
- return (
12
- <Card>
13
- <div className="text-center py-8 text-gray-500">
14
- No metrics data available for charting
15
- </div>
16
- </Card>
17
- )
18
- }
19
-
20
- // Simple bar chart implementation using CSS
21
- const renderSimpleBarChart = (data, title, color = 'blue') => {
22
- if (!data || data.length === 0) return null
23
-
24
- const maxValue = Math.max(...data.map(d => d.value))
25
-
26
- return (
27
- <div className="mb-6">
28
- <h4 className="font-medium mb-3">{title}</h4>
29
- <div className="space-y-2">
30
- {data.map((item, index) => (
31
- <div key={index} className="flex items-center gap-3">
32
- <div className="w-32 text-sm truncate">{item.label}</div>
33
- <div className="flex-1 flex items-center">
34
- <div className="flex-1 bg-gray-200 rounded h-6 relative">
35
- <div
36
- className={`bg-${color}-500 h-full rounded transition-all duration-300`}
37
- style={{ width: `${(item.value / maxValue) * 100}%` }}
38
- />
39
- </div>
40
- <span className="ml-2 text-sm font-mono w-16 text-right">
41
- {item.value}
42
- </span>
43
- </div>
44
- </div>
45
- ))}
46
- </div>
47
- </div>
48
- )
49
- }
50
-
51
- // Prepare chart data
52
- const lambdaInvocationsData = metrics.lambda?.functions?.map(fn => ({
53
- label: fn.functionName.split('-').pop() || fn.functionName,
54
- value: fn.metrics?.invocations || 0
55
- })) || []
56
-
57
- const lambdaErrorsData = metrics.lambda?.functions?.map(fn => ({
58
- label: fn.functionName.split('-').pop() || fn.functionName,
59
- value: fn.metrics?.errors || 0
60
- })) || []
61
-
62
- const apiRequestsData = metrics.apiGateway?.apis?.map(api => ({
63
- label: api.apiName.split('-').pop() || api.apiName,
64
- value: api.metrics?.count || 0
65
- })) || []
66
-
67
- const queueMessagesData = metrics.sqs?.queues?.map(queue => ({
68
- label: queue.queueName.split('-').pop() || queue.queueName,
69
- value: (queue.messagesAvailable || 0) + (queue.messagesInFlight || 0)
70
- })) || []
71
-
72
- return (
73
- <div className="space-y-6">
74
- <Card>
75
- <h3 className="text-lg font-semibold mb-4">Metrics Visualization</h3>
76
- <p className="text-gray-600 mb-6">
77
- Visual representation of your Frigg application metrics.
78
- Charts are updated in real-time as new metrics are collected.
79
- </p>
80
-
81
- {/* Lambda Invocations Chart */}
82
- {lambdaInvocationsData.length > 0 && (
83
- renderSimpleBarChart(
84
- lambdaInvocationsData.filter(d => d.value > 0),
85
- 'Lambda Function Invocations (Last Hour)',
86
- 'blue'
87
- )
88
- )}
89
-
90
- {/* Lambda Errors Chart */}
91
- {lambdaErrorsData.some(d => d.value > 0) && (
92
- renderSimpleBarChart(
93
- lambdaErrorsData.filter(d => d.value > 0),
94
- 'Lambda Function Errors (Last Hour)',
95
- 'red'
96
- )
97
- )}
98
-
99
- {/* API Gateway Requests Chart */}
100
- {apiRequestsData.length > 0 && (
101
- renderSimpleBarChart(
102
- apiRequestsData.filter(d => d.value > 0),
103
- 'API Gateway Requests (Last Hour)',
104
- 'green'
105
- )
106
- )}
107
-
108
- {/* SQS Messages Chart */}
109
- {queueMessagesData.length > 0 && (
110
- renderSimpleBarChart(
111
- queueMessagesData.filter(d => d.value > 0),
112
- 'SQS Queue Messages',
113
- 'yellow'
114
- )
115
- )}
116
-
117
- {/* Performance Comparison */}
118
- {metrics.lambda?.functions?.length > 0 && (
119
- <div className="mt-8">
120
- <h4 className="font-medium mb-3">Average Duration Comparison</h4>
121
- <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
122
- {metrics.lambda.functions
123
- .filter(fn => fn.metrics?.duration > 0)
124
- .sort((a, b) => (b.metrics?.duration || 0) - (a.metrics?.duration || 0))
125
- .map((fn, index) => (
126
- <div key={index} className="border rounded p-3">
127
- <div className="text-sm font-medium truncate">
128
- {fn.functionName.split('-').pop() || fn.functionName}
129
- </div>
130
- <div className="text-2xl font-mono">
131
- {fn.metrics.duration < 1000
132
- ? `${Math.round(fn.metrics.duration)}ms`
133
- : `${(fn.metrics.duration / 1000).toFixed(2)}s`
134
- }
135
- </div>
136
- <div className="text-xs text-gray-500">
137
- {fn.metrics.invocations} invocations
138
- </div>
139
- </div>
140
- ))
141
- }
142
- </div>
143
- </div>
144
- )}
145
-
146
- {/* Health Score */}
147
- <div className="mt-8 p-4 bg-gray-50 rounded">
148
- <h4 className="font-medium mb-2">System Health Score</h4>
149
- <div className="flex items-center gap-4">
150
- <div className="flex-1">
151
- {(() => {
152
- const totalInvocations = metrics.lambda?.functions?.reduce(
153
- (sum, fn) => sum + (fn.metrics?.invocations || 0), 0
154
- ) || 0
155
- const totalErrors = metrics.lambda?.functions?.reduce(
156
- (sum, fn) => sum + (fn.metrics?.errors || 0), 0
157
- ) || 0
158
- const errorRate = totalInvocations > 0 ? (totalErrors / totalInvocations) * 100 : 0
159
- const healthScore = Math.max(0, 100 - errorRate * 10)
160
-
161
- let healthColor = 'green'
162
- if (healthScore < 80) healthColor = 'yellow'
163
- if (healthScore < 60) healthColor = 'red'
164
-
165
- return (
166
- <>
167
- <div className="flex justify-between text-sm mb-1">
168
- <span>Overall Health</span>
169
- <span>{Math.round(healthScore)}%</span>
170
- </div>
171
- <div className="w-full bg-gray-200 rounded-full h-4">
172
- <div
173
- className={`bg-${healthColor}-500 h-4 rounded-full transition-all duration-300`}
174
- style={{ width: `${healthScore}%` }}
175
- />
176
- </div>
177
- <div className="text-xs text-gray-600 mt-1">
178
- Based on error rates and response times
179
- </div>
180
- </>
181
- )
182
- })()}
183
- </div>
184
- </div>
185
- </div>
186
-
187
- {/* Future Chart Integration Notice */}
188
- <div className="mt-8 p-4 bg-blue-50 rounded text-sm text-blue-700">
189
- <strong>Coming Soon:</strong> Interactive time-series charts with Chart.js or D3.js
190
- for historical trend analysis and real-time metric streaming.
191
- </div>
192
- </Card>
193
- </div>
194
- )
195
- }
196
-
197
- export default MetricsChart