Skip to content

Fixes #3732: createPlugin helper function#3734

Merged
mbarto merged 5 commits intogeosolutions-it:masterfrom
mbarto:create_plugin
May 21, 2019
Merged

Fixes #3732: createPlugin helper function#3734
mbarto merged 5 commits intogeosolutions-it:masterfrom
mbarto:create_plugin

Conversation

@mbarto
Copy link
Copy Markdown
Contributor

@mbarto mbarto commented May 8, 2019

Description

Helper function to ease creating new plugins.

Issues

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
To create a plugin you need to export a JS object, a descriptor of the plugin

What is the new behavior?
The old way of exporting plugins still works, the new helper makes the process more easy and readable.

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@ghost ghost assigned mbarto May 8, 2019
@mbarto mbarto added this to the 2019.02.00 milestone May 8, 2019
@coveralls
Copy link
Copy Markdown

coveralls commented May 8, 2019

Coverage Status

Coverage increased (+0.03%) to 81.384% when pulling 7e45234 on mbarto:create_plugin into d3a2a2a on geosolutions-it:master.

@geosolutions-it geosolutions-it deleted a comment May 9, 2019
@tdipisa tdipisa requested a review from offtherailz May 10, 2019 12:34
Copy link
Copy Markdown
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a suggestion to improve doc

*
* @param {string} name name of the plugin (without the Plugin postfix)
* @param {object} config configuration object, with the following (optional) properties:
* * component: ReactJS component that implements the plugin functionalities, can be null if the plugin supports lazy loading
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use

@param {type} cfg.name for all the cfg object parameters, so it will can specify type and if they are options (using [])

also an

@example
createPlugin( MyPlugin, {
   component: ...
   options: { 
      disablePluginIf: ,,,
   },
   containers: {
         Toolbar: {}
   }
}

could be useful. I see there are some usage samples around, but they are not so many neither complete.

@mbarto mbarto merged commit 60e3353 into geosolutions-it:master May 21, 2019
@mbarto mbarto deleted the create_plugin branch May 21, 2019 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce helper function to define a new plugin

3 participants