Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cubesql-webadmin.xojo_project
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ WebContainer=cntLog;webapp/containers/information/cntLog.xojo_code;&h000000002B1
DefaultWindow=LoginPage
MajorVersion=0
MinorVersion=0
SubVersion=2
SubVersion=3
NonRelease=0
Release=0
InfoVersion=cubeSQL Web Admin
LongVersion=jo-tools.ch
ShortVersion=0.0.2
WinCompanyName=example.com
ShortVersion=0.0.3
WinCompanyName=jo-tools.ch
WinInternalName=cubesqlwebadmin
WinProductName=cubeSQL Web Admin
WinFileDescription=cubeSQL Web Admin
Expand Down
21 changes: 21 additions & 0 deletions webapp/containers/base/cntBase.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ Inherits WebContainer

#tag Method, Flags = &h0
Sub Search(SearchValue As String)
#Pragma unused SearchValue

End Sub
#tag EndMethod


#tag Property, Flags = &h0
Area As String = "Home"
#tag EndProperty

#tag Property, Flags = &h0
SearchAvailable As Boolean = False
#tag EndProperty
Expand Down Expand Up @@ -273,6 +278,22 @@ Inherits WebContainer
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Group="Behavior"
InitialValue="False"
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
15 changes: 14 additions & 1 deletion webapp/containers/base/cntDatasourceBase.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Implements WebDataSource
If cntrl IsA WebListBox Then WebListBox(cntrl).DataSource = Nil
Next

If (timRefresh <> Nil) Then
timRefresh.RunMode = WebTimer.RunModes.Off
timRefresh.Enabled = False
End If

Super.Close()

End Sub
Expand Down Expand Up @@ -39,7 +44,7 @@ Implements WebDataSource
timRefresh.Enabled = False
Me.AddControl(timRefresh)

AddHandler timRefresh.Run, AddressOf WebTimer_RowDataLoaded
AddHandler timRefresh.Run, WeakAddressOf WebTimer_RowDataLoaded

End Sub
#tag EndMethod
Expand Down Expand Up @@ -388,6 +393,14 @@ Implements WebDataSource


#tag ViewBehavior
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Expand Down
19 changes: 18 additions & 1 deletion webapp/containers/cntStatus.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ End
Sub Constructor()
Super.Constructor

me.Title = "Status"
Me.Area = "cubeSQL"
Me.Title = "Status"
End Sub
#tag EndMethod

Expand Down Expand Up @@ -240,6 +241,22 @@ End
#tag EndEvent
#tag EndEvents
#tag ViewBehavior
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Group="Behavior"
InitialValue="False"
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="_mPanelIndex"
Visible=false
Expand Down
40 changes: 34 additions & 6 deletions webapp/containers/information/cntClients.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ End
#tag WindowCode
#tag Event
Sub Opening()
Self.RefreshButtons()
Self.ShowInfos()

End Sub
Expand Down Expand Up @@ -203,6 +202,7 @@ End
Sub Constructor()
Super.Constructor

Me.Area = "Information"
Me.Title = "Clients"
Me.SearchAvailable = True

Expand Down Expand Up @@ -298,9 +298,11 @@ End
Private Function GetSelectedClientId(ByRef username As String) As Integer
username = ""
If (lstInfos.SelectedRowIndex < 0) Then Return -1
If (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then
username = Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("username", "").StringValue
Return Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("id", "").IntegerValue

Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
If (selectedRowTag IsA Dictionary) Then
username = Dictionary(selectedRowTag).Lookup("username", "").StringValue
Return Dictionary(selectedRowTag).Lookup("id", "").IntegerValue
End If

Return -1
Expand All @@ -317,8 +319,8 @@ End

If (clientId > 0) Then
bDisconnect = (clientId <> Session.ClientId)
bRefresh = True
End If
bRefresh = True

If (btnRefresh.Enabled <> bRefresh) Then btnRefresh.Enabled = bRefresh
If (btnDisconnect.Enabled <> bDisconnect) Then btnDisconnect.Enabled = bDisconnect
Expand Down Expand Up @@ -354,6 +356,8 @@ End

#tag Method, Flags = &h21
Private Sub ShowInfos()
Me.UpdateNoRowsMessage()

Me.LoadDatasource(Session.DB.SelectSQL("SHOW CONNECTIONS"))

If (lstInfos.DataSource = Nil) Then
Expand All @@ -365,11 +369,27 @@ End
End Sub
#tag EndMethod

#tag Method, Flags = &h21
Private Sub UpdateNoRowsMessage()
Var sInfo As String = "No Clients"

If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If

lstInfos.NoRowsMessage = sInfo

End Sub
#tag EndMethod

#tag Method, Flags = &h1
Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
Super.WebTimer_RowDataLoaded(obj)

If (eiSelectAfterReload <= 0) Then Return
If (eiSelectAfterReload <= 0) Then
Me.RefreshButtons()
Return
End If

Var iSelectAfterReload As Integer = eiSelectAfterReload
eiSelectAfterReload = -1
Expand Down Expand Up @@ -445,6 +465,14 @@ End
#tag EndEvent
#tag EndEvents
#tag ViewBehavior
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Expand Down
24 changes: 24 additions & 0 deletions webapp/containers/information/cntCommands.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ End
Sub Constructor()
Super.Constructor

Me.Area = "Information"
Me.Title = "Commands"
Me.SearchAvailable = True

Expand Down Expand Up @@ -125,6 +126,8 @@ End

#tag Method, Flags = &h21
Private Sub ShowInfos()
Me.UpdateNoRowsMessage()

Me.LoadDatasource(Session.DB.SelectSQL("SHOW COMMANDS"))

If (lstInfos.DataSource = Nil) Then
Expand All @@ -136,10 +139,31 @@ End
End Sub
#tag EndMethod

#tag Method, Flags = &h21
Private Sub UpdateNoRowsMessage()
Var sInfo As String = "No Commands"

If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If

lstInfos.NoRowsMessage = sInfo

End Sub
#tag EndMethod


#tag EndWindowCode

#tag ViewBehavior
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Expand Down
66 changes: 64 additions & 2 deletions webapp/containers/information/cntLog.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ Begin cntDatasourceBase cntLog
Width = 120
_mPanelIndex = -1
End
Begin WebTimer timRefresh
ControlID = ""
Enabled = False
Index = -2147483648
Location = 0
LockedInPosition= False
Period = 1
RunMode = 0
Scope = 2
TabIndex = 4
TabStop = True
_mPanelIndex = -1
End
End
#tag EndWebContainerControl

Expand All @@ -169,6 +182,7 @@ End
Sub Constructor()
Super.Constructor

Me.Area = "Information"
Me.Title = "Log"
Me.SearchAvailable = True

Expand Down Expand Up @@ -241,6 +255,19 @@ End
End Sub
#tag EndMethod

#tag Method, Flags = &h21
Private Sub RefreshSchedule(pbImmediately As Boolean)
'if already running, stop
timRefresh.RunMode = WebTimer.RunModes.Off
timRefresh.Enabled = False

timRefresh.Period = If(pbImmediately, 1, 800)
timRefresh.RunMode = WebTimer.RunModes.Single
timRefresh.Enabled = True

End Sub
#tag EndMethod

#tag Method, Flags = &h0
Sub Search(SearchValue As String)
Super.Search(SearchValue)
Expand All @@ -257,6 +284,8 @@ End
Return
End If

Me.UpdateNoRowsMessage()

Me.LoadDatasource(Session.DB.SelectSQL("SHOW LAST " + numLogEntries.ToString + " ROWS FROM Log ORDER DESC"))

If (lstInfos.DataSource = Nil) Then
Expand All @@ -268,6 +297,19 @@ End
End Sub
#tag EndMethod

#tag Method, Flags = &h21
Private Sub UpdateNoRowsMessage()
Var sInfo As String = "No Log entries"

If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If

lstInfos.NoRowsMessage = sInfo

End Sub
#tag EndMethod


#tag Constant, Name = constLogEntriesDefault, Type = String, Dynamic = False, Default = \"50", Scope = Private
#tag EndConstant
Expand All @@ -278,15 +320,16 @@ End
#tag Events btnRefresh
#tag Event
Sub Pressed()
Self.ShowInfos()
Self.RefreshSchedule(True)

End Sub
#tag EndEvent
#tag EndEvents
#tag Events edtLogNumberOfEntries
#tag Event
Sub TextChanged()
self.ShowInfos()
Self.RefreshSchedule(False)

End Sub
#tag EndEvent
#tag Event
Expand All @@ -298,7 +341,26 @@ End
End Sub
#tag EndEvent
#tag EndEvents
#tag Events timRefresh
#tag Event
Sub Run()
Me.RunMode = WebTimer.RunModes.Off
Me.Enabled = False

Self.ShowInfos()

End Sub
#tag EndEvent
#tag EndEvents
#tag ViewBehavior
#tag ViewProperty
Name="Area"
Visible=false
Group="Behavior"
InitialValue="Home"
Type="String"
EditorType="MultiLineEditor"
#tag EndViewProperty
#tag ViewProperty
Name="SearchAvailable"
Visible=false
Expand Down
Loading