Merge PR #424: Fix graphs not filtering properly for type id

This commit is contained in:
Jenkins nymea 2020-09-09 01:05:51 +02:00
commit 267f43077d
2 changed files with 20 additions and 2 deletions

View File

@ -96,6 +96,17 @@ QHash<int, QByteArray> LogsModelNg::roleNames() const
return roles;
}
void LogsModelNg::classBegin()
{
}
void LogsModelNg::componentComplete()
{
m_ready = true;
fetchMore();
}
bool LogsModelNg::busy() const
{
return m_busy;
@ -359,6 +370,9 @@ void LogsModelNg::fetchMore(const QModelIndex &parent)
{
Q_UNUSED(parent)
if (!m_ready) {
return;
}
if (!m_engine) {
qWarning() << "Cannot update. Engine not set";
return;
@ -404,7 +418,7 @@ void LogsModelNg::fetchMore(const QModelIndex &parent)
params.insert("limit", m_blockSize);
params.insert("offset", m_list.count());
qDebug() << "Fetching logs from" << m_startTime.toString() << "to" << m_endTime.toString() << "with offset" << m_list.count() << "and limit" << m_blockSize;
qDebug() << "Fetching logs:" << qUtf8Printable(QJsonDocument::fromVariant(params).toJson());
m_engine->jsonRpcClient()->sendCommand("Logging.GetLogEntries", params, this, "logsReply");
// qDebug() << "GetLogEntries called";

View File

@ -36,11 +36,12 @@
#include <QDateTime>
#include <QLineSeries>
#include <QUuid>
#include <QQmlParserStatus>
class LogEntry;
class Engine;
class LogsModelNg : public QAbstractListModel
class LogsModelNg : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
Q_PROPERTY(Engine* engine READ engine WRITE setEngine NOTIFY engineChanged)
@ -77,6 +78,8 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
void classBegin() override;
void componentComplete() override;
bool busy() const;
@ -143,6 +146,7 @@ private:
QDateTime m_viewStartTime;
QVariant m_minValue;
QVariant m_maxValue;
bool m_ready = false;
QtCharts::QXYSeries *m_graphSeries = nullptr;