From b3edb787bbaf246f69ce31f5a91af45f0c3fe16a Mon Sep 17 00:00:00 2001 From: Gavin Frazar Date: Fri, 25 Oct 2024 10:04:08 -0700 Subject: [PATCH] fix web UI db enrollment guide links --- .../src/Discover/SelectResource/databases.tsx | 127 +++++++++++++----- 1 file changed, 95 insertions(+), 32 deletions(-) diff --git a/web/packages/teleport/src/Discover/SelectResource/databases.tsx b/web/packages/teleport/src/Discover/SelectResource/databases.tsx index aaf4bc8190e34..1d648e91380b6 100644 --- a/web/packages/teleport/src/Discover/SelectResource/databases.tsx +++ b/web/packages/teleport/src/Discover/SelectResource/databases.tsx @@ -26,14 +26,23 @@ import { ResourceKind } from '../Shared/ResourceKind'; import { ResourceSpec, DatabaseLocation, DatabaseEngine } from './types'; +enum DatabaseGuideSection { + Aws = 'enroll-aws-databases', + Azure = 'enroll-azure-databases', + Gcp = 'enroll-google-cloud-databases', + Managed = 'enroll-managed-databases', + SelfHosted = 'enroll-self-hosted-databases', + Guides = 'guides', +} + const baseDatabaseKeywords = 'db database databases'; const awsKeywords = baseDatabaseKeywords + 'aws amazon web services'; const gcpKeywords = baseDatabaseKeywords + 'gcp google cloud provider'; const selfhostedKeywords = baseDatabaseKeywords + 'self hosted self-hosted'; const azureKeywords = baseDatabaseKeywords + 'microsoft azure'; -function getDbAccessDocLink(guide: string) { - return `https://goteleport.com/docs/database-access/guides/${guide}`; +function getDbAccessDocLink(subsection: DatabaseGuideSection, guide: string) { + return `https://goteleport.com/docs/enroll-resources/database-access/${subsection}/${guide}`; } // DATABASES_UNGUIDED_DOC are documentations that is not specific @@ -45,7 +54,10 @@ export const DATABASES_UNGUIDED_DOC: ResourceSpec[] = [ keywords: awsKeywords + 'rds proxy postgresql', kind: ResourceKind.Database, icon: 'aws', - unguidedLink: getDbAccessDocLink('rds-proxy-postgres'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'rds-proxy-postgres' + ), // TODO(lisa): add a new usage event event: DiscoverEventResource.DatabaseDocRdsProxy, }, @@ -55,7 +67,10 @@ export const DATABASES_UNGUIDED_DOC: ResourceSpec[] = [ keywords: awsKeywords + 'rds proxy sql server sqlserver', kind: ResourceKind.Database, icon: 'aws', - unguidedLink: getDbAccessDocLink('rds-proxy-sqlserver'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'rds-proxy-sqlserver' + ), // TODO(lisa): add a new usage event event: DiscoverEventResource.DatabaseDocRdsProxy, }, @@ -65,7 +80,10 @@ export const DATABASES_UNGUIDED_DOC: ResourceSpec[] = [ keywords: awsKeywords + 'rds proxy mariadb mysql', kind: ResourceKind.Database, icon: 'aws', - unguidedLink: getDbAccessDocLink('rds-proxy-mysql'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'rds-proxy-mysql' + ), // TODO(lisa): add a new usage event event: DiscoverEventResource.DatabaseDocRdsProxy, }, @@ -75,7 +93,7 @@ export const DATABASES_UNGUIDED_DOC: ResourceSpec[] = [ keywords: baseDatabaseKeywords + 'high availability ha', kind: ResourceKind.Database, icon: 'database', - unguidedLink: getDbAccessDocLink('ha'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Guides, 'ha'), event: DiscoverEventResource.DatabaseDocHighAvailability, }, { @@ -84,7 +102,10 @@ export const DATABASES_UNGUIDED_DOC: ResourceSpec[] = [ keywords: baseDatabaseKeywords + 'dynamic registration', kind: ResourceKind.Database, icon: 'database', - unguidedLink: getDbAccessDocLink('dynamic-registration'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Guides, + 'dynamic-registration' + ), event: DiscoverEventResource.DatabaseDocDynamicRegistration, }, ]; @@ -96,7 +117,7 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: awsKeywords + 'dynamodb', kind: ResourceKind.Database, icon: 'dynamo', - unguidedLink: getDbAccessDocLink('aws-dynamodb'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Aws, 'aws-dynamodb'), event: DiscoverEventResource.DatabaseDynamoDb, }, { @@ -105,7 +126,7 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: awsKeywords + 'elasticache memorydb redis', kind: ResourceKind.Database, icon: 'aws', - unguidedLink: getDbAccessDocLink('redis-aws'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Aws, 'redis-aws'), event: DiscoverEventResource.DatabaseRedisElasticache, }, { @@ -117,7 +138,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: awsKeywords + 'keyspaces apache cassandra', kind: ResourceKind.Database, icon: 'aws', - unguidedLink: getDbAccessDocLink('aws-cassandra-keyspaces'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'aws-cassandra-keyspaces' + ), event: DiscoverEventResource.DatabaseCassandraKeyspaces, }, { @@ -126,7 +150,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: awsKeywords + 'redshift postgresql', kind: ResourceKind.Database, icon: 'redshift', - unguidedLink: getDbAccessDocLink('postgres-redshift'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'postgres-redshift' + ), event: DiscoverEventResource.DatabasePostgresRedshift, }, { @@ -135,7 +162,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: awsKeywords + 'redshift serverless postgresql', kind: ResourceKind.Database, icon: 'redshift', - unguidedLink: getDbAccessDocLink('redshift-serverless'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Aws, + 'redshift-serverless' + ), event: DiscoverEventResource.DatabasePostgresRedshiftServerless, }, { @@ -144,7 +174,7 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: azureKeywords + 'cache redis', kind: ResourceKind.Database, icon: 'azure', - unguidedLink: getDbAccessDocLink('azure-redis'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Azure, 'azure-redis'), event: DiscoverEventResource.DatabaseRedisAzureCache, }, { @@ -156,7 +186,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: azureKeywords + 'postgresql', kind: ResourceKind.Database, icon: 'azure', - unguidedLink: getDbAccessDocLink('azure-postgres-mysql'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Azure, + 'azure-postgres-mysql' + ), event: DiscoverEventResource.DatabasePostgresAzure, }, { @@ -165,7 +198,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: azureKeywords + 'mysql', kind: ResourceKind.Database, icon: 'azure', - unguidedLink: getDbAccessDocLink('azure-postgres-mysql'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Azure, + 'azure-postgres-mysql' + ), event: DiscoverEventResource.DatabaseMysqlAzure, }, { @@ -178,22 +214,25 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ azureKeywords + 'active directory ad sql server sqlserver preview', kind: ResourceKind.Database, icon: 'azure', - unguidedLink: getDbAccessDocLink('azure-sql-server-ad'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Azure, + 'azure-sql-server-ad' + ), event: DiscoverEventResource.DatabaseSqlServerAzure, platform: Platform.Windows, }, { dbMeta: { - location: DatabaseLocation.Microsoft, + location: DatabaseLocation.Aws, engine: DatabaseEngine.SqlServer, }, - name: 'SQL Server', + name: 'RDS SQL Server', keywords: - baseDatabaseKeywords + - 'microsoft active directory ad sql server sqlserver preview', + awsKeywords + + 'rds microsoft active directory ad sql server sqlserver preview', kind: ResourceKind.Database, - icon: 'windows', - unguidedLink: getDbAccessDocLink('sql-server-ad'), + icon: 'aws', + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Aws, 'sql-server-ad'), event: DiscoverEventResource.DatabaseSqlServerMicrosoft, platform: Platform.Windows, }, @@ -203,7 +242,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: gcpKeywords + 'mysql', kind: ResourceKind.Database, icon: 'googlecloud', - unguidedLink: getDbAccessDocLink('mysql-cloudsql'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Gcp, + 'mysql-cloudsql' + ), event: DiscoverEventResource.DatabaseMysqlGcp, }, { @@ -212,7 +254,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: gcpKeywords + 'postgresql', kind: ResourceKind.Database, icon: 'googlecloud', - unguidedLink: getDbAccessDocLink('postgres-cloudsql'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Gcp, + 'postgres-cloudsql' + ), event: DiscoverEventResource.DatabasePostgresGcp, }, { @@ -224,7 +269,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: baseDatabaseKeywords + 'mongodb atlas', kind: ResourceKind.Database, icon: 'mongo', - unguidedLink: getDbAccessDocLink('mongodb-atlas'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.Managed, + 'mongodb-atlas' + ), event: DiscoverEventResource.DatabaseMongodbAtlas, }, { @@ -236,7 +284,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'cassandra scylladb', kind: ResourceKind.Database, icon: 'selfhosted', - unguidedLink: getDbAccessDocLink('cassandra-self-hosted'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.SelfHosted, + 'cassandra-self-hosted' + ), event: DiscoverEventResource.DatabaseCassandraSelfHosted, }, { @@ -248,7 +299,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'cockroachdb', kind: ResourceKind.Database, icon: 'cockroach', - unguidedLink: getDbAccessDocLink('cockroachdb-self-hosted'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.SelfHosted, + 'cockroachdb-self-hosted' + ), event: DiscoverEventResource.DatabaseCockroachDbSelfHosted, }, { @@ -260,7 +314,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'elasticsearch', kind: ResourceKind.Database, icon: 'selfhosted', - unguidedLink: getDbAccessDocLink('elastic'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.SelfHosted, + 'elastic' + ), event: DiscoverEventResource.DatabaseElasticSearchSelfHosted, }, { @@ -272,7 +329,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'mongodb', kind: ResourceKind.Database, icon: 'mongo', - unguidedLink: getDbAccessDocLink('mongodb-self-hosted'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.SelfHosted, + 'mongodb-self-hosted' + ), event: DiscoverEventResource.DatabaseMongodbSelfHosted, }, { @@ -284,7 +344,7 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'redis', kind: ResourceKind.Database, icon: 'selfhosted', - unguidedLink: getDbAccessDocLink('redis'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.SelfHosted, 'redis'), event: DiscoverEventResource.DatabaseRedisSelfHosted, }, { @@ -296,7 +356,10 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: selfhostedKeywords + 'redis cluster', kind: ResourceKind.Database, icon: 'selfhosted', - unguidedLink: getDbAccessDocLink('redis-cluster'), + unguidedLink: getDbAccessDocLink( + DatabaseGuideSection.SelfHosted, + 'redis-cluster' + ), event: DiscoverEventResource.DatabaseRedisClusterSelfHosted, }, { @@ -308,7 +371,7 @@ export const DATABASES_UNGUIDED: ResourceSpec[] = [ keywords: baseDatabaseKeywords + 'snowflake preview', kind: ResourceKind.Database, icon: 'snowflake', - unguidedLink: getDbAccessDocLink('snowflake'), + unguidedLink: getDbAccessDocLink(DatabaseGuideSection.Managed, 'snowflake'), event: DiscoverEventResource.DatabaseSnowflake, }, ];