Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some cosmetics to identify the ReviewRequest ID #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

logsnaath
Copy link

@logsnaath logsnaath commented Sep 28, 2023

  1. Changes mtui prompt to include the review id. Ex S:M:xxxxx:yyyyyy/mtui-auto>. This requires python311-settproctitle.
  2. Sets the process name to include the review id. This helps to identify the window/tab of most of the terminal emulators title.

Would like to get more insights and comments.

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Logu, Happy to see your contributions. I am tempted to say please add test coverage but I don't know if the surrounding code is already covered by automatic tests at all. Anyway, please take a look. Maybe it's not that hard :) and second there is a duplication which you can avoid by extracting a method

@logsnaath logsnaath force-pushed the enhance_prompt branch 2 times, most recently from 5bc43dd to 43f928c Compare September 29, 2023 06:03
@logsnaath logsnaath requested a review from okurz September 29, 2023 06:17
@logsnaath
Copy link
Author

Hi Logu, Happy to see your contributions. I am tempted to say please add test coverage but I don't know if the surrounding code is already covered by automatic tests at all. Anyway, please take a look. Maybe it's not that hard :) and second there is a duplication which you can avoid by extracting a method

I dont know which duplication you have mentioned, is it leveraging subprocess instead of setproctitle ?

mtui/main.py Outdated
@@ -45,6 +45,11 @@ def run_mtui(sys, config, logger, Prompt, Display, args):

prompt = Prompt(config, logger, sys, Display)
if args.update:
short_rrid = (
str(args.update.id).replace("SUSE", "S").replace("Maintenance", "M")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicating ...

mtui/prompt.py Outdated

def load_update(self, update, autoconnect):
tr = update.make_testreport(self.config, autoconnect=autoconnect)
self.metadata = tr
self.targets = tr.targets
self.set_prompt(None)
short_rrid = str(update.id).replace("SUSE", "S").replace("Maintenance", "M")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... this

.PHONY: tidy-diff
tidy-diff:
black --diff ./

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valid extension. But please make that a separate commit

Comment on lines +436 to +437
dboard_burl = "http://dashboard.qam.suse.de/incident/"
openqa_burl = "https://openqa.suse.de/tests/overview?build=:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid specifying any SUSE internal URLs that are not relevant to this "upstream" open source project

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I avoid this change entirely?
or get the base urls from some other ways like the user environment?
or have them in mtui/config.py where a few simillar urls are already defined?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reading from user environment or mtu/config.py both sounds good. I would just avoid specifying any SUSE internal URLs but for convenience maybe it makes sense to provide them but then please in a specific config file. https://github.com/openSUSE/mtui/blob/main/mtui/config.py#L114 looks similar so I guess it's ok if you define URLs there.

@@ -443,6 +452,8 @@ def _show_yourself_data(self):
("Build checks", self._testreport_url()[:-3] + "build_checks"),
("Testreport", self._testreport_url()),
("Repository", self.repository),
("DashBoard Link", self._get_result_links()[0]),
("OpenQA Link", self._get_result_links()[1]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("OpenQA Link", self._get_result_links()[1]),
("openQA Link", self._get_result_links()[1]),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also lowercase "Link" here, as well as in the line above. If this ends up rendered as link then maybe also drop " Link" completely. The other entries also don't have " Link".

@@ -443,6 +452,8 @@ def _show_yourself_data(self):
("Build checks", self._testreport_url()[:-3] + "build_checks"),
("Testreport", self._testreport_url()),
("Repository", self.repository),
("DashBoard Link", self._get_result_links()[0]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("DashBoard Link", self._get_result_links()[0]),
("Dashboard Link", self._get_result_links()[0]),

@@ -1,6 +1,7 @@
import logging
import sys
from subprocess import CalledProcessError
import setproctitle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, nonexisting module

@@ -11,6 +12,7 @@

from .argparse import ArgsParseFailure
from .colorlog import create_logger
from .utils import get_short_rrid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why special function if this can be method of RequestReviewID class ?

@@ -45,6 +46,9 @@ def run_mtui(sys, config, logger, Prompt, Display, args):

prompt = Prompt(config, logger, sys, Display)
if args.update:
short_rrid = get_short_rrid(str(args.update.id))
# helps to set window/tab title with reviewid
setproctitle.setproctitle("mtui-" + short_rrid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw how will load_template command change title ?

dboard_burl = "http://dashboard.qam.suse.de/incident/"
openqa_burl = "https://openqa.suse.de/tests/overview?build=:"
dboard_lnk = dboard_burl + incident_id
openqa_lnk = openqa_burl + incident_id + ":" + self.srpms[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rly ? this can't work


self._attrs = [
"products",
"category",
"packager",
"reviewer",
"packages",
"srpms",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and parser for srpms is where ? and data source ?

@@ -333,3 +333,7 @@ def walk(inc):
if isinstance(inc[key], (list, dict)):
inc[key] = walk(inc[key])
return inc


def get_short_rrid(id_str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ? this should be method of RequestReviewID ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants