|
1 | 1 | /** |
2 | 2 | * Initialize the API keys page |
3 | 3 | */ |
4 | | -async function initApiKeysPage() { |
5 | | - console.log("Initializing API keys page"); |
6 | | - |
7 | | - // Ensure the api-key-manager component is loaded |
8 | | - try { |
9 | | - // Import the api-key-manager component |
10 | | - await import('../components/api-key-manager.js'); |
11 | | - console.log("API key manager component imported"); |
12 | | - |
13 | | - // Make sure the component is defined and registered |
14 | | - if (!customElements.get('api-key-manager')) { |
15 | | - console.error("API key manager component not registered"); |
16 | | - } else { |
17 | | - console.log("API key manager component is registered"); |
18 | | - } |
19 | | - |
20 | | - // Force re-render of the component if it exists |
21 | | - const apiKeyManager = document.querySelector('api-key-manager'); |
22 | | - if (apiKeyManager) { |
23 | | - console.log("Found api-key-manager element, forcing render"); |
24 | | - // If the component has a render method, call it |
25 | | - if (typeof apiKeyManager.render === 'function') { |
26 | | - apiKeyManager.render(); |
27 | | - } |
28 | | - // Otherwise, try to re-initialize it by removing and re-adding it |
29 | | - else { |
30 | | - const container = document.getElementById('api-key-container'); |
31 | | - if (container) { |
32 | | - const newManager = document.createElement('api-key-manager'); |
33 | | - container.innerHTML = ''; |
34 | | - container.appendChild(newManager); |
35 | | - console.log("Re-created api-key-manager element"); |
36 | | - } |
37 | | - } |
38 | | - } else { |
39 | | - console.log("No api-key-manager element found, creating one"); |
40 | | - const container = document.getElementById('api-key-container'); |
41 | | - if (container) { |
42 | | - const newManager = document.createElement('api-key-manager'); |
43 | | - container.innerHTML = ''; |
44 | | - container.appendChild(newManager); |
45 | | - console.log("Created new api-key-manager element"); |
46 | | - } |
47 | | - } |
48 | | - } catch (error) { |
49 | | - console.error("Error loading api-key-manager component:", error); |
50 | | - } |
51 | | - |
| 4 | +function initApiKeysPage() { |
52 | 5 | // Set up tab switching |
53 | 6 | const tabButtons = document.querySelectorAll(".tab-button"); |
54 | 7 | tabButtons.forEach((button) => { |
@@ -78,6 +31,12 @@ async function initApiKeysPage() { |
78 | 31 | } |
79 | 32 | }); |
80 | 33 | }); |
| 34 | + |
| 35 | + // Make sure the first tab content is visible by default |
| 36 | + const firstTabContent = document.getElementById("manage-tab"); |
| 37 | + if (firstTabContent) { |
| 38 | + firstTabContent.style.display = "block"; |
| 39 | + } |
81 | 40 | } |
82 | 41 |
|
83 | 42 | // Initialize the page when the DOM is loaded |
|
0 commit comments