From f658ee9996041e23d078d6a97ee383842155468b Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 14 Sep 2022 18:38:03 +0100 Subject: [PATCH] ui: Add AWS Lambda as potential external source (#14605) * ui: Add AWS Lambda as potential external source * Update mocks to expect `lambda` as an external-source meta * Additional mock to make sure all our mocks only contain whats possible --- .../app/components/consul/external-source/index.scss | 1 + .../app/components/popover-select/index.scss | 1 + .../consul-ui/app/helpers/service/external-source.js | 11 ++++++++++- ui/packages/consul-ui/mock-api/v1/connect/_ | 11 ++++++++++- ui/packages/consul-ui/mock-api/v1/health/service/_ | 11 ++++++++++- .../mock-api/v1/internal/ui/gateway-services-nodes/_ | 11 ++++++++++- ui/packages/consul-ui/mock-api/v1/internal/ui/node/_ | 9 ++++++++- .../consul-ui/mock-api/v1/internal/ui/services | 11 ++++++++++- ui/packages/consul-ui/translations/common/en-us.yaml | 1 + 9 files changed, 61 insertions(+), 6 deletions(-) diff --git a/ui/packages/consul-ui/app/components/consul/external-source/index.scss b/ui/packages/consul-ui/app/components/consul/external-source/index.scss index b876b48fd..0b6656ede 100644 --- a/ui/packages/consul-ui/app/components/consul/external-source/index.scss +++ b/ui/packages/consul-ui/app/components/consul/external-source/index.scss @@ -22,6 +22,7 @@ .consul-external-source.vault::before { @extend %with-vault-300; } +.consul-external-source.lambda::before, .consul-external-source.aws::before { @extend %with-aws-300; } diff --git a/ui/packages/consul-ui/app/components/popover-select/index.scss b/ui/packages/consul-ui/app/components/popover-select/index.scss index 0f9a1b950..90dd0fd27 100644 --- a/ui/packages/consul-ui/app/components/popover-select/index.scss +++ b/ui/packages/consul-ui/app/components/popover-select/index.scss @@ -52,6 +52,7 @@ @extend %with-user-team-mask, %as-pseudo; color: rgb(var(--tone-gray-500)); } +%popover-select .lambda button::before, %popover-select .aws button::before { @extend %with-aws-300; } diff --git a/ui/packages/consul-ui/app/helpers/service/external-source.js b/ui/packages/consul-ui/app/helpers/service/external-source.js index c5ab7949b..97124316d 100644 --- a/ui/packages/consul-ui/app/helpers/service/external-source.js +++ b/ui/packages/consul-ui/app/helpers/service/external-source.js @@ -9,7 +9,16 @@ export function serviceExternalSource(params, hash) { const prefix = typeof hash.prefix === 'undefined' ? '' : hash.prefix; if ( source && - ['consul-api-gateway', 'vault', 'kubernetes', 'terraform', 'nomad', 'consul', 'aws'].includes( + [ + 'consul-api-gateway', + 'vault', + 'kubernetes', + 'terraform', + 'nomad', + 'consul', + 'aws', + 'lambda' + ].includes( source ) ) { diff --git a/ui/packages/consul-ui/mock-api/v1/connect/_ b/ui/packages/consul-ui/mock-api/v1/connect/_ index 2a618024d..65b0c5972 100644 --- a/ui/packages/consul-ui/mock-api/v1/connect/_ +++ b/ui/packages/consul-ui/mock-api/v1/connect/_ @@ -97,7 +97,16 @@ ${fake.helpers.randomize([ "Precedence": ${i + 1}, ${ fake.random.number({min: 1, max: 10}) > 2 ? ` "Meta": { - "external-source": "${fake.helpers.randomize(['kubernetes', 'consul-api-gateway'])}" + "external-source": "${fake.helpers.randomize([ + 'consul-api-gateway', + 'vault', + 'nomad', + 'terraform', + 'kubernetes', + 'aws', + 'lambda', + '' + ])}" }, ` : `` } "CreatedAt": "2018-05-21T16:41:27.977155457Z", diff --git a/ui/packages/consul-ui/mock-api/v1/health/service/_ b/ui/packages/consul-ui/mock-api/v1/health/service/_ index 0b0daa392..1a9bbedc2 100644 --- a/ui/packages/consul-ui/mock-api/v1/health/service/_ +++ b/ui/packages/consul-ui/mock-api/v1/health/service/_ @@ -87,7 +87,16 @@ ${typeof location.search.partition !== 'undefined' ? ` ${ fake.random.number({min: 1, max: 10}) > 2 ? ` "Meta": { "consul-dashboard-url": "${fake.internet.protocol()}://${fake.internet.domainName()}/?id={{Service}}", - "external-source": "${fake.helpers.randomize(['consul-api-gateway', 'vault', 'consul', 'nomad', 'terraform', 'kubernetes', 'aws', ''])}" + "external-source": "${fake.helpers.randomize([ + 'consul-api-gateway', + 'vault', + 'nomad', + 'terraform', + 'kubernetes', + 'aws', + 'lambda', + '' + ])}" }, ` : ` "Meta": null, diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/gateway-services-nodes/_ b/ui/packages/consul-ui/mock-api/v1/internal/ui/gateway-services-nodes/_ index 3bd119146..e4038ad0d 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/gateway-services-nodes/_ +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/gateway-services-nodes/_ @@ -50,7 +50,16 @@ ${ fake.random.number({min: 1, max: 10}) > 2 ? ` range(fake.random.number({min: 1, max: 1})).map( function(item, i) { - return `"${fake.helpers.randomize(['vault', 'consul', 'nomad', 'terraform', 'kubernetes', 'aws', ''])}"`; + return `"${fake.helpers.randomize([ + 'consul-api-gateway', + 'vault', + 'nomad', + 'terraform', + 'kubernetes', + 'aws', + 'lambda', + '' + ])}"`; } ) } diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/node/_ b/ui/packages/consul-ui/mock-api/v1/internal/ui/node/_ index 200e066a0..27afd9c8e 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/node/_ +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/node/_ @@ -63,7 +63,14 @@ return ` ], ${ fake.random.number({min: 1, max: 10}) > 2 ? ` "Meta": { - "external-source": "${fake.helpers.randomize(['consul-api-gateway', 'consul', 'nomad', 'terraform', 'kubernetes', ''])}" + "external-source": "${fake.helpers.randomize([ + 'consul-api-gateway', + 'consul', + 'nomad', + 'terraform', + 'kubernetes', + '' + ])}" }, ` : `` } "Address":"", diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/services b/ui/packages/consul-ui/mock-api/v1/internal/ui/services index 1a4a73250..f44e59d17 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/services +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/services @@ -90,7 +90,16 @@ ${ fake.random.number({min: 1, max: 10}) > 2 ? ` range(fake.random.number({min: 1, max: 1})).map( function(item, i) { - return `"${fake.helpers.randomize(['consul-api-gateway', 'vault', 'nomad', 'terraform', 'kubernetes', 'aws', ''])}"`; + return `"${fake.helpers.randomize([ + 'consul-api-gateway', + 'vault', + 'nomad', + 'terraform', + 'kubernetes', + 'aws', + 'lambda', + '' + ])}"`; } ) } diff --git a/ui/packages/consul-ui/translations/common/en-us.yaml b/ui/packages/consul-ui/translations/common/en-us.yaml index a096b0980..8fce90430 100644 --- a/ui/packages/consul-ui/translations/common/en-us.yaml +++ b/ui/packages/consul-ui/translations/common/en-us.yaml @@ -5,6 +5,7 @@ brand: nomad: Nomad vault: Vault aws: AWS + lambda: AWS Lambda aws-iam: AWS IAM kubernetes: Kubernetes jwt: JWT