Skip to content

Commit 5c7d340

Browse files
authored
Update the placeholder URL for dedicated (#5527)
* update the placeholder URL for dedicated * added dedicated URL migration
1 parent e851b00 commit 5c7d340

File tree

21 files changed

+85
-77
lines changed

21 files changed

+85
-77
lines changed

api-docs/cloud-dedicated/v2/content/servers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
variables:
44
baseurl:
55
enum:
6-
- 'cluster-id.influxdb.io'
7-
default: 'cluster-id.influxdb.io'
6+
- 'cluster-id.a.influxdb.io'
7+
default: 'cluster-id.a.influxdb.io'
88
description: InfluxDB Cloud Dedicated URL

api-docs/cloud-dedicated/v2/ref.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ servers:
1717
variables:
1818
baseurl:
1919
enum:
20-
- cluster-id.influxdb.io
21-
default: cluster-id.influxdb.io
20+
- cluster-id.a.influxdb.io
21+
default: cluster-id.a.influxdb.io
2222
description: InfluxDB Cloud Dedicated URL
2323
security:
2424
- BearerAuthentication: []
@@ -1996,7 +1996,7 @@ components:
19961996
# Use the --user option with `--user username:DATABASE_TOKEN` syntax
19971997
#######################################
19981998
1999-
curl --get "http://cluster-id.influxdb.io/query" \
1999+
curl --get "http://cluster-id.a.influxdb.io/query" \
20002000
--user "":"DATABASE_TOKEN" \
20012001
--data-urlencode "db=DATABASE_NAME" \
20022002
--data-urlencode "q=SELECT * FROM MEASUREMENT"
@@ -2024,8 +2024,8 @@ components:
20242024
### Syntax
20252025
20262026
```http
2027-
https://cluster-id.influxdb.io/query/?[u=any]&p=DATABASE_TOKEN
2028-
https://cluster-id.influxdb.io/write/?[u=any]&p=DATABASE_TOKEN
2027+
https://cluster-id.a.influxdb.io/query/?[u=any]&p=DATABASE_TOKEN
2028+
https://cluster-id.a.influxdb.io/write/?[u=any]&p=DATABASE_TOKEN
20292029
```
20302030
20312031
### Example
@@ -2041,7 +2041,7 @@ components:
20412041
# ?p=DATABASE_TOKEN
20422042
#######################################
20432043
2044-
curl --get "https://cluster-id.influxdb.io/query" \
2044+
curl --get "https://cluster-id.a.influxdb.io/query" \
20452045
--data-urlencode "p=DATABASE_TOKEN" \
20462046
--data-urlencode "db=DATABASE_NAME" \
20472047
--data-urlencode "q=SELECT * FROM MEASUREMENT"
@@ -2078,7 +2078,7 @@ components:
20782078
# to write data.
20792079
########################################################
20802080
2081-
curl --request post "https://cluster-id.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
2081+
curl --request post "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
20822082
--header "Authorization: Bearer DATABASE_TOKEN" \
20832083
--data-binary 'home,room=kitchen temp=72 1463683075'
20842084
```
@@ -2109,7 +2109,7 @@ components:
21092109
# to write data.
21102110
########################################################
21112111
2112-
curl --request post "https://cluster-id.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
2112+
curl --request post "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
21132113
--header "Authorization: Token DATABASE_TOKEN" \
21142114
--data-binary 'home,room=kitchen temp=72 1463683075'
21152115
```

api-docs/clustered/v2/ref.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ components:
19801980
# Use the --user option with `--user username:DATABASE_TOKEN` syntax
19811981
#######################################
19821982
1983-
curl --get "http://cluster-id.influxdb.io/query" \
1983+
curl --get "http://cluster-id.a.influxdb.io/query" \
19841984
--user "":"DATABASE_TOKEN" \
19851985
--data-urlencode "db=DATABASE_NAME" \
19861986
--data-urlencode "q=SELECT * FROM MEASUREMENT"
@@ -2008,8 +2008,8 @@ components:
20082008
### Syntax
20092009
20102010
```http
2011-
https://cluster-id.influxdb.io/query/?[u=any]&p=DATABASE_TOKEN
2012-
https://cluster-id.influxdb.io/write/?[u=any]&p=DATABASE_TOKEN
2011+
https://cluster-id.a.influxdb.io/query/?[u=any]&p=DATABASE_TOKEN
2012+
https://cluster-id.a.influxdb.io/write/?[u=any]&p=DATABASE_TOKEN
20132013
```
20142014
20152015
### Example
@@ -2025,7 +2025,7 @@ components:
20252025
# ?p=DATABASE_TOKEN
20262026
#######################################
20272027
2028-
curl --get "https://cluster-id.influxdb.io/query" \
2028+
curl --get "https://cluster-id.a.influxdb.io/query" \
20292029
--data-urlencode "p=DATABASE_TOKEN" \
20302030
--data-urlencode "db=DATABASE_NAME" \
20312031
--data-urlencode "q=SELECT * FROM MEASUREMENT"
@@ -2062,7 +2062,7 @@ components:
20622062
# to write data.
20632063
########################################################
20642064
2065-
curl --request post "https://cluster-id.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
2065+
curl --request post "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
20662066
--header "Authorization: Bearer DATABASE_TOKEN" \
20672067
--data-binary 'home,room=kitchen temp=72 1463683075'
20682068
```
@@ -2093,7 +2093,7 @@ components:
20932093
# to write data.
20942094
########################################################
20952095
2096-
curl --request post "https://cluster-id.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
2096+
curl --request post "https://cluster-id.a.influxdb.io/api/v2/write?bucket=DATABASE_NAME&precision=s" \
20972097
--header "Authorization: Token DATABASE_TOKEN" \
20982098
--data-binary 'home,room=kitchen temp=72 1463683075'
20992099
```

assets/js/cookies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var defaultUrls = {
9393
oss: 'http://localhost:8086',
9494
cloud: 'https://us-west-2-1.aws.cloud2.influxdata.com',
9595
serverless: 'https://us-east-1-1.aws.cloud2.influxdata.com',
96-
dedicated: 'cluster-id.influxdb.io',
96+
dedicated: 'cluster-id.a.influxdb.io',
9797
clustered: 'cluster-host.com',
9898
};
9999

assets/js/influxdb-url.js

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var placeholderUrls = {
22
oss: 'http://localhost:8086',
33
cloud: 'https://cloud2.influxdata.com',
44
serverless: 'https://cloud2.influxdata.com',
5-
dedicated: 'cluster-id.influxdb.io',
5+
dedicated: 'cluster-id.a.influxdb.io',
66
clustered: 'cluster-host.com',
77
};
88

@@ -13,7 +13,7 @@ var placeholderUrls = {
1313
var elementSelector = '.article--content pre:not(.preserve)';
1414

1515
// Return the page context (cloud, serverless, oss/enterprise, dedicated, clustered, other)
16-
function context () {
16+
function context() {
1717
if (/\/influxdb\/cloud\//.test(window.location.pathname)) {
1818
return 'cloud';
1919
} else if (/\/influxdb\/cloud-serverless/.test(window.location.pathname)) {
@@ -37,12 +37,12 @@ function context () {
3737

3838
// Retrieve the user's InfluxDB preference (cloud or oss) from the influxdb_pref session cookie
3939
// Default is cloud.
40-
function getURLPreference () {
40+
function getURLPreference() {
4141
return getPreference('influxdb_url');
4242
}
4343

4444
// Set the user's selected InfluxDB preference (cloud or oss)
45-
function setURLPreference (preference) {
45+
function setURLPreference(preference) {
4646
setPreference('influxdb_url', preference);
4747
}
4848

@@ -61,7 +61,7 @@ function setURLPreference (preference) {
6161
*/
6262

6363
// Store URLs in the urls session cookies
64-
function storeUrl (context, newUrl, prevUrl) {
64+
function storeUrl(context, newUrl, prevUrl) {
6565
urlsObj = {};
6666
urlsObj['prev_' + context] = prevUrl;
6767
urlsObj[context] = newUrl;
@@ -71,20 +71,20 @@ function storeUrl (context, newUrl, prevUrl) {
7171

7272
// Store custom URL in the url session cookie.
7373
// Used to populate the custom URL field
74-
function storeCustomUrl (customUrl) {
74+
function storeCustomUrl(customUrl) {
7575
setInfluxDBUrls({ custom: customUrl });
7676
$('input#custom[type=radio]').val(customUrl);
7777
}
7878

7979
// Set a URL in the urls session cookie to an empty string
8080
// Used to clear the form when custom url input is left empty
81-
function removeCustomUrl () {
81+
function removeCustomUrl() {
8282
removeInfluxDBUrl('custom');
8383
}
8484

8585
// Store a product URL in the urls session cookie
8686
// Used to populate the custom URL field
87-
function storeProductUrl (product, productUrl) {
87+
function storeProductUrl(product, productUrl) {
8888
urlsObj = {};
8989
urlsObj[product] = productUrl;
9090

@@ -94,7 +94,7 @@ function storeProductUrl (product, productUrl) {
9494

9595
// Set a product URL in the urls session cookie to an empty string
9696
// Used to clear the form when dedicated url input is left empty
97-
function removeProductUrl (product) {
97+
function removeProductUrl(product) {
9898
removeInfluxDBUrl(product);
9999
}
100100

@@ -104,7 +104,7 @@ function removeProductUrl (product) {
104104

105105
// Preserve URLs in codeblocks that come just after or are inside a div
106106
// with the class, .keep-url
107-
function addPreserve () {
107+
function addPreserve() {
108108
$('.keep-url').each(function () {
109109
// For code blocks with no syntax highlighting
110110
$(this).next('pre').addClass('preserve');
@@ -119,7 +119,7 @@ function addPreserve () {
119119
}
120120

121121
// Retrieve the currently selected URLs from the urls session cookie.
122-
function getUrls () {
122+
function getUrls() {
123123
var storedUrls = getInfluxDBUrls();
124124
var currentCloudUrl = storedUrls.cloud;
125125
var currentOSSUrl = storedUrls.oss;
@@ -138,7 +138,7 @@ function getUrls () {
138138

139139
// Retrieve the previously selected URLs from the from the urls session cookie.
140140
// This is used to update URLs whenever you switch between browser tabs.
141-
function getPrevUrls () {
141+
function getPrevUrls() {
142142
var storedUrls = getInfluxDBUrls();
143143
var prevCloudUrl = storedUrls.prev_cloud;
144144
var prevOSSUrl = storedUrls.prev_oss;
@@ -156,7 +156,7 @@ function getPrevUrls () {
156156
}
157157

158158
// Iterate through code blocks and update InfluxDB urls
159-
function updateUrls (prevUrls, newUrls) {
159+
function updateUrls(prevUrls, newUrls) {
160160
var preference = getURLPreference();
161161
var prevUrlsParsed = {
162162
oss: {},
@@ -244,7 +244,7 @@ function updateUrls (prevUrls, newUrls) {
244244
}
245245
});
246246

247-
function replaceWholename (startStr, endStr, replacement) {
247+
function replaceWholename(startStr, endStr, replacement) {
248248
var startsWithSeparator = new RegExp('[/.]');
249249
var endsWithSeparator = new RegExp('[-.:]');
250250
if (
@@ -278,7 +278,7 @@ function updateUrls (prevUrls, newUrls) {
278278
}
279279

280280
// Append the URL selector button to each codeblock containing a placeholder URL
281-
function appendUrlSelector () {
281+
function appendUrlSelector() {
282282
var appendToUrls = [
283283
placeholderUrls.oss,
284284
placeholderUrls.cloud,
@@ -290,15 +290,15 @@ function appendUrlSelector () {
290290
getBtnText = (context) => {
291291
contextText = {
292292
'oss/enterprise': 'Change InfluxDB URL',
293-
'cloud': 'InfluxDB Cloud Region',
294-
'serverless': 'InfluxDB Cloud Region',
295-
'dedicated': 'Set Dedicated cluster URL',
296-
'clustered': 'Set InfluxDB cluster URL',
297-
'other': 'InfluxDB Cloud or OSS?'
298-
}
299-
300-
return contextText[context]
301-
}
293+
cloud: 'InfluxDB Cloud Region',
294+
serverless: 'InfluxDB Cloud Region',
295+
dedicated: 'Set Dedicated cluster URL',
296+
clustered: 'Set InfluxDB cluster URL',
297+
other: 'InfluxDB Cloud or OSS?',
298+
};
299+
300+
return contextText[context];
301+
};
302302

303303
appendToUrls.forEach(function (url) {
304304
$(elementSelector).each(function () {
@@ -344,7 +344,7 @@ $('.url-trigger').click(function (e) {
344344
});
345345

346346
// Set the selected URL radio buttons to :checked
347-
function setRadioButtons () {
347+
function setRadioButtons() {
348348
currentUrls = getUrls();
349349
$('input[name="influxdb-cloud-url"][value="' + currentUrls.cloud + '"]').prop(
350350
'checked',
@@ -426,7 +426,7 @@ $('input[name="influxdb-clustered-url"]').change(function () {
426426
});
427427

428428
// Toggle preference tabs
429-
function togglePrefBtns (el) {
429+
function togglePrefBtns(el) {
430430
preference = el.length ? el.attr('id').replace('pref-', '') : 'cloud';
431431
prefUrls = $('#' + preference + '-urls');
432432

@@ -443,7 +443,7 @@ $('#pref-tabs .pref-tab').click(function () {
443443
});
444444

445445
// Select preference tab from cookie
446-
function showPreference () {
446+
function showPreference() {
447447
var preference = getPreference('influxdb_url');
448448
prefTab = $('#pref-' + preference);
449449
togglePrefBtns(prefTab);
@@ -457,7 +457,7 @@ showPreference();
457457
////////////////////////////////////////////////////////////////////////////////
458458

459459
// Validate custom URLs
460-
function validateUrl (url) {
460+
function validateUrl(url) {
461461
/** validDomain = (Named host | IPv6 host | IPvFuture host)(:Port)? **/
462462
var validDomain = new RegExp(
463463
`([a-z0-9\-._~%]+` +
@@ -505,19 +505,19 @@ function validateUrl (url) {
505505
}
506506

507507
// Show validation errors
508-
function showValidationMessage (validation) {
508+
function showValidationMessage(validation) {
509509
$('#custom-url').addClass('error');
510510
$('#custom-url').attr('data-message', validation.error);
511511
}
512512

513513
// Hide validation messages and replace the message attr with empty string
514-
function hideValidationMessage () {
514+
function hideValidationMessage() {
515515
$('#custom-url').removeClass('error').attr('data-message', '');
516516
}
517517

518518
// Set the custom URL cookie and apply the change
519519
// If the custom URL field is empty, it defaults to the OSS default
520-
function applyCustomUrl () {
520+
function applyCustomUrl() {
521521
var custUrl = $('#custom-url-field').val();
522522
let urlValidation = validateUrl(custUrl);
523523
if (custUrl.length > 0) {
@@ -540,7 +540,7 @@ function applyCustomUrl () {
540540

541541
// Set the product URL cookie and apply the change
542542
// If the product URL field is empty, it defaults to the product default
543-
function applyProductUrl (product) {
543+
function applyProductUrl(product) {
544544
var productUrl = $(`#${product}-url-field`).val();
545545
let urlValidation = validateUrl(productUrl);
546546
if (productUrl.length > 0) {
@@ -605,15 +605,15 @@ $(urlValueElements).blur(function () {
605605
/** Delay execution of a function `fn` for a number of milliseconds `ms`
606606
* e.g., delay a validation handler to avoid annoying the user.
607607
*/
608-
function delay (fn, ms) {
608+
function delay(fn, ms) {
609609
let timer = 0;
610610
return function (...args) {
611611
clearTimeout(timer);
612612
timer = setTimeout(fn.bind(this, ...args), ms || 0);
613613
};
614614
}
615615

616-
function handleUrlValidation () {
616+
function handleUrlValidation() {
617617
let url = $(urlValueElements).val();
618618
let urlValidation = validateUrl(url);
619619
if (urlValidation.valid) {
@@ -658,3 +658,13 @@ if (cloudUrls.includes(referrerHost)) {
658658
setURLPreference('cloud');
659659
showPreference();
660660
}
661+
662+
////////////////////////////////////////////////////////////////////////////////
663+
//////////////////////////// Dedicated URL Migration ///////////////////////////
664+
///////////////////////// REMOVE AFTER AUGUST 22, 2024 /////////////////////////
665+
////////////////////////////////////////////////////////////////////////////////
666+
667+
if (getUrls().dedicated == 'cluster-id.influxdb.io') {
668+
storeUrl('dedicated', 'cluster-id.a.influxdb.io', getUrls().dedicated);
669+
updateUrls(getPrevUrls(), getUrls());
670+
}

0 commit comments

Comments
 (0)