Add status structable macros for alternative field

Some resources uses `state` or `operating_status` as a sort of `status`
property. Set `status` StructTable marcros for such fields so that
output coloring use those fields.

Change-Id: I1c1faa0f69e1d22b6230db2df90a981ca496e643
This commit is contained in:
Artem Goncharov 2024-12-03 11:20:27 +01:00
parent 84db415a8f
commit fddec42f7e

View File

@ -34,6 +34,7 @@ BASIC_FIELDS = [
"uuid",
"state",
"status",
"operating_status",
]
@ -276,6 +277,16 @@ class StructFieldResponse(common_rust.StructField):
# there is at least "id" field existing in the struct OR the
# field is not in the first 10
macros.add("wide")
if (
self.local_name == "state"
and "status" not in struct.fields.keys()
):
macros.add("status")
elif (
self.local_name == "operating_status"
and "status" not in struct.fields.keys()
):
macros.add("status")
if self.data_type.type_hint in [
"Value",
"Option<Value>",