Skip to content

Commit 79b4f45

Browse files
authored
Add descriptions (#194)
* Add descriptions * Fix ci
1 parent 29c092a commit 79b4f45

7 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
test:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1313
strategy:
1414
matrix:
1515
tox_env: [python] #, precommit]
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@v3
3232
- uses: actions/setup-python@v3
3333
with:
34-
python-version: "3.7"
34+
python-version: "3.6.7"
3535
- name: Display system info
3636
run: python -c "import sys; print(sys.version)"
3737
- name: Setup Python

‎bsyncviewer/lib/schema_parser.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ def _walk_sequence_or_choice_element(self, parent_element, root_path, current_tr
569569
num_added += 1
570570
return_rows.append({
571571
'name': elem.name,
572+
'description': "; ".join([anno.documentation for anno in elem.annotations]),
572573
'type': elem.name,
573574
'parent_path': root_path,
574575
'path': root_path + '.' + elem.name,
@@ -612,6 +613,7 @@ def _walk_sequence_or_choice_element(self, parent_element, root_path, current_tr
612613
num_added += 1
613614
return_rows.append({
614615
'name': elem.name,
616+
'description': "; ".join([anno.documentation for anno in elem.annotations]),
615617
'path': root_path + '.' + elem.name,
616618
'type': NamedElement.my_string(),
617619
'parent_path': root_path,
@@ -646,6 +648,7 @@ def _walk_sequence_or_choice_element(self, parent_element, root_path, current_tr
646648
ref_type_clean = elem.ref_type
647649
return_rows.append({
648650
'name': ref_type_clean,
651+
'description': "; ".join([anno.documentation for anno in elem.annotations]),
649652
'path': root_path + '.' + ref_type_clean,
650653
'type': ReferenceElement.my_string(),
651654
'parent_path': root_path,
@@ -737,6 +740,7 @@ def _walk_restriction_element(parent_element, root_path, current_tree_level, cur
737740

738741
return_rows.append({
739742
'name': elem,
743+
'description': None,
740744
'full_path': root_path,
741745
'path': the_path,
742746
'type': 'Enumeration',
@@ -790,6 +794,7 @@ def process_schema(schema_object):
790794
# add 1 to tree level to account for root
791795
b = Attribute(
792796
name=se['name'],
797+
description=se["description"],
793798
type=se['type'],
794799
tree_level=(se['$$treeLevel'] + 1),
795800
parent=get_parent_from_path(se['parent_path'], schema_object),

‎bsyncviewer/lib/tree_viewer.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_jstree_node(el):
2727
node = {
2828
'id': u'{}'.format(el.pk),
2929
'text': u'{}'.format(node_name),
30+
"description": u'{}'.format(el.description),
3031
'parent': u'{}'.format(parent_node),
3132
'icon': False
3233
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.2.28 on 2025-01-31 21:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('bsyncviewer', '0013_auto_20220408_2025'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='attribute',
15+
name='description',
16+
field=models.CharField(default=None, max_length=15000, null=True),
17+
),
18+
]

‎bsyncviewer/models/attribute.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
class Attribute(models.Model):
55
name = models.CharField(max_length=250, db_index=True)
6+
description = models.CharField(max_length=15000, null=True, default=None)
67
type = models.CharField(max_length=100, default="<unknown_type>")
78
schema = models.ForeignKey(
89
'Schema', on_delete=models.CASCADE, related_name="attributes", db_index=True

‎bsyncviewer/static/css/overrides.css‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ a#current-path {
246246
font-size: 0.8em;
247247
}
248248

249+
#term_description {
250+
font-size: 0.8em;
251+
}
252+
249253
ul.term-pad {
250254
padding-left: 10px !important;
251255
}

‎bsyncviewer/templates/dictionary.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ <h3 class="panel-title">Quicklinks</h3>
8282
</div>
8383

8484
<h3 id="term_title" class="hidden">SELECTED NAME</h3>
85+
<h3 id="term_description" class="hidden">SELECTED DESCRIPTION</h3>
8586
<div id="bedes_panel" class="panel panel-default hidden">
8687
<div class="panel-heading">
8788
<h4 class="panel-title">Data Dictionary Links</h4>
@@ -123,7 +124,6 @@ <h4 class="panel-title">Enumerations</h4>
123124
$(function () {
124125
let data = {{ schema_tree_data|safe }};
125126

126-
127127
$('#schematree').jstree({
128128
'core': {
129129
'data': data,
@@ -155,6 +155,9 @@ <h4 class="panel-title">Enumerations</h4>
155155
$('#bedes_panel').removeClass('hidden').addClass('visible');
156156
$('#term_title').removeClass('hidden').addClass('visible');
157157
$('#term_title').html(node.text);
158+
159+
$('#term_description').removeClass('hidden').addClass('visible');
160+
$('#term_description').html(node.original.description);
158161
} else {
159162
$('#term_title').removeClass('visible').addClass('hidden');
160163
$('#bedes_panel').removeClass('visible').addClass('hidden');

0 commit comments

Comments
 (0)