app: Fix attribute type parsing

This commit is contained in:
Valentin Tolmer
2025-07-30 00:56:53 +02:00
committed by nitnelave
parent 3c7e4c3dec
commit 363ef106e2
5 changed files with 42 additions and 13 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ impl CommonComponent<CreateGroupAttributeForm> for CreateGroupAttributeForm {
);
})?;
let attribute_type =
serde_json::from_str::<AttributeType>(&model.attribute_type).unwrap();
AttributeType::try_from(model.attribute_type.as_str()).unwrap();
let req = create_group_attribute::Variables {
name: model.attribute_name,
attribute_type,
@@ -144,7 +144,7 @@ impl Component for CreateGroupAttributeForm {
oninput={link.callback(|_| Msg::Update)}>
<option selected=true value="String">{"String"}</option>
<option value="Integer">{"Integer"}</option>
<option value="Jpeg">{"Jpeg"}</option>
<option value="JpegPhoto">{"Jpeg"}</option>
<option value="DateTime">{"DateTime"}</option>
</Select<CreateGroupAttributeModel>>
<CheckBox<CreateGroupAttributeModel>
+2 -2
View File
@@ -73,7 +73,7 @@ impl CommonComponent<CreateUserAttributeForm> for CreateUserAttributeForm {
);
})?;
let attribute_type =
serde_json::from_str::<AttributeType>(&model.attribute_type).unwrap();
AttributeType::try_from(model.attribute_type.as_str()).unwrap();
let req = create_user_attribute::Variables {
name: model.attribute_name,
attribute_type,
@@ -146,7 +146,7 @@ impl Component for CreateUserAttributeForm {
oninput={link.callback(|_| Msg::Update)}>
<option selected=true value="String">{"String"}</option>
<option value="Integer">{"Integer"}</option>
<option value="Jpeg">{"Jpeg"}</option>
<option value="JpegPhoto">{"Jpeg"}</option>
<option value="DateTime">{"DateTime"}</option>
</Select<CreateUserAttributeModel>>
<CheckBox<CreateUserAttributeModel>