[feat] console : add a redirection to a device details page after creation
use crate::error::{ErrorNotification, ErrorNotifier};
+use crate::pages::{
+ devices::AppRoute,
+ devices::ApplicationContext,
+ devices::{DetailsSection, Pages},
+};
use crate::utils::url_encode;
use crate::{backend::Backend, error::error};
use http::{Method, StatusCode};
use patternfly_yew::*;
use yew::prelude::*;
+use yew_router::{agent::RouteRequest, prelude::*};
use crate::backend::{ApiResponse, Json, JsonHandlerScopeExt, RequestHandle};
use serde_json::json;
@@ -54,7 +60,13 @@ impl Component for CreateDialog {
}
Msg::Success => {
ctx.props().on_close.emit(());
- BackdropDispatcher::default().close()
+ RouteAgentDispatcher::<()>::new().send(RouteRequest::ChangeRoute(Route::from(
+ AppRoute::Devices(Pages::Details {
+ app: ApplicationContext::Single(ctx.props().app.clone()),
+ name: self.new_device_name.clone(),
+ details: DetailsSection::Overview,
+ }),
+ )))
}
Msg::NewDeviceName(name) => self.new_device_name = name,
};
