Skip to content

Commit

Permalink
fix web UI db enrollment guide links
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinFrazar committed Oct 25, 2024
1 parent 4756f37 commit b3edb78
Showing 1 changed file with 95 additions and 32 deletions.
127 changes: 95 additions & 32 deletions web/packages/teleport/src/Discover/SelectResource/databases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
{
Expand All @@ -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,
},
];
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
{
Expand All @@ -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,
},
];
Expand Down

0 comments on commit b3edb78

Please sign in to comment.