ORE Studio 0.0.4
Loading...
Searching...
No Matches
WorkunitDetailDialog.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_WORKUNIT_DETAIL_DIALOG_HPP
21#define ORES_QT_WORKUNIT_DETAIL_DIALOG_HPP
22
23#include <QUrl>
24#include <QString>
25#include <vector>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.qt/DetailDialogBase.hpp"
28#include "ores.logging/make_logger.hpp"
29#include "ores.compute.api/domain/batch.hpp"
30#include "ores.compute.api/domain/app_version.hpp"
31#include "ores.compute.api/domain/workunit.hpp"
32
33namespace Ui {
34class WorkunitDetailDialog;
35}
36
37namespace ores::qt {
38
47 Q_OBJECT
48
49private:
50 inline static std::string_view logger_name =
51 "ores.qt.workunit_detail_dialog";
52
53 [[nodiscard]] static auto& lg() {
54 using namespace ores::logging;
55 static auto instance = make_logger(logger_name);
56 return instance;
57 }
58
59public:
60 explicit WorkunitDetailDialog(QWidget* parent = nullptr);
61 ~WorkunitDetailDialog() override;
62
63 void setClientManager(ClientManager* clientManager);
64 void setUsername(const std::string& username);
65 void setHttpBaseUrl(const std::string& url);
66 void setWorkunit(const compute::domain::workunit& workunit);
67 void setCreateMode(bool createMode);
68 void setReadOnly(bool readOnly);
69
70signals:
71 void workunitSaved(const QString& id);
72 void workunitDeleted(const QString& id);
73
74private slots:
75 void onSaveClicked();
76 void onDeleteClicked();
77 void onFieldChanged();
78 void onBrowseInputClicked();
79 void onBrowseConfigClicked();
80
81protected:
82 QTabWidget* tabWidget() const override;
83 QWidget* provenanceTab() const override;
84 ProvenanceWidget* provenanceWidget() const override;
85 bool hasUnsavedChanges() const override { return hasChanges_; }
86
87private:
88 struct IdEntry {
89 std::string id;
90 std::string label;
91 };
92
93 void setupUi();
94 void setupConnections();
95 void loadBatches();
96 void loadAppVersions();
97 void populateBatchCombo();
98 void populateAppVersionCombo();
99 void updateUiFromWorkunit();
100 void updateWorkunitFromUi();
101 void updateSaveButtonState();
102 bool validateInput();
103 void saveWorkunitViaNats();
104
105 Ui::WorkunitDetailDialog* ui_;
106 ClientManager* clientManager_;
107 std::string username_;
108 QUrl httpBaseUrl_;
110 std::vector<IdEntry> batchEntries_;
111 std::vector<IdEntry> appVersionEntries_;
112 QString selectedInputFilePath_;
113 QString selectedConfigFilePath_;
114 bool createMode_{true};
115 bool readOnly_{false};
116 bool hasChanges_{false};
117};
118
119}
120
121#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
An abstract job template within a compute batch.
Definition workunit.hpp:36
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:74
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:39
Dialog for submitting a new workunit to the compute grid.
Definition WorkunitDetailDialog.hpp:46
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition WorkunitDetailDialog.cpp:68
bool hasUnsavedChanges() const override
Definition WorkunitDetailDialog.hpp:85
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition WorkunitDetailDialog.cpp:60
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition WorkunitDetailDialog.cpp:64