mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	Git migration UX (#12619)
* Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Implementation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix gitlab and token cloning Signed-off-by: jolheiser <john.olheiser@gmail.com> * Imports and JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Linting Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move mirror toggle and rename options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		| @@ -8,6 +8,7 @@ import {htmlEscape} from 'escape-goat'; | ||||
| import 'jquery.are-you-sure'; | ||||
| import './vendor/semanticdropdown.js'; | ||||
|  | ||||
| import initMigration from './features/migration.js'; | ||||
| import initContextPopups from './features/contextpopup.js'; | ||||
| import initGitGraph from './features/gitgraph.js'; | ||||
| import initClipboard from './features/clipboard.js'; | ||||
| @@ -1155,25 +1156,6 @@ async function initRepository() { | ||||
|   } | ||||
| } | ||||
|  | ||||
| function initMigration() { | ||||
|   const toggleMigrations = function () { | ||||
|     const authUserName = $('#auth_username').val(); | ||||
|     const cloneAddr = $('#clone_addr').val(); | ||||
|     if (!$('#mirror').is(':checked') && (authUserName && authUserName.length > 0) && | ||||
|         (cloneAddr !== undefined && (cloneAddr.startsWith('https://github.com') || cloneAddr.startsWith('http://github.com') || cloneAddr.startsWith('http://gitlab.com') || cloneAddr.startsWith('https://gitlab.com')))) { | ||||
|       $('#migrate_items').show(); | ||||
|     } else { | ||||
|       $('#migrate_items').hide(); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   toggleMigrations(); | ||||
|  | ||||
|   $('#clone_addr').on('input', toggleMigrations); | ||||
|   $('#auth_username').on('input', toggleMigrations); | ||||
|   $('#mirror').on('change', toggleMigrations); | ||||
| } | ||||
|  | ||||
| function initPullRequestReview() { | ||||
|   $('.show-outdated').on('click', function (e) { | ||||
|     e.preventDefault(); | ||||
| @@ -2477,14 +2459,6 @@ $(document).ready(async () => { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   const $cloneAddr = $('#clone_addr'); | ||||
|   $cloneAddr.on('change', () => { | ||||
|     const $repoName = $('#repo_name'); | ||||
|     if ($cloneAddr.val().length > 0 && $repoName.val().length === 0) { // Only modify if repo_name input is blank | ||||
|       $repoName.val($cloneAddr.val().match(/^(.*\/)?((.+?)(\.git)?)$/)[3]); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   // parallel init of async loaded features | ||||
|   await Promise.all([ | ||||
|     attachTribute(document.querySelectorAll('#content, .emoji-input')), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user