|
15 | 15 | :color="service.status === 'active' ? 'primary' : 'grey-lighten-2'" |
16 | 16 | :variant="service.status === 'active' ? 'elevated' : 'outlined'" |
17 | 17 | class="pa-4" |
18 | | - height="120" |
| 18 | + height="150" |
19 | 19 | @click="service.status === 'active' ? navigateToService(service.route): null" |
20 | 20 | style="cursor: pointer" |
21 | 21 | > |
@@ -127,10 +127,12 @@ import { ListFunctionsCommand } from '@aws-sdk/client-lambda' |
127 | 127 | import { ListBucketsCommand, ListObjectsV2Command, DeleteObjectsCommand, DeleteBucketCommand } from '@aws-sdk/client-s3' |
128 | 128 | import { ListTopicsCommand } from '@aws-sdk/client-sns' |
129 | 129 | import { ListQueuesCommand, DeleteQueueCommand } from '@aws-sdk/client-sqs' |
| 130 | +import { ListIdentitiesCommand } from '@aws-sdk/client-ses' |
| 131 | +import { deleteSesMessage, getSesData } from '@/utils/api.js' |
130 | 132 |
|
131 | 133 | const router = useRouter() |
132 | 134 | const appStore = useAppStore() |
133 | | -const { s3, sns, sqs, dynamodb, lambda, kinesis, kms } = storeToRefs(appStore) |
| 135 | +const { s3, ses, sns, sqs, dynamodb, lambda, kinesis, kms } = storeToRefs(appStore) |
134 | 136 |
|
135 | 137 | const services = ref([ |
136 | 138 | { |
@@ -168,6 +170,13 @@ const services = ref([ |
168 | 170 | status: 'inactive', |
169 | 171 | stats: null |
170 | 172 | }, |
| 173 | + { |
| 174 | + name: 'SES', |
| 175 | + icon: 'mdi-email', |
| 176 | + route: '/ses', |
| 177 | + status: 'inactive', |
| 178 | + stats: null |
| 179 | + }, |
171 | 180 | { |
172 | 181 | name: 'SNS', |
173 | 182 | icon: 'mdi-forum', |
@@ -206,6 +215,13 @@ const quickActions = ref([ |
206 | 215 | action: 'clearDynamoDB', |
207 | 216 | loading: false |
208 | 217 | }, |
| 218 | + { |
| 219 | + title: 'Limpar SES', |
| 220 | + icon: 'mdi-email-remove', |
| 221 | + color: 'error', |
| 222 | + action: 'clearSES', |
| 223 | + loading: false |
| 224 | + }, |
209 | 225 | { |
210 | 226 | title: 'Atualizar Status', |
211 | 227 | icon: 'mdi-refresh', |
@@ -290,28 +306,42 @@ const loadServiceStats = async () => { |
290 | 306 | services.value[4].status = 'inactive' |
291 | 307 | } |
292 | 308 |
|
293 | | - // SNS Stats |
| 309 | + // SES Stats |
294 | 310 | try { |
295 | | - const snsTopics = await sns.value.send(new ListTopicsCommand({})) |
| 311 | + const sesIdentities = await ses.value.send(new ListIdentitiesCommand({ IdentityType: 'EmailAddress' })) |
| 312 | + const sesData = await getSesData(); |
296 | 313 | services.value[5].status = 'active' |
297 | 314 | services.value[5].stats = { |
| 315 | + 'E-mails': sesData.messages ? sesData.messages.length : 0, |
| 316 | + 'Identidades': sesIdentities.Identities ? sesIdentities.Identities.length : 0 |
| 317 | + } |
| 318 | + } catch (error) { |
| 319 | + console.error('SES error:', error) |
| 320 | + services.value[5].status = 'inactive' |
| 321 | + } |
| 322 | +
|
| 323 | + // SNS Stats |
| 324 | + try { |
| 325 | + const snsTopics = await sns.value.send(new ListTopicsCommand({})) |
| 326 | + services.value[6].status = 'active' |
| 327 | + services.value[6].stats = { |
298 | 328 | 'Tópicos': snsTopics.Topics ? snsTopics.Topics.length : 0 |
299 | 329 | } |
300 | 330 | } catch (error) { |
301 | 331 | console.error('SNS error:', error) |
302 | | - services.value[5].status = 'inactive' |
| 332 | + services.value[6].status = 'inactive' |
303 | 333 | } |
304 | 334 |
|
305 | 335 | // SQS Stats |
306 | 336 | try { |
307 | 337 | const sqsQueues = await sqs.value.send(new ListQueuesCommand({})) |
308 | | - services.value[6].status = 'active' |
309 | | - services.value[6].stats = { |
| 338 | + services.value[7].status = 'active' |
| 339 | + services.value[7].stats = { |
310 | 340 | 'Filas': sqsQueues.QueueUrls ? sqsQueues.QueueUrls.length : 0 |
311 | 341 | } |
312 | 342 | } catch (error) { |
313 | 343 | console.error('SQS error:', error) |
314 | | - services.value[6].status = 'inactive' |
| 344 | + services.value[7].status = 'inactive' |
315 | 345 | } |
316 | 346 |
|
317 | 347 | } catch (error) { |
@@ -344,6 +374,11 @@ const executeQuickAction = (action) => { |
344 | 374 | text = 'Esta ação irá deletar todas as filas SQS. Deseja continuar?' |
345 | 375 | color = 'warning' |
346 | 376 | break |
| 377 | + case 'clearSES': |
| 378 | + title = 'Limpar todos os emails SES' |
| 379 | + text = 'Esta ação irá deletar todos os emails do SES. Deseja continuar?' |
| 380 | + color = 'error' |
| 381 | + break |
347 | 382 | case 'clearDynamoDB': |
348 | 383 | title = 'Limpar todas as tabelas DynamoDB' |
349 | 384 | text = 'Esta ação irá deletar todas as tabelas DynamoDB. Deseja continuar?' |
@@ -373,6 +408,9 @@ const performClearAction = async (action) => { |
373 | 408 | case 'clearSQS': |
374 | 409 | await clearAllSQSQueues() |
375 | 410 | break |
| 411 | + case 'clearSES': |
| 412 | + await clearAllSESData() |
| 413 | + break |
376 | 414 | case 'clearDynamoDB': |
377 | 415 | await clearAllDynamoDBTables() |
378 | 416 | break |
@@ -422,6 +460,10 @@ const clearAllSQSQueues = async () => { |
422 | 460 | } |
423 | 461 | } |
424 | 462 |
|
| 463 | +const clearAllSESData = async () => { |
| 464 | + await deleteSesMessage() |
| 465 | +} |
| 466 | +
|
425 | 467 | const clearAllDynamoDBTables = async () => { |
426 | 468 | const tables = await dynamodb.value.send(new ListTablesCommand({})) |
427 | 469 | |
|
0 commit comments