- {details.error &&
{details.error}}
- {!details.error && (
+ {details.error &&
{details.error}}
+ {!details.error && (
+ <>
{details.buckets.map((bucket: Bucket, idx: number) => (
))}
- )}
-
- {showVisualizeLink && (
- <>
-
- {/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
-
handleVisualizeLinkClick(e)}
- href={visualizeLink}
- size="s"
- className="dscFieldDetails__visualizeBtn"
- data-test-subj={`fieldVisualize-${field.name}`}
- >
+
+
+ {!indexPattern.metaFields.includes(field.name) && !field.scripted ? (
+ onAddFilter('_exists_', field.name, '+')}
+ data-test-subj="onAddFilterButton"
+ >
+
+
+ ) : (
-
- {warnings.length > 0 && (
-
)}
- >
- )}
-
+
+ >
+ )}
>
);
}
diff --git a/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field_details_footer.test.tsx b/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field_details_footer.test.tsx
deleted file mode 100644
index aa93b2a663736..0000000000000
--- a/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field_details_footer.test.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-import React from 'react';
-import { findTestSubject } from '@elastic/eui/lib/test';
-import { mountWithIntl } from '@kbn/test/jest';
-// @ts-expect-error
-import stubbedLogstashFields from '../../../../../__fixtures__/logstash_fields';
-import { coreMock } from '../../../../../../../../core/public/mocks';
-import { IndexPatternField } from '../../../../../../../data/public';
-import { getStubIndexPattern } from '../../../../../../../data/public/test_utils';
-import { DiscoverFieldDetailsFooter } from './discover_field_details_footer';
-
-const indexPattern = getStubIndexPattern(
- 'logstash-*',
- (cfg: unknown) => cfg,
- 'time',
- stubbedLogstashFields(),
- coreMock.createSetup()
-);
-
-describe('discover sidebar field details footer', function () {
- const onAddFilter = jest.fn();
- const defaultProps = {
- indexPattern,
- details: { buckets: [], error: '', exists: 1, total: 2, columns: [] },
- onAddFilter,
- };
-
- function mountComponent(field: IndexPatternField) {
- const compProps = { ...defaultProps, field };
- return mountWithIntl(