Skip to content

Commit 16fe479

Browse files
authored
Merge pull request #54 from cmushroom/dev
2.4.0
2 parents ea399ab + 951ae43 commit 16fe479

File tree

12 files changed

+92
-138
lines changed

12 files changed

+92
-138
lines changed

.version

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"latestVersionNum": 17,
3-
"latestVersion": "2.3.0",
2+
"latestVersionNum": 18,
3+
"latestVersion": "2.4.0",
44
"updateType": "hint",
5-
"releaseNotes": "1. 使用reids 连接池。 \n2. table通用组件支持拷贝行数据, 右键菜单添加快捷键。 #49 \n3. 文本框禁用情况下支持选中复制 #49。 \n4. 表格拖动排序问题修复。 \n5. 点击一个失败的链接,正常redis服务器也无法登录bug修复 #48。 \n6. redis client 重构。"
5+
"releaseNotes": "1. 切换db Bug 修复 #53。 \n2. 连接池关闭错误修复。 \n3. 最小化到dock后无法唤起问题修复 #38。"
66
}

redis-pro.xcodeproj/project.pbxproj

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
430A09E225C1559400B60DFC /* FormLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430A09E125C1559400B60DFC /* FormLabel.swift */; };
1818
430A09E625C155F800B60DFC /* FormItemText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 430A09E525C155F800B60DFC /* FormItemText.swift */; };
1919
431266CC261C450300FB6B69 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 431266CB261C450300FB6B69 /* Tag.swift */; };
20-
431266CF261C4E0900FB6B69 /* RedisKeySearchRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 431266CE261C4E0900FB6B69 /* RedisKeySearchRowView.swift */; };
2120
431266D5261C5C9000FB6B69 /* ButtonTypeEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 431266D4261C5C9000FB6B69 /* ButtonTypeEnum.swift */; };
2221
431266D8261C66E100FB6B69 /* MTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 431266D7261C66E100FB6B69 /* MTheme.swift */; };
2322
431266DE261D45C500FB6B69 /* MIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 431266DD261D45C500FB6B69 /* MIcon.swift */; };
@@ -213,7 +212,6 @@
213212
430A09E125C1559400B60DFC /* FormLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabel.swift; sourceTree = "<group>"; };
214213
430A09E525C155F800B60DFC /* FormItemText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormItemText.swift; sourceTree = "<group>"; };
215214
431266CB261C450300FB6B69 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; };
216-
431266CE261C4E0900FB6B69 /* RedisKeySearchRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedisKeySearchRowView.swift; sourceTree = "<group>"; };
217215
431266D4261C5C9000FB6B69 /* ButtonTypeEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonTypeEnum.swift; sourceTree = "<group>"; };
218216
431266D7261C66E100FB6B69 /* MTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MTheme.swift; sourceTree = "<group>"; };
219217
431266DD261D45C500FB6B69 /* MIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MIcon.swift; sourceTree = "<group>"; };
@@ -595,7 +593,6 @@
595593
isa = PBXGroup;
596594
children = (
597595
62CB3D742619AEC20061E8C3 /* RedisKeysListView.swift */,
598-
431266CE261C4E0900FB6B69 /* RedisKeySearchRowView.swift */,
599596
437C09342649039000F1904C /* DatabasePicker.swift */,
600597
);
601598
path = Sidebar;
@@ -1026,7 +1023,6 @@
10261023
62E8F9D92765F197006A5326 /* MPasswordField.swift in Sources */,
10271024
431266F5261D912500FB6B69 /* StringEditorView.swift in Sources */,
10281025
43CD28AC267B67C600E11876 /* PuppyLogger.swift in Sources */,
1029-
431266CF261C4E0900FB6B69 /* RedisKeySearchRowView.swift in Sources */,
10301026
43F22EF5269FCE6000A00F97 /* DateHelper.swift in Sources */,
10311027
4314A34126243ED500053FEE /* PageBar.swift in Sources */,
10321028
62CB3D7D2619AF990061E8C3 /* RedisKeyModel.swift in Sources */,
@@ -1260,7 +1256,7 @@
12601256
CODE_SIGN_IDENTITY = "-";
12611257
CODE_SIGN_STYLE = Automatic;
12621258
COMBINE_HIDPI_IMAGES = YES;
1263-
CURRENT_PROJECT_VERSION = 17;
1259+
CURRENT_PROJECT_VERSION = 18;
12641260
DEVELOPMENT_ASSET_PATHS = "\"redis-pro/Preview Content\"";
12651261
ENABLE_PREVIEWS = YES;
12661262
INFOPLIST_FILE = "redis-pro/Info.plist";
@@ -1269,7 +1265,7 @@
12691265
"@executable_path/../Frameworks",
12701266
);
12711267
MACOSX_DEPLOYMENT_TARGET = 11.0;
1272-
MARKETING_VERSION = 2.3.0;
1268+
MARKETING_VERSION = 2.4.0;
12731269
PRODUCT_BUNDLE_IDENTIFIER = "com.cmushroom.redis-pro";
12741270
PRODUCT_NAME = "$(TARGET_NAME)";
12751271
SWIFT_VERSION = 5.0;
@@ -1285,7 +1281,7 @@
12851281
CODE_SIGN_IDENTITY = "-";
12861282
CODE_SIGN_STYLE = Automatic;
12871283
COMBINE_HIDPI_IMAGES = YES;
1288-
CURRENT_PROJECT_VERSION = 17;
1284+
CURRENT_PROJECT_VERSION = 18;
12891285
DEVELOPMENT_ASSET_PATHS = "\"redis-pro/Preview Content\"";
12901286
DEVELOPMENT_TEAM = "";
12911287
ENABLE_PREVIEWS = YES;
@@ -1295,7 +1291,7 @@
12951291
"@executable_path/../Frameworks",
12961292
);
12971293
MACOSX_DEPLOYMENT_TARGET = 11.0;
1298-
MARKETING_VERSION = 2.3.0;
1294+
MARKETING_VERSION = 2.4.0;
12991295
PRODUCT_BUNDLE_IDENTIFIER = "com.cmushroom.redis-pro";
13001296
PRODUCT_NAME = "$(TARGET_NAME)";
13011297
PROVISIONING_PROFILE_SPECIFIER = "";

redis-pro.xcodeproj/xcuserdata/chengpan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+24-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
4141
<BreakpointContent
4242
uuid = "5BE6502F-970F-4408-94FF-3C0CD5C53636"
43-
shouldBeEnabled = "Yes"
43+
shouldBeEnabled = "No"
4444
ignoreCount = "0"
4545
continueAfterRunningActions = "No"
4646
filePath = "redis-pro/Common/RedisClient/RediStackClient.swift"
@@ -55,17 +55,33 @@
5555
<BreakpointProxy
5656
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
5757
<BreakpointContent
58-
uuid = "A2780896-FB71-452E-B32B-7FA169DB1346"
59-
shouldBeEnabled = "Yes"
58+
uuid = "C83B50A6-5CE2-4A4F-BC9F-34837FA9E29A"
59+
shouldBeEnabled = "No"
6060
ignoreCount = "0"
6161
continueAfterRunningActions = "No"
62-
filePath = "redis-pro/Common/RedisClient/RediStackClient.swift"
62+
filePath = "redis-pro/Common/RedisClient/RedisClientSystem.swift"
6363
startingColumnNumber = "9223372036854775807"
6464
endingColumnNumber = "9223372036854775807"
65-
startingLineNumber = "308"
66-
endingLineNumber = "308"
67-
landmarkName = "RediStackClient"
68-
landmarkType = "3">
65+
startingLineNumber = "22"
66+
endingLineNumber = "22"
67+
landmarkName = "selectDB(_:)"
68+
landmarkType = "7">
69+
</BreakpointContent>
70+
</BreakpointProxy>
71+
<BreakpointProxy
72+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
73+
<BreakpointContent
74+
uuid = "06DDB51C-119C-4DEF-80DB-9901923A6A49"
75+
shouldBeEnabled = "No"
76+
ignoreCount = "0"
77+
continueAfterRunningActions = "No"
78+
filePath = "../../../Library/Developer/Xcode/DerivedData/redis-pro-dqdhwgmlxxtepdhgbmpmdcldlrxf/SourcePackages/checkouts/RediStack/Sources/RediStack/Commands/ConnectionCommands.swift"
79+
startingColumnNumber = "9223372036854775807"
80+
endingColumnNumber = "9223372036854775807"
81+
startingLineNumber = "58"
82+
endingLineNumber = "58"
83+
landmarkName = "select(database:)"
84+
landmarkType = "7">
6985
</BreakpointContent>
7086
</BreakpointProxy>
7187
</Breakpoints>

redis-pro/Common/RedisClient/RediStackClient.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RediStackClient {
2323
var redisModel:RedisModel
2424

2525
// conn
26-
private let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 3)
26+
private let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 2)
2727
var connection:RedisConnection?
2828
var connPool:RedisConnectionPool?
2929

@@ -264,7 +264,7 @@ class RediStackClient {
264264
, boundEventLoop: eventLoop)
265265

266266
pool.activate()
267-
267+
268268
// _keepalive()
269269
self.logger.info("init redis connection pool complete...")
270270
return pool
@@ -305,10 +305,12 @@ class RediStackClient {
305305
}
306306

307307
deinit {
308-
logger.info("gracefully shutdown event loop group start...")
309-
self.eventLoopGroup.shutdownGracefully({ _ in
310-
self.logger.info("gracefully shutdown event loop group complete...")
311-
})
308+
do {
309+
logger.info("gracefully shutdown event loop group start...")
310+
try self.eventLoopGroup.syncShutdownGracefully()
311+
} catch {
312+
logger.info("gracefully shutdown event loop group error: \(error)")
313+
}
312314
}
313315
}
314316

redis-pro/Common/RedisClient/RedisClientSystem.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import RediStack
1313
extension RediStackClient {
1414

1515
func selectDB(_ database: Int) async -> Bool {
16-
16+
self.logger.info("select db: \(database)")
17+
self.redisModel.database = database
18+
19+
self.connPool?.close()
20+
self.connPool = nil
21+
1722
let command: RedisCommand<Void> = .select(database: database)
1823
let _ = await send(command)
1924
return true

redis-pro/RedisProCommands.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct RedisProCommands: Commands {
5555
Button("New Tab", action: {
5656

5757
if let currentWindow = NSApp.keyWindow,
58-
let windowController = currentWindow.windowController {
58+
let windowController = currentWindow.windowController {
5959
windowController.newWindowForTab(nil)
6060
if let newWindow = NSApp.keyWindow,
6161
currentWindow != newWindow {

redis-pro/Store/DatabaseStore.swift

+18-5
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ struct DatabaseState: Equatable {
2424
enum DatabaseAction:BindableAction, Equatable {
2525
case initial
2626
case getDatabases
27-
case updateDatabases(Int)
28-
case change(Int)
27+
case setDB(Int)
28+
case selectDB(Int)
29+
case onDBChange(Int)
2930
case none
3031
case binding(BindingAction<DatabaseState>)
3132
}
@@ -49,15 +50,27 @@ let databaseReducer = Reducer<DatabaseState, DatabaseAction, DatabaseEnvironment
4950
case .getDatabases:
5051
return .task {
5152
let r = await env.redisInstanceModel.getClient().databases()
52-
return .updateDatabases(r)
53+
return .setDB(r)
5354
}
5455
.receive(on: env.mainQueue)
5556
.eraseToEffect()
56-
case let .updateDatabases(databases):
57+
case let .setDB(databases):
5758
state.databases = databases
5859
return .none
59-
case let .change(database):
60+
case let .selectDB(database):
6061
state.database = database
62+
63+
return .task {
64+
let r = await env.redisInstanceModel.getClient().selectDB(database)
65+
if r {
66+
return .onDBChange(database)
67+
}
68+
return .none
69+
}
70+
.receive(on: env.mainQueue)
71+
.eraseToEffect()
72+
73+
case .onDBChange:
6174
return .none
6275
case .none:
6376
return .none

redis-pro/Store/RedisKeysStore.swift

+4-9
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,12 @@ let redisKeysReducer = Reducer<RedisKeysState, RedisKeysAction, RedisKeysEnviron
349349
return .none
350350

351351
//MARK: --------------------------- database action ---------------------------
352-
case let .databaseAction(.change(database)):
352+
case let .databaseAction(.onDBChange(database)):
353353
logger.info("change database, \(database)")
354-
return .task {
355-
let r = await env.redisInstanceModel.getClient().selectDB(database)
356-
if r {
357-
return .initial
358-
}
359-
return .none
354+
return .result {
355+
.success(.initial)
360356
}
361-
.receive(on: env.mainQueue)
362-
.eraseToEffect()
357+
363358
case .databaseAction:
364359
return .none
365360

redis-pro/Views/Sidebar/DatabasePicker.swift

+3-25
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,15 @@ import SwiftUI
99
import ComposableArchitecture
1010

1111
struct DatabasePicker: View {
12-
// @EnvironmentObject var redisInstanceModel:RedisInstanceModel
13-
// @State private var databases:Int = 16
14-
// @State var database:Int = 0
15-
// @State var selection = 0
16-
// var onChange: (() -> Void)?
17-
//
12+
1813
var store:Store<DatabaseState, DatabaseAction>
1914

2015
var body: some View {
2116
WithViewStore(store) {viewStore in
2217

2318
Menu(content: {
2419
ForEach(0 ..< viewStore.databases, id: \.self) { item in
25-
Button("DB\(item)", action: { viewStore.send(.change(item))})
20+
Button("DB\(item)", action: { viewStore.send(.selectDB(item))})
2621
.font(.system(size: 10.0))
2722
.foregroundColor(.primary)
2823
}
@@ -37,23 +32,6 @@ struct DatabasePicker: View {
3732
}
3833
}
3934
}
40-
41-
//
42-
// func onSelectDatabaseAction(_ database:Int) -> Void {
43-
// Task {
44-
// let r = await redisInstanceModel.getClient().selectDB(database)
45-
// if r {
46-
// self.database = database
47-
// self.onChange?()
48-
// }
49-
// }
50-
// }
51-
//
52-
// func queryDBList() -> Void {
53-
// Task {
54-
// let r = await redisInstanceModel.getClient().databases()
55-
// self.databases = r
56-
// }
57-
// }
35+
5836
}
5937

redis-pro/Views/Sidebar/RedisKeySearchRowView.swift

-52
This file was deleted.

0 commit comments

Comments
 (0)