mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Disable migration items when mirror is selected (#12918)
* Disable migration items when mirror is selected Disable migration items when mirror option is selected to make it more clear that it isn't possible to mirror anything other than code. * allow wiki checkbox for mirrors Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		| @@ -2,7 +2,8 @@ const $service = $('#service_type'); | |||||||
| const $user = $('#auth_username'); | const $user = $('#auth_username'); | ||||||
| const $pass = $('#auth_password'); | const $pass = $('#auth_password'); | ||||||
| const $token = $('#auth_token'); | const $token = $('#auth_token'); | ||||||
| const $items = $('#migrate_items').find('.field'); | const $mirror = $('#mirror'); | ||||||
|  | const $items = $('#migrate_items').find('input[type=checkbox]'); | ||||||
|  |  | ||||||
| export default function initMigration() { | export default function initMigration() { | ||||||
|   checkAuth(); |   checkAuth(); | ||||||
| @@ -10,6 +11,7 @@ export default function initMigration() { | |||||||
|   $user.on('keyup', () => {checkItems(false)}); |   $user.on('keyup', () => {checkItems(false)}); | ||||||
|   $pass.on('keyup', () => {checkItems(false)}); |   $pass.on('keyup', () => {checkItems(false)}); | ||||||
|   $token.on('keyup', () => {checkItems(true)}); |   $token.on('keyup', () => {checkItems(true)}); | ||||||
|  |   $mirror.on('change', () => {checkItems(true)}); | ||||||
|  |  | ||||||
|   const $cloneAddr = $('#clone_addr'); |   const $cloneAddr = $('#clone_addr'); | ||||||
|   $cloneAddr.on('change', () => { |   $cloneAddr.on('change', () => { | ||||||
| @@ -34,8 +36,13 @@ function checkItems(tokenAuth) { | |||||||
|     enableItems = $user.val() !== '' || $pass.val() !== ''; |     enableItems = $user.val() !== '' || $pass.val() !== ''; | ||||||
|   } |   } | ||||||
|   if (enableItems && $service.val() > 1) { |   if (enableItems && $service.val() > 1) { | ||||||
|     $items.removeClass('disabled'); |     if ($mirror.is(':checked')) { | ||||||
|  |       $items.not('[name="wiki"]').attr('disabled', true); | ||||||
|  |       $items.filter('[name="wiki"]').attr('disabled', false); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     $items.attr('disabled', false); | ||||||
|   } else { |   } else { | ||||||
|     $items.addClass('disabled'); |     $items.attr('disabled', true); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user