|
16 | 16 | import logging
|
17 | 17 | from datetime import datetime
|
18 | 18 | from datetime import timedelta
|
19 |
| -from typing import TYPE_CHECKING |
20 | 19 | from typing import Any
|
21 | 20 | from typing import Dict
|
22 | 21 | from typing import Iterable
|
|
46 | 45 | from typing_extensions import TypeAliasType
|
47 | 46 | from typing_extensions import TypedDict
|
48 | 47 |
|
| 48 | +from zabbix_cli.models import ColsRowsType |
| 49 | +from zabbix_cli.models import RowsType |
49 | 50 | from zabbix_cli.models import TableRenderable
|
50 | 51 | from zabbix_cli.output.style import Color
|
51 | 52 | from zabbix_cli.pyzabbix.enums import AckStatus
|
|
61 | 62 | from zabbix_cli.pyzabbix.enums import MaintenancePeriodType
|
62 | 63 | from zabbix_cli.pyzabbix.enums import MaintenanceStatus
|
63 | 64 | from zabbix_cli.pyzabbix.enums import MaintenanceWeekType
|
| 65 | +from zabbix_cli.pyzabbix.enums import MediaTypeType |
64 | 66 | from zabbix_cli.pyzabbix.enums import MonitoredBy
|
65 | 67 | from zabbix_cli.pyzabbix.enums import MonitoringStatus
|
66 | 68 | from zabbix_cli.pyzabbix.enums import ProxyCompatibility
|
|
77 | 79 | from zabbix_cli.utils.utils import get_maintenance_status
|
78 | 80 | from zabbix_cli.utils.utils import get_monitoring_status
|
79 | 81 |
|
80 |
| -if TYPE_CHECKING: |
81 |
| - from zabbix_cli.models import ColsRowsType |
82 |
| - from zabbix_cli.models import RowsType |
83 |
| - |
84 |
| - |
85 | 82 | logger = logging.getLogger(__name__)
|
86 | 83 |
|
87 | 84 | SortOrder = Literal["ASC", "DESC"]
|
@@ -843,6 +840,23 @@ class MediaType(ZabbixAPIBaseModel):
|
843 | 840 | type: int
|
844 | 841 | description: Optional[str] = None
|
845 | 842 |
|
| 843 | + @computed_field |
| 844 | + @property |
| 845 | + def type_str(self) -> str: |
| 846 | + return MediaTypeType.string_from_value(self.type) |
| 847 | + |
| 848 | + def __cols_rows__(self) -> ColsRowsType: |
| 849 | + cols = ["ID", "Name", "Type", "Description"] |
| 850 | + rows: RowsType = [ |
| 851 | + [ |
| 852 | + self.mediatypeid, |
| 853 | + self.name, |
| 854 | + self.type_str, |
| 855 | + self.description or "", |
| 856 | + ] |
| 857 | + ] |
| 858 | + return cols, rows |
| 859 | + |
846 | 860 |
|
847 | 861 | class UserMedia(ZabbixAPIBaseModel):
|
848 | 862 | """Media attached to a user object."""
|
|
0 commit comments