forked from
microcosm.blue/microcosm-rs
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1{% extends "base.html.j2" %}
2{% import "try-it-macros.html.j2" as try_it %}
3
4{% block title %}Many to Many counts{% endblock %}
5{% block description %}Counts of many-to-many {{ query.source }} join records with links to {{ query.subject }} and a secondary target at {{ query.path_to_other }}{% endblock %}
6
7{% block content %}
8
9 {% call try_it::get_many_to_many_counts(
10 query.subject,
11 query.source,
12 query.path_to_other,
13 query.did,
14 query.other_subject,
15 query.limit,
16 ) %}
17
18 <h2>
19 Many-to-many links to <code>{{ query.subject }}</code> joining through <code>{{ query.path_to_other }}</code>
20 {% if let Some(browseable_uri) = query.subject|to_browseable %}
21 <small style="font-weight: normal; font-size: 1rem"><a href="{{ browseable_uri }}">browse record</a></small>
22 {% endif %}
23 </h2>
24
25 <p><strong>{% if cursor.is_some() || query.cursor.is_some() %}more than {% endif %}{{ counts_by_other_subject.len()|to_u64|human_number }} joins</strong> <code>{{ query.source }}→{{ query.path_to_other }}</code></p>
26
27 <ul>
28 <li>See direct backlinks at <code>/xrpc/blue.microcosm.links.getBacklinks</code>: <a href="/xrpc/blue.microcosm.links.getBacklinks?subject={{ query.subject|urlencode }}&source={{ query.source|urlencode }}">/xrpc/blue.microcosm.links.getBacklinks?subject={{ query.subject }}&source={{ query.source }}</a></li>
29 <li>See all links to this target at <code>/links/all</code>: <a href="/links/all?target={{ query.subject|urlencode }}">/links/all?target={{ query.subject }}</a></li>
30 </ul>
31
32 <h3>Counts by other subject:</h3>
33
34 {% for counts in counts_by_other_subject %}
35 <pre style="display: block; margin: 1em 2em" class="code"><strong>Joined subject</strong>: {{ counts.subject }}
36<strong>Joining records</strong>: {{ counts.total }}
37<strong>Unique joiner ids</strong>: {{ counts.distinct }}
38-> {% if let Some(browseable_uri) = counts.subject|to_browseable -%}
39 <a href="{{ browseable_uri }}">browse record</a>
40 {%- endif %}</pre>
41 {% endfor %}
42
43 {% if let Some(c) = cursor %}
44 <form method="get" action="/xrpc/blue.microcosm.links.getManyToManyCounts">
45 <input type="hidden" name="subject" value="{{ query.subject }}" />
46 <input type="hidden" name="source" value="{{ query.source }}" />
47 <input type="hidden" name="pathToOther" value="{{ query.path_to_other }}" />
48 {% for did in query.did %}
49 <input type="hidden" name="did" value="{{ did }}" />
50 {% endfor %}
51 {% for otherSubject in query.other_subject %}
52 <input type="hidden" name="otherSubject" value="{{ otherSubject }}" />
53 {% endfor %}
54 <input type="hidden" name="limit" value="{{ query.limit }}" />
55 <input type="hidden" name="cursor" value={{ c|json|safe }} />
56 <button type="submit">next page…</button>
57 </form>
58 {% else %}
59 <button disabled><em>end of results</em></button>
60 {% endif %}
61
62 <details>
63 <summary>Raw JSON response</summary>
64 <pre class="code">{{ self|tojson }}</pre>
65 </details>
66
67{% endblock %}