diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-25 14:00:43 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-25 14:00:43 +0200 |
commit | da955d84beda72e26ce641375bd6fc4159a4c9fc (patch) | |
tree | 9ced7c7fc2d1404a45728ea8fc64a14590fdb9d3 /components | |
parent | 65d7fe39ccb3ae011f63ab6abbdcec5ee0c71055 (diff) | |
download | kube-da955d84beda72e26ce641375bd6fc4159a4c9fc.tar.gz kube-da955d84beda72e26ce641375bd6fc4159a4c9fc.zip |
Prepare logview for error merging.
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/contents/ui/LogView.qml | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/components/kube/contents/ui/LogView.qml b/components/kube/contents/ui/LogView.qml index 4475e318..246e1a18 100644 --- a/components/kube/contents/ui/LogView.qml +++ b/components/kube/contents/ui/LogView.qml | |||
@@ -42,8 +42,11 @@ Controls.SplitView { | |||
42 | Kube.Listener { | 42 | Kube.Listener { |
43 | filter: Kube.Messages.notification | 43 | filter: Kube.Messages.notification |
44 | onMessageReceived: { | 44 | onMessageReceived: { |
45 | root.pendingError = true | 45 | if (message.type == Kube.Notifications.error) { |
46 | logModel.insert(0, {message: message.message, details: message.details, timestamp: new Date(), resource: message.resource}); | 46 | root.pendingError = true |
47 | } | ||
48 | var error = {timestamp: new Date(), message: message.message, details: message.details, resource: message.resource} | ||
49 | logModel.insert(0, {type: message.type, errors: [error]}) | ||
47 | } | 50 | } |
48 | } | 51 | } |
49 | 52 | ||
@@ -64,14 +67,15 @@ Controls.SplitView { | |||
64 | 67 | ||
65 | model: ListModel { | 68 | model: ListModel { |
66 | id: logModel | 69 | id: logModel |
70 | objectName: "logModel" | ||
67 | } | 71 | } |
68 | 72 | ||
69 | onCurrentItemChanged: { | 73 | onCurrentItemChanged: { |
70 | if (!!currentItem.currentData.resource) { | 74 | if (!!currentItem.currentData.resource) { |
71 | details.resourceId = currentItem.currentData.resource | 75 | details.resourceId = currentItem.currentData.errors.get(0).resource |
72 | } | 76 | } |
73 | details.message = currentItem.currentData.message + "\n" + currentItem.currentData.details | 77 | details.message = currentItem.currentData.message + "\n" + currentItem.currentData.errors.get(0).details |
74 | details.timestamp = currentItem.currentData.timestamp | 78 | details.timestamp = currentItem.currentData.errors.get(0).timestamp |
75 | } | 79 | } |
76 | delegate: Kube.ListDelegate { | 80 | delegate: Kube.ListDelegate { |
77 | border.color: Kube.Colors.buttonColor | 81 | border.color: Kube.Colors.buttonColor |
@@ -86,7 +90,7 @@ Controls.SplitView { | |||
86 | } | 90 | } |
87 | height: Kube.Units.gridUnit | 91 | height: Kube.Units.gridUnit |
88 | width: parent.width - Kube.Units.largeSpacing * 2 | 92 | width: parent.width - Kube.Units.largeSpacing * 2 |
89 | text: qsTr("Error") | 93 | text: model.type == Kube.Notifications.error ? qsTr("Error") : qsTr("Info") |
90 | } | 94 | } |
91 | 95 | ||
92 | Kube.Label { | 96 | Kube.Label { |
@@ -102,8 +106,7 @@ Controls.SplitView { | |||
102 | maximumLineCount: 1 | 106 | maximumLineCount: 1 |
103 | elide: Text.ElideRight | 107 | elide: Text.ElideRight |
104 | color: Kube.Colors.disabledTextColor | 108 | color: Kube.Colors.disabledTextColor |
105 | 109 | text: model.errors.get(0).message | |
106 | text: model.message | ||
107 | } | 110 | } |
108 | 111 | ||
109 | Kube.Label { | 112 | Kube.Label { |
@@ -113,7 +116,7 @@ Controls.SplitView { | |||
113 | right: parent.right | 116 | right: parent.right |
114 | bottom: parent.bottom | 117 | bottom: parent.bottom |
115 | } | 118 | } |
116 | text: Qt.formatDateTime(model.timestamp, " hh:mm:ss dd MMM yyyy") | 119 | text: Qt.formatDateTime(model.errors.get(0).timestamp, " hh:mm:ss dd MMM yyyy") |
117 | font.italic: true | 120 | font.italic: true |
118 | color: Kube.Colors.disabledTextColor | 121 | color: Kube.Colors.disabledTextColor |
119 | font.pointSize: Kube.Units.smallFontSize | 122 | font.pointSize: Kube.Units.smallFontSize |