diff options
author | maxbr <maxbr@mi.fu-berlin.de> | 2016-08-19 17:10:31 +0200 |
---|---|---|
committer | maxbr <maxbr@mi.fu-berlin.de> | 2016-08-19 17:10:31 +0200 |
commit | 3b5ef3b0a88247eeafeee878de528aad71f9fd4b (patch) | |
tree | 8f08dcacdfd5b313f04a46406d0282cdde3670e5 /tools/pharos-dashboard/templates | |
parent | e556a63cc5f78598e890346889948765906a6411 (diff) |
Split the dashboard into different apps, add tests
JIRA: RELENG-12
Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools/pharos-dashboard/templates')
11 files changed, 150 insertions, 126 deletions
diff --git a/tools/pharos-dashboard/templates/dashboard/base.html b/tools/pharos-dashboard/templates/base.html index 544bf0b3..1479b043 100644 --- a/tools/pharos-dashboard/templates/dashboard/base.html +++ b/tools/pharos-dashboard/templates/base.html @@ -1,4 +1,4 @@ -{% extends "layout/base.html" %} +{% extends "layout.html" %} {% load bootstrap3 %} {% block basecontent %} @@ -16,7 +16,7 @@ </button> <a href="https://www.opnfv.org/" class="navbar-left"><img src="https://www.opnfv.org/sites/all/themes/opnfv/logo.png"></a> - <a class="navbar-brand" href={% url 'dashboard:' %}>Pharos Dashboard</a> + <a class="navbar-brand" href={% url 'dashboard:index' %}>Pharos Dashboard</a> </div> <!-- /.navbar-header --> @@ -27,19 +27,23 @@ </a> <ul class="dropdown-menu dropdown-user"> {% if user.is_authenticated %} - <li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a> - </li> - <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a> + <li><a href="{% url 'account:settings' %}"><i + class="fa fa-gear fa-fw"></i> + Settings</a> </li> <li class="divider"></li> - <li><a href="{% url 'dashboard:logout' %}?next={{ request.path }}"><i + <li><a href="{% url 'account:logout' %}?next={{ request.path }}"><i class="fa fa-sign-out fa-fw"></i> Logout</a> </li> {% else %} - <li><a href="{% url 'dashboard:login' %}"><i - class="fa fa-sign-out fa-fw"></i> - Login</a> + <li><a href="{% url 'account:login' %}"><i + class="fa fa-sign-in fa-fw"></i> + Login</a> + <li> + <a href="{% url 'account:registration' %}"><i + class="fa fa-edit fa-fw"></i> + Register</a> {% endif %} </ul> <!-- /.dropdown-user --> diff --git a/tools/pharos-dashboard/templates/booking/booking_calendar.html b/tools/pharos-dashboard/templates/booking/booking_calendar.html new file mode 100644 index 00000000..1fa5dc4d --- /dev/null +++ b/tools/pharos-dashboard/templates/booking/booking_calendar.html @@ -0,0 +1,56 @@ +{% extends "dashboard/table.html" %} +{% load staticfiles %} + +{% block extrahead %} + <link href="{% static "bower_components/fullcalendar/dist/fullcalendar.css" %}" + rel='stylesheet'/> + <link href="{% static "bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" %}" + rel='stylesheet'/> +{% endblock extrahead %} + +{% block content %} + <div class="row"> + <div class="col-lg-8"> + <div class="container-fluid"> + <div class="panel panel-default"> + <div class="panel-heading"> + <i class="fa fa-calendar fa-fw"></i>Calendar + </div> + <div class="panel-body"> + <div id='calendar'> + </div> + </div> + <!-- /.panel-body --> + </div> + <!-- /.panel --> + </div> + </div> + + <div class="col-lg-4"> + <div class="panel panel-default"> + <div class="panel-heading"> + <i class="fa fa-edit fa-fw"></i>Booking + </div> + <div class="panel-body"> + <div id="booking_form_div"> + {% include 'booking/booking_form.html' %} + </div> + </div> + </div> + </div> +{% endblock content %} + +{% block extrajs %} + <script type="text/javascript"> + var bookings_url = "{% url 'booking:bookings_json' resource_id=resource.id %}" + var user_timezone = "{{ request.user.userprofile.timezone }}" + </script> + + <script src={% static "bower_components/moment/moment.js" %}></script> + <script src={% static "bower_components/fullcalendar/dist/fullcalendar.js" %}></script> + <script type="text/javascript" + src={% static "bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js" %}></script> + <script src={% static "js/fullcalendar-options.js" %}></script> + <script src={% static "js/datetimepicker-options.js" %}></script> + <script src={% static "js/booking-calendar.js" %}></script> +{% endblock extrajs %}
\ No newline at end of file diff --git a/tools/pharos-dashboard/templates/booking/booking_form.html b/tools/pharos-dashboard/templates/booking/booking_form.html new file mode 100644 index 00000000..f13c4b41 --- /dev/null +++ b/tools/pharos-dashboard/templates/booking/booking_form.html @@ -0,0 +1,21 @@ +{% load bootstrap3 %} + + +{% bootstrap_form_errors form type='non_fields' %} +<form method="post" action="" class="form" id="bookingform"> + {% csrf_token %} + + <div class='input-group' id='starttimepicker'> + {% bootstrap_field form.start addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} + </div> + <div class='input-group' id='endtimepicker'> + {% bootstrap_field form.end addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} + </div> + {% bootstrap_field form.purpose %} + + {% buttons %} + <button type="submit" class="btn btn btn-success"> + Book + </button> + {% endbuttons %} +</form>
\ No newline at end of file diff --git a/tools/pharos-dashboard/templates/dashboard/booking_calendar.html b/tools/pharos-dashboard/templates/dashboard/booking_calendar.html deleted file mode 100644 index 0f6bece0..00000000 --- a/tools/pharos-dashboard/templates/dashboard/booking_calendar.html +++ /dev/null @@ -1,79 +0,0 @@ -{% extends "dashboard/base.html" %} -{% load staticfiles %} -{% load bootstrap3 %} - -{% block extrahead %} - <link href="{% static "bower_components/fullcalendar/dist/fullcalendar.css" %}" - rel='stylesheet'/> - <link href="{% static "bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" %}" - rel='stylesheet'/> -{% endblock extrahead %} - -{% block content %} - <div class="row"> - <div class="col-lg-8"> - <div class="container-fluid"> - <div class="panel panel-default"> - <div class="panel-heading"> - Calendar - </div> - <div class="panel-body"> - <div id='calendar'> - </div> - </div> - <!-- /.panel-body --> - </div> - <!-- /.panel --> - </div> - </div> - - <div class="col-lg-4"> - <div class="panel panel-default"> - <div class="panel-heading"> - Booking - </div> - <div class="panel-body"> - {% bootstrap_form_errors form type='non_fields' %} - - <form method="post" class="form" id="bookingform"> - {% csrf_token %} - <div class='input-group' id='starttimepicker'> - {% bootstrap_field form.start_date_time addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} - </div> - <div class='input-group' id='endtimepicker'> - {% bootstrap_field form.end_date_time addon_after='<span class="glyphicon glyphicon-calendar"></span>' %} - </div> - {% bootstrap_field form.purpose %} - {{ form.booking_id }} - {% buttons %} - <button type="submit" class="btn btn btn-success" - id="submitform"> - Book Pod - </button> - <button type="button" class="btn btn btn-danger hidden" - id="deletebutton"> - Delete Booking - </button> - {% endbuttons %} - </form> - - </div> - </div> - </div> - </div> -{% endblock content %} - -{% block extrajs %} - <script type="text/javascript"> - var bookings_url = '/resource/' + {{ resource.resource_id }} +'/bookings/'; - </script> - - <script src={% static "bower_components/moment/moment.js" %}></script> - <script src={% static "bower_components/fullcalendar/dist/fullcalendar.js" %}></script> - <script type="text/javascript" - src={% static "bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js" %}></script> - <script src={% static "js/fullcalendar-options.js" %}></script> - <script src={% static "js/datetimepicker-options.js" %}></script> - <script src={% static "js/csrf.js" %}></script> - <script src={% static "js/booking-calendar.js" %}></script> -{% endblock extrajs %}
\ No newline at end of file diff --git a/tools/pharos-dashboard/templates/tables/ci_pods.html b/tools/pharos-dashboard/templates/dashboard/ci_pods.html index 3889664b..d3e5ff62 100644 --- a/tools/pharos-dashboard/templates/tables/ci_pods.html +++ b/tools/pharos-dashboard/templates/dashboard/ci_pods.html @@ -35,13 +35,12 @@ {{ pod.last_job.branch }} </th> <th><a {{ pod.last_job.blink }} style="color:{{ pod.last_job.color }}" - target='_blank' - href={{ pod.last_job.url }}>{{ pod.last_job.name }}</a> + target='_blank' + href={{ pod.last_job.url }}>{{ pod.last_job.name }}</a> </th> </tr> {% endfor %}` </tbody> - </table> {% endblock table %} diff --git a/tools/pharos-dashboard/templates/tables/dev_pods.html b/tools/pharos-dashboard/templates/dashboard/dev_pods.html index 730aa953..f08e1d1f 100644 --- a/tools/pharos-dashboard/templates/tables/dev_pods.html +++ b/tools/pharos-dashboard/templates/dashboard/dev_pods.html @@ -14,28 +14,28 @@ </tr> </thead> <tbody> - {% for pod in dev_pods %} + {% for resource in dev_pods %} <tr> <th> - <a target='_blank' href={{ pod.url }}>{{ pod.name }}</a> + <a target='_blank' href={{ resource.url }}>{{ resource.name }}</a> </th> <th> - <a target='_blank' href={{ pod.slaveurl }}>{{ pod.slavename }}</a> + <a target='_blank' href={{ resource.slaveurl }}>{{ resource.slavename }}</a> </th> <th> - {{ pod.current_booking.user }} + {{ resource.current_booking.user.username }} </th> <th> - {{ pod.current_booking.end_date_time }} + {{ resource.current_booking.end }} </th> <th> - {{ pod.current_booking.purpose }} + {{ resource.current_booking.purpose }} </th> - <th style="background-color:{{ pod.status_color }}"> - {{ pod.status }} + <th style="background-color:{{ resource.status_color }}"> + {{ resource.status }} </th> <th> - <a href='{% url 'dashboard:booking_calendar' %}{{ pod.resource_id }}' class="btn btn-primary"> + <a href="{% url 'booking:create' resource_id=resource.id %}" class="btn btn-primary"> Book </a> </th> diff --git a/tools/pharos-dashboard/templates/tables/jenkins_slaves.html b/tools/pharos-dashboard/templates/dashboard/jenkins_slaves.html index 2d011b46..2d011b46 100644 --- a/tools/pharos-dashboard/templates/tables/jenkins_slaves.html +++ b/tools/pharos-dashboard/templates/dashboard/jenkins_slaves.html diff --git a/tools/pharos-dashboard/templates/dashboard/table.html b/tools/pharos-dashboard/templates/dashboard/table.html index 2d0b82ee..addd5c12 100644 --- a/tools/pharos-dashboard/templates/dashboard/table.html +++ b/tools/pharos-dashboard/templates/dashboard/table.html @@ -1,4 +1,4 @@ -{% extends "dashboard/base.html" %} +{% extends "base.html" %} {% load staticfiles %} {% block extrahead %} diff --git a/tools/pharos-dashboard/templates/layout/base.html b/tools/pharos-dashboard/templates/layout.html index e9e1cd1f..db9490f5 100644 --- a/tools/pharos-dashboard/templates/layout/base.html +++ b/tools/pharos-dashboard/templates/layout.html @@ -50,9 +50,12 @@ {% block basecontent %} {% endblock basecontent %} -<!-- jQuery --> -<script src="{% static "bower_components/jquery/dist/jquery.min.js" %}"></script> -<script src="{% static "bower_components/jquery-migrate/jquery-migrate.min.js" %}"></script> + +<script src="https://code.jquery.com/jquery-2.2.4.min.js" + integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> +{#<!-- jQuery -->#} +{#<script src="{% static "bower_components/jquery/dist/jquery.min.js" %}"></script>#} +{#<script src="{% static "bower_components/jquery-migrate/jquery-migrate.min.js" %}"></script>#} {#<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>#} <!-- Bootstrap Core JavaScript --> diff --git a/tools/pharos-dashboard/templates/registration/login.html b/tools/pharos-dashboard/templates/registration/login.html index efdcd1fb..45b9d451 100644 --- a/tools/pharos-dashboard/templates/registration/login.html +++ b/tools/pharos-dashboard/templates/registration/login.html @@ -1,4 +1,5 @@ -{% extends "layout/base.html" %} +{% extends "layout.html" %} +{% load bootstrap3 %} {% block basecontent %} <div class="container"> @@ -17,14 +18,6 @@ {% endif %} </div> {% endif %} - {% if form.errors %} - <div class="alert alert-danger alert-dismissable"> - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> - <span aria-hidden="true">×</span> - </button> - Your username and password didn't match. Please try again. - </div> - {% endif %} </div> </div> <div class="row"> @@ -36,26 +29,23 @@ </h3> </div> <div class="panel-body"> - <form method="post" action="{% url 'dashboard:login' %}"> + <form method="post"> {% csrf_token %} - <fieldset> - <div class="form-group"> - <input class="form-control" placeholder="Username" name="username" type="text" - autofocus> - </div> - <div class="form-group"> - <input class="form-control" placeholder="Password" name="password" - type="password" value=""> - </div> - <input type="submit" value="Login" class="btn btn-lg btn-success btn-block"/> - <input type="hidden" name="next" value="{{ next }}"/> - </fieldset> + {% bootstrap_form form %} + {% buttons %} + <button type="submit" class="btn btn btn-success"> + Login + </button> + <a href="{% url 'account:registration' %}" class="btn btn-info" + role="button">Register</a> + {% endbuttons %} </form> </div> </div> </div> </div> </div> + {# Assumes you setup the password_reset view in your URLconf #} {# <p><a href="{% url 'password_reset' %}">Lost password?</a></p>#} {% endblock basecontent %} diff --git a/tools/pharos-dashboard/templates/registration/registration_form.html b/tools/pharos-dashboard/templates/registration/registration_form.html new file mode 100644 index 00000000..0a921d51 --- /dev/null +++ b/tools/pharos-dashboard/templates/registration/registration_form.html @@ -0,0 +1,30 @@ +{% extends "layout.html" %} +{% load bootstrap3 %} + +{% block basecontent %} + <div class="container"> + <div class="row"> + <div class="col-md-4 col-md-offset-4"> + {% bootstrap_messages %} + <div class="login-panel panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title"> + {{ title }} + </h3> + </div> + <div class="panel-body"> + <form method="post" action=""> + {% csrf_token %} + {% bootstrap_form form %} + {% buttons %} + <button type="submit" class="btn btn btn-success"> + Submit + </button> + {% endbuttons %} + </form> + </div> + </div> + </div> + </div> + </div> +{% endblock basecontent %} |