Flask-AppBuilder icon indicating copy to clipboard operation
Flask-AppBuilder copied to clipboard

fix: add_view menu_cond

Open steve-embling opened this issue 3 years ago • 2 comments

Description

menu_cond parameter of appbuilder.add_view is described as being a callable or None, that will hide the menu item if returns false. But setting this as per docs doesn't hide the menu item.

Apologies for lack of test case. It looks like current ones fail if an item is artificially hidden, but doesn't fail if an item is not hidden.

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] Is CRUD MVC related.
  • [ ] Is Auth, RBAC security related.
  • [ ] Changes the security db schema.
  • [ ] Introduces new feature
  • [ ] Removes existing feature

steve-embling avatar Sep 08 '22 19:09 steve-embling

Closing this - It doesnt only hide from the main menu but from action menus too, so I don't think that was the intention. Will step back and take a look for a more sensible approach, probably in menu

steve-embling avatar Sep 08 '22 21:09 steve-embling

Rereading the docs and actually struggling to interpret exactly what is intended, so maybe this does meet it.

It's not what I was looking for (keeping the views but leaving them out of the main menu) but appears to meet conditions described in docs, kind of! Sorry.

I do not think this should be merged but I'll reopen for discussion perhaps.

steve-embling avatar Sep 08 '22 21:09 steve-embling