All built-in widgets resides in this directory.
Documentation for them is available here.
Each widget has README.md file in root folder (e.g. widgets/blueprints/README.md
). That file should be in sync with widget description page from User Documentation .
To update widgets' documentation - instead of modifying README.md files directly - you have to:
- Update it in docs.getcloudify.org repository
- Execute
npm run docWidgetsin this repository. Configuration for update script can be found in: scripts/readmesConfig.json.
This section describes how to create a new widget.
To create your own widget:
To test your own widget:
- Start the application (see Application start section in main README file)
- Add your widget to the page using Edit Mode (check this for details)
Since now, every single change in widget's source code should be reflected by webpack dev server after page reload.
To use your custom widget outside of the development environment, you need to create a widget ZIP package.
Assuming you are working on widget named myWidget just run npm run build:widget myWidget
and your custom widget package will be available in dist/widgets directory.
You can install widget ZIP package on Cloudify Manager (check Adding widget section in Edit Mode page for details)
As widget JS bundle is independently built using Webpack, importing a code from the outside of a widget directory should be avoided to keep widget JS bundle small.
Most common method for accessing application framework code (app directory) is through Stage global object (see Stage API definition).
There are a few methods how you can access application Redux store from the widget:
- In functional components you can use
ReactReduxglobal object which provides Redux hooks (seeReactReduxdefinition in Stage API definition) - In class components you can use
connectToStoreglobal function (seeconnectToStoredefinition in Stage API definition) - You can use
toolbox.getManagerState()method if you need justmanagerpart of the Redux state (seegetManagerStatedescription in Widget APIs page)