class AlertFormCommon(ControlExplorerView): description = Input(name="description") active = Checkbox("enabled_cb") based_on = BootstrapSelect("miq_alert_db") @View.nested class evaluate(View): # noqa type = BootstrapSelect("exp_name") # Real Time Performance Parameters performance_field = BootstrapSelect("perf_column") performance_field_operator = BootstrapSelect("select_operator") performance_field_value = Input(name="value_threshold") performance_trend = BootstrapSelect("trend_direction") performance_time_threshold = BootstrapSelect("rt_time_threshold") # Hardware Reconfigured Parameters hardware_attribute = BootstrapSelect("select_hdw_attr") operator = BootstrapSelect("select_operator") def fill(self, values): new_values = dict(type=values[0], **values[1]) return View.fill(self, new_values) driving_event = BootstrapSelect("exp_event") notification_frequency = BootstrapSelect("repeat_time") snmp_trap_send = Checkbox("send_snmp_cb") snmp_trap = SNMPForm() timeline_event = Checkbox("send_evm_event_cb") mgmt_event_send = Checkbox("send_event_cb") mgmt_event = Input("event_name") cancel_button = Button("Cancel") emails_send = Checkbox("send_email_cb") emails = AlertEmail()
class AlertFormCommon(ControlExplorerView): description = Input(name="description") active = Checkbox("enabled_cb") severity = BootstrapSelect("miq_alert_severity") based_on = BootstrapSelect("miq_alert_db") @View.nested class evaluate(View): # noqa type = BootstrapSelect("exp_name") # Real Time Performance Parameters performance_field = BootstrapSelect("perf_column") performance_field_operator = BootstrapSelect("select_operator") performance_field_value = Input(name="value_threshold") performance_trend = BootstrapSelect("trend_direction") performance_time_threshold = BootstrapSelect("rt_time_threshold") # Hardware Reconfigured Parameters hardware_attribute = BootstrapSelect("select_hdw_attr") operator = BootstrapSelect("select_operator") # Expression Parameters expression = ExpressionEditor( "//button[normalize-space(.)='Define Expression']") def fill(self, values): if isinstance(values, str): new_values = dict(type=values) elif isinstance(values, (list, tuple)): new_values = dict(type=values[0], **values[1]) else: raise TypeError("Evaluate part should be a string or tuple.") return View.fill(self, new_values) driving_event = BootstrapSelect("exp_event") notification_frequency = BootstrapSelect("repeat_time") snmp_trap_send = Checkbox("send_snmp_cb") snmp_trap = SNMPForm() timeline_event = Checkbox("send_evm_event_cb") mgmt_event_send = Checkbox("send_event_cb") mgmt_event = Input("event_name") cancel_button = Button("Cancel") emails_send = Checkbox("send_email_cb") emails = AlertEmail()