backoffice: add links to carddef in graph (#58368)
gitea-wip/wcs/pipeline/head Build started...
Details
gitea-wip/wcs/pipeline/head Build started...
Details
This commit is contained in:
parent
ffa52fcdd3
commit
ce6aee3fb7
|
@ -743,6 +743,11 @@ def test_cards_svg(pub):
|
|||
resp = app.get('/backoffice/cards/svg')
|
||||
# cards
|
||||
assert '<title>card_card_1_1</title' in resp
|
||||
assert (
|
||||
'xlink:href="http://example.net/backoffice/cards/%s/" xlink:title="<card>card 1-1"'
|
||||
% carddef11.id
|
||||
in resp
|
||||
)
|
||||
assert '<title>card_card_1_2</title' in resp
|
||||
assert '<title>card_card_1_3</title' not in resp
|
||||
assert '<title>card_card_2_1</title' in resp
|
||||
|
@ -761,6 +766,11 @@ def test_cards_svg(pub):
|
|||
resp = app.get('/backoffice/cards/categories/%s/svg' % cat1.id)
|
||||
# cards
|
||||
assert '<title>card_card_1_1</title' in resp
|
||||
assert (
|
||||
'xlink:href="http://example.net/backoffice/cards/%s/" xlink:title="<card>card 1-1"'
|
||||
% carddef11.id
|
||||
in resp
|
||||
)
|
||||
assert '<title>card_card_1_2</title' in resp
|
||||
assert '<title>card_card_1_3</title' not in resp
|
||||
assert '<title>card_card_2_1</title' not in resp
|
||||
|
|
|
@ -331,10 +331,13 @@ def get_cards_graph(category=None, show_orphans=False):
|
|||
|
||||
for carddef in carddefs:
|
||||
carddef_ref = 'card_%s' % carddef.url_name.replace('-', '_')
|
||||
record = '%s [shape=record,label="<card>%s' % (carddef_ref, carddef.name)
|
||||
relations += list(check_relations(carddef_ref, carddef.get_all_fields()))
|
||||
record += '"];'
|
||||
record = '%s [shape=record,label="<card>%s",URL="%s"];' % (
|
||||
carddef_ref,
|
||||
carddef.name,
|
||||
carddef.get_admin_url(),
|
||||
)
|
||||
records.append(record)
|
||||
relations += list(check_relations(carddef_ref, carddef.get_all_fields()))
|
||||
if not show_orphans:
|
||||
for record in records[:]:
|
||||
if not [x for x in relations if record.split()[0] in x.split()]:
|
||||
|
|
Loading…
Reference in New Issue