mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #13938 from tarekbecker/grafana-css-hash
Add [hash] to grafana.{light,dark}.css
This commit is contained in:
commit
4f601761df
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ awsconfig
|
|||||||
/dist
|
/dist
|
||||||
/public/build
|
/public/build
|
||||||
/public/views/index.html
|
/public/views/index.html
|
||||||
|
/public/views/error.html
|
||||||
/emails/dist
|
/emails/dist
|
||||||
/public_gen
|
/public_gen
|
||||||
/public/vendor/npm
|
/public/vendor/npm
|
||||||
|
@ -18,6 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMiddlewareContext(t *testing.T) {
|
func TestMiddlewareContext(t *testing.T) {
|
||||||
|
setting.ERR_TEMPLATE_NAME = "error-template"
|
||||||
|
|
||||||
Convey("Given the grafana middleware", t, func() {
|
Convey("Given the grafana middleware", t, func() {
|
||||||
middlewareScenario("middleware should add context to injector", func(sc *scenarioContext) {
|
middlewareScenario("middleware should add context to injector", func(sc *scenarioContext) {
|
||||||
|
@ -138,7 +138,7 @@ func Recovery() macaron.Handler {
|
|||||||
|
|
||||||
c.JSON(500, resp)
|
c.JSON(500, resp)
|
||||||
} else {
|
} else {
|
||||||
c.HTML(500, "error")
|
c.HTML(500, setting.ERR_TEMPLATE_NAME)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -8,11 +8,14 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
m "github.com/grafana/grafana/pkg/models"
|
m "github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/services/session"
|
"github.com/grafana/grafana/pkg/services/session"
|
||||||
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
"gopkg.in/macaron.v1"
|
"gopkg.in/macaron.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRecoveryMiddleware(t *testing.T) {
|
func TestRecoveryMiddleware(t *testing.T) {
|
||||||
|
setting.ERR_TEMPLATE_NAME = "error-template"
|
||||||
|
|
||||||
Convey("Given an api route that panics", t, func() {
|
Convey("Given an api route that panics", t, func() {
|
||||||
apiURL := "/api/whatever"
|
apiURL := "/api/whatever"
|
||||||
recoveryScenario("recovery middleware should return json", apiURL, func(sc *scenarioContext) {
|
recoveryScenario("recovery middleware should return json", apiURL, func(sc *scenarioContext) {
|
||||||
@ -50,6 +53,7 @@ func recoveryScenario(desc string, url string, fn scenarioFunc) {
|
|||||||
sc := &scenarioContext{
|
sc := &scenarioContext{
|
||||||
url: url,
|
url: url,
|
||||||
}
|
}
|
||||||
|
|
||||||
viewsPath, _ := filepath.Abs("../../public/views")
|
viewsPath, _ := filepath.Abs("../../public/views")
|
||||||
|
|
||||||
sc.m = macaron.New()
|
sc.m = macaron.New()
|
||||||
|
@ -36,7 +36,7 @@ func (ctx *ReqContext) Handle(status int, title string, err error) {
|
|||||||
ctx.Data["AppSubUrl"] = setting.AppSubUrl
|
ctx.Data["AppSubUrl"] = setting.AppSubUrl
|
||||||
ctx.Data["Theme"] = "dark"
|
ctx.Data["Theme"] = "dark"
|
||||||
|
|
||||||
ctx.HTML(status, "error")
|
ctx.HTML(status, setting.ERR_TEMPLATE_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *ReqContext) JsonOK(message string) {
|
func (ctx *ReqContext) JsonOK(message string) {
|
||||||
|
@ -38,6 +38,10 @@ const (
|
|||||||
APP_NAME_ENTERPRISE = "Grafana Enterprise"
|
APP_NAME_ENTERPRISE = "Grafana Enterprise"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ERR_TEMPLATE_NAME = "error"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// App settings.
|
// App settings.
|
||||||
Env = DEV
|
Env = DEV
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<base href="[[.AppSubUrl]]/" />
|
<base href="[[.AppSubUrl]]/" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="public/build/grafana.[[ .Theme ]].css?v[[ .BuildVersion ]]">
|
<link rel="stylesheet" href="public/build/grafana.[[ .Theme ]].<%= webpack.hash %>.css">
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="public/img/fav32.png">
|
<link rel="icon" type="image/png" href="public/img/fav32.png">
|
||||||
<link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28">
|
<link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28">
|
@ -15,7 +15,7 @@
|
|||||||
<link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28">
|
<link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="public/img/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="public/img/apple-touch-icon.png">
|
||||||
|
|
||||||
<link rel="stylesheet" href="public/build/grafana.[[ .Theme ]].css?v[[ .BuildVersion ]]+[[ .BuildCommit ]]">
|
<link rel="stylesheet" href="public/build/grafana.[[ .Theme ]].<%= webpack.hash %>.css">
|
||||||
|
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
@ -47,7 +47,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.html$/,
|
test: /\.html$/,
|
||||||
exclude: /index\.template.html/,
|
exclude: /(index|error)\-template\.html/,
|
||||||
use: [
|
use: [
|
||||||
{ loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public' },
|
{ loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public' },
|
||||||
{
|
{
|
||||||
|
@ -80,11 +80,16 @@ module.exports = merge(common, {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new CleanWebpackPlugin('../../public/build', { allowExternal: true }),
|
new CleanWebpackPlugin('../../public/build', { allowExternal: true }),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "grafana.[name].css"
|
filename: "grafana.[name].[hash].css"
|
||||||
|
}),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: path.resolve(__dirname, '../../public/views/error.html'),
|
||||||
|
template: path.resolve(__dirname, '../../public/views/error-template.html'),
|
||||||
|
inject: 'false',
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
||||||
template: path.resolve(__dirname, '../../public/views/index.template.html'),
|
template: path.resolve(__dirname, '../../public/views/index-template.html'),
|
||||||
inject: 'body',
|
inject: 'body',
|
||||||
chunks: ['manifest', 'vendor', 'app'],
|
chunks: ['manifest', 'vendor', 'app'],
|
||||||
}),
|
}),
|
||||||
|
@ -87,7 +87,7 @@ module.exports = merge(common, {
|
|||||||
new CleanWebpackPlugin('../public/build', { allowExternal: true }),
|
new CleanWebpackPlugin('../public/build', { allowExternal: true }),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
||||||
template: path.resolve(__dirname, '../../public/views/index.template.html'),
|
template: path.resolve(__dirname, '../../public/views/index-template.html'),
|
||||||
inject: 'body',
|
inject: 'body',
|
||||||
alwaysWriteToDisk: true
|
alwaysWriteToDisk: true
|
||||||
}),
|
}),
|
||||||
|
@ -71,15 +71,20 @@ module.exports = merge(common, {
|
|||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "grafana.[name].css"
|
filename: "grafana.[name].[hash].css"
|
||||||
}),
|
}),
|
||||||
new ngAnnotatePlugin(),
|
new ngAnnotatePlugin(),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
||||||
template: path.resolve(__dirname, '../../public/views/index.template.html'),
|
template: path.resolve(__dirname, '../../public/views/index-template.html'),
|
||||||
inject: 'body',
|
inject: 'body',
|
||||||
chunks: ['vendor', 'app'],
|
chunks: ['vendor', 'app'],
|
||||||
}),
|
}),
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: path.resolve(__dirname, '../../public/views/error.html'),
|
||||||
|
template: path.resolve(__dirname, '../../public/views/error-template.html'),
|
||||||
|
inject: false,
|
||||||
|
}),
|
||||||
function () {
|
function () {
|
||||||
this.hooks.done.tap('Done', function (stats) {
|
this.hooks.done.tap('Done', function (stats) {
|
||||||
if (stats.compilation.errors && stats.compilation.errors.length) {
|
if (stats.compilation.errors && stats.compilation.errors.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user