]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/dashboard: correct type signature of CRUDEndpoint arg
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 20 Jan 2024 16:07:54 +0000 (11:07 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 24 Jan 2024 18:33:29 +0000 (13:33 -0500)
Typing issue was found by mypy 1.5.1. The type only accepted values
of str but based on the data and code using set_column data the
boolean assignments to the 'isHidden' key were correct and so
I updated the type to also accept bool.

A more correct fix might be to use typing.TypedDict - this would
require python 3.8 (or typing extensions) and someone more familiar
with the dashboard code :-)

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/dashboard/controllers/_crud.py

index d65649cadb4be49d97539fedc340f59ec0f53450..855832ff55086e6debb4d81c820972363a56b64f 100644 (file)
@@ -332,7 +332,7 @@ class CRUDEndpoint:
     CRUDClassMetadata: Optional[RESTController] = None
 
     def __init__(self, router: APIRouter, doc: APIDoc,
-                 set_column: Optional[Dict[str, Dict[str, str]]] = None,
+                 set_column: Optional[Dict[str, Dict[str, Union[str, bool]]]] = None,
                  actions: Optional[List[TableAction]] = None,
                  permissions: Optional[List[str]] = None, forms: Optional[List[Form]] = None,
                  column_key: Optional[str] = None,