@@ -183,57 +183,41 @@ QFuture<void> TreeOperations::getDatabases(
183183}
184184
185185void 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) {
189191 QString keyPattern = filter.isEmpty () ? m_config.keysPattern () : filter;
190192
191193 if (m_filterHistory.contains (keyPattern)) {
192- m_filterHistory[keyPattern] = m_filterHistory[keyPattern].toInt () + 1 ;
194+ m_filterHistory[keyPattern] = m_filterHistory[keyPattern].toInt () + 1 ;
193195 } else {
194- m_filterHistory[keyPattern] = 1 ;
196+ m_filterHistory[keyPattern] = 1 ;
195197 }
196198 m_config.setFilterHistory (m_filterHistory);
197199 emit filterHistoryUpdated ();
198200
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-
218201 if (!connect (m_connection)) return ;
219202
220203 auto processErr = [callback](const QString& err) {
221204 return callback (
205+ RedisClient::Connection::RawKeysList (),
222206 QCoreApplication::translate (" RDM" , " Cannot load keys: %1" ).arg (err));
223- };
207+ };
224208
225209 try {
226210 if (m_connection->mode () == RedisClient::Connection::Mode::Cluster) {
227- m_connection->getClusterKeys (renderingCallback , keyPattern);
211+ m_connection->getClusterKeys (callback , keyPattern);
228212 } else {
229213 m_connection->cmd (
230- {" ping" }, this , parent-> getDbIndex () ,
231- [this , callback, renderingCallback, keyPattern,
214+ {" ping" }, this , dbIndex ,
215+ [this , callback, keyPattern,
232216 processErr](const RedisClient::Response& r) {
233217 if (r.isErrorMessage ()) {
234218 return processErr (r.value ().toString ());
235219 }
236- m_connection->getDatabaseKeys (renderingCallback , keyPattern, -1 );
220+ m_connection->getDatabaseKeys (callback , keyPattern, -1 );
237221 },
238222 [processErr](const QString& err) { return processErr (err); });
239223 }
@@ -394,7 +378,8 @@ void TreeOperations::openKeyIfExists(
394378 if (result.toByteArray () == " 1" ) {
395379 auto key = QSharedPointer<ConnectionsTree::KeyItem>(
396380 new ConnectionsTree::KeyItem (fullPath, parent.toWeakRef (),
397- parent->model ()));
381+ parent->model (),
382+ parent->keysShortNameRendering ()));
398383
399384 emit m_events->openValueTab (m_connection, key, true );
400385
0 commit comments