Skip to content

Commit

Permalink
[Discover] Deangularize controller part 1 (#93896)
Browse files Browse the repository at this point in the history
* Refactor minimumVisibleRows

* Extract setupVisualization function

* Extract getDimensions function

* Inline breadcrumb and help menu function exec to discover.tsx

* Extract getStateDefault 

* Remove unnecessary code

* Improve performance by React.memo
  • Loading branch information
kertal authored Mar 25, 2021
1 parent 070ca4b commit 6b5023a
Show file tree
Hide file tree
Showing 26 changed files with 704 additions and 374 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const fields = [
type: 'date',
scripted: false,
filterable: true,
aggregatable: true,
sortable: true,
},
{
name: 'message',
Expand All @@ -34,12 +36,14 @@ const fields = [
type: 'string',
scripted: false,
filterable: true,
aggregatable: true,
},
{
name: 'bytes',
type: 'number',
scripted: false,
filterable: true,
aggregatable: true,
},
{
name: 'scripted',
Expand All @@ -55,14 +59,14 @@ fields.getByName = (name: string) => {

const indexPattern = ({
id: 'index-pattern-with-timefield-id',
title: 'index-pattern-without-timefield',
title: 'index-pattern-with-timefield',
metaFields: ['_index', '_score'],
flattenHit: undefined,
formatHit: jest.fn((hit) => hit._source),
fields,
getComputedFields: () => ({}),
getSourceFiltering: () => ({}),
getFieldByName: () => ({}),
getFieldByName: (name: string) => fields.getByName(name),
timeFieldName: 'timestamp',
} as unknown) as IndexPattern;

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/discover/public/__mocks__/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
*/

import { IUiSettingsClient } from 'kibana/public';
import { SAMPLE_SIZE_SETTING } from '../../common';
import { DEFAULT_COLUMNS_SETTING, SAMPLE_SIZE_SETTING } from '../../common';

export const uiSettingsMock = ({
get: (key: string) => {
if (key === SAMPLE_SIZE_SETTING) {
return 10;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
}
},
} as unknown) as IUiSettingsClient;
Loading

0 comments on commit 6b5023a

Please sign in to comment.