46 lines
1.4 KiB
HTML
46 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-TW">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>手動輸入組織,批次建立 Gitea 儲存庫與團隊</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
|
</head>
|
|
|
|
<body>
|
|
<h2>輸入組織名稱並從 JSON 建立儲存庫+設定團隊<br>PS.請先建好團隊(或使用下方按鈕批次建立)</h2>
|
|
|
|
<label>組織名稱:<input type="text" id="orgInput"></label>
|
|
<button data-action="createTeams">創建團隊</button>
|
|
<button data-action="createRepos">建立儲存庫</button>
|
|
<button data-action="setActions">設定 Actions</button>
|
|
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
const logDiv = document.getElementById('log');
|
|
|
|
document.querySelectorAll('button').forEach(btn => {
|
|
btn.addEventListener('click', () => {
|
|
logDiv.innerHTML = ""; // ← 清空舊訊息
|
|
const org = document.getElementById('orgInput').value.trim();
|
|
if (!org) {
|
|
logDiv.innerHTML = "❌ 請輸入組織名稱<br>";
|
|
return;
|
|
}
|
|
const evt = new EventSource(`run.php?org=${encodeURIComponent(org)}&action=${btn.dataset.action}`);
|
|
evt.onmessage = e => {
|
|
logDiv.innerHTML += e.data + "<br>";
|
|
logDiv.scrollTop = logDiv.scrollHeight;
|
|
};
|
|
evt.onerror = () => {
|
|
// logDiv.innerHTML += "執行完成<br>";
|
|
evt.close();
|
|
};
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |