groundwork for influxdb url select

pull/954/head
Scott Anderson 2020-04-16 09:59:35 -06:00
parent 4d10f27c3b
commit e7d191a4a1
10 changed files with 85 additions and 16 deletions

File diff suppressed because one or more lines are too long

2
assets/js/jquery-3.5.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

15
assets/js/region-url.js Normal file
View File

@ -0,0 +1,15 @@
var url = "https://us-west-2-1.aws.cloud2.influxdata.com"
// Create a way for users to select their region
// store the region url as a cookie
// set a session cookie for the url
// If the session cookie isn't defined, don't do anything
function updateUrls() {
$(".article--content pre").each(function() {
$(this).html($(this).html().replace("http://localhost:9999", url));
});
}
updateUrls()

View File

@ -15,18 +15,7 @@ Use the URLs below to interact with your InfluxDB Cloud instances with the
[InfluxDB API](/v2.0/reference/api/), [InfluxDB client libraries](/v2.0/reference/api/client-libraries/),
[`influx` CLI](/v2.0/reference/cli/influx/), or [Telegraf](/v2.0/write-data/use-telegraf/).
## Amazon Web Services (AWS)
| Region | URL |
|:------ |:--- |
| US West (Oregon) | https://us-west-2-1.aws.cloud2.influxdata.com |
| EU Frankfurt | https://eu-central-1-1.aws.cloud2.influxdata.com |
## Google Cloud Platform (GCP)
| Region | URL |
|:------ |:--- |
| US Central (Iowa) | https://us-central1-1.gcp.cloud2.influxdata.com/ |
{{< cloud_urls >}}
---

20
data/influxdb_urls.yml Normal file
View File

@ -0,0 +1,20 @@
oss:
product: InfluxDB OSS
name: localhost:9999
url: http://localhost:9999
cloud:
product: InfluxDB Cloud
providers:
- name: Amazon Web Services
short_name: AWS
regions:
- name: US West (Orgeon)
url: https://us-west-2-1.aws.cloud2.influxdata.com
- name: EU Frankfort
url: https://eu-central-1-1.aws.cloud2.influxdata.com
- name: Google Cloud Platform
short_name: GCP
regions:
- name: US Central (Iowa)
url: https://us-central1-1.gcp.cloud2.influxdata.com

View File

@ -1,4 +1,8 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) }}
<!-- InfluxDB URL modal -->
{{ partial "footer/influxdb-url-modal.html" . }}
<!-- Docsearch JS -->
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script>

View File

@ -0,0 +1,18 @@
<div class="url-selector" style="background: #fff; padding: 1rem;">
{{ range sort .Site.Data.influxdb_urls "product" "desc" }}
<h4>{{ .product }}</h4>
{{ if .name }}
<ul><li data-url="{{ .url }}">{{ .name }}</li></ul>
{{ end }}
{{ if .providers }}
{{ range .providers }}
<strong>{{ if .short_name}}{{ .short_name }}{{ else }}{{ .name }}{{ end }}</strong>
<ul>
{{ range .regions }}
<li data-url="{{ .url }}">{{ .name }}</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ end }}
</div>

View File

@ -2,6 +2,7 @@
{{ $contentInteractions := resources.Get "js/content-interactions.js" }}
{{ $searchInteractions := resources.Get "js/search-interactions.js" }}
{{ $telegrafFilters := resources.Get "js/telegraf-filters.js" }}
{{ $footerjs := slice $versionSelector $contentInteractions $searchInteractions $telegrafFilters | resources.Concat "js/footer.bundle.js" }}
{{ $regionURLs := resources.Get "js/region-url.js" }}
{{ $footerjs := slice $versionSelector $contentInteractions $searchInteractions $telegrafFilters $regionURLs | resources.Concat "js/footer.bundle.js" }}
<script type="text/javascript" src="{{ $footerjs.RelPermalink }}" ></script>

View File

@ -1,4 +1,4 @@
{{ $jquery := resources.Get "js/jquery-3.3.1.min.js" }}
{{ $jquery := resources.Get "js/jquery-3.5.0.min.js" }}
{{ $cookies := resources.Get "js/js.cookie.js" }}
{{ $themes := resources.Get "js/docs-themes.js" }}
{{ $sidebar := resources.Get "js/sidebar-toggle.js" }}

View File

@ -0,0 +1,22 @@
{{ range .Site.Data.influxdb_urls.cloud.providers }}
{{ $scratch := newScratch }}
{{ $scratch.Set "title" .name }}
{{ if .short_name }}
{{ $scratch.Set "title" (print .name " (" .short_name ")")}}
{{ end }}
{{ $title := $scratch.Get "title" }}
{{ $titleID := anchorize $title }}
<h2 id="{{ $titleID }}">{{ $title }}</h2></strong>
<table>
<thead>
<th align="left">Region</th>
<th align="left">URL</th>
</thead>
{{ range .regions }}
<tr>
<td>{{ .name }}</td>
<td><a href="{{ .url }}">{{ .url }}</a></td>
</tr>
{{ end }}
</table>
{{ end }}