Add collector PC->printer links and searchable custom fields
Collector: the computers collector schema gains defaultprinter and printers; apply_collector_payload resolves each reported identifier to a printer asset (windowsname/hostname/sharename/assetnumber/IP, first-hit case-insensitive) and idempotently syncs relationships - defaultprinter (directional) for the default, connectedto for the rest. Collector-created rows are tagged so a re-report archives dropped links while manual relationships are never touched; unresolved identifiers warn instead of failing. Both PC and printer detail pages show the links via the shared relationships card (no frontend change). GE-Enforce Win32_Printer collection snippet documented. Searchable custom fields: a per-field searchable flag (migration 7d24); global search matches custom-field values on flagged active fields and routes each hit to the asset detail page, reusing the existing (type,id) dedupe and search_<type>_enabled domain filter. Searchable toggle on the Custom Fields settings page. 822 tests pass; both verified live. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,6 +87,7 @@ def create_field():
|
||||
existing.options = _normalize_options(data.get('options'))
|
||||
existing.showondetail = bool(data.get('showondetail', True))
|
||||
existing.showonform = bool(data.get('showonform', True))
|
||||
existing.searchable = bool(data.get('searchable', False))
|
||||
existing.sortorder = data.get('sortorder', 0)
|
||||
db.session.commit()
|
||||
return success_response(existing.to_dict(), message='Reactivated existing field')
|
||||
@@ -101,6 +102,7 @@ def create_field():
|
||||
options=_normalize_options(data.get('options')),
|
||||
showondetail=bool(data.get('showondetail', True)),
|
||||
showonform=bool(data.get('showonform', True)),
|
||||
searchable=bool(data.get('searchable', False)),
|
||||
sortorder=data.get('sortorder', 0),
|
||||
)
|
||||
db.session.add(field)
|
||||
@@ -124,7 +126,7 @@ def update_field(fieldid):
|
||||
field.datatype = data['datatype']
|
||||
if 'options' in data:
|
||||
field.options = _normalize_options(data['options'])
|
||||
for key in ('showondetail', 'showonform', 'isactive'):
|
||||
for key in ('showondetail', 'showonform', 'isactive', 'searchable'):
|
||||
if key in data:
|
||||
setattr(field, key, bool(data[key]))
|
||||
if 'sortorder' in data:
|
||||
|
||||
Reference in New Issue
Block a user