mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following code smells reported by SonarQube:
1) Immediately return this expression instead of assigning it to the temporary variable. 2) Extract this nested ternary operation into an independent statement. 3) Expected a `for-of` loop instead of a `for` loop with this simple iteration.
This commit is contained in:
@@ -43,10 +43,10 @@ export function transformData(labels, refreshRate) {
|
||||
export function legendCallback(chart) {
|
||||
var text = [];
|
||||
text.push('<div class="' + chart.id + '-legend d-flex">');
|
||||
for (var i = 0; i < chart.data.datasets.length; i++) {
|
||||
text.push('<div class="legend-value"><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"> </span>');
|
||||
if (chart.data.datasets[i].label) {
|
||||
text.push('<span class="legend-label">' + chart.data.datasets[i].label + '</span>');
|
||||
for (let chart_val of chart.data.datasets) {
|
||||
text.push('<div class="legend-value"><span style="background-color:' + chart_val.backgroundColor + '"> </span>');
|
||||
if (chart_val.label) {
|
||||
text.push('<span class="legend-label">' + chart_val.label + '</span>');
|
||||
}
|
||||
text.push('</div>');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user