20#ifndef ORES_QT_CLIENT_HOST_MODEL_HPP
21#define ORES_QT_CLIENT_HOST_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/AbstractClientModel.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/RecencyPulseManager.hpp"
29#include "ores.qt/RecencyTracker.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.compute.api/domain/host.hpp"
45 inline static std::string_view logger_name =
46 "ores.qt.client_host_model";
48 [[nodiscard]]
static auto& lg() {
50 static auto instance = make_logger(logger_name);
73 QObject* parent =
nullptr);
77 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
78 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
79 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
80 QVariant headerData(
int section, Qt::Orientation orientation,
81 int role = Qt::DisplayRole)
const override;
99 void load_page(std::uint32_t offset, std::uint32_t limit);
126 void onHostsLoaded();
127 void onPulseStateChanged(
bool isOn);
128 void onPulsingComplete();
131 QVariant recency_foreground_color(
const std::string& code)
const;
135 std::vector<compute::domain::host> hosts;
136 std::uint32_t total_available_count;
137 QString error_message;
138 QString error_details;
141 void fetch_hosts(std::uint32_t offset, std::uint32_t limit);
143 ClientManager* clientManager_;
144 std::vector<compute::domain::host> hosts_;
145 QFutureWatcher<FetchResult>* watcher_;
146 std::uint32_t page_size_{100};
147 std::uint32_t total_available_count_{0};
148 bool is_fetching_{
false};
151 RecencyTracker<compute::domain::host, HostKeyExtractor> recencyTracker_;
152 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 registered compute node in the distributed grid.
Definition host.hpp:36
Base class for all client-side entity models.
Definition AbstractClientModel.hpp:36
Model for displaying compute hosts fetched from the server.
Definition ClientHostModel.hpp:41
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientHostModel.cpp:285
void refresh()
Refresh compute host data from server asynchronously.
Definition ClientHostModel.cpp:152
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientHostModel.hpp:114
const compute::domain::host * getHost(int row) const
Get compute host at the specified row.
Definition ClientHostModel.cpp:297
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of data.
Definition ClientHostModel.cpp:178
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientHostModel.hpp:104
Column
Enumeration of table columns for type-safe column access.
Definition ClientHostModel.hpp:58
@ DisplayName
Whimsical name; UUID in Qt::ToolTipRole.
Definition ClientHostModel.hpp:59
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109