Skip to content

Commit e465f1f

Browse files
larseggertrjsparks
andauthored
feat: Replace graphviz with d3 (ietf-tools#4067)
* feat: Use d3 for doc dependencies * Interim commit * Progress * Progress * Auto pan and zoom * Arrows * Remove graphviz and the code that uses it * More graphviz-related changes * Interim commit * Move things into place * Add test * Final touches * Make SVG work in Chrome * Get the docs more similarly to how the group doc page does it * Reindent * Add ability to download the SVG, and use bs fonts. * Follow @rjsparks' advice on how to compute the reference list * Interim commit * Add legend * Speed up simulation * Fix tooltips * fix: escape a period in a new url regex Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
1 parent fcbd5e4 commit e465f1f

12 files changed

Lines changed: 667 additions & 372 deletions

File tree

bin/graph-models

Lines changed: 0 additions & 22 deletions
This file was deleted.

docker/base.Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ RUN apt-get update --fix-missing && apt-get install -qy \
3232
ghostscript \
3333
git \
3434
gnupg \
35-
graphviz \
3635
jq \
3736
less \
3837
libcairo2-dev \

ietf/bin/graphall

Lines changed: 0 additions & 30 deletions
This file was deleted.

ietf/group/dot.py

Lines changed: 0 additions & 133 deletions
This file was deleted.

ietf/group/tests.py

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import io
55
import os
66
import datetime
7+
import json
78

8-
from unittest import skipIf
99
from tempfile import NamedTemporaryFile
1010

1111
from django.core.management import call_command
@@ -21,25 +21,10 @@
2121
from ietf.group.models import Role, Group
2222
from ietf.group.utils import get_group_role_emails, get_child_group_role_emails, get_group_ad_emails
2323
from ietf.group.factories import GroupFactory, RoleFactory
24-
from ietf.utils.test_runner import set_coverage_checking
2524
from ietf.person.factories import PersonFactory, EmailFactory
2625
from ietf.person.models import Person
2726
from ietf.utils.test_utils import login_testing_unauthorized, TestCase
2827

29-
30-
if getattr(settings,'SKIP_DOT_TO_PDF', False):
31-
skip_dot_to_pdf = True
32-
skip_message = "settings.SKIP_DOT_TO_PDF = %s" % skip_dot_to_pdf
33-
elif ( os.path.exists(settings.DOT_BINARY) and
34-
os.path.exists(settings.UNFLATTEN_BINARY)):
35-
skip_dot_to_pdf = False
36-
skip_message = ""
37-
else:
38-
skip_dot_to_pdf = True
39-
skip_message = ("Skipping dependency graph tests: One or more of the binaries for dot\n "
40-
"and unflatten weren't found in the locations indicated in settings.py")
41-
print(" "+skip_message)
42-
4328
class StreamTests(TestCase):
4429
def test_streams(self):
4530
r = self.client.get(urlreverse("ietf.group.views.streams"))
@@ -72,56 +57,43 @@ def test_stream_edit(self):
7257
self.assertTrue(Role.objects.filter(name="delegate", group__acronym=stream_acronym, email__address="ad2@ietf.org"))
7358

7459

75-
@skipIf(skip_dot_to_pdf, skip_message)
76-
class GroupDocDependencyGraphTests(TestCase):
77-
60+
class GroupDocDependencyTests(TestCase):
7861
def setUp(self):
7962
super().setUp()
80-
set_coverage_checking(False)
8163
a = WgDraftFactory()
8264
b = WgDraftFactory()
83-
RelatedDocument.objects.create(source=a,target=b.docalias.first(),relationship_id='refnorm')
84-
85-
def tearDown(self):
86-
set_coverage_checking(True)
87-
super().tearDown()
65+
RelatedDocument.objects.create(
66+
source=a, target=b.docalias.first(), relationship_id="refnorm"
67+
)
8868

89-
def test_group_document_dependency_dotfile(self):
69+
def test_group_document_dependencies(self):
9070
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
91-
client = Client(Accept='text/plain')
92-
for url in [ urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,output_type="dot")),
93-
urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,group_type=group.type_id,output_type="dot")),
94-
]:
71+
client = Client(Accept="application/json")
72+
for url in [
73+
urlreverse(
74+
"ietf.group.views.dependencies", kwargs=dict(acronym=group.acronym)
75+
),
76+
urlreverse(
77+
"ietf.group.views.dependencies",
78+
kwargs=dict(acronym=group.acronym, group_type=group.type_id),
79+
),
80+
]:
9581
r = client.get(url)
96-
self.assertTrue(r.status_code == 200, "Failed to receive "
97-
"a dot dependency graph for group: %s"%group.acronym)
98-
self.assertGreater(len(r.content), 0, "Dot dependency graph for group "
99-
"%s has no content"%group.acronym)
82+
self.assertTrue(
83+
r.status_code == 200,
84+
"Failed to receive a group document dependencies for group: %s"
85+
% group.acronym,
86+
)
87+
self.assertGreater(
88+
len(r.content),
89+
0,
90+
"Document dependencies for group %s has no content" % group.acronym,
91+
)
92+
try:
93+
json.loads(r.content)
94+
except Exception as e:
95+
self.fail("JSON load failed: %s" % e)
10096

101-
def test_group_document_dependency_pdffile(self):
102-
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
103-
client = Client(Accept='application/pdf')
104-
for url in [ urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,output_type="pdf")),
105-
urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,group_type=group.type_id,output_type="pdf")),
106-
]:
107-
r = client.get(url)
108-
self.assertTrue(r.status_code == 200, "Failed to receive "
109-
"a pdf dependency graph for group: %s"%group.acronym)
110-
self.assertGreater(len(r.content), 0, "Pdf dependency graph for group "
111-
"%s has no content"%group.acronym)
112-
113-
def test_group_document_dependency_svgfile(self):
114-
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
115-
client = Client(Accept='image/svg+xml')
116-
for url in [ urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,output_type="svg")),
117-
urlreverse("ietf.group.views.dependencies",kwargs=dict(acronym=group.acronym,group_type=group.type_id,output_type="svg")),
118-
]:
119-
r = client.get(url)
120-
self.assertTrue(r.status_code == 200, "Failed to receive "
121-
"a svg dependency graph for group: %s"%group.acronym)
122-
self.assertGreater(len(r.content), 0, "svg dependency graph for group "
123-
"%s has no content"%group.acronym)
124-
12597

12698
class GenerateGroupAliasesTests(TestCase):
12799
def setUp(self):

ietf/group/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
url(r'^history/$',views.history),
2828
url(r'^history/addcomment/$',views.add_comment),
2929
url(r'^email/$', views.email),
30-
url(r'^deps/(?P<output_type>[\w-]+)/$', views.dependencies),
30+
url(r'^deps\.json$', views.dependencies),
3131
url(r'^meetings/$', views.meetings),
3232
url(r'^edit/$', views.edit, {'action': "edit"}),
3333
url(r'^edit/(?P<field>[-a-z0-9_]+)/?$', views.edit, {'action': "edit"}),

0 commit comments

Comments
 (0)