Ejemplo n.º 1
0
 def display(self):
     html.begin_checkbox_group()
     for state, state_name in sorted(defines.interface_oper_states().items()):
         if state >= 8:
             continue  # skip artificial state 8 (degraded) and 9 (admin down)
         varname = self.ident + "_" + str(state)
         html.checkbox(varname, True, label=state_name)
         if state in (4, 7):
             html.br()
     html.end_checkbox_group()
Ejemplo n.º 2
0
def checkbox_row(
    options: List[Tuple[str, str]], value: FilterHTTPVariables, title: Optional[str] = None
) -> None:
    html.begin_checkbox_group()
    if title:
        html.write_text(title)
    checkbox_default = not any(value.values())
    for var, text in options:
        html.checkbox(var, bool(value.get(var, checkbox_default)), label=text)
    html.end_checkbox_group()
Ejemplo n.º 3
0
 def display(self, value: FilterHTTPVariables) -> None:
     html.begin_checkbox_group()
     for state, state_name in sorted(defines.interface_oper_states().items()):
         if not isinstance(state, int):  # needed because of silly types
             continue
         if state >= 8:
             continue  # skip artificial state 8 (degraded) and 9 (admin down)
         varname = self.ident + "_" + str(state)
         html.checkbox(varname, bool(value.get(varname, True)), label=state_name)
         if state in (4, 7):
             html.br()
     html.end_checkbox_group()