Skip to content

Commit fe83ea5

Browse files
committed
Replace handlebars with the simpler and saner mustache library.
1 parent 0a6972b commit fe83ea5

File tree

5 files changed

+14
-2022
lines changed

5 files changed

+14
-2022
lines changed

NOTICE

+6-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ https://github.com/shutterstock/rickshaw
3939
Copyright 2011-2014 by Shutterstock Images, LLC
4040
See https://github.com/shutterstock/rickshaw/blob/master/LICENSE for license details
4141

42-
handlebars.js
43-
Copyright 2011 by Yehuda Katz
44-
See web/static/vendor/js/handlebars.js for license details
42+
mustache.js
43+
https://github.com/janl/mustache.js
44+
Copyright 2009 Chris Wanstrath (Ruby)
45+
Copyright 2010-2014 Jan Lehnardt (JavaScript)
46+
Copyright 2010-2015 The mustache.js community
47+
Licensed under the MIT License
4548

4649
jQuery
4750
https://jquery.org

web/ui/static/js/graph.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ var graphTemplate;
33

44
var SECOND = 1000;
55

6-
Handlebars.registerHelper('pathPrefix', function() { return PATH_PREFIX; });
7-
86
Prometheus.Graph = function(element, options, handleChange, handleRemove) {
97
this.el = element;
108
this.graphHTML = null;
@@ -48,7 +46,9 @@ Prometheus.Graph.prototype.initialize = function() {
4846

4947
// Draw graph controls and container from Handlebars template.
5048

51-
self.graphHTML = $(graphTemplate(self.options));
49+
var options = {'pathPrefix': PATH_PREFIX};
50+
jQuery.extend(options, self.options);
51+
self.graphHTML = $(Mustache.render(graphTemplate, options));
5252
self.el.append(self.graphHTML);
5353

5454
// Get references to all the interesting elements in the graph container and
@@ -822,7 +822,9 @@ function init() {
822822
$.ajax({
823823
url: PATH_PREFIX + "/static/js/graph_template.handlebar",
824824
success: function(data) {
825-
graphTemplate = Handlebars.compile(data);
825+
826+
graphTemplate = data;
827+
Mustache.parse(data);
826828
if (isDeprecatedGraphURL()) {
827829
redirectToMigratedURL();
828830
} else {

0 commit comments

Comments
 (0)