20#ifndef ORES_QT_CLIENT_ROLE_MODEL_HPP
21#define ORES_QT_CLIENT_ROLE_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.logging/make_logger.hpp"
28#include "ores.iam/domain/role.hpp"
42 inline static std::string_view logger_name =
43 "ores.qt.client_role_model";
45 [[nodiscard]]
static auto& lg() {
47 static auto instance = make_logger(logger_name);
53 QObject* parent =
nullptr);
57 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
58 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
59 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
60 QVariant headerData(
int section, Qt::Orientation orientation,
61 int role = Qt::DisplayRole)
const override;
81 std::vector<iam::domain::role>
getRoles()
const;
92 void loadError(
const QString& error_message,
const QString& details = {});
113 std::vector<iam::domain::role> roles;
114 QString error_message;
115 QString error_details;
118 using FutureWatcherResult = FetchResult;
120 ClientManager* clientManager_;
121 std::vector<iam::domain::role> roles_;
122 QFutureWatcher<FutureWatcherResult>* watcher_;
123 bool is_fetching_{
false};
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Represents a named collection of permissions that can be assigned to accounts.
Definition role.hpp:39
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Model for displaying roles fetched from the server via client.
Definition ClientRoleModel.hpp:38
void refresh()
Refresh role data from server asynchronously.
Definition ClientRoleModel.cpp:100
void dataLoaded()
Emitted when data has been successfully loaded.
std::vector< iam::domain::role > getRoles() const
Get all roles.
Definition ClientRoleModel.cpp:191
void loadError(const QString &error_message, const QString &details={})
Emitted when an error occurs during data loading.
const iam::domain::role * getRole(int row) const
Get role at the specified row.
Definition ClientRoleModel.cpp:184