From 6b54d83cc3a0a8687027662680850bcf84506222 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 21 Feb 2018 13:45:37 +0100 Subject: Pass around the message's entities in the log view --- framework/src/sinkfabric.cpp | 5 +++++ views/log/qml/View.qml | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp index 7d780ce3..b2281a5d 100644 --- a/framework/src/sinkfabric.cpp +++ b/framework/src/sinkfabric.cpp @@ -152,6 +152,11 @@ public: QVariantMap message; if (notification.type == Sink::Notification::Warning) { message["type"] = "warning"; + QStringList entities; + for(const auto &entity : notification.entities) { + entities << QString{entity}; + } + message["entities"] = entities; message["resource"] = QString{notification.resource}; if (notification.code == Sink::ApplicationDomain::TransmissionError) { message["message"] = QObject::tr("Failed to send message."); diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 14e2d543..df9e882f 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml @@ -45,7 +45,7 @@ Controls.SplitView { if (message.type == Kube.Notifications.error) { root.pendingError = true } - var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource} + var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource, entities: message.entities} if (logModel.count > 0) { var lastEntry = logModel.get(0) //Merge if we get an entry of the same subtype @@ -89,6 +89,8 @@ Controls.SplitView { } else { details.subtype = "" } + + details.entities = error.entities } delegate: Kube.ListDelegate { @@ -145,6 +147,7 @@ Controls.SplitView { property date timestamp property string message: "" property string resourceId: "" + property var entities: [] Kube.ModelIndexRetriever { id: retriever @@ -166,6 +169,7 @@ Controls.SplitView { property string resourceId: details.resourceId property string accountId: retriever.currentData ? retriever.currentData.accountId : "" property string accountName: retriever.currentData ? retriever.currentData.name : "" + property var entities: details.entities function getComponent(subtype) { if (subtype == Kube.Notifications.loginError) { @@ -348,7 +352,7 @@ Controls.SplitView { } Kube.Label { id: subHeadline - text: accountName + text: "Account: " + accountName + "\nMessage-Id: " + entities[0]; color: Kube.Colors.disabledTextColor wrapMode: Text.Wrap } -- cgit v1.2.3