ORE Studio 0.0.4
Loading...
Searching...
No Matches
ServiceDashboardMdiWindow.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_SERVICE_DASHBOARD_MDI_WINDOW_HPP
21#define ORES_QT_SERVICE_DASHBOARD_MDI_WINDOW_HPP
22
23#include <string>
24#include <vector>
25#include <QTimer>
26#include <QLabel>
27#include <QWidget>
28#include <QAction>
29#include <QSpinBox>
30#include <QToolBar>
31#include <QGroupBox>
32#include <QSplitter>
33#include <QPushButton>
34#include <QTableWidget>
35#include <QVBoxLayout>
36#include <QCloseEvent>
37#include "ores.qt/ClientManager.hpp"
38#include "ores.logging/make_logger.hpp"
39#include "ores.controller.api/domain/service_definition.hpp"
40
41namespace ores::qt {
42
53class ServiceDashboardMdiWindow final : public QWidget {
54 Q_OBJECT
55
56private:
57 inline static std::string_view logger_name =
58 "ores.qt.service_dashboard_mdi_window";
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:
68 ClientManager* clientManager,
69 QWidget* parent = nullptr);
70 ~ServiceDashboardMdiWindow() override = default;
71
72 QSize sizeHint() const override {
73 return savedWindowSize_.isValid() ? savedWindowSize_ : QSize{900, 600};
74 }
75
76protected:
77 void closeEvent(QCloseEvent* event) override;
78
79public slots:
80 void refresh();
81
82signals:
83 void statusChanged(const QString& message);
84 void errorOccurred(const QString& error_message);
85
86private slots:
87 void onRefreshToggled(bool checked);
88 void onRowSelected(int row);
89 void onApplyReplicas();
90 void onStopService();
91 void onRestartService();
92
93private:
94 void setupUi();
95 void setupToolbar();
96 void loadSamples();
97 void loadInstanceDetails(const QString& serviceName);
98
99 ClientManager* clientManager_;
100
101 QToolBar* toolbar_;
102 QAction* refreshAction_;
103 QAction* autoRefreshAction_;
104
105 // Overview table (one row per service)
106 QTableWidget* table_;
107
108 // Detail panel
109 QGroupBox* detailGroup_;
110 QLabel* detailServiceLabel_;
111 QSpinBox* replicasSpinBox_;
112 QPushButton* applyReplicasButton_;
113 QPushButton* stopButton_;
114 QPushButton* restartButton_;
115 QTableWidget* detailTable_;
116
117 QSplitter* splitter_;
118 QTimer* autoRefreshTimer_;
119 QSize savedWindowSize_;
120
121 std::string selectedServiceName_;
122 std::vector<controller::api::domain::service_definition> serviceDefinitions_;
123};
124
125}
126
127#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
MDI window showing the live status of all running services.
Definition ServiceDashboardMdiWindow.hpp:53