-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
apps: Warn if appstream data package is missing #19281
apps: Warn if appstream data package is missing #19281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This also needs an integration test. Do you want to work on that, or need some help?
631b973
to
637bccd
Compare
I would like to give it a try, I was writing this before:
|
637bccd
to
b2e0897
Compare
@martinpitt the only caveat is that I have no idea how to get appstream installed to test otherwise, but seems like everything else was already mocking anyways. The refresh will remain blocked this way, btw. |
b2e0897
to
914f7ee
Compare
Btw it breaks testBasic and TestWithUrlRoot due to its reliance on Edit: solved |
de7a136
to
dca567b
Compare
Had some troubles with tox but fixed now, but overall I believe the only thing missing is my own question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misunderstood the purpose of this yesterday. What this PR should do is to show the alert if the metapackages are absent. It should not modify the actual install procedure, as that is already happening. See the detailed comments below.
Added an attempt assert for the Alert also, but VM says no:
That's because you added a new test case which doesn't call self.createAppStreamRepoPackage()
to mock the metapackages. But this should go away entirely.
Thanks!
dca567b
to
ef37084
Compare
This should be rebased after #19283, to test I just changed the Let me know if you want further changes. |
2dc5ba7
to
5d15a58
Compare
5d15a58
to
64d3912
Compare
@martinpitt I've rebased on top of main, testOsMap fails locally for me, but I am not entirely sure why, i'll keep digging, but feel free to fix if obvious Edit: |
Still a bit clueless on how to fix it, i'd expect an diff --git a/test/verify/check-apps b/test/verify/check-apps
index a269d89a4..4de52e955 100755
--- a/test/verify/check-apps
+++ b/test/verify/check-apps
@@ -170,6 +170,7 @@ class TestApps(packagelib.PackageCase):
# unknown OS: nothing gets installed
m.write("/etc/os-release", 'ID="unmapped"\nID_LIKE="mysterious"\nVERSION_ID="1"\n')
+ b.enter_page("/apps")
b.click("#refresh")
# the progress bar is too fast to reliably catch it
time.sleep(1)
@@ -178,6 +179,7 @@ class TestApps(packagelib.PackageCase):
# known OS: appstream-data-tst gets installed from the map
m.write("/etc/os-release", 'ID="derivative"\nID_LIKE="spicy testy"\nVERSION_ID="1"\n')
+ b.enter_page("/apps")
b.click("#refresh")
with b.wait_timeout(30):
b.wait_visible(".app-list #app-1") The first one seems to work, but if I were to guess it is just because of expecting the empty state |
@leomoty sorry, this week was really hectic, we had an IRL team sprint. I'll review this on Monday. |
I triggered https://cockpit-logs.us-east-1.linodeobjects.com/pull-19281-20230908-155558-64d3912b-fedora-38-other/log.html for now, to see how far it gets |
I saw the group picture, pretty cool! Don't worry, thanks for putting up with me :) |
I split out the first two commits to PR #19416, as that should get fixed ASAP and there's more design bikeshedding here. |
This gets added to `data` in the middle of `check_missing_packages()` anyway, so declare it right away. Also document it, as it's part of the result and e.g. `install_missing_packages()` assumes that this field exists.
80b8161
to
09b9bc2
Compare
Sorry, took me a while to get back to this, but I addressed @mvollmer 's feedback. |
Okay, now in retrospect I do understand what @mvollmer was asking, that makes sense. |
pkg/apps/application-list.jsx
Outdated
? <EmptyStatePanel title={ _("No applications installed or available.") } /> | ||
? <EmptyStatePanel title={ _("No applications installed or available.") } | ||
paragraph={data_missing_msg} | ||
action={_("Install application information")} onAction={refresh} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this button always be here, even if data_missing_msg
is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, thanks for spotting! Fixed, and added a test (which took a bit of work to test a negative)
09b9bc2
to
a6f6f8f
Compare
Can't hurt, done. I updated the screenshot in the description. I also fixed the button issue you spotted above, and did some minor cleanups. |
pkg/apps/application.scss
Outdated
@@ -28,6 +28,10 @@ | |||
overflow: hidden; | |||
} | |||
|
|||
.ct-missing-metainfo-alert { | |||
margin-block-end: 1rem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arg, CSS! :-) What about <Stack hasGutter>
? But I am far from the authority here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint! Indeed that's nicer.
I needed to update this again anyway, I found that PackageKit behaved very poorly and blocked the check for a long time. I found out how to do that properly (lightning fast now, and also easier).
Introduce a new packagekit.js helper check_uninstalled_packages() which is a lightweight version of check_missing_packages() that avoids the expensive Refresh call. If there are no installed nor available apps, show an explanation and an action button in the empty state, otherwise show an alert with an "Install" button on top of the installed apps. Use the latter in TestApps.testBasic, as the top right "Refresh" button is already covered by other test cases. Fixes cockpit-project#18454 Thanks to leomoty <[email protected]> for the idea and initial implementation!
a6f6f8f
to
1a910de
Compare
} catch (e) { | ||
console.warn("Failed to check missing AppStream metadata packages:", e.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test. Details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #18454
Apps: Detect missing AppStream metadata
If the AppStream metadata is not installed, the "Apps" page cannot show available Cockpit extensions. The page detects this now, and offers the user to install the metadata.
Thanks to leomoty for designing this improvement!