Пример #1
0
    def _vs_mandatory_elements(self):
        if self._new:
            ident_attr = [
                ("ident",
                 ID(
                     title=_("Unique ID"),
                     help=_(
                         "The ID must be a unique text. It will be used as an internal key "
                         "when objects refer to this object."),
                     allow_empty=False,
                     size=12,
                 )),
            ]
        else:
            ident_attr = [
                ("ident", FixedValue(
                    self._ident,
                    title=_("Unique ID"),
                )),
            ]

        if self._mode_type.is_site_specific():
            site_attr = [
                ("site", SiteChoice()),
            ]
        else:
            site_attr = []

        if self._mode_type.can_be_disabled():
            disable_attr = [
                ("disabled",
                 Checkbox(
                     title=_("Activation"),
                     help=
                     _("Disabled %s are kept in the configuration but are not active."
                       ) % self._mode_type.name_singular(),
                     label=_("do not activate this %s") %
                     self._mode_type.name_singular(),
                 )),
            ]
        else:
            disable_attr = []

        elements = ident_attr + [
            ("title",
             TextUnicode(
                 title=_("Title"),
                 help=_(
                     "The title of the %s. It will be used as display name.") %
                 (self._mode_type.name_singular()),
                 allow_empty=False,
                 size=80,
             )),
            ("comment", RuleComment()),
            ("docu_url", DocumentationURL()),
        ] + disable_attr + site_attr

        return elements
Пример #2
0
 def valuespec(self):
     return SiteChoice(
         title=_("Monitored on site"),
         help=_("Specify the site that should monitor this host."),
         invalid_choice_error=_("The configured site is not known to this site. In case you "
                                "are configuring in a distributed slave, this may be a host "
                                "monitored by another site. If you want to modify this "
                                "host, you will have to change the site attribute to the "
                                "local site. But this may make the host be monitored from "
                                "multiple sites."),
     )
Пример #3
0
 def __init__(self):
     super(LockedByValuespec, self).__init__(
         orientation="horizontal",
         title_br=False,
         elements=[
             SiteChoice(),
             ID(title=_("Program"),),
             ID(title=_("Connection ID"),),
         ],
         title=_("Locked by"),
         help=_("The host is (partially) managed by an automatic data source like the "
                "Dynamic Configuration."),
     )
Пример #4
0
 def site_valuespec(self):
     # type: () -> SiteChoice
     return SiteChoice()
Пример #5
0
 def site_valuespec(self) -> SiteChoice:
     return SiteChoice()