-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] Update default map client (#323)
* [Build] Update default maps client Update to not use EMS so it works out of the box. Related to: #221 Fails linter and should problem write more unit tests but working with smoke tests. Signed-off-by: Kawika Avilla <[email protected]> * [Build] fix linter for map messages Signed-off-by: Kawika Avilla <[email protected]> * [Build] enable and update map func tests Passing on the CI. Needed to update the casing of the expected response but that was all that was needed. Signed-off-by: Kawika Avilla <[email protected]> * [Rename] rename to osd_version Signed-off-by: Kawika Avilla <[email protected]>
- Loading branch information
Showing
15 changed files
with
237 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/plugins/maps_legacy/public/common/opensearch_maps_client.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
import { EMSClient } from '@elastic/ems-client'; | ||
|
||
export class OpenSearchMapsClient extends EMSClient { | ||
constructor({ osdVersion, manifestServiceUrl, language, landingPageUrl, fetchFunction }) { | ||
super({ osdVersion, manifestServiceUrl, language, landingPageUrl, fetchFunction }); | ||
this._queryParams = { | ||
osd_version: osdVersion, | ||
opensearch_tos_agree: true, | ||
}; | ||
this._manifestServiceUrl = manifestServiceUrl; | ||
} | ||
|
||
async isEnabled() { | ||
let result; | ||
try { | ||
result = await this._fetchWithTimeout(this._manifestServiceUrl); | ||
} catch (e) { | ||
// silently ignoring the exception and returning false. | ||
return false; | ||
} | ||
if (result.ok) { | ||
const resultJson = await result.json(); | ||
return resultJson.enabled; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.