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: 2 additions & 4 deletions apple/TablePro/Core/Events/AppEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ final class AppEvents {
/// uniformly handle "this update may affect me" via `payload == nil || payload == self.connectionId`.
let linkedSQLFoldersDidUpdate = PassthroughSubject<UUID?, Never>()

let versionHistoryRefreshRequested = PassthroughSubject<UUID, Never>()

/// Refresh on a table listing tab, which loads its own rows rather than through the coordinator.
let tableListingRefreshRequested = PassthroughSubject<UUID, Never>()
// Refresh on a tab that loads its own content rather than through the coordinator, by tab id.
let tabRefreshRequested = PassthroughSubject<UUID, Never>()

// MARK: - License & Sync

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private extension TabType {
case .erDiagram: "erDiagram"
case .serverDashboard: "serverDashboard"
case .insights: "insights"
case .tableHealth: "tableHealth"
case .usersRoles: "usersRoles"
case .objectSource: "objectSource"
case .versionHistory: "versionHistory"
Expand Down
4 changes: 4 additions & 0 deletions apple/TablePro/Core/Menu/DatabaseMenuBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ enum DatabaseMenuBuilder {
String(localized: "Query Insights"),
action: #selector(MainSplitViewController.showQueryInsights(_:))
),
MenuItemFactory.item(
String(localized: "Table Health"),
action: #selector(MainSplitViewController.showTableHealth(_:))
),
MenuItemFactory.separator,
/// No ellipsis: the HIG reserves one for an action that needs more information before
/// it can complete, and this needs none. It validates to disabled for every connection
Expand Down
1 change: 1 addition & 0 deletions apple/TablePro/Core/Scripting/ScriptEnumerations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal enum ScriptEnumerations {
case .serverDashboard: fourCharCode("TPk5")
case .usersRoles: fourCharCode("TPk6")
case .insights: fourCharCode("TPk7")
case .tableHealth: fourCharCode("TPkx")
case .objectSource: fourCharCode("TPk8")
case .versionHistory: fourCharCode("TPk9")
case .tableListing: fourCharCode("TPkl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ internal enum EditorTabOpener {
databaseName: payload.databaseName ?? openingDatabaseName,
schemaName: payload.schemaName
)
case .serverDashboard:
tabManager.addServerDashboardTab()
case .usersRoles:
tabManager.addUsersRolesTab()
case .insights:
tabManager.addQueryInsightsTab()
case .serverDashboard, .usersRoles, .insights, .tableHealth:
tabManager.addSingletonTab(payload.tabType)
case .objectSource:
guard let objectRef = payload.objectRef else { return }
tabManager.addObjectSourceTab(objectRef: objectRef)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,8 @@ extension MainSplitViewController {
@objc func showQueryInsights(_ sender: Any?) {
commandActions?.showQueryInsights()
}

@objc func showTableHealth(_ sender: Any?) {
commandActions?.showTableHealth()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct MenuValidationContext: Equatable {
var supportsRestore = false
var supportsServerDashboard = false
var supportsUserManagement = false
var supportsTableHealth = false
var supportsSchemaSwitching = false
// Same rule as the editor bar, so the menu cannot run a statement the bar's button refuses.
var supportsExplain = false
Expand Down Expand Up @@ -287,6 +288,8 @@ extension MainSplitViewController: NSMenuItemValidation {
return context.isConnected && context.supportsUserManagement
case #selector(showQueryInsights(_:)):
return context.isConnected
case #selector(showTableHealth(_:)):
return context.isConnected && context.supportsTableHealth

case #selector(toggleFilterBar(_:)):
return context.isConnected && context.canUseTableResultCommands
Expand Down Expand Up @@ -462,6 +465,9 @@ extension MainSplitViewController: NSMenuItemValidation {
#selector(importData(_:)),
#selector(importDataFormat(_:)),
#selector(showServerDashboard(_:)),
#selector(showUsersAndRoles(_:)),
#selector(showQueryInsights(_:)),
#selector(showTableHealth(_:)),
#selector(navigateBack(_:)),
#selector(navigateForward(_:)),
#selector(moveTabToConnection(_:)),
Expand Down Expand Up @@ -664,6 +670,7 @@ extension MainSplitViewController: NSMenuItemValidation {
supportsRestore: actions.supportsRestore,
supportsServerDashboard: actions.supportsServerDashboard,
supportsUserManagement: actions.supportsUserManagement,
supportsTableHealth: actions.supportsTableHealth,
supportsSchemaSwitching: actions.supportsSchemaSwitching,
supportsExplain: actions.supportsExplain,
supportsFormatting: actions.supportsFormatting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ internal extension MainSplitViewController {
return "person.2"
case .insights:
return "chart.bar"
case .tableHealth:
return "stethoscope"
case .objectSource:
return "curlybraces.square"
case .versionHistory:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,8 @@ internal final class MainSplitViewController: NSSplitViewController {
switch tabType {
case .usersRoles:
return UsersRolesLayoutMetrics.tabMinimumWidth
case .query, .table, .createTable, .erDiagram, .serverDashboard, .insights, .objectSource, .versionHistory,
.tableListing, .routineDebug:
case .query, .table, .createTable, .erDiagram, .serverDashboard, .insights, .tableHealth, .objectSource,
.versionHistory, .tableListing, .routineDebug:
return defaultDetailMinThickness
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ internal enum ToolbarContextResolver {
String(localized: "Create Table")
case .usersRoles:
String(localized: "Apply Changes")
case .query, .table, .erDiagram, .serverDashboard, .insights, .objectSource, .versionHistory, .tableListing,
.routineDebug, nil:
case .query, .table, .erDiagram, .serverDashboard, .insights, .tableHealth, .objectSource, .versionHistory,
.tableListing, .routineDebug, nil:
String(localized: "Save Changes")
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@ internal enum ToolbarContextResolver {
return [MainWindowToolbar.refresh]
case .objectSource where key.stagesObjectChanges:
return []
case .serverDashboard, .insights, .objectSource, .versionHistory, .tableListing:
case .serverDashboard, .insights, .tableHealth, .objectSource, .versionHistory, .tableListing:
/// None of these can stage a change, so the commit control could only ever be dim.
return [MainWindowToolbar.saveChanges]
case .routineDebug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ enum WindowTitleResolver {
return ResolvedWindowTitle(title: sessionTitle, subtitle: "")
}

static func title(for tabType: TabType) -> String {
resolveTitle(
tabType: tabType,
tableName: nil,
schemaName: nil,
explicitTitle: nil,
sourceFileURL: nil,
databaseType: nil,
queryLanguageName: nil
)
}

static func resolveTitle(
payload: EditorTabPayload?,
databaseType: DatabaseType?,
Expand Down Expand Up @@ -144,6 +156,8 @@ enum WindowTitleResolver {
return String(localized: "Users & Roles")
case .insights:
return String(localized: "Query Insights")
case .tableHealth:
return String(localized: "Table Health")
case .erDiagram:
return String(localized: "ER Diagram")
case .createTable:
Expand Down
Loading
Loading