Feat: Ajustes y Preparación Docker

This commit is contained in:
2025-11-20 12:39:23 -03:00
parent c94936d56e
commit 1e85b2ed86
11 changed files with 317 additions and 56 deletions

View File

@@ -0,0 +1,21 @@
# Dockerfile.admin
# ---- Etapa de Compilación (Build) ----
FROM node:24-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
# Definimos la URL de la API para el panel de admin
RUN VITE_API_BASE_URL=http://192.168.5.129:8080 npm run build
# ---- Etapa Final (Runtime) ----
FROM nginx:alpine AS final
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

15
chatbot-admin/nginx.conf Normal file
View File

@@ -0,0 +1,15 @@
# nginx.conf
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
# Si un archivo o directorio no existe, redirige al index.html
# Esto es esencial para que el enrutamiento del lado del cliente de React funcione.
try_files $uri $uri/ /index.html;
}
}

View File

@@ -41,7 +41,25 @@ const LogsViewer: React.FC<LogsViewerProps> = ({ onAuthError }) => {
field: 'fecha',
headerName: 'Fecha',
width: 200,
valueGetter: (value) => new Date(value).toLocaleString(),
valueGetter: (value) => {
// 1. Le decimos a JavaScript que la fecha que viene de la DB es UTC añadiendo una 'Z'.
const date = new Date(value + 'Z');
// 2. Definimos las opciones de formato.
const options: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
timeZone: 'America/Argentina/Buenos_Aires',
hour12: false,
};
// 3. Ahora la conversión será correcta.
return date.toLocaleString('es-AR', options);
},
},
{ field: 'usuarioMensaje', headerName: 'Mensaje del Usuario', flex: 1 },
{ field: 'botRespuesta', headerName: 'Respuesta del Bot', flex: 1 },