コード例 #1
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."),
     )
コード例 #2
0
    def _basic_elements(self, id_title):
        if self._new:
            vs_id = ID(
                title=id_title,
                size=60,
                allow_empty=False,
                help=
                _("This ID is used as it's unique identifier. It cannot be changed later."
                  ),
            )
        else:
            vs_id = FixedValue(
                self._id,
                title=id_title,
            )

        return [
            ("id", vs_id),
            ("title",
             TextUnicode(
                 title=_("Title"),
                 size=60,
                 allow_empty=False,
             )),
            ("topic", self._get_topic_valuespec()),
            ("help", TextUnicode(
                title=_("Help"),
                size=60,
            )),
        ]
コード例 #3
0
ファイル: simple_modes.py プロジェクト: maxmalysh/checkmk
    def _vs_mandatory_elements(self):
        ident_attr: List = []
        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."),
                     default_value=self._default_id,
                     allow_empty=False,
                     size=80,
                 )),
            ]
        else:
            ident_attr = [
                ("ident", FixedValue(
                    self._ident,
                    title=_("Unique ID"),
                )),
            ]

        if self._mode_type.is_site_specific():
            site_attr = [
                ("site", self._mode_type.site_valuespec()),
            ]
        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
コード例 #4
0
 def parameters(cls, mode):
     return [(_("General Properties"), [
         (1.1, 'name',
          ID(
              title=_('Unique ID'),
              help=
              _("The ID will be used do identify this page in URLs. If this page has the "
                "same ID as a builtin page of the type <i>%s</i> then it will shadow the builtin one."
               ) % cls.phrase("title"),
          )),
         (1.2, 'title',
          TextUnicode(
              title=_('Title') + '<sup>*</sup>',
              size=50,
              allow_empty=False,
          )),
         (1.3, 'description',
          TextAreaUnicode(
              title=_('Description') + '<sup>*</sup>',
              help=_(
                  "The description is optional and can be used for explanations or documentation"
              ),
              rows=4,
              cols=50,
          )),
     ])]
コード例 #5
0
    def _basic_elements(self):
        if self._new:
            vs_id = ID(
                title=_("Tag ID"),
                size=60,
                allow_empty=False,
                help=_(
                    "The internal ID of the tag is used as it's unique identifier "
                    "It cannot be changed later."),
            )
        else:
            vs_id = FixedValue(
                self._id,
                title=_("Tag ID"),
            )

        return [
            ("id", vs_id),
            ("title",
             TextUnicode(
                 title=_("Title"),
                 size=60,
                 allow_empty=False,
             )),
            ("topic", self._get_topic_valuespec()),
        ]
コード例 #6
0
ファイル: check_catalog.py プロジェクト: bsmr/tribe29-checkmk
    def _from_vars(self):
        self._search = get_search_expression()
        self._topic = html.request.get_ascii_input("topic")
        if self._topic and not self._search:
            if not re.match("^[a-zA-Z0-9_./]+$", self._topic):
                raise MKUserError("topic", _("Invalid topic"))

            self._path = tuple(
                self._topic.split("/"))  # e.g. [ "hw", "network" ]
        else:
            self._path = tuple()

        for comp in self._path:
            ID().validate_value(comp, None)  # Beware against code injection!

        self._manpages = self._get_check_catalog()
        self._titles = man_pages.man_page_catalog_titles()

        self._has_second_level = None
        if self._topic and not self._search:
            for t, has_second_level, title, _helptext in self._man_page_catalog_topics(
            ):
                if t == self._path[0]:
                    self._has_second_level = has_second_level
                    self._topic_title = title
                    break

            if len(self._path) == 2:
                self._topic_title = self._titles.get(self._path[1],
                                                     self._path[1])
コード例 #7
0
    def _from_vars(self):
        self._topic = request.get_ascii_input_mandatory("topic", "")
        if not re.match("^[a-zA-Z0-9_./]+$", self._topic):
            raise MKUserError("topic", _("Invalid topic"))

        self._path: Tuple[str, ...] = tuple(self._topic.split("/"))  # e.g. [ "hw", "network" ]

        for comp in self._path:
            ID().validate_value(comp, None)  # Beware against code injection!

        self._manpages = _get_check_catalog(self._path)
        self._titles = man_pages.man_page_catalog_titles()

        self._has_second_level = None
        for t, has_second_level, title, _helptext in _man_page_catalog_topics():
            if t == self._path[0]:
                self._has_second_level = has_second_level
                self._topic_title = title
                break

        if len(self._path) == 2:
            self._topic_title = self._titles.get(self._path[1], self._path[1])
コード例 #8
0
ファイル: siemens_plc.py プロジェクト: LinuxHaus/checkmk
def _special_agents_siemens_plc_siemens_plc_value():
    return [
        Transform(
            valuespec=CascadingDropdown(
                title=_("The Area"),
                choices=[
                    (
                        "db",
                        _("Datenbaustein"),
                        Integer(
                            title="<nobr>%s</nobr>" % _("DB Number"),
                            minvalue=1,
                        ),
                    ),
                    ("input", _("Input")),
                    ("output", _("Output")),
                    ("merker", _("Merker")),
                    ("timer", _("Timer")),
                    ("counter", _("Counter")),
                ],
                orientation="horizontal",
                sorted=True,
            ),
            # Transform old Integer() value spec to new cascading dropdown value
            forth=lambda x: isinstance(x, int) and ("db", x) or x,
        ),
        Float(
            title=_("Address"),
            display_format="%.1f",
            help=
            _("Addresses are specified with a dot notation, where number "
              "before the dot specify the byte to fetch and the number after the "
              "dot specifies the bit to fetch. The number of the bit is always "
              "between 0 and 7."),
        ),
        CascadingDropdown(
            title=_("Datatype"),
            choices=[
                ("dint", _("Double Integer (DINT)")),
                ("real", _("Real Number (REAL)")),
                ("bit", _("Single Bit (BOOL)")),
                (
                    "str",
                    _("String (STR)"),
                    Integer(
                        minvalue=1,
                        title=_("Size"),
                        unit=_("Bytes"),
                    ),
                ),
                (
                    "raw",
                    _("Raw Bytes (HEXSTR)"),
                    Integer(
                        minvalue=1,
                        title=_("Size"),
                        unit=_("Bytes"),
                    ),
                ),
            ],
            orientation="horizontal",
            sorted=True,
        ),
        DropdownChoice(
            title=_("Type of the value"),
            choices=[
                (None, _("Unclassified")),
                ("temp", _("Temperature")),
                ("hours_operation", _("Hours of operation")),
                ("hours_since_service", _("Hours since service")),
                ("hours", _("Hours")),
                ("seconds_operation", _("Seconds of operation")),
                ("seconds_since_service", _("Seconds since service")),
                ("seconds", _("Seconds")),
                ("counter", _("Increasing counter")),
                ("flag", _("State flag (on/off)")),
                ("text", _("Text")),
            ],
            sorted=True,
        ),
        ID(
            title=_("Ident of the value"),
            help=_(" An identifier of your choice. This identifier "
                   "is used by the Check_MK checks to access "
                   "and identify the single values. The identifier "
                   "needs to be unique within a group of VALUETYPES."),
        ),
    ]