20#ifndef ORES_QT_CLIENT_DATASET_MODEL_HPP
21#define ORES_QT_CLIENT_DATASET_MODEL_HPP
25#include <QFutureWatcher>
26#include <QAbstractTableModel>
27#include "ores.qt/AbstractClientModel.hpp"
28#include <boost/uuid/uuid.hpp>
29#include <boost/uuid/uuid_io.hpp>
30#include "ores.qt/ClientManager.hpp"
31#include "ores.qt/ColumnMetadata.hpp"
32#include "ores.qt/RecencyPulseManager.hpp"
33#include "ores.qt/RecencyTracker.hpp"
34#include "ores.logging/make_logger.hpp"
35#include "ores.dq.api/domain/dataset.hpp"
39class ClientDatasetModel final :
public AbstractClientModel {
43 inline static std::string_view logger_name =
44 "ores.qt.client_dataset_model";
46 [[nodiscard]]
static auto& lg() {
48 static auto instance = make_logger(logger_name);
72 static constexpr int OriginRole = Qt::UserRole + 100;
73 static constexpr int NatureRole = Qt::UserRole + 101;
74 static constexpr int TreatmentRole = Qt::UserRole + 102;
81 static constexpr std::size_t kColumnCount = std::size_t(ColumnCount);
82 static constexpr std::array<ColumnMetadata, kColumnCount> kColumns = {{
85 .header = std::string_view(
"Name"),
87 .hidden_by_default =
false,
92 .header = std::string_view(
"Code"),
94 .hidden_by_default =
false,
99 .header = std::string_view(
"Catalog"),
101 .hidden_by_default =
false,
105 .column = SubjectArea,
106 .header = std::string_view(
"Subject Area"),
108 .hidden_by_default =
false,
113 .header = std::string_view(
"Domain"),
115 .hidden_by_default =
false,
120 .header = std::string_view(
"Origin"),
122 .hidden_by_default =
false,
127 .header = std::string_view(
"Nature"),
129 .hidden_by_default =
false,
134 .header = std::string_view(
"Treatment"),
136 .hidden_by_default =
false,
140 .column = SourceSystem,
141 .header = std::string_view(
"Source System"),
143 .hidden_by_default =
false,
148 .header = std::string_view(
"As Of Date"),
150 .hidden_by_default =
false,
155 .header = std::string_view(
"Version"),
157 .hidden_by_default =
false,
161 .column = ModifiedBy,
162 .header = std::string_view(
"Modified By"),
164 .hidden_by_default =
false,
168 .column = RecordedAt,
169 .header = std::string_view(
"Recorded At"),
171 .hidden_by_default =
false,
176 .header = std::string_view(
"Tags"),
178 .hidden_by_default =
false,
186 inline static const QSize kDefaultWindowSize = {900, 400};
191 static constexpr std::string_view kSettingsGroup =
"DatasetMdiWindow";
195 static std::vector<column_style>
const& columnStyles() {
196 static std::vector<column_style>
const kStylesVector = []() {
197 std::vector<column_style> result;
198 result.reserve(kColumnCount);
199 for (std::size_t i = 0; i < kColumnCount; ++i)
200 result.push_back(kColumns[i].style);
203 return kStylesVector;
210 static QVector<int>
const result =
211 ::ores::qt::defaultHiddenColumns<kColumnCount>(kColumns);
215 explicit ClientDatasetModel(ClientManager* clientManager,
216 QObject* parent =
nullptr);
217 ~ClientDatasetModel()
override =
default;
219 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
220 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
221 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
222 QVariant headerData(
int section, Qt::Orientation orientation,
223 int role = Qt::DisplayRole)
const override;
231 void onDatasetsLoaded();
232 void onPulseStateChanged(
bool isOn);
233 void onPulsingComplete();
236 QVariant recency_foreground_color(
const boost::uuids::uuid&
id)
const;
240 std::vector<dq::domain::dataset> datasets;
241 QString error_message;
242 QString error_details;
245 ClientManager* clientManager_;
246 std::vector<dq::domain::dataset> datasets_;
247 QFutureWatcher<FetchResult>* watcher_;
248 bool is_fetching_{
false};
251 RecencyTracker<dq::domain::dataset, DatasetKeyExtractor> recencyTracker_;
252 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
QVector< int > defaultHiddenColumns(const std::array< ColumnMetadata, N > &columns)
Builds a QVector of hidden column indices from a metadata array.
Definition ColumnMetadata.hpp:99
constexpr int kColumnWidthAuto
Sentinel value for column default width meaning "auto-size to contents".
Definition ColumnMetadata.hpp:38
@ mono_center
Monospace, centered.
@ text_left
Proportional font, left-aligned (default).
@ mono_left
Monospace, left-aligned.
Represents a data quality dataset with lineage tracking.
Definition dataset.hpp:37