Hi,
I’m hoping someone could please assist with this problem.
I’ve got a scenario where I use these dynamic variables within a template .dashboard.js.erb file (using it to construct a grafana dashboard):
#dashboard.js.erb
/* global _ */
‘use strict’;
var windows, document, $, jQuery, moment, kbn, ARGS;
var dashboard;
var rows = 5;
var env = :metric;
var nodes_env = :node;…
and my recipe uses the following resource:-
#recipe.rb
dashboard_path = “/usr/share/public/grafana”
file = “dashboard.js”
metric = “blue-monolith”
node = “nodes.production_blue”
template File.join(dashboard_path, file) do
source “dashboard.js.erb”
variables({
:metric => metric,
:node => node
})
end
end
Does anyone know how to represent these dynamic variables (:metric and :node) in a .js.erb file?
Many thanks
Sent from iCloud