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

[Portable Dashboards] Implementation Feature Branch #144332

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c24569d
Initial portable dashboards commit
ThomThomson Sep 29, 2022
ce6a832
Implementation in Dashboard actions, app, and container
ThomThomson Oct 24, 2022
0a7bfa3
Merge branch 'main' of https://github.com/elastic/kibana into portabl…
ThomThomson Oct 25, 2022
f1a9b6f
Removed container context in favor of exposing the embeddable instanc…
ThomThomson Oct 27, 2022
11a3600
Unified search integration, dashboard diffing integration, outcome ha…
ThomThomson Nov 1, 2022
82f0cc7
first attempt at loading locator state. Dashboards expect id change
ThomThomson Nov 1, 2022
808afa7
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 1, 2022
296cc7b
reorganize strings, finish locator / drilldown reimplementation, reim…
ThomThomson Nov 1, 2022
89a68db
Merge remote-tracking branch 'origin/portableDashboards/implementatio…
ThomThomson Nov 1, 2022
079e0f7
Some type checks, control group reimplementation
ThomThomson Nov 3, 2022
671e7f5
remove unused translations, fix types and linting
ThomThomson Nov 3, 2022
3b03030
security solution fix, expect id change on save as new
ThomThomson Nov 3, 2022
cef9150
removed old dashboard example, removed some translations and fixed so…
ThomThomson Nov 3, 2022
2892a28
add loading spinner
ThomThomson Nov 3, 2022
63beef6
make controls integration optional, fix some jest tests
ThomThomson Nov 3, 2022
52796ca
Remove saved query id from dashboard input
ThomThomson Nov 4, 2022
daa817d
Remove dashboard embeddable example functional tests as the example n…
ThomThomson Nov 4, 2022
000a41c
fix sharing bug, simplify dashboard container renderer props
ThomThomson Nov 4, 2022
b10c509
move dashboard options to top level temporarily
ThomThomson Nov 7, 2022
33e6e2a
update snapshot
ThomThomson Nov 7, 2022
2e666b1
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Nov 7, 2022
6d37300
update doc link
ThomThomson Nov 7, 2022
89d010a
Fix type issue in test, shrink dashboard bundle size
ThomThomson Nov 7, 2022
dec251e
Reset time restore on reset dashboard state, fix relevant data view. …
ThomThomson Nov 9, 2022
98889b5
remove exclusive suite...
ThomThomson Nov 9, 2022
f29024d
Fix broken URL forward param. Disable expecting ID Change for now to …
ThomThomson Nov 9, 2022
1c72742
change strategy for drag handle assignment not to rely on React Grid …
ThomThomson Nov 9, 2022
8de13d8
Search sessions integration. Fix copy to dashboard and remove panel a…
ThomThomson Nov 18, 2022
82169fb
simplify integrations and cleanup
ThomThomson Nov 18, 2022
497ddd4
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Nov 18, 2022
0b0eef4
merge changes
ThomThomson Nov 18, 2022
1b45647
Fix type
ThomThomson Nov 18, 2022
feca191
fix remove panel action
ThomThomson Nov 18, 2022
f52aa12
Update snapshot
ThomThomson Nov 18, 2022
fd6eb6b
start new session on state change. Change state diff system
ThomThomson Nov 18, 2022
af29b86
move global query sync earlier
ThomThomson Nov 20, 2022
9eae25e
move global query sync slightly later...
ThomThomson Nov 22, 2022
f889908
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Nov 22, 2022
bbe35bd
Update save modal test snap
ThomThomson Nov 22, 2022
b151995
remove empty file
ThomThomson Nov 22, 2022
ef3dc8f
Pass execution context down to children. Diff state separately for ch…
ThomThomson Nov 23, 2022
0c87fce
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Nov 23, 2022
cde3f44
Extra comment, extra await to stabalize falky test
ThomThomson Nov 24, 2022
9ecf032
Merge branch 'main' into portableDashboards/implementation
kibanamachine Nov 28, 2022
08e6c26
use redux embeddable context instead of redux container context
ThomThomson Nov 28, 2022
48a3ce8
Merge branch 'main' into portableDashboards/implementation
kibanamachine Dec 5, 2022
9b2086c
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Dec 7, 2022
7537d74
start new search session when sync colors changes.
ThomThomson Dec 7, 2022
f867a8e
await until initialized in test
ThomThomson Dec 7, 2022
5f00cf9
Merge branch 'main' into portableDashboards/implementation
kibanamachine Dec 8, 2022
8a09aa3
Merge branch 'main' into portableDashboards/implementation
kibanamachine Dec 8, 2022
7bd2df7
Merge remote-tracking branch 'upstream/main' into portableDashboards/…
ThomThomson Dec 14, 2022
3aab559
remove unused strings reimplement logic that keeps hide panel titles.
ThomThomson Dec 14, 2022
d090b85
Merge remote-tracking branch 'refs/remotes/origin/portableDashboards/…
ThomThomson Dec 14, 2022
cf96aa7
review feedback, remove more translations
ThomThomson Dec 14, 2022
026b224
reinstate play functionality for time slider
ThomThomson Dec 14, 2022
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
28 changes: 8 additions & 20 deletions examples/dashboard_embeddable_examples/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {
EuiPageContentBody_Deprecated as EuiPageContentBody,
EuiPageSideBar_Deprecated as EuiPageSideBar,
EuiSideNav,
EuiTitle,
EuiText,
} from '@elastic/eui';
import 'brace/mode/json';
import { AppMountParameters, IUiSettingsClient } from '@kbn/core/public';
import { DashboardStart } from '@kbn/dashboard-plugin/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { DashboardEmbeddableByValue } from './by_value/embeddable';

interface PageDef {
title: string;
Expand Down Expand Up @@ -56,32 +56,20 @@ const Nav = withRouter(({ history, pages }: NavProps) => {

interface Props {
basename: string;
DashboardContainerByValueRenderer: ReturnType<
DashboardStart['getDashboardContainerByValueRenderer']
>;
uiSettings: IUiSettingsClient;
}

const DashboardEmbeddableExplorerApp = ({
basename,
DashboardContainerByValueRenderer,
uiSettings,
}: Props) => {
const DashboardEmbeddableExplorerApp = ({ basename, uiSettings }: Props) => {
const pages: PageDef[] = [
{
title: 'By value dashboard embeddable',
id: 'dashboardEmbeddableByValue',
title: 'Portable Dashboard basic embeddable example',
id: 'portableDashboardEmbeddableBasicExample',
component: (
<DashboardEmbeddableByValue
DashboardContainerByValueRenderer={DashboardContainerByValueRenderer}
/>
<EuiTitle>
<EuiText>Portable Dashboard embeddable examples coming soon!</EuiText>
</EuiTitle>
),
},
{
title: 'By ref dashboard embeddable',
id: 'dashboardEmbeddableByRef',
component: <div>TODO: Not implemented, but coming soon...</div>,
},
];

const routes = pages.map((page, i) => (
Expand Down
112 changes: 0 additions & 112 deletions examples/dashboard_embeddable_examples/public/by_value/embeddable.tsx

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions examples/dashboard_embeddable_examples/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export class DashboardEmbeddableExamples implements Plugin<void, void, {}, Start
return renderApp(
{
basename: params.appBasePath,
DashboardContainerByValueRenderer:
depsStart.dashboard.getDashboardContainerByValueRenderer(),
uiSettings: coreStart.uiSettings,
},
params.element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ import {

import { FormattedMessage } from '@kbn/i18n-react';
import { Markdown } from '@kbn/kibana-react-plugin/public';
import { useReduxContainerContext } from '@kbn/presentation-util-plugin/public';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';
import { ControlGroupReduxState } from '../types';
import { pluginServices } from '../../services';
import { EditControlButton } from '../editor/edit_control';
import { ControlGroupStrings } from '../control_group_strings';
import { useChildEmbeddable } from '../../hooks/use_child_embeddable';
import { TIME_SLIDER_CONTROL } from '../../../common';
import { controlGroupReducers } from '../state/control_group_reducers';
import { ControlGroupContainer } from '..';

interface ControlFrameErrorProps {
error: Error;
Expand Down Expand Up @@ -85,10 +87,12 @@ export const ControlFrame = ({
const embeddableRoot: React.RefObject<HTMLDivElement> = useMemo(() => React.createRef(), []);
const [fatalError, setFatalError] = useState<Error>();

const {
useEmbeddableSelector: select,
containerActions: { untilEmbeddableLoaded, removeEmbeddable },
} = useReduxContainerContext<ControlGroupReduxState>();
const { useEmbeddableSelector: select, embeddableInstance: controlGroup } =
useReduxEmbeddableContext<
ControlGroupReduxState,
typeof controlGroupReducers,
ControlGroupContainer
>();

const controlStyle = select((state) => state.explicitInput.controlStyle);

Expand All @@ -97,7 +101,11 @@ export const ControlFrame = ({
overlays: { openConfirm },
} = pluginServices.getServices();

const embeddable = useChildEmbeddable({ untilEmbeddableLoaded, embeddableId, embeddableType });
const embeddable = useChildEmbeddable({
untilEmbeddableLoaded: controlGroup.untilEmbeddableLoaded.bind(controlGroup),
embeddableType,
embeddableId,
});

const [title, setTitle] = useState<string>();

Expand Down Expand Up @@ -143,7 +151,7 @@ export const ControlFrame = ({
buttonColor: 'danger',
}).then((confirmed) => {
if (confirmed) {
removeEmbeddable(embeddableId);
controlGroup.removeEmbeddable(embeddableId);
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ import {
} from '@dnd-kit/core';

import { ViewMode } from '@kbn/embeddable-plugin/public';
import { useReduxContainerContext } from '@kbn/presentation-util-plugin/public';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';

import { ControlGroupReduxState } from '../types';
import { controlGroupReducers } from '../state/control_group_reducers';
import { ControlClone, SortableControl } from './control_group_sortable_item';

export const ControlGroup = () => {
// Redux embeddable container Context
const reduxContainerContext = useReduxContainerContext<
const reduxContext = useReduxEmbeddableContext<
ControlGroupReduxState,
typeof controlGroupReducers
>();
const {
actions: { setControlOrders },
useEmbeddableSelector: select,
useEmbeddableDispatch,
} = reduxContainerContext;
} = reduxContext;
const dispatch = useEmbeddableDispatch();

// current state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import classNames from 'classnames';

import { useReduxContainerContext } from '@kbn/presentation-util-plugin/public';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';
import { ControlFrame, ControlFrameProps } from './control_frame_component';
import { ControlGroupReduxState } from '../types';
import { ControlGroupStrings } from '../control_group_strings';
Expand Down Expand Up @@ -67,7 +67,7 @@ const SortableControlInner = forwardRef<
dragHandleRef
) => {
const { isOver, isDragging, draggingIndex, index } = dragInfo;
const { useEmbeddableSelector } = useReduxContainerContext<ControlGroupReduxState>();
const { useEmbeddableSelector } = useReduxEmbeddableContext<ControlGroupReduxState>();
const panels = useEmbeddableSelector((state) => state.explicitInput.panels);

const grow = panels[embeddableId].grow;
Expand Down Expand Up @@ -119,7 +119,7 @@ const SortableControlInner = forwardRef<
* can be quite cumbersome.
*/
export const ControlClone = ({ draggingId }: { draggingId: string }) => {
const { useEmbeddableSelector: select } = useReduxContainerContext<ControlGroupReduxState>();
const { useEmbeddableSelector: select } = useReduxEmbeddableContext<ControlGroupReduxState>();
const panels = select((state) => state.explicitInput.panels);
const controlStyle = select((state) => state.explicitInput.controlStyle);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useLifecycles from 'react-use/lib/useLifecycles';
import React, { useMemo, useRef, useState } from 'react';

import { IEmbeddable } from '@kbn/embeddable-plugin/public';
import { useReduxContainerContext } from '@kbn/presentation-util-plugin/public';
import { useReduxEmbeddableContext } from '@kbn/presentation-util-plugin/public';

import { pluginServices } from '../services';
import { getDefaultControlGroupInput } from '../../common';
Expand Down Expand Up @@ -78,7 +78,7 @@ export const ControlGroupRenderer = ({
};

export const useControlGroupContainerContext = () =>
useReduxContainerContext<ControlGroupReduxState, typeof controlGroupReducers>();
useReduxEmbeddableContext<ControlGroupReduxState, typeof controlGroupReducers>();

// required for dynamic import using React.lazy()
// eslint-disable-next-line import/no-default-export
Expand Down
Loading