Merge lp:~brendan-donegan/checkbox/bug1314516_checkbox-gui into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2979
Merged at revision: 2981
Proposed branch: lp:~brendan-donegan/checkbox/bug1314516_checkbox-gui
Merge into: lp:checkbox
Diff against target: 87 lines (+14/-15)
2 files modified
checkbox-gui/checkbox-gui/testitemmodel.cpp (+12/-13)
plainbox/plainbox/impl/job.py (+2/-2)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/bug1314516_checkbox-gui
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Brendan Donegan (community) Needs Resubmitting
Review via email: mp+218608@code.launchpad.net

Description of the change

This branch updates the GUI to use the summary field of a job in all cases in the UI, falling back to the partial_id of the job if the summary is not available. For local jobs it will display the description where the summary is not available.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Please split that to two commits, one per project

review: Needs Fixing
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I also wonder if plainbox tests pass with those changes, perhaps we just have spotty coverage

2978. By Brendan Donegan

plainbox: If summary does not exist, use partial_id

Signed-off-by: Brendan Donegan <email address hidden>

2979. By Brendan Donegan

checkbox-gui: Display summary where possible, otherwise partial_id

To make the UI of plainbox based tools consistent, let's use summary when
displaying jobs. However these is currently no guarantee summary is there
for any particular job, so we need to fall back to using partial_id.

To keep behaviour consistent, local jobs should fall back to using
description instead of partial_id.

Signed-off-by: Brendan Donegan <email address hidden>

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Rebased. Overall coverage is 52%, but in e.g. job.py it's 91%, so there might be room for improvement, but it's not that bad.

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

26 + variant = *iface->properties.find("summary");
27 + if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {
28 + testname = variant.toString();
29 + }
30 +

When would that be false? We always return something for summary

review: Needs Information
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

That's just the pattern used in the current code - it's probably better to be defensive, don't you think?

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Ok, I see, I was just wondering if there was something else to it.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox-gui/checkbox-gui/testitemmodel.cpp'
--- checkbox-gui/checkbox-gui/testitemmodel.cpp 2014-04-07 09:07:29 +0000
+++ checkbox-gui/checkbox-gui/testitemmodel.cpp 2014-05-07 13:01:19 +0000
@@ -106,6 +106,7 @@
106 double duration;106 double duration;
107 QString checksum;107 QString checksum;
108 QString depends;108 QString depends;
109 QString partial_id;
109 QString testname;110 QString testname;
110 QString requires;111 QString requires;
111 QString description;112 QString description;
@@ -143,9 +144,6 @@
143 // Should we show this to the user at all?144 // Should we show this to the user at all?
144 bool human = true;145 bool human = true;
145146
146 // Local jobs use description as the visible name
147 bool description_as_name = false;
148
149 // The path for this job is:147 // The path for this job is:
150 path = jnode->m_node->object_path.path();148 path = jnode->m_node->object_path.path();
151149
@@ -178,9 +176,14 @@
178 description = variant.toString();176 description = variant.toString();
179 }177 }
180178
179 variant = *iface->properties.find("summary");
180 if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {
181 testname = variant.toString();
182 }
183
181 variant = *iface->properties.find("partial_id");184 variant = *iface->properties.find("partial_id");
182 if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {185 if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {
183 testname = variant.toString();186 partial_id = variant.toString();
184 }187 }
185188
186 variant = *iface->properties.find("requires");189 variant = *iface->properties.find("requires");
@@ -205,8 +208,12 @@
205 type = tr("Manual");208 type = tr("Manual");
206 }209 }
207210
211 // local jobs should display description if there's no summary
212 // not partial_id
208 if (variant.toString().compare("local") == 0) {213 if (variant.toString().compare("local") == 0) {
209 description_as_name = true;214 if (testname == partial_id) {
215 testname = description;
216 }
210 }217 }
211218
212 if (variant.toString().compare("resource") == 0) {219 if (variant.toString().compare("resource") == 0) {
@@ -235,14 +242,6 @@
235 depth++;242 depth++;
236 }243 }
237244
238 // For local jobs, we may substitute the description for the human name
239 if (description_as_name) {
240 // dont do this if the description is empty however!
241 if (!description.isEmpty()) {
242 testname = description;
243 }
244 }
245
246 // Does this node have children?245 // Does this node have children?
247 bool branch = false;246 bool branch = false;
248 if (!jnode->m_children.isEmpty()) {247 if (!jnode->m_children.isEmpty()) {
249248
=== modified file 'plainbox/plainbox/impl/job.py'
--- plainbox/plainbox/impl/job.py 2014-03-28 21:48:09 +0000
+++ plainbox/plainbox/impl/job.py 2014-05-07 13:01:19 +0000
@@ -270,14 +270,14 @@
270270
271 @property271 @property
272 def summary(self):272 def summary(self):
273 return self.get_record_value('summary', self.id)273 return self.get_record_value('summary', self.partial_id)
274274
275 def tr_summary(self):275 def tr_summary(self):
276 """276 """
277 Get the translated version of :meth:`summary`277 Get the translated version of :meth:`summary`
278 """278 """
279 return self.get_normalized_translated_data(279 return self.get_normalized_translated_data(
280 self.get_raw_record_value('summary')) or self.id280 self.get_raw_record_value('summary')) or self.partial_id
281281
282 @property282 @property
283 def name(self):283 def name(self):

Subscribers

People subscribed via source and target branches