mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 10:40:07 -04:00
[Dashboard] Fast Navigation Between Dashboards (#157437)
## Summary Makes all navigation from one Dashboard to another feel snappier.
This commit is contained in:
parent
83b7939e03
commit
5342563a22
24 changed files with 299 additions and 230 deletions
|
@ -14,7 +14,11 @@ import { EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
|
|||
import { controlGroupInputBuilder } from '@kbn/controls-plugin/public';
|
||||
import { getDefaultControlGroupInput } from '@kbn/controls-plugin/common';
|
||||
import { FILTER_DEBUGGER_EMBEDDABLE } from '@kbn/embeddable-examples-plugin/public';
|
||||
import { AwaitingDashboardAPI, DashboardRenderer } from '@kbn/dashboard-plugin/public';
|
||||
import {
|
||||
AwaitingDashboardAPI,
|
||||
DashboardRenderer,
|
||||
DashboardCreationOptions,
|
||||
} from '@kbn/dashboard-plugin/public';
|
||||
|
||||
export const DashboardWithControlsExample = ({ dataView }: { dataView: DataView }) => {
|
||||
const [dashboard, setDashboard] = useState<AwaitingDashboardAPI>();
|
||||
|
@ -48,7 +52,7 @@ export const DashboardWithControlsExample = ({ dataView }: { dataView: DataView
|
|||
<EuiSpacer size="m" />
|
||||
<EuiPanel hasBorder={true}>
|
||||
<DashboardRenderer
|
||||
getCreationOptions={async () => {
|
||||
getCreationOptions={async (): Promise<DashboardCreationOptions> => {
|
||||
const builder = controlGroupInputBuilder;
|
||||
const controlGroupInput = getDefaultControlGroupInput();
|
||||
await builder.addDataControlFromField(controlGroupInput, {
|
||||
|
@ -68,11 +72,11 @@ export const DashboardWithControlsExample = ({ dataView }: { dataView: DataView
|
|||
|
||||
return {
|
||||
useControlGroupIntegration: true,
|
||||
initialInput: {
|
||||
getInitialInput: () => ({
|
||||
timeRange: { from: 'now-30d', to: 'now' },
|
||||
viewMode: ViewMode.VIEW,
|
||||
controlGroupInput,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}}
|
||||
ref={setDashboard}
|
||||
|
|
|
@ -136,10 +136,10 @@ export const DynamicByReferenceExample = () => {
|
|||
getCreationOptions={async () => {
|
||||
const persistedInput = getPersistableInput();
|
||||
return {
|
||||
initialInput: {
|
||||
getInitialInput: () => ({
|
||||
...persistedInput,
|
||||
timeRange: { from: 'now-30d', to: 'now' }, // need to set the time range for the by value vis
|
||||
},
|
||||
}),
|
||||
};
|
||||
}}
|
||||
ref={setdashboard}
|
||||
|
|
|
@ -50,12 +50,15 @@ export const StaticByReferenceExample = ({
|
|||
const field = dataView.getFieldByName('machine.os.keyword');
|
||||
let filter: Filter;
|
||||
let creationOptions: DashboardCreationOptions = {
|
||||
initialInput: { viewMode: ViewMode.VIEW },
|
||||
getInitialInput: () => ({ viewMode: ViewMode.VIEW }),
|
||||
};
|
||||
if (field) {
|
||||
filter = buildPhraseFilter(field, 'win xp', dataView);
|
||||
filter.meta.negate = true;
|
||||
creationOptions = { ...creationOptions, initialInput: { filters: [filter] } };
|
||||
creationOptions = {
|
||||
...creationOptions,
|
||||
getInitialInput: () => ({ filters: [filter] }),
|
||||
};
|
||||
}
|
||||
return creationOptions; // if can't find the field, then just return no special creation options
|
||||
}}
|
||||
|
|
|
@ -29,11 +29,11 @@ export const StaticByValueExample = () => {
|
|||
<DashboardRenderer
|
||||
getCreationOptions={async () => {
|
||||
return {
|
||||
initialInput: {
|
||||
getInitialInput: () => ({
|
||||
timeRange: { from: 'now-30d', to: 'now' },
|
||||
viewMode: ViewMode.VIEW,
|
||||
panels: panelsJson as DashboardPanelMap,
|
||||
},
|
||||
}),
|
||||
};
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue