-
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
Fix context.pageName by fixing missing executionContext #201118
base: main
Are you sure you want to change the base?
Changes from 7 commits
3925c21
d0b0d51
b0c621c
dcc81b8
68cae60
3f82e98
87ae813
89b004b
81a712c
7e4df5d
2a5a780
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library") | ||
|
||
SRCS = glob( | ||
[ | ||
"**/*.ts", | ||
"**/*.tsx", | ||
], | ||
exclude = [ | ||
"**/test_helpers.ts", | ||
"**/*.config.js", | ||
"**/*.mock.*", | ||
"**/*.test.*", | ||
"**/*.stories.*", | ||
"**/__snapshots__/**", | ||
"**/integration_tests/**", | ||
"**/mocks/**", | ||
"**/scripts/**", | ||
"**/storybook/**", | ||
"**/test_fixtures/**", | ||
"**/test_helpers/**", | ||
], | ||
) | ||
|
||
DEPS = [ | ||
|
||
] | ||
|
||
js_library( | ||
name = "shared-ux-router", | ||
package_name = "@kbn/shared-ux-router", | ||
srcs = ["package.json"] + SRCS, | ||
deps = DEPS, | ||
visibility = ["//visibility:public"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ export const DashboardListingTable = ({ | |
urlStateEnabled, | ||
showCreateDashboardButton = true, | ||
}: DashboardListingProps) => { | ||
// TODO: Remove this comment after testing | ||
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. dashboard changes LGTM, comment needs to be removed |
||
useExecutionContext(coreServices.executionContext, { | ||
type: 'application', | ||
page: 'list', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ export const ContextApp = ({ dataView, anchorId, referrer }: ContextAppProps) => | |
}); | ||
}, [locator, referrer, services]); | ||
|
||
// TODO: Remove this comment after testing | ||
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. I reviewed our usages in Discover and dropping the custom overrides changes the
I kept the overrides and removed the TODO here: 89b004b. |
||
useExecutionContext(core.executionContext, { | ||
type: 'application', | ||
page: 'context', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ export const VisualizeEditor = ({ onAppLeave }: VisualizeAppProps) => { | |
); | ||
|
||
const editorName = savedVisInstance?.vis.type.title.toLowerCase().replace(' ', '_') || ''; | ||
// TODO: Remove this comment after testing | ||
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. I've checked this and noticed some subtle different
|
||
useExecutionContext(services.executionContext, { | ||
type: 'application', | ||
page: `editor${editorName ? `:${editorName}` : ''}`, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ const AppWithExecutionContext = ({ | |
getUrlForApp: ApplicationStart['getUrlForApp']; | ||
executionContext: ExecutionContextStart; | ||
}) => { | ||
// TODO: Remove this comment after testing | ||
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. |
||
useExecutionContext(executionContext, { | ||
type: 'application', | ||
page: 'crossClusterReplication', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ export const IndexList: React.FunctionComponent<RouteComponentProps> = ({ histor | |
core: { executionContext }, | ||
} = useAppContext(); | ||
|
||
// TODO: Remove this comment after testing | ||
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. Lgtm, removed comment with 2a5a780. |
||
useExecutionContext(executionContext, { | ||
type: 'application', | ||
page: 'indexManagementIndicesTab', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,7 @@ export function App({ | |
setIndicateNoData(true); | ||
}, [setIndicateNoData]); | ||
|
||
// TODO: Remove this comment after testing | ||
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. Not sure it is strictly related to this PR, but from my quick testing I see these page names from different flows:
|
||
useExecutionContext(executionContext, { | ||
type: 'application', | ||
id: savedObjectId || 'new', // TODO: this doesn't consider when lens is saved by value | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -98,6 +98,7 @@ export const useActiveRoute = (routesList: MlRoute[]): MlRoute => { | |||
[activeRoute, overlays, pathname, startServices] | ||||
); | ||||
|
||||
// TODO: Remove this comment after testing | ||||
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. Tested, works as expected
Suggested change
|
||||
useExecutionContext(executionContext, { | ||||
name: PLUGIN_ID, | ||||
type: 'application', | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ const AppWithExecutionContext = ({ | |
history: ManagementAppMountParams['history']; | ||
executionContext: ExecutionContextStart; | ||
}) => { | ||
// TODO: Remove this comment after testing | ||
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. |
||
useExecutionContext(executionContext, { | ||
type: 'application', | ||
page: 'rollup', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ export const useUpdateExecutionContext = () => { | |
useEffect(() => { | ||
// setImmediate is required to ensure that EBT telemetry for the previous page is shipped before the new page is updated | ||
setImmediate(() => { | ||
// TODO: Remove this comment after testing | ||
executionContext.set({ page: pathname }); | ||
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. @kpatticha noticed a difference in the new context: @elastic/security-solution Any idea how we can solve this issue? 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. It seems like the same problem as with the data_quality page. The custom hook is called before the hook in our Route 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. And there is slight implementation difference which is probably why the pageName is different we use : const match = useRouteMatch(); match.path |
||
}); | ||
}, [pathname, executionContext]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ export const PolicyList: React.FunctionComponent<RouteComponentProps<MatchParams | |
uiMetricService.trackUiMetric(UIM_POLICY_LIST_LOAD); | ||
}, [uiMetricService]); | ||
|
||
// TODO: Remove this comment after testing | ||
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. Lgtm, removed comment with 2a5a780. |
||
useExecutionContext(core.executionContext, { | ||
type: 'application', | ||
page: 'snapshotRestorePolicyTab', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,7 @@ export const RootComponent = (dependencies: AppDependencies) => { | |
core: { application, http, executionContext, ...startServices }, | ||
} = dependencies.services; | ||
|
||
// TODO: Remove this comment after testing | ||
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. Lgtm, removed comment with 2a5a780. |
||
executionContext.set({ type: 'application', page: 'upgradeAssistant' }); | ||
|
||
return ( | ||
|
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.
Q: to avoid errors in the future, should we make this one mandatory?
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.
I will check to see if it is OK to make this dependency mandatory.
Still, I don't think this will prevent similar issues in the future because, eventually, it will be passed to SharedUXContext, which is initialized with an empty executionContext here.