generated from coulomb/repo-seed
Explore after registration as default
This commit is contained in:
@@ -101,6 +101,15 @@ def page(title: str, body: str) -> HTMLResponse:
|
||||
font: inherit;
|
||||
}}
|
||||
label {{ display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }}
|
||||
label.checkbox {{
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
color: var(--text);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}}
|
||||
label.checkbox input {{ width: auto; }}
|
||||
button, .button {{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -203,6 +212,7 @@ def render_repository_index(
|
||||
<label>Branch <input name="branch" value="main"></label>
|
||||
<label>Username <input name="access_username" autocomplete="username" placeholder="Optional for private HTTP(S) repos"></label>
|
||||
<label>Password or access token <input name="access_password" type="password" autocomplete="current-password" placeholder="Used for this Git operation only"></label>
|
||||
<label class="checkbox"><input type="checkbox" name="explore_after_registration" value="1" checked> Explore after registration</label>
|
||||
<div class="actions">
|
||||
<button type="submit">Register</button>
|
||||
<span data-pending>Registering repository...</span>
|
||||
@@ -414,6 +424,7 @@ def create_repository_from_form(
|
||||
branch: str = Form("main"),
|
||||
access_username: str = Form(""),
|
||||
access_password: str = Form(""),
|
||||
explore_after_registration: str | None = Form(None),
|
||||
service: RegistryService = Depends(get_service),
|
||||
):
|
||||
try:
|
||||
@@ -429,6 +440,16 @@ def create_repository_from_form(
|
||||
error_message=str(exc),
|
||||
status_code=400,
|
||||
)
|
||||
if explore_after_registration:
|
||||
summary = service.analyze_repository(
|
||||
repository.id,
|
||||
access_username=access_username or None,
|
||||
access_password=access_password or None,
|
||||
)
|
||||
return RedirectResponse(
|
||||
f"/ui/repos/{repository.id}/analysis-runs/{summary.analysis_run.id}",
|
||||
status_code=303,
|
||||
)
|
||||
return RedirectResponse(f"/ui/repos/{repository.id}", status_code=303)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user