Skip to content

Commit d6bd835

Browse files
Remove html-generation method (#46)
1 parent d64cdc9 commit d6bd835

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

src/ems_service.ts

-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { toAbsoluteUrl } from './utils';
2323

2424
export interface IEmsService {
2525
getAttributions(): { url: string; label: string }[];
26-
getHTMLAttribution(): string;
2726
getMarkdownAttribution(): string;
2827
getDisplayName(): string;
2928
getId(): string;
@@ -54,16 +53,6 @@ export abstract class AbstractEmsService implements IEmsService {
5453
});
5554
}
5655

57-
getHTMLAttribution(): string {
58-
const attributions = this._config.attribution.map((attribution) => {
59-
const url = this._emsClient.getValueInLanguage(attribution.url);
60-
const label = this._emsClient.getValueInLanguage(attribution.label);
61-
const html = url ? `<a rel="noreferrer noopener" href="${url}">${label}</a>` : label;
62-
return this._emsClient.sanitizeHtml(html);
63-
});
64-
return attributions.join(' | '); //!!!this is the current convention used in Kibana
65-
}
66-
6756
getMarkdownAttribution(): string {
6857
const attributions = this._config.attribution.map((attribution) => {
6958
const url = this._emsClient.getValueInLanguage(attribution.url);

src/tms_service.ts

-3
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,9 @@ export class TMSService extends AbstractEmsService {
125125
const url = this._proxyPath + this._getAbsoluteUrl(tileUrl);
126126
return this._emsClient.extendUrlWithParams(url);
127127
});
128-
// Override the attribution in the sources with the localized attribution
129-
const htmlAttribution = await this.getHTMLAttribution();
130128
inlinedSources[sourceName] = {
131129
...sourceJson,
132130
type: 'vector',
133-
attribution: htmlAttribution,
134131
tiles: extendedTileUrls,
135132
};
136133
}

test/ems_client.test.ts

-18
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ describe('ems_client', () => {
6565
'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=tester&my_app_version=7.x.x'
6666
);
6767

68-
expect(tileService.getHTMLAttribution()).toBe(
69-
'<a rel="noreferrer noopener" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a> | <a rel="noreferrer noopener" href="https://openmaptiles.org">OpenMapTiles</a> | <a rel="noreferrer noopener" href="https://www.maptiler.com">MapTiler</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>'
70-
);
7168
expect(await tileService.getMinZoom()).toBe(0);
7269
expect(await tileService.getMaxZoom()).toBe(10);
7370
expect(tileService.hasId('road_map')).toBe(true);
@@ -89,9 +86,6 @@ describe('ems_client', () => {
8986
'https://tiles.foobar/raster/styles/osm-bright/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=tester&my_app_version=7.x.x'
9087
);
9188

92-
expect(tileService.getHTMLAttribution()).toBe(
93-
'<a rel="noreferrer noopener" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a> | <a rel="noreferrer noopener" href="https://openmaptiles.org">OpenMapTiles</a> | <a rel="noreferrer noopener" href="https://www.maptiler.com">MapTiler</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>'
94-
);
9589
expect(await tileService.getMinZoom()).toBe(0);
9690
expect(await tileService.getMaxZoom()).toBe(10);
9791
expect(tileService.hasId('road_map')).toBe(true);
@@ -175,10 +169,6 @@ describe('ems_client', () => {
175169
},
176170
]);
177171

178-
expect(layer.getHTMLAttribution()).toBe(
179-
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>'
180-
);
181-
182172
expect(layer.getDisplayName()).toBe('World Countries');
183173
});
184174

@@ -197,10 +187,6 @@ describe('ems_client', () => {
197187
const layer = layers[0];
198188
expect(layer.getId()).toBe('world_countries');
199189
expect(layer.hasId('world_countries')).toBe(true);
200-
201-
expect(layer.getHTMLAttribution()).toBe(
202-
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>'
203-
);
204190
expect(layer.getDisplayName()).toBe('pays');
205191

206192
const fields = layer.getFieldsInLanguage();
@@ -228,10 +214,6 @@ describe('ems_client', () => {
228214
const layer = layers[0];
229215
expect(layer.getId()).toBe('world_countries');
230216
expect(layer.hasId('world_countries')).toBe(true);
231-
232-
expect(layer.getHTMLAttribution()).toBe(
233-
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>'
234-
);
235217
expect(layer.getDisplayName()).toBe('World Countries');
236218

237219
const fields = layer.getFieldsInLanguage();

0 commit comments

Comments
 (0)