Load container status into iframe as streamed response

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl
2026-02-11 15:54:41 +01:00
parent dd989ee87f
commit bf2d9ff394
10 changed files with 257 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
function toggleTheme() {
const currentTheme = document.documentElement.getAttribute('data-theme');
const newTheme = (currentTheme === 'dark') ? '' : 'dark'; // Toggle between no theme and dark theme
document.documentElement.setAttribute('data-theme', newTheme);
setThemeToDOM(newTheme);
localStorage.setItem('theme', newTheme);
// Change the icon based on the current theme
@@ -10,14 +10,16 @@ function toggleTheme() {
themeIcon.textContent = newTheme === 'dark' ? '☀️' : '🌙'; // Switch between moon and sun icons
}
function setThemeToDOM(value) {
// Set the theme to the root document and all possible iframe documents (so they can adapt their styling, too).
const documents = [document, Array.from(document.querySelectorAll('iframe')).map((iframe) => iframe.contentDocument)].flat()
documents.forEach((doc) => doc.documentElement.setAttribute('data-theme', value));
}
// Function to immediately apply saved theme without icon update
function applySavedThemeImmediately() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute('data-theme'); // Default to light theme
}
// Default to light theme
setThemeToDOM(localStorage.getItem('theme') ?? '');
}
// Function to apply theme-icon update