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
16 changes: 16 additions & 0 deletions TableProMobile/TableProMobile/Views/ConnectedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ struct ConnectedView: View {
}
}
.animation(.default, value: isSwitching)
.overlay(alignment: .top) {
if isReconnecting {
HStack(spacing: 6) {
ProgressView()
.controlSize(.mini)
Text(String(localized: "Reconnecting..."))
.font(.caption)
}
.padding(.horizontal, 12)
.padding(.vertical, 6)
.background(.regularMaterial, in: Capsule())
.transition(.move(edge: .top).combined(with: .opacity))
.padding(.top, 4)
}
}
.animation(.default, value: isReconnecting)
}
}
.sensoryFeedback(.success, trigger: hapticSuccess)
Expand Down
2 changes: 2 additions & 0 deletions TableProMobile/TableProMobile/Views/ConnectionFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ struct ConnectionFormView: View {
Text(level.displayName).tag(level)
}
}
.pickerStyle(.menu)
}

if type == .sqlite {
Expand Down Expand Up @@ -379,6 +380,7 @@ struct ConnectionFormView: View {
Text("Password").tag(SSHConfiguration.SSHAuthMethod.password)
Text("Private Key").tag(SSHConfiguration.SSHAuthMethod.privateKey)
}
.pickerStyle(.segmented)
}

if sshAuthMethod == .password {
Expand Down
8 changes: 8 additions & 0 deletions TableProMobile/TableProMobile/Views/ConnectionListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ struct ConnectionListView: View {
ConnectionRow(connection: connection, tag: appState.tag(for: connection.tagId))
}
.hoverEffect()
.swipeActions(edge: .leading) {
Button {
editingConnection = connection
} label: {
Label("Edit", systemImage: "pencil")
}
.tint(.blue)
}
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
Button {
connectionToDelete = connection
Expand Down
2 changes: 1 addition & 1 deletion TableProMobile/TableProMobile/Views/DataBrowserView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ private struct RowCard: View {
ForEach(Array(detailPairs.enumerated()), id: \.offset) { _, pair in
HStack(spacing: 6) {
Text(pair.name)
.font(.caption2)
.font(.caption)
.foregroundStyle(.tertiary)
Text(verbatim: pair.value)
.font(.caption)
Expand Down
38 changes: 31 additions & 7 deletions TableProMobile/TableProMobile/Views/QueryEditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct QueryEditorView: View {
@State private var isExecuting = false
@State private var executionTime: TimeInterval?
@State private var executeTask: Task<Void, Never>?
@State private var executionStartTime: Date?
@Binding var queryHistory: [QueryHistoryItem]
let connectionId: UUID
let historyStorage: QueryHistoryStorage
Expand All @@ -31,6 +32,7 @@ struct QueryEditorView: View {
@State private var showWriteConfirmation = false
@State private var showWriteBlockedAlert = false
@State private var pendingWriteQuery = ""
@State private var showClearConfirmation = false
@State private var showShareSheet = false
@State private var shareText = ""
@State private var hapticSuccess = false
Expand Down Expand Up @@ -63,6 +65,20 @@ struct QueryEditorView: View {
ActivityViewController(items: [shareText])
}
.sheet(isPresented: $showHistory) { historySheet }
.confirmationDialog(
String(localized: "Clear Query"),
isPresented: $showClearConfirmation,
titleVisibility: .visible
) {
Button(String(localized: "Clear"), role: .destructive) {
query = ""
result = nil
appError = nil
executionTime = nil
}
} message: {
Text("Query text and results will be cleared.")
}
}

// MARK: - Editor
Expand All @@ -72,9 +88,16 @@ struct QueryEditorView: View {
SQLHighlightTextView(text: $query)
.frame(minHeight: 80, maxHeight: result != nil || appError != nil ? 120 : 250)

if executionTime != nil || result != nil {
if isExecuting || executionTime != nil || result != nil {
HStack {
if let time = executionTime {
if isExecuting, let startTime = executionStartTime {
TimelineView(.periodic(from: startTime, by: 0.1)) { context in
let elapsed = context.date.timeIntervalSince(startTime)
Label(String(format: "%.1fs", elapsed), systemImage: "clock")
.font(.caption2)
.foregroundStyle(.secondary)
}
} else if let time = executionTime {
Label(String(format: "%.1fms", time * 1000), systemImage: "clock")
.font(.caption2)
.foregroundStyle(.secondary)
Expand Down Expand Up @@ -290,10 +313,7 @@ struct QueryEditorView: View {
Divider()

Button(role: .destructive) {
query = ""
result = nil
appError = nil
executionTime = nil
showClearConfirmation = true
} label: {
Label("Clear", systemImage: "trash")
}
Expand Down Expand Up @@ -398,7 +418,11 @@ struct QueryEditorView: View {

UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
isExecuting = true
defer { isExecuting = false }
executionStartTime = Date()
defer {
isExecuting = false
executionStartTime = nil
}
appError = nil
result = nil

Expand Down
4 changes: 2 additions & 2 deletions TableProMobile/TableProMobile/Views/RowDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ struct RowDetailView: View {
} label: {
HStack(spacing: 4) {
Image(systemName: "arrow.right.circle.fill")
.font(.caption2)
.font(.footnote)
Text("\(fk.referencedTable).\(fk.referencedColumn)")
.font(.caption2)
.font(.footnote)
}
.foregroundStyle(.blue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct TagManagementView: View {

if tag.isPreset {
Image(systemName: "lock.fill")
.font(.caption2)
.font(.caption)
.foregroundStyle(.secondary)
}

Expand Down
Loading