ORE Studio 0.0.4
Loading...
Searching...
No Matches
PartyProvisioningWizard.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 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_PARTY_PROVISIONING_WIZARD_HPP
21#define ORES_QT_PARTY_PROVISIONING_WIZARD_HPP
22
23#include <QWizard>
24#include <QWizardPage>
25#include <QComboBox>
26#include <QLabel>
27#include <QProgressBar>
28#include <QTextEdit>
29#include <QListWidget>
30#include <optional>
31#include <cstdint>
32#include <vector>
33#include <string>
34#include "ores.logging/make_logger.hpp"
35#include "ores.qt/ClientManager.hpp"
36
37namespace ores::qt {
38
53class PartyProvisioningWizard final : public QWizard {
54 Q_OBJECT
55
56private:
57 inline static std::string_view logger_name =
58 "ores.qt.party_provisioning_wizard";
59
60 [[nodiscard]] static auto& lg() {
61 using namespace ores::logging;
62 static auto instance = make_logger(logger_name);
63 return instance;
64 }
65
66public:
67 enum PageId {
68 Page_Welcome,
69 Page_CounterpartySetup,
70 Page_OrganisationSetup,
71 Page_ReportSetup,
72 Page_ReportInstall,
73 Page_Summary
74 };
75
79 struct ReportSpec {
80 std::string name;
81 std::string description;
82 std::string schedule_expression;
83 std::string report_type;
84 std::string concurrency_policy;
85 };
86
88 ClientManager* clientManager,
89 QWidget* parent = nullptr);
90
91 ~PartyProvisioningWizard() override = default;
92
93 ClientManager* clientManager() const { return clientManager_; }
94
95 QString selectedBundleCode() const { return selectedBundleCode_; }
96 void setSelectedBundleCode(const QString& code) { selectedBundleCode_ = code; }
97
98 QString leiDatasetSize() const { return leiDatasetSize_; }
99 void setLeiDatasetSize(const QString& size) { leiDatasetSize_ = size; }
100
101 bool organisationPublished() const { return organisationPublished_; }
102 void setOrganisationPublished(bool v) { organisationPublished_ = v; }
103
104 std::vector<ReportSpec> selectedReports() const { return selectedReports_; }
105 void setSelectedReports(std::vector<ReportSpec> r) { selectedReports_ = std::move(r); }
106
113 [[nodiscard]] bool markPartyActive();
114
115signals:
116 void provisioningCompleted();
117
118private:
119 void setupPages();
120
121 ClientManager* clientManager_;
122 QString selectedBundleCode_ = "base";
123 QString leiDatasetSize_ = "small";
124 bool organisationPublished_ = false;
125 std::vector<ReportSpec> selectedReports_;
126};
127
128// Forward declarations
129class PartyWelcomePage;
130class PartyCounterpartySetupPage;
131class PartyOrganisationSetupPage;
132class PartyReportSetupPage;
133class PartyReportInstallPage;
134class PartyApplyAndSummaryPage;
135
139class PartyWelcomePage final : public QWizardPage {
140 Q_OBJECT
141
142public:
144
145private:
146 void setupUI();
148};
149
156class PartyCounterpartySetupPage final : public QWizardPage {
157 Q_OBJECT
158
159public:
161 bool validatePage() override;
162
163private:
164 void setupUI();
166 QComboBox* datasetSizeCombo_;
167};
168
172class PartyOrganisationSetupPage final : public QWizardPage {
173 Q_OBJECT
174
175private:
176 inline static std::string_view logger_name =
177 "ores.qt.party_organisation_setup_page";
178
179 [[nodiscard]] static auto& lg() {
180 using namespace ores::logging;
181 static auto instance = make_logger(logger_name);
182 return instance;
183 }
184
185public:
187 void initializePage() override;
188 bool isComplete() const override;
189
190private:
191 void startPublish();
192 void appendLog(const QString& message);
193
195 QLabel* statusLabel_;
196 QProgressBar* progressBar_;
197 QTextEdit* logOutput_;
198 bool publishComplete_ = false;
199 bool publishSuccess_ = false;
200};
201
205class PartyReportSetupPage final : public QWizardPage {
206 Q_OBJECT
207
208public:
210 bool validatePage() override;
211 int nextId() const override;
212
213private:
214 void setupUI();
215
217 QListWidget* reportList_;
218};
219
223class PartyReportInstallPage final : public QWizardPage {
224 Q_OBJECT
225
226private:
227 inline static std::string_view logger_name =
228 "ores.qt.party_report_install_page";
229
230 [[nodiscard]] static auto& lg() {
231 using namespace ores::logging;
232 static auto instance = make_logger(logger_name);
233 return instance;
234 }
235
236public:
238 void initializePage() override;
239 bool isComplete() const override;
240
241private:
242 void startInstall();
243 void appendLog(const QString& message);
244
246 QLabel* statusLabel_;
247 QProgressBar* progressBar_;
248 QTextEdit* logOutput_;
249 bool installComplete_ = false;
250 bool installSuccess_ = false;
251};
252
256class PartyApplyAndSummaryPage final : public QWizardPage {
257 Q_OBJECT
258
259private:
260 inline static std::string_view logger_name =
261 "ores.qt.party_apply_and_summary_page";
262
263 [[nodiscard]] static auto& lg() {
264 using namespace ores::logging;
265 static auto instance = make_logger(logger_name);
266 return instance;
267 }
268
269public:
271 void initializePage() override;
272
273private:
274 void setupUI();
275
277 QLabel* summaryLabel_;
278};
279
280}
281
282#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:112
Wizard for setting up a party after it has been created by tenant provisioning.
Definition PartyProvisioningWizard.hpp:53
bool markPartyActive()
Sets the current party's status to 'Active' via save_party_request.
Definition PartyProvisioningWizard.cpp:84
Specification for an initial report definition to create during provisioning.
Definition PartyProvisioningWizard.hpp:79
Welcome page for the party provisioning wizard.
Definition PartyProvisioningWizard.hpp:139
Page for selecting the GLEIF counterparty dataset size.
Definition PartyProvisioningWizard.hpp:156
Page for async publication of counterparties and organisation structure.
Definition PartyProvisioningWizard.hpp:172
Page for selecting which initial report definitions to create.
Definition PartyProvisioningWizard.hpp:205
Page that asynchronously creates the selected report definitions.
Definition PartyProvisioningWizard.hpp:223
Final summary page that clears the party setup flag.
Definition PartyProvisioningWizard.hpp:256