diff --git a/assets/js/influxdb-version-detector.ts b/assets/js/influxdb-version-detector.ts index 9f94babb5b..d39512224b 100644 --- a/assets/js/influxdb-version-detector.ts +++ b/assets/js/influxdb-version-detector.ts @@ -182,6 +182,24 @@ class InfluxDBVersionDetector { private restartBtn: HTMLElement | null = null; private currentContext: 'questionnaire' | 'result' = 'questionnaire'; + /** Example host URLs for each product type */ + private static readonly HOST_EXAMPLES: Record = { + influxdb3_core: 'http://localhost:8181', + influxdb3_enterprise: 'http://localhost:8181', + influxdb3_cloud_serverless: 'https://cloud2.influxdata.com', + influxdb3_cloud_dedicated: 'https://cluster-id.a.influxdb.io', + influxdb3_clustered: 'https://cluster-host.com', + influxdb_v1: 'http://localhost:8086', + influxdb_v2: 'http://localhost:8086', + }; + + /** Default host URL (InfluxDB v2 localhost) */ + private static readonly DEFAULT_HOST = + InfluxDBVersionDetector.HOST_EXAMPLES.influxdb_v2; + + /** Default host:port without protocol (for curl examples) */ + private static readonly DEFAULT_HOST_PORT = 'localhost:8086'; + constructor(options: ComponentOptions) { this.container = options.component; @@ -627,17 +645,10 @@ class InfluxDBVersionDetector { } // Fallback based on product type - const hostExamples: Record = { - influxdb3_core: 'http://localhost:8181', - influxdb3_enterprise: 'http://localhost:8181', - influxdb3_cloud_serverless: 'https://cloud2.influxdata.com', - influxdb3_cloud_dedicated: 'https://cluster-id.a.influxdb.io', - influxdb3_clustered: 'https://cluster-host.com', - influxdb_v1: 'http://localhost:8086', - influxdb_v2: 'http://localhost:8086', - }; - - return hostExamples[productDataKey] || 'http://localhost:8086'; + return ( + InfluxDBVersionDetector.HOST_EXAMPLES[productDataKey] || + InfluxDBVersionDetector.DEFAULT_HOST + ); } private usesDatabaseTerminology(productConfig: ProductConfig): boolean { @@ -888,7 +899,7 @@ class InfluxDBVersionDetector {
+ placeholder="for example, https://us-east-1-1.aws.cloud2.influxdata.com or ${InfluxDBVersionDetector.DEFAULT_HOST}">