aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2020-09-21 18:42:22 -0400
committerGitHub <noreply@github.com>2020-09-22 01:42:22 +0300
commit63e8bdaf739519c800498dac87b4f362b3c6f478 (patch)
tree6dbd3e53ab7aab29ca18a9fb74bc5e611f8c6854
parent060d46dd257a00160b3bd10893ae83cae7deb855 (diff)
downloadgitea-63e8bdaf739519c800498dac87b4f362b3c6f478.tar.gz
gitea-63e8bdaf739519c800498dac87b4f362b3c6f478.zip
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>
-rw-r--r--web_src/js/features/migration.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/web_src/js/features/migration.js b/web_src/js/features/migration.js
index 7a406616fd..09ab49b3e1 100644
--- a/web_src/js/features/migration.js
+++ b/web_src/js/features/migration.js
@@ -2,7 +2,8 @@ const $service = $('#service_type');
const $user = $('#auth_username');
const $pass = $('#auth_password');
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() {
checkAuth();
@@ -10,6 +11,7 @@ export default function initMigration() {
$user.on('keyup', () => {checkItems(false)});
$pass.on('keyup', () => {checkItems(false)});
$token.on('keyup', () => {checkItems(true)});
+ $mirror.on('change', () => {checkItems(true)});
const $cloneAddr = $('#clone_addr');
$cloneAddr.on('change', () => {
@@ -34,8 +36,13 @@ function checkItems(tokenAuth) {
enableItems = $user.val() !== '' || $pass.val() !== '';
}
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 {
- $items.addClass('disabled');
+ $items.attr('disabled', true);
}
}