Skip to content

Commit 63e8bda

Browse files
mrsdizzielunny
andauthored
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 <[email protected]>
1 parent 060d46d commit 63e8bda

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

web_src/js/features/migration.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ const $service = $('#service_type');
22
const $user = $('#auth_username');
33
const $pass = $('#auth_password');
44
const $token = $('#auth_token');
5-
const $items = $('#migrate_items').find('.field');
5+
const $mirror = $('#mirror');
6+
const $items = $('#migrate_items').find('input[type=checkbox]');
67

78
export default function initMigration() {
89
checkAuth();
910

1011
$user.on('keyup', () => {checkItems(false)});
1112
$pass.on('keyup', () => {checkItems(false)});
1213
$token.on('keyup', () => {checkItems(true)});
14+
$mirror.on('change', () => {checkItems(true)});
1315

1416
const $cloneAddr = $('#clone_addr');
1517
$cloneAddr.on('change', () => {
@@ -34,8 +36,13 @@ function checkItems(tokenAuth) {
3436
enableItems = $user.val() !== '' || $pass.val() !== '';
3537
}
3638
if (enableItems && $service.val() > 1) {
37-
$items.removeClass('disabled');
39+
if ($mirror.is(':checked')) {
40+
$items.not('[name="wiki"]').attr('disabled', true);
41+
$items.filter('[name="wiki"]').attr('disabled', false);
42+
return;
43+
}
44+
$items.attr('disabled', false);
3845
} else {
39-
$items.addClass('disabled');
46+
$items.attr('disabled', true);
4047
}
4148
}

0 commit comments

Comments
 (0)