-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Reporting/Dashboard] Update integration to use v2 reports #108553
Merged
jloleysens
merged 28 commits into
elastic:master
from
jloleysens:dashboard/update-report-to-use-v2
Aug 26, 2021
Merged
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
40ab51f
very wip, updating dashboard integration to use v2 reports. at the mo…
jloleysens 56985bd
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine 47ec77a
added missing dependency to hook
jloleysens 1cb0766
added tests and refined ForwadedAppState interface
jloleysens adee42b
remove unused import
jloleysens 3a93a16
updated test because generating a report from an unsaved report is po…
jloleysens 9eacc30
migrated locator to forward state on history only, reordered methods …
jloleysens 06ef623
remove unused import
jloleysens 6cd42ba
update locator test and use panel index number if panelIndex does not…
jloleysens 99b7479
ensure locator params are serializable
jloleysens db13ecd
- moved getSerializableRecord to locator.ts to ensure that the
jloleysens 7c4260c
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine 27d86a7
update generated api docs
jloleysens c9d09e7
remove unused variable
jloleysens 8261f76
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine a002d5c
- removed SerializedRecord extension from dashboard locator params
jloleysens 6116fc3
updated locator jest tests and SerializableRecord types
jloleysens f69d78f
explicitly map values to dashboardlocatorparams and export serializab…
jloleysens e3e7f7e
use serializable params type in embeddable
jloleysens 9d97c06
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine 566851e
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine d302131
factored out logic for converting panels to dashboard panels map
jloleysens 84cbc7b
use "type =" instead of "interface"
jloleysens c3a8f4f
big update to locator params: type fixes and added options key
jloleysens 4f2b82d
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine 2ad676a
Merge branch 'master' into dashboard/update-report-to-use-v2
kibanamachine cb39ce9
added comment about why we are using "type" alias instead of "interfa…
jloleysens 30978d9
simplify is v2 job param check
jloleysens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
.../plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.pause.md
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
.../plugins/data/public/kibana-plugin-plugins-data-public.refreshinterval.value.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,9 @@ import { | |
DashboardRedirect, | ||
DashboardState, | ||
} from '../../types'; | ||
import { DashboardAppLocatorParams } from '../../locator'; | ||
import { | ||
loadDashboardHistoryLocationState, | ||
tryDestroyDashboardContainer, | ||
syncDashboardContainerInput, | ||
savedObjectToDashboardState, | ||
|
@@ -88,6 +90,7 @@ export const useDashboardAppState = ({ | |
savedObjectsTagging, | ||
dashboardCapabilities, | ||
dashboardSessionStorage, | ||
scopedHistory, | ||
} = services; | ||
const { docTitle } = chrome; | ||
const { notifications } = core; | ||
|
@@ -149,10 +152,15 @@ export const useDashboardAppState = ({ | |
*/ | ||
const dashboardSessionStorageState = dashboardSessionStorage.getState(savedDashboardId) || {}; | ||
const dashboardURLState = loadDashboardUrlState(dashboardBuildContext); | ||
const forwardedAppState = loadDashboardHistoryLocationState( | ||
scopedHistory()?.location?.state as undefined | DashboardAppLocatorParams | ||
); | ||
|
||
const initialDashboardState = { | ||
...savedDashboardState, | ||
...dashboardSessionStorageState, | ||
...dashboardURLState, | ||
...forwardedAppState, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where we add the state from |
||
|
||
// if there is an incoming embeddable, dashboard always needs to be in edit mode to receive it. | ||
...(incomingEmbeddable ? { viewMode: ViewMode.EDIT } : {}), | ||
|
@@ -312,6 +320,7 @@ export const useDashboardAppState = ({ | |
getStateTransfer, | ||
savedDashboards, | ||
usageCollection, | ||
scopedHistory, | ||
notifications, | ||
indexPatterns, | ||
kibanaVersion, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/plugins/dashboard/public/application/lib/convert_saved_panels_to_panel_map.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { convertSavedDashboardPanelToPanelState } from '../../../common/embeddable/embeddable_saved_object_converters'; | ||
import type { SavedDashboardPanel, DashboardPanelMap } from '../../types'; | ||
|
||
export const convertSavedPanelsToPanelMap = (panels?: SavedDashboardPanel[]): DashboardPanelMap => { | ||
const panelsMap: DashboardPanelMap = {}; | ||
panels?.forEach((panel, idx) => { | ||
panelsMap![panel.panelIndex ?? String(idx)] = convertSavedDashboardPanelToPanelState(panel); | ||
}); | ||
return panelsMap; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/plugins/dashboard/public/application/lib/load_dashboard_history_location_state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { ForwardedDashboardState } from '../../locator'; | ||
import { DashboardState } from '../../types'; | ||
import { convertSavedPanelsToPanelMap } from './convert_saved_panels_to_panel_map'; | ||
|
||
export const loadDashboardHistoryLocationState = ( | ||
state?: ForwardedDashboardState | ||
): Partial<DashboardState> => { | ||
if (!state) { | ||
return {}; | ||
} | ||
|
||
const { panels, ...restOfState } = state; | ||
if (!panels?.length) { | ||
return restOfState; | ||
} | ||
|
||
return { | ||
...restOfState, | ||
...{ panels: convertSavedPanelsToPanelMap(panels) }, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done to address issues with emebedding this type inside of a
SerializableRecord
type. There are issues with index types not being present ininterface
definitions, these are not an issue withtype
definitions as they are more permissive (it seems). Otherwise we run into what I think is: microsoft/TypeScript#1889