20#ifndef ORES_QT_CLIENT_RESULT_MODEL_HPP
21#define ORES_QT_CLIENT_RESULT_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/AbstractClientModel.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/HostDisplayNameCache.hpp"
29#include "ores.qt/RecencyPulseManager.hpp"
30#include "ores.qt/RecencyTracker.hpp"
31#include "ores.logging/make_logger.hpp"
32#include "ores.compute.api/domain/result.hpp"
46 inline static std::string_view logger_name =
47 "ores.qt.client_result_model";
49 [[nodiscard]]
static auto& lg() {
51 static auto instance = make_logger(logger_name);
73 QObject* parent =
nullptr);
84 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
85 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
86 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
87 QVariant headerData(
int section, Qt::Orientation orientation,
88 int role = Qt::DisplayRole)
const override;
106 void load_page(std::uint32_t offset, std::uint32_t limit);
133 void onResultsLoaded();
134 void onPulseStateChanged(
bool isOn);
135 void onPulsingComplete();
138 QVariant recency_foreground_color(
const std::string& code)
const;
142 std::vector<compute::domain::result> results;
143 std::uint32_t total_available_count;
144 QString error_message;
145 QString error_details;
148 void fetch_results(std::uint32_t offset, std::uint32_t limit);
150 ClientManager* clientManager_;
151 HostDisplayNameCache* host_name_cache_{
nullptr};
152 std::vector<compute::domain::result> results_;
153 QFutureWatcher<FetchResult>* watcher_;
154 std::uint32_t page_size_{100};
155 std::uint32_t total_available_count_{0};
156 bool is_fetching_{
false};
159 RecencyTracker<compute::domain::result, ResultKeyExtractor> recencyTracker_;
160 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
A specific execution instance of a workunit assigned to a host.
Definition result.hpp:38
Base class for all client-side entity models.
Definition AbstractClientModel.hpp:36
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Model for displaying compute results fetched from the server.
Definition ClientResultModel.hpp:42
const compute::domain::result * getResult(int row) const
Get compute result at the specified row.
Definition ClientResultModel.cpp:326
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientResultModel.cpp:314
void refresh()
Refresh compute result data from server asynchronously.
Definition ClientResultModel.cpp:181
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientResultModel.hpp:121
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of data.
Definition ClientResultModel.cpp:207
void set_host_name_cache(HostDisplayNameCache *cache)
Sets the host display-name cache used to render the Host column.
Definition ClientResultModel.cpp:148
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientResultModel.hpp:111
Column
Enumeration of table columns for type-safe column access.
Definition ClientResultModel.hpp:59
Shared cache mapping host UUID strings to whimsical display names.
Definition HostDisplayNameCache.hpp:41