diff options
author | Minijackson <minijackson@riseup.net> | 2018-02-21 13:45:37 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-02-26 14:42:42 +0100 |
commit | 6b54d83cc3a0a8687027662680850bcf84506222 (patch) | |
tree | 1b346050d2361630159626225b77cf88713a3de8 | |
parent | 0b27ee6df7588a1a1a7c86a888498ffa50b0e115 (diff) | |
download | kube-6b54d83cc3a0a8687027662680850bcf84506222.tar.gz kube-6b54d83cc3a0a8687027662680850bcf84506222.zip |
Pass around the message's entities in the log view
-rw-r--r-- | framework/src/sinkfabric.cpp | 5 | ||||
-rw-r--r-- | 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: | |||
152 | QVariantMap message; | 152 | QVariantMap message; |
153 | if (notification.type == Sink::Notification::Warning) { | 153 | if (notification.type == Sink::Notification::Warning) { |
154 | message["type"] = "warning"; | 154 | message["type"] = "warning"; |
155 | QStringList entities; | ||
156 | for(const auto &entity : notification.entities) { | ||
157 | entities << QString{entity}; | ||
158 | } | ||
159 | message["entities"] = entities; | ||
155 | message["resource"] = QString{notification.resource}; | 160 | message["resource"] = QString{notification.resource}; |
156 | if (notification.code == Sink::ApplicationDomain::TransmissionError) { | 161 | if (notification.code == Sink::ApplicationDomain::TransmissionError) { |
157 | message["message"] = QObject::tr("Failed to send message."); | 162 | 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 { | |||
45 | if (message.type == Kube.Notifications.error) { | 45 | if (message.type == Kube.Notifications.error) { |
46 | root.pendingError = true | 46 | root.pendingError = true |
47 | } | 47 | } |
48 | var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource} | 48 | var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource, entities: message.entities} |
49 | if (logModel.count > 0) { | 49 | if (logModel.count > 0) { |
50 | var lastEntry = logModel.get(0) | 50 | var lastEntry = logModel.get(0) |
51 | //Merge if we get an entry of the same subtype | 51 | //Merge if we get an entry of the same subtype |
@@ -89,6 +89,8 @@ Controls.SplitView { | |||
89 | } else { | 89 | } else { |
90 | details.subtype = "" | 90 | details.subtype = "" |
91 | } | 91 | } |
92 | |||
93 | details.entities = error.entities | ||
92 | } | 94 | } |
93 | 95 | ||
94 | delegate: Kube.ListDelegate { | 96 | delegate: Kube.ListDelegate { |
@@ -145,6 +147,7 @@ Controls.SplitView { | |||
145 | property date timestamp | 147 | property date timestamp |
146 | property string message: "" | 148 | property string message: "" |
147 | property string resourceId: "" | 149 | property string resourceId: "" |
150 | property var entities: [] | ||
148 | 151 | ||
149 | Kube.ModelIndexRetriever { | 152 | Kube.ModelIndexRetriever { |
150 | id: retriever | 153 | id: retriever |
@@ -166,6 +169,7 @@ Controls.SplitView { | |||
166 | property string resourceId: details.resourceId | 169 | property string resourceId: details.resourceId |
167 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" | 170 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" |
168 | property string accountName: retriever.currentData ? retriever.currentData.name : "" | 171 | property string accountName: retriever.currentData ? retriever.currentData.name : "" |
172 | property var entities: details.entities | ||
169 | 173 | ||
170 | function getComponent(subtype) { | 174 | function getComponent(subtype) { |
171 | if (subtype == Kube.Notifications.loginError) { | 175 | if (subtype == Kube.Notifications.loginError) { |
@@ -348,7 +352,7 @@ Controls.SplitView { | |||
348 | } | 352 | } |
349 | Kube.Label { | 353 | Kube.Label { |
350 | id: subHeadline | 354 | id: subHeadline |
351 | text: accountName | 355 | text: "Account: " + accountName + "\nMessage-Id: " + entities[0]; |
352 | color: Kube.Colors.disabledTextColor | 356 | color: Kube.Colors.disabledTextColor |
353 | wrapMode: Text.Wrap | 357 | wrapMode: Text.Wrap |
354 | } | 358 | } |