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

feat(web): remake the user interface #1202

Merged
merged 195 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
4d354d2
web: Use PF Thead#noWrap prop
dgdavid May 2, 2024
e26c183
web: Migrate to "data router"
dgdavid May 9, 2024
c7bd9ff
web: start using PatternFly/Page as Root layout
dgdavid May 9, 2024
611fa30
web: Start core/Page component adaptation
dgdavid May 11, 2024
805e31b
web: Drop application with limitation
dgdavid May 11, 2024
c829885
web: Add initial version of Breadcrumbs
dgdavid May 12, 2024
a6f14ca
web: Start adapting existing pages
dgdavid May 12, 2024
8432d4e
web: Start dropping Agama/Section component
dgdavid May 12, 2024
5a3be68
web: small improvements in Breadcrumbs and Page title
dgdavid May 12, 2024
092ec16
web: Make Masthead SVG fill white
dgdavid May 12, 2024
59282d1
web: Improve ProductSelectionPage
dgdavid May 12, 2024
f384ed4
web: Extract Page sticky actions
dgdavid May 13, 2024
a769761
web: Fix from rebase
dgdavid May 13, 2024
56ce907
web: Add missing routes
dgdavid May 13, 2024
a101dbd
web: Fix rebase
dgdavid May 15, 2024
2f6c5f3
web: Start adapting locale selection
dgdavid May 16, 2024
3b0373f
web: core/ListSearch fixes
dgdavid May 16, 2024
c4418ef
web: Start adapting keymap selection
dgdavid May 16, 2024
fa0d0d8
keymap: drop some components and create selection route
dgdavid May 17, 2024
cc7f90d
keymap: fixes
dgdavid May 17, 2024
ee0ff4b
web: Start adapting timezone selection
dgdavid May 17, 2024
73433e3
web: Simplify l10n/L10nPage
dgdavid May 17, 2024
834a64d
web: Start adaption software selection
dgdavid May 20, 2024
6a8b91a
web: start adapting installation device selection
dgdavid May 20, 2024
286c825
web: Drop no longer needed ControlledPanels component
dgdavid May 21, 2024
d09b57a
web: start adapting booting selection
dgdavid May 21, 2024
22b2591
web: start adaption network pages
dgdavid May 21, 2024
e8fa924
web: partial adaption of users
dgdavid May 21, 2024
aea28e4
web: partial adaptation of users,
dgdavid May 22, 2024
ae59b6e
web: continue adapting users
dgdavid May 22, 2024
cb7799b
web: Experiment for loading nested route in a drawer
dgdavid May 22, 2024
253b185
web: undo the experiment
dgdavid May 22, 2024
2792343
web: move things to the new/temporary sidebar
dgdavid May 22, 2024
bb72f76
web: leftovers
dgdavid May 22, 2024
726c632
web: drop some of no longer needed components
dgdavid May 22, 2024
db7db7c
web: improve L10nPage
dgdavid May 23, 2024
b6b0e2f
Merge branch 'master' into new-ui-proposal
dgdavid May 23, 2024
67fb903
web: continue adapting storage routing
dgdavid May 23, 2024
c649bc5
web: more storage ui refinements
dgdavid May 27, 2024
1956557
web: route and styles minor changes
dgdavid May 27, 2024
f88d7e1
web: encryption field adjustments
dgdavid May 27, 2024
14de1d2
web: drop no longer needed Field components
dgdavid May 27, 2024
6dc0fd5
Merge branch 'master' into new-ui-proposal
dgdavid May 27, 2024
56e3126
Merge branch 'master' into new-ui-proposal
dgdavid Jun 5, 2024
f66c01c
web: Drop Breadcrumbs
dgdavid Jun 5, 2024
87696da
web: Use the product name as title
dgdavid Jun 5, 2024
3c9c82f
web: Try a "Gallery" pattern in locale selection
dgdavid Jun 5, 2024
a09a56b
web: Missing custom component
dgdavid Jun 6, 2024
7ea663b
web: WIP overview page
dgdavid Jun 6, 2024
c355d35
Merge branch 'master' into new-ui-proposal
dgdavid Jun 6, 2024
42998d5
Revert "web: Try a "Gallery" pattern in locale selection"
dgdavid Jun 6, 2024
0c6f010
feat: adapt users to the Issues API
imobachgs Jun 6, 2024
2c62494
chore: drop the Validations API
imobachgs Jun 6, 2024
df75f11
feat(web): WIP display the issues in the overview
imobachgs Jun 6, 2024
e1b9c00
web: A bunch of page changes
dgdavid Jun 7, 2024
037d23b
fix(web): do not report issues on InstallButton
imobachgs Jun 7, 2024
c631352
wip: add hard-coded values to the OverviewPage
imobachgs Jun 7, 2024
11a36ba
wip: improve the software page
imobachgs Jun 7, 2024
fa28d34
web: start adaption connection form
dgdavid Jun 9, 2024
abb6754
web: more temporary layout improvements
dgdavid Jun 9, 2024
fc59be2
web: add and start using EmptyState wrapper
dgdavid Jun 9, 2024
00bc2fa
web: Sidebar icon color hotfix
dgdavid Jun 9, 2024
a566f03
web: routes and layout improvements
dgdavid Jun 9, 2024
e52201d
Merge branch 'master' into new-ui-proposal
dgdavid Jun 10, 2024
cbb8e75
web: few improvements regarding to SimpleLayout
dgdavid Jun 10, 2024
0330481
web: few improvements regarding to layouts (#1299)
dgdavid Jun 10, 2024
71ebce9
web: fix questions
joseivanlopez Jun 10, 2024
03cdcf8
web: More consistent search boxes
ancorgs Jun 10, 2024
93b00bb
web: More consistent search boxes (#1300)
ancorgs Jun 10, 2024
aa95ed5
feat: add the L10n info to the overview
imobachgs Jun 10, 2024
f8a4088
web: use patternfly Label instead of Tag
joseivanlopez Jun 10, 2024
9e772ce
web: drop Tag component
joseivanlopez Jun 10, 2024
9d26083
web: drop unused CSS
joseivanlopez Jun 10, 2024
00cc9d8
fix(ui): use Label component (#1298)
joseivanlopez Jun 10, 2024
cfe8d82
feat: add real data to the overview page
imobachgs Jun 10, 2024
965b530
refactor: replace jotai with plain React
imobachgs Jun 10, 2024
1ededb9
test(web): add a test for SoftwareSummary component
imobachgs Jun 10, 2024
c4cc383
test(web): fix OverviewPage test
imobachgs Jun 10, 2024
10cc01f
test(web): fix StorageSection test
imobachgs Jun 10, 2024
3dfb75f
feat(web): add real data to the overview page (#1301)
imobachgs Jun 11, 2024
2b96d50
web: improvements for Installer Options dialog
dgdavid Jun 11, 2024
6c8fcf3
test(web): disable failing tests
imobachgs Jun 11, 2024
ae8c6c4
test(web): remove mocks of the old Sidebar
imobachgs Jun 11, 2024
969435b
test(web): rename SoftwarePatternsSelection tests
imobachgs Jun 11, 2024
b558362
test(web): fix About component test
imobachgs Jun 11, 2024
0791b42
test(web): fix EncryptionField test
imobachgs Jun 11, 2024
3f809f1
web: First steps to adapt network to the new UI
ancorgs Jun 11, 2024
fe36a49
web: Adapt button style
ancorgs Jun 11, 2024
de96530
test(web): be less verbose while running tests
imobachgs Jun 11, 2024
8efa654
Adapt network to the new UI (#1302)
ancorgs Jun 11, 2024
19515e6
web: improvements for Installer Options dialog (#1303)
dgdavid Jun 11, 2024
aa99978
Adapted users form to be shown in a page
teclator Jun 11, 2024
d488222
Disable failing tests (#1304)
imobachgs Jun 11, 2024
9f89942
Make user password set consistent
teclator Jun 11, 2024
703fd03
Removed unnecesary delete
teclator Jun 11, 2024
049fa8c
Show password required validation in case of editing
teclator Jun 11, 2024
5e19ba3
Use all fields are required validation
teclator Jun 11, 2024
2f11032
Skip FirstUser tests
teclator Jun 11, 2024
8951f23
feat(web): improve software page layout
imobachgs Jun 11, 2024
dcae70b
refactor(web): replace SoftwareSection with SoftwareSummary
imobachgs Jun 11, 2024
fc24534
test(web): fix UsedSize tests
imobachgs Jun 11, 2024
bcbed41
fix(web): replace patterns descriptions with summaries
imobachgs Jun 11, 2024
c5bf27d
feat(web): adapt software page to the new UI (#1305)
imobachgs Jun 11, 2024
82edb2d
Adapted first user form to be shown in a page instead of a popup (#1306)
teclator Jun 11, 2024
81cfe16
fix(web): for a product to be selected
imobachgs Jun 11, 2024
d4147e0
fix(web): force to select a product (#1307)
imobachgs Jun 11, 2024
4e4db89
Small network fixes
teclator Jun 11, 2024
78c9371
Small network fixes (#1309)
dgdavid Jun 11, 2024
ae58f86
web: Rename MainLayout
dgdavid Jun 11, 2024
c7b9082
web: Fix CSS overrides
dgdavid Jun 11, 2024
cf04518
web: Drop no longer needed component
dgdavid Jun 11, 2024
b2bec2b
web: simplify code for displaying the wifi connection button
dgdavid Jun 11, 2024
0566d85
web: Drop If component
dgdavid Jun 11, 2024
9cd515f
web: Use Stack/Split/Flex components
dgdavid Jun 11, 2024
1a28f0e
web: more split/stack clean up
dgdavid Jun 11, 2024
5e9c08b
web: drop stack-gutter variables
dgdavid Jun 11, 2024
68f99e8
web: UI clean up (#1310)
dgdavid Jun 11, 2024
a6f1ff8
web: restore the storage devices tech menu
dgdavid Jun 11, 2024
fee2c63
feat(web): show issues on their related section
imobachgs Jun 11, 2024
8640249
fix(web): fix issue link
imobachgs Jun 11, 2024
7065346
feat(web): add issues to the software page
imobachgs Jun 11, 2024
4950622
feat(web): add issues to the corresponding pages (#1313)
imobachgs Jun 11, 2024
276964a
refactor(web): remove some unused components
imobachgs Jun 11, 2024
183e49b
fix(test): fix locale switchers tests
imobachgs Jun 12, 2024
de4c391
fix(test): fix Overview tests
imobachgs Jun 12, 2024
ecfa2f7
fix(test): disable a ZFCPPage test
imobachgs Jun 12, 2024
75282e8
fix(test): fix FieldSet tests
imobachgs Jun 12, 2024
33b55d2
refactor(web): remove some unused components (#1315)
imobachgs Jun 12, 2024
628dff8
web: Keep the old "Edit password too" text
dgdavid Jun 12, 2024
ed7e084
web: Drop dead code
dgdavid Jun 12, 2024
749ac7c
web(users): small layout adjustments
dgdavid Jun 12, 2024
898fe57
web: add disabled tests
dgdavid Jun 12, 2024
559eb85
web: drop broken tests
dgdavid Jun 12, 2024
8c41c96
fix(dbus): fix users issues detection
imobachgs Jun 12, 2024
1ab1d78
chore: make Rubocop happy
imobachgs Jun 12, 2024
b1961af
doc(dbus): remove ServiceStatus for Users1 object
imobachgs Jun 12, 2024
e311083
fix(dbus): fix users issues detection (#1317)
imobachgs Jun 12, 2024
75f58ee
Merge branch 'new-ui-proposal' into new-ui-fix-locale
dgdavid Jun 12, 2024
0e3802b
feat(web): users adjustments (#1316)
dgdavid Jun 12, 2024
72d0aab
chore: make rustfmt happy
imobachgs Jun 12, 2024
91357b3
web: restore the storage devices tech menu (#1312)
dgdavid Jun 12, 2024
06bc945
web: allow pass html props to Center component
joseivanlopez Jun 12, 2024
8e1e4b1
web: add product selection progress
joseivanlopez Jun 12, 2024
8cbe101
web: improve product selection
joseivanlopez Jun 12, 2024
af95905
web: add button for changing product
joseivanlopez Jun 12, 2024
9936573
web: remove old product components
joseivanlopez Jun 12, 2024
02b0958
web: minor improvements in product progress
joseivanlopez Jun 12, 2024
0f07536
web: fix tests
joseivanlopez Jun 12, 2024
206cfd4
web: change wording of progress step
joseivanlopez Jun 12, 2024
2d5abc7
feat(web): product selection progress (#1308)
joseivanlopez Jun 12, 2024
5fcd29d
chore: make rustfmt happy (#1319)
imobachgs Jun 12, 2024
e3d4354
fix(web): display the installation progress
imobachgs Jun 12, 2024
5b55c6e
web: allow SimpleLayout display Outlet or children
dgdavid Jun 12, 2024
3d2347c
web: wrap installation progress with SimpleLayout
dgdavid Jun 12, 2024
612a121
web: avoid mounting Questions twice
dgdavid Jun 12, 2024
82c5e4c
web: fix broken test
dgdavid Jun 12, 2024
6cf510b
Apply changes immediately when connection and disconnecting
teclator Jun 12, 2024
c8304d4
Fix disconnect and connect urls
teclator Jun 12, 2024
07b1c1b
Fix client network variable
teclator Jun 12, 2024
e4172e5
Show connect and disconnect buttons
teclator Jun 12, 2024
68081d8
web: Adjustments at storage result card
ancorgs Jun 12, 2024
49a2a42
web: Adjustments in the space policy card
ancorgs Jun 12, 2024
2153f6b
web: remove Lorem Ipsum
ancorgs Jun 12, 2024
d5535ed
web: WIP: adapt installation device card
ancorgs Jun 12, 2024
70a5e32
fix(web): make sure the client is connected
imobachgs Jun 12, 2024
372d94a
(feat) Fix network issues (#1320)
teclator Jun 12, 2024
7ce8859
First adaptations to the storage page (#1322)
teclator Jun 12, 2024
ef0796d
fix(web): display the installation progress (#1321)
imobachgs Jun 12, 2024
96fca14
test(web): fix App tests
imobachgs Jun 12, 2024
0c0e409
test(web): fix App tests (#1323)
imobachgs Jun 12, 2024
6d8eb19
chore(web): adjust issues wording
imobachgs Jun 12, 2024
0028f24
Wrap loading component inside SimpleLayout
dgdavid Jun 12, 2024
b6fb5ba
Drop no longer used SVG
dgdavid Jun 12, 2024
afad85e
Force the sidebar width
dgdavid Jun 12, 2024
e4e2c53
fix(web): fix first user creation
imobachgs Jun 12, 2024
29198e2
Avoid reserving space for empty nodes
dgdavid Jun 12, 2024
05d8f4a
Minor changes in IpSettingsForm
dgdavid Jun 12, 2024
74f360b
Use Alert component for formatting issues in OverviewPage
dgdavid Jun 12, 2024
1f503e1
Merge branch 'change-wording' into new-ui-adjustments
dgdavid Jun 12, 2024
7e347ca
Add prop to SimpleLayout for displaying InstallerOptions
dgdavid Jun 12, 2024
02d1518
fix(web): fix first user creation (#1325)
imobachgs Jun 13, 2024
f3db871
chore(web): adjust issues wording (#1324)
imobachgs Jun 13, 2024
47c74ae
web: Improve overview issues list
dgdavid Jun 13, 2024
745a2a2
web: use the proper heading level
dgdavid Jun 13, 2024
119cdec
fix(web): more UI adjustments (#1326)
dgdavid Jun 13, 2024
5bdaeff
chore: update services changes files
imobachgs Jun 13, 2024
392a754
web: update changes file
dgdavid Jun 13, 2024
a4ce3fb
Merge branch 'master' into new-ui-proposal
dgdavid Jun 13, 2024
4980bcd
web: do not preselect a product
joseivanlopez Jun 13, 2024
14ba857
web: add layout to product progress
joseivanlopez Jun 13, 2024
750eeb0
web: fix product routes
joseivanlopez Jun 13, 2024
55fa988
web: fix scope
joseivanlopez Jun 13, 2024
7af5751
web: show installer options
joseivanlopez Jun 13, 2024
127bb7a
web: fix software overview
joseivanlopez Jun 13, 2024
23a05f7
chore(web): improve product selection (#1328)
joseivanlopez Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: npm run stylelint

- name: Run the tests and generate coverage report
run: npm test -- --coverage
run: npm test -- --coverage --silent
#
# # send the code coverage for the web part to the coveralls.io
# - name: Coveralls GitHub Action
Expand Down
9 changes: 2 additions & 7 deletions doc/dbus/bus/org.opensuse.Agama.Users1.bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@
<property type="s" name="RootSSHKey" access="read"/>
<property type="(sssba{sv})" name="FirstUser" access="read"/>
</interface>
<interface name="org.opensuse.Agama1.ServiceStatus">
<property type="aa{sv}" name="All" access="read"/>
<property type="u" name="Current" access="read"/>
</interface>
<interface name="org.opensuse.Agama1.Validation">
<property type="as" name="Errors" access="read"/>
<property type="b" name="Valid" access="read"/>
<interface name="org.opensuse.Agama1.Issues">
<property type="a(ssuu)" name="All" access="read"/>
</interface>
</node>
1 change: 0 additions & 1 deletion doc/dbus/bus/org.opensuse.Agama1.ServiceStatus.bus.xml

This file was deleted.

1 change: 0 additions & 1 deletion doc/dbus/bus/org.opensuse.Agama1.Validation.bus.xml

This file was deleted.

35 changes: 0 additions & 35 deletions doc/dbus/org.opensuse.Agama1.ServiceStatus.doc.xml

This file was deleted.

24 changes: 0 additions & 24 deletions doc/dbus/org.opensuse.Agama1.Validation.doc.xml

This file was deleted.

2 changes: 0 additions & 2 deletions doc/dbus_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Service for managing storage devices.
.ObjectManager
.Agama1.ServiceStatus
.Agama1.Progress
.Agama1.Validation
.Agama.Storage1
.Agama.Storage1.Proposal.Calculator
.Agama.Storage1.ISCSI.Initiator
Expand All @@ -96,7 +95,6 @@ Service for managing storage devices.
.ObjectManager
.Agama1.ServiceStatus
.Agama1.Progress
.Agama1.Validation
.Agama.Storage1
.Agama.Storage1.Proposal.Calculator
.Agama.Storage1.ISCSI.Initiator
Expand Down
11 changes: 0 additions & 11 deletions rust/agama-lib/src/proxies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,3 @@ trait Issues {
#[dbus_proxy(property)]
fn all(&self) -> zbus::Result<Vec<(String, String, u32, u32)>>;
}

#[dbus_proxy(interface = "org.opensuse.Agama1.Validation", assume_defaults = true)]
trait Validation {
/// Errors property
#[dbus_proxy(property)]
fn errors(&self) -> zbus::Result<Vec<String>>;

/// Valid property
#[dbus_proxy(property)]
fn valid(&self) -> zbus::Result<bool>;
}
12 changes: 12 additions & 0 deletions rust/agama-server/src/network/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ async fn connect(
.await
.map_err(|_| NetworkError::CannotApplyConfig)?;

state
.network
.apply()
.await
.map_err(|_| NetworkError::CannotApplyConfig)?;

Ok(StatusCode::NO_CONTENT)
}

Expand All @@ -341,6 +347,12 @@ async fn disconnect(
.await
.map_err(|_| NetworkError::CannotApplyConfig)?;

state
.network
.apply()
.await
.map_err(|_| NetworkError::CannotApplyConfig)?;

Ok(StatusCode::NO_CONTENT)
}

Expand Down
6 changes: 3 additions & 3 deletions rust/agama-server/src/users/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use crate::{
error::Error,
web::{
common::{service_status_router, validation_router, EventStreams},
common::{issues_router, service_status_router, EventStreams},
Event,
},
};
Expand Down Expand Up @@ -125,7 +125,7 @@ pub async fn users_service(dbus: zbus::Connection) -> Result<Router, ServiceErro

let users = UsersClient::new(dbus.clone()).await?;
let state = UsersState { users };
let validation_router = validation_router(&dbus, DBUS_SERVICE, DBUS_PATH).await?;
let issues_router = issues_router(&dbus, DBUS_SERVICE, DBUS_PATH).await?;
let status_router = service_status_router(&dbus, DBUS_SERVICE, DBUS_PATH).await?;
let router = Router::new()
.route(
Expand All @@ -135,8 +135,8 @@ pub async fn users_service(dbus: zbus::Connection) -> Result<Router, ServiceErro
.delete(remove_first_user),
)
.route("/root", get(get_root_config).patch(patch_root))
.merge(validation_router)
.merge(status_router)
.nest("/issues", issues_router)
.with_state(state);
Ok(router)
}
Expand Down
9 changes: 9 additions & 0 deletions rust/agama-server/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ async fn run_events_monitor(dbus: zbus::Connection, events: EventsSender) -> Res
)
.await?,
);
stream.insert(
"users-issues",
issues_stream(
dbus.clone(),
"org.opensuse.Agama.Manager1",
"/org/opensuse/Agama/Users1",
)
.await?,
);

tokio::pin!(stream);
let e = events.clone();
Expand Down
107 changes: 1 addition & 106 deletions rust/agama-server/src/web/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{pin::Pin, task::Poll};
use agama_lib::{
error::ServiceError,
progress::Progress,
proxies::{IssuesProxy, ProgressProxy, ServiceStatusProxy, ValidationProxy},
proxies::{IssuesProxy, ProgressProxy, ServiceStatusProxy},
};
use axum::{extract::State, routing::get, Json, Router};
use pin_project::pin_project;
Expand Down Expand Up @@ -354,108 +354,3 @@ async fn build_issues_proxy<'a>(
.await?;
Ok(proxy)
}

/// Builds a router to the `org.opensuse.Agama1.Validation` interface of a given
/// D-Bus object.
///
/// ```no_run
/// # use axum::{extract::State, routing::get, Json, Router};
/// # use agama_lib::connection;
/// # use agama_server::web::common::validation_router;
/// # use tokio_test;
///
/// # tokio_test::block_on(async {
/// async fn hello(state: State<HelloWorldState>) {};
///
/// #[derive(Clone)]
/// struct HelloWorldState {};
///
/// let dbus = connection().await.unwrap();
/// let validation_routes = validation_router(
/// &dbus, "org.opensuse.HelloWorld", "/org/opensuse/hello"
/// ).await.unwrap();
/// let router: Router<HelloWorldState> = Router::new()
/// .route("/hello", get(hello))
/// .merge(validation_routes)
/// .with_state(HelloWorldState {});
/// });
/// ```
///
/// * `dbus`: D-Bus connection.
/// * `destination`: D-Bus service name.
/// * `path`: D-Bus object path.
pub async fn validation_router<T>(
dbus: &zbus::Connection,
destination: &str,
path: &str,
) -> Result<Router<T>, ServiceError> {
let proxy = build_validation_proxy(dbus, destination, path).await?;
let state = ValidationState { proxy };
Ok(Router::new()
.route("/validation", get(validation))
.with_state(state))
}

#[derive(Clone, Serialize, utoipa::ToSchema)]
pub struct ValidationResult {
valid: bool,
errors: Vec<String>,
}

async fn validation(
State(state): State<ValidationState<'_>>,
) -> Result<Json<ValidationResult>, Error> {
let validation = ValidationResult {
valid: state.proxy.valid().await?,
errors: state.proxy.errors().await?,
};
Ok(Json(validation))
}

#[derive(Clone)]
struct ValidationState<'a> {
proxy: ValidationProxy<'a>,
}

/// Builds a stream of the changes in the the `org.opensuse.Agama1.Validation`
/// interface of the given D-Bus object.
///
/// * `dbus`: D-Bus connection.
/// * `destination`: D-Bus service name.
/// * `path`: D-Bus object path.
pub async fn validation_stream(
dbus: zbus::Connection,
destination: &'static str,
path: &'static str,
) -> Result<Pin<Box<dyn Stream<Item = Event> + Send>>, Error> {
let proxy = build_validation_proxy(&dbus, destination, path).await?;
let stream = proxy
.receive_errors_changed()
.await
.then(move |change| async move {
if let Ok(errors) = change.get().await {
Some(Event::ValidationChanged {
service: destination.to_string(),
path: path.to_string(),
errors,
})
} else {
None
}
})
.filter_map(|e| e);
Ok(Box::pin(stream))
}

async fn build_validation_proxy<'a>(
dbus: &zbus::Connection,
destination: &str,
path: &str,
) -> Result<ValidationProxy<'a>, zbus::Error> {
let proxy = ValidationProxy::builder(dbus)
.destination(destination.to_string())?
.path(path.to_string())?
.build()
.await?;
Ok(proxy)
}
13 changes: 13 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Jun 13 10:50:44 UTC 2024 - Knut Anderssen <[email protected]>

- Apply network changes when connecting or disconnecting
(gh#openSUSE/agama#1320).

-------------------------------------------------------------------
Thu Jun 13 10:39:57 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

- Expose Issues API in users-related interface
(gh#openSUSE/agama#1202).
- Drop the old validations API.

-------------------------------------------------------------------
Wed Jun 12 10:15:33 UTC 2024 - Jorik Cronenberg <[email protected]>

Expand Down
48 changes: 0 additions & 48 deletions service/lib/agama/dbus/clients/with_validation.rb

This file was deleted.

Loading
Loading