diff options
author | Rémi Nicole <nicole@kolabsystems.com> | 2018-02-26 18:19:43 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-02-26 18:20:13 +0100 |
commit | 331f75d4da056ddb235be45a3784d2c19e545211 (patch) | |
tree | 64adc5432725e6d484012acfcea64b95b5d1711f /views/log/qml/View.qml | |
parent | 2dc4d380f8c0cc90aa0dec67a826703c3ceb34af (diff) | |
download | kube-331f75d4da056ddb235be45a3784d2c19e545211.tar.gz kube-331f75d4da056ddb235be45a3784d2c19e545211.zip |
Improvements of the log view
Summary:
- Add a test view for the log view
- Allow passing the `entities` part of Sink messages
- That allowed getting information about which mail could not be sent in sink transmission errors
Reviewers: cmollekopf
Reviewed By: cmollekopf
Differential Revision: https://phabricator.kde.org/D10861
Diffstat (limited to 'views/log/qml/View.qml')
-rw-r--r-- | views/log/qml/View.qml | 67 |
1 files changed, 56 insertions, 11 deletions
diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 14e2d543..7e95e20f 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml | |||
@@ -45,7 +45,18 @@ 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 | |
49 | var error = { | ||
50 | timestamp: new Date(), | ||
51 | message: message.message, | ||
52 | details: message.details, | ||
53 | resource: message.resource, | ||
54 | // TODO: if we passed entities as a list, it would get | ||
55 | // converted to a ListModel, in all likelihood because of | ||
56 | // ListDelegate, which we should rewrite in C++ | ||
57 | entities: {elements: message.entities} | ||
58 | } | ||
59 | |||
49 | if (logModel.count > 0) { | 60 | if (logModel.count > 0) { |
50 | var lastEntry = logModel.get(0) | 61 | var lastEntry = logModel.get(0) |
51 | //Merge if we get an entry of the same subtype | 62 | //Merge if we get an entry of the same subtype |
@@ -89,6 +100,8 @@ Controls.SplitView { | |||
89 | } else { | 100 | } else { |
90 | details.subtype = "" | 101 | details.subtype = "" |
91 | } | 102 | } |
103 | |||
104 | details.entities = error.entities | ||
92 | } | 105 | } |
93 | 106 | ||
94 | delegate: Kube.ListDelegate { | 107 | delegate: Kube.ListDelegate { |
@@ -145,6 +158,7 @@ Controls.SplitView { | |||
145 | property date timestamp | 158 | property date timestamp |
146 | property string message: "" | 159 | property string message: "" |
147 | property string resourceId: "" | 160 | property string resourceId: "" |
161 | property var entities: [] | ||
148 | 162 | ||
149 | Kube.ModelIndexRetriever { | 163 | Kube.ModelIndexRetriever { |
150 | id: retriever | 164 | id: retriever |
@@ -166,6 +180,7 @@ Controls.SplitView { | |||
166 | property string resourceId: details.resourceId | 180 | property string resourceId: details.resourceId |
167 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" | 181 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" |
168 | property string accountName: retriever.currentData ? retriever.currentData.name : "" | 182 | property string accountName: retriever.currentData ? retriever.currentData.name : "" |
183 | property var entities: details.entities | ||
169 | 184 | ||
170 | function getComponent(subtype) { | 185 | function getComponent(subtype) { |
171 | if (subtype == Kube.Notifications.loginError) { | 186 | if (subtype == Kube.Notifications.loginError) { |
@@ -340,19 +355,49 @@ Controls.SplitView { | |||
340 | right: parent.right | 355 | right: parent.right |
341 | } | 356 | } |
342 | spacing: Kube.Units.largeSpacing | 357 | spacing: Kube.Units.largeSpacing |
358 | |||
359 | Kube.Heading { | ||
360 | id: heading | ||
361 | text: qsTr("Failed to send the message.") | ||
362 | color: Kube.Colors.warningColor | ||
363 | } | ||
364 | |||
343 | Column { | 365 | Column { |
344 | Kube.Heading { | 366 | spacing: Kube.Units.largeSpacing |
345 | id: heading | 367 | |
346 | text: qsTr("Failed to send the message.") | 368 | Repeater { |
347 | color: Kube.Colors.warningColor | 369 | model: Kube.MailListModel { |
348 | } | 370 | entityId: entities.elements[0] |
349 | Kube.Label { | 371 | } |
350 | id: subHeadline | 372 | delegate: Column { |
351 | text: accountName | 373 | id: subHeadline |
352 | color: Kube.Colors.disabledTextColor | 374 | |
353 | wrapMode: Text.Wrap | 375 | Kube.Label { |
376 | text: qsTr("Account") + ": " + accountName | ||
377 | color: Kube.Colors.disabledTextColor | ||
378 | wrapMode: Text.Wrap | ||
379 | } | ||
380 | Kube.Label { | ||
381 | text: qsTr("Subject") + ": " + model.subject | ||
382 | color: Kube.Colors.disabledTextColor | ||
383 | wrapMode: Text.Wrap | ||
384 | } | ||
385 | Kube.Label { | ||
386 | text: qsTr("To") + ": " + model.to | ||
387 | color: Kube.Colors.disabledTextColor | ||
388 | wrapMode: Text.Wrap | ||
389 | } | ||
390 | Kube.Label { | ||
391 | visible: !!model.cc | ||
392 | text: qsTr("Cc") + ": " + model.cc; | ||
393 | color: Kube.Colors.disabledTextColor | ||
394 | wrapMode: Text.Wrap | ||
395 | } | ||
396 | |||
397 | } | ||
354 | } | 398 | } |
355 | } | 399 | } |
400 | |||
356 | Kube.Button { | 401 | Kube.Button { |
357 | text: qsTr("Try again") | 402 | text: qsTr("Try again") |
358 | onClicked: { | 403 | onClicked: { |