diff --git a/app/main/views.py b/app/main/views.py index 409b1c711f72190884a5b5b9292a389c56b2f4d0..1555a66c2f5c50b2a83b2db91700f4fbfbda023c 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -63,6 +63,12 @@ def index(): return render_template('index.html') +@bp.route('/items') +@login_required +def items_index(): + return render_template('items.html') + + @bp.route('/view/<ics_id>') @login_required def view_item(ics_id): diff --git a/app/static/js/csentry.js b/app/static/js/items.js similarity index 100% rename from app/static/js/csentry.js rename to app/static/js/items.js diff --git a/app/templates/base.html b/app/templates/base.html index c60b5a8608ee7b02dae617113d196d043ba40229..b853c9e03a2dc6247bf0cb663bea6b74ee6fc456 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -23,7 +23,7 @@ <div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="navbar-nav mr-auto"> {% set path = request.path %} - <a class="nav-item nav-link {{ is_active(path in ("/", "/index", "/index/")) }}" href="{{ url_for('main.index') }}">Items</a> + <a class="nav-item nav-link {{ is_active(path.startswith("/items")) }}" href="{{ url_for('main.items_index') }}">Items</a> <a class="nav-item nav-link {{ is_active(path == "/hosts") }}" href="{{ url_for('main.hosts_index') }}">Hosts</a> <div class="dropdown {{ is_active(path.startswith("/qrcodes")) }}"> <a class="nav-link dropdown-toggle" href="#" id="qrcodesDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> diff --git a/app/templates/index.html b/app/templates/index.html index 43c0d8205751f78c1c189dcfee36e187a3e98d59..bf37fb4912b76e3c98fb3bfe271b847c52e35bbf 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -3,25 +3,6 @@ {% block main %} <div class="jumbotron"> <h1 class="display-4">Welcome to CSEntry!</h1> + <p class="lead">Control System Entry allows you to easily register items and network devices.</lead> </div> - <table id="items_table" class="table table-bordered table-hover table-sm"> - <thead> - <tr> - <th>Id</th> - <th>ICS id</th> - <th>Created</th> - <th>Updated</th> - <th>Serial number</th> - <th>Manufacturer</th> - <th>Model</th> - <th>Location</th> - <th>Status</th> - <th>Parent</th> - </tr> - </thead> - </table> {%- endblock %} - -{% block csentry_scripts %} - <script src="{{ url_for('static', filename='js/csentry.js') }}"></script> -{% endblock %} diff --git a/app/templates/items.html b/app/templates/items.html new file mode 100644 index 0000000000000000000000000000000000000000..adfbdb337337bd4b952acdec554941f1664d141d --- /dev/null +++ b/app/templates/items.html @@ -0,0 +1,33 @@ +{%- extends "base.html" %} + +{% block title %}Items - CSEntry{% endblock %} + +{% block main %} + <div class="card"> + <h4 class="card-header">Register new item</h4> + <div class="card-body"> + </div> + </div> + + <hr class="separator"> + <table id="items_table" class="table table-bordered table-hover table-sm"> + <thead> + <tr> + <th>Id</th> + <th>ICS id</th> + <th>Created</th> + <th>Updated</th> + <th>Serial number</th> + <th>Manufacturer</th> + <th>Model</th> + <th>Location</th> + <th>Status</th> + <th>Parent</th> + </tr> + </thead> + </table> +{%- endblock %} + +{% block csentry_scripts %} + <script src="{{ url_for('static', filename='js/items.js') }}"></script> +{% endblock %} diff --git a/tests/functional/test_web.py b/tests/functional/test_web.py index f26a20118606a171737ff6f59f74079c4aae9b07..3f85e18d311ed5383041e1318a325fb511267d24 100644 --- a/tests/functional/test_web.py +++ b/tests/functional/test_web.py @@ -60,6 +60,7 @@ def test_index(logged_client): @pytest.mark.parametrize('url', [ '/', + '/items', '/qrcodes', '_retrieve_items', ])