From f01737563be855b4de06b0a0de9885efb84320f9 Mon Sep 17 00:00:00 2001 From: Valeria Bulanova Date: Tue, 26 Dec 2023 18:24:47 +0300 Subject: [PATCH] Delete oauth row --- .../api/ydb/connection_form/form_config.py | 25 ++++--------------- .../dl_connector_ydb/core/ydb/settings.py | 6 ++--- 2 files changed, 8 insertions(+), 23 deletions(-) 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 a801ea7b1..eebae020e 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 @@ -45,25 +45,10 @@ 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]: - 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=self._localizer.translate(Translatable("field_oauth_row"))), - 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"), - ), - ] - ) + oauth_row = C.OAuthTokenRow( + name=CommonFieldName.token, + fake_value="******" if self.mode == ConnectionFormMode.edit else None, + application=YDBOAuthApplication.ydb, ) return [ oauth_row, @@ -132,7 +117,7 @@ def get_form_config( common_api_schema_items.append( FormFieldApiSchema( name=CommonFieldName.token, - required=self.mode == ConnectionFormMode.create and connector_settings.MANAGED_OAUTH_ROW, + required=self.mode == ConnectionFormMode.create and connector_settings.HAS_AUTH, ) ) 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 04b2c724f..e628af9ae 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 @@ -19,12 +19,12 @@ @attr.s(frozen=True) class YDBConnectorSettings(ConnectorSettingsBase): - MANAGED_OAUTH_ROW: Optional[bool] = s_attrib("MANAGED_OAUTH_ROW", missing=True) # type: ignore + HAS_AUTH: Optional[bool] = s_attrib("HAS_AUTH", missing=True) # type: ignore DEFAULT_HOST_VALUE: Optional[str] = s_attrib("DEFAULT_HOST_VALUE", missing=None) # type: ignore class ConnectorsDataYDBBase(ConnectorsDataBase): - MANAGED_OAUTH_ROW: ClassVar[Optional[bool]] = True + HAS_AUTH: ClassVar[Optional[bool]] = True @classmethod def connector_name(cls) -> str: @@ -39,7 +39,7 @@ def ydb_settings_fallback(full_cfg: ConnectorsConfigType) -> dict[str, Connector ) if cfg is None: return {} - return dict(YDB=YDBConnectorSettings(MANAGED_OAUTH_ROW=cfg.MANAGED_OAUTH_ROW)) # type: ignore + return dict(YDB=YDBConnectorSettings(HAS_AUTH=cfg.HAS_AUTH)) # type: ignore class YDBSettingDefinition(ConnectorSettingsDefinition):