Skip to content

Commit

Permalink
Refs #19533: Add Status view to layout
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Include problem callback backend connection

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Sync with statistics backend to obtain StatusData

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Take the samples and prepare a json structure

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Display the problem data in status layout

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Improve arrows based on internal feedback

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Include external QMLTreeView module

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Include external QMLTreeView module and adapt the tree with the required mechanisms

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Adapt model to use roles

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Include missing information through roles in the UI

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Add status icon and homogenize fonts

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Add incompatible qos policies links to documentation compatibility rules

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Fix first click issue in status footer and remove dead code

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Add view problem filter functionality

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Display entity issues counter on its right

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Avoid problem model destruction to avoid error messages when app closed

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Catch entity dispose and remove entity problems from model

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Update icons

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Fix visual details

Signed-off-by: JesusPoderoso <[email protected]>

Refs #19533: Fix error counting

Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Oct 24, 2023
1 parent 9da757e commit 0c2a1a1
Show file tree
Hide file tree
Showing 67 changed files with 2,941 additions and 110 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ set(PROJECT_HEADERS
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/statistics/EntityItem.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/SubListedListItem.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/SubListedListModel.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/tree/ProblemTreeItem.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/tree/ProblemTreeModel.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/tree/TreeItem.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/tree/TreeModel.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/statistics/DataChartBox.h
Expand Down Expand Up @@ -261,6 +263,8 @@ set(PROJECT_SOURCES_NO_MAIN
${PROJECT_SOURCE_DIR}/src/model/physical/ProcessModelItem.cpp
${PROJECT_SOURCE_DIR}/src/model/statistics/EntityItem.cpp
${PROJECT_SOURCE_DIR}/src/model/SubListedListModel.cpp
${PROJECT_SOURCE_DIR}/src/model/tree/ProblemTreeItem.cpp
${PROJECT_SOURCE_DIR}/src/model/tree/ProblemTreeModel.cpp
${PROJECT_SOURCE_DIR}/src/model/tree/TreeItem.cpp
${PROJECT_SOURCE_DIR}/src/model/tree/TreeModel.cpp
${PROJECT_SOURCE_DIR}/src/statistics/DataChartBox.cpp
Expand Down
4 changes: 4 additions & 0 deletions fastdds_monitor.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ SOURCES += \
src/model/physical/ProcessModelItem.cpp \
src/model/statistics/EntityItem.cpp \
src/model/SubListedListModel.cpp \
src/model/tree/ProblemTreeItem.cpp \
src/model/tree/ProblemTreeModel.cpp \
src/model/tree/TreeItem.cpp \
src/model/tree/TreeModel.cpp \
src/statistics/DataChartBox.cpp \
Expand Down Expand Up @@ -75,6 +77,8 @@ HEADERS += \
include/fastdds_monitor/model/statistics/EntityItem.h \
include/fastdds_monitor/model/SubListedListItem.h \
include/fastdds_monitor/model/SubListedListModel.h \
include/fastdds_monitor/model/tree/ProblemTreeModel.h \
include/fastdds_monitor/model/tree/ProblemTreeItem.h \
include/fastdds_monitor/model/tree/TreeItem.h \
include/fastdds_monitor/model/tree/TreeModel.h \
include/fastdds_monitor/statistics/DataChartBox.h \
Expand Down
14 changes: 14 additions & 0 deletions include/fastdds_monitor/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <QObject>
#include <QtCharts/QVXYModelMapper>

#include <fastdds_monitor/backend/backend_types.h>

class Engine;

enum class ErrorType : int
Expand Down Expand Up @@ -59,6 +61,15 @@ class Controller : public QObject
QString error_msg,
ErrorType error_type = ErrorType::GENERIC);

//! Status counters displayed in the QML
struct StatusCounters
{
std::map<backend::EntityId,uint32_t> errors;
std::map<backend::EntityId,uint32_t> warnings;
uint32_t total_errors = 0;
uint32_t total_warnings = 0;
} status_counters;

public slots:

// Methods to be called from QML
Expand Down Expand Up @@ -275,6 +286,9 @@ public slots:
//! Signal to inform qml that a new monitor has been initialized
void monitorInitialized();

//! Signal to notify status counters have been updated
void update_status_counters(QString errors, QString warnings);

protected:

//! Reference to \c Engine object
Expand Down
73 changes: 72 additions & 1 deletion include/fastdds_monitor/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QWaitCondition>

#include <fastdds_monitor/backend/Callback.h>
#include <fastdds_monitor/backend/ProblemCallback.h>
#include <fastdds_monitor/backend/Listener.h>
#include <fastdds_monitor/backend/Listener.h>
#include <fastdds_monitor/backend/SyncBackendConnection.h>
Expand All @@ -40,6 +41,7 @@
#include <fastdds_monitor/model/info/InfoModel.h>
#include <fastdds_monitor/statistics/dynamic/DynamicStatisticsData.h>
#include <fastdds_monitor/statistics/historic/HistoricStatisticsData.h>
#include <fastdds_monitor/model/tree/ProblemTreeModel.h>

struct EntityClicked
{
Expand Down Expand Up @@ -267,6 +269,13 @@ class Engine : public QQmlApplicationEngine
bool new_entity = true,
bool last_clicked = false);

bool update_problem(
const backend::EntityId& id,
backend::StatusKind kind);

bool update_problem_entities(
const backend::EntityId& id);

/**
* @brief Update the internal dds model with entities related with Entity referenced by \c id
*
Expand Down Expand Up @@ -348,6 +357,19 @@ class Engine : public QQmlApplicationEngine
bool add_callback(
backend::Callback callback);

/**
* @brief add a callback arrived from the backend to the callback queue
*
* Add a callback to the callback queue in order to process it afterwards by the main thread.
* Emit a signal that communicate the main thread that there are info to process in the callback queue.
* Add a callback issue.
*
* @param callback new callback to add
* @return true
*/
bool add_callback(
backend::ProblemCallback callback);

/**
* @brief Refresh the view
*
Expand Down Expand Up @@ -390,6 +412,14 @@ class Engine : public QQmlApplicationEngine
*/
void process_callback_queue();

/**
* @brief Pop problem callbacks from the callback queues while non empty and update the models
*
* @warning This method must be executed from the main Thread (or at least a QThread) so the models are
* updated in the view when modified.
*/
void process_problem_callback_queue();

//! Refresh summary panel
void refresh_summary();

Expand Down Expand Up @@ -507,14 +537,26 @@ class Engine : public QQmlApplicationEngine
*/
void new_callback_signal();

/**
* Internal signal that communicate that there are callbacks to process by the main Thread.
* Arise from \c add_callback
*/
void new_problem_callback_signal();

public slots:

/**
* Receive the internal signal \c new_callback_signal and start the process of
* Receive the internal signal \c new_callback_signal and start the process of problem
* callback queue by \c process_callback_queue
*/
void new_callback_slot();

/**
* Receive the internal signal \c new_problem_callback_signal and start the process of
* callback queue by \c process_problem_callback_queue
*/
void new_problem_callback_slot();

protected:

/**
Expand Down Expand Up @@ -570,6 +612,13 @@ public slots:
*/
bool fill_status_();

/**
* @brief Clear and fill the Problem Model
*
* @return true if any change in any model has been done
*/
bool fill_problem_();

//! Add a new callback message to the Log model
bool add_log_callback_(
std::string callback,
Expand Down Expand Up @@ -633,13 +682,23 @@ public slots:
//! True if there are callbacks in the callback queue
bool are_callbacks_to_process_();

//! True if there are problem callbacks in the callback queue
bool are_problem_callbacks_to_process_();

//! Pop a callback from callback queues and call \c read_callback for that callback
bool process_callback_();

//! Pop a problem callback from callback queues and call \c read_callback for that problem callback
bool process_problem_callback_();

//! Update the model concerned by the entity in the callback
bool read_callback_(
backend::Callback callback);

//! Update the model concerned by the entity in the problem callback
bool read_callback_(
backend::ProblemCallback callback);

//! Common method to demultiplex to update functions depending on the entity kind
bool update_entity_generic(
backend::EntityId entity_id,
Expand Down Expand Up @@ -695,6 +754,9 @@ public slots:
//! Data that is represented in the Status Model when this model is refreshed
backend::Info status_info_;

//! Data Model for Fast DDS Monitor problem view. Collects all entities problems detected by the monitor service
models::ProblemTreeModel* problem_model_;

//! TODO
models::ListModel* source_entity_id_model_;

Expand Down Expand Up @@ -722,9 +784,15 @@ public slots:
//! Mutex to protect \c callback_queue_
std::recursive_mutex callback_queue_mutex_;

//! Mutex to protect \c problem_callback_queue_
std::recursive_mutex problem_callback_queue_mutex_;

//! Queue of Callbacks that have arrived by the \c Listener and have not been processed
QQueue<backend::Callback> callback_queue_;

//! Queue of Problem Callbacks that have arrived by the \c Listener and have not been processed
QQueue<backend::ProblemCallback> problem_callback_queue_;

//! Object that manage all the communications with the QML view
Controller* controller_;

Expand All @@ -746,6 +814,9 @@ public slots:
* to happen) there are going to create entities already created.
*/
std::recursive_mutex initializing_monitor_;

//! All status log
backend::Info problem_status_log_;
};

#endif // _EPROSIMA_FASTDDS_MONITOR_ENGINE_H
6 changes: 6 additions & 0 deletions include/fastdds_monitor/backend/Listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ class Listener : public PhysicalListener
EntityId datawriter_id,
const Status& status) override;

//! Callback when a problem is reported
void on_problem_reported(
EntityId domain_id,
EntityId entity_id,
StatusKind data_kind) override;

protected:

//! Engine reference
Expand Down
60 changes: 60 additions & 0 deletions include/fastdds_monitor/backend/ProblemCallback.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// This file is part of eProsima Fast DDS Monitor.
//
// eProsima Fast DDS Monitor is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// eProsima Fast DDS Monitor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with eProsima Fast DDS Monitor. If not, see <https://www.gnu.org/licenses/>.

/**
* @file ProblemCallback.h
*/

#ifndef _EPROSIMA_FASTDDS_MONITOR_BACKEND_PROBLEM_CALLBACK_H
#define _EPROSIMA_FASTDDS_MONITOR_BACKEND_PROBLEM_CALLBACK_H

#include <fastdds_monitor/backend/backend_types.h>

namespace backend {

/*
* Struct that store the problem callback information required by the GUI.
* It encapsulates the domain id, entity id and the kind of the new problem reported.
*/
struct ProblemCallback
{
//! Void constructor to use copy constructor afterwards
ProblemCallback()
{
}

//! Standard constructor with the two fields required
ProblemCallback(
backend::EntityId domain_entity_id,
backend::EntityId entity_id,
backend::StatusKind status_kind)
: domain_entity_id(domain_entity_id)
, entity_id(entity_id)
, status_kind(status_kind)
{
}
//! Information of the domain \c EntityId the callback refers
backend::EntityId domain_entity_id;
//! Information of the \c EntityId the callback refers
backend::EntityId entity_id;
//! Information of the \c StatusKind the callback refers
backend::StatusKind status_kind;
};

} // namespace backend

#endif // _EPROSIMA_FASTDDS_MONITOR_BACKEND_PROBLEM_CALLBACK_H
37 changes: 37 additions & 0 deletions include/fastdds_monitor/backend/SyncBackendConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define _EPROSIMA_FASTDDS_MONITOR_BACKEND_SYNCBACKENDCONNECTION_H

#include <fastdds_statistics_backend/StatisticsBackend.hpp>
#include <fastdds_statistics_backend/types/types.hpp>

#include <fastdds_monitor/backend/backend_types.h>
#include <fastdds_monitor/backend/Listener.h>
Expand Down Expand Up @@ -147,6 +148,42 @@ class SyncBackendConnection
Timestamp start_time = Timestamp(),
Timestamp end_time = std::chrono::system_clock::now());

void get_status_data(
EntityId source_entity_id,
ConnectionListSample& sample);

void get_status_data(
EntityId source_entity_id,
DeadlineMissedSample& sample);

void get_status_data(
EntityId source_entity_id,
IncompatibleQosSample& sample);

void get_status_data(
EntityId source_entity_id,
InconsistentTopicSample& sample);

void get_status_data(
EntityId source_entity_id,
LivelinessChangedSample& sample);

void get_status_data(
EntityId source_entity_id,
LivelinessLostSample& sample);

void get_status_data(
EntityId source_entity_id,
ProxySample& sample);

void get_status_data(
EntityId source_entity_id,
SampleLostSample& sample);

/*void get_status_data(
EntityId source_entity_id,
StatusesSizeSample& sample);*/

//! Get info from an entity from the Backend
std::vector<EntityId> get_entities(
EntityKind entity_type,
Expand Down
17 changes: 17 additions & 0 deletions include/fastdds_monitor/backend/backend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,32 @@ namespace backend {
using EntityId = eprosima::statistics_backend::EntityId;
using EntityKind = eprosima::statistics_backend::EntityKind;
using DataKind = eprosima::statistics_backend::DataKind;
using StatusKind = eprosima::statistics_backend::StatusKind;
using StatisticKind = eprosima::statistics_backend::StatisticKind;
using EntityInfo = eprosima::statistics_backend::Info;
using Timestamp = eprosima::statistics_backend::Timestamp;

// Problem status types from backend
using ConnectionListSample = eprosima::statistics_backend::ConnectionListSample;
using DeadlineMissedSample = eprosima::statistics_backend::DeadlineMissedSample;
using IncompatibleQosSample = eprosima::statistics_backend::IncompatibleQosSample;
using InconsistentTopicSample = eprosima::statistics_backend::InconsistentTopicSample;
using LivelinessChangedSample = eprosima::statistics_backend::LivelinessChangedSample;
using LivelinessLostSample = eprosima::statistics_backend::LivelinessLostSample;
using ProxySample = eprosima::statistics_backend::ProxySample;
using SampleLostSample = eprosima::statistics_backend::SampleLostSample;
//using StatusesSizeSample = eprosima::statistics_backend::StatusesSizeSample;

//! Reference the ID_ALL in the project
extern const EntityId ID_ALL;
//! Reference the ID_NONE in the project
extern const EntityId ID_NONE;

//! Reference for problem status (ok, error or warning)
static constexpr const char* PROBLEM_STATUS_ERROR = "error";
static constexpr const char* PROBLEM_STATUS_OK = "ok";
static constexpr const char* PROBLEM_STATUS_WARNING = "warning";

} //namespace backend

#endif // _EPROSIMA_FASTDDS_MONITOR_BACKEND_BACKENDTYPES_H
Loading

0 comments on commit 0c2a1a1

Please sign in to comment.