Skip to content

Commit

Permalink
Turn on ydb in OS
Browse files Browse the repository at this point in the history
  • Loading branch information
vallbull committed Dec 19, 2023
1 parent 0960c1c commit 5602037
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/dl_control_api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
1 change: 1 addition & 0 deletions app/dl_data_api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions lib/dl_connector_ydb/dl_connector_ydb/core/ydb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 2 additions & 0 deletions metapkg/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5602037

Please sign in to comment.