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
2 changes: 2 additions & 0 deletions cubesql-webadmin.xojo_project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ OrigIDEVersion=20240100
Folder=resources;resources;&h0000000035B107FF;&h0000000000000000;false
Folder=styles;styles;&h00000000139DBFFF;&h0000000000000000;false
Class=CheckboxCellRenderer;styles/CheckboxCellRenderer.xojo_code;&h000000007F7FF7FF;&h00000000139DBFFF;false
Class=CopyContentCellRenderer;styles/CopyContentCellRenderer.xojo_code;&h00000000730747FF;&h00000000139DBFFF;false
Folder=webapp;webapp;&h0000000018D38FFF;&h0000000000000000;false
Folder=main;webapp/main;&h000000001D9447FF;&h0000000018D38FFF;false
WebView=LoginPage;webapp/main/LoginPage.xojo_code;&h000000005492FFFF;&h000000001D9447FF;false
Expand Down Expand Up @@ -51,6 +52,7 @@ Module=modCubeSQLAdmin;webapp/modCubeSQLAdmin.xojo_code;&h00000000097C9FFF;&h000
MultiImage=icon_128;resources/icon_128.xojo_image;&h000000007294E7FF;&h0000000035B107FF;false
BuildSteps=Build Automation;Build Automation.xojo_code;&h000000001394FFFF;&h0000000000000000;false
ColorAsset=colTextKey;styles/colTextKey.xojo_color;&h000000005870AFFF;&h00000000139DBFFF;false
ColorAsset=colWebListBoxSelectedRow;styles/colWebListBoxSelectedRow.xojo_color;&h0000000015B10FFF;&h00000000139DBFFF;false
Module=modWebStyles;styles/modWebStyles.xojo_code;&h0000000002BE7FFF;&h00000000139DBFFF;false
WebContainer=cntRegistration;webapp/containers/server/cntRegistration.xojo_code;&h000000002FA707FF;&h0000000045A527FF;false
WebContainer=cntConsole;webapp/containers/server/cntConsole.xojo_code;&h000000004BD2DFFF;&h0000000045A527FF;false
Expand Down
2 changes: 1 addition & 1 deletion styles/CheckboxCellRenderer.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Inherits WebListboxCellRenderer
code.Add " render(controlID, row, data, rowIndex, columnIndex, cell) {"

// Remove the text that's already in the cell
code.Add " cell.innerText = '';"
code.Add " cell.innerHTML = '';"

// Make a bootstrap checkbox
Expand Down Expand Up @@ -61,7 +62,6 @@ Inherits WebListboxCellRenderer

Return String.FromArray(code, EndOfLine.Windows)


End Function
#tag EndEvent

Expand Down
134 changes: 134 additions & 0 deletions styles/CopyContentCellRenderer.xojo_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#tag Class
Protected Class CopyContentCellRenderer
Inherits WebListBoxCellRenderer
#tag Event
Sub Deserialize(js As JSONItem)
CopyContent = js.Lookup("copycontent", "")

End Sub
#tag EndEvent

#tag Event
Function JavascriptClassCode(s As WebSession) As String
#Pragma unused s

Var code() As String

// All custom cells extend the XojoWeb.ListboxCellRenderer class
code.Add "class TextWithCopyButtonCell extends XojoWeb.ListboxCellRenderer {"

// You must override the "render" method
// controlID (string): The identifier of the listbox control that the renderer is currently running under
// row (HTMLElement): The HTML DOM element of the entire row. This is provided so that you can make modifications to the entire row if necessary, like applying a style.
// data (object): The data that the Xojo portion of your control provided for this column
// rowIndex (number): The row number that is currently being rendered
// columnIndex (number): The column number that is currently being rendered
// cell (HTMLElement): The HTML DOM element of the cell that your renderer is responsible for.
code.Add " render(controlID, row, data, rowIndex, columnIndex, cell) {"

// Remove the text that's already in the cell
code.Add " cell.innerText = '';"
code.Add " cell.innerHTML = '';"

// Make a Container for both Text and Copy Button
code.Add " let container = document.createElement('div');"
code.Add " container.style = 'display: flex;';"

// Div for Text
code.Add " let textContainer = document.createElement('div');"
code.Add " textContainer.innerText = data.copycontent;"
code.Add " textContainer.style = 'white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 5px;';"

// Make a bootstrap Button
code.Add " let button = document.createElement('button');"
code.Add " button.className = 'btn btn-outline-secondary btn-sm';"
code.Add " button.innerText = 'Copy';"
code.Add " button.style= 'float: right; margin-left: auto;';"

// Handle clicking on the button
code.Add " button.addEventListener('click', function(ev) {"
code.Add " ev.stopPropagation();"
code.Add " navigator.clipboard.writeText(data.copycontent);"
code.Add " return false;"
code.Add " });"

// Add our new content
code.Add " container.appendChild(textContainer);"
code.Add " container.appendChild(button);"
code.Add " cell.appendChild(container);"
code.Add " }"
code.Add "}"

Return String.FromArray(code, EndOfLine.Windows)

End Function
#tag EndEvent

#tag Event
Function Serialize() As JSONItem
Var result As New JSONItem
result.Value("copycontent") = CopyContent
Return result
End Function
#tag EndEvent


#tag Method, Flags = &h0
Sub Constructor(Content As String)
// Calling the overridden superclass constructor.
Super.Constructor

Me.CopyContent = Content.Trim
End Sub
#tag EndMethod


#tag Property, Flags = &h21
Private CopyContent As String
#tag EndProperty


#tag ViewBehavior
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
8 changes: 8 additions & 0 deletions styles/colWebListBoxSelectedRow.xojo_color
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#tag ColorGroup
CodeName=colWebListBoxSelectedRow
#tag Color
Type=0
Platform=3
Light=004B9619
#tag EndColor
#tag EndColorGroup
2 changes: 1 addition & 1 deletion webapp/containers/cntStatus.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Begin cntBase cntStatus
RowSelectionType= 0
Scope = 2
SearchCriteria = ""
SelectedRowColor= &c0d6efd
SelectedRowColor= colWebListBoxSelectedRow
SelectedRowIndex= 0
TabIndex = 0
TabStop = True
Expand Down
29 changes: 24 additions & 5 deletions webapp/containers/data/cntBackups.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Begin cntDatasourceBase cntBackups
RowSelectionType= 1
Scope = 2
SearchCriteria = ""
SelectedRowColor= &c0d6efd
SelectedRowColor= colWebListBoxSelectedRow
SelectedRowIndex= 0
TabIndex = 0
TabStop = True
Expand Down Expand Up @@ -434,6 +434,25 @@ Begin cntDatasourceBase cntBackups
Scope = 2
_mPanelIndex = -1
End
Begin WebMessageDialog dlgMessage
ControlID = ""
Enabled = True
Explanation = ""
Index = -2147483648
Indicator = ""
LockBottom = False
LockedInPosition= True
LockHorizontal = False
LockLeft = True
LockRight = False
LockTop = True
LockVertical = False
Message = ""
Scope = 2
Title = ""
Tooltip = ""
_mPanelIndex = -1
End
End
#tag EndWebContainerControl

Expand Down Expand Up @@ -942,7 +961,7 @@ End
End If

If update.HasKey("Error") Then
ShowErrorDialog("Backup Database", "Could not backup database.", update.Lookup("Error", "").StringValue)
ShowErrorDialog(dlgMessage, "Backup Database", "Could not backup database.", update.Lookup("Error", "").StringValue)
End If

Next
Expand Down Expand Up @@ -989,7 +1008,7 @@ End
End If

If update.HasKey("Error") Then
ShowErrorDialog("Delete Backup", "Could not delete backup.", update.Lookup("Error", "").StringValue)
ShowErrorDialog(dlgMessage, "Delete Backup", "Could not delete backup.", update.Lookup("Error", "").StringValue)
End If

Next
Expand Down Expand Up @@ -1036,7 +1055,7 @@ End
End If

If update.HasKey("Error") Then
ShowErrorDialog("Restore Backup", "Could not restore backup.", update.Lookup("Error", "").StringValue)
ShowErrorDialog(dlgMessage, "Restore Backup", "Could not restore backup.", update.Lookup("Error", "").StringValue)
End If

Next
Expand Down Expand Up @@ -1152,7 +1171,7 @@ End
End If

If update.HasKey("Error") Then
ShowErrorDialog("Download Backup", "Could not download backup.", update.Lookup("Error", "").StringValue)
ShowErrorDialog(dlgMessage, "Download Backup", "Could not download backup.", update.Lookup("Error", "").StringValue)
End If

Next
Expand Down
Loading