mirror of
https://github.com/lldap/lldap.git
synced 2026-07-25 17:58:44 +00:00
chore: Migrate all the crates to edition 2024
This commit is contained in:
committed by
nitnelave
parent
e18f2af54f
commit
ba9bcb3894
+2
-2
@@ -2,7 +2,7 @@
|
||||
name = "lldap_app"
|
||||
version = "0.6.2-alpha"
|
||||
description = "Frontend for LLDAP"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
include = ["src/**/*", "queries/**/*", "Cargo.toml", "../schema.graphql"]
|
||||
authors.workspace = true
|
||||
homepage.workspace = true
|
||||
@@ -23,7 +23,7 @@ serde_json = "1"
|
||||
url-escape = "0.1.1"
|
||||
validator = "0.14"
|
||||
validator_derive = "0.14"
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen = "0.2.100"
|
||||
wasm-bindgen-futures = "*"
|
||||
yew = "0.19.3"
|
||||
yew-router = "0.16"
|
||||
|
||||
@@ -23,15 +23,14 @@ use crate::{
|
||||
use gloo_console::error;
|
||||
use lldap_frontend_options::Options;
|
||||
use yew::{
|
||||
function_component,
|
||||
Context, function_component,
|
||||
html::Scope,
|
||||
prelude::{html, Component, Html},
|
||||
Context,
|
||||
prelude::{Component, Html, html},
|
||||
};
|
||||
use yew_router::{
|
||||
BrowserRouter, Switch,
|
||||
prelude::{History, Location},
|
||||
scope_ext::RouterScopeExt,
|
||||
BrowserRouter, Switch,
|
||||
};
|
||||
|
||||
#[function_component(AppContainer)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::infra::functional::{use_graphql_call, LoadableResult};
|
||||
use crate::infra::functional::{LoadableResult, use_graphql_call};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use yew::{function_component, html, virtual_dom::AttrValue, Properties};
|
||||
use yew::{Properties, function_component, html, virtual_dom::AttrValue};
|
||||
|
||||
#[derive(GraphQLQuery)]
|
||||
#[graphql(
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::components::{
|
||||
router::{AppRoute, Link},
|
||||
};
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use yew::{function_component, html, Callback, Properties};
|
||||
use yew::{Callback, Properties, function_component, html};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct Props {
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
},
|
||||
};
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use anyhow::{Result, anyhow, bail};
|
||||
use gloo_console::error;
|
||||
use lldap_auth::*;
|
||||
use validator_derive::Validate;
|
||||
|
||||
@@ -11,13 +11,13 @@ use crate::{
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
form_utils::{
|
||||
read_all_form_attributes, AttributeValue, EmailIsRequired, GraphQlAttributeSchema,
|
||||
IsAdmin,
|
||||
AttributeValue, EmailIsRequired, GraphQlAttributeSchema, IsAdmin,
|
||||
read_all_form_attributes,
|
||||
},
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
use anyhow::{ensure, Result};
|
||||
use anyhow::{Result, ensure};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use validator_derive::Validate;
|
||||
|
||||
@@ -6,10 +6,10 @@ use crate::{
|
||||
convert_attribute_type,
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
schema::{validate_attribute_type, AttributeType},
|
||||
schema::{AttributeType, validate_attribute_type},
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{Result, bail};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use lldap_validation::attributes::validate_attribute_name;
|
||||
|
||||
@@ -12,13 +12,13 @@ use crate::{
|
||||
api::HostService,
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
form_utils::{
|
||||
read_all_form_attributes, AttributeValue, EmailIsRequired, GraphQlAttributeSchema,
|
||||
IsAdmin,
|
||||
AttributeValue, EmailIsRequired, GraphQlAttributeSchema, IsAdmin,
|
||||
read_all_form_attributes,
|
||||
},
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
use anyhow::{ensure, Result};
|
||||
use anyhow::{Result, ensure};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use lldap_auth::{opaque, registration};
|
||||
|
||||
@@ -6,10 +6,10 @@ use crate::{
|
||||
convert_attribute_type,
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
schema::{validate_attribute_type, AttributeType},
|
||||
schema::{AttributeType, validate_attribute_type},
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{Result, bail};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use lldap_validation::attributes::validate_attribute_name;
|
||||
|
||||
@@ -4,8 +4,8 @@ use crate::{
|
||||
};
|
||||
use web_sys::Element;
|
||||
use yew::{
|
||||
function_component, html, use_effect_with_deps, use_node_ref, virtual_dom::AttrValue,
|
||||
Component, Context, Html, Properties,
|
||||
Component, Context, Html, Properties, function_component, html, use_effect_with_deps,
|
||||
use_node_ref, virtual_dom::AttrValue,
|
||||
};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
@@ -24,12 +24,12 @@ fn attribute_input(props: &AttributeInputProps) -> Html {
|
||||
AttributeType::DateTime => {
|
||||
return html! {
|
||||
<DateTimeInput name={props.name.clone()} value={props.value.clone()} />
|
||||
}
|
||||
};
|
||||
}
|
||||
AttributeType::Jpeg => {
|
||||
return html! {
|
||||
<JpegFileInput name={props.name.clone()} value={props.value.clone()} />
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yew::{function_component, html, virtual_dom::AttrValue, Callback, Properties};
|
||||
use yew::{Callback, Properties, function_component, html, virtual_dom::AttrValue};
|
||||
use yew_form::{Form, Model};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::str::FromStr;
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use wasm_bindgen::JsCast;
|
||||
use web_sys::HtmlInputElement;
|
||||
use yew::{function_component, html, use_state, virtual_dom::AttrValue, Event, Properties};
|
||||
use yew::{Event, Properties, function_component, html, use_state, virtual_dom::AttrValue};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct DateTimeInputProps {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yew::{function_component, html, virtual_dom::AttrValue, Callback, InputEvent, Properties};
|
||||
use yew::{Callback, InputEvent, Properties, function_component, html, virtual_dom::AttrValue};
|
||||
use yew_form::{Form, Model};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use anyhow::{bail, Error, Ok, Result};
|
||||
use anyhow::{Error, Ok, Result, bail};
|
||||
use gloo_file::{
|
||||
callbacks::{read_as_bytes, FileReader},
|
||||
File,
|
||||
callbacks::{FileReader, read_as_bytes},
|
||||
};
|
||||
use web_sys::{FileList, HtmlInputElement, InputEvent};
|
||||
use yew::Properties;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use yew::{
|
||||
function_component, html, virtual_dom::AttrValue, Callback, Children, InputEvent, Properties,
|
||||
Callback, Children, InputEvent, Properties, function_component, html, virtual_dom::AttrValue,
|
||||
};
|
||||
use yew_form::{Form, Model};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yew::{function_component, html, virtual_dom::AttrValue, Children, Properties};
|
||||
use yew::{Children, Properties, function_component, html, virtual_dom::AttrValue};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct Props {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use web_sys::MouseEvent;
|
||||
use yew::{function_component, html, virtual_dom::AttrValue, Callback, Children, Properties};
|
||||
use yew::{Callback, Children, Properties, function_component, html, virtual_dom::AttrValue};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct Props {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::infra::attributes::AttributeDescription;
|
||||
use lldap_validation::attributes::{validate_attribute_name, ALLOWED_CHARACTERS_DESCRIPTION};
|
||||
use yew::{html, Html};
|
||||
use lldap_validation::attributes::{ALLOWED_CHARACTERS_DESCRIPTION, validate_attribute_name};
|
||||
use yew::{Html, html};
|
||||
|
||||
fn render_attribute_aliases(attribute_description: &AttributeDescription) -> Html {
|
||||
if attribute_description.aliases.is_empty() {
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
form_utils::GraphQlAttributeSchema,
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Error, Result};
|
||||
use anyhow::{Error, Result, bail};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use yew::prelude::*;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{
|
||||
},
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
form_utils::{read_all_form_attributes, AttributeValue, EmailIsRequired, IsAdmin},
|
||||
form_utils::{AttributeValue, EmailIsRequired, IsAdmin, read_all_form_attributes},
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
use anyhow::{anyhow, Error, Result};
|
||||
use anyhow::{Error, Result, anyhow};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use yew::prelude::*;
|
||||
@@ -57,21 +57,21 @@ impl CommonComponent<GroupSchemaTable> for GroupSchemaTable {
|
||||
Ok(true)
|
||||
}
|
||||
Msg::OnError(e) => Err(e),
|
||||
Msg::OnAttributeDeleted(attribute_name) => {
|
||||
match self.attributes {
|
||||
None => {
|
||||
log!(format!("Attribute {attribute_name} was deleted but component has no attributes"));
|
||||
Err(anyhow!("invalid state"))
|
||||
}
|
||||
Some(_) => {
|
||||
self.attributes
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.retain(|a| a.name != attribute_name);
|
||||
Ok(true)
|
||||
}
|
||||
Msg::OnAttributeDeleted(attribute_name) => match self.attributes {
|
||||
None => {
|
||||
log!(format!(
|
||||
"Attribute {attribute_name} was deleted but component has no attributes"
|
||||
));
|
||||
Err(anyhow!("invalid state"))
|
||||
}
|
||||
}
|
||||
Some(_) => {
|
||||
self.attributes
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.retain(|a| a.name != attribute_name);
|
||||
Ok(true)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
},
|
||||
};
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use anyhow::{Result, anyhow, bail};
|
||||
use gloo_console::error;
|
||||
use lldap_auth::*;
|
||||
use validator_derive::Validate;
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{Result, bail};
|
||||
use validator_derive::Validate;
|
||||
use yew::prelude::*;
|
||||
use yew_form::Form;
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{Result, bail};
|
||||
use lldap_auth::{
|
||||
opaque::client::registration as opaque_registration,
|
||||
password_reset::ServerPasswordResetResponse, registration,
|
||||
@@ -148,7 +148,7 @@ impl Component for ResetPasswordStep2Form {
|
||||
(None, None) => {
|
||||
return html! {
|
||||
{"Validating token"}
|
||||
}
|
||||
};
|
||||
}
|
||||
(None, Some(e)) => {
|
||||
return html! {
|
||||
@@ -163,7 +163,7 @@ impl Component for ResetPasswordStep2Form {
|
||||
{"Back"}
|
||||
</Link>
|
||||
</>
|
||||
}
|
||||
};
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
form_utils::GraphQlAttributeSchema,
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Error, Result};
|
||||
use anyhow::{Error, Result, bail};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use yew::prelude::*;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{
|
||||
},
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
form_utils::{read_all_form_attributes, AttributeValue, EmailIsRequired, IsAdmin},
|
||||
form_utils::{AttributeValue, EmailIsRequired, IsAdmin, read_all_form_attributes},
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
schema::AttributeType,
|
||||
},
|
||||
};
|
||||
use anyhow::{anyhow, Error, Result};
|
||||
use anyhow::{Error, Result, anyhow};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use yew::prelude::*;
|
||||
@@ -55,21 +55,21 @@ impl CommonComponent<UserSchemaTable> for UserSchemaTable {
|
||||
Ok(true)
|
||||
}
|
||||
Msg::OnError(e) => Err(e),
|
||||
Msg::OnAttributeDeleted(attribute_name) => {
|
||||
match self.attributes {
|
||||
None => {
|
||||
log!(format!("Attribute {attribute_name} was deleted but component has no attributes"));
|
||||
Err(anyhow!("invalid state"))
|
||||
}
|
||||
Some(_) => {
|
||||
self.attributes
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.retain(|a| a.name != attribute_name);
|
||||
Ok(true)
|
||||
}
|
||||
Msg::OnAttributeDeleted(attribute_name) => match self.attributes {
|
||||
None => {
|
||||
log!(format!(
|
||||
"Attribute {attribute_name} was deleted but component has no attributes"
|
||||
));
|
||||
Err(anyhow!("invalid state"))
|
||||
}
|
||||
}
|
||||
Some(_) => {
|
||||
self.attributes
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.retain(|a| a.name != attribute_name);
|
||||
Ok(true)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use super::cookies::set_cookie;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use gloo_net::http::{Method, RequestBuilder};
|
||||
use graphql_client::GraphQLQuery;
|
||||
use lldap_auth::{login, registration, JWTClaims};
|
||||
use lldap_auth::{JWTClaims, login, registration};
|
||||
|
||||
use lldap_frontend_options::Options;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use serde::{Serialize, de::DeserializeOwned};
|
||||
use web_sys::RequestCredentials;
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use anyhow::{Result, anyhow};
|
||||
use chrono::prelude::*;
|
||||
use wasm_bindgen::JsCast;
|
||||
use web_sys::HtmlDocument;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::{anyhow, ensure, Result};
|
||||
use anyhow::{Result, anyhow, ensure};
|
||||
use validator::validate_email;
|
||||
use web_sys::{FormData, HtmlFormElement};
|
||||
use yew::NodeRef;
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::infra::api::HostService;
|
||||
use anyhow::Result;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use wasm_bindgen_futures::spawn_local;
|
||||
use yew::{use_effect_with_deps, use_state_eq, UseStateHandle};
|
||||
use yew::{UseStateHandle, use_effect_with_deps, use_state_eq};
|
||||
|
||||
// Enum to represent a result that is fetched asynchronously.
|
||||
#[derive(Debug)]
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
pub mod components;
|
||||
pub mod infra;
|
||||
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, JsValue};
|
||||
use wasm_bindgen::prelude::{JsValue, wasm_bindgen};
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn run_app() -> Result<(), JsValue> {
|
||||
|
||||
Reference in New Issue
Block a user