<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <meta content="{{ polling_interval }}" name="polling-interval">

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>sems</title>

    <link rel="stylesheet" href="/static/v2/sems.css" ) }}">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>

<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="#">sems</a>
            <form class="form-inline">
                <button class="btn btn-secondary btn-sm my-2 my-sm-0" type="button" data-toggle="modal"
                    data-target="#newMonitorModal">
                    <i class="fa fa-plus"></i>&nbsp;New Monitor
                </button>
            </form>
        </div>
    </nav>
    <div id="summary" class="summary container">
        <div class="alert alert-success d-none" role="alert">
        </div>
    </div>
    <div id="monitor-container" class="container">
        {% for group in groups_monitors %}
            <div class="list-group" data-group="Barramento">
                {% if group %}
                    <h3>{{ group }}</h3>
                {% else %}
                    <h3>Default</h3>
                {% end %}
                {% for monitor in groups_monitors[group] %}
                    <div class="list-group-item monitor-entry">
                        <div class="d-flex w-100 justify-content-between">
                            <div class="component-container">
                                <span class="component-name mb-1">{{monitor.label}}</span>
                                <a href="#" class="immediate-action" data-monitor="{{monitor.label}}" data-group="{{group}}">(excluir)</a>
                            </div>
                            <span class="component-status healthy mb-1"></span>
                        </div>
                    </div>
                    <!-- <i class="fa fa-check"></i>Healthy -->
                {% end %}
            </div>
        {% end %}
    </div>

    <!-- New Monitor Modal -->
    <div class="modal fade" id="newMonitorModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">New Monitor</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="newMonitorForm" action="#">
                        <div class="form-group">
                            <label for="monitorType">Type</label>
                            <select class="form-control" id="monitorType" required>
                                <option value="">Select ...</option>
                                <option value="HTTPStatusMonitor">Check Status HTTP</option>
                                <option value="SocketPortMonitor">Check Socket Port</option>
                                <option value="TextMonitor">Check HTTP Response Content</option>
                                <option value="ContractTestRestMonitor">Contract test rest</option>
                                <option value="ContractTestSoapMonitor">Contract test soap</option>
                            </select>
                            <div class="invalid-feedback">
                                Please, select a monitor type.
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="monitorGroup">Group</label>
                            <input type="text" class="form-control" id="monitorGroup"
                                placeholder="" required>
                            <div class="invalid-feedback">
                                Please, provide a group.
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="monitorLabel">Label</label>
                            <input type="text" class="form-control" id="monitorLabel"
                                placeholder="" required>
                            <div class="invalid-feedback">
                                Please, select a label for your monitor.
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="monitorUrl">URL or Host</label>
                            <input type="text" class="form-control" id="monitorUrl"
                                placeholder="">
                        </div>
                        <div id="custom-fields">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" id="save-new-monitor" class="btn btn-primary">Save changes</button>
                </div>
            </div>
        </div>
    </div>

    <script id="custom-field-template" type="text/x-custom-template">
        <div class="form-group">
            <label for="#field_name#">#field_name#</label>
            <input type="#field_type#" class="form-control" id="#field_name#"
                placeholder="">
        </div>
    </script>

    <script src="../static/v2/jquery-3.4.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
        crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
        crossorigin="anonymous"></script>

    <script src="/static/rest_client.js"></script>
    <script src="/static/v2/monitor.js"></script>
    <script src="/static/v2/monitor_form.js"></script>
</body>

</html>