diff options
Diffstat (limited to 'views/log/qml/View.qml')
-rw-r--r-- | views/log/qml/View.qml | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/views/log/qml/View.qml b/views/log/qml/View.qml index 30b87bcc..b710267d 100644 --- a/views/log/qml/View.qml +++ b/views/log/qml/View.qml | |||
@@ -61,27 +61,7 @@ Controls1.SplitView { | |||
61 | } | 61 | } |
62 | root.pendingNotification = true | 62 | root.pendingNotification = true |
63 | } | 63 | } |
64 | 64 | logModel.insert(message) | |
65 | var error = { | ||
66 | timestamp: new Date(), | ||
67 | message: message.message, | ||
68 | details: message.details, | ||
69 | resource: message.resource, | ||
70 | // TODO: if we passed entities as a list, it would get | ||
71 | // converted to a ListModel, in all likelihood because of | ||
72 | // ListDelegate, which we should rewrite in C++ | ||
73 | entities: {elements: message.entities} | ||
74 | } | ||
75 | |||
76 | if (logModel.count > 0) { | ||
77 | var lastEntry = logModel.get(0) | ||
78 | //Merge if we get an entry of the same subtype | ||
79 | if (lastEntry.subtype && lastEntry.subtype == message.subtype) { | ||
80 | logModel.set(0, {type: message.type, subtype: message.subtype, errors: [error].concat(lastEntry.errors)}) | ||
81 | return | ||
82 | } | ||
83 | } | ||
84 | logModel.insert(0, {type: message.type, subtype: message.subtype, errors: [error]}) | ||
85 | } | 65 | } |
86 | } | 66 | } |
87 | 67 | ||
@@ -99,25 +79,23 @@ Controls1.SplitView { | |||
99 | 79 | ||
100 | clip: true | 80 | clip: true |
101 | 81 | ||
102 | model: ListModel { | 82 | model: Kube.LogModel { |
103 | id: logModel | 83 | id: logModel |
104 | objectName: "logModel" | 84 | objectName: "logModel" |
105 | } | 85 | } |
106 | 86 | ||
107 | onCurrentItemChanged: { | 87 | onCurrentItemChanged: { |
108 | var error = currentItem.currentData.errors.get(0) | 88 | if (!!currentItem.currentData.resource) { |
109 | if (!!error.resource) { | 89 | details.resourceId = currentItem.currentData.resource |
110 | details.resourceId = error.resource | ||
111 | } | 90 | } |
112 | details.message = error.message + "\n" + error.details | 91 | details.message = currentItem.currentData.message + "\n" + currentItem.currentData.details |
113 | details.timestamp = error.timestamp | 92 | details.timestamp = currentItem.currentData.timestamp |
93 | details.entities = currentItem.currentData.entities | ||
114 | if (!!currentItem.currentData.subtype) { | 94 | if (!!currentItem.currentData.subtype) { |
115 | details.subtype = currentItem.currentData.subtype | 95 | details.subtype = currentItem.currentData.subtype |
116 | } else { | 96 | } else { |
117 | details.subtype = "" | 97 | details.subtype = "" |
118 | } | 98 | } |
119 | |||
120 | details.entities = error.entities | ||
121 | } | 99 | } |
122 | 100 | ||
123 | delegate: Kube.ListDelegate { | 101 | delegate: Kube.ListDelegate { |
@@ -149,7 +127,7 @@ Controls1.SplitView { | |||
149 | maximumLineCount: 1 | 127 | maximumLineCount: 1 |
150 | elide: Text.ElideRight | 128 | elide: Text.ElideRight |
151 | color: Kube.Colors.disabledTextColor | 129 | color: Kube.Colors.disabledTextColor |
152 | text: model.errors.get(0).message | 130 | text: model.message |
153 | } | 131 | } |
154 | 132 | ||
155 | Kube.Label { | 133 | Kube.Label { |
@@ -160,7 +138,7 @@ Controls1.SplitView { | |||
160 | bottom: parent.bottom | 138 | bottom: parent.bottom |
161 | rightMargin: Kube.Units.smallSpacing | 139 | rightMargin: Kube.Units.smallSpacing |
162 | } | 140 | } |
163 | text: Qt.formatDateTime(model.errors.get(0).timestamp, " hh:mm:ss dd MMM yyyy") | 141 | text: Qt.formatDateTime(model.timestamp, " hh:mm:ss dd MMM yyyy") |
164 | font.italic: true | 142 | font.italic: true |
165 | color: Kube.Colors.disabledTextColor | 143 | color: Kube.Colors.disabledTextColor |
166 | font.pointSize: Kube.Units.smallFontSize | 144 | font.pointSize: Kube.Units.smallFontSize |
@@ -196,7 +174,7 @@ Controls1.SplitView { | |||
196 | property string resourceId: details.resourceId | 174 | property string resourceId: details.resourceId |
197 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" | 175 | property string accountId: retriever.currentData ? retriever.currentData.accountId : "" |
198 | property string accountName: retriever.currentData ? retriever.currentData.name : "" | 176 | property string accountName: retriever.currentData ? retriever.currentData.name : "" |
199 | property var entities: details.entities | 177 | property string entityId: details.entities.length != 0 ? details.entities[0] : "" |
200 | 178 | ||
201 | function getComponent(subtype) { | 179 | function getComponent(subtype) { |
202 | if (subtype == Kube.Notifications.loginError) { | 180 | if (subtype == Kube.Notifications.loginError) { |
@@ -364,6 +342,7 @@ Controls1.SplitView { | |||
364 | Component { | 342 | Component { |
365 | id: transmissionErrorComponent | 343 | id: transmissionErrorComponent |
366 | Item { | 344 | Item { |
345 | id: componentRoot | ||
367 | Column { | 346 | Column { |
368 | anchors { | 347 | anchors { |
369 | top: parent.top | 348 | top: parent.top |
@@ -383,7 +362,7 @@ Controls1.SplitView { | |||
383 | 362 | ||
384 | Repeater { | 363 | Repeater { |
385 | model: Kube.MailListModel { | 364 | model: Kube.MailListModel { |
386 | entityId: entities.elements[0] | 365 | entityId: componentRoot.parent ? componentRoot.parent.entityId : "" |
387 | } | 366 | } |
388 | delegate: Column { | 367 | delegate: Column { |
389 | id: subHeadline | 368 | id: subHeadline |