mirror of
https://github.com/KeymonSoft/Monitor-Keymon.git
synced 2026-04-19 05:39:32 +00:00
4/11/23 - Guardamos los errores en base de datos.
- Falta guardar los pings con exito.
This commit is contained in:
@@ -174,7 +174,6 @@ Private Sub lv_server_ItemClick (Position As Int, Value As Object)
|
|||||||
ToastMessageShow($"Servidor modificado"$, False)
|
ToastMessageShow($"Servidor modificado"$, False)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Private Sub clv_server_ItemClick (Index As Int, Value As Object)
|
Private Sub clv_server_ItemClick (Index As Int, Value As Object)
|
||||||
If logger Then Log(Value)
|
If logger Then Log(Value)
|
||||||
et_server.Text = Value
|
et_server.Text = Value
|
||||||
@@ -221,10 +220,7 @@ Private Sub b_ping_Click
|
|||||||
b_ping.Background = cd1
|
b_ping.Background = cd1
|
||||||
b_ping.Text = "Buscando ..."
|
b_ping.Text = "Buscando ..."
|
||||||
CallSubDelayed(Monitor, "Timer1_Tick")
|
CallSubDelayed(Monitor, "Timer1_Tick")
|
||||||
|
|
||||||
CallSubDelayed(Monitor, "probamosConexion")
|
CallSubDelayed(Monitor, "probamosConexion")
|
||||||
|
|
||||||
|
|
||||||
' Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 2", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
' Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 2", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||||
' If Success Then
|
' If Success Then
|
||||||
' Log("ExitValue:" & ExitValue)
|
' Log("ExitValue:" & ExitValue)
|
||||||
@@ -261,7 +257,6 @@ Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel 'ignore
|
|||||||
Return p
|
Return p
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Private Sub l_info_Click
|
Private Sub l_info_Click
|
||||||
l_info.Visible = False
|
l_info.Visible = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ ModuleBreakpoints5=
|
|||||||
ModuleBreakpoints6=
|
ModuleBreakpoints6=
|
||||||
ModuleBreakpoints7=
|
ModuleBreakpoints7=
|
||||||
ModuleClosedNodes0=
|
ModuleClosedNodes0=
|
||||||
ModuleClosedNodes1=
|
ModuleClosedNodes1=7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
|
||||||
ModuleClosedNodes2=
|
ModuleClosedNodes2=
|
||||||
ModuleClosedNodes3=
|
ModuleClosedNodes3=
|
||||||
ModuleClosedNodes4=
|
ModuleClosedNodes4=
|
||||||
ModuleClosedNodes5=
|
ModuleClosedNodes5=5
|
||||||
ModuleClosedNodes6=
|
ModuleClosedNodes6=
|
||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
NavigationStack=C_Subs,ping,461,6,B4XMainPage,Class_Globals,55,0,B4XMainPage,CreateListItem,255,0,B4XMainPage,l_db_Click,262,0,B4XMainPage,l_internet_Click,270,0,B4XMainPage,l_conexion_Click,274,0,B4XMainPage,l_info_Click,258,4,B4XMainPage,p_Main_Click,278,0,Visual Designer,login.bal,-100,6,B4XMainPage,B4XPage_Created,80,4
|
NavigationStack=Visual Designer,login.bal,-100,6,B4XMainPage,B4XPage_Created,80,4,B4XMainPage,lv_server_ItemClick,169,0,B4XMainPage,b_ping_Click,211,0,B4XMainPage,CreateListItem,251,0,Monitor,probamosConexion,86,0,C_Subs,Class_Globals,0,0,Monitor,reinicializaReqManager,102,0,C_Subs,fechaKMT,42,0,Monitor,JobDone,143,6
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=1,7,3,5,6,4
|
VisibleModules=1,7,3,5,6,4
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ Sub Service_Start (StartingIntent As Intent)
|
|||||||
s.Initialize
|
s.Initialize
|
||||||
skmt = s.inicializaBD(File.DirInternal, "kmt.db")
|
skmt = s.inicializaBD(File.DirInternal, "kmt.db")
|
||||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS cat_variables(nombre TEXT, valor text)")
|
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS cat_variables(nombre TEXT, valor text)")
|
||||||
|
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS error_log(error TEXT, fecha text)")
|
||||||
If s.traeDBReqServerDeBD <> "N/A" Then DBReqServer = s.traeDBReqServerDeBD
|
If s.traeDBReqServerDeBD <> "N/A" Then DBReqServer = s.traeDBReqServerDeBD
|
||||||
' reqManager.Initialize(Me, DBReqServer)
|
' reqManager.Initialize(Me, DBReqServer)
|
||||||
StartService(Monitor)
|
StartService(Monitor)
|
||||||
|
|||||||
@@ -113,12 +113,13 @@ Sub JobDone(Job As HttpJob)
|
|||||||
' Log(Job)
|
' Log(Job)
|
||||||
If Job.Success = False Then
|
If Job.Success = False Then
|
||||||
If Job.JobName = "DBRequest" Then DBReqServerOk = False
|
If Job.JobName = "DBRequest" Then DBReqServerOk = False
|
||||||
|
|
||||||
Dim cd1 As ColorDrawable
|
Dim cd1 As ColorDrawable
|
||||||
cd1.Initialize(Colors.Red, 10dip)
|
cd1.Initialize(Colors.Red, 10dip)
|
||||||
If B4XPages.IsInitialized Then B4XPages.MainPage.b_ping.Background = cd1
|
If B4XPages.IsInitialized Then B4XPages.MainPage.b_ping.Background = cd1
|
||||||
If B4XPages.IsInitialized Then B4XPages.MainPage.b_ping.Text = "DBReqServer KO"
|
If B4XPages.IsInitialized Then B4XPages.MainPage.b_ping.Text = "DBReqServer KO"
|
||||||
s.notiHigh("ERROR ❌", $"El servidor ${Starter.DBReqServer} NO responde!!"$, nid, Main)
|
s.notiHigh("ERROR ❌", $"El servidor ${Starter.DBReqServer} NO responde!!"$, nid, Main)
|
||||||
|
Log("Guardamos error en BD")
|
||||||
|
Starter.skmt.ExecNonQuery($"insert into error_log(error, fecha) values ('El servidor ${Starter.DBReqServer} NO responde!!', '${s.fechaKMT(DateTime.Now)}')"$)
|
||||||
If Job.ErrorMessage.Contains("failed to connect") Or Job.ErrorMessage.Contains("Failed to connect") Then
|
If Job.ErrorMessage.Contains("failed to connect") Or Job.ErrorMessage.Contains("Failed to connect") Then
|
||||||
' ToastMessageShow("¡Hubo un error contactando al servidor, por favor revise su conexión!", True)
|
' ToastMessageShow("¡Hubo un error contactando al servidor, por favor revise su conexión!", True)
|
||||||
End If
|
End If
|
||||||
@@ -128,6 +129,7 @@ Sub JobDone(Job As HttpJob)
|
|||||||
If Job.JobName = "DBRequest" Then
|
If Job.JobName = "DBRequest" Then
|
||||||
Dim resultado As DBResult = reqManager.HandleJob(Job)
|
Dim resultado As DBResult = reqManager.HandleJob(Job)
|
||||||
If resultado.Tag = "select_conexion" Then
|
If resultado.Tag = "select_conexion" Then
|
||||||
|
Log("select_conexion")
|
||||||
For Each records() As Object In resultado.Rows
|
For Each records() As Object In resultado.Rows
|
||||||
Private valor As String = records(resultado.Columns.Get("VALOR"))
|
Private valor As String = records(resultado.Columns.Get("VALOR"))
|
||||||
If valor = "OK" Then
|
If valor = "OK" Then
|
||||||
@@ -144,6 +146,8 @@ Sub JobDone(Job As HttpJob)
|
|||||||
s.notiHigh("ERROR ❌", $"El servidor NO esta respondiendo!!"$, nid, Main)
|
s.notiHigh("ERROR ❌", $"El servidor NO esta respondiendo!!"$, nid, Main)
|
||||||
If B4XPages.IsInitialized Then
|
If B4XPages.IsInitialized Then
|
||||||
B4XPages.MainPage.l_status.Text = "El servidor NO esta respondiendo!!"
|
B4XPages.MainPage.l_status.Text = "El servidor NO esta respondiendo!!"
|
||||||
|
Log("Guardamos error en BD")
|
||||||
|
Starter.skmt.ExecNonQuery($"insert into error_log(error, fecha) values ('La BD NO esta respondiendo!!', '${s.fechaKMT(DateTime.Now)}')"$)
|
||||||
Dim cd1 As ColorDrawable
|
Dim cd1 As ColorDrawable
|
||||||
cd1.Initialize(Colors.Red, 10dip)
|
cd1.Initialize(Colors.Red, 10dip)
|
||||||
B4XPages.MainPage.b_ping.Background = cd1
|
B4XPages.MainPage.b_ping.Background = cd1
|
||||||
|
|||||||
Reference in New Issue
Block a user