-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Open-Telecoms-Data/2022-11-17
work
- Loading branch information
Showing
6 changed files
with
88 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 55 additions & 33 deletions
88
cove_ofds/templates/cove_ofds/jsonschema_validation_table.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,61 @@ | ||
{% load i18n %} | ||
{% load cove_tags %} | ||
{% load ofds_cove_tags %} | ||
|
||
<table class="table table-condensed"> | ||
<thead> | ||
<tr> | ||
<th>{% trans 'Identifiers' %}</th> | ||
<th>{% trans 'Path' %}</th> | ||
<th>{% trans 'Value' %}</Th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for error in validation_errors_for_table %} | ||
|
||
<div style="text-align: right;"> | ||
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#validation_error_details_{{ error_table_id }}" aria-expanded="false" aria-controls="validation_error_details_{{ error_table_id }}"> | ||
Show/Hide errors | ||
</button> | ||
</div> | ||
|
||
<div class="collapse" id="validation_error_details_{{ error_table_id }}"> | ||
<table class="table table-condensed"> | ||
<thead> | ||
<tr> | ||
<td> | ||
{% if error.data_ids.network_id or error.data_ids.span_id or error.data_ids.node_id %} | ||
{% if error.data_ids.network_id %} | ||
<div>{% trans 'Network' %}: {{ error.data_ids.network_id }}</div> | ||
{% endif %} | ||
{% if error.data_ids.span_id %} | ||
<div>{% trans 'Span' %}: {{ error.data_ids.span_id }}</div> | ||
{% endif %} | ||
{% if error.data_ids.node_id %} | ||
<div>{% trans 'Node' %}: {{ error.data_ids.node_id }}</div> | ||
<th>{% trans 'Identifiers' %}</th> | ||
<th>{% trans 'Path' %}</th> | ||
{% if col_instance %} | ||
<th>{% trans 'Value' %}</Th> | ||
{% endif %} | ||
{% if col_validator_value %} | ||
<th>{{ col_validator_value_label }}</Th> | ||
{% endif %} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for error in validation_errors_for_table %} | ||
<tr> | ||
<td> | ||
{% if error.data_ids.network_id or error.data_ids.span_id or error.data_ids.node_id %} | ||
{% if error.data_ids.network_id %} | ||
<div>{% trans 'Network' %}: {{ error.data_ids.network_id }}</div> | ||
{% endif %} | ||
{% if error.data_ids.span_id %} | ||
<div>{% trans 'Span' %}: {{ error.data_ids.span_id }}</div> | ||
{% endif %} | ||
{% if error.data_ids.node_id %} | ||
<div>{% trans 'Node' %}: {{ error.data_ids.node_id }}</div> | ||
{% endif %} | ||
{% else %} | ||
N/A | ||
{% endif %} | ||
{% else %} | ||
N/A | ||
</td> | ||
<td> | ||
/{{ error.path|join:"/" }} | ||
</td> | ||
{% if col_instance %} | ||
<td> | ||
{{ error.instance|error_instance_display }} | ||
</td> | ||
{% endif %} | ||
</td> | ||
<td> | ||
/{{ error.path|join:"/" }} | ||
</td> | ||
<td> | ||
{{ error.instance }} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% if col_validator_value %} | ||
<td> | ||
{{ error.validator_value }} | ||
</td> | ||
{% endif %} | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django import template | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter(name="error_instance_display") | ||
def error_instance_display(input): | ||
if isinstance(input, str): | ||
return '"' + input + '"' | ||
else: | ||
return str(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters