244 lines
9.2 KiB
Plaintext
244 lines
9.2 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="@ViewBag.Language">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>@(ViewBag.PageTitle ?? "Sentence Converter Module")</title>
|
|
|
|
<!-- Bootstrap CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<!-- Font Awesome -->
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
|
|
|
<style>
|
|
.hero-section {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 60px 0;
|
|
}
|
|
|
|
.test-section {
|
|
background-color: #f8f9fa;
|
|
padding: 40px 0;
|
|
}
|
|
|
|
.endpoint-card {
|
|
transition: transform 0.2s;
|
|
border: none;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.endpoint-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
|
|
}
|
|
|
|
.status-indicator {
|
|
width: 12px;
|
|
height: 12px;
|
|
border-radius: 50%;
|
|
display: inline-block;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.status-healthy {
|
|
background-color: #28a745;
|
|
}
|
|
|
|
.status-unhealthy {
|
|
background-color: #dc3545;
|
|
}
|
|
|
|
.status-unknown {
|
|
background-color: #6c757d;
|
|
}
|
|
|
|
.module-demo {
|
|
border: 2px dashed #dee2e6;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
background-color: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/">
|
|
<i class="fas fa-text-height me-2"></i>
|
|
Sentence Converter
|
|
</a>
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav me-auto">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/">Home</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="navbar-nav">
|
|
<div class="nav-item dropdown">
|
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
|
|
@(ViewBag.Language?.ToString().ToUpper() ?? "PT")
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" href="/?language=pt">Português</a></li>
|
|
<li><a class="dropdown-item" href="/?language=en">English</a></li>
|
|
<li><a class="dropdown-item" href="/?language=es">Español</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<span class="navbar-text ms-3">
|
|
<span class="status-indicator" id="health-indicator"></span>
|
|
<span id="health-text">Verificando...</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main>
|
|
@RenderBody()
|
|
</main>
|
|
|
|
<footer class="bg-dark text-light py-4 mt-5">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6>Sentence Converter Module</h6>
|
|
<p class="mb-0">Módulo standalone para conversão de texto</p>
|
|
</div>
|
|
<div class="col-md-6 text-md-end">
|
|
<small class="text-muted">Versão: 1.0.0 | Port: @Context.Request.Host.Port</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- SUBSTITUIR a seção de scripts por: -->
|
|
<!-- Bootstrap JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<!-- Module Loader Lite para testes standalone -->
|
|
<script src="~/js/module-loader-lite.js"></script>
|
|
|
|
<!-- Sistema de carregamento para ambiente de teste -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
console.log('🚀 ModuleLoaderLite v1.0.0 inicializado para testes');
|
|
});
|
|
|
|
// Event listener para módulos carregados localmente
|
|
document.addEventListener('moduleLoadedLocal', function (event) {
|
|
console.log('✅ Módulo local carregado:', event.detail);
|
|
|
|
// Mostrar feedback visual
|
|
showModuleLoadedFeedback(event.detail);
|
|
});
|
|
|
|
function showModuleLoadedFeedback(detail) {
|
|
const toast = document.createElement('div');
|
|
toast.className = 'toast position-fixed top-0 end-0 m-3';
|
|
toast.style.zIndex = '9999';
|
|
toast.innerHTML = `
|
|
<div class="toast-header bg-success text-white">
|
|
<i class="fas fa-check-circle me-2"></i>
|
|
<strong class="me-auto">Módulo Carregado</strong>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="toast"></button>
|
|
</div>
|
|
<div class="toast-body">
|
|
<strong>${detail.moduleId}</strong> inicializado com sucesso!<br>
|
|
<small class="text-muted">Modo: ${detail.mode}</small>
|
|
</div>
|
|
`;
|
|
|
|
document.body.appendChild(toast);
|
|
|
|
const bsToast = new bootstrap.Toast(toast);
|
|
bsToast.show();
|
|
|
|
// Remove o toast após ser ocultado
|
|
toast.addEventListener('hidden.bs.toast', () => {
|
|
document.body.removeChild(toast);
|
|
});
|
|
}
|
|
|
|
// Função global para carregar módulos em testes
|
|
window.loadTestModule = async function (containerId, endpoint) {
|
|
console.log(`🧪 Carregando módulo de teste: ${endpoint} -> ${containerId}`);
|
|
|
|
const container = document.getElementById(containerId);
|
|
if (container) {
|
|
// Mostrar loading
|
|
container.innerHTML = `
|
|
<div class="text-center py-4">
|
|
<div class="spinner-border text-primary" role="status">
|
|
<span class="visually-hidden">Carregando...</span>
|
|
</div>
|
|
<p class="mt-3">Carregando módulo de teste...</p>
|
|
<small class="text-muted">Endpoint: ${endpoint}</small>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
try {
|
|
const success = await window.ModuleLoaderLite.loadModule(containerId, endpoint);
|
|
if (!success) {
|
|
throw new Error('Falha ao inicializar módulo');
|
|
}
|
|
return true;
|
|
} catch (error) {
|
|
console.error('❌ Erro ao carregar módulo de teste:', error);
|
|
if (container) {
|
|
container.innerHTML = `
|
|
<div class="alert alert-danger">
|
|
<h6><i class="fas fa-exclamation-triangle me-2"></i>Erro ao Carregar Módulo</h6>
|
|
<p class="mb-2"><strong>Endpoint:</strong> ${endpoint}</p>
|
|
<p class="mb-2"><strong>Erro:</strong> ${error.message}</p>
|
|
<button class="btn btn-sm btn-outline-danger" onclick="loadTestModule('${containerId}', '${endpoint}')">
|
|
<i class="fas fa-redo me-1"></i> Tentar Novamente
|
|
</button>
|
|
</div>
|
|
`;
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<!-- Health Check Script (manter existente) -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
checkHealth();
|
|
setInterval(checkHealth, 30000);
|
|
});
|
|
|
|
async function checkHealth() {
|
|
const indicator = document.getElementById('health-indicator');
|
|
const text = document.getElementById('health-text');
|
|
|
|
try {
|
|
const response = await fetch('/home/healthcheck');
|
|
const data = await response.json();
|
|
|
|
if (data.status === 'healthy') {
|
|
indicator.className = 'status-indicator status-healthy';
|
|
text.textContent = 'Online';
|
|
} else {
|
|
indicator.className = 'status-indicator status-unhealthy';
|
|
text.textContent = 'Erro';
|
|
}
|
|
} catch (error) {
|
|
indicator.className = 'status-indicator status-unknown';
|
|
text.textContent = 'Offline';
|
|
}
|
|
}
|
|
</script>
|
|
|
|
@await RenderSectionAsync("Scripts", required: false)
|
|
</body>
|
|
</html> |