-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files moved and relative paths updated
- Loading branch information
Aaron Caldwell
committed
Feb 10, 2020
1 parent
6820c45
commit 2649472
Showing
326 changed files
with
33,891 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { ES_SPATIAL_RELATIONS } from './constants'; | ||
|
||
export function getAppTitle() { | ||
return i18n.translate('xpack.maps.appTitle', { | ||
defaultMessage: 'Maps', | ||
}); | ||
} | ||
|
||
export function getDataSourceLabel() { | ||
return i18n.translate('xpack.maps.source.dataSourceLabel', { | ||
defaultMessage: 'Data source', | ||
}); | ||
} | ||
|
||
export function getUrlLabel() { | ||
return i18n.translate('xpack.maps.source.urlLabel', { | ||
defaultMessage: 'Url', | ||
}); | ||
} | ||
|
||
export function getEsSpatialRelationLabel(spatialRelation) { | ||
switch (spatialRelation) { | ||
case ES_SPATIAL_RELATIONS.INTERSECTS: | ||
return i18n.translate('xpack.maps.common.esSpatialRelation.intersectsLabel', { | ||
defaultMessage: 'intersects', | ||
}); | ||
case ES_SPATIAL_RELATIONS.DISJOINT: | ||
return i18n.translate('xpack.maps.common.esSpatialRelation.disjointLabel', { | ||
defaultMessage: 'disjoint', | ||
}); | ||
case ES_SPATIAL_RELATIONS.WITHIN: | ||
return i18n.translate('xpack.maps.common.esSpatialRelation.withinLabel', { | ||
defaultMessage: 'within', | ||
}); | ||
case ES_SPATIAL_RELATIONS.CONTAINS: | ||
return i18n.translate('xpack.maps.common.esSpatialRelation.containsLabel', { | ||
defaultMessage: 'contains', | ||
}); | ||
default: | ||
return spatialRelation; | ||
} | ||
} |
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,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { parseString } from 'xml2js'; | ||
|
||
// promise based wrapper around parseString | ||
export async function parseXmlString(xmlString) { | ||
const parsePromise = new Promise((resolve, reject) => { | ||
parseString(xmlString, (error, result) => { | ||
if (error) { | ||
reject(error); | ||
} else { | ||
resolve(result); | ||
} | ||
}); | ||
}); | ||
|
||
return await parsePromise; | ||
} |
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,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { parseXmlString } from './parse_xml_string'; | ||
|
||
describe('parseXmlString', () => { | ||
it('Should parse xml string into JS object', async () => { | ||
const xmlAsObject = await parseXmlString('<foo>bar</foo>'); | ||
expect(xmlAsObject).toEqual({ | ||
foo: 'bar', | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.