To support white-labeling, we need custom colors and logo. #471 is about the colors, here we deal with the logo.
In the end, users with role account-admin should be able to upload a logo, which gets saved to the database (in the account table). Of course, the size should be limited. The SO link here is a good inspiration for the whole roundtrip, but this issue only deals with making it possible for FlexMeasures admins to set the logo.
This requires:
an extension of the accounts table with a logo field (the SO example used db.Column(db.LargeBinary) but I guess we can restrict the size here somewhat)
extending the CLI command (pointing to a file?) might be a good way to test this without already having to write an upload form, probably not and maybe these two tickets require a new account editing form, but that
when the logo field is set, the UI should show that logo in the upper left corner instead of the FlexMeasures logo. Currently, to set a custom logo we check the config variable which can contain a custom URL: in view_utils.py we do this: variables["menu_logo"] = current_app.config.get("FLEXMEASURES_MENU_LOGO_PATH"). Maybe we can add a Flask route account/ID/logo which serves the logo of an account (requiring users to be logged-in) and if the account has a logo and FLEXMEASURES_MENU_LOGO_PATH is not set, variables["menu_logo"] gets set to the URL for that view.
Not included: API endpoint to patch an account and a form to upload logo.
To support white-labeling, we need custom colors and logo. #471 is about the colors, here we deal with the logo.
In the end, users with role
account-admin
should be able to upload a logo, which gets saved to the database (in the account table). Of course, the size should be limited. The SO link here is a good inspiration for the whole roundtrip, but this issue only deals with making it possible for FlexMeasures admins to set the logo.This requires:
logo
field (the SO example useddb.Column(db.LargeBinary)
but I guess we can restrict the size here somewhat)logo
field is set, the UI should show that logo in the upper left corner instead of the FlexMeasures logo. Currently, to set a custom logo we check the config variable which can contain a custom URL: inview_utils.py
we do this:variables["menu_logo"] = current_app.config.get("FLEXMEASURES_MENU_LOGO_PATH")
. Maybe we can add a Flask routeaccount/ID/logo
which serves the logo of an account (requiring users to be logged-in) and if the account has a logo andFLEXMEASURES_MENU_LOGO_PATH
is not set,variables["menu_logo"]
gets set to the URL for that view.Not included: API endpoint to patch an account and a form to upload logo.