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
Plugin-ability for views #91
Conversation
Here is a showcase file I made in
|
Note: I believe we might do without the |
Without |
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.
My only main concern is that it appears as if all plugin views are public.
flexmeasures/utils/app_utils.py
Outdated
- Your plugin folder contains an 'fmplugin' folder with an __init__.py file. | ||
- In this init, you define a Blueprint object called <plugin folder>_bp | ||
|
||
TODO: Support multiple plugins. |
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.
Wouldn't it suffice to make the config setting a list of paths and loop through that list?
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.
Probably. But I also would need to test that which is somewhat more effort. Actually, I believe it might take a while until someone needs it, or do you disagree?
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.
Hopefully not a lot of extra effort: I suggest the test would be to split up your one module defining both a UI view and CLI function into two modules. We'd indeed most likely be the first users of this plugin architecture, but I would prefer us to work in a modular fashion on small and dedicated plugins from the start, if possible. But fair enough, if your preference is to have multiple plugins be outside of the scope of this PR, let's open a separate ticket.
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.
In my eyes, one plugin and one private repo is what one would usually make per customer, and that's what we'll be doing for a few months. Of course, if our customers want custom stuff per client of theirs, then we should have more than one plugin per server. But that would also require our account data model (multiple accounts per server).
{% endfor %} | ||
|
||
|
||
{% set show_queues = True if current_user.is_authenticated and (current_user.has_role('admin') or FLEXMEASURES_MODE == "demo") else False %} |
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.
Candidate for an explicit config setting, rather than checking for server mode.
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.
So the design problem here is that some views are only for authenticated users (that's the default) while others also require a specific role (right now that only touches the admin
role).
/tasks
is the only current example of the latter but there might be others. I'll think about this some more.
Yes, I believe it could be either a folder (needing an What I don't know is how paths are resolved from a file (e.g. to templates, but also other Python files or configs like |
Add the possibility for views to be plugged-in to FlexMeasures by means of Blueprints.
Also adds the config option FLEXMEASURES_LISTED_VIEWS, so we can control what is shown in the menu. We cannot yet control which icon the menu entry will have (just use "info" for now).
This PR also fixes a few things in documentation and UI, which are too small for their own PR.
closes #90 and maybe #92