Skip to content

Commit 1b15ffa

Browse files
Merge pull request #75 from rowan04/GT1180-record-format-validator
Record format validator
2 parents 5660033 + b69861d commit 1b15ffa

File tree

14 files changed

+189
-0
lines changed

14 files changed

+189
-0
lines changed

monitoring/publishing/static/stylesheet.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,15 @@ li {
183183
background-color: #8D8D8D;
184184
color: white;
185185
}
186+
187+
textarea {
188+
vertical-align: top;
189+
}
190+
191+
button#validate-button {
192+
background-color: #e0e0e0;
193+
border-color: #b0b0b0;
194+
cursor: pointer;
195+
font-weight: bold;
196+
padding: 5px 10px;
197+
}

monitoring/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
'monitoring.availability',
9696
'monitoring.benchmarks',
9797
'monitoring.iris',
98+
'monitoring.validator',
9899
]
99100

100101
REST_FRAMEWORK = {

monitoring/templates/home.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,12 @@ <h2>Return format</h2>
4242
For example: <a href="{% url 'gridsitesync-detail' 'RAL-LCG2' %}?format=json">{% url 'gridsitesync-detail' 'RAL-LCG2' %}?format=json</a>
4343
</p>
4444

45+
<h2>Record Validator</h2>
46+
<p><ul><li>
47+
<a href="{% url 'validator' %}">{% url 'validator' %}</a> - A validating tool to check APEL records are
48+
correctly formatted. Records can be validated against a specific record type, or the type can be inferred from
49+
a record header.
50+
</li></ul></p>
51+
4552
</body>
4653
</html>

monitoring/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
path('benchmarks/', include('monitoring.benchmarks.urls')),
1111
path('iris/', include('monitoring.iris.urls')),
1212
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
13+
path('validator/', include ('monitoring.validator.urls')),
1314
]

monitoring/validator/__init__.py

Whitespace-only changes.

monitoring/validator/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

monitoring/validator/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ValidatorConfig(AppConfig):
5+
name = 'monitoring.validator'

monitoring/validator/migrations/__init__.py

Whitespace-only changes.

monitoring/validator/models.py

Whitespace-only changes.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{% load static %}
2+
3+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4+
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5+
6+
<head>
7+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8+
<title>Record Validator</title>
9+
<link href="{% static 'stylesheet.css' %}" rel="stylesheet" type="text/css" />
10+
<link href="{% static 'style.css' %}" rel="stylesheet" type="text/css" />
11+
</head>
12+
13+
<body>
14+
<h1>Record Validator</h2>
15+
16+
<form id="validate-form" method="post">
17+
{% csrf_token %}
18+
<label for="record_type">Record Type:</label>
19+
<select name="record_type" id="record_type">
20+
<option value="All">All</option>
21+
<option value="CloudRecord">Cloud Record</option>
22+
<option value="CloudSummaryRecord">Cloud Summary Record</option>
23+
<option value="JobRecord">Job Record</option>
24+
<option value="JobRecord04">Job Record v0.4</option>
25+
<option value="NormalisedSummaryRecord">Normalised Summary Record</option>
26+
<option value="NormalisedSummaryRecord04">Normalised Summary Record v0.4</option>
27+
<option value="SummaryRecord">Summary Record</option>
28+
<option value="SummaryRecord04">Summary Record v0.4</option>
29+
<option value="SyncRecord">Sync Record</option>
30+
</select>
31+
<p>Selecting 'All' means the type is determined by the record header.</p>
32+
<p>If you select a specific record type, the header will need to be removed from the record input.</p>
33+
<p>v0.4 records are the newer record type - they require dictionary fields for benchmark data.</p>
34+
<br>
35+
<label for="input_record">Enter Record:</label>
36+
<textarea
37+
id="input_record"
38+
name="input_record"
39+
rows="15"
40+
cols="50"
41+
wrap="wrap"
42+
>{{ input_record|default:''|escape }}</textarea>
43+
<br><br>
44+
<button type="submit" id="validate-button">Validate!</button>
45+
<br><br>
46+
</form>
47+
48+
<script>
49+
// Setting select option back to what was selected (as it gets reset on form submission)
50+
document.getElementById("record_type").value = "{{ record_type }}";
51+
</script>
52+
53+
<div id="output">
54+
{% if output %}
55+
<h3>Validation Output</h3>
56+
{{ output }}
57+
{% endif %}
58+
</div>
59+
</body>
60+
</html>

0 commit comments

Comments
 (0)