feat: service credentials (login/password) on dashboard cards with copy button
This commit is contained in:
+7
-1
@@ -197,6 +197,8 @@ class Service(Base):
|
||||
type: Mapped[ServiceType] = mapped_column(Enum(ServiceType), index=True)
|
||||
target: Mapped[str] = mapped_column(Text)
|
||||
comment: Mapped[str] = mapped_column(Text, default="")
|
||||
svc_login: Mapped[str] = mapped_column(String(256), default="")
|
||||
svc_password: Mapped[str] = mapped_column(String(256), default="")
|
||||
icon_path: Mapped[str] = mapped_column(Text, default="")
|
||||
active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
warm_pool_size: Mapped[int] = mapped_column(Integer, default=0)
|
||||
@@ -1255,6 +1257,8 @@ def ensure_schema_compatibility() -> None:
|
||||
with engine.begin() as conn:
|
||||
conn.execute(text("ALTER TABLE services ADD COLUMN IF NOT EXISTS warm_pool_size INTEGER NOT NULL DEFAULT 0"))
|
||||
conn.execute(text("ALTER TABLE services ADD COLUMN IF NOT EXISTS comment TEXT NOT NULL DEFAULT ''"))
|
||||
conn.execute(text("ALTER TABLE services ADD COLUMN IF NOT EXISTS svc_login VARCHAR(256) NOT NULL DEFAULT ''"))
|
||||
conn.execute(text("ALTER TABLE services ADD COLUMN IF NOT EXISTS svc_password VARCHAR(256) NOT NULL DEFAULT ''"))
|
||||
conn.execute(text("ALTER TABLE services ADD COLUMN IF NOT EXISTS icon_path TEXT NOT NULL DEFAULT ''"))
|
||||
conn.execute(
|
||||
text(
|
||||
@@ -2677,6 +2681,8 @@ def create_service(payload: dict, request: Request, _: User = Depends(require_ad
|
||||
type=service_type,
|
||||
target=target,
|
||||
comment=payload.get("comment", ""),
|
||||
svc_login=payload.get("svc_login", ""),
|
||||
svc_password=payload.get("svc_password", ""),
|
||||
active=payload.get("active", True),
|
||||
warm_pool_size=max(0, int(payload.get("warm_pool_size", 0))),
|
||||
)
|
||||
@@ -2741,7 +2747,7 @@ def edit_service(service_id: int, payload: dict, request: Request, _: User = Dep
|
||||
service = db.get(Service, service_id)
|
||||
if not service:
|
||||
raise HTTPException(status_code=404, detail="Service not found")
|
||||
for key in ["name", "slug", "target", "active", "comment"]:
|
||||
for key in ["name", "slug", "target", "active", "comment", "svc_login", "svc_password"]:
|
||||
if key in payload:
|
||||
setattr(service, key, payload[key])
|
||||
if "type" in payload:
|
||||
|
||||
Reference in New Issue
Block a user