josh-fell commented on a change in pull request #15159:
URL: https://github.com/apache/airflow/pull/15159#discussion_r609783462



##########
File path: airflow/providers/microsoft/azure/hooks/azure_cosmos.py
##########
@@ -50,6 +50,39 @@ class AzureCosmosDBHook(BaseHook):
     conn_type = 'azure_cosmos'
     hook_name = 'Azure CosmosDB'
 
+    @staticmethod
+    def get_connection_form_widgets() -> Dict[str, Any]:
+        """Returns connection widgets to add to connection form"""
+        from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
+        from flask_babel import lazy_gettext
+        from wtforms import StringField
+
+        return {
+            "extra__azure_cosmos__database_name": StringField(
+                lazy_gettext('Cosmos Database Name'), 
widget=BS3TextFieldWidget()
+            ),
+            "extra__azure_cosmos__collection_name": StringField(
+                lazy_gettext('Cosmos Collection Name'), 
widget=BS3TextFieldWidget()
+            ),
+        }
+
+    @staticmethod
+    def get_ui_field_behaviour() -> Dict:
+        """Returns custom field behaviour"""
+        return {
+            "hidden_fields": ['schema', 'port', 'host', 'extra'],
+            "relabeling": {
+                'login': 'Cosmos Endpoint URI',
+                'password': 'Cosmos Master Key Token',
+            },
+            "placeholders": {
+                'login': 'endpoint uri',
+                'password': 'master key',
+                'extra__azure_cosmos__database_name': 'database name 
(optional)',
+                'extra__azure_cosmos__collection_name': 'collection name 
(optional)',

Review comment:
       For consistency can the "(optional)" text in the placeholder be part of 
the field relabeling?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to