Files
Warracker/frontend/page-test.html
sassanix 8f62a166a6 Status page added
Please refer to Changelogs.md
2025-03-06 22:06:44 -04:00

160 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Navigation Test</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
h1 {
color: #2c3e50;
border-bottom: 2px solid #ecf0f1;
padding-bottom: 10px;
}
.test-links {
margin: 20px 0;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 15px;
}
.link-card {
border: 1px solid #e0e0e0;
border-radius: 5px;
padding: 15px;
display: flex;
flex-direction: column;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.link-card h3 {
margin-top: 0;
color: #3498db;
}
.link-card p {
margin-bottom: 15px;
flex-grow: 1;
}
.direct-link, .iframe-test {
display: inline-block;
padding: 8px 15px;
background-color: #3498db;
color: white;
text-decoration: none;
border-radius: 4px;
margin-right: 10px;
border: none;
cursor: pointer;
font-size: 14px;
}
.direct-link:hover, .iframe-test:hover {
background-color: #2980b9;
}
.test-frame {
width: 100%;
height: 300px;
border: 1px solid #e0e0e0;
border-radius: 5px;
margin-top: 20px;
display: none;
}
.message {
padding: 10px;
margin: 10px 0;
border-radius: 4px;
}
.success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
</style>
</head>
<body>
<h1>Page Navigation Test</h1>
<p>This page helps test if direct navigation to different pages in your application works correctly.</p>
<div id="message" style="display: none;" class="message"></div>
<div class="test-links">
<div class="link-card">
<h3>Home Page</h3>
<p>The main dashboard page of the application.</p>
<a href="index.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="index.html">Test in iframe</button>
</div>
<div class="link-card">
<h3>Status Page</h3>
<p>The warranty status dashboard.</p>
<a href="status.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="status.html">Test in iframe</button>
</div>
<div class="link-card">
<h3>Simple Status Test</h3>
<p>A simplified test page with no JavaScript.</p>
<a href="simple-status.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="simple-status.html">Test in iframe</button>
</div>
<div class="link-card">
<h3>Chart Test Page</h3>
<p>A page that tests Chart.js rendering.</p>
<a href="status-simple.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="status-simple.html">Test in iframe</button>
</div>
<div class="link-card">
<h3>API Test Page</h3>
<p>A page that tests API endpoints.</p>
<a href="api-test.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="api-test.html">Test in iframe</button>
</div>
<div class="link-card">
<h3>This Test Page</h3>
<p>The current page you're viewing.</p>
<a href="page-test.html" class="direct-link">Direct Link</a>
<button class="iframe-test" data-page="page-test.html">Test in iframe</button>
</div>
</div>
<iframe id="testFrame" class="test-frame" title="Test frame"></iframe>
<script>
document.querySelectorAll('.iframe-test').forEach(button => {
button.addEventListener('click', function() {
const pagePath = this.getAttribute('data-page');
const frame = document.getElementById('testFrame');
const message = document.getElementById('message');
// Show the frame
frame.style.display = 'block';
frame.src = pagePath;
// Listen for load or error
frame.onload = function() {
message.className = 'message success';
message.textContent = `Success! Page "${pagePath}" loaded correctly in the iframe.`;
message.style.display = 'block';
};
frame.onerror = function() {
message.className = 'message error';
message.textContent = `Error! Page "${pagePath}" failed to load in the iframe.`;
message.style.display = 'block';
};
});
});
</script>
</body>
</html>