Skip to content

Commit

Permalink
Delete oauth row
Browse files Browse the repository at this point in the history
  • Loading branch information
vallbull committed Dec 26, 2023
1 parent bb81b1a commit f017375
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit f017375

Please sign in to comment.