mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge pull request #1728 from mperham/graph-labels-locale
Use locale labels for dashboard graphs
This commit is contained in:
commit
c0d05b3cf1
2 changed files with 15 additions and 8 deletions
|
@ -22,14 +22,16 @@ var poller;
|
||||||
var realtimeGraph = function(updatePath) {
|
var realtimeGraph = function(updatePath) {
|
||||||
var timeInterval = parseInt(localStorage.timeInterval || '2000');
|
var timeInterval = parseInt(localStorage.timeInterval || '2000');
|
||||||
|
|
||||||
|
var graphElement = document.getElementById("realtime");
|
||||||
|
|
||||||
var graph = new Rickshaw.Graph( {
|
var graph = new Rickshaw.Graph( {
|
||||||
element: document.getElementById("realtime"),
|
element: graphElement,
|
||||||
width: responsiveWidth(),
|
width: responsiveWidth(),
|
||||||
height: 200,
|
height: 200,
|
||||||
renderer: 'line',
|
renderer: 'line',
|
||||||
interpolation: 'linear',
|
interpolation: 'linear',
|
||||||
|
|
||||||
series: new Rickshaw.Series.FixedDuration([{ name: 'Failed', color: '#B1003E' }, { name: 'Processed', color: '#006f68' }], undefined, {
|
series: new Rickshaw.Series.FixedDuration([{ name: graphElement.dataset.failedLabel, color: '#B1003E' }, { name: graphElement.dataset.processedLabel, color: '#006f68' }], undefined, {
|
||||||
timeInterval: timeInterval,
|
timeInterval: timeInterval,
|
||||||
maxDataPoints: 100,
|
maxDataPoints: 100,
|
||||||
})
|
})
|
||||||
|
@ -93,7 +95,11 @@ var realtimeGraph = function(updatePath) {
|
||||||
var failed = data.sidekiq.failed - Sidekiq.failed;
|
var failed = data.sidekiq.failed - Sidekiq.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph.series.addData({ Failed: failed, Processed: processed });
|
dataPoint = {};
|
||||||
|
dataPoint[graphElement.dataset.failedLabel] = failed;
|
||||||
|
dataPoint[graphElement.dataset.processedLabel] = processed;
|
||||||
|
|
||||||
|
graph.series.addData(dataPoint);
|
||||||
graph.render();
|
graph.render();
|
||||||
|
|
||||||
Sidekiq.processed = data.sidekiq.processed;
|
Sidekiq.processed = data.sidekiq.processed;
|
||||||
|
@ -111,8 +117,9 @@ var historyGraph = function() {
|
||||||
processed = createSeries($("#history").data("processed"))
|
processed = createSeries($("#history").data("processed"))
|
||||||
failed = createSeries($("#history").data("failed"))
|
failed = createSeries($("#history").data("failed"))
|
||||||
|
|
||||||
|
var graphElement = document.getElementById("history");
|
||||||
var graph = new Rickshaw.Graph( {
|
var graph = new Rickshaw.Graph( {
|
||||||
element: document.getElementById("history"),
|
element: graphElement,
|
||||||
width: responsiveWidth(),
|
width: responsiveWidth(),
|
||||||
height: 200,
|
height: 200,
|
||||||
renderer: 'line',
|
renderer: 'line',
|
||||||
|
@ -121,11 +128,11 @@ var historyGraph = function() {
|
||||||
{
|
{
|
||||||
color: "#B1003E",
|
color: "#B1003E",
|
||||||
data: failed,
|
data: failed,
|
||||||
name: 'Failed'
|
name: graphElement.dataset.failedLabel
|
||||||
}, {
|
}, {
|
||||||
color: "#006f68",
|
color: "#006f68",
|
||||||
data: processed,
|
data: processed,
|
||||||
name: 'Processed'
|
name: graphElement.dataset.processedLabel
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="realtime"></div>
|
<div id="realtime" data-processed-label="<%= t('Processed') %>" data-failed-label="<%= t('Failed') %>"></div>
|
||||||
<div id="realtime-legend"></div>
|
<div id="realtime-legend"></div>
|
||||||
|
|
||||||
<h5>
|
<h5>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<a href="<%= root_path %>?days=90" class="history-graph <%= "active" if params[:days] == "90" %>"><%= t('ThreeMonths') %></a>
|
<a href="<%= root_path %>?days=90" class="history-graph <%= "active" if params[:days] == "90" %>"><%= t('ThreeMonths') %></a>
|
||||||
<a href="<%= root_path %>?days=180" class="history-graph <%= "active" if params[:days] == "180" %>"><%= t('SixMonths') %></a>
|
<a href="<%= root_path %>?days=180" class="history-graph <%= "active" if params[:days] == "180" %>"><%= t('SixMonths') %></a>
|
||||||
</h5>
|
</h5>
|
||||||
<div id="history" data-processed="<%= h Sidekiq.dump_json(@processed_history) %>" data-failed="<%= h Sidekiq.dump_json(@failed_history) %>" data-update-url="<%= root_path %>dashboard/stats"></div>
|
<div id="history" data-processed-label="<%= t('Processed') %>" data-failed-label="<%= t('Failed') %>" data-processed="<%= h Sidekiq.dump_json(@processed_history) %>" data-failed="<%= h Sidekiq.dump_json(@failed_history) %>" data-update-url="<%= root_path %>dashboard/stats"></div>
|
||||||
<div id="history-legend"></div>
|
<div id="history-legend"></div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
Loading…
Reference in a new issue