Browse Source

Merge pull request #2468 from agaoglu/version-statics

Adding version to names of static files
pull/2349/merge
Julius Volz 8 years ago committed by GitHub
parent
commit
e22553edd2
  1. 23
      console_libraries/prom.lib
  2. 156
      web/ui/bindata.go
  3. 7
      web/ui/static/js/graph.js
  4. 2
      web/ui/static/js/graph_template.handlebar
  5. 2
      web/ui/static/js/prom_console.js
  6. 11
      web/ui/templates/_base.html
  7. 4
      web/ui/templates/alerts.html
  8. 28
      web/ui/templates/graph.html
  9. 1
      web/web.go

23
console_libraries/prom.lib

@ -1,17 +1,20 @@
{{/* vim: set ft=html: */}}
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
{{ define "prom_console_head" }}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css">
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css?v={{ buildVersion }}">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css?v={{ buildVersion }}">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js?v={{ buildVersion }}"></script>
<script>var PATH_PREFIX = "{{ pathPrefix }}";</script>
<script src="{{ pathPrefix }}/static/js/prom_console.js"></script>
<script>
var PATH_PREFIX = "{{ pathPrefix }}";
var BUILD_VERSION = "{{ buildVersion }}";
</script>
<script src="{{ pathPrefix }}/static/js/prom_console.js?v={{ buildVersion }}"></script>
{{ end }}
{{/* Top of all pages. */}}

156
web/ui/bindata.go

File diff suppressed because one or more lines are too long

7
web/ui/static/js/graph.js

@ -46,7 +46,10 @@ Prometheus.Graph.prototype.initialize = function() {
// Draw graph controls and container from Handlebars template.
var options = {'pathPrefix': PATH_PREFIX};
var options = {
'pathPrefix': PATH_PREFIX,
'buildVersion': BUILD_VERSION
};
jQuery.extend(options, self.options);
self.graphHTML = $(Mustache.render(graphTemplate, options));
self.el.append(self.graphHTML);
@ -819,7 +822,7 @@ function init() {
});
$.ajax({
url: PATH_PREFIX + "/static/js/graph_template.handlebar",
url: PATH_PREFIX + "/static/js/graph_template.handlebar?v=" + BUILD_VERSION,
success: function(data) {
graphTemplate = data;

2
web/ui/static/js/graph_template.handlebar

@ -6,7 +6,7 @@
</div>
<div class="col-lg-2">
<div class="eval_stats pull-right"></div>
<img src="{{ pathPrefix }}/static/img/ajax-loader.gif" class="spinner" alt="ajax_spinner">
<img src="{{ pathPrefix }}/static/img/ajax-loader.gif?v={{ buildVersion }}" class="spinner" alt="ajax_spinner">
</div>
</div>
<div class="row">

2
web/ui/static/js/prom_console.js

@ -578,7 +578,7 @@ PromConsole.Graph.prototype.dispatch = function() {
}
var loadingImg = document.createElement("img");
loadingImg.src = PATH_PREFIX + '/static/img/ajax-loader.gif';
loadingImg.src = PATH_PREFIX + '/static/img/ajax-loader.gif?v=' + BUILD_VERSION;
loadingImg.alt = 'Loading...';
loadingImg.className = 'prom_graph_loading';
this.graphTd.appendChild(loadingImg);

11
web/ui/templates/_base.html

@ -3,15 +3,16 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Prometheus Time Series Collection and Processing Server</title>
<link rel="shortcut icon" href="{{ pathPrefix }}/static/img/favicon.ico">
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
<link rel="shortcut icon" href="{{ pathPrefix }}/static/img/favicon.ico?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js?v={{ buildVersion }}"></script>
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prometheus.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css?v={{ buildVersion }}">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prometheus.css?v={{ buildVersion }}">
<script>
var PATH_PREFIX = "{{ pathPrefix }}";
var BUILD_VERSION = "{{ buildVersion }}";
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})

4
web/ui/templates/alerts.html

@ -1,6 +1,6 @@
{{define "head"}}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/alerts.css">
<script src="{{ pathPrefix }}/static/js/alerts.js"></script>
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/alerts.css?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/js/alerts.js?v={{ buildVersion }}"></script>
{{end}}
{{define "content"}}

28
web/ui/templates/graph.html

@ -1,22 +1,22 @@
{{define "head"}}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/graph.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/graph.css?v={{ buildVersion }}">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css?v={{ buildVersion }}">
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.css?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/moment/moment.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap3-typeahead/bootstrap3-typeahead.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/fuzzy/fuzzy.js"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/moment/moment.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/bootstrap3-typeahead/bootstrap3-typeahead.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/fuzzy/fuzzy.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/mustache/mustache.min.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.selection.js"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.hotkeys.js"></script>
<script src="{{ pathPrefix }}/static/vendor/mustache/mustache.min.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.selection.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/vendor/js/jquery.hotkeys.js?v={{ buildVersion }}"></script>
<script src="{{ pathPrefix }}/static/js/graph.js?v=1"></script>
<script src="{{ pathPrefix }}/static/js/graph.js?v={{ buildVersion }}"></script>
<script id="graph_template" type="text/x-handlebars-template"></script>
{{end}}

1
web/web.go

@ -425,6 +425,7 @@ func tmplFuncs(consolesPath string, opts *Options) template_text.FuncMap {
},
"consolesPath": func() string { return consolesPath },
"pathPrefix": func() string { return opts.ExternalURL.Path },
"buildVersion": func() string { return opts.Version.Revision[:7] },
"stripLabels": func(lset model.LabelSet, labels ...model.LabelName) model.LabelSet {
for _, ln := range labels {
delete(lset, ln)

Loading…
Cancel
Save