-
Notifications
You must be signed in to change notification settings - Fork 900
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
Extend the Vmdb::Plugins singleton with UI-specific plugin support #15309
Conversation
Checked commit skateman@a7e2ecc with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
I can see us having public methods to get a list of |
I'm conflicted on the "Right Way". I like the However, on the flip side, a plugin can automatically be an automate plugin by having a content directory at the top-level. Pretend we required an cc @bdunne Thoughts? @skateman Out of curiosity, how is this needed? Could we do this by also detecting paths, like app/controllers or something or is that potentially too open ended? |
I like the idea of implementing |
Thinking about it more I agree with @bdunne . I was confusing vmdb_plugin? with feature_plugin? |
If we go this way then remember that one |
So first of all this would be a nice to have thing for letting know the server that we want to dynamically load JS assets into the application.js, through a Then we would like to able to declare new menu items and attach them to the already existing main menu. For now we're doing this in an My vision was to have a special class (let's call it for now module MiqPluginExample
class Engine < ::ManageIQ::UI::Plugin # inherited from ::Rails::Engine
provides_menu # maybe a parameter pointing to the menu file
provides_routes
provides_js
works_with_webpack
requires [ManageIQ::Providers::Openstack, ManageIQ::Providers::Vmware]
# etc
end As we want the UI separated from the core as much as possible, I was thinking about going through UI-related plugins in a second iteration in our |
Scanning / Detection happens only at boot time. Why not say that all UI Engines should be namespaced like the providers? module ManageIQ
module UI
module Amazon
class Engine < ::Rails::Engine
isolate_namespace ManageIQ::UI::Amazon
end
end
end
end This would
In the end, providers are also just rails engines... |
I'm not sure who depends on whom. Short term I'd say, like it is now, the core owns the UI server and hence has the right to know about UI plugins. But long term I'd say the UI is its own rails server and communicates to the core/platform server via defined APIs. |
@martinpovolny you explicitly disabled isolated namespaces in your plugin example. Is there any reason behind this? |
Yes, it was dealing with splitting the UI making sure things work so it fitted me more. For plugin usecase we might want to isolate the namespaces. For first shot proof of concept I'd do whatever is easier for you. |
As long as any JS assets use webpacker, the current implementation (ManageIQ/manageiq-ui-classic@66f9dcc) will pick up any engine that contains an We still need a way to find all the plugins' packs to include them in the layout. (Think the equivalent of adding a line to |
Okay, based on the reactions I'm closing this PR. |
We need a way to mark rails engines as plugins related to the User Interface. I found out that there is already a structure holding provider plugins, so I'd like to extend this if possible. By declaring a
ui_plugin
method inside the engine, the plugin would be registered under the@registered_ui_plugins
instance variable that we would use in the UI on some places.For now I require both the
ui_plugin
and thevmdb_plugin
methods to be declared and return true, but I'm not 100% sure if this is The Right Way™. Renaming the method or requiring just one of the two methods are both an option, I just need some feedback 😉ping @martinpovolny, @jrafanie, @Fryguy