20#ifndef ORES_QT_SESSION_HISTORY_DIALOG_HPP
21#define ORES_QT_SESSION_HISTORY_DIALOG_HPP
29#include <QAbstractTableModel>
30#include <QFutureWatcher>
31#include <QItemSelection>
32#include <QtCharts/QChartView>
34#include <boost/uuid/uuid.hpp>
35#include "ores.qt/ClientManager.hpp"
36#include "ores.logging/make_logger.hpp"
37#include "ores.iam.api/domain/session.hpp"
38#include "ores.iam.api/messaging/session_samples_protocol.hpp"
51 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
52 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
53 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
54 QVariant headerData(
int section, Qt::Orientation orientation,
55 int role = Qt::DisplayRole)
const override;
57 void setSessions(
const std::vector<iam::domain::session>& sessions);
68 std::uint64_t bytes_received);
70 const std::vector<iam::domain::session>& sessions()
const {
return sessions_; }
85 std::vector<iam::domain::session> sessions_;
100 inline static std::string_view logger_name =
101 "ores.qt.session_history_dialog";
103 [[nodiscard]]
static auto& lg() {
105 static auto instance = make_logger(logger_name);
111 QWidget* parent =
nullptr);
120 void setAccount(
const boost::uuids::uuid& accountId,
121 const QString& username);
129 void statusMessage(
const QString& message);
130 void errorMessage(
const QString& message);
133 void onSessionsLoaded();
134 void onSamplesLoaded();
135 void onSessionSelectionChanged(
const QItemSelection& selected,
136 const QItemSelection& deselected);
137 void onSampleRefreshTimeout();
142 QTableView* tableView_;
144 QSplitter* splitter_;
145 QChartView* chartView_;
147 boost::uuids::uuid accountId_;
152 std::vector<iam::domain::session> sessions;
153 std::uint32_t total_count;
156 struct FetchSamplesResult {
158 bool is_active =
false;
159 boost::uuids::uuid session_id;
160 QString session_label;
161 std::vector<iam::messaging::session_sample_dto> samples;
164 QFutureWatcher<FetchResult>* watcher_;
165 QFutureWatcher<FetchSamplesResult>* samplesWatcher_;
166 QTimer* sampleRefreshTimer_;
169 bool hasSelectedSession_ =
false;
170 boost::uuids::uuid selectedSessionId_ = {};
171 QString selectedSessionLabel_;
172 bool selectedSessionActive_ =
false;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Table model for displaying session history.
Definition SessionHistoryDialog.hpp:45
void updateActiveBytesFromClient(std::uint64_t bytes_sent, std::uint64_t bytes_received)
Inject live byte counters into active (no end_time) session rows.
Definition SessionHistoryDialog.cpp:179
Dialog for displaying session history for an account.
Definition SessionHistoryDialog.hpp:96
void setAccount(const boost::uuids::uuid &accountId, const QString &username)
Set the account to display sessions for.
Definition SessionHistoryDialog.cpp:265
void refresh()
Refresh the session list from the server.
Definition SessionHistoryDialog.cpp:273