Migrate legacy map UI settings (#75887)
* Migrate legacy map UI settings * i18n fixes
This commit is contained in:
parent
e236bdf4af
commit
f2fef70282
|
@ -17,88 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export function getUiSettingDefaults() {
|
||||
// wrapped in provider so that a new instance is given to each app/test
|
||||
return {
|
||||
'visualization:tileMap:maxPrecision': {
|
||||
name: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle', {
|
||||
defaultMessage: 'Maximum tile map precision',
|
||||
}),
|
||||
value: 7,
|
||||
description: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionText', {
|
||||
defaultMessage:
|
||||
'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, 12 is the max. {cellDimensionsLink}',
|
||||
description:
|
||||
'Part of composite text: kbn.advancedSettings.visualization.tileMap.maxPrecisionText + ' +
|
||||
'kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
|
||||
values: {
|
||||
cellDimensionsLink:
|
||||
`<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator"
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate(
|
||||
'kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
|
||||
{
|
||||
defaultMessage: 'Explanation of cell dimensions',
|
||||
}
|
||||
) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
category: ['visualization'],
|
||||
},
|
||||
'visualization:tileMap:WMSdefaults': {
|
||||
name: i18n.translate('kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle', {
|
||||
defaultMessage: 'Default WMS properties',
|
||||
}),
|
||||
value: JSON.stringify(
|
||||
{
|
||||
enabled: false,
|
||||
url: undefined,
|
||||
options: {
|
||||
version: undefined,
|
||||
layers: undefined,
|
||||
format: 'image/png',
|
||||
transparent: true,
|
||||
attribution: undefined,
|
||||
styles: undefined,
|
||||
},
|
||||
},
|
||||
null,
|
||||
2
|
||||
),
|
||||
type: 'json',
|
||||
description: i18n.translate('kbn.advancedSettings.visualization.tileMap.wmsDefaultsText', {
|
||||
defaultMessage:
|
||||
'Default {propertiesLink} for the WMS map server support in the coordinate map',
|
||||
description:
|
||||
'Part of composite text: kbn.advancedSettings.visualization.tileMap.wmsDefaultsText + ' +
|
||||
'kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
|
||||
values: {
|
||||
propertiesLink:
|
||||
'<a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate(
|
||||
'kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
|
||||
{
|
||||
defaultMessage: 'properties',
|
||||
}
|
||||
) +
|
||||
'</a>',
|
||||
},
|
||||
}),
|
||||
category: ['visualization'],
|
||||
},
|
||||
'visualization:regionmap:showWarnings': {
|
||||
name: i18n.translate('kbn.advancedSettings.visualization.showRegionMapWarningsTitle', {
|
||||
defaultMessage: 'Show region map warning',
|
||||
}),
|
||||
value: true,
|
||||
description: i18n.translate('kbn.advancedSettings.visualization.showRegionMapWarningsText', {
|
||||
defaultMessage:
|
||||
'Whether the region map shows a warning when terms cannot be joined to a shape on the map.',
|
||||
}),
|
||||
category: ['visualization'],
|
||||
},
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
*/
|
||||
|
||||
import { Plugin, PluginConfigDescriptor } from 'kibana/server';
|
||||
import { PluginInitializerContext } from 'src/core/server';
|
||||
import { CoreSetup, PluginInitializerContext } from 'src/core/server';
|
||||
import { Observable } from 'rxjs';
|
||||
import { configSchema, ConfigSchema } from '../config';
|
||||
import { getUiSettings } from './ui_settings';
|
||||
|
||||
export const config: PluginConfigDescriptor<ConfigSchema> = {
|
||||
exposeToBrowser: {
|
||||
|
@ -49,7 +50,9 @@ export class MapsLegacyPlugin implements Plugin<MapsLegacyPluginSetup> {
|
|||
this._initializerContext = initializerContext;
|
||||
}
|
||||
|
||||
public setup() {
|
||||
public setup(core: CoreSetup) {
|
||||
core.uiSettings.register(getUiSettings());
|
||||
|
||||
// @ts-ignore
|
||||
const config$ = this._initializerContext.config.create();
|
||||
return {
|
||||
|
|
113
src/plugins/maps_legacy/server/ui_settings.ts
Normal file
113
src/plugins/maps_legacy/server/ui_settings.ts
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from 'kibana/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
||||
return {
|
||||
'visualization:tileMap:maxPrecision': {
|
||||
name: i18n.translate('maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionTitle', {
|
||||
defaultMessage: 'Maximum tile map precision',
|
||||
}),
|
||||
value: 7,
|
||||
description: i18n.translate(
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionText',
|
||||
{
|
||||
defaultMessage:
|
||||
'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, 12 is the max. {cellDimensionsLink}',
|
||||
description:
|
||||
'Part of composite text: maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionText + ' +
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
|
||||
values: {
|
||||
cellDimensionsLink:
|
||||
`<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator"
|
||||
target="_blank" rel="noopener">` +
|
||||
i18n.translate(
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
|
||||
{
|
||||
defaultMessage: 'Explanation of cell dimensions',
|
||||
}
|
||||
) +
|
||||
'</a>',
|
||||
},
|
||||
}
|
||||
),
|
||||
schema: schema.number(),
|
||||
category: ['visualization'],
|
||||
},
|
||||
'visualization:tileMap:WMSdefaults': {
|
||||
name: i18n.translate('maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsTitle', {
|
||||
defaultMessage: 'Default WMS properties',
|
||||
}),
|
||||
value: JSON.stringify(
|
||||
{
|
||||
enabled: false,
|
||||
url: '',
|
||||
options: {
|
||||
version: '',
|
||||
layers: '',
|
||||
format: 'image/png',
|
||||
transparent: true,
|
||||
attribution: '',
|
||||
styles: '',
|
||||
},
|
||||
},
|
||||
null,
|
||||
2
|
||||
),
|
||||
type: 'json',
|
||||
description: i18n.translate(
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsText',
|
||||
{
|
||||
defaultMessage:
|
||||
'Default {propertiesLink} for the WMS map server support in the coordinate map',
|
||||
description:
|
||||
'Part of composite text: maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsText + ' +
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
|
||||
values: {
|
||||
propertiesLink:
|
||||
'<a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank" rel="noopener noreferrer">' +
|
||||
i18n.translate(
|
||||
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
|
||||
{
|
||||
defaultMessage: 'properties',
|
||||
}
|
||||
) +
|
||||
'</a>',
|
||||
},
|
||||
}
|
||||
),
|
||||
schema: schema.object({
|
||||
enabled: schema.boolean(),
|
||||
url: schema.string(),
|
||||
options: schema.object({
|
||||
version: schema.string(),
|
||||
layers: schema.string(),
|
||||
format: schema.string(),
|
||||
transparent: schema.boolean(),
|
||||
attribution: schema.string(),
|
||||
styles: schema.string(),
|
||||
}),
|
||||
}),
|
||||
category: ['visualization'],
|
||||
},
|
||||
};
|
||||
}
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
|
||||
import { PluginConfigDescriptor } from 'kibana/server';
|
||||
import { CoreSetup } from 'src/core/server';
|
||||
import { configSchema, ConfigSchema } from '../config';
|
||||
import { getUiSettings } from './ui_settings';
|
||||
|
||||
export const config: PluginConfigDescriptor<ConfigSchema> = {
|
||||
exposeToBrowser: {
|
||||
|
@ -29,6 +31,9 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
|
|||
};
|
||||
|
||||
export const plugin = () => ({
|
||||
setup() {},
|
||||
setup(core: CoreSetup) {
|
||||
core.uiSettings.register(getUiSettings());
|
||||
},
|
||||
|
||||
start() {},
|
||||
});
|
||||
|
|
42
src/plugins/region_map/server/ui_settings.ts
Normal file
42
src/plugins/region_map/server/ui_settings.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiSettingsParams } from 'kibana/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
|
||||
return {
|
||||
'visualization:regionmap:showWarnings': {
|
||||
name: i18n.translate('regionMap.advancedSettings.visualization.showRegionMapWarningsTitle', {
|
||||
defaultMessage: 'Show region map warning',
|
||||
}),
|
||||
value: true,
|
||||
description: i18n.translate(
|
||||
'regionMap.advancedSettings.visualization.showRegionMapWarningsText',
|
||||
{
|
||||
defaultMessage:
|
||||
'Whether the region map shows a warning when terms cannot be joined to a shape on the map.',
|
||||
}
|
||||
),
|
||||
schema: schema.boolean(),
|
||||
category: ['visualization'],
|
||||
},
|
||||
};
|
||||
}
|
|
@ -2775,14 +2775,6 @@
|
|||
"inspector.requests.statisticsTabLabel": "統計",
|
||||
"inspector.title": "インスペクター",
|
||||
"inspector.view": "{viewName} を表示",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsText": "用語がマップの形に合わない場合に地域マップに警告を表示するかどうかです。",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "地域マップに警告を表示",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "ディメンションの説明",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecisionText": "マップに表示されるジオハッシュの最高精度です。7 が高い、10 が非常に高い、12 が最高を意味します。{cellDimensionsLink}",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle": "タイルマップの最高精度",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText": "プロパティ",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaultsText": "座標マップの WMS マップサーバーサポートのデフォルトの {propertiesLink} です。",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle": "デフォルトの WMS プロパティ",
|
||||
"kibana_legacy.notify.fatalError.errorStatusMessage": "エラー {errStatus} {errStatusText}: {errMessage}",
|
||||
"kibana_legacy.notify.fatalError.unavailableServerErrorMessage": "HTTP リクエストで接続に失敗しました。Kibana サーバーが実行されていて、ご使用のブラウザの接続が正常に動作していることを確認するか、システム管理者にお問い合わせください。",
|
||||
"kibana_legacy.notify.toaster.errorMessage": "エラー: {errorMessage}\n {errorStack}",
|
||||
|
|
|
@ -2776,14 +2776,6 @@
|
|||
"inspector.requests.statisticsTabLabel": "统计信息",
|
||||
"inspector.title": "检查器",
|
||||
"inspector.view": "视图:{viewName}",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsText": "词无法联接到地图上的形状时,区域地图是否显示警告。",
|
||||
"kbn.advancedSettings.visualization.showRegionMapWarningsTitle": "显示区域地图警告",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText": "单元格维度的解释",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecisionText": "在磁贴地图上显示的最大 geoHash 精确度:7 为高,10 为很高,12 为最大值。{cellDimensionsLink}",
|
||||
"kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle": "最大磁贴地图精确度",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText": "属性",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaultsText": "坐标地图中 WMS 地图服务器支持的默认{propertiesLink}",
|
||||
"kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle": "默认 WMS 属性",
|
||||
"kibana_legacy.notify.fatalError.errorStatusMessage": "错误 {errStatus} {errStatusText}:{errMessage}",
|
||||
"kibana_legacy.notify.fatalError.unavailableServerErrorMessage": "HTTP 请求无法连接。请检查 Kibana 服务器是否正在运行以及您的浏览器是否具有有效的连接,或请联系您的系统管理员。",
|
||||
"kibana_legacy.notify.toaster.errorMessage": "错误:{errorMessage}\n {errorStack}",
|
||||
|
|
Loading…
Reference in a new issue