20#ifndef ORES_QT_ORE_IMPORT_WIZARD_HPP
21#define ORES_QT_ORE_IMPORT_WIZARD_HPP
26#include <boost/uuid/uuid.hpp>
32#include <QProgressBar>
34#include <QRadioButton>
42#include "ores.logging/make_logger.hpp"
43#include "ores.qt/ClientManager.hpp"
44#include "ores.ore/scanner/scan_result.hpp"
45#include "ores.ore/planner/import_choices.hpp"
46#include "ores.ore/planner/ore_import_plan.hpp"
47#include "ores.refdata.api/domain/book.hpp"
48#include "ores.ore.api/messaging/ore_import_protocol.hpp"
68 inline static std::string_view logger_name =
"ores.qt.ore_import_wizard";
70 [[nodiscard]]
static auto& lg() {
72 static auto instance = make_logger(logger_name);
88 std::optional<boost::uuids::uuid> targetBookId = std::nullopt,
89 const std::string& targetBookName =
"",
90 QWidget* parent =
nullptr);
92 const std::string& targetBookName()
const {
return targetBookName_; }
95 ClientManager* clientManager()
const {
return clientManager_; }
105 void setOreDir(std::filesystem::path dir) { ore_dir_ = std::move(dir); }
106 const std::filesystem::path& oreDir()
const {
return ore_dir_; }
109 void setHttpBaseUrl(std::string url) { http_base_url_ = std::move(url); }
110 const std::string& httpBaseUrl()
const {
return http_base_url_; }
114 import_response_ = std::move(response);
115 importSuccess_ = import_response_.success;
116 importError_ = QString::fromStdString(import_response_.message);
118 bool importSuccess()
const {
return importSuccess_; }
119 QString importError()
const {
return importError_; }
121 return import_response_;
125 const std::set<std::string>& existingIsoCodes()
const {
return existingIsoCodes_; }
126 void setExistingIsoCodes(std::set<std::string> codes) {
127 existingIsoCodes_ = std::move(codes);
131 const std::vector<std::string>& existingPortfolioNames()
const {
132 return existingPortfolioNames_;
134 void setExistingPortfolioNames(std::vector<std::string> names) {
135 existingPortfolioNames_ = std::move(names);
142 std::string targetBookName_;
146 std::set<std::string> existingIsoCodes_;
147 std::vector<std::string> existingPortfolioNames_;
149 std::filesystem::path ore_dir_;
150 std::string http_base_url_;
152 bool importSuccess_ =
false;
153 QString importError_;
160class OreWelcomePage final :
public QWizardPage {
168class OreDirectoryPage final :
public QWizardPage {
172 inline static std::string_view logger_name =
"ores.qt.ore_directory_page";
173 [[nodiscard]]
static auto& lg() {
175 static auto instance = make_logger(logger_name);
180 explicit OreDirectoryPage(OreImportWizard* wizard);
181 bool isComplete()
const override;
182 bool validatePage()
override;
185 void onBrowseClicked();
186 void onScanFinished();
191 OreImportWizard* wizard_;
193 QPushButton* browseBtn_;
194 QLabel* statusLabel_;
195 QProgressBar* progressBar_;
196 bool scanComplete_ =
false;
197 bool scanning_ =
false;
200class OreScanSummaryPage final :
public QWizardPage {
203 explicit OreScanSummaryPage(OreImportWizard* wizard);
204 void initializePage()
override;
207 void onExclusionAdded();
208 void onExclusionRemoved();
211 void refreshSummary();
213 OreImportWizard* wizard_;
214 QLabel* summaryLabel_;
215 QListWidget* exclusionList_;
216 QLineEdit* exclusionEdit_;
217 QPushButton* addBtn_;
218 QPushButton* removeBtn_;
219 QLabel* hierarchyLabel_;
222class OreCurrencyPage final :
public QWizardPage {
226 inline static std::string_view logger_name =
"ores.qt.ore_currency_page";
227 [[nodiscard]]
static auto& lg() {
229 static auto instance = make_logger(logger_name);
234 explicit OreCurrencyPage(OreImportWizard* wizard);
235 void initializePage()
override;
238 void onFetchFinished();
239 void onModeChanged();
242 OreImportWizard* wizard_;
243 QRadioButton* allRadio_;
244 QRadioButton* missingRadio_;
245 QLabel* statusLabel_;
247 bool fetchDone_ =
false;
250class OrePortfolioPage final :
public QWizardPage {
254 inline static std::string_view logger_name =
"ores.qt.ore_portfolio_page";
255 [[nodiscard]]
static auto& lg() {
257 static auto instance = make_logger(logger_name);
262 explicit OrePortfolioPage(OreImportWizard* wizard);
263 void initializePage()
override;
264 bool isComplete()
const override;
265 bool validatePage()
override;
268 void onBookSelectionChanged();
269 void onBooksFetchFinished();
272 OreImportWizard* wizard_;
273 QComboBox* parentCombo_;
274 QLabel* hierarchyPreviewLabel_;
275 bool fetchDone_ =
false;
277 std::map<std::string, refdata::domain::book> booksByName_;
280class OreTradeImportPage final :
public QWizardPage {
284 inline static std::string_view logger_name =
"ores.qt.ore_trade_import_page";
285 [[nodiscard]]
static auto& lg() {
287 static auto instance = make_logger(logger_name);
292 explicit OreTradeImportPage(OreImportWizard* wizard);
293 void initializePage()
override;
294 bool isComplete()
const override;
295 bool validatePage()
override;
298 void onActivityTypesFetchFinished();
299 void onCounterpartiesFetchFinished();
300 void onImportFinished();
304 void appendLog(
const QString& msg);
306 OreImportWizard* wizard_;
307 QLineEdit* tradeDateEdit_;
308 QComboBox* lifecycleEventCombo_;
309 QComboBox* defaultCounterpartyCombo_;
310 QLabel* counterpartyStatusLabel_;
311 QLabel* statusLabel_;
312 QProgressBar* progressBar_;
313 QTextEdit* logOutput_;
314 bool importDone_ =
false;
315 bool importStarted_ =
false;
318class OreDonePage final :
public QWizardPage {
321 explicit OreDonePage(OreImportWizard* wizard);
322 void initializePage()
override;
324 void setupIdRow(QWidget* container, QLabel* label, QLineEdit* edit,
325 QPushButton* copyBtn,
const QString& labelText);
327 OreImportWizard* wizard_;
328 QLabel* summaryLabel_;
331 QWidget* workflowIdRow_ =
nullptr;
332 QLineEdit* workflowIdEdit_ =
nullptr;
333 QWidget* correlIdRow_ =
nullptr;
334 QLineEdit* correlIdEdit_ =
nullptr;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Response for an ore_import_request.
Definition ore_import_protocol.hpp:64
User-supplied choices that drive the import plan.
Definition import_choices.hpp:69
Complete, ready-to-execute import plan produced by ore_import_planner.
Definition ore_import_plan.hpp:37
Result of scanning an ORE directory for importable files.
Definition scan_result.hpp:31
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
7-page wizard for importing ORE directory data into OreStudio.
Definition OreImportWizard.hpp:64