summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-25 14:39:44 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-25 14:39:44 +0200
commit8a78d09844826948647aa5ecc46449413ce09502 (patch)
treed6101ac6a83c3645c0debfec06aced889012f4e0 /components
parentda955d84beda72e26ce641375bd6fc4159a4c9fc (diff)
downloadkube-8a78d09844826948647aa5ecc46449413ce09502.tar.gz
kube-8a78d09844826948647aa5ecc46449413ce09502.zip
Use a loader so we can load different components depending on the error
Diffstat (limited to 'components')
-rw-r--r--components/kube/contents/ui/LogView.qml58
1 files changed, 37 insertions, 21 deletions
diff --git a/components/kube/contents/ui/LogView.qml b/components/kube/contents/ui/LogView.qml
index 246e1a18..2ffa978c 100644
--- a/components/kube/contents/ui/LogView.qml
+++ b/components/kube/contents/ui/LogView.qml
@@ -46,7 +46,7 @@ Controls.SplitView {
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}
49 logModel.insert(0, {type: message.type, errors: [error]}) 49 logModel.insert(0, {type: message.type, subtype: message.subtype, errors: [error]})
50 } 50 }
51 } 51 }
52 52
@@ -71,12 +71,15 @@ Controls.SplitView {
71 } 71 }
72 72
73 onCurrentItemChanged: { 73 onCurrentItemChanged: {
74 if (!!currentItem.currentData.resource) { 74 var error = currentItem.currentData.errors.get(0)
75 details.resourceId = currentItem.currentData.errors.get(0).resource 75 if (!!error.resource) {
76 details.resourceId = error.resource
76 } 77 }
77 details.message = currentItem.currentData.message + "\n" + currentItem.currentData.errors.get(0).details 78 details.message = error.message + "\n" + error.details
78 details.timestamp = currentItem.currentData.errors.get(0).timestamp 79 details.timestamp = error.timestamp
80 details.subtype = currentItem.currentData.subtype
79 } 81 }
82
80 delegate: Kube.ListDelegate { 83 delegate: Kube.ListDelegate {
81 border.color: Kube.Colors.buttonColor 84 border.color: Kube.Colors.buttonColor
82 border.width: 1 85 border.width: 1
@@ -126,11 +129,10 @@ Controls.SplitView {
126 } 129 }
127 Item { 130 Item {
128 id: details 131 id: details
132 property string subtype: ""
129 property date timestamp 133 property date timestamp
130 property string message: "" 134 property string message: ""
131 property string resourceId: "" 135 property string resourceId: ""
132 property string accountId: retriever.currentData ? retriever.currentData.accountId : ""
133 property string accountName: retriever.currentData ? retriever.currentData.name : ""
134 136
135 Kube.ModelIndexRetriever { 137 Kube.ModelIndexRetriever {
136 id: retriever 138 id: retriever
@@ -139,12 +141,27 @@ Controls.SplitView {
139 } 141 }
140 } 142 }
141 143
142 Rectangle { 144 Loader {
145 id: detailsLoader
143 anchors { 146 anchors {
144 fill: parent 147 fill: parent
145 margins: Kube.Units.largeSpacing 148 margins: Kube.Units.largeSpacing
146 } 149 }
147 visible: details.message != "" 150 property date timestamp: details.timestamp
151 property string message: details.message
152 property string resourceId: details.resourceid
153 property string accountId: retriever.currentData ? retriever.currentData.accountId : ""
154 property string accountName: retriever.currentData ? retriever.currentData.name : ""
155
156 sourceComponent: detailsComponent
157 }
158
159 }
160
161 Component {
162 id: detailsComponent
163 Rectangle {
164 visible: message != ""
148 clip: true 165 clip: true
149 color: Kube.Colors.viewBackgroundColor 166 color: Kube.Colors.viewBackgroundColor
150 GridLayout { 167 GridLayout {
@@ -158,31 +175,31 @@ Controls.SplitView {
158 columns: 2 175 columns: 2
159 Kube.Label { 176 Kube.Label {
160 text: qsTr("Account:") 177 text: qsTr("Account:")
161 visible: details.accountName 178 visible: accountName
162 } 179 }
163 Kube.Label { 180 Kube.Label {
164 Layout.fillWidth: true 181 Layout.fillWidth: true
165 text: details.accountName 182 text: accountName
166 visible: details.accountName 183 visible: accountName
167 elide: Text.ElideRight 184 elide: Text.ElideRight
168 } 185 }
169 Kube.Label { 186 Kube.Label {
170 text: qsTr("Account Id:") 187 text: qsTr("Account Id:")
171 visible: details.accountId 188 visible: accountId
172 } 189 }
173 Kube.Label { 190 Kube.Label {
174 text: details.accountId 191 text: accountId
175 visible: details.accountId 192 visible: accountId
176 Layout.fillWidth: true 193 Layout.fillWidth: true
177 elide: Text.ElideRight 194 elide: Text.ElideRight
178 } 195 }
179 Kube.Label { 196 Kube.Label {
180 text: qsTr("Resource Id:") 197 text: qsTr("Resource Id:")
181 visible: details.resourceId 198 visible: resourceId
182 } 199 }
183 Kube.Label { 200 Kube.Label {
184 text: details.resourceId 201 text: resourceId
185 visible: details.resourceId 202 visible: resourceId
186 Layout.fillWidth: true 203 Layout.fillWidth: true
187 elide: Text.ElideRight 204 elide: Text.ElideRight
188 } 205 }
@@ -190,7 +207,7 @@ Controls.SplitView {
190 text: qsTr("Timestamp:") 207 text: qsTr("Timestamp:")
191 } 208 }
192 Kube.Label { 209 Kube.Label {
193 text: Qt.formatDateTime(details.timestamp, " hh:mm:ss dd MMM yyyy") 210 text: Qt.formatDateTime(timestamp, " hh:mm:ss dd MMM yyyy")
194 Layout.fillWidth: true 211 Layout.fillWidth: true
195 elide: Text.ElideRight 212 elide: Text.ElideRight
196 } 213 }
@@ -199,7 +216,7 @@ Controls.SplitView {
199 Layout.alignment: Qt.AlignTop 216 Layout.alignment: Qt.AlignTop
200 } 217 }
201 Kube.Label { 218 Kube.Label {
202 text: details.message 219 text: message
203 Layout.fillWidth: true 220 Layout.fillWidth: true
204 wrapMode: Text.Wrap 221 wrapMode: Text.Wrap
205 } 222 }
@@ -208,7 +225,6 @@ Controls.SplitView {
208 Layout.fillHeight: true 225 Layout.fillHeight: true
209 Layout.fillWidth: true 226 Layout.fillWidth: true
210 } 227 }
211 //TODO offer a possible explanation for known errors and a path to resolution.
212 } 228 }
213 229
214 Kube.SelectableItem { 230 Kube.SelectableItem {