Skip to content
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

Merged
merged 1 commit into from
Aug 10, 2016

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Aug 8, 2016

fixes #4725 - plugins with no init function shouldn't show status

@spalger
Copy link
Contributor

spalger commented Aug 8, 2016

LGTM

@spalger spalger removed their assignment Aug 8, 2016
@cjcenizal cjcenizal self-assigned this Aug 9, 2016
@cjcenizal
Copy link
Contributor

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) {
Copy link
Contributor

@cjcenizal cjcenizal Aug 10, 2016

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') {

Copy link
Contributor

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.

Copy link
Member Author

@ppisljar ppisljar Aug 10, 2016

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.

Copy link
Contributor

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
.

@cjcenizal
Copy link
Contributor

I thought of a couple comments after I wrote LGTM. 😄

@ppisljar
Copy link
Member Author

i added the comment and squashed commits ...

@ppisljar
Copy link
Member Author

jenkins. test this

@ppisljar ppisljar merged commit adfcf06 into elastic:master Aug 10, 2016
@ppisljar ppisljar deleted the fix-4725 branch August 10, 2016 06:38
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
fixes elastic#4725 - plugins without init function shouldn't show statuses

Former-commit-id: adfcf06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugins without init() functions don't need statuses
4 participants