()
| 86 | // --- Public API --- |
| 87 | |
| 88 | export function initChatAppsDialog() { |
| 89 | dialog = document.getElementById("chatapps-dialog"); |
| 90 | openBtn = document.getElementById("open-chatapps-btn"); |
| 91 | closeBtn = document.getElementById("close-chatapps-btn"); |
| 92 | saveBtn = document.getElementById("save-chatapps-btn"); |
| 93 | restartBtn = document.getElementById("restart-chatapps-btn"); |
| 94 | telegramTokenInput = document.getElementById("chatapps-telegram-token"); |
| 95 | slackBotTokenInput = document.getElementById("chatapps-slack-bot-token"); |
| 96 | slackAppTokenInput = document.getElementById("chatapps-slack-app-token"); |
| 97 | feishuDomainSelect = document.getElementById("chatapps-feishu-domain"); |
| 98 | feishuAppIdInput = document.getElementById("chatapps-feishu-app-id"); |
| 99 | feishuAppSecretInput = document.getElementById("chatapps-feishu-app-secret"); |
| 100 | telegramGuideBtn = document.getElementById("chatapps-open-telegram-guide"); |
| 101 | slackGuideBtn = document.getElementById("chatapps-open-slack-guide"); |
| 102 | statusEl = document.getElementById("chatapps-status"); |
| 103 | tabButtons = Array.from(document.querySelectorAll("[data-chatapps-tab]")); |
| 104 | tabPanels = Array.from(document.querySelectorAll("[data-chatapps-panel]")); |
| 105 | |
| 106 | if (!dialog) return; |
| 107 | |
| 108 | if (openBtn) { |
| 109 | openBtn.addEventListener("click", open); |
| 110 | } |
| 111 | if (closeBtn) { |
| 112 | closeBtn.addEventListener("click", close); |
| 113 | } |
| 114 | if (saveBtn) { |
| 115 | saveBtn.addEventListener("click", handleSave); |
| 116 | } |
| 117 | if (restartBtn) { |
| 118 | restartBtn.addEventListener("click", handleRestart); |
| 119 | } |
| 120 | if (telegramGuideBtn) { |
| 121 | telegramGuideBtn.addEventListener("click", () => openGuide(TELEGRAM_GUIDE_URL)); |
| 122 | } |
| 123 | if (slackGuideBtn) { |
| 124 | slackGuideBtn.addEventListener("click", () => openGuide(SLACK_GUIDE_URL)); |
| 125 | } |
| 126 | |
| 127 | tabButtons.forEach((button) => { |
| 128 | button.addEventListener("click", () => { |
| 129 | selectChatAppsTab(button.dataset.chatappsTab || "telegram"); |
| 130 | }); |
| 131 | }); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * 根据当前连接状态更新按钮外观 |
no test coverage detected