From 2364c5886b6e4fa34355d0e300ebd9aae0ba8ffc Mon Sep 17 00:00:00 2001 From: akhilbatra898 Date: Tue, 8 Aug 2017 23:09:51 +0530 Subject: Add basic ui - Repos Listing - Creation and updation - Running Benchmarking - Listed and detailed view of logs - Add django management command to import frontend dependencies Change-Id: If6f7dbc1fc18b022d9dda7a76f76dfee1c110450 Signed-off-by: akhilbatra898 --- .gitignore | 1 + qtip/web/bench/management/__init__.py | 0 qtip/web/bench/management/commands/__init__.py | 0 qtip/web/bench/management/commands/_private.py | 0 qtip/web/bench/management/commands/importstatic.py | 10 + qtip/web/bench/urls.py | 1 + qtip/web/bench/views.py | 7 + qtip/web/templates/bench/base.html | 537 ++++++++++++++++++++- qtip/web/templates/bench/index.html | 3 + qtip/web/templates/bench/repo_form.html | 50 +- qtip/web/templates/bench/run.html | 21 +- qtip/web/templates/bench/task_detail.html | 41 +- qtip/web/templates/bench/task_list.html | 93 +++- qtip/web/templates/registration/login.html | 104 +++- 14 files changed, 789 insertions(+), 79 deletions(-) create mode 100644 qtip/web/bench/management/__init__.py create mode 100644 qtip/web/bench/management/commands/__init__.py create mode 100644 qtip/web/bench/management/commands/_private.py create mode 100644 qtip/web/bench/management/commands/importstatic.py create mode 100644 qtip/web/templates/bench/index.html diff --git a/.gitignore b/.gitignore index 9df6dccd..3009b6ab 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ data/my_key.pem # Django stuff: *.log *.sqlite3 +static/ # Sphinx documentation docs/_build/ diff --git a/qtip/web/bench/management/__init__.py b/qtip/web/bench/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qtip/web/bench/management/commands/__init__.py b/qtip/web/bench/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/qtip/web/bench/management/commands/_private.py b/qtip/web/bench/management/commands/_private.py new file mode 100644 index 00000000..e69de29b diff --git a/qtip/web/bench/management/commands/importstatic.py b/qtip/web/bench/management/commands/importstatic.py new file mode 100644 index 00000000..471faf8b --- /dev/null +++ b/qtip/web/bench/management/commands/importstatic.py @@ -0,0 +1,10 @@ +import os + +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = 'Import frontend dependencies for serving as static files' + + def handle(self, *args, **options): + os.system("git clone https://github.com/gurayyarar/AdminBSBMaterialDesign.git bench/static/") diff --git a/qtip/web/bench/urls.py b/qtip/web/bench/urls.py index ae9738b6..a6decbc5 100644 --- a/qtip/web/bench/urls.py +++ b/qtip/web/bench/urls.py @@ -16,6 +16,7 @@ import views urlpatterns = [ url('^', include('django.contrib.auth.urls')), + url('^dashboard/$', views.Dashboard.as_view(), name="index"), url('^repos/$', views.ReposView.as_view(), name='repos'), url('^repos/(?P\d+)$', views.RepoUpdate.as_view(), name='repo_update'), url('^run/$', views.Run.as_view(), name='run'), diff --git a/qtip/web/bench/views.py b/qtip/web/bench/views.py index 6de5e4cc..56f100cb 100644 --- a/qtip/web/bench/views.py +++ b/qtip/web/bench/views.py @@ -15,6 +15,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic.edit import CreateView, UpdateView from django.views.generic.list import ListView from django.views.generic.detail import DetailView +from django.views.generic import TemplateView from django.views import View from django.shortcuts import render, redirect from django.core.files.base import ContentFile @@ -25,6 +26,10 @@ import models import utils +class Dashboard(TemplateView): + template_name = "bench/index.html" + + class ReposView(LoginRequiredMixin, CreateView): model = models.Repo fields = '__all__' @@ -32,6 +37,7 @@ class ReposView(LoginRequiredMixin, CreateView): def get_context_data(self, **kwargs): context = super(ReposView, self).get_context_data(**kwargs) context["repos"] = self.model.objects.all() + context["template_role"] = "add" return context @@ -42,6 +48,7 @@ class RepoUpdate(LoginRequiredMixin, UpdateView): def get_context_data(self, **kwargs): context = super(RepoUpdate, self).get_context_data(**kwargs) context["repos"] = self.model.objects.all() + context["template_role"] = "edit" return context diff --git a/qtip/web/templates/bench/base.html b/qtip/web/templates/bench/base.html index f0d3610e..4eaf56f5 100644 --- a/qtip/web/templates/bench/base.html +++ b/qtip/web/templates/bench/base.html @@ -1,10 +1,527 @@ - - - - QTIP Benchmarking Services - - - {% block content %} - {% endblock %} - - \ No newline at end of file + + + + + + QTIP Benchmarking Services + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+

Please wait...

+
+
+ + +
+ + + + + + + +
+ + + + + + +
+ +
+
+ {% block content %} + {% endblock %} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtip/web/templates/bench/index.html b/qtip/web/templates/bench/index.html new file mode 100644 index 00000000..b3625a33 --- /dev/null +++ b/qtip/web/templates/bench/index.html @@ -0,0 +1,3 @@ +{% extends 'bench/base.html' %} +{% block content %} +{% endblock %} \ No newline at end of file diff --git a/qtip/web/templates/bench/repo_form.html b/qtip/web/templates/bench/repo_form.html index 109436a9..158b8481 100644 --- a/qtip/web/templates/bench/repo_form.html +++ b/qtip/web/templates/bench/repo_form.html @@ -1,15 +1,43 @@ {% extends 'bench/base.html' %} {% block content %} -
-

Repos

- {% for repo in repos %} -
  • {{ repo.name }}
  • - {% endfor %} -
    -
    {% csrf_token %} - {{ form }} -
    - +
    +
    +

    Repos

    +
      +
    • + +
    • +
    +
    +
    + {% for repo in repos %} + + {% endfor %}
    - +
    + + {% endblock %} diff --git a/qtip/web/templates/bench/run.html b/qtip/web/templates/bench/run.html index 8eaa251b..eabd2ea6 100644 --- a/qtip/web/templates/bench/run.html +++ b/qtip/web/templates/bench/run.html @@ -1,15 +1,14 @@ {% extends 'bench/base.html' %} {% block content %} -
    -

    Repos

    - {% for repo in repos %} -
  • {{ repo.name }}
  • - {% endfor %} -
    -
    {% csrf_token %} - {{ form }} -
    - +
    +
    +

    Run

    - +
    {% csrf_token %} + {{ form }} +
    + +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/qtip/web/templates/bench/task_detail.html b/qtip/web/templates/bench/task_detail.html index d715022b..3f42c10a 100644 --- a/qtip/web/templates/bench/task_detail.html +++ b/qtip/web/templates/bench/task_detail.html @@ -1,17 +1,34 @@ {% extends 'bench/base.html' %} {% block content %} -
    -

    Task

    - - - - - -
    {{ object.repo}}{{ object.get_status_display }}{{ object.start_time }}{{ object.end_time }}{{ object.duration }}{{ object.log }}
    -
    -

    - {{ log | linebreaks }} -

    +
    +
    +

    Task

    +
    +
    + + + + + + + + + + + + + + + + +
    RepoStatusStart TimeEnd TimeRun time
    {{ object.repo}}{{ object.get_status_display }}{{ object.start_time }}{{ object.end_time }}{{ object.duration }}{{ object.log }}
    +
    +
    +
    +

    + {{ log | linebreaks }} +

    +
    {% endblock %} \ No newline at end of file diff --git a/qtip/web/templates/bench/task_list.html b/qtip/web/templates/bench/task_list.html index 188d6b81..074483ab 100644 --- a/qtip/web/templates/bench/task_list.html +++ b/qtip/web/templates/bench/task_list.html @@ -1,22 +1,77 @@ {% extends 'bench/base.html' %} {% block content %} -
    -

    Tasks Log

    - - - - - - - {% for task in object_list %} - - - - - - - - {% endfor %} -
    RepoStatusStart TimeEnd TimeRun time
    {{ task.repo }}{{ task.get_status_display }}{{ task.start_time }}{{ task.end_time }}{{ task.run_time }}
    - + + + +
    +
    +

    + Tasks Log +

    + +
    +
    +
    +
    +
    + + + + + + + + + + + {% for task in object_list %} + + + + + + + + {% endfor %} + + + + + + + + + + +
    RepoStatusStart TimeEnd TimeRun time
    {{ task.repo }}{{ task.get_status_display }}{{ task.start_time }}{{ task.end_time }}{{ task.run_time }}
    RepoStatusStart TimeEnd TimeRun time
    +
    +
    +
    + + + + + + + + + + + + + + + + {% endblock %} \ No newline at end of file diff --git a/qtip/web/templates/registration/login.html b/qtip/web/templates/registration/login.html index 53da9376..1e15b90b 100644 --- a/qtip/web/templates/registration/login.html +++ b/qtip/web/templates/registration/login.html @@ -1,18 +1,90 @@ - - - - QTIP Benchmarking Services - - - {% block content %} -
    {% csrf_token %} - {{ form }} -
    - - + + + + + Sign In | Bootstrap Based Admin Template - Material Design + + + + + + + + + + + + + + + + + + + + + + + {% endblock %} + + + + + + + + + + + + + + + + + + -- cgit