Skip to content

Commit

Permalink
[Lens] show meta field data in Lens (#77210)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Sep 24, 2020
1 parent eebb6af commit a69f2fb
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 251 deletions.
21 changes: 0 additions & 21 deletions x-pack/plugins/lens/public/indexpattern_datasource/datapanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,6 @@
margin-bottom: $euiSizeS;
}

/**
* 1. Don't cut off the shadow of the field items
*/

.lnsInnerIndexPatternDataPanel__listWrapper {
@include euiOverflowShadow;
@include euiScrollBar;
margin-left: -$euiSize; /* 1 */
position: relative;
flex-grow: 1;
overflow: auto;
}

.lnsInnerIndexPatternDataPanel__list {
padding-top: $euiSizeS;
position: absolute;
top: 0;
left: $euiSize; /* 1 */
right: $euiSizeXS; /* 1 */
}

.lnsInnerIndexPatternDataPanel__fieldItems {
// Quick fix for making sure the shadow and focus rings are visible outside the accordion bounds
padding: $euiSizeXS $euiSizeXS 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,40 @@ describe('IndexPattern Data Panel', () => {
).toEqual(['client', 'source', 'timestampLabel']);
});

it('should show meta fields accordion', async () => {
const wrapper = mountWithIntl(
<InnerIndexPatternDataPanel
{...props}
indexPatterns={{
'1': {
...props.indexPatterns['1'],
fields: [
...props.indexPatterns['1'].fields,
{ name: '_id', displayName: '_id', meta: true, type: 'string' },
],
},
}}
/>
);
wrapper
.find('[data-test-subj="lnsIndexPatternMetaFields"]')
.find('button')
.first()
.simulate('click');
expect(
wrapper
.find('[data-test-subj="lnsIndexPatternMetaFields"]')
.find(FieldItem)
.first()
.prop('field').name
).toEqual('_id');
});

it('should display NoFieldsCallout when all fields are empty', async () => {
const wrapper = mountWithIntl(
<InnerIndexPatternDataPanel {...defaultProps} existingFields={{ idx1: {} }} />
);
expect(wrapper.find(NoFieldsCallout).length).toEqual(1);
expect(wrapper.find(NoFieldsCallout).length).toEqual(2);
expect(
wrapper
.find('[data-test-subj="lnsIndexPatternAvailableFields"]')
Expand All @@ -654,7 +683,7 @@ describe('IndexPattern Data Panel', () => {
.length
).toEqual(1);
wrapper.setProps({ existingFields: { idx1: {} } });
expect(wrapper.find(NoFieldsCallout).length).toEqual(1);
expect(wrapper.find(NoFieldsCallout).length).toEqual(2);
});

it('should filter down by name', () => {
Expand Down Expand Up @@ -699,7 +728,7 @@ describe('IndexPattern Data Panel', () => {
expect(wrapper.find(FieldItem).map((fieldItem) => fieldItem.prop('field').name)).toEqual([
'Records',
]);
expect(wrapper.find(NoFieldsCallout).length).toEqual(2);
expect(wrapper.find(NoFieldsCallout).length).toEqual(3);
});

it('should toggle type if clicked again', () => {
Expand Down
Loading

0 comments on commit a69f2fb

Please sign in to comment.