diff --git a/app/dl_control_api/pyproject.toml b/app/dl_control_api/pyproject.toml index abf1601c9..40266e283 100644 --- a/app/dl_control_api/pyproject.toml +++ b/app/dl_control_api/pyproject.toml @@ -18,6 +18,7 @@ datalens-sqlalchemy-common = {path = "../../lib/dl_sqlalchemy_common"} datalens-sqlalchemy-clickhouse = {path = "../../lib/dl_sqlalchemy_clickhouse"} datalens-connector-postgresql = {path = "../../lib/dl_connector_postgresql"} datalens-connector-clickhouse = {path = "../../lib/dl_connector_clickhouse"} +datalens-connector-ydb = {path = "../../lib/dl_connector_ydb"} datalens-connector-chyt = {path = "../../lib/dl_connector_chyt"} datalens-core = {path = "../../lib/dl_core"} datalens-app-tools = {path = "../../lib/dl_app_tools"} diff --git a/app/dl_data_api/pyproject.toml b/app/dl_data_api/pyproject.toml index b929f655d..2e38c1a79 100644 --- a/app/dl_data_api/pyproject.toml +++ b/app/dl_data_api/pyproject.toml @@ -19,6 +19,7 @@ datalens-sqlalchemy-clickhouse = {path = "../../lib/dl_sqlalchemy_clickhouse"} datalens-connector-postgresql = {path = "../../lib/dl_connector_postgresql"} datalens-connector-clickhouse = {path = "../../lib/dl_connector_clickhouse"} datalens-connector-chyt = {path = "../../lib/dl_connector_chyt"} +datalens-connector-ydb = {path = "../../lib/dl_connector_ydb"} datalens-core = {path = "../../lib/dl_core"} datalens-app-tools = {path = "../../lib/dl_app_tools"} datalens-model-tools = {path = "../../lib/dl_model_tools"} diff --git a/lib/dl_connector_ydb/dl_connector_ydb/api/ydb/connection_form/form_config.py b/lib/dl_connector_ydb/dl_connector_ydb/api/ydb/connection_form/form_config.py index 653e13bcf..e5103127f 100644 --- a/lib/dl_connector_ydb/dl_connector_ydb/api/ydb/connection_form/form_config.py +++ b/lib/dl_connector_ydb/dl_connector_ydb/api/ydb/connection_form/form_config.py @@ -44,12 +44,28 @@ def _get_base_common_api_schema_items(self, names_source: Type[Enum]) -> list[Fo ] def _get_default_db_section(self, rc: RowConstructor, connector_settings: YDBConnectorSettings) -> list[FormRow]: - return [ + oauth_row = ( C.OAuthTokenRow( name=CommonFieldName.token, fake_value="******" if self.mode == ConnectionFormMode.edit else None, application=YDBOAuthApplication.ydb, - ), + ) + if connector_settings.MANAGED_OAUTH_ROW + else C.CustomizableRow( + items=[ + C.LabelRowItem(text="OAuth"), + C.InputRowItem( + name=CommonFieldName.token, + width="l", + default_value="" if self.mode == ConnectionFormMode.create else None, + fake_value="******" if self.mode == ConnectionFormMode.edit else None, + control_props=C.InputRowItem.Props(type="password"), + ), + ] + ) + ) + return [ + oauth_row, rc.host_row(default_value=connector_settings.DEFAULT_HOST_VALUE), rc.port_row(default_value="2135"), rc.db_name_row(), @@ -113,7 +129,10 @@ def get_form_config( common_api_schema_items = self._get_base_common_api_schema_items(names_source=CommonFieldName) db_section_rows = self._get_default_db_section(rc=rc, connector_settings=connector_settings) common_api_schema_items.append( - FormFieldApiSchema(name=CommonFieldName.token, required=self.mode == ConnectionFormMode.create) + FormFieldApiSchema( + name=CommonFieldName.token, + required=self.mode == ConnectionFormMode.create, + ) ) edit_api_schema.items.extend(common_api_schema_items) diff --git a/lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py b/lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py index 7d32efa0a..ead4be5fe 100644 --- a/lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py +++ b/lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py @@ -12,6 +12,7 @@ @attr.s(frozen=True) class YDBConnectorSettings(ConnectorSettingsBase): + MANAGED_OAUTH_ROW: Optional[str] = False DEFAULT_HOST_VALUE: Optional[str] = s_attrib("DEFAULT_HOST_VALUE", missing=None) # type: ignore diff --git a/metapkg/poetry.lock b/metapkg/poetry.lock index 3a7547e6b..3b6d66172 100644 --- a/metapkg/poetry.lock +++ b/metapkg/poetry.lock @@ -1698,6 +1698,7 @@ datalens-app-tools = {path = "../../lib/dl_app_tools"} datalens-connector-chyt = {path = "../../lib/dl_connector_chyt"} datalens-connector-clickhouse = {path = "../../lib/dl_connector_clickhouse"} datalens-connector-postgresql = {path = "../../lib/dl_connector_postgresql"} +datalens-connector-ydb = {path = "../../lib/dl_connector_ydb"} datalens-core = {path = "../../lib/dl_core"} datalens-model-tools = {path = "../../lib/dl_model_tools"} datalens-sqlalchemy-clickhouse = {path = "../../lib/dl_sqlalchemy_clickhouse"} @@ -1817,6 +1818,7 @@ datalens-app-tools = {path = "../../lib/dl_app_tools"} datalens-connector-chyt = {path = "../../lib/dl_connector_chyt"} datalens-connector-clickhouse = {path = "../../lib/dl_connector_clickhouse"} datalens-connector-postgresql = {path = "../../lib/dl_connector_postgresql"} +datalens-connector-ydb = {path = "../../lib/dl_connector_ydb"} datalens-core = {path = "../../lib/dl_core"} datalens-model-tools = {path = "../../lib/dl_model_tools"} datalens-sqlalchemy-clickhouse = {path = "../../lib/dl_sqlalchemy_clickhouse"}