ORE Studio 0.0.4
Loading...
Searching...
No Matches
ClientDatasetDependencyModel.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_CLIENT_DATASET_DEPENDENCY_MODEL_HPP
21#define ORES_QT_CLIENT_DATASET_DEPENDENCY_MODEL_HPP
22
23#include <QAbstractTableModel>
24#include <vector>
25#include "ores.dq.api/domain/dataset_dependency.hpp"
26#include "ores.qt/AbstractClientModel.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.logging/make_logger.hpp"
29
30namespace ores::qt {
31
39 Q_OBJECT
40
41private:
42 inline static std::string_view logger_name =
43 "ores.qt.client_dataset_dependency_model";
44
45 [[nodiscard]] static auto& lg() {
46 using namespace ores::logging;
47 static auto instance = make_logger(logger_name);
48 return instance;
49 }
50
51public:
52 enum Column {
53 DatasetCode = 0,
54 DependencyCode,
55 Role,
56 ModifiedBy,
57 RecordedAt,
58 ColumnCount
59 };
60
61 explicit ClientDatasetDependencyModel(ClientManager* clientManager,
62 QObject* parent = nullptr);
63
64 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
65 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
66 QVariant data(const QModelIndex& index,
67 int role = Qt::DisplayRole) const override;
68 QVariant headerData(int section, Qt::Orientation orientation,
69 int role = Qt::DisplayRole) const override;
70
71 void loadData();
72 void loadDataByDataset(const std::string& dataset_code);
73
74 const std::vector<dq::domain::dataset_dependency>& dependencies() const;
75
82 std::vector<dq::domain::dataset_dependency>
83 dependenciesForDataset(const std::string& dataset_code) const;
84
85signals:
86 void loadStarted();
87 void loadFinished();
88 void errorOccurred(const QString& message, const QString& details = {});
89
90private:
91 ClientManager* clientManager_;
92 std::vector<dq::domain::dataset_dependency> dependencies_;
93};
94
95}
96
97#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Base class for all client-side entity models.
Definition AbstractClientModel.hpp:37
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Table model for displaying dataset dependencies.
Definition ClientDatasetDependencyModel.hpp:38
std::vector< dq::domain::dataset_dependency > dependenciesForDataset(const std::string &dataset_code) const
Gets dependencies for a specific dataset from the loaded data.
Definition ClientDatasetDependencyModel.cpp:246