@@ -183,57 +183,41 @@ QFuture<void> TreeOperations::getDatabases(
183
183
}
184
184
185
185
void TreeOperations::loadNamespaceItems (
186
- QSharedPointer<ConnectionsTree::AbstractNamespaceItem> parent,
187
- const QString& filter, std::function<void (const QString& err)> callback,
188
- QSet<QByteArray> expandedNs) {
186
+ uint dbIndex,
187
+ const QString& filter,
188
+ std::function<void (const RedisClient::Connection::RawKeysList& keylist,
189
+ const QString& err)>
190
+ callback) {
189
191
QString keyPattern = filter.isEmpty () ? m_config.keysPattern () : filter;
190
192
191
193
if (m_filterHistory.contains (keyPattern)) {
192
- m_filterHistory[keyPattern] = m_filterHistory[keyPattern].toInt () + 1 ;
194
+ m_filterHistory[keyPattern] = m_filterHistory[keyPattern].toInt () + 1 ;
193
195
} else {
194
- m_filterHistory[keyPattern] = 1 ;
196
+ m_filterHistory[keyPattern] = 1 ;
195
197
}
196
198
m_config.setFilterHistory (m_filterHistory);
197
199
emit filterHistoryUpdated ();
198
200
199
- auto renderingCallback =
200
- [this , callback, filter, parent, expandedNs](
201
- const RedisClient::Connection::RawKeysList& keylist,
202
- const QString& err) {
203
- if (!err.isEmpty ()) {
204
- return callback (err);
205
- }
206
-
207
- auto settings = ConnectionsTree::KeysTreeRenderer::RenderingSettigns{
208
- QRegExp (filter), getNamespaceSeparator (), parent->getDbIndex (),
209
- true };
210
-
211
- AsyncFuture::observe (
212
- QtConcurrent::run (&ConnectionsTree::KeysTreeRenderer::renderKeys,
213
- sharedFromThis (), keylist, parent, settings,
214
- expandedNs))
215
- .subscribe ([callback]() { callback (QString ()); });
216
- };
217
-
218
201
if (!connect (m_connection)) return ;
219
202
220
203
auto processErr = [callback](const QString& err) {
221
204
return callback (
205
+ RedisClient::Connection::RawKeysList (),
222
206
QCoreApplication::translate (" RDM" , " Cannot load keys: %1" ).arg (err));
223
- };
207
+ };
224
208
225
209
try {
226
210
if (m_connection->mode () == RedisClient::Connection::Mode::Cluster) {
227
- m_connection->getClusterKeys (renderingCallback , keyPattern);
211
+ m_connection->getClusterKeys (callback , keyPattern);
228
212
} else {
229
213
m_connection->cmd (
230
- {" ping" }, this , parent-> getDbIndex () ,
231
- [this , callback, renderingCallback, keyPattern,
214
+ {" ping" }, this , dbIndex ,
215
+ [this , callback, keyPattern,
232
216
processErr](const RedisClient::Response& r) {
233
217
if (r.isErrorMessage ()) {
234
218
return processErr (r.value ().toString ());
235
219
}
236
- m_connection->getDatabaseKeys (renderingCallback , keyPattern, -1 );
220
+ m_connection->getDatabaseKeys (callback , keyPattern, -1 );
237
221
},
238
222
[processErr](const QString& err) { return processErr (err); });
239
223
}
@@ -394,7 +378,8 @@ void TreeOperations::openKeyIfExists(
394
378
if (result.toByteArray () == " 1" ) {
395
379
auto key = QSharedPointer<ConnectionsTree::KeyItem>(
396
380
new ConnectionsTree::KeyItem (fullPath, parent.toWeakRef (),
397
- parent->model ()));
381
+ parent->model (),
382
+ parent->keysShortNameRendering ()));
398
383
399
384
emit m_events->openValueTab (m_connection, key, true );
400
385
0 commit comments