mwielgoszewski/doorman

View on GitHub
doorman/templates/manage/forms/rule.html

Summary

Maintainability
Test Coverage
                <form class="form-horizontal" method="POST">
                    <fieldset>
                        {% if rule is defined %}
                        <legend>update rule</legend>
                        {% else %}
                        <legend>add rule</legend>
                        {% endif %}
                        {{ form.csrf_token }}

                        <div class="form-group">
                            {{ form.name.label(class_="col-sm-2 control-label") }}
                            <div class="col-sm-10">
                                {{ form.name(class_="form-control") }}
                            </div>
                        </div>

                        <div class="form-group">
                            {{ form.description.label(class_="col-sm-2 control-label") }}
                            <div class="col-sm-10">
                                {{ form.description(class_="form-control") }}
                                <small>
                                    Note: Rule names and descriptions may be treated as <a href="https://docs.python.org/dev/library/string.html#template-strings">Template strings</a> for <em>some</em> alerters.
                                    Valid placeholders may include column keys returned in query results and/or node attributes (i.e., <tt>host_identifier</tt>, <tt>enrolled_on</tt>).
                                    A missing placeholder will result in the original placeholder to appear in the resulting string intact.
                                </small>
                            </div>
                        </div>

                        <div class="form-group">
                            {{ form.alerters.label(class_="col-sm-2 control-label") }}
                            <div class="col-sm-10">
                                {{ form.alerters(class_="form-control") }}
                            </div>
                        </div>

                        <div class="form-group">
                            {{ form.conditions.label(class_="col-sm-2 control-label") }}
                            <div class="col-sm-10">
                                <div id='query-builder'></div>
                                {{ form.conditions(id='rules-hidden') }}
                            </div>
                        </div>

                        <div class="form-group"> 
                            <div class="col-sm-10 col-sm-offset-2">
                                <p><input id='submit-button' class="btn-small btn-default btn-submit" type="submit" value="{% if rule is defined %}update{% else %}add{% endif %} rule"></p>
                            </div>
                        </div>

                    </fieldset>

                </form>