diff options
Diffstat (limited to 'web_src/js/features/repo-migration.ts')
-rw-r--r-- | web_src/js/features/repo-migration.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/web_src/js/features/repo-migration.ts b/web_src/js/features/repo-migration.ts index 8f79ee1423..fb9c822f98 100644 --- a/web_src/js/features/repo-migration.ts +++ b/web_src/js/features/repo-migration.ts @@ -1,14 +1,14 @@ import {hideElem, showElem, toggleElem} from '../utils/dom.ts'; -const service = document.querySelector('#service_type'); -const user = document.querySelector('#auth_username'); -const pass = document.querySelector('#auth_password'); -const token = document.querySelector('#auth_token'); -const mirror = document.querySelector('#mirror'); -const lfs = document.querySelector('#lfs'); -const lfsSettings = document.querySelector('#lfs_settings'); -const lfsEndpoint = document.querySelector('#lfs_endpoint'); -const items = document.querySelectorAll('#migrate_items input[type=checkbox]'); +const service = document.querySelector<HTMLInputElement>('#service_type'); +const user = document.querySelector<HTMLInputElement>('#auth_username'); +const pass = document.querySelector<HTMLInputElement>('#auth_password'); +const token = document.querySelector<HTMLInputElement>('#auth_token'); +const mirror = document.querySelector<HTMLInputElement>('#mirror'); +const lfs = document.querySelector<HTMLInputElement>('#lfs'); +const lfsSettings = document.querySelector<HTMLElement>('#lfs_settings'); +const lfsEndpoint = document.querySelector<HTMLElement>('#lfs_endpoint'); +const items = document.querySelectorAll<HTMLInputElement>('#migrate_items input[type=checkbox]'); export function initRepoMigration() { checkAuth(); @@ -25,11 +25,11 @@ export function initRepoMigration() { }); lfs?.addEventListener('change', setLFSSettingsVisibility); - const cloneAddr = document.querySelector('#clone_addr'); + const cloneAddr = document.querySelector<HTMLInputElement>('#clone_addr'); cloneAddr?.addEventListener('change', () => { - const repoName = document.querySelector('#repo_name'); + const repoName = document.querySelector<HTMLInputElement>('#repo_name'); if (cloneAddr.value && !repoName?.value) { // Only modify if repo_name input is blank - repoName.value = cloneAddr.value.match(/^(.*\/)?((.+?)(\.git)?)$/)[3]; + repoName.value = /^(.*\/)?((.+?)(\.git)?)$/.exec(cloneAddr.value)[3]; } }); } @@ -41,8 +41,8 @@ function checkAuth() { checkItems(serviceType !== 1); } -function checkItems(tokenAuth) { - let enableItems; +function checkItems(tokenAuth: boolean) { + let enableItems = false; if (tokenAuth) { enableItems = token?.value !== ''; } else { |