mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Maps] Update EMS Landing Page link to root or vX.Y (#162494)
Fixes #161791 Updates the link to the EMS Landing Page website in the Kibana Maps UI to point to the root directory at https://maps.elastic.co when the build is `serverless` and to the correct `https://maps.elastic.co/vX.Y` for `traditional` builds. To test: * When running with `yarn start` * Check the link in the source details of an EMS Administrative boundaries dataset in the Maps Application * When running with `yarn start --serverless=es` * Check the source details of an EMS Administrative boundaries dataset in the Maps Application ⚠️ **Note**: This change does not affect the link in the Tutorial for the Elastic Maps Service since it only touches the EMS Client creation and not the `EMSSettings` that happens synchronously. This is OK since that tutorial should point to the latest Landing Page revision to offer all the data for our users. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
c4692b33a0
commit
f2d412073f
5 changed files with 32 additions and 11 deletions
|
@ -8,7 +8,7 @@
|
|||
|
||||
export const DEFAULT_EMS_FILE_API_URL = 'https://vector.maps.elastic.co';
|
||||
export const DEFAULT_EMS_TILE_API_URL = 'https://tiles.maps.elastic.co';
|
||||
export const DEFAULT_EMS_LANDING_PAGE_URL = 'https://maps.elastic.co/v8.7';
|
||||
export const DEFAULT_EMS_LANDING_PAGE_URL = 'https://maps.elastic.co';
|
||||
export const DEFAULT_EMS_FONT_LIBRARY_URL =
|
||||
'https://tiles.maps.elastic.co/fonts/{fontstack}/{range}.pbf';
|
||||
|
||||
|
|
|
@ -6,18 +6,32 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import coerce from 'semver/functions/coerce';
|
||||
|
||||
import { BuildFlavor } from '@kbn/config/src/types';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EMSClient } from '@elastic/ems-client';
|
||||
import { EMS_APP_NAME, EMSSettings } from '../../common';
|
||||
|
||||
export function createEMSClient(emsSettings: EMSSettings, kbnVersion: string): EMSClient {
|
||||
export function createEMSClient(
|
||||
emsSettings: EMSSettings,
|
||||
kbnVersion: string,
|
||||
buildFlavor: BuildFlavor = 'traditional'
|
||||
): EMSClient {
|
||||
let landingPageUrl = emsSettings!.getEMSLandingPageUrl();
|
||||
const kbnSemVer = coerce(kbnVersion);
|
||||
|
||||
if (buildFlavor === 'traditional' && kbnSemVer) {
|
||||
landingPageUrl = `${landingPageUrl}/v${kbnSemVer.major}.${kbnSemVer.minor}`;
|
||||
}
|
||||
|
||||
return new EMSClient({
|
||||
language: i18n.getLocale(),
|
||||
appVersion: kbnVersion,
|
||||
appName: EMS_APP_NAME,
|
||||
tileApiUrl: emsSettings!.getEMSTileApiUrl(),
|
||||
fileApiUrl: emsSettings!.getEMSFileApiUrl(),
|
||||
landingPageUrl: emsSettings!.getEMSLandingPageUrl(),
|
||||
landingPageUrl,
|
||||
fetchFunction(url: string) {
|
||||
return fetch(url);
|
||||
},
|
||||
|
|
|
@ -7,13 +7,18 @@
|
|||
*/
|
||||
|
||||
import type { EMSClient } from '@elastic/ems-client';
|
||||
import { BuildFlavor } from '@kbn/config/src/types';
|
||||
import type { EMSSettings } from '../../common';
|
||||
|
||||
let lazyLoaded: (emsSettings: EMSSettings, version: string) => EMSClient;
|
||||
let lazyLoaded: (emsSettings: EMSSettings, version: string, buildFlavor: BuildFlavor) => EMSClient;
|
||||
|
||||
export async function createEMSClientLazy(emsSettings: EMSSettings, version: string) {
|
||||
export async function createEMSClientLazy(
|
||||
emsSettings: EMSSettings,
|
||||
version: string,
|
||||
buildFlavor: BuildFlavor = 'traditional'
|
||||
) {
|
||||
if (lazyLoaded) {
|
||||
return await lazyLoaded(emsSettings, version);
|
||||
return await lazyLoaded(emsSettings, version, buildFlavor);
|
||||
}
|
||||
|
||||
lazyLoaded = await new Promise(async (resolve, reject) => {
|
||||
|
@ -29,5 +34,5 @@ export async function createEMSClientLazy(emsSettings: EMSSettings, version: str
|
|||
}
|
||||
});
|
||||
|
||||
return await lazyLoaded(emsSettings, version);
|
||||
return await lazyLoaded(emsSettings, version, buildFlavor);
|
||||
}
|
||||
|
|
|
@ -35,10 +35,11 @@ export class MapsEmsPlugin implements Plugin<MapsEmsPluginPublicSetup, MapsEmsPl
|
|||
}
|
||||
|
||||
public start(code: CoreStart, plugins: MapsEmsStartPublicDependencies) {
|
||||
const mapConfig = this._initializerContext.config.get<MapConfig>();
|
||||
const kibanaVersion = this._initializerContext.env.packageInfo.version;
|
||||
const context = this._initializerContext;
|
||||
const mapConfig = context.config.get<MapConfig>();
|
||||
const { buildFlavor, version } = context.env.packageInfo;
|
||||
|
||||
setKibanaVersion(kibanaVersion);
|
||||
setKibanaVersion(version);
|
||||
setMapConfig(mapConfig);
|
||||
|
||||
if (plugins.licensing) {
|
||||
|
@ -51,7 +52,7 @@ export class MapsEmsPlugin implements Plugin<MapsEmsPluginPublicSetup, MapsEmsPl
|
|||
},
|
||||
createEMSClient: async () => {
|
||||
const emsSettings = createEMSSettings(mapConfig, getIsEnterprisePlus);
|
||||
return createEMSClientLazy(emsSettings, kibanaVersion);
|
||||
return createEMSClientLazy(emsSettings, version, buildFlavor);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"@kbn/licensing-plugin",
|
||||
"@kbn/i18n",
|
||||
"@kbn/config-schema",
|
||||
"@kbn/config",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue