From babd3da49b40c1d672650b4bc34dade684c7603f Mon Sep 17 00:00:00 2001 From: pomidorry Date: Mon, 8 Jun 2026 16:02:58 +0300 Subject: [PATCH] proper style --- options/locale/locale_en-US.json | 3 ++- templates/repo/migrate/git.tmpl | 17 +++++++++++------ web_src/js/features/repo-migrate.ts | 24 ++---------------------- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 2ba38e0892..722ff0fe00 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -1123,7 +1123,8 @@ "repo.migrate.ssh_helper_desc": "Upload your SSH mirror keys to the remote SSH server for authentication.", "repo.migrate.ssh_helper_link": "View your SSH keys (if migrating to an organization, you may need to upload the organization's SSH keys).", "repo.migrate.ssh_key_owner_label": "Authenticate with", - "repo.migrate.ssh_key_owner_repo_default": "Repository owner's managed SSH key (default)", + "repo.migrate.ssh_key_owner_org_default": "This organization's managed SSH key (default)", + "repo.migrate.ssh_key_owner_personal": "Your personal managed SSH key (%s)", "repo.migrate.permission_denied": "You are not allowed to import local repositories.", "repo.migrate.permission_denied_blocked": "You cannot import from disallowed hosts. Please ask the admin to check ALLOWED_DOMAINS/ALLOW_LOCALNETWORKS/BLOCKED_DOMAINS settings.", "repo.migrate.invalid_local_path": "The local path is invalid. It doesn't exist or is not a directory.", diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index e6c29de16b..2bfc425b4a 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -30,12 +30,17 @@ -
- - - +
+ +
{{template "repo/migrate/options" .}} diff --git a/web_src/js/features/repo-migrate.ts b/web_src/js/features/repo-migrate.ts index 1ebeb8782b..f73c37dc6d 100644 --- a/web_src/js/features/repo-migrate.ts +++ b/web_src/js/features/repo-migrate.ts @@ -109,21 +109,11 @@ export function initRepoMigrationForm() { // managed key. The hidden #ssh_key_owner_id field is submitted with the form. function initSSHKeyOwnerSelector(cloneAddrInput: HTMLInputElement) { const container = document.querySelector('.ssh-key-owner-selector'); - const select = document.querySelector('#ssh_key_owner_select'); const hiddenId = document.querySelector('#ssh_key_owner_id'); const uidInput = document.querySelector('#uid'); - if (!container || !select || !hiddenId || !uidInput) return; + if (!container || !hiddenId || !uidInput) return; const signedUserID = container.getAttribute('data-signed-user-id') ?? ''; - const signedUserName = container.getAttribute('data-signed-user-name') ?? ''; - - // Build {ownerID -> name} from the owner dropdown menu items - const ownerNameById = new Map(); - for (const item of document.querySelectorAll('.owner.dropdown .menu .item')) { - const id = item.getAttribute('data-value'); - const name = item.getAttribute('title') ?? item.textContent?.trim() ?? ''; - if (id) ownerNameById.set(id, name); - } function update() { const isSSH = isSSHURL(cloneAddrInput.value.trim()); @@ -136,20 +126,10 @@ function initSSHKeyOwnerSelector(cloneAddrInput: HTMLInputElement) { return; } - // Target is an organisation — offer both keys - const orgName = ownerNameById.get(targetUid) ?? `#${targetUid}`; - select!.innerHTML = ''; - select!.add(new Option(`Use ${orgName}'s managed SSH key (default)`, '0')); - select!.add(new Option(`Use your personal managed SSH key (${signedUserName})`, signedUserID)); - select!.value = hiddenId!.value || '0'; - hiddenId!.value = select!.value; + // Target is an organisation — show selector (Fomantic dropdown wires the hidden input itself) showElem(container!); } - select.addEventListener('change', () => { - hiddenId.value = select.value; - }); - // Semantic UI updates the #uid hidden input via menu item clicks for (const item of document.querySelectorAll('.owner.dropdown .menu .item')) { item.addEventListener('click', () => setTimeout(update, 0));