-
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
fixes #4725 - plugins without init function shouldn't show statuses #7953
Conversation
LGTM |
LGTM |
@@ -127,8 +127,10 @@ module.exports = class Plugin { | |||
server.exposeStaticDir(`/plugins/${id}/{path*}`, this.publicDir); | |||
} | |||
|
|||
this.status = kbnServer.status.createForPlugin(this); | |||
server.expose('status', this.status); | |||
if (this.externalInit !== _.noop) { |
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.
Out of curiosity, why not:
if (this.externalInit !== undefined) {
Or
if (typeof this.externalInit === 'function') {
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.
Also, I think this merits a comment, to explain the intention.
// Many of the plugins are simply adding static assets to the server and we don't need
// to track their "status". Since plugins must have an init() function to even set its status
// we shouldn't even create a status unless the plugin can use it.
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.
well... because its never undefined and its always a function ? :) (please correct me if im wrong)
this.externalInit will always be a function.
- _.noop in case its not used ... and
- a real function in case init was set.
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.
Oh, I see. externalInit defaults to _.noop. Thanks for explaining.
On Tuesday, August 9, 2016, Peter Pisljar [email protected] wrote:
In src/server/plugins/plugin.js
#7953 (comment):@@ -127,8 +127,10 @@ module.exports = class Plugin {
server.exposeStaticDir(/plugins/${id}/{path*}
, this.publicDir);
}
this.status = kbnServer.status.createForPlugin(this);
server.expose('status', this.status);
if (this.externalInit !== _.noop) {
well... because its never undefined and its always a function ? :)
this.externalInit will always be a function.
- _.noop in case its not used ... and
- a real function in case init was set.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/elastic/kibana/pull/7953/files/91615cf6bbd1e9e254adf93e596062a49b5773d0#r74188822,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLmg2eI9PZE4di_Yg42-pDtFP5mLEl_ks5qeWb3gaJpZM4Je86g
.
I thought of a couple comments after I wrote LGTM. 😄 |
i added the comment and squashed commits ... |
jenkins. test this |
fixes elastic#4725 - plugins without init function shouldn't show statuses Former-commit-id: adfcf06
fixes #4725 - plugins with no init function shouldn't show status