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
1=== modified file 'checkbox-gui/checkbox-gui/testitemmodel.cpp'
2--- checkbox-gui/checkbox-gui/testitemmodel.cpp 2014-04-07 09:07:29 +0000
3+++ checkbox-gui/checkbox-gui/testitemmodel.cpp 2014-05-07 13:01:19 +0000
4@@ -106,6 +106,7 @@
5 double duration;
6 QString checksum;
7 QString depends;
8+ QString partial_id;
9 QString testname;
10 QString requires;
11 QString description;
12@@ -143,9 +144,6 @@
13 // Should we show this to the user at all?
14 bool human = true;
15
16- // Local jobs use description as the visible name
17- bool description_as_name = false;
18-
19 // The path for this job is:
20 path = jnode->m_node->object_path.path();
21
22@@ -178,9 +176,14 @@
23 description = variant.toString();
24 }
25
26+ variant = *iface->properties.find("summary");
27+ if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {
28+ testname = variant.toString();
29+ }
30+
31 variant = *iface->properties.find("partial_id");
32 if (variant.isValid() && variant.canConvert(QMetaType::QString) ) {
33- testname = variant.toString();
34+ partial_id = variant.toString();
35 }
36
37 variant = *iface->properties.find("requires");
38@@ -205,8 +208,12 @@
39 type = tr("Manual");
40 }
41
42+ // local jobs should display description if there's no summary
43+ // not partial_id
44 if (variant.toString().compare("local") == 0) {
45- description_as_name = true;
46+ if (testname == partial_id) {
47+ testname = description;
48+ }
49 }
50
51 if (variant.toString().compare("resource") == 0) {
52@@ -235,14 +242,6 @@
53 depth++;
54 }
55
56- // For local jobs, we may substitute the description for the human name
57- if (description_as_name) {
58- // dont do this if the description is empty however!
59- if (!description.isEmpty()) {
60- testname = description;
61- }
62- }
63-
64 // Does this node have children?
65 bool branch = false;
66 if (!jnode->m_children.isEmpty()) {
67
68=== modified file 'plainbox/plainbox/impl/job.py'
69--- plainbox/plainbox/impl/job.py 2014-03-28 21:48:09 +0000
70+++ plainbox/plainbox/impl/job.py 2014-05-07 13:01:19 +0000
71@@ -270,14 +270,14 @@
72
73 @property
74 def summary(self):
75- return self.get_record_value('summary', self.id)
76+ return self.get_record_value('summary', self.partial_id)
77
78 def tr_summary(self):
79 """
80 Get the translated version of :meth:`summary`
81 """
82 return self.get_normalized_translated_data(
83- self.get_raw_record_value('summary')) or self.id
84+ self.get_raw_record_value('summary')) or self.partial_id
85
86 @property
87 def name(self):

Subscribers

People subscribed via source and target branches