Added support for dataset names

This commit is contained in:
Vivek Santayana 2022-06-22 01:53:46 +01:00
parent 2f509af1de
commit 1e7124262e
2 changed files with 44 additions and 17 deletions

View File

@ -57,7 +57,7 @@
<thead> <thead>
<tr> <tr>
<th> <th>
Uploaded Name
</th> </th>
<th> <th>
Exams Exams
@ -68,7 +68,9 @@
{% for dataset in datasets %} {% for dataset in datasets %}
<tr> <tr>
<td> <td>
{{ dataset.date.strftime('%d %b %Y %H:%M') }} <a href="{{ url_for('editor._editor_console', id=dataset.id) }}">
{{ dataset.get_name() }}
</a>
</td> </td>
<td> <td>
{{ dataset.tests|length }} {{ dataset.tests|length }}

View File

@ -9,9 +9,12 @@
<tr> <tr>
<th> <th>
</th>
<th data-priority="1">
Name
</th> </th>
<th data-priority="2"> <th data-priority="2">
Uploaded Updated
</th> </th>
<th data-priority="3"> <th data-priority="3">
Author Author
@ -36,6 +39,9 @@
</div> </div>
{% endif %} {% endif %}
</td> </td>
<td>
{{ element.get_name() }}
</td>
<td> <td>
{{ element.date.strftime('%d %b %Y %H:%M') }} {{ element.date.strftime('%d %b %Y %H:%M') }}
</td> </td>
@ -47,18 +53,27 @@
</td> </td>
<td class="row-actions"> <td class="row-actions">
<a <a
href="#" href="javascript:void(0)"
class="btn btn-primary edit-question-dataset {% if element.filename == default %}disabled{% endif %}" class="btn btn-primary edit-question-dataset"
data-filename="{{ element.filename }}" data-id="{{ element.id }}"
data-action="default" data-action="download"
title="Make Default" title="Download Dataset"
>
<i class="bi bi-cloud-arrow-down-fill button-icon"></i>
</button>
<a
href="javascript:void(0)"
class="btn btn-primary edit-question-dataset"
data-id="{{ element.id }}"
data-action="edit"
title="Edit Dataset"
> >
<i class="bi bi-file-earmark-text-fill button-icon"></i> <i class="bi bi-file-earmark-text-fill button-icon"></i>
</button> </button>
<a <a
href="#" href="javascript:void(0)"
class="btn btn-danger edit-question-dataset {% if element.filename == default %}disabled{% endif %}" class="btn btn-danger edit-question-dataset {% if element.default %}disabled{% endif %}"
data-filename="{{ element.filename }}" data-id="{{ element.id }}"
data-action="delete" data-action="delete"
title="Delete Dataset" title="Delete Dataset"
> >
@ -72,13 +87,23 @@
{% else %} {% else %}
<div class="alert alert-primary alert-db-empty"> <div class="alert alert-primary alert-db-empty">
<i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i> <i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i>
There are no question datasets uploaded. Please use the panel below to upload a new question dataset. There are no question datasets uploaded. Please use the panel below to upload a new question dataset or create a new dataset using the editor console.
</div> </div>
{% endif %} {% endif %}
<div class="col text-center">
<button title="Create New" class="btn btn-md btn-primary btn-block create-new-dataset">
<i class="bi bi-cloud-plus-fill button-icon"></i>
Create New Dataset
</button>
</div>
<div class="form-container"> <div class="form-container">
<form name="form-upload-questions" class="form-display" action="{{ url_for(request.endpoint, **request.view_args) }}" data-rel-success="" enctype="multipart/form-data"> <form name="form-upload-questions" class="form-display" action="{{ url_for(request.endpoint, **request.view_args) }}" data-rel-success="" enctype="multipart/form-data">
<h2 class="form-heading">Upload Question Dataset</h2> <h2 class="form-heading">Upload Question Dataset</h2>
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
<div class="form-label-group">
{{ form.name(class_="form-control", autofocus=true, placeholder="Enter Name of Dataset") }}
{{ form.name.label }}
</div>
<div class="form-upload"> <div class="form-upload">
{{ form.data_file() }} {{ form.data_file() }}
</div> </div>
@ -89,8 +114,8 @@
<div class="container form-submission-button"> <div class="container form-submission-button">
<div class="row"> <div class="row">
<div class="col text-center"> <div class="col text-center">
<button title="Create User" class="btn btn-md btn-success btn-block" type="submit"> <button title="Upload Dataset" class="btn btn-md btn-success btn-block" type="submit">
<i class="bi bi-file-earmark-arrow-up-fill button-icon"></i> <i class="bi bi-cloud-arrow-up-fill button-icon"></i>
Upload Dataset Upload Dataset
</button> </button>
</div> </div>
@ -106,10 +131,10 @@
$(document).ready(function() { $(document).ready(function() {
$('#question-datasets-table').DataTable({ $('#question-datasets-table').DataTable({
'columnDefs': [ 'columnDefs': [
{'sortable': false, 'targets': [0,4]}, {'sortable': false, 'targets': [0,5]},
{'searchable': false, 'targets': [0,3,4]} {'searchable': false, 'targets': [1,2,3]}
], ],
'order': [[1, 'desc'], [2, 'asc']], 'order': [[1, 'asc'], [2, 'desc'], [3, 'asc']],
'responsive': 'true', 'responsive': 'true',
'fixedHeader': 'true', 'fixedHeader': 'true',
}); });