Skip to content

Commit fc09917

Browse files
committed
Run prettier
1 parent 67c7e95 commit fc09917

File tree

4 files changed

+53
-15
lines changed

4 files changed

+53
-15
lines changed

src/data_formatter.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,19 @@ export default class DataFormatter {
212212
return;
213213
}
214214

215-
const locationName = this.settings.esLocationName ? row[columnNames[this.settings.esLocationName]] : encodedGeohash;
215+
const locationName = this.settings.esLocationName
216+
? row[columnNames[this.settings.esLocationName]]
217+
: encodedGeohash;
216218
const value = row[columnNames[this.settings.esMetric]];
217219
const link = this.settings.esLink ? row[columnNames[this.settings.esLink]] : null;
218220

219-
const dataValue = this.createDataValueWithGeohash(encodedGeohash, decodedGeohash, locationName, value, link);
221+
const dataValue = this.createDataValueWithGeohash(
222+
encodedGeohash,
223+
decodedGeohash,
224+
locationName,
225+
value,
226+
link
227+
);
220228

221229
// Add all values from the original datapoint as attributes prefixed with `__field_`.
222230
for (const columnName in columnNames) {
@@ -252,11 +260,19 @@ export default class DataFormatter {
252260
return;
253261
}
254262

255-
const locationName = this.settings.esLocationName ? datapoint[this.settings.esLocationName] : encodedGeohash;
263+
const locationName = this.settings.esLocationName
264+
? datapoint[this.settings.esLocationName]
265+
: encodedGeohash;
256266
const value = datapoint[this.settings.esMetric];
257267
const link = this.settings.esLink ? datapoint[this.settings.esLink] : null;
258268

259-
const dataValue = this.createDataValueWithGeohash(encodedGeohash, decodedGeohash, locationName, value, link);
269+
const dataValue = this.createDataValueWithGeohash(
270+
encodedGeohash,
271+
decodedGeohash,
272+
locationName,
273+
value,
274+
link
275+
);
260276

261277
// Add all values from the original datapoint as attributes prefixed with `__field_`.
262278
for (let key in datapoint) {

src/worldmap.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,7 @@ describe('Worldmap', () => {
520520

521521
describe('when a data point has a value of NaN', () => {
522522
beforeEach(() => {
523-
ctrl.data = new DataBuilder()
524-
.withCountryAndValue('SE', NaN)
525-
.build();
523+
ctrl.data = new DataBuilder().withCountryAndValue('SE', NaN).build();
526524
});
527525

528526
it('should create a popup which contains n/a', () => {
@@ -536,7 +534,6 @@ describe('Worldmap', () => {
536534
expect(worldMap.circles[0]._popup._content).toBe('Sweden');
537535
});
538536
});
539-
540537
});
541538

542539
describe('WorldmapFoundation', () => {

src/worldmap.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const tileServers = {
88
'CartoDB Positron': {
99
url: 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
1010
attribution:
11-
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + '&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
11+
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
12+
'&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
1213
subdomains: 'abcd',
1314
},
1415
'CartoDB Dark': {
1516
url: 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png',
1617
attribution:
17-
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' + '&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
18+
'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
19+
'&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
1820
subdomains: 'abcd',
1921
},
2022
};
@@ -107,7 +109,14 @@ export default class WorldMap {
107109
case ColorModes.categories.id:
108110
return () => {
109111
const legendHtml = this.ctrl.data.categories.reduce((html, cat, idx) => {
110-
return html + '<div class="legend-item"><i style="background:' + this.ctrl.settings.colors[idx + 1] + '"></i> ' + cat + '</div>';
112+
return (
113+
html +
114+
'<div class="legend-item"><i style="background:' +
115+
this.ctrl.settings.colors[idx + 1] +
116+
'"></i> ' +
117+
cat +
118+
'</div>'
119+
);
111120
}, '<div class="legend-item"><i style="background:' + this.ctrl.settings.colors[0] + '"></i> *</div>');
112121
this.legend._div.innerHTML = legendHtml;
113122
};
@@ -117,7 +126,12 @@ export default class WorldMap {
117126
const thresholds = this.ctrl.data.thresholds;
118127
let legendHtml = '';
119128
legendHtml +=
120-
'<div class="legend-item"><i style="background:' + this.ctrl.settings.colors[0] + '"></i> ' + '&lt; ' + thresholds[0] + '</div>';
129+
'<div class="legend-item"><i style="background:' +
130+
this.ctrl.settings.colors[0] +
131+
'"></i> ' +
132+
'&lt; ' +
133+
thresholds[0] +
134+
'</div>';
121135
for (let index = 0; index < thresholds.length; index += 1) {
122136
legendHtml +=
123137
'<div class="legend-item"><i style="background:' +

src/worldmap_ctrl.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
258258
console.info('Refreshing panel. initializing=', this.initializing);
259259
this.errors.reset('data');
260260

261-
if (!this.loading && !this.initializing && _.isEmpty(this.locations) && _.isEmpty(this.panel.snapshotLocationData)) {
261+
if (
262+
!this.loading &&
263+
!this.initializing &&
264+
_.isEmpty(this.locations) &&
265+
_.isEmpty(this.panel.snapshotLocationData)
266+
) {
262267
this.loadLocationData(true);
263268
}
264269
}
@@ -287,7 +292,10 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
287292

288293
this.updateColorMode();
289294

290-
const autoCenterMap = this.settings.mapCenter === 'First GeoHash' || this.settings.mapCenter === 'Last GeoHash' || this.settings.mapFitData;
295+
const autoCenterMap =
296+
this.settings.mapCenter === 'First GeoHash' ||
297+
this.settings.mapCenter === 'Last GeoHash' ||
298+
this.settings.mapFitData;
291299

292300
if (this.data.length && autoCenterMap) {
293301
this.updateMapCenter(false);
@@ -313,7 +321,10 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
313321
if (_.isEmpty(dataList)) {
314322
this.resetData();
315323
this.resetLocations();
316-
this.errors.add('No data received, please check data source and time range', { level: 'warning', domain: 'data' });
324+
this.errors.add('No data received, please check data source and time range', {
325+
level: 'warning',
326+
domain: 'data',
327+
});
317328
return;
318329
}
319330

0 commit comments

Comments
 (0)