Configurable device display name (#13528)

* Configurable device display name
You can just set the display name in device settings.

It also accepts simple template format with  the variables: hostname, sysName, sysName_fallback, ip

Default controlled by device_display_default, (set from old force_hostname_to_sysname and force_ip_to_sysname settings

* remove second argument to format_hostname()

* Style fixes

* Update schema

* update phpstan baseline

* Improved settings strings (and add for translation)
This commit is contained in:
Tony Murray
2021-11-18 15:46:22 -06:00
committed by GitHub
parent 69d0753ec4
commit 790c4b3402
24 changed files with 196 additions and 159 deletions

View File

@@ -874,6 +874,19 @@
"ifAlias": "ifAlias"
}
},
"device_display_default": {
"group": "webui",
"section": "device",
"order": 1,
"default": null,
"type": "select",
"options": {
"{{ $hostname }}": "hostname",
"{{ $sysName_fallback }}": "sysName_fallback",
"{{ $sysName }}": "sysName",
"{{ $ip }}": "ip"
}
},
"device_perf_purge": {
"default": 7,
"units": "days",
@@ -1597,20 +1610,6 @@
"order": 2,
"type": "text"
},
"force_hostname_to_sysname": {
"group": "webui",
"section": "device",
"order": 0,
"default": false,
"type": "boolean"
},
"force_ip_to_sysname": {
"group": "webui",
"section": "device",
"order": 1,
"default": false,
"type": "boolean"
},
"fping": {
"default": "fping",
"group": "external",

View File

@@ -495,6 +495,7 @@ devices:
- { Field: inserted, Type: timestamp, 'Null': true, Extra: '', Default: CURRENT_TIMESTAMP }
- { Field: hostname, Type: varchar(128), 'Null': false, Extra: '' }
- { Field: sysName, Type: varchar(128), 'Null': true, Extra: '' }
- { Field: display, Type: varchar(128), 'Null': true, Extra: '' }
- { Field: ip, Type: varbinary(16), 'Null': true, Extra: '' }
- { Field: overwrite_ip, Type: varchar(40), 'Null': true, Extra: '' }
- { Field: community, Type: varchar(255), 'Null': true, Extra: '' }