Skip to content

Commit 151ddc9

Browse files
author
Aaron Caldwell
committed
Publish configs for maps_legacy and tile_maps using NP format
1 parent 6a4c970 commit 151ddc9

File tree

5 files changed

+206
-0
lines changed

5 files changed

+206
-0
lines changed

src/plugins/maps_legacy/config.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { schema, TypeOf } from '@kbn/config-schema';
21+
import { configSchema as tilemapSchema } from '../tile_map/config';
22+
23+
// TODO: Move this to regionmap plugin on migration
24+
export const regionmapSchema = schema.object({
25+
includeElasticMapsService: schema.boolean({ defaultValue: true }),
26+
layers: schema.maybe(
27+
schema.arrayOf(
28+
schema.object({
29+
url: schema.string(),
30+
format: schema.object({
31+
type: schema.string({ defaultValue: 'geojson' }),
32+
}),
33+
meta: schema.object({
34+
feature_collection_path: schema.string({ defaultValue: 'data' }),
35+
}),
36+
attribution: schema.string(),
37+
name: schema.string(),
38+
fields: schema.arrayOf(
39+
schema.object({
40+
name: schema.string(),
41+
description: schema.string(),
42+
})
43+
),
44+
})
45+
)
46+
),
47+
});
48+
49+
export const configSchema = schema.object({
50+
includeElasticMapsService: schema.boolean({ defaultValue: true }),
51+
proxyElasticMapsServiceInMaps: schema.boolean({ defaultValue: false }),
52+
tilemap: tilemapSchema,
53+
regionmap: regionmapSchema,
54+
manifestServiceUrl: schema.string({ defaultValue: '' }),
55+
emsFileApiUrl: schema.string({ defaultValue: 'https://vector.maps.elastic.co' }),
56+
emsTileApiUrl: schema.string({ defaultValue: 'https://tiles.maps.elastic.co' }),
57+
emsLandingPageUrl: schema.string({ defaultValue: 'https://maps.elastic.co/v7.7' }),
58+
emsFontLibraryUrl: schema.string({
59+
defaultValue: 'https://tiles.maps.elastic.co/fonts/{fontstack}/{range}.pbf',
60+
}),
61+
emsTileLayerId: schema.object({
62+
bright: schema.string({ defaultValue: 'road_map' }),
63+
desaturated: schema.string({ defaultValue: 'road_map_desaturated' }),
64+
dark: schema.string({ defaultValue: 'dark_map' }),
65+
}),
66+
});
67+
68+
export type ConfigSchema = TypeOf<typeof configSchema>;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { PluginConfigDescriptor } from 'kibana/server';
21+
import { configSchema, ConfigSchema } from '../config';
22+
23+
export const config: PluginConfigDescriptor<ConfigSchema> = {
24+
exposeToBrowser: {
25+
includeElasticMapsService: true,
26+
proxyElasticMapsServiceInMaps: true,
27+
tilemap: true,
28+
regionmap: true,
29+
manifestServiceUrl: true,
30+
emsFileApiUrl: true,
31+
emsTileApiUrl: true,
32+
emsLandingPageUrl: true,
33+
emsFontLibraryUrl: true,
34+
emsTileLayerId: true,
35+
},
36+
schema: configSchema,
37+
};
38+
39+
export const plugin = () => ({
40+
setup() {},
41+
start() {},
42+
});

src/plugins/tile_map/config.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { schema, TypeOf } from '@kbn/config-schema';
21+
22+
export const configSchema = schema.object({
23+
url: schema.string(),
24+
deprecated: schema.any({
25+
defaultValue: {
26+
config: {
27+
options: {
28+
attribution: '',
29+
},
30+
},
31+
},
32+
}),
33+
options: schema.object({
34+
attribution: schema.string({ defaultValue: '' }),
35+
minZoom: schema.number({ defaultValue: 0 }),
36+
maxZoom: schema.number({ defaultValue: 10 }),
37+
tileSize: schema.maybe(schema.number()),
38+
subdomains: schema.maybe(schema.arrayOf(schema.string())),
39+
errorTileUrl: schema.maybe(schema.string()),
40+
tms: schema.maybe(schema.boolean()),
41+
reuseTiles: schema.maybe(schema.boolean()),
42+
bounds: schema.maybe(schema.arrayOf(schema.number())),
43+
default: schema.maybe(schema.boolean()),
44+
}),
45+
});
46+
47+
export type ConfigSchema = TypeOf<typeof configSchema>;

src/plugins/tile_map/kibana.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"id": "tileMap",
3+
"version": "8.0.0",
4+
"kibanaVersion": "kibana",
5+
"configPath": ["map", "tilemap"],
6+
"ui": true,
7+
"server": true,
8+
"requiredPlugins": [
9+
"visualizations",
10+
"expressions",
11+
"mapsLegacy",
12+
"data"
13+
]
14+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { PluginConfigDescriptor } from 'kibana/server';
21+
import { configSchema, ConfigSchema } from '../config';
22+
23+
export const config: PluginConfigDescriptor<ConfigSchema> = {
24+
exposeToBrowser: {
25+
url: true,
26+
deprecated: true,
27+
options: true,
28+
},
29+
schema: configSchema,
30+
};
31+
32+
export const plugin = () => ({
33+
setup() {},
34+
start() {},
35+
});

0 commit comments

Comments
 (0)