app: create group attribute schema page (#825)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::{
|
||||
components::{
|
||||
form::{checkbox::CheckBox, field::Field, select::Select, submit::Submit},
|
||||
@@ -8,13 +6,12 @@ use crate::{
|
||||
convert_attribute_type,
|
||||
infra::{
|
||||
common_component::{CommonComponent, CommonComponentParts},
|
||||
schema::AttributeType,
|
||||
schema::{validate_attribute_type, AttributeType},
|
||||
},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
use gloo_console::log;
|
||||
use graphql_client::GraphQLQuery;
|
||||
use validator::ValidationError;
|
||||
use validator_derive::Validate;
|
||||
use yew::prelude::*;
|
||||
use yew_form_derive::Model;
|
||||
@@ -47,14 +44,6 @@ pub struct CreateUserAttributeModel {
|
||||
is_visible: bool,
|
||||
}
|
||||
|
||||
fn validate_attribute_type(attribute_type: &str) -> Result<(), ValidationError> {
|
||||
let result = AttributeType::from_str(attribute_type);
|
||||
match result {
|
||||
Ok(_) => Ok(()),
|
||||
_ => Err(ValidationError::new("Invalid attribute type")),
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Msg {
|
||||
Update,
|
||||
SubmitForm,
|
||||
@@ -146,7 +135,7 @@ impl Component for CreateUserAttributeForm {
|
||||
label="Type"
|
||||
required={true}
|
||||
form={&self.form}
|
||||
field_name="attribute_name"
|
||||
field_name="attribute_type"
|
||||
oninput={link.callback(|_| Msg::Update)}>
|
||||
<option selected=true value="String">{"String"}</option>
|
||||
<option value="Integer">{"Integer"}</option>
|
||||
|
||||
Reference in New Issue
Block a user