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

Create dashboard drilldown - select dashboard via filtering combo box and navigate to dashboarrd #60087

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
813a896
partial progress on async loading / searching of dashboard titles
mattkime Mar 13, 2020
65ff148
feat: 🎸 make combobox full width
streamich Mar 13, 2020
d46fcf0
filtering combobox polish
mattkime Mar 16, 2020
6e11bc2
Merge branch 'drilldowns_load_dashboard_list' of github.com:mattkime/…
mattkime Mar 16, 2020
699d853
storybook fix
mattkime Mar 16, 2020
d3ac7ad
implement navigating to dashboard, seems like a type problem
mattkime Mar 17, 2020
a5ee274
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 17, 2020
4369399
try navToApp
mattkime Mar 17, 2020
94b08ae
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 17, 2020
86f9768
Merge remote-tracking branch 'upstream/drilldowns' into drilldowns_lo…
mattkime Mar 17, 2020
a276b96
filter out current dashboard
mattkime Mar 17, 2020
a112732
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 17, 2020
3b39dcd
rough draft linking to a dashboard
mattkime Mar 18, 2020
0bbf360
remove note
mattkime Mar 18, 2020
636d9ab
typefix
mattkime Mar 18, 2020
6ea19aa
fix navigation from dashboard to dashboard
Dosant Mar 18, 2020
0178ff5
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 19, 2020
a431e86
partial progress getting filters from action data
mattkime Mar 20, 2020
4217b18
fix issue with getIndexPatterns undefined
Dosant Mar 20, 2020
177822f
fix filter / time passing into url
Dosant Mar 20, 2020
8bcbc1b
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 21, 2020
f7b7add
typefix
mattkime Mar 21, 2020
346dc40
Merge branch 'drilldowns_load_dashboard_list' of github.com:mattkime/…
mattkime Mar 21, 2020
bd7a91c
dashboard to dashboard drilldown functional test and back button fix
Dosant Mar 21, 2020
5ea7818
documentation update
mattkime Mar 21, 2020
8297b55
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 22, 2020
feccdfc
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 22, 2020
29e885c
Merge branch 'drilldowns' of github.com:elastic/kibana into dev/drill…
Dosant Mar 23, 2020
100c4f0
chore clean-ups
Dosant Mar 23, 2020
340fd89
basic unit test for dashboard drilldown
Dosant Mar 23, 2020
406facd
remove test todos
Dosant Mar 23, 2020
d894574
Merge branch 'drilldowns' of github.com:elastic/kibana into dev/drill…
Dosant Mar 23, 2020
bf9e505
remove config
Dosant Mar 23, 2020
a24e29a
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 23, 2020
d7633b3
improve back button with filter comparison tweak
Dosant Mar 23, 2020
59101ef
dashboard filters/date option off by default
Dosant Mar 23, 2020
9fdb358
Merge branch 'drilldowns_load_dashboard_list' of github.com:mattkime/…
mattkime Mar 23, 2020
bb308d6
revert change to config/kibana.yml
mattkime Mar 23, 2020
8d10133
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
streamich Mar 23, 2020
31e28a3
remove unneeded comments
mattkime Mar 23, 2020
38ec7a0
use default time range as appropriate
mattkime Mar 24, 2020
c3708ca
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Mar 24, 2020
4a8d4a1
fix type, add filter icon, add text
mattkime Mar 24, 2020
0deb6b4
fix test
mattkime Mar 24, 2020
6a78486
change how time range is restored and improve back button for drilldowns
Dosant Mar 24, 2020
bc3fdd4
Merge branch 'drilldowns' into drilldowns_load_dashboard_list
mattkime Apr 3, 2020
8deeaa9
Merge branch 'drilldowns' of github.com:elastic/kibana into drilldown…
Dosant Apr 7, 2020
514561b
resolve conflicts
Dosant Apr 7, 2020
40e396c
fix async compile issue
mattkime Apr 8, 2020
a9b86a9
remove redundant test
Dosant Apr 8, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import { EuiFormRow, EuiSelect, EuiSwitch } from '@elastic/eui';
import { EuiFormRow, EuiSwitch, EuiComboBox } from '@elastic/eui';
import { txtChooseDestinationDashboard } from './i18n';

export interface DashboardItem {
Expand All @@ -21,6 +21,8 @@ export interface DashboardDrilldownConfigProps {
onDashboardSelect: (dashboardId: string) => void;
onCurrentFiltersToggle?: () => void;
onKeepRangeToggle?: () => void;
onSearchChange: (searchString: string) => void;
isLoading: boolean;
}

export const DashboardDrilldownConfig: React.FC<DashboardDrilldownConfigProps> = ({
Expand All @@ -31,17 +33,26 @@ export const DashboardDrilldownConfig: React.FC<DashboardDrilldownConfigProps> =
onDashboardSelect,
onCurrentFiltersToggle,
onKeepRangeToggle,
onSearchChange,
isLoading,
}) => {
// TODO: use i18n below.
// todo - don't assume selectedTitle is in set
const selectedTitle = dashboards.find(item => item.id === activeDashboardId)?.title || '';
return (
<>
<EuiFormRow label={txtChooseDestinationDashboard}>
<EuiSelect
name="selectDashboard"
hasNoInitialSelection={true}
options={dashboards.map(({ id, title }) => ({ value: id, text: title }))}
value={activeDashboardId}
onChange={e => onDashboardSelect(e.target.value)}
<EuiFormRow label={txtChooseDestinationDashboard} fullWidth>
<EuiComboBox<string>
async
selectedOptions={
activeDashboardId ? [{ label: selectedTitle, value: activeDashboardId }] : []
}
options={dashboards.map(({ id, title }) => ({ label: title, value: id }))}
onChange={([{ value = '' } = { value: '' }]) => onDashboardSelect(value)}
onSearchChange={onSearchChange}
isLoading={isLoading}
singleSelection={{ asPlainText: true }}
fullWidth
/>
</EuiFormRow>
{!!onCurrentFiltersToggle && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class DashboardDrilldownsService {
) {
const overlays = async () => (await core.getStartServices())[0].overlays;
const drilldowns = async () => (await core.getStartServices())[1].drilldowns;
const savedObjects = async () => (await core.getStartServices())[0].savedObjects.client;
const getSavedObjectsClient = async () =>
(await core.getStartServices())[0].savedObjects.client;

const actionFlyoutCreateDrilldown = new FlyoutCreateDrilldownAction({ overlays, drilldowns });
plugins.uiActions.registerAction(actionFlyoutCreateDrilldown);
Expand All @@ -45,7 +46,7 @@ export class DashboardDrilldownsService {
plugins.uiActions.attachAction(CONTEXT_MENU_DRILLDOWNS_TRIGGER, actionFlyoutEditDrilldown);

const dashboardToDashboardDrilldown = new DashboardToDashboardDrilldown({
savedObjects,
getSavedObjectsClient,
});
plugins.drilldowns.registerDrilldown(dashboardToDashboardDrilldown);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React, { useState, useEffect } from 'react';
import { CollectConfigProps } from './types';
import { DashboardDrilldownConfig } from '../../../components/dashboard_drilldown_config';
import { Params } from './drilldown';
import { SimpleSavedObject } from '../../../../../../../src/core/public';

export interface CollectConfigContainerProps extends CollectConfigProps {
params: Params;
Expand All @@ -16,28 +17,48 @@ export interface CollectConfigContainerProps extends CollectConfigProps {
export const CollectConfigContainer: React.FC<CollectConfigContainerProps> = ({
config,
onConfig,
params: { savedObjects },
params: { getSavedObjectsClient },
}) => {
const [dashboards] = useState([
{ id: 'dashboard1', title: 'Dashboard 1' },
{ id: 'dashboard2', title: 'Dashboard 2' },
{ id: 'dashboard3', title: 'Dashboard 3' },
{ id: 'dashboard4', title: 'Dashboard 4' },
]);
const [dashboards, setDashboards] = useState([]);
const [searchString, setSearchString] = useState();
const [isLoading, setIsLoading] = useState(false);

useEffect(() => {
// TODO: Load dashboards...
}, [savedObjects]);
setIsLoading(true);
getSavedObjectsClient().then(savedObjectsClient => {
savedObjectsClient
.find({
type: 'dashboard',
search: searchString ? `${searchString}*` : undefined,
// todo search by id
searchFields: ['title^3', 'description'],
defaultSearchOperator: 'AND',
perPage: 100,
})
.then(({ savedObjects }) => {
const dashboardList = savedObjects.map(
(savedObject: SimpleSavedObject<{ id: string; title: string }>) => ({
id: savedObject.id,
title: savedObject.attributes.title,
})
);
setDashboards(dashboardList);
mattkime marked this conversation as resolved.
Show resolved Hide resolved
setIsLoading(false);
});
});
}, [getSavedObjectsClient, searchString]);

return (
<DashboardDrilldownConfig
activeDashboardId={config.dashboardId}
dashboards={dashboards}
currentFilters={config.useCurrentDashboardFilters}
keepRange={config.useCurrentDashboardDataRange}
isLoading={isLoading}
onDashboardSelect={dashboardId => {
onConfig({ ...config, dashboardId });
}}
onSearchChange={setSearchString}
onCurrentFiltersToggle={() =>
onConfig({
...config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const dashboards = [
];

export interface Params {
savedObjects: () => Promise<CoreStart['savedObjects']['client']>;
getSavedObjectsClient: () => Promise<CoreStart['savedObjects']['client']>;
}

export class DashboardToDashboardDrilldown
Expand All @@ -43,7 +43,7 @@ export class DashboardToDashboardDrilldown
public readonly CollectConfig = reactToUiComponent(this.ReactCollectConfig);

public readonly createConfig = () => ({
dashboardId: '123',
dashboardId: '',
useCurrentDashboardDataRange: true,
useCurrentDashboardFilters: true,
});
Expand Down