mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-03 17:43:59 +03:00
Miscellaneous fixes (#23177)
* add optional onClick to EmptyCard * show EmptyCard in face rec when face library is empty * add loading indicator * add description to camera management pane * Cleanup when use snapshot but can't load snapshot * Migrate files * fix birdseye color distortion when configured aspect ratio is unsupported * Skip processing end for object descriptions * don't crash if stats is null * fix genai roles in migration * frigate+ pane updates - allow users to select a plus model from the select even when one was not previously loaded - always show model summary card - add model filter popover - add restart button totast * fix frigate+ pane layout and buttons to match other settings panes * match button layout in go2rtc settings view * make audio maintainer respond to dynamic config updates * check correct zone name in publish state * fix nested translation extraction for Optional dict and list fields * mypy --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
co-authored by
Nicolas Mowen
parent
c67170aa20
commit
4e90d254ed
@@ -150,29 +150,51 @@ def extract_translations_from_schema(
|
||||
# Handle anyOf cases
|
||||
elif "anyOf" in field_schema:
|
||||
for item in field_schema["anyOf"]:
|
||||
nested = None
|
||||
if item.get("type") == "null":
|
||||
continue
|
||||
if "properties" in item:
|
||||
nested = extract_translations_from_schema(item, defs=defs)
|
||||
elif "$ref" in item:
|
||||
ref_path = item["$ref"]
|
||||
if ref_path.startswith("#/$defs/"):
|
||||
ref_name = ref_path.split("/")[-1]
|
||||
if ref_name in defs:
|
||||
nested = extract_translations_from_schema(
|
||||
defs[ref_name], defs=defs
|
||||
)
|
||||
elif (
|
||||
"additionalProperties" in item
|
||||
and isinstance(item["additionalProperties"], dict)
|
||||
and "$ref" in item["additionalProperties"]
|
||||
):
|
||||
ref_path = item["additionalProperties"]["$ref"]
|
||||
if ref_path.startswith("#/$defs/"):
|
||||
ref_name = ref_path.split("/")[-1]
|
||||
if ref_name in defs:
|
||||
nested = extract_translations_from_schema(
|
||||
defs[ref_name], defs=defs
|
||||
)
|
||||
elif (
|
||||
"items" in item
|
||||
and isinstance(item["items"], dict)
|
||||
and ("$ref" in item["items"])
|
||||
):
|
||||
ref_path = item["items"]["$ref"]
|
||||
if ref_path.startswith("#/$defs/"):
|
||||
ref_name = ref_path.split("/")[-1]
|
||||
if ref_name in defs:
|
||||
nested = extract_translations_from_schema(
|
||||
defs[ref_name], defs=defs
|
||||
)
|
||||
|
||||
if nested:
|
||||
nested_without_root = {
|
||||
k: v
|
||||
for k, v in nested.items()
|
||||
if k not in ("label", "description")
|
||||
}
|
||||
field_translations.update(nested_without_root)
|
||||
elif "$ref" in item:
|
||||
ref_path = item["$ref"]
|
||||
if ref_path.startswith("#/$defs/"):
|
||||
ref_name = ref_path.split("/")[-1]
|
||||
if ref_name in defs:
|
||||
ref_schema = defs[ref_name]
|
||||
nested = extract_translations_from_schema(
|
||||
ref_schema, defs=defs
|
||||
)
|
||||
nested_without_root = {
|
||||
k: v
|
||||
for k, v in nested.items()
|
||||
if k not in ("label", "description")
|
||||
}
|
||||
field_translations.update(nested_without_root)
|
||||
|
||||
if field_translations:
|
||||
translations[field_name] = field_translations
|
||||
|
||||
Reference in New Issue
Block a user