ORE Studio 0.0.4
Loading...
Searching...
No Matches
PublishDatasetsDialog.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_PUBLISH_DATASETS_DIALOG_HPP
21#define ORES_QT_PUBLISH_DATASETS_DIALOG_HPP
22
23#include <vector>
24#include <QWizard>
25#include <QWizardPage>
26#include <QListWidget>
27#include <QComboBox>
28#include <QCheckBox>
29#include <QTableWidget>
30#include <QLabel>
31#include <QProgressBar>
32#include <boost/uuid/uuid.hpp>
33#include "ores.logging/make_logger.hpp"
34#include "ores.dq/domain/dataset.hpp"
35#include "ores.dq/domain/publication_mode.hpp"
36#include "ores.dq/domain/publication_result.hpp"
37
38namespace ores::qt {
39
40class ClientManager;
41
52class PublishDatasetsDialog final : public QWizard {
53 Q_OBJECT
54
55private:
56 inline static std::string_view logger_name = "ores.qt.publish_datasets_dialog";
57
58 [[nodiscard]] static auto& lg() {
59 using namespace ores::logging;
60 static auto instance = make_logger(logger_name);
61 return instance;
62 }
63
64public:
65signals:
73 void datasetsPublished(const QStringList& datasetCodes);
74
75public:
76 // Page IDs
77 enum PageId {
78 Page_Selection,
79 Page_Options,
80 Page_Review,
81 Page_Progress,
82 Page_Results
83 };
84
85 explicit PublishDatasetsDialog(
86 ClientManager* clientManager,
87 const QString& username,
88 QWidget* parent = nullptr);
89
90 ~PublishDatasetsDialog() override = default;
91
96 void setDatasets(const std::vector<dq::domain::dataset>& datasets);
97
98 // Accessors for wizard pages
99 ClientManager* clientManager() const { return clientManager_; }
100 const QString& username() const { return username_; }
101 const std::vector<dq::domain::dataset>& datasets() const { return datasets_; }
102 std::vector<dq::domain::dataset>& resolvedDatasets() { return resolvedDatasets_; }
103 std::vector<boost::uuids::uuid>& requestedIds() { return requestedIds_; }
104 std::vector<dq::domain::publication_result>& results() { return results_; }
105
106 // State accessors
107 dq::domain::publication_mode selectedMode() const;
108 bool resolveDependencies() const;
109
110private:
111 void setupPages();
112
113 ClientManager* clientManager_;
114 QString username_;
115 std::vector<dq::domain::dataset> datasets_; // Originally selected
116 std::vector<dq::domain::dataset> resolvedDatasets_; // Full list including deps
117 std::vector<boost::uuids::uuid> requestedIds_; // IDs explicitly requested
118 std::vector<dq::domain::publication_result> results_; // Publication results
119};
120
121// Forward declarations of page classes
122class SelectionPage;
123class OptionsPage;
124class ReviewPage;
125class ProgressPage;
126class ResultsPage;
127
131class SelectionPage final : public QWizardPage {
132 Q_OBJECT
133
134public:
135 explicit SelectionPage(PublishDatasetsDialog* wizard);
136 void initializePage() override;
137
138private:
139 PublishDatasetsDialog* wizard_;
140 QListWidget* datasetList_;
141 QLabel* countLabel_;
142};
143
147class OptionsPage final : public QWizardPage {
148 Q_OBJECT
149
150public:
151 explicit OptionsPage(PublishDatasetsDialog* wizard);
152
153 QComboBox* modeCombo() const { return modeCombo_; }
154 QCheckBox* resolveDependenciesCheck() const { return resolveDependenciesCheck_; }
155
156private:
157 PublishDatasetsDialog* wizard_;
158 QComboBox* modeCombo_;
159 QCheckBox* resolveDependenciesCheck_;
160};
161
165class ReviewPage final : public QWizardPage {
166 Q_OBJECT
167
168public:
169 explicit ReviewPage(PublishDatasetsDialog* wizard);
170 void initializePage() override;
171 bool isComplete() const override;
172
173private:
174 void resolveDependencies();
175 void updatePublicationOrder();
176
177 PublishDatasetsDialog* wizard_;
178 QTableWidget* orderTable_;
179 QLabel* summaryLabel_;
180 QLabel* statusLabel_;
181 bool resolved_ = false;
182};
183
187class ProgressPage final : public QWizardPage {
188 Q_OBJECT
189
190public:
191 explicit ProgressPage(PublishDatasetsDialog* wizard);
192 void initializePage() override;
193 bool isComplete() const override;
194 int nextId() const override;
195
196private:
197 void performPublish();
198
199 PublishDatasetsDialog* wizard_;
200 QLabel* statusLabel_;
201 QProgressBar* progressBar_;
202 QLabel* currentDatasetLabel_;
203 bool publishComplete_ = false;
204 bool publishSuccess_ = false;
205};
206
210class ResultsPage final : public QWizardPage {
211 Q_OBJECT
212
213public:
214 explicit ResultsPage(PublishDatasetsDialog* wizard);
215 void initializePage() override;
216
217private:
218 PublishDatasetsDialog* wizard_;
219 QTableWidget* resultsTable_;
220 QLabel* summaryLabel_;
221};
222
223}
224
225#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Wizard for publishing datasets from artefact tables to production.
Definition PublishDatasetsDialog.hpp:52
void datasetsPublished(const QStringList &datasetCodes)
Emitted when datasets are successfully published.
void setDatasets(const std::vector< dq::domain::dataset > &datasets)
Set the datasets to publish.
Definition PublishDatasetsDialog.cpp:72
Page showing the selected datasets.
Definition PublishDatasetsDialog.hpp:131
Page for configuring publication options.
Definition PublishDatasetsDialog.hpp:147
Page showing the resolved publication order.
Definition PublishDatasetsDialog.hpp:165
Page showing progress during publication.
Definition PublishDatasetsDialog.hpp:187
Page showing publication results.
Definition PublishDatasetsDialog.hpp:210