Add Edge check for pes

This commit is contained in:
Tim Lorsbach
2026-06-19 09:52:39 +02:00
parent 831496992c
commit a2761dcaaf

View File

@ -5,6 +5,7 @@
x-data="{
isSubmitting: false,
reactionImageUrl: '',
pes: false,
reset() {
this.isSubmitting = false;
@ -15,20 +16,30 @@
const substratesSelect = document.getElementById('add_pathway_edge_substrates');
const productsSelect = document.getElementById('add_pathway_edge_products');
const pesLinks = [];
const substrates = [];
for (const option of substratesSelect.selectedOptions) {
substrates.push(option.dataset.smiles);
if (option.dataset.pes === 'true') {
pesLinks.push(option.dataset.pes);
}
}
const products = [];
for (const option of productsSelect.selectedOptions) {
products.push(option.dataset.smiles);
if (option.dataset.pes === 'true') {
pesLinks.push(option.dataset.pes);
}
}
if (substrates.length > 0 && products.length > 0) {
const reaction = substrates.join('.') + '>>' + products.join('.');
this.reactionImageUrl = '{% url "depict" %}?smirks=' + encodeURIComponent(reaction);
this.pes = pesLinks.length > 0;
} else {
this.pes = false;
this.reactionImageUrl = '';
}
},
@ -106,6 +117,7 @@
{% for n in pathway.nodes %}
<option
data-smiles="{{ n.default_node_label.smiles }}"
data-pes="{% if n.default_node_label.pes_link %}true{% else %}false{% endif %}"
value="{{ n.url }}"
>
{{ n.default_node_label.name|safe }}
@ -132,6 +144,7 @@
{% for n in pathway.nodes %}
<option
data-smiles="{{ n.default_node_label.smiles }}"
data-pes="{% if n.default_node_label.pes_link %}true{% else %}false{% endif %}"
value="{{ n.url }}"
>
{{ n.default_node_label.name|safe }}
@ -144,6 +157,9 @@
<div class="mb-3" x-show="reactionImageUrl" x-cloak>
<img :src="reactionImageUrl" class="w-full" alt="Reaction preview" />
<div x-show="pes">
<span class='alert alert-info alert-soft'>The reaction contains a partially elucidated structure!</br>For visualization the representative structure is used. The pathway itself will show the actual partially elucidated structure.</span>
</div>
</div>
</form>
</div>