<commit_before>{% extends 'base.html' %}


{% block title %}Devices{% endblock %}


{% block js %}{{ script(('/static/js/device_list.js',)) }}{% endblock %}


{% macro render_device(device) %}
    <tr data-id="{{ device['id'] }}">
        <td class="device-description">{{ device['description'] }}</td>
        <td class="device-mac">{{ device['mac'] }}</td>
        <td>
            <a class="edit" href=""><span class="glyphicon glyphicon-pencil" role="button" aria-label="edit"></span></a>
            <a class="delete" href=""><span class="glyphicon glyphicon-remove" role="button" aria-label="delete"></span></a>
        </td>
    </tr>
{% endmacro %}


{% set full = (devices|length == 10) %}

{% block navbar_content %}
    <ul class="nav navbar-nav pull-right">
        <li><a href="{{ logout_view }}">Logout</a></li>
    </ul>
{% endblock %}


{% block body %}
    <div class="modal fade" id="deleteDeviceModal" tabindex="-1" role="dialog"
         aria-labelledby="deleteDeviceLabel">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" type="button" data-dismiss="modal"
                            aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="deleteDeviceLabel">
                        Are you sure?
                    </h4>
                </div>
                <div class="modal-body">
                    <p>Deleting a device is permanent and can't be undone!
                        Are you sure you want to continue?</p>
                </div>
                <div class="modal-footer">
                    <img id="loadingDelete" class="loading" src="/static/img/loading.gif" alt="Loading...">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="button" class="btn btn-danger" id="deleteDevice">Delete</button>
                </div>
            </div>
        </div>
    </div>
    <span id="metadata" data-csrfmiddlewaretoken="{{ csrf_token }}"></span>
    <div class="container" id="main">
        <div class="row">
                <div class="page-header">
                    <h1>Wireless Device Registration</h1>
                </div>
                <p>Welcome, {{ user.username }}! Enter a device's information to register it for network access.</p>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 id="form-title">Register a new device</h4>
                    </div>
                    <div id="form-body" class="panel-body">
                        <div id="form-server-error" class="alert alert-danger" role="alert"
                             style="display: none">A server error occurred.</div>
                        <form role="form" method="post" autocomplete="off" id="device-form">
                        <div id="form-error" class="alert alert-danger" role="alert"
                            {% if not full %}style="display: none;" {% endif %}>You have registered 10 devices. Delete a device before trying to add another.</div>
                        <form role="form" method="post" autocomplete="off">
                            <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
                            <input type="hidden" id="id" name="id">
                            <div class="form-group">
                                <label for="description">Description</label>
                                <input class="form-control" type="text" name="description" id="description" aria-live="assertive" {% if full %}disabled{% endif %}>
                            </div>
                            <div class="form-group">
                                <label for="mac">Hardware address</label>
                                <input class="form-control" type="text" name="mac" id="mac" aria-live="assertive" {% if full %}disabled{% endif %}>
                                <p class="help-block">A hardware address, also known as a MAC address, is a unique string of letters and numbers, optionally separated by colons or hyphens, that identifies your computer. It is not related to the Apple "Mac" brand.
                                    <a href="http://oregonstate.edu/helpdocs/network/resnet-getting-started/help-guides/finding-your-network-adapter-address">Click here for help locating your computer's hardware address.</a></p>
                            </div>
                            <button type="submit" class="btn btn-primary" {% if full %}disabled {% endif %}>Register</button>
                            {% if mac_address %}
                            <button type="button" class="btn" id="prefill-mac" data-mac="{{ mac_address }}">Detect This Computer's Address</button>
                            {% endif %}
                            <button type="reset" class="btn" id="reset-form">Cancel</button>
                            <img id="loading" class="loading" src="/static/img/loading.gif" alt="Loading...">
                        </form>
                    </div>
                </div>
                <p><span id="number-of-devices">{{ devices|length }}</span> of 10 devices registered.</p>
                <div id="device-list-server-error" class="alert alert-danger"
                     style="display: none">A server error occurred.</div><commit_msg>Mark fields as required<commit_after>{% extends 'base.html' %}


{% block title %}Devices{% endblock %}


{% block js %}{{ script(('/static/js/device_list.js',)) }}{% endblock %}


{% macro render_device(device) %}
    <tr data-id="{{ device['id'] }}">
        <td class="device-description">{{ device['description'] }}</td>
        <td class="device-mac">{{ device['mac'] }}</td>
        <td>
            <a class="edit" href=""><span class="glyphicon glyphicon-pencil" role="button" aria-label="edit"></span></a>
            <a class="delete" href=""><span class="glyphicon glyphicon-remove" role="button" aria-label="delete"></span></a>
        </td>
    </tr>
{% endmacro %}


{% set full = (devices|length == 10) %}

{% block navbar_content %}
    <ul class="nav navbar-nav pull-right">
        <li><a href="{{ logout_view }}">Logout</a></li>
    </ul>
{% endblock %}


{% block body %}
    <div class="modal fade" id="deleteDeviceModal" tabindex="-1" role="dialog"
         aria-labelledby="deleteDeviceLabel">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" type="button" data-dismiss="modal"
                            aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="deleteDeviceLabel">
                        Are you sure?
                    </h4>
                </div>
                <div class="modal-body">
                    <p>Deleting a device is permanent and can't be undone!
                        Are you sure you want to continue?</p>
                </div>
                <div class="modal-footer">
                    <img id="loadingDelete" class="loading" src="/static/img/loading.gif" alt="Loading...">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="button" class="btn btn-danger" id="deleteDevice">Delete</button>
                </div>
            </div>
        </div>
    </div>
    <span id="metadata" data-csrfmiddlewaretoken="{{ csrf_token }}"></span>
    <div class="container" id="main">
        <div class="row">
                <div class="page-header">
                    <h1>Wireless Device Registration</h1>
                </div>
                <p>Welcome, {{ user.username }}! Enter a device's information to register it for network access.</p>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 id="form-title">Register a new device</h4>
                    </div>
                    <div id="form-body" class="panel-body">
                        <div id="form-server-error" class="alert alert-danger" role="alert"
                             style="display: none">A server error occurred.</div>
                        <form role="form" method="post" autocomplete="off" id="device-form">
                        <div id="form-error" class="alert alert-danger" role="alert"
                            {% if not full %}style="display: none;" {% endif %}>You have registered 10 devices. Delete a device before trying to add another.</div>
                        <form role="form" method="post" autocomplete="off">
                            <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
                            <input type="hidden" id="id" name="id">
                            <div class="form-group">
                                <label for="description">Description</label>
                                <input class="form-control" type="text" name="description" id="description" aria-live="assertive" aria-required="true"
                                       {% if full %}disabled{% endif %}>
                            </div>
                            <div class="form-group">
                                <label for="mac">Hardware address</label>
                                <input class="form-control" type="text" name="mac" id="mac" aria-live="assertive" aria-required="true" {% if full %}disabled{% endif %}>
                                <p class="help-block">A hardware address, also known as a MAC address, is a unique string of letters and numbers, optionally separated by colons or hyphens, that identifies your computer. It is not related to the Apple "Mac" brand.
                                    <a href="http://oregonstate.edu/helpdocs/network/resnet-getting-started/help-guides/finding-your-network-adapter-address">Click here for help locating your computer's hardware address.</a></p>
                            </div>
                            <button type="submit" class="btn btn-primary" {% if full %}disabled {% endif %}>Register</button>
                            {% if mac_address %}
                            <button type="button" class="btn" id="prefill-mac" data-mac="{{ mac_address }}">Detect This Computer's Address</button>
                            {% endif %}
                            <button type="reset" class="btn" id="reset-form">Cancel</button>
                            <img id="loading" class="loading" src="/static/img/loading.gif" alt="Loading...">
                        </form>
                    </div>
                </div>
                <p><span id="number-of-devices">{{ devices|length }}</span> of 10 devices registered.</p>
                <div id="device-list-server-error" class="alert alert-danger"
                     style="display: none">A server error occurred.</div>
{'fraction_non_alphanumeric': 0.15204995927233234, 'fraction_numerical': 0.0023531541315956195, 'mean_word_length': 1.7742907356264122, 'pattern_counts': {'":': 0, '<': 201, '<?xml version=': 0, '>': 201, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6320970', 'n_tokens_mistral': 3003, 'n_tokens_neox': 2767, 'n_words': 702}