Merge ~pieq/bugit/+git/qabro:1904849-add-stage-when-issue-filed into bugit:master

Proposed by Pierre Equoy
Status: Merged
Approved by: Pierre Equoy
Approved revision: a60cb33d7f583d0b9ba28e93a0b2b7a5a8c84b92
Merged at revision: f4d39c61bea0f52c303b43171b4da6ee189047cf
Proposed branch: ~pieq/bugit/+git/qabro:1904849-add-stage-when-issue-filed
Merge into: bugit:master
Diff against target: 59 lines (+20/-0)
1 file modified
qabro/ui.py (+20/-0)
Reviewer Review Type Date Requested Status
Kristin Chuang (community) Approve
Yuan-Chen Cheng (community) Approve
Review via email: mp+402241@code.launchpad.net

Description of the change

See description of commit for more information.

Tested on an amd64 machine by submitting issues on the Staging instance of Launchpad, and checking the right description was set.

Also tested interrupting the process (for instance pressing Ctrl+C when sosreport is generated), then changing the stage radio button, and making sure the bug description is updated as expected, and that there is only one "[Stage]" section, and not more.

To post a comment you must log in.
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

The code itself looks good for me, I'll approve it.

However I myself rarely run it, so I think you still need another approval from those who use it a lot to approve it.

review: Approve
Revision history for this message
Kristin Chuang (kristinchuang) wrote :

+1 based on the internal discussion thread: https://chat.canonical.com/canonical/pl/jsep8xm6cfnkmkd7fa4y9yh4mh

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/qabro/ui.py b/qabro/ui.py
2index 436eb68..6942096 100644
3--- a/qabro/ui.py
4+++ b/qabro/ui.py
5@@ -29,6 +29,9 @@ class ReportScreen:
6 'Medium',
7 'High',
8 'Critical')
9+ stage_bug_filed = ("Issue reported and logs collected right after it happened",
10+ "Device froze, issue reported and logs collected right after a reboot",
11+ "Issue reported and logs collected at a later stage")
12
13 default_description = ("[Summary]\n\n"
14 "[Steps to reproduce]\n\n"
15@@ -64,6 +67,9 @@ class ReportScreen:
16 self._importance = []
17 for i in self.importances:
18 rb = urwid.RadioButton(self._importance, i, 'first True', None)
19+ self._stage_bug_filed = []
20+ for s in self.stage_bug_filed:
21+ rb = urwid.RadioButton(self._stage_bug_filed, s, False, None)
22 self._bug_features = []
23 for feature in sorted(self.tags["features"]):
24 cb = urwid.CheckBox(label=feature, state=False,
25@@ -80,6 +86,7 @@ class ReportScreen:
26 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), 'Tags')
27 status_list = urwid.LineBox(urwid.Pile(self._status), 'Status')
28 importance_list = urwid.LineBox(urwid.Pile(self._importance), 'Importance')
29+ stage_bug_filed_list = urwid.LineBox(urwid.Pile(self._stage_bug_filed), 'When was the issue filed?')
30 self.bug_features_list = urwid.LineBox(urwid.Pile(self._bug_features), 'Impacted Feature(s)')
31 self.bug_vendors_list = urwid.LineBox(urwid.Pile(self._bug_vendors), 'Impacted Vendor(s)')
32 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), 'foot')
33@@ -87,6 +94,7 @@ class ReportScreen:
34 self.bug_vendors_list])
35 self.pile = urwid.Pile([self._title,
36 self._description,
37+ stage_bug_filed_list,
38 self._project,
39 self._series,
40 status_list,
41@@ -153,6 +161,18 @@ class ReportScreen:
42 def report(self):
43 tags = self._tags.base_widget.text
44 options = {'include_fwts_logs': 'hwe-firmware' in tags}
45+ stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]
46+ if stage_bug_filed:
47+ # If the bug description already contains a "[Stage]" section,
48+ # remove it since it will be updated and re-filled below
49+ description_list = self._description.base_widget.text.split("\n")
50+ if "[Stage]" in description_list:
51+ i = description_list.index("[Stage]")
52+ description_list.pop(i) # Remove the [Stage] line
53+ description_list.pop(i) # Remove the line after [Stage]
54+ description = "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]
55+ self._description.base_widget.set_edit_text(description)
56+
57 return BugReport(title=self._title.base_widget.text,
58 description=self._description.base_widget.text,
59 project=self._project.base_widget.text,

Subscribers

People subscribed via source and target branches

to all changes: