Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
Pruebas-RTO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 1594f9a6
authored
2024-07-26 14:51:52 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Taller 247 se agrega historico
1 parent
a7a8bd2c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
275 additions
and
0 deletions
configuracion.py
grep.sh
main.py
protected_static/buscador.js
templates/buscador.html
templates/historico.html
configuracion.py
View file @
1594f9a
#Taller: (247) Interfor S.R.L.
carpetaDescargas
=
"/home/taller_4/Descargas/"
carpetaDescargas
=
"/home/taller_4/Descargas/"
cabezaeraDescargas
=
"Planilla_Diaria-"
cabezaeraDescargas
=
"Planilla_Diaria-"
grepfile
=
"/home/taller_4/Pruebas-RTO/grep.sh"
grepfile
=
"/home/taller_4/Pruebas-RTO/grep.sh"
...
...
grep.sh
View file @
1594f9a
#!/bin/bash
#!/bin/bash
ls /home/juan/Descargas/ -ls | grep Planilla_Diaria-247 | grep xls | grep -v crdownload &> /dev/shm/tmpscdecas_1.txt
ls /home/juan/Descargas/ -ls | grep Planilla_Diaria-247 | grep xls | grep -v crdownload &> /dev/shm/tmpscdecas_1.txt
main.py
View file @
1594f9a
...
@@ -71,6 +71,18 @@ def historico():
...
@@ -71,6 +71,18 @@ def historico():
bypass
=
False
bypass
=
False
)
)
@app.route
(
'/buscador'
)
def
buscador
():
if
"login"
not
in
request
.
cookies
:
return
redirect
(
url_for
(
"login"
))
return
render_template
(
"buscador.html"
,
bypass
=
False
)
@app.route
(
'/login'
,
methods
=
[
'GET'
,
'POST'
])
@app.route
(
'/login'
,
methods
=
[
'GET'
,
'POST'
])
def
login
():
def
login
():
if
request
.
method
==
"GET"
:
if
request
.
method
==
"GET"
:
...
@@ -79,6 +91,27 @@ def login():
...
@@ -79,6 +91,27 @@ def login():
)
)
else
:
else
:
try
:
try
:
user
=
request
.
json
[
'usuario'
]
pasw
=
request
.
json
[
'contrasena'
]
print
(
user
,
pasw
,
pruebas
.
login
)
if
pruebas
.
login
[
user
]
!=
pasw
:
raise
MyCustomException
(
"Ocurrió un error personalizado."
)
#
print
(
"Login user desarrollo"
)
response
=
make_response
(
redirect
(
url_for
(
'historico'
)))
#response = make_response('', 200)
response
.
headers
[
'Location'
]
=
"historico"
response
.
set_cookie
(
"login"
,
user
,
60
*
60
*
8
,
httponly
=
True
)
return
response
# Login rapido para desarrollo
except
Exception
as
E
:
print
(
f
"No se encontro usuariodesarrollo {E}"
)
try
:
#raise()
s
=
SI
(
SI
.
Chrome
)
s
=
SI
(
SI
.
Chrome
)
r
=
make_response
(
r
=
make_response
(
json
.
dumps
(
json
.
dumps
(
...
@@ -106,6 +139,7 @@ def login():
...
@@ -106,6 +139,7 @@ def login():
TratarCerrarNabegador
(
s
)
TratarCerrarNabegador
(
s
)
return
f
"Error en el login {str(E)}"
return
f
"Error en el login {str(E)}"
def
TratarCerrarNabegador
(
s
):
def
TratarCerrarNabegador
(
s
):
try
:
try
:
s
.
driver
.
quit
()
s
.
driver
.
quit
()
...
...
protected_static/buscador.js
0 → 100644
View file @
1594f9a
const
idCentGlobal
=
'247'
;
///Declaracion de taller
const
chatUrl
=
'https://api.hgt.com.ar/poll/rto_'
+
idCentGlobal
+
'_update/dewfrfgbeolkgkteprlk,hptrlk,hqff'
;
let
pendingRequests
=
0
;
function
CargarLista
()
{
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/diaria"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
idCentGlobal
}
};
fetch
(
'https://api.hgt.com.ar/redirect'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
requestData
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
createHistoricoList
(
data
);
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
});
};
// Function to create the list items
function
createHistoricoList
(
data
)
{
const
historicoDiv
=
document
.
getElementById
(
'div_historico'
);
historicoDiv
.
innerHTML
=
""
;
//historicoDiv.innerText = "Dominios del dia"
data
.
inspecciones
.
forEach
(
inspeccion
=>
{
const
button
=
document
.
createElement
(
'button'
);
button
.
className
=
'PDFButton'
;
button
.
id
=
inspeccion
.
name
;
button
.
textContent
=
'Ir dominio '
;
const
div
=
document
.
createElement
(
'div'
);
//div.textContent = inspeccion.name + " " + inspeccion.resultado + " " + inspeccion.fecha + " ";
const
titulo
=
document
.
createElement
(
'H4'
);
titulo
.
textContent
=
inspeccion
.
name
+
" "
+
inspeccion
.
resultado
;
const
ftl
=
document
.
createElement
(
'H6'
);
ftl
.
textContent
=
"Linea "
+
inspeccion
.
linea
+
", Planilla "
+
inspeccion
.
numeroplanilla
+
", Categoria "
+
inspeccion
.
categoria
;
div
.
appendChild
(
titulo
);
div
.
appendChild
(
ftl
);
div
.
appendChild
(
button
);
const
separador
=
document
.
createElement
(
'hr'
)
separador
.
className
=
'custom-hr'
;
historicoDiv
.
appendChild
(
div
);
historicoDiv
.
appendChild
(
separador
);
});
}
async
function
fetchChat
()
{
const
MensajeDiv
=
document
.
getElementById
(
'DivMensajeFijo'
);
const
MensajeCaida
=
"Se perdio contacto con el server, revise conexcion a internet"
//MensajeDiv.innerText = "Escuchando novedades"
while
(
true
)
{
try
{
const
response
=
await
fetch
(
chatUrl
);
const
data
=
await
response
.
json
();
if
(
data
.
proccess
===
true
)
{
//CargarLista();
MensajeDiv
.
innerText
=
"Lista Actualizada al "
+
data
.
tiempo
}
if
(
MensajeDiv
.
innerText
==
MensajeCaida
)
{
MensajeDiv
.
innerText
=
"Se recupero conixion al server, Esperando novedades, o recarge la pagina"
}
}
catch
(
error
)
{
MensajeDiv
.
innerText
=
MensajeCaida
;
// Si ocurre un error, esperamos 5 segundos antes de volver a intentarlo
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
5000
));
}
}
}
function
BuscarLista
(
fecha
,
dominio
)
{
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/buscador"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
idCentGlobal
,
//"id_cent": "61",
"fecha"
:
fecha
,
"dominio"
:
dominio
}
};
fetch
(
'https://api.hgt.com.ar/redirect'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
requestData
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
createHistoricoList
(
data
);
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
});
};
async
function
IniciarInterfaceBusqueda
()
{
const
searchForm
=
document
.
getElementById
(
'searchForm'
);
searchForm
.
addEventListener
(
'submit'
,
function
(
event
)
{
event
.
preventDefault
();
// Prevent the form from submitting normally
//console.log("Presionando boton busqueda")
const
fecha
=
document
.
getElementById
(
'date_input'
).
value
;
const
dominio
=
document
.
getElementById
(
'domain_input'
).
value
;
if
(
fecha
===
""
&&
dominio
===
""
)
{
alert
(
"Carge los parametros de busqueda"
);
return
;
// Stop further execution if validation fails
}
else
{
BuscarLista
(
fecha
,
dominio
);
}
})
}
////////////INICIO ACTIVIDAD
window
.
addEventListener
(
'load'
,
()
=>
{
//CargarLista();
//fetchChat();
IniciarInterfaceBusqueda
();
});
\ No newline at end of file
\ No newline at end of file
templates/buscador.html
0 → 100755
View file @
1594f9a
<html
lang=
"es"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename = 'styles/general.css') }}"
>
<script
src=
"/protected_static/buscador.js"
></script>
<!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>
Pruebas de Alineamiento
</title>
<style>
.custom-hr
{
border
:
none
;
border-top
:
1px
solid
#000
;
/* Personaliza el color y grosor aquí */
width
:
66.67%
;
/* Dos tercios del ancho de la página */
margin
:
20px
0
;
/* Ajusta el espacio alrededor de la línea aquí */
margin-left
:
0
;
/* Alinea la línea al inicio (izquierda) */
}
</style>
</head>
<body>
<div
>
<!--
<div class="MessageFixed" id="DivMensajeFijo">
</div>
-->
<div
class=
"DataCard"
>
<form
id=
"searchForm"
>
<div>
<label
for=
"date_input"
>
Fecha:
</label>
<input
type=
"date"
id=
"date_input"
name=
"date_input"
>
</div>
<div>
<label
for=
"domain_input"
>
Dominio:
</label>
<input
type=
"text"
id=
"domain_input"
name=
"domain_input"
>
</div>
<button
class=
"PDFButton"
type=
"submit"
id=
"id_boton_busqueda"
>
Buscar
</button>
</form>
<hr
class=
"custom-hr"
>
Resultados de la busqueda
<br>
<div
id=
"div_historico"
>
<hr
class=
"custom-hr"
>
Sin resultados
<hr
class=
"custom-hr"
>
</div>
</div>
<div
class=
"PDFButtonContainerFixed"
>
<h3>
Buscador
</h3>
<button
class=
"PDFButton"
onclick=
"location.href='/historico'"
>
Historico
</button>
<button
class=
"PDFButton"
onclick=
"location.href='/'"
>
Carga
</button>
</div>
</div>
<div
id=
"message"
class=
"MessageContainer"
onclick=
"this.style.display = 'none'"
style=
"display: none;"
>
<div
class=
"Message"
style=
"text-align: center;"
>
<p
id =
"msg"
></p>
<span
class =
"X"
>
x
<span>
</div>
</div>
</body>
</html>
\ No newline at end of file
\ No newline at end of file
templates/historico.html
View file @
1594f9a
...
@@ -37,6 +37,10 @@
...
@@ -37,6 +37,10 @@
<h3>
Dominios del dia
</h3>
<h3>
Dominios del dia
</h3>
<button
class=
"PDFButton"
onclick=
"location.href='/buscador'"
>
Buscador
</button>
<button
class=
"PDFButton"
onclick=
"location.href='/'"
>
<button
class=
"PDFButton"
onclick=
"location.href='/'"
>
Carga
Carga
</button>
</button>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment