Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
64254eaa
Unverified
Commit
64254eaa
authored
Feb 02, 2021
by
Torkel Ödegaard
Committed by
GitHub
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CDN: Fixes cdn path when Grafana is under sub path (#30822)
parent
76d02048
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
pkg/setting/setting.go
+1
-1
pkg/setting/setting_test.go
+11
-6
public/views/index-template.html
+8
-7
No files found.
pkg/setting/setting.go
View file @
64254eaa
...
...
@@ -1320,7 +1320,7 @@ func (cfg *Cfg) GetContentDeliveryURL(prefix string) string {
}
url
.
Path
=
path
.
Join
(
url
.
Path
,
prefix
,
preReleaseFolder
,
cfg
.
BuildVersion
)
return
url
.
String
()
return
url
.
String
()
+
"/"
}
return
""
...
...
pkg/setting/setting_test.go
View file @
64254eaa
...
...
@@ -398,8 +398,13 @@ func TestGetCDNPath(t *testing.T) {
cfg
.
CDNRootURL
,
err
=
url
.
Parse
(
"http://cdn.grafana.com"
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana-oss/v7.5.0-11124"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana/v7.5.0-11124"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana-oss/v7.5.0-11124/"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana/v7.5.0-11124/"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
}
func
TestGetContentDeliveryURLWhenNoCDNRootURLIsSet
(
t
*
testing
.
T
)
{
cfg
:=
NewCfg
()
require
.
Equal
(
t
,
""
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
}
func
TestGetCDNPathWithPreReleaseVersionAndSubPath
(
t
*
testing
.
T
)
{
...
...
@@ -408,8 +413,8 @@ func TestGetCDNPathWithPreReleaseVersionAndSubPath(t *testing.T) {
cfg
.
BuildVersion
=
"v7.5.0-11124pre"
cfg
.
CDNRootURL
,
err
=
url
.
Parse
(
"http://cdn.grafana.com/sub"
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"http://cdn.grafana.com/sub/grafana-oss/pre-releases/v7.5.0-11124pre"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/sub/grafana/pre-releases/v7.5.0-11124pre"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/sub/grafana-oss/pre-releases/v7.5.0-11124pre
/
"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/sub/grafana/pre-releases/v7.5.0-11124pre
/
"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
}
// Adding a case for this in case we switch to proper semver version strings
...
...
@@ -419,6 +424,6 @@ func TestGetCDNPathWithAlphaVersion(t *testing.T) {
cfg
.
BuildVersion
=
"v7.5.0-alpha.11124"
cfg
.
CDNRootURL
,
err
=
url
.
Parse
(
"http://cdn.grafana.com"
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana-oss/pre-releases/v7.5.0-alpha.11124"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana/pre-releases/v7.5.0-alpha.11124"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana-oss/pre-releases/v7.5.0-alpha.11124
/
"
,
cfg
.
GetContentDeliveryURL
(
"grafana-oss"
))
require
.
Equal
(
t
,
"http://cdn.grafana.com/grafana/pre-releases/v7.5.0-alpha.11124
/
"
,
cfg
.
GetContentDeliveryURL
(
"grafana"
))
}
public/views/index-template.html
View file @
64254eaa
...
...
@@ -24,15 +24,15 @@
<link
rel=
"preload"
href=
"[[.ContentDeliveryURL]]
/
public/fonts/roboto/RxZJdnzeo3R5zSexge8UUVtXRa8TVwTICgirnJhmVJw.woff2"
href=
"[[.ContentDeliveryURL]]public/fonts/roboto/RxZJdnzeo3R5zSexge8UUVtXRa8TVwTICgirnJhmVJw.woff2"
as=
"font"
crossorigin
/>
<link
rel=
"icon"
type=
"image/png"
href=
"[[.FavIcon]]"
/>
<link
rel=
"apple-touch-icon"
sizes=
"180x180"
href=
"[[.AppleTouchIcon]]"
/>
<link
rel=
"mask-icon"
href=
"[[.ContentDeliveryURL]]
/
public/img/grafana_mask_icon.svg"
color=
"#F05A28"
/>
<link
rel=
"stylesheet"
href=
"[[.ContentDeliveryURL]]
/
public/build/grafana.[[ .Theme ]].<%= webpack.hash %>.css"
/>
<link
rel=
"mask-icon"
href=
"[[.ContentDeliveryURL]]public/img/grafana_mask_icon.svg"
color=
"#F05A28"
/>
<link
rel=
"stylesheet"
href=
"[[.ContentDeliveryURL]]public/build/grafana.[[ .Theme ]].<%= webpack.hash %>.css"
/>
<script
nonce=
"[[.Nonce]]"
>
performance
.
mark
(
'css done blocking'
);
...
...
@@ -236,8 +236,9 @@
preloader
[
0
].
className
=
"preloader preloader--done"
;
}
};
window
.
public_cdn_path
=
'[[.ContentDeliveryURL]]/public/build/'
;
[[
if
.
ContentDeliveryURL
]]
window
.
public_cdn_path
=
'[[.ContentDeliveryURL]]public/build/'
;
[[
end
]]
</script>
[[if .GoogleTagManagerId]]
...
...
@@ -281,7 +282,7 @@
<
%
if
(
htmlWebpackPlugin
.
files
.
jsIntegrity
)
{
%
>
<script
nonce=
"[[.Nonce]]"
src=
"[[.ContentDeliveryURL]]
/
<%= htmlWebpackPlugin.files.chunks[key].entry %>"
src=
"[[.ContentDeliveryURL]]<%= htmlWebpackPlugin.files.chunks[key].entry %>"
type=
"text/javascript"
integrity=
"<%= htmlWebpackPlugin.files.jsIntegrity[htmlWebpackPlugin.files.js.indexOf(htmlWebpackPlugin.files.chunks[key].entry)] %>"
crossorigin=
"<%= webpackConfig.output.crossOriginLoading %>"
>
...
...
@@ -289,7 +290,7 @@
<
%
}
else
{
%
>
<script
nonce=
"[[.Nonce]]"
src=
"[[.ContentDeliveryURL]]
/
<%= htmlWebpackPlugin.files.chunks[key].entry %>"
src=
"[[.ContentDeliveryURL]]<%= htmlWebpackPlugin.files.chunks[key].entry %>"
type=
"text/javascript"
>
</script>
<
%
}
%
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment