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
40844614
Unverified
Commit
40844614
authored
May 30, 2018
by
David
Committed by
GitHub
May 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12096 from grafana/davkal/11446-fix-systemjs-cachebust
Fix cache busting for systemjs imports for plugins
parents
f2942d94
8bcd55d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
public/app/features/plugins/plugin_loader.ts
+9
-11
public/vendor/plugin-css/css.js
+13
-12
No files found.
public/app/features/plugins/plugin_loader.ts
View file @
40844614
...
...
@@ -27,6 +27,13 @@ import 'rxjs/add/observable/from';
import
'rxjs/add/operator/map'
;
import
'rxjs/add/operator/combineAll'
;
// add cache busting
const
bust
=
`?_cache=
${
Date
.
now
()}
`
;
function
locate
(
load
)
{
return
load
.
address
+
bust
;
}
System
.
registry
.
set
(
'plugin-loader'
,
System
.
newModule
({
locate
:
locate
}));
System
.
config
({
baseURL
:
'public'
,
defaultExtension
:
'js'
,
...
...
@@ -40,23 +47,14 @@ System.config({
css
:
'vendor/plugin-css/css.js'
,
},
meta
:
{
'*'
:
{
'
plugin
*'
:
{
esModule
:
true
,
authorization
:
true
,
loader
:
'plugin-loader'
,
},
},
});
// add cache busting
var
systemLocate
=
System
.
locate
;
System
.
cacheBust
=
'?bust='
+
Date
.
now
();
System
.
locate
=
function
(
load
)
{
var
System
=
this
;
return
Promise
.
resolve
(
systemLocate
.
call
(
this
,
load
)).
then
(
function
(
address
)
{
return
address
+
System
.
cacheBust
;
});
};
function
exposeToPlugin
(
name
:
string
,
component
:
any
)
{
System
.
registerDynamic
(
name
,
[],
true
,
function
(
require
,
exports
,
module
)
{
module
.
exports
=
component
;
...
...
public/vendor/plugin-css/css.js
View file @
40844614
"use strict"
;
if
(
typeof
window
!==
'undefined'
)
{
var
bust
=
'?_cache='
+
Date
.
now
();
var
waitSeconds
=
100
;
var
head
=
document
.
getElementsByTagName
(
'head'
)[
0
];
...
...
@@ -13,8 +14,8 @@ if (typeof window !== 'undefined') {
}
var
isWebkit
=
!!
window
.
navigator
.
userAgent
.
match
(
/AppleWebKit
\/([^
;
]
*
)
/
);
var
webkitLoadCheck
=
function
(
link
,
callback
)
{
setTimeout
(
function
()
{
var
webkitLoadCheck
=
function
(
link
,
callback
)
{
setTimeout
(
function
()
{
for
(
var
i
=
0
;
i
<
document
.
styleSheets
.
length
;
i
++
)
{
var
sheet
=
document
.
styleSheets
[
i
];
if
(
sheet
.
href
===
link
.
href
)
{
...
...
@@ -25,17 +26,17 @@ if (typeof window !== 'undefined') {
},
10
);
};
var
noop
=
function
()
{
};
var
noop
=
function
()
{
};
var
loadCSS
=
function
(
url
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
timeout
=
setTimeout
(
function
()
{
var
loadCSS
=
function
(
url
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
timeout
=
setTimeout
(
function
()
{
reject
(
'Unable to load CSS'
);
},
waitSeconds
*
1000
);
var
_callback
=
function
(
error
)
{
var
_callback
=
function
(
error
)
{
clearTimeout
(
timeout
);
link
.
onload
=
link
.
onerror
=
noop
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
if
(
error
)
{
reject
(
error
);
}
...
...
@@ -47,22 +48,22 @@ if (typeof window !== 'undefined') {
var
link
=
document
.
createElement
(
'link'
);
link
.
type
=
'text/css'
;
link
.
rel
=
'stylesheet'
;
link
.
href
=
url
;
link
.
href
=
url
+
bust
;
if
(
!
isWebkit
)
{
link
.
onload
=
function
()
{
link
.
onload
=
function
()
{
_callback
();
}
}
else
{
webkitLoadCheck
(
link
,
_callback
);
}
link
.
onerror
=
function
(
event
)
{
link
.
onerror
=
function
(
event
)
{
_callback
(
event
.
error
||
new
Error
(
'Error loading CSS file.'
));
};
head
.
appendChild
(
link
);
});
};
exports
.
fetch
=
function
(
load
)
{
exports
.
fetch
=
function
(
load
)
{
// dont reload styles loaded in the head
for
(
var
i
=
0
;
i
<
linkHrefs
.
length
;
i
++
)
if
(
load
.
address
==
linkHrefs
[
i
])
...
...
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