mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-01-18 18:46:24 +00:00
ui: Make device metric name optional.
If enabled, metrics will be automatically detected and created based on the decoded payload. The key will be set, but the name is left blank for the user to configure. This can be confusing as it leads to validation errors in the device-profile form if the name is not filled in. The UI does show that one of the fields failed to validate, but even with such notification, it is not clear that users have to check one of the form tabs which they didn't edit on save. This makes the name optional and uses the key as fallback such that saving the form no longer fails in case the name is still blank. Closes #313.
This commit is contained in:
parent
b0ed12a1f5
commit
464937169b
@ -714,7 +714,11 @@ impl DeviceService for Device {
|
||||
out.metrics.insert(
|
||||
k.to_string(),
|
||||
common::Metric {
|
||||
name: v.name.to_string(),
|
||||
name: if v.name.is_empty() {
|
||||
k.to_string()
|
||||
} else {
|
||||
v.name.to_string()
|
||||
},
|
||||
timestamps: m
|
||||
.iter()
|
||||
.map(|row| {
|
||||
|
@ -1125,7 +1125,6 @@ function DeviceProfileForm(props: IProps) {
|
||||
{...restField}
|
||||
name={[name, 1, "name"]}
|
||||
fieldKey={[name, 1, "name"]}
|
||||
rules={[{ required: true, message: "Please enter a name!" }]}
|
||||
>
|
||||
<Input placeholder="Measurement name" disabled={props.disabled} />
|
||||
</Form.Item>
|
||||
|
Loading…
Reference in New Issue
Block a user