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
diff --git a/qabro/ui.py b/qabro/ui.py
index 436eb68..6942096 100644
--- a/qabro/ui.py
+++ b/qabro/ui.py
@@ -29,6 +29,9 @@ class ReportScreen:
29 'Medium',29 'Medium',
30 'High',30 'High',
31 'Critical')31 'Critical')
32 stage_bug_filed = ("Issue reported and logs collected right after it happened",
33 "Device froze, issue reported and logs collected right after a reboot",
34 "Issue reported and logs collected at a later stage")
3235
33 default_description = ("[Summary]\n\n"36 default_description = ("[Summary]\n\n"
34 "[Steps to reproduce]\n\n"37 "[Steps to reproduce]\n\n"
@@ -64,6 +67,9 @@ class ReportScreen:
64 self._importance = []67 self._importance = []
65 for i in self.importances:68 for i in self.importances:
66 rb = urwid.RadioButton(self._importance, i, 'first True', None)69 rb = urwid.RadioButton(self._importance, i, 'first True', None)
70 self._stage_bug_filed = []
71 for s in self.stage_bug_filed:
72 rb = urwid.RadioButton(self._stage_bug_filed, s, False, None)
67 self._bug_features = []73 self._bug_features = []
68 for feature in sorted(self.tags["features"]):74 for feature in sorted(self.tags["features"]):
69 cb = urwid.CheckBox(label=feature, state=False,75 cb = urwid.CheckBox(label=feature, state=False,
@@ -80,6 +86,7 @@ class ReportScreen:
80 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), 'Tags')86 self._tags = urwid.LineBox(urwid.Edit(edit_text=tags), 'Tags')
81 status_list = urwid.LineBox(urwid.Pile(self._status), 'Status')87 status_list = urwid.LineBox(urwid.Pile(self._status), 'Status')
82 importance_list = urwid.LineBox(urwid.Pile(self._importance), 'Importance')88 importance_list = urwid.LineBox(urwid.Pile(self._importance), 'Importance')
89 stage_bug_filed_list = urwid.LineBox(urwid.Pile(self._stage_bug_filed), 'When was the issue filed?')
83 self.bug_features_list = urwid.LineBox(urwid.Pile(self._bug_features), 'Impacted Feature(s)')90 self.bug_features_list = urwid.LineBox(urwid.Pile(self._bug_features), 'Impacted Feature(s)')
84 self.bug_vendors_list = urwid.LineBox(urwid.Pile(self._bug_vendors), 'Impacted Vendor(s)')91 self.bug_vendors_list = urwid.LineBox(urwid.Pile(self._bug_vendors), 'Impacted Vendor(s)')
85 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), 'foot')92 self.footer = urwid.AttrMap(urwid.Text(self.footer_text), 'foot')
@@ -87,6 +94,7 @@ class ReportScreen:
87 self.bug_vendors_list])94 self.bug_vendors_list])
88 self.pile = urwid.Pile([self._title,95 self.pile = urwid.Pile([self._title,
89 self._description,96 self._description,
97 stage_bug_filed_list,
90 self._project,98 self._project,
91 self._series,99 self._series,
92 status_list,100 status_list,
@@ -153,6 +161,18 @@ class ReportScreen:
153 def report(self):161 def report(self):
154 tags = self._tags.base_widget.text162 tags = self._tags.base_widget.text
155 options = {'include_fwts_logs': 'hwe-firmware' in tags}163 options = {'include_fwts_logs': 'hwe-firmware' in tags}
164 stage_bug_filed = [rb.label for rb in self._stage_bug_filed if rb.state]
165 if stage_bug_filed:
166 # If the bug description already contains a "[Stage]" section,
167 # remove it since it will be updated and re-filled below
168 description_list = self._description.base_widget.text.split("\n")
169 if "[Stage]" in description_list:
170 i = description_list.index("[Stage]")
171 description_list.pop(i) # Remove the [Stage] line
172 description_list.pop(i) # Remove the line after [Stage]
173 description = "\n".join(description_list) + "\n\n[Stage]\n" + stage_bug_filed[0]
174 self._description.base_widget.set_edit_text(description)
175
156 return BugReport(title=self._title.base_widget.text,176 return BugReport(title=self._title.base_widget.text,
157 description=self._description.base_widget.text,177 description=self._description.base_widget.text,
158 project=self._project.base_widget.text,178 project=self._project.base_widget.text,

Subscribers

People subscribed via source and target branches

to all changes: