Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Observability] Exploratory View initial skeleton #94426

Merged
merged 86 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
9e7c169
wip
shahzad31 Mar 7, 2021
12c028f
Merge branch 'master' into exploratry-view
shahzad31 Mar 8, 2021
b089a87
Save progress
shahzad31 Mar 10, 2021
501a166
Merge branch 'master' into exploratry-view
shahzad31 Mar 10, 2021
3ed7c82
breakpoint
shahzad31 Mar 11, 2021
c303383
Merge branch 'master' into exploratry-view
shahzad31 Mar 11, 2021
73b2c41
more views
shahzad31 Mar 15, 2021
9166efc
add def col
shahzad31 Mar 15, 2021
3783b5f
Merge branch 'master' into exploratry-view
shahzad31 Mar 15, 2021
04316ab
update
shahzad31 Mar 15, 2021
9677edd
Merge branch 'master' into exploratry-view
shahzad31 Mar 15, 2021
e715ace
wip
shahzad31 Mar 15, 2021
5d3605f
Merge branch 'master' into exploratry-view
shahzad31 Mar 15, 2021
3d824be
wip
shahzad31 Mar 16, 2021
1db17ad
Merge branch 'master' into exploratry-view
shahzad31 Mar 16, 2021
306fa3f
wip
shahzad31 Mar 17, 2021
e2f281f
Merge branch 'master' into exploratry-view
shahzad31 Mar 17, 2021
700cdd7
fix more stuff
shahzad31 Mar 18, 2021
ee82e77
Merge branch 'master' into exploratry-view
shahzad31 Mar 19, 2021
1d5a7c8
update
shahzad31 Mar 21, 2021
91bcf95
Merge branch 'master' into exploratry-view
shahzad31 Mar 22, 2021
2ec3924
update filters
shahzad31 Mar 22, 2021
4f8f118
update
shahzad31 Mar 22, 2021
b2fbc2b
wip
shahzad31 Mar 23, 2021
e5c1e59
update
shahzad31 Mar 23, 2021
c14a2e5
update asset
shahzad31 Mar 24, 2021
165a540
update
shahzad31 Mar 24, 2021
e3b3eb5
update eslint
shahzad31 Mar 24, 2021
4b8aab4
Merge branch 'master' into exploratry-view
shahzad31 Mar 24, 2021
84c2abe
udate
shahzad31 Mar 24, 2021
75b87e1
wip
shahzad31 Mar 24, 2021
533698a
update plugin start/setup
shahzad31 Mar 24, 2021
f60a7f5
Merge branch 'master' into exploratry-view
shahzad31 Mar 24, 2021
805f062
update
shahzad31 Mar 24, 2021
8952b21
Merge branch 'master' into update-obsv-plugin-setup
shahzad31 Mar 24, 2021
68282c6
fix types
shahzad31 Mar 24, 2021
9886ef6
Merge branch 'master' into update-obsv-plugin-setup
shahzad31 Mar 25, 2021
a2121eb
update types
shahzad31 Mar 25, 2021
4b87ef9
Merge branch 'master' into exploratry-view
shahzad31 Mar 25, 2021
ad9574f
Merge branch 'master' into exploratry-view
shahzad31 Mar 25, 2021
52cbefa
fix type
shahzad31 Mar 25, 2021
a6dcd15
fix types
shahzad31 Mar 25, 2021
7af9e25
fix types
shahzad31 Mar 25, 2021
6c1a330
fix types
shahzad31 Mar 25, 2021
89d87e0
Merge branch 'master' into exploratry-view
shahzad31 Mar 25, 2021
a85d735
Merge branch 'master' into exploratry-view
shahzad31 Mar 25, 2021
3c670f2
fix test
shahzad31 Mar 25, 2021
d26f306
update test
shahzad31 Mar 25, 2021
ec98c08
Merge branch 'update-obsv-plugin-setup' into exploratry-view
shahzad31 Mar 25, 2021
43887f1
update types
shahzad31 Mar 26, 2021
967888a
fix types
shahzad31 Mar 26, 2021
8e5109f
Merge branch 'master' into exploratry-view
shahzad31 Mar 26, 2021
9acecc1
fix issue
shahzad31 Mar 26, 2021
082eaf4
Merge branch 'master' into exploratry-view
shahzad31 Mar 26, 2021
211716b
fix types
shahzad31 Mar 26, 2021
635be8e
test
shahzad31 Mar 26, 2021
50e100f
Merge branch 'master' into exploratry-view
shahzad31 Mar 26, 2021
dbb98c7
update tests
shahzad31 Mar 29, 2021
68d8243
added ests
shahzad31 Mar 29, 2021
1f4a516
update
shahzad31 Mar 29, 2021
31b60b6
Merge branch 'master' into exploratry-view
shahzad31 Mar 30, 2021
0557ad3
update
shahzad31 Mar 30, 2021
c512b3d
Merge branch 'master' into exploratry-view
shahzad31 Mar 30, 2021
e4ce7bd
update labels
shahzad31 Mar 30, 2021
1b57eff
Merge branch 'master' into exploratry-view
shahzad31 Mar 30, 2021
17120a6
Merge branch 'master' into exploratry-view
shahzad31 Mar 30, 2021
1710e5d
PR feedback
shahzad31 Mar 31, 2021
f162f96
update
shahzad31 Mar 31, 2021
c43e925
add loading state
shahzad31 Mar 31, 2021
adfefa3
fix types
shahzad31 Mar 31, 2021
e004a7a
fix types
shahzad31 Mar 31, 2021
01a1559
update test
shahzad31 Mar 31, 2021
5406e75
Merge branch 'master' into exploratry-view
shahzad31 Mar 31, 2021
2b5229b
update test
shahzad31 Mar 31, 2021
f894f18
update constants
shahzad31 Mar 31, 2021
7050460
fix type
shahzad31 Mar 31, 2021
06f305b
Merge branch 'master' into exploratry-view
kibanamachine Apr 1, 2021
62070d4
Merge branch 'master' into exploratry-view
shahzad31 Apr 1, 2021
9090e64
update mock
shahzad31 Apr 1, 2021
3e29da3
Merge branch 'exploratry-view' of https://github.com/shahzad31/kibana…
shahzad31 Apr 1, 2021
25c45e0
update test file
shahzad31 Apr 1, 2021
c18c829
debug tests
shahzad31 Apr 1, 2021
99d3596
Merge branch 'master' into exploratry-view
shahzad31 Apr 2, 2021
679a4a8
Merge branch 'master' into exploratry-view
shahzad31 Apr 3, 2021
9c86621
Merge branch 'master' into exploratry-view
shahzad31 Apr 5, 2021
7e5cf29
update plugin setup
shahzad31 Apr 5, 2021
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
Prev Previous commit
Next Next commit
update
  • Loading branch information
shahzad31 committed Mar 24, 2021
commit 805f0621aaedf409fc5d3147c198bd5f84ba0c30
1 change: 0 additions & 1 deletion x-pack/plugins/lens/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export {
EmbeddableComponentProps,
TypedLensByValueInput,
} from './editor_frame_service/embeddable/embeddable_component';
export { XYChartTypes } from './shared_components/chart_types';
export type {
XYState,
AxesSettingsConfig,
Expand Down
11 changes: 10 additions & 1 deletion x-pack/plugins/lens/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
VISUALIZE_FIELD_TRIGGER,
} from '../../../../src/plugins/ui_actions/public';
import { APP_ID, getEditPath, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common';
import { EditorFrameStart } from './types';
import { EditorFrameStart, VisualizationType } from './types';
import { getLensAliasConfig } from './vis_type_alias';
import { visualizeFieldAction } from './trigger_actions/visualize_field_actions';
import { getSearchProvider } from './search_provider';
Expand Down Expand Up @@ -101,6 +101,11 @@ export interface LensPublicStart {
* Method which returns true if the user has permission to use Lens as defined by application capabilities.
*/
canUseEditor: () => boolean;

/**
* Method which returns xy VisualizationTypes array keeping this async as to not impact page load bundle
*/
getXyVisTypes: () => Promise<VisualizationType[]>;
}

export class LensPlugin {
Expand Down Expand Up @@ -257,6 +262,10 @@ export class LensPlugin {
canUseEditor: () => {
return Boolean(core.application.capabilities.visualize?.show);
},
getXyVisTypes: async () => {
const { visualizationTypes } = await import('./xy_visualization/types');
return visualizationTypes;
},
};
}

Expand Down
19 changes: 0 additions & 19 deletions x-pack/plugins/lens/public/shared_components/chart_types/index.tsx

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
* 2.0.
*/

import React from 'react';
import React, { useState } from 'react';

import { EuiButton, EuiButtonGroup, EuiButtonIcon, EuiPopover } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { useKibana } from '../../../../../../../../../src/plugins/kibana_react/public';
import { ObservabilityClientPluginsStart } from '../../../../../plugin';
import { useFetcher } from '../../../../..';
import { useUrlStorage } from '../../hooks/use_url_strorage';
import { XYChartTypes } from '../../../../../../../lens/public';

export function SeriesChartTypes({
seriesId,
Expand Down Expand Up @@ -38,3 +43,95 @@ export function SeriesChartTypes({
/>
);
}

export interface XYChartTypesProps {
onChange: (value: string) => void;
value: string;
label?: string;
includeChartTypes?: string[];
excludeChartTypes?: string[];
}

function XYChartTypes({
onChange,
value,
label,
includeChartTypes,
excludeChartTypes,
}: XYChartTypesProps) {
const [isOpen, setIsOpen] = useState(false);

const {
services: { lens },
} = useKibana<ObservabilityClientPluginsStart>();

const { data = [] } = useFetcher(() => lens.getXyVisTypes(), [lens]);
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved

let vizTypes = data ?? [];

if ((excludeChartTypes ?? []).length > 0) {
vizTypes = vizTypes.filter(({ id }) => !excludeChartTypes?.includes(id));
}

if ((includeChartTypes ?? []).length > 0) {
vizTypes = vizTypes.filter(({ id }) => includeChartTypes?.includes(id));
}

return (
<EuiPopover
isOpen={isOpen}
anchorPosition="downCenter"
button={
label ? (
<EuiButton
size="s"
color="text"
iconType={vizTypes.find(({ id }) => id === value)?.icon}
onClick={() => {
setIsOpen((prevState) => !prevState);
}}
>
{label}
</EuiButton>
) : (
<EuiButtonIcon
iconType={vizTypes.find(({ id }) => id === value)?.icon!}
onClick={() => {
setIsOpen((prevState) => !prevState);
}}
/>
)
}
closePopover={() => setIsOpen(false)}
>
<ButtonGroup
isIconOnly
buttonSize="m"
legend={i18n.translate('xpack.lens.xyChart.chartTypeLegend', {
defaultMessage: 'Chart type',
})}
name="chartType"
className="eui-displayInlineBlock"
options={vizTypes.map((t) => ({
id: t.id,
label: t.label,
title: t.label,
iconType: t.icon || 'empty',
'data-test-subj': `lnsXY_seriesType-${t.id}`,
}))}
idSelected={value}
onChange={(valueN: string) => {
onChange(valueN);
}}
/>
</EuiPopover>
);
}

const ButtonGroup = styled(EuiButtonGroup)`
&&& {
.euiButtonGroupButton-isSelected {
background-color: #a5a9b1 !important;
}
}
`;