mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[UnifiedFieldList] Revert changes from Discover for now
This commit is contained in:
parent
871016ae6d
commit
3f4ae6e395
6 changed files with 4 additions and 63 deletions
|
@ -15,8 +15,7 @@
|
|||
"savedObjects",
|
||||
"dataViewFieldEditor",
|
||||
"dataViewEditor",
|
||||
"expressions",
|
||||
"unifiedFieldList"
|
||||
"expressions"
|
||||
],
|
||||
"optionalPlugins": ["home", "share", "usageCollection", "spaces", "triggersActionsUi"],
|
||||
"requiredBundles": ["kibanaUtils", "kibanaReact", "dataViews", "unifiedSearch", "savedSearch"],
|
||||
|
|
|
@ -56,7 +56,6 @@ function getComponent({
|
|||
onRemoveField: jest.fn(),
|
||||
showDetails,
|
||||
selected,
|
||||
state: {},
|
||||
};
|
||||
const services = {
|
||||
history: () => ({
|
||||
|
|
|
@ -20,22 +20,18 @@ import {
|
|||
EuiFlexItem,
|
||||
EuiSpacer,
|
||||
EuiHorizontalRule,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { UiCounterMetricType } from '@kbn/analytics';
|
||||
import classNames from 'classnames';
|
||||
import { FieldButton, FieldIcon } from '@kbn/react-field';
|
||||
import type { DataViewField, DataView } from '@kbn/data-views-plugin/public';
|
||||
import { FieldStats } from '@kbn/unified-field-list-plugin/public';
|
||||
import { getFieldCapabilities } from '../../../../utils/get_field_capabilities';
|
||||
import { getTypeForFieldIcon } from '../../../../utils/get_type_for_field_icon';
|
||||
import { DiscoverFieldDetails } from './discover_field_details';
|
||||
import { FieldDetails } from './types';
|
||||
import { getFieldTypeName } from '../../../../utils/get_field_type_name';
|
||||
import { DiscoverFieldVisualize } from './discover_field_visualize';
|
||||
import type { AppState } from '../../services/discover_state';
|
||||
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
|
||||
|
||||
function wrapOnDot(str?: string) {
|
||||
// u200B is a non-width white-space character, which allows
|
||||
|
@ -267,11 +263,6 @@ export interface DiscoverFieldProps {
|
|||
* Optionally show or hide field stats in the popover
|
||||
*/
|
||||
showFieldStats?: boolean;
|
||||
|
||||
/**
|
||||
* Discover App State
|
||||
*/
|
||||
state: AppState;
|
||||
}
|
||||
|
||||
function DiscoverFieldComponent({
|
||||
|
@ -288,10 +279,7 @@ function DiscoverFieldComponent({
|
|||
onEditField,
|
||||
onDeleteField,
|
||||
showFieldStats,
|
||||
state,
|
||||
}: DiscoverFieldProps) {
|
||||
const services = useDiscoverServices();
|
||||
const { data } = services;
|
||||
const [infoIsOpen, setOpen] = useState(false);
|
||||
const isDocumentRecord = !!onAddFilter;
|
||||
|
||||
|
@ -409,51 +397,13 @@ function DiscoverFieldComponent({
|
|||
|
||||
const renderPopover = () => {
|
||||
const details = getDetails(field);
|
||||
const dateRange = data?.query?.timefilter.timefilter.getTime();
|
||||
const fieldForStats = multiFields ? multiFields[0].field : field; // TODO: how to handle multifields?
|
||||
const showNewStatsPreviewInDiscover = true; // Toggle this variable to preview new stats locally
|
||||
|
||||
// TODO: integrate <FieldStats .../>
|
||||
|
||||
return (
|
||||
<>
|
||||
{showFieldStats && (
|
||||
<>
|
||||
{showNewStatsPreviewInDiscover && (
|
||||
<>
|
||||
<EuiText color="subdued" size="s">
|
||||
{'Stats as in Lens:'}
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
{Boolean(dateRange) && (
|
||||
<FieldStats
|
||||
services={services}
|
||||
query={state.query!}
|
||||
filters={state.filters!}
|
||||
fromDate={dateRange.from}
|
||||
toDate={dateRange.to}
|
||||
dataViewOrDataViewId={dataView}
|
||||
field={fieldForStats}
|
||||
testSubject="dscFieldListPanel"
|
||||
overrideMissingContent={(params) => {
|
||||
if (params?.noDataFound) {
|
||||
return (
|
||||
<EuiText size="s">{`TODO: add a custom "no data available" message for ${fieldForStats.type} field`}</EuiText>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<EuiText size="s">{`TODO: add a custom "stats are not available" message for ${fieldForStats.type} field`}</EuiText>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* TODO: remove previous field stats view when we finish FieldStats component and add addFilter buttons to it */}
|
||||
<EuiSpacer size="l" />
|
||||
<EuiText color="subdued" size="s">
|
||||
{'Current Discover stats:'}
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
</>
|
||||
)}
|
||||
<EuiTitle size="xxxs">
|
||||
<h5>
|
||||
{i18n.translate('discover.fieldChooser.discoverField.fieldTopValuesLabel', {
|
||||
|
@ -482,7 +432,7 @@ function DiscoverFieldComponent({
|
|||
</>
|
||||
)}
|
||||
{(showFieldStats || multiFields) && <EuiHorizontalRule margin="m" />}
|
||||
<DiscoverFieldVisualize // TODO: what to do with `details`?
|
||||
<DiscoverFieldVisualize
|
||||
field={field}
|
||||
dataView={dataView}
|
||||
multiFields={rawMultiFields}
|
||||
|
|
|
@ -116,7 +116,6 @@ export function DiscoverSidebarComponent({
|
|||
viewMode,
|
||||
createNewDataView,
|
||||
showDataViewPicker,
|
||||
state,
|
||||
}: DiscoverSidebarProps) {
|
||||
const { uiSettings, dataViewFieldEditor } = useDiscoverServices();
|
||||
const [fields, setFields] = useState<DataViewField[] | null>(null);
|
||||
|
@ -413,7 +412,6 @@ export function DiscoverSidebarComponent({
|
|||
onEditField={editField}
|
||||
onDeleteField={deleteField}
|
||||
showFieldStats={showFieldStats}
|
||||
state={state}
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
|
@ -474,7 +472,6 @@ export function DiscoverSidebarComponent({
|
|||
onEditField={editField}
|
||||
onDeleteField={deleteField}
|
||||
showFieldStats={showFieldStats}
|
||||
state={state}
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
|
@ -504,7 +501,6 @@ export function DiscoverSidebarComponent({
|
|||
onEditField={editField}
|
||||
onDeleteField={deleteField}
|
||||
showFieldStats={showFieldStats}
|
||||
state={state}
|
||||
/>
|
||||
</li>
|
||||
);
|
||||
|
|
|
@ -83,7 +83,6 @@ export interface DiscoverServices {
|
|||
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
|
||||
locator: DiscoverAppLocator;
|
||||
expressions: ExpressionsStart;
|
||||
charts: ChartsPluginStart;
|
||||
}
|
||||
|
||||
export const buildServices = memoize(function (
|
||||
|
@ -129,6 +128,5 @@ export const buildServices = memoize(function (
|
|||
triggersActionsUi: plugins.triggersActionsUi,
|
||||
locator,
|
||||
expressions: plugins.expressions,
|
||||
charts: plugins.charts,
|
||||
};
|
||||
});
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
{ "path": "../field_formats/tsconfig.json" },
|
||||
{ "path": "../data_views/tsconfig.json" },
|
||||
{ "path": "../unified_search/tsconfig.json" },
|
||||
{ "path": "../unified_field_list/tsconfig.json" },
|
||||
{ "path": "../../../x-pack/plugins/spaces/tsconfig.json" },
|
||||
{ "path": "../data_view_editor/tsconfig.json" },
|
||||
{ "path": "../../../x-pack/plugins/triggers_actions_ui/tsconfig.json" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue