Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
61a1f1c
RedisDesktopManager 0.9.0-alpha4
uglide Dec 9, 2016
943f85b
Remove php-unserialize submodule
uglide Dec 9, 2016
57d484d
Fix qml.qrc
uglide Dec 9, 2016
c22a576
Clean up code
uglide Dec 16, 2016
a80b230
Fix issues detected in unit tests
uglide Dec 16, 2016
4b1b46d
Show human readable size of the value
uglide Dec 16, 2016
bc95417
Use WebEngine to render values
uglide Dec 16, 2016
8ea79f1
Fix #3454: Add support for Pub/Sub commands in console
uglide Dec 16, 2016
31260b3
Update formattersmanager
uglide Dec 16, 2016
cbee8a1
Fix issue #3732: RDM shows invalid error message when trying to conne…
uglide Dec 16, 2016
6be67a5
Fix issue #3758: RDM Shows Key Values for One Key Only
uglide Dec 23, 2016
a732a44
Fix tree rendering with multi-char NS
uglide Dec 23, 2016
5848c90
Improve connections dialog
uglide Dec 23, 2016
762e062
Fix issue #3724: Load NS seperator from connection settings in NS del…
uglide Dec 23, 2016
9aacc32
Fix #3691: RDM doesn't fade deleted keys & namespaces
uglide Dec 23, 2016
44c62a0
Remove qgamp and clean code
uglide Mar 31, 2017
449c0c8
Migrate to Qt 5.8
uglide Mar 31, 2017
5c2cf08
Merge branch '0.9' into alpha4
uglide Mar 31, 2017
2378df2
Change breakpad origin to github
uglide Mar 31, 2017
ab44583
Update breakpad
uglide Mar 31, 2017
8af79a4
Update qredisclient
uglide Apr 14, 2017
f600bd0
Fix Qt installation on Ubuntu
uglide Apr 21, 2017
701693a
Update rdm.desktop
uglide Apr 21, 2017
8f42d8e
Do not build libssh2 if static lib exists
uglide Apr 21, 2017
9b5db95
Update common_functions
uglide Apr 21, 2017
715fef8
Remove webengine usage
uglide Apr 21, 2017
d2c95c7
Remove import
uglide Apr 21, 2017
f0c82b5
Remove import
uglide Apr 21, 2017
73b364a
Revert "Update rdm.desktop"
uglide Apr 21, 2017
25f520f
Update configure script
uglide Apr 21, 2017
7add88f
Update value editor
uglide Apr 21, 2017
adef640
Fix issue #3791: Model doesn't hide removed row on page > 1
uglide Apr 28, 2017
5e67a7d
Fix unit tests & regression
uglide Apr 28, 2017
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
8 changes: 1 addition & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@
url = https://github.com/uglide/qredisclient.git
[submodule "3rdparty/gbreakpad"]
path = 3rdparty/gbreakpad
url = https://chromium.googlesource.com/breakpad/breakpad
[submodule "3rdparty/qgamp"]
path = 3rdparty/qgamp
url = https://github.com/uglide/qgamp.git
[submodule "src/qml/3rdparty/php-unserialize-js"]
path = src/qml/3rdparty/php-unserialize-js
url = https://github.com/uglide/php-unserialize-js.git
url = https://github.com/google/breakpad.git
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
fi
- cd ./src && ./configure && cd ./../
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
source /opt/qt57/bin/qt57-env.sh
source /opt/qt58/bin/qt58-env.sh
;
fi
- qmake -v
Expand Down
4 changes: 0 additions & 4 deletions 3rdparty/3rdparty.pri
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ OTHER_FILES += $$PWD/../src/resources/qml/3rdparty/php-unserialize-js/phpUnseria
# qredisclient
include($$PWD/qredisclient/qredisclient.pri)

#qgamp
include($$PWD/qgamp/qgamp.pri)
DEFINES += GMP_ID=\\\"UA-68484170-1\\\"

# Easylogging
INCLUDEPATH += $$PWD/easyloggingpp/src
HEADERS += $$PWD/easyloggingpp/src/easylogging++.h
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/gbreakpad
Submodule gbreakpad updated 276 files
1 change: 0 additions & 1 deletion 3rdparty/qgamp
Submodule qgamp deleted from f4da8a
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.9.0.{build}
clone_depth: 5
install:
- git submodule update --init --recursive
- set QTDIR=C:\Qt\5.7\msvc2015
- set QTDIR=C:\Qt\5.8\msvc2015
- set PATH=%QTDIR%\bin;%PATH%
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
- nuget install -Version 1.6.0.2 -OutputDirectory ./3rdparty/qredisclient/3rdparty/windows rmt_libssh2
Expand Down
20 changes: 11 additions & 9 deletions build/common_functions
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ function build_breakpad {
git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss || true
touch README
./configure
make -j 2
make -s -j 2
}

function build_libssh2 {
cd $DEPS_DIR
git clone https://github.com/libssh2/libssh2.git libssh2 || true
cd libssh2
mkdir bin || rm -fR ./bin && mkdir bin
cd bin
cmake -DCRYPTO_BACKEND=OpenSSL -DENABLE_ZLIB_COMPRESSION=ON ..
cmake --build .
sudo make install
if [ ! -f /usr/local/lib/libssh2.a ]; then
cd $DEPS_DIR
git clone https://github.com/libssh2/libssh2.git libssh2 || true
cd libssh2
mkdir bin || rm -fR ./bin && mkdir bin
cd bin
cmake -DCRYPTO_BACKEND=OpenSSL -DENABLE_ZLIB_COMPRESSION=ON ..
cmake --build .
sudo make install
fi
}

function print_line {
Expand Down
28 changes: 8 additions & 20 deletions src/app/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <QSettings>
#include <QMessageBox>
#include <easylogging++.h>
#include <googlemp.h>
#include <qredisclient/redisclient.h>

#include "logger.h"
Expand All @@ -21,21 +20,14 @@
#include "modules/value-editor/valueviewmodel.h"
#include "modules/value-editor/viewmodel.h"
#include "modules/value-editor/sortfilterproxymodel.h"
#include "modules/value-editor/formattersmanager.h"
#include "modules/console/consolemodel.h"
#include "modules/server-stats/serverstatsmodel.h"
#include "modules/bulk-operations/bulkoperationsmanager.h"


INITIALIZE_EASYLOGGINGPP

static QObject *analytics_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)

GoogleMP *gmp = GoogleMP::instance();
return gmp;
}

Application::Application(int &argc, char **argv)
: QApplication(argc, argv),
Expand All @@ -45,8 +37,7 @@ Application::Application(int &argc, char **argv)
// Init components required for models and qml
initLog();
initAppInfo();
initAppFonts();
initAppAnalytics();
initAppFonts();
initRedisClient();
initUpdater();
installTranslator();
Expand All @@ -65,6 +56,9 @@ void Application::initModels()

connect(m_connections.data(), &ConnectionsManager::openServerStats,
m_serverStatsModel.data(), &TabViewModel::openTab);

m_formattersManager = QSharedPointer<ValueEditor::FormattersManager>(new ValueEditor::FormattersManager());
m_formattersManager->loadFormatters();
}

void Application::initAppInfo()
Expand Down Expand Up @@ -103,17 +97,10 @@ void Application::initAppFonts()
QApplication::setFont(defaultFont);
}

void Application::initAppAnalytics()
{
GoogleMP::startSession(QDateTime::currentMSecsSinceEpoch());
GoogleMP::instance()->reportEvent("rdm:cpp", "app start", "");
}

void Application::registerQmlTypes()
{
qmlRegisterType<ValueEditor::ValueViewModel>("rdm.models", 1, 0, "ValueViewModel");
qmlRegisterType<SortFilterProxyModel>("rdm.models", 1, 0, "SortFilterProxyModel");
qmlRegisterSingletonType<GoogleMP>("MeasurementProtocol", 1, 0, "Analytics", analytics_singletontype_provider);
qmlRegisterType<SortFilterProxyModel>("rdm.models", 1, 0, "SortFilterProxyModel");
qRegisterMetaType<ServerConfig>();
}

Expand All @@ -124,14 +111,15 @@ void Application::registerQmlRootObjects()
m_engine.rootContext()->setContextProperty("connectionsManager", m_connections.data());
m_engine.rootContext()->setContextProperty("viewModel", m_keyValues.data()); // TODO: Remove legacy name usage in qml
m_engine.rootContext()->setContextProperty("valuesModel", m_keyValues.data());
m_engine.rootContext()->setContextProperty("formattersManager", m_formattersManager.data());
m_engine.rootContext()->setContextProperty("consoleModel", m_consoleModel.data());
m_engine.rootContext()->setContextProperty("serverStatsModel", m_serverStatsModel.data());
m_engine.rootContext()->setContextProperty("appLogger", m_logger);
m_engine.rootContext()->setContextProperty("bulkOperations", m_bulkOperations.data());
}

void Application::initQml()
{
{
registerQmlTypes();
registerQmlRootObjects();
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QQmlApplicationEngine>
#include <QFontDatabase>
#include <QMenu>
#include <googlemp.h>

#ifndef RDM_VERSION
#include "../version.h"
Expand All @@ -16,6 +15,7 @@ class Updater;
class LogHandler;
class TabViewModel;
namespace ValueEditor { class ViewModel; }
namespace ValueEditor { class FormattersManager; }
namespace BulkOperations { class Manager; }


Expand All @@ -30,8 +30,7 @@ class Application : public QApplication

private:
void initAppInfo();
void initAppFonts();
void initAppAnalytics();
void initAppFonts();
void registerQmlTypes();
void registerQmlRootObjects();
void initLog();
Expand All @@ -48,6 +47,7 @@ private slots:
QSharedPointer<ConnectionsManager> m_connections;
QSharedPointer<Updater> m_updater;
QSharedPointer<ValueEditor::ViewModel> m_keyValues;
QSharedPointer<ValueEditor::FormattersManager> m_formattersManager;
QSharedPointer<BulkOperations::Manager> m_bulkOperations;
QSharedPointer<TabViewModel> m_consoleModel;
QSharedPointer<TabViewModel> m_serverStatsModel;
Expand Down
26 changes: 16 additions & 10 deletions src/app/models/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ ConfigManager::ConfigManager(const QString &basePath)

QString ConfigManager::getApplicationConfigPath(const QString &configFile, bool checkPath)
{
QString configDir;
#ifdef Q_OS_MACX
configDir = QDir::toNativeSeparators(
QString("%1/%2").arg(m_basePath).arg("/Library/Preferences/rdm/")
);
#else
configDir = QDir::toNativeSeparators(
QString("%1/%2").arg(m_basePath).arg(".rdm")
);
#endif
QString configDir = getConfigPath(m_basePath);
QDir settingsPath(configDir);

if (!settingsPath.exists() && settingsPath.mkpath(configDir)) {
Expand Down Expand Up @@ -189,6 +180,21 @@ void ConfigManager::setPermissions(QFile &file)
#endif
}

QString ConfigManager::getConfigPath(QString basePath)
{
QString configDir;
#ifdef Q_OS_MACX
configDir = QDir::toNativeSeparators(
QString("%1/%2").arg(basePath).arg("/Library/Preferences/rdm/")
);
#else
configDir = QDir::toNativeSeparators(
QString("%1/%2").arg(basePath).arg(".rdm")
);
#endif
return configDir;
}

bool saveJsonArrayToFile(const QJsonArray &c, const QString &f)
{
QJsonDocument config(c);
Expand Down
3 changes: 2 additions & 1 deletion src/app/models/configmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ class ConfigManager
QString getApplicationConfigPath(const QString &, bool checkPath=true);
bool migrateOldConfig(const QString &oldFileName, const QString &newFileName);
public:
static QString getConfigPath(QString basePath = QDir::homePath());
static QJsonArray xmlConfigToJsonArray(const QString &xmlConfigPath);

private:
static bool chechPath(const QString&);
static void setPermissions(QFile&);
static void setPermissions(QFile&);
private:
QString m_basePath;
};
Expand Down
4 changes: 2 additions & 2 deletions src/app/models/key-models/abstractkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ template < typename T > class KeyModel : public ValueEditor::Model
virtual void setTTL(const long long ttl) override
{
RedisClient::Response result;
qDebug(QString("TTL=%1").arg(ttl).toLatin1().constData());
qDebug() << QString("TTL=%1").arg(ttl);
try {
if (ttl >= 0)
result = m_connection->commandSync({"EXPIRE", m_keyFullPath, QString::number(ttl).toLatin1()}, m_dbIndex);
Expand All @@ -105,7 +105,7 @@ template < typename T > class KeyModel : public ValueEditor::Model
}

if (result.getValue().toInt() == 0) {
throw Exception("Not supprt TTL at this key");
throw Exception("Not support TTL at this key");
}
if (ttl >= 0)
m_ttl = ttl;
Expand Down
2 changes: 1 addition & 1 deletion src/app/models/key-models/stringkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void StringKeyModel::loadRows(unsigned long, unsigned long, std::function<void(c
m_connection->command({"GET", m_keyFullPath}, getConnector().data(),
[this, callback](RedisClient::Response r, QString e)
{
if (r.getType() != RedisClient::Response::Bulk) {
if (r.getType() != RedisClient::Response::Bulk || !e.isEmpty()) {
return callback(QString("Cannot load value"));
}

Expand Down
19 changes: 14 additions & 5 deletions src/app/models/treeoperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@ TreeOperations::TreeOperations(QSharedPointer<RedisClient::Connection> connectio

void TreeOperations::getDatabases(std::function<void (RedisClient::DatabaseList)> callback)
{
if (!m_connection->isConnected()) {
bool connected = m_connection->isConnected();

if (!connected) {
try {
m_connection->connect(true);
connected = m_connection->connect(true);
} catch (const RedisClient::Connection::Exception& e) {
throw ConnectionsTree::Operations::Exception(QObject::tr("Connection error: ") + QString(e.what()));
}
}

if (!connected) {
throw ConnectionsTree::Operations::Exception(
QObject::tr("Cannot connect to server '%1'. Check log for details.").arg(m_connection->getConfig().name()));
}

if (m_connection->getServerVersion() < 2.8)
throw ConnectionsTree::Operations::Exception(QObject::tr("RedisDesktopManager >= 0.9.0 doesn't support old versions of "
"redis-server (< 2.8). Please use RedisDesktopManager 0.8.8 or upgrade your redis-server."));
Expand Down Expand Up @@ -116,9 +123,9 @@ void TreeOperations::deleteDbKey(ConnectionsTree::KeyItem& key, std::function<vo
return;
}

QRegExp filter(key.getFullPath(), Qt::CaseSensitive, QRegExp::Wildcard);
emit m_manager.closeDbKeys(m_connection, key.getDbIndex(), filter);
key.setRemoved();
QRegExp filter(key.getFullPath(), Qt::CaseSensitive, QRegExp::Wildcard);
emit m_manager.closeDbKeys(m_connection, key.getDbIndex(), filter);
};

try {
Expand All @@ -130,7 +137,9 @@ void TreeOperations::deleteDbKey(ConnectionsTree::KeyItem& key, std::function<vo

void TreeOperations::deleteDbNamespace(ConnectionsTree::NamespaceItem &ns)
{
QString pattern = QString("%1:*").arg(QString::fromUtf8(ns.getFullPath()));
QString pattern = QString("%1%2*")
.arg(QString::fromUtf8(ns.getFullPath()))
.arg(static_cast<ServerConfig>(m_connection->getConfig()).namespaceSeparator());
QRegExp filter(pattern, Qt::CaseSensitive, QRegExp::Wildcard);

int dbIndex = ns.getDbIndex();
Expand Down
27 changes: 25 additions & 2 deletions src/app/qmlutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ long QmlUtils::binaryStringLength(const QVariant &value)
return val.size();
}

QString QmlUtils::humanSize(long size)
{
double num = size;
QStringList list;
list << "KB" << "MB" << "GB";

QStringListIterator i(list);
QString unit("bytes");

while(num >= 1024.0 && i.hasNext())
{
unit = i.next();
num /= 1024.0;
}
return QString().setNum(num,'f',2)+" "+unit;
}


QVariant QmlUtils::valueToBinary(const QVariant &value)
{
if (!value.canConvert(QVariant::ByteArray)) {
Expand All @@ -48,13 +66,18 @@ QVariant QmlUtils::binaryListToValue(const QVariantList &binaryList)
return value;
}

QVariant QmlUtils::printable(const QVariant &value)
QVariant QmlUtils::printable(const QVariant &value, bool htmlEscaped)
{
if (!value.canConvert(QVariant::ByteArray)) {
return QVariant();
}
QByteArray val = value.toByteArray();
return printableString(val);

if (htmlEscaped) {
return printableString(val).toHtmlEscaped();
} else {
return printableString(val);
}
}

QVariant QmlUtils::printableToValue(const QVariant &printable)
Expand Down
3 changes: 2 additions & 1 deletion src/app/qmlutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class QmlUtils : public QObject
public:
Q_INVOKABLE bool isBinaryString(const QVariant &value);
Q_INVOKABLE long binaryStringLength(const QVariant &value);
Q_INVOKABLE QString humanSize(long size);
Q_INVOKABLE QVariant valueToBinary(const QVariant &value);
Q_INVOKABLE QVariant binaryListToValue(const QVariantList& binaryList);
Q_INVOKABLE QVariant printable(const QVariant &value);
Q_INVOKABLE QVariant printable(const QVariant &value, bool htmlEscaped=false);
Q_INVOKABLE QVariant printableToValue(const QVariant &printable);
Q_INVOKABLE QVariant toUtf(const QVariant &value);
Q_INVOKABLE QString getPathFromUrl(const QUrl &url);
Expand Down
Loading