Skip to content

Commit

Permalink
Status layout with problems per entity (#204)
Browse files Browse the repository at this point in the history
* Refs #19533: Add Status view to layout

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]>

Refs #19533: Adapt changes

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

* Refs #19533: Improve disable view of chart layout button

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

* Fix mock build issue

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

* Fix visual details

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

* Display entity information when clicked in status layout

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

* Refs #19533: Fix warning visual issue

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

* Refs #19533: Add filter to status layout properly

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

* Refs #19743: Fix topic filtering visual bugs

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

* Refs #19743: Add load model check for empty filter

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

* Refs #19743: [ARS] Set Backend status references

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

* Refs #19743: [ARS] Delete debug comment

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

* Refs #19743: [ARS] Rename all problems to statuses

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

* Refs #19743: [ARS] Improve comments

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

* Refs #19743: [ARS] Minor sugestions

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

* Refs #19743: [ARS] Improve entity status assignments

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

* Refs #19743: [ARS] Add missing problem sample 'Liveliness changed'

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

* Refs #19743: [ARS] Improve error / warning counter update and update left panel info when problem reported

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

* Refs #19743: [ARS] Rename method

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

* Refs #19743: [ARS] QML minor changes

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

* Refs #19743: [ARS] Improve graph connections section

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

* Refs #19743: [ARS] Fix style in the imported qml files

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

* Refs #19743: [ARS] Remove unnecessary dead code

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

* Refs #19743: [ARS] Remove unnecessary method

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

* Refs #19743: [ARS] Refactor tree model filtering

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

* Refs #19743: [ARS] Remove info dead code

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

* Refs #19743: [ARS] Improve StatusLayout.qml comments

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

* Refs #19743: [ARS] Improve pointers deletion

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

* Refs #19743: Refactor model roles to use direct get methods

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

* Refs #19743: [ALRS] Rename 'copy' model method as 'filtered_copy'

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

* Refs #19743: [ALRS] Remove repeated description in problems

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

* Refs #19743: [ALRS] Rename domain graph public property entity id as 'domain_entity_id'

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

* Refs #19743: [ALRS] Improve status counter anchoring to avoid overlapping numbers and icons

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

* Refs #19743: [ALRS] Improve status sample kind usage

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

* Refs #19743: [ALRS] Treat entity status model status as StatusLevel instead of as boolean

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

* Refs #19743: [ALRS] Comment typo

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

* Refs #19743: [ARS] Improve entity info update when new status reported

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

* Refs #19743: [ARS] Remove unnecessary error check

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

* Refs #19743: [ARS] Get Status Level string from sources (backend)

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

* Refs #19743: [ARS] Fix visual bug with expand/collapse status layout icon

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

* Refs #19743: [ARS] Fix timer flow

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

* Refs #19743: [ARS] Add try-catch in get_status_data

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

* Refs #19743: [ARS] Fix timer

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

* Refs #19743: [ARS] Fix left panel focus

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

---------

Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Dec 12, 2023
1 parent 28ade30 commit 32fc463
Show file tree
Hide file tree
Showing 73 changed files with 4,259 additions and 257 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/StatusTreeItem.h
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/model/tree/StatusTreeModel.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/StatusTreeItem.cpp
${PROJECT_SOURCE_DIR}/src/model/tree/StatusTreeModel.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/StatusTreeItem.cpp \
src/model/tree/StatusTreeModel.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/StatusTreeModel.h \
include/fastdds_monitor/model/tree/StatusTreeItem.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;
int32_t total_errors = 0;
int32_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
85 changes: 82 additions & 3 deletions include/fastdds_monitor/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
#include <QWaitCondition>

#include <fastdds_monitor/backend/Callback.h>
#include <fastdds_monitor/backend/Listener.h>
#include <fastdds_monitor/backend/StatusCallback.h>
#include <fastdds_monitor/backend/Listener.h>
#include <fastdds_monitor/backend/SyncBackendConnection.h>
#include <fastdds_monitor/Controller.h>
#include <fastdds_monitor/model/tree/TreeModel.h>
#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/StatusTreeModel.h>

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

/**
* @brief Update the entity status model with the status kind received
*
* @param id entity id
* @param kind StatusKind reported
* @return true if any change in model has been done
*/
bool update_entity_status(
const backend::EntityId& id,
backend::StatusKind kind);

/**
* @brief Update the entity status counters and populate the model with empty message if empty
*
* @param id entity id
* @return false
*/
bool remove_inactive_entities_from_status_model(
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 +369,19 @@ class Engine : public QQmlApplicationEngine
bool add_callback(
backend::Callback callback);

/**
* @brief add a status callback arrived from the backend to the status callback queue
*
* Add a status callback to the status 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 status callback queue.
* Add a status callback issue.
*
* @param callback new status callback to add
* @return true
*/
bool add_callback(
backend::StatusCallback callback);

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

/**
* @brief Pop status callbacks from the status 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_status_callback_queue();

//! Refresh summary panel
void refresh_summary();

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

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

public slots:

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

/**
* Receive the internal signal \c new_status_callback_signal and start the process of status
* callback queue by \c process_status_callback_queue
*/
void new_status_callback_slot();

protected:

/**
Expand Down Expand Up @@ -633,13 +687,23 @@ public slots:
//! True if there are callbacks in the callback queue
bool are_callbacks_to_process_();

//! True if there are status callbacks in the callback queue
bool are_status_callbacks_to_process_();

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

//! Pop a status callback from callback queues and call \c read_callback for that status callback
bool process_status_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 status callback
bool read_callback_(
backend::StatusCallback 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 +759,12 @@ 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 status view. Collects all entities statuses detected by the monitor service
models::StatusTreeModel* entity_status_model_;

//! Display and allow to filter Model for Fast DDS Monitor status view.
models::StatusTreeModel* entity_status_proxy_model_;

//! TODO
models::ListModel* source_entity_id_model_;

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

//! Mutex to protect \c status_callback_queue_
std::recursive_mutex status_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 status Callbacks that have arrived by the \c Listener and have not been processed
QQueue<backend::StatusCallback> status_callback_queue_;

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

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

//! All status log
backend::Info status_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 status is reported
void on_status_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/StatusCallback.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 StatusCallback.h
*/

#ifndef _EPROSIMA_FASTDDS_MONITOR_BACKEND_STATUS_CALLBACK_H
#define _EPROSIMA_FASTDDS_MONITOR_BACKEND_STATUS_CALLBACK_H

#include <fastdds_monitor/backend/backend_types.h>

namespace backend {

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

//! Standard constructor with the two fields required
StatusCallback(
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_STATUS_CALLBACK_H
45 changes: 45 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 @@ -116,6 +117,14 @@ class SyncBackendConnection
std::string get_name(
backend::EntityId id);

//! Get the alias of an entity from the Backend by calling \c get_info
std::string get_alias(
backend::EntityId id);

//! Get the status level of an entity from the Backend by calling \c get_status
StatusLevel get_status(
backend::EntityId id);

//! Get the alive status of an entity from the Backend by calling \c is_active
bool get_alive(
backend::EntityId id);
Expand Down Expand Up @@ -147,6 +156,42 @@ class SyncBackendConnection
Timestamp start_time = Timestamp(),
Timestamp end_time = std::chrono::system_clock::now());

bool get_status_data(
EntityId source_entity_id,
ConnectionListSample& sample);

bool get_status_data(
EntityId source_entity_id,
DeadlineMissedSample& sample);

bool get_status_data(
EntityId source_entity_id,
IncompatibleQosSample& sample);

bool get_status_data(
EntityId source_entity_id,
InconsistentTopicSample& sample);

bool get_status_data(
EntityId source_entity_id,
LivelinessChangedSample& sample);

bool get_status_data(
EntityId source_entity_id,
LivelinessLostSample& sample);

bool get_status_data(
EntityId source_entity_id,
ProxySample& sample);

bool get_status_data(
EntityId source_entity_id,
SampleLostSample& sample);

/*bool 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
Loading

0 comments on commit 32fc463

Please sign in to comment.