-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat(software): Reload repositories after failure #1894
Conversation
Use the first solution This reverts commit e425bb6.
Pull Request Test Coverage Report for Build 12872505669Details
💛 - Coveralls |
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.
Web part looks good to me, just few NP comments.
@@ -1,4 +1,3 @@ | |||
/* eslint-disable */ |
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.
NP: I believe such a line was there because the file is automatically generated. Let's ask @imobachgs or @joseivanlopez
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.
Yes, but I have removed it too in our feature branch. I have to check whether that line can be omitted somehow when generating the file.
@@ -67,6 +67,24 @@ def issues | |||
private_constant :SOFTWARE_INTERFACE | |||
|
|||
dbus_interface SOFTWARE_INTERFACE do | |||
# array of repository properties: pkg-bindings ID, alias, name, URL, product dir, enabled | |||
# and loaded flag | |||
dbus_method :ListRepositories, "out Result:a(issssbb)" do |
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.
In storage we are tending to other kind of interfaces. The storage API returns JSON data instead of D-Bus structs, dicts, etc. At the end, we are using D-Bus as a transport layer, and probably we will replace it in the future by a HTTP API. Having JSON data has 2 advandanges in our case:
- Replacing D-Bus by HTTP will be almost transparent.
- The rust code is only a proxy that defines an endpoint (it does not need to interpret the data coming from D-Bus).
I guess it is fine to continue with this approach using structs in software. Anyway, we want to rewrite this service in rust.
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.
LGTM
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.
I trust @dgdavid when it comes to the UI. The rest looks good to me.
@@ -28,6 +28,7 @@ use serde_repr::Serialize_repr; | |||
use std::collections::HashMap; | |||
use zbus::Connection; | |||
|
|||
// TODO: move it to model? |
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.
I agree. But there is not need to do it right now.
const ReloadSection = (): React.ReactNode => ( | ||
// TRANSLATORS: title for an error message box, at least one repository could not be loaded | ||
<Alert variant="danger" isInline title={_("Repository load failed")}> | ||
{/* TRANSLATORS: error details followed by a "Try again" link*/} | ||
{_( | ||
"Some installation repositories could not be loaded. The system cannot be installed without them.", | ||
)}{" "} | ||
{loading ? ( | ||
<> | ||
{" "} | ||
<Spinner size="md" /> | ||
<Spinner size="md" /> {_("Loading the installation repositories...")} | ||
</> | ||
) : ( | ||
<Button variant="link" isInline onClick={startProbing}> | ||
{/* TRANSLATORS: link for retrying failed repository load */} | ||
{_("Try again")} | ||
</Button> | ||
<> | ||
{errorMsg}{" "} | ||
<Button variant="link" isInline onClick={startProbing}> | ||
{/* TRANSLATORS: link for retrying failed repository load */} | ||
{_("Try again")} | ||
</Button> | ||
</> |
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 forgot to mention in yestereday's review. Please, move this component outside of the component is using it. As far as I can see yo just need to give it an onReload
prop
<ReloadSection onReload={startProbing} />
Reason for moving it outside: https://react.dev/learn/preserving-and-resetting-state.
We have had issues with that, for example #1550 (comment)
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 a lot about this, I didn't know it!
Problem
Solution
Recording
SLES4SAP-screen0.webm
Details
Tasks
ListRepositories
DBus method)/api/software/repositories
using the DBus backend above (@jreidinger thanks!)