Exemplo n.º 1
0
    def _vs_inventory_paths_and_keys(self) -> CascadingDropdown:
        def vs_choices(title):
            return CascadingDropdown(
                title=title,
                choices=[
                    ("nothing", _("Restrict all")),
                    (
                        "choices",
                        _("Restrict the following keys"),
                        ListOfStrings(
                            orientation="horizontal",
                            size=15,
                            allow_empty=True,
                        ),
                    ),
                ],
                default_value="nothing",
            )

        return CascadingDropdown(
            choices=[
                ("allow_all", _("Allowed to see the whole tree")),
                ("forbid_all", _("Forbid to see the whole tree")),
                (
                    "paths",
                    _("Allowed to see parts of the tree"),
                    ListOf(
                        Dictionary(
                            elements=[
                                vs_element_inventory_visible_raw_path(),
                                ("attributes",
                                 vs_choices(_("Restrict single values"))),
                                ("columns",
                                 vs_choices(_("Restrict table columns"))),
                                ("nodes",
                                 vs_choices(_("Restrict subcategories"))),
                            ],
                            optional_keys=["attributes", "columns", "nodes"],
                        ),
                        help=vs_inventory_path_or_keys_help() +
                        _("<br>If single values, table columns or subcategories are not"
                          " restricted, then all entries are added respectively."
                          ),
                    ),
                ),
            ],
            default_value="allow_all",
        )
Exemplo n.º 2
0
def _valuespec_inv_retention_intervals() -> ValueSpec:
    def vs_choices(title):
        return CascadingDropdown(
            title=title,
            choices=[
                ("all", _("Choose all")),
                (
                    "choices",
                    _("Choose the following keys"),
                    ListOfStrings(
                        orientation="horizontal",
                        size=15,
                        allow_empty=True,
                    ),
                ),
            ],
            default_value="choices",
        )

    return ListOf(
        Dictionary(
            elements=[
                (
                    "interval",
                    Age(
                        title=_(
                            "How long single values or table columns are kept."
                        ),
                        minvalue=1,
                        default_value=3600 * 2,
                        display=["days", "hours", "minutes"],
                    ),
                ),
                vs_element_inventory_visible_raw_path(),
                ("attributes", vs_choices(_("Choose single values"))),
                ("columns", vs_choices(_("Choose table columns"))),
            ],
            optional_keys=["attributes", "columns"],
        ),
        title=_("Retention intervals for HW/SW inventory entities"),
        help=vs_inventory_path_or_keys_help() +
        _("<br>With these intervals specific single values or table columns can be kept"
          " from the previous inventory tree if the current agent output does not"
          " provide any new data for these entries."
          "<br>Only entries corresponding to chosen single values or columns are added."
          ),
    )