'no users browsing' feature for presence chart

v1.18.x
psychobunny 11 years ago
parent 3634cebff7
commit cb84b79bbc

@ -307,6 +307,10 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
} }
function updateTopicsGraph(topics) { function updateTopicsGraph(topics) {
if (!Object.keys(topics).length) {
topics = {"0": 1};
}
var tids = Object.keys(topics), var tids = Object.keys(topics),
segments = graphs.topics.segments; segments = graphs.topics.segments;
@ -338,6 +342,9 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
continue; continue;
} }
if (tid === '0') {
color = '#4D5360';
} else {
do { do {
for (var i = 0, ii = topicColors.length; i < ii; i++) { for (var i = 0, ii = topicColors.length; i < ii; i++) {
var chosenColor = topicColors[i]; var chosenColor = topicColors[i];
@ -349,13 +356,14 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
} }
} }
} while (color === null && usedTopicColors.length < topicColors.length); } while (color === null && usedTopicColors.length < topicColors.length);
}
if (color) { if (color) {
graphs.topics.addData({ graphs.topics.addData({
value: tid, value: value,
color: color, color: color,
highlight: lighten(color, 10), highlight: lighten(color, 10),
label: "tid " + tid label: tid !== '0' ? "tid " + tid : "No users browsing"
}); });
segments[segments.length - 1].tid = tid; segments[segments.length - 1].tid = tid;
@ -367,12 +375,13 @@ define('forum/admin/general/dashboard', ['semver'], function(semver) {
var legend = $('#topics-legend').html(''); var legend = $('#topics-legend').html('');
for (var i = 0, ii = segments.length; i < ii; i++) { for (var i = 0, ii = segments.length; i < ii; i++) {
var topic = segments[i]; var topic = segments[i],
label = topic.tid === '0' ? topic.label : '<a href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.label + '</a>';
legend.append( legend.append(
'<li>' + '<li>' +
'<div style="background-color: ' + topic.highlightColor + '; border-color: ' + topic.strokeColor + '"></div>' + '<div style="background-color: ' + topic.highlightColor + '; border-color: ' + topic.strokeColor + '"></div>' +
'<span><a href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.label + '</a></span>' + '<span>' + label + '</span>' +
'</li>'); '</li>');
} }
} }

Loading…
Cancel
Save