-
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
[Canvas] Remove Angular and unnecessary reporting config from Canvas #54050
Conversation
Pinging @elastic/kibana-canvas (Team:Canvas) |
initClipboard(plugins.__LEGACY.storage); | ||
initLoadingIndicator(core.http.addLoadingCountSource); | ||
|
||
const CanvasRootController = CanvasRootControllerFactory(core, plugins); | ||
plugins.__LEGACY.setRootController('canvas', CanvasRootController); | ||
core.chrome.setBadge( |
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 just moved from the controller. Definitely need to test read only
@@ -32,7 +32,6 @@ export interface AppState { | |||
} | |||
|
|||
interface StoreAppState { | |||
kbnVersion: string; |
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 couldn't find any usage of the kbnVersion
in our frontend code so I'm removing it
element | ||
); | ||
return () => ReactDOM.unmountComponentAtNode(element); | ||
}; |
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 created based on the new conventions laid out here: https://github.com/elastic/kibana/blob/0dac43516e0690486d13071063cb089bce96ee11/src/core/CONVENTIONS.md#applications
The thing is, it's kinda weird to have applications
at the same level as our apps
directory (which houses home, workpad, and export)
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.
Could this just live in the root of public as just application.tsx
or something like that?
const CanvasRootController = CanvasRootControllerFactory(core, plugins); | ||
plugins.__LEGACY.setRootController('canvas', CanvasRootController); | ||
core.chrome.setBadge( | ||
core.application.capabilities.canvas && core.application.capabilities.canvas.save |
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.
Originally this was checking for the existence just of core.application.capabilities.canvas.save
but I was running into a test error where .canvas
wasn't defined on capabilities
. I fixed it by adding this check. If we want to fix this by doing a mock somewhere for the test instead, I can do that
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.
The way Core API's are consumed lgtm 👍
canvasStore: Store | ||
) => { | ||
ReactDOM.render( | ||
<KibanaContextProvider services={{ ...coreStart, ...plugins }}> |
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.
nit: The KibanaContextProvider
uses react context to provide enable deeply nested react components to directly consume these services. I didn't look closely at the Canvas code, but since you seem to be using Redux, you probably won't need this context and would instead consume Core API's from reducers.
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.
@rudolf We are using useSetting
and other hooks from kibana-react
and I thought those required setting a context like this, or is there a way to do that without requiring a context like this?
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.
If you're using the hooks from kibana-react
then this is correct.
NP doesn't / won't allow cross-plugin config reading, so the reporting plugin will have to expose any of it's config values that are meant to be consumed by other plugins from it's setup or start API's. |
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.
Looks good, just a couple of nits.
If we could remove the bulk of the stuff on the server side that is injecting the vars, that would be great too.
element | ||
); | ||
return () => ReactDOM.unmountComponentAtNode(element); | ||
}; |
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.
Could this just live in the root of public as just application.tsx
or something like that?
canvasStore: Store | ||
) => { | ||
ReactDOM.render( | ||
<KibanaContextProvider services={{ ...coreStart, ...plugins }}> |
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.
@rudolf We are using useSetting
and other hooks from kibana-react
and I thought those required setting a context like this, or is there a way to do that without requiring a context like this?
const initialState = getInitialState(); | ||
|
||
const basePath = core.http.basePath.get(); | ||
const reportingBrowserType = core.injectedMetadata.getInjectedVar('reportingBrowserType'); |
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.
Did we decide that injectedVars are going away? If so, let's shim out the reporting plugin in our dependency and pass that in here instead.
20e8542
to
55e43f2
Compare
@@ -43,9 +43,6 @@ export interface CanvasStartDeps { | |||
setRootController: Chrome['setRootController']; |
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.
Can setRootController
also be removed? Think we're just using the application.register
now?
reporting: | ||
npSetup.core && npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') | ||
? {} | ||
: undefined, |
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.
The reason that Canvas had to check the Reporting browser type was because, if it was configured to phantom
, the, the PDF would fail. Originally it was important to show that the configuration had to change and make the browser type become chromium
In Kibana 7.x we dropped support for phantom, and now chromium is the only valid option for the type setting! The setting will probably go away completely in 8.0.
Letting you know this, because you can remove lots of code in Canvas, since the browser type check isn't needed! 🍾
|
||
core.injectUiAppVars('canvas', async () => { | ||
const config = core.getServerConfig(); | ||
const basePath = config.get('server.basePath'); | ||
const reportingBrowserType = (() => { |
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.
No need to worry about this, per https://github.com/elastic/kibana/pull/54050/files#r370402125
Leaving this as-is would complicate the Reporting team from upgrading to the NP config service anyway 😄
You could probably get rid of |
ba3bb29
to
ad15369
Compare
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…ve-out-legacy * 'master' of github.com:elastic/kibana: (187 commits) [ML] Reseting categorization validation if category field is cleared (elastic#56029) [SIEM] Fields browser readable (elastic#56000) [docs] Remove unused callout (elastic#56032) Refactor saved object management registry usage (elastic#54155) [SIEM][Detection Engine] critical blocker, updates the pre-packaged rules, removes dead ones, adds license file (elastic#56090) Fix failing snapshot artifact tests when using env var (elastic#56063) Fix Github PR comment formatting (elastic#56078) [Maps] fix join metric field selection bugs (elastic#56044) Create a new menu for observability links (elastic#54847) [SIEM] [Detection Engine] Fixes histogram intervals (elastic#55969) make test less flaky by retrying if list is re-rendered (elastic#55949) Remove matrix build support (elastic#54202) Add animation to service map layout (elastic#56042) [Canvas] Remove Angular and unnecessary reporting config from Canvas (elastic#54050) [Uptime] Simplify snapshot max to Infinity (elastic#55931) [Uptime] Reintroduce a column for url (elastic#55451) Cleanup action task params objects after successful execution (elastic#55227) [CI] Retry flaky tests (elastic#53961) Expose NP FieldFormats service to server side (elastic#55419) [Endpoint] EMT-65: make endpoint data types common, restructure (elastic#54772) ... # Conflicts: # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/containers/panel.tsx # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/context.tsx # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/index.ts # src/legacy/core_plugins/console/public/np_ready/application/components/split_panel/split_panel.test.tsx # src/legacy/ui/public/vis/editors/default/default_editor.tsx # src/plugins/console/public/application/components/split_panel/__snapshots__/split_panel.test.tsx.snap # src/plugins/console/public/application/components/split_panel/components/resizer.tsx # src/plugins/console/public/application/components/split_panel/containers/panel.tsx # src/plugins/console/public/application/components/split_panel/containers/panel_container.tsx # src/plugins/console/public/application/components/split_panel/context.tsx # src/plugins/console/public/application/components/split_panel/index.ts # src/plugins/console/public/application/components/split_panel/registry.ts # src/plugins/console/public/application/components/split_panel/split_panel.test.tsx # src/plugins/kibana_react/public/split_panel/__snapshots__/split_panel.test.tsx.snap # src/plugins/kibana_react/public/split_panel/containers/panel.tsx # src/plugins/kibana_react/public/split_panel/context.tsx # src/plugins/kibana_react/public/split_panel/index.ts # src/plugins/kibana_react/public/split_panel/split_panel.test.tsx
* master: (77 commits) [ML] Reseting categorization validation if category field is cleared (elastic#56029) [SIEM] Fields browser readable (elastic#56000) [docs] Remove unused callout (elastic#56032) Refactor saved object management registry usage (elastic#54155) [SIEM][Detection Engine] critical blocker, updates the pre-packaged rules, removes dead ones, adds license file (elastic#56090) Fix failing snapshot artifact tests when using env var (elastic#56063) Fix Github PR comment formatting (elastic#56078) [Maps] fix join metric field selection bugs (elastic#56044) Create a new menu for observability links (elastic#54847) [SIEM] [Detection Engine] Fixes histogram intervals (elastic#55969) make test less flaky by retrying if list is re-rendered (elastic#55949) Remove matrix build support (elastic#54202) Add animation to service map layout (elastic#56042) [Canvas] Remove Angular and unnecessary reporting config from Canvas (elastic#54050) [Uptime] Simplify snapshot max to Infinity (elastic#55931) [Uptime] Reintroduce a column for url (elastic#55451) Cleanup action task params objects after successful execution (elastic#55227) [CI] Retry flaky tests (elastic#53961) Expose NP FieldFormats service to server side (elastic#55419) [Endpoint] EMT-65: make endpoint data types common, restructure (elastic#54772) ...
Summary
kbnVersion
from frontend state since we don't appear to use it anywhere I could findChecklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers