Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export { wrapInI18nContext } from 'ui/i18n';
import { search } from '../../../../../plugins/data/public';
export const { getRequestInspectorStats, getResponseInspectorStats, tabifyAggResponse } = search;
// @ts-ignore
export { shortenDottedString } from '../../common/utils/shorten_dotted_string';
// @ts-ignore
export { intervalOptions } from 'ui/agg_types';
export { subscribeWithScope } from '../../../../../plugins/kibana_legacy/public';
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import classNames from 'classnames';
import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';

import { FieldIcon, FieldIconProps } from '../../../../../../../../../plugins/kibana_react/public';
import { shortenDottedString } from '../../../../kibana_services';
import { shortenDottedString } from '../../../helpers';
import { getFieldTypeName } from './field_type_name';

// property field is provided at discover's field chooser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { IndexPattern, shortenDottedString } from '../../../../../kibana_services';
import { IndexPattern } from '../../../../../kibana_services';
import { shortenDottedString } from '../../../../helpers';

export type SortOrder = [string, string];
export interface ColumnProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,4 @@
* under the License.
*/

import expect from '@kbn/expect';
import { shortenDottedString } from '../shorten_dotted_string';

describe('shortenDottedString', () => {
it('Convert a dot.notated.string into a short string', () => {
expect(shortenDottedString('dot.notated.string')).to.equal('d.n.string');
});

it('Ignores non-string values', () => {
expect(shortenDottedString(true)).to.equal(true);
expect(shortenDottedString(123)).to.equal(123);
const obj = { key: 'val' };
expect(shortenDottedString(obj)).to.equal(obj);
});
});
export { shortenDottedString } from './shorten_dotted_string';
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@ const DOT_PREFIX_RE = /(.).+?\./g;
/**
* Convert a dot.notated.string into a short
* version (d.n.string)
*
* @param {string} str - the long string to convert
* @return {string}
*/
export function shortenDottedString(input) {
return typeof input !== 'string' ? input : input.replace(DOT_PREFIX_RE, '$1.');
}
export const shortenDottedString = (input: string) => input.replace(DOT_PREFIX_RE, '$1.');