A tool to migrate GitHub Repositories to Gitea including all issues
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
gitea-github-migrator/web/public/js/select-repos.js

30 lines
856 B

var repo_regex = /^[A-Za-z0-9-.]+\/[A-Za-z0-9-.]+$/;
function openSelectRepoModal() {
$("#add-repos").modal('setting', {
onApprove: function () {
var repos = parseReposInTextArea();
for (var idx in repos) {
var repo = repos[idx];
if (repo_regex.test(repo)){
addRepoToList(repo);
}else {
alert(repo + " is not a repository")
}
}
return true;
}
}).modal('show');
}
function parseReposInTextArea() {
var text = $("#repo-textform").val();
return text.split("\n");
}
function addRepoToList(repo) {
var item = $("#repo-item").children('.item').clone();
item.html(item.html().replace(/FULL_REPO_NAME/g, repo));
console.log(repo, item.html());
$("#repo-list").append(item);
}