forked from enviPath/enviPy
[Feature] Engineer Pathway (#256)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#256
This commit is contained in:
0
templates/actions/objects/joblog.html
Normal file
0
templates/actions/objects/joblog.html
Normal file
@ -41,6 +41,14 @@
|
||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
role="button"
|
||||
onclick="document.getElementById('engineer_pathway_modal').showModal(); return false;"
|
||||
>
|
||||
<i class="glyphicon glyphicon-cog"></i> Engineer Pathway</a
|
||||
>
|
||||
</li>
|
||||
{% if meta.can_edit %}
|
||||
<li>
|
||||
<a
|
||||
|
||||
@ -20,6 +20,9 @@
|
||||
<table class="table-zebra table">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if meta.user.is_superuser %}
|
||||
<th>User</th>
|
||||
{% endif %}
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
@ -36,7 +39,11 @@
|
||||
<a href="{{ job.user.url }}">{{ job.user.username }}</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
<td>{{ job.task_id }}</td>
|
||||
<td>
|
||||
<a href="{% url 'job detail' job.task_id %}"
|
||||
>{{ job.task_id }}</a
|
||||
>
|
||||
</td>
|
||||
<td>{{ job.job_name }}</td>
|
||||
<td>{{ job.status }}</td>
|
||||
<td>{{ job.created }}</td>
|
||||
|
||||
107
templates/modals/objects/engineer_pathway_modal.html
Normal file
107
templates/modals/objects/engineer_pathway_modal.html
Normal file
@ -0,0 +1,107 @@
|
||||
{% load static %}
|
||||
|
||||
<dialog
|
||||
id="engineer_pathway_modal"
|
||||
class="modal"
|
||||
x-data="modalForm()"
|
||||
@close="reset()"
|
||||
>
|
||||
<div class="modal-box max-w-2xl">
|
||||
<!-- Header -->
|
||||
<h3 class="font-bold text-lg">Engineer Pathway</h3>
|
||||
|
||||
<!-- Close button (X) -->
|
||||
<form method="dialog">
|
||||
<button
|
||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Body -->
|
||||
<div class="py-4">
|
||||
<p class="mb-4">
|
||||
Engineering Package is a process used to identify potential intermediate
|
||||
transformation products. To achieve this, a pathway is predicted using
|
||||
an existing setting. The threshold is temporarily set to zero to ensure
|
||||
that even intermediates with very low probability are not filtered out.
|
||||
<br /><br />
|
||||
If any intermediates are found, two pathways will be saved in a
|
||||
generated Package:
|
||||
<br />
|
||||
1. The engineered Pathway with the identified intermediates highlighted.
|
||||
<br />
|
||||
2. The fully predicted Pathway preserved for further analysis.
|
||||
<br /><br />
|
||||
Note: This is an asynchronous process and may take a few minutes to
|
||||
complete. You will be redirected to a page containing details about the
|
||||
task and its status.
|
||||
</p>
|
||||
<form
|
||||
id="engineer-pathway-modal-form"
|
||||
accept-charset="UTF-8"
|
||||
action="{% url 'jobs' %}"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="form-control mb-3">
|
||||
<label class="label" for="engineer-setting">
|
||||
<span class="label-text">
|
||||
Select the Setting you want to use for pathway engineering
|
||||
</span>
|
||||
</label>
|
||||
<select
|
||||
id="engineer-setting"
|
||||
name="engineer-setting"
|
||||
class="select select-bordered w-full"
|
||||
required
|
||||
>
|
||||
<option value="" disabled selected>Select Setting</option>
|
||||
{% for s in meta.available_settings %}
|
||||
<option value="{{ s.url }}">{{ s.name|safe }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input
|
||||
type="hidden"
|
||||
name="pathway-to-engineer"
|
||||
value="{{ pathway.url }}"
|
||||
/>
|
||||
<input type="hidden" name="job-name" value="engineer-pathway" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="modal-action">
|
||||
<button
|
||||
type="button"
|
||||
class="btn"
|
||||
onclick="this.closest('dialog').close()"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="submit('engineer-pathway-modal-form')"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
<span x-show="!isSubmitting">Engineer</span>
|
||||
<span
|
||||
x-show="isSubmitting"
|
||||
class="loading loading-spinner loading-sm"
|
||||
></span>
|
||||
<span x-show="isSubmitting">Engineering...</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Backdrop -->
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button :disabled="isSubmitting">close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
123
templates/objects/joblog.html
Normal file
123
templates/objects/joblog.html
Normal file
@ -0,0 +1,123 @@
|
||||
{% extends "framework_modern.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% block action_modals %}
|
||||
{# {% include "modals/objects/refresh_job_log.html" %}#}
|
||||
{% endblock action_modals %}
|
||||
|
||||
<div class="space-y-2 p-4">
|
||||
<!-- Header Section -->
|
||||
<div class="card bg-base-100">
|
||||
<div class="card-body">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="card-title text-2xl">Job Status for {{ job.job_name }}</h2>
|
||||
<div id="actionsButton" class="dropdown dropdown-end hidden">
|
||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="lucide lucide-wrench"
|
||||
>
|
||||
<path
|
||||
d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
|
||||
/>
|
||||
</svg>
|
||||
Actions
|
||||
</div>
|
||||
<ul
|
||||
tabindex="-1"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2"
|
||||
>
|
||||
{% block actions %}
|
||||
{% include "actions/objects/joblog.html" %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div class="collapse-arrow bg-base-200 collapse">
|
||||
<input type="checkbox" checked />
|
||||
<div class="collapse-title text-xl font-medium">Description</div>
|
||||
<div class="collapse-content">
|
||||
Status page for Task {{ job.job_name }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Job Status -->
|
||||
<div class="collapse-arrow bg-base-200 collapse">
|
||||
<input type="checkbox" checked />
|
||||
<div class="collapse-title text-xl font-medium">Task Status</div>
|
||||
<div class="collapse-content">{{ job.status }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Job ID -->
|
||||
<div class="collapse-arrow bg-base-200 collapse">
|
||||
<input type="checkbox" checked />
|
||||
<div class="collapse-title text-xl font-medium">Task ID</div>
|
||||
<div class="collapse-content">{{ job.task_id }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Job Result -->
|
||||
{% if job.is_in_terminal_state %}
|
||||
<div class="collapse-arrow bg-base-200 collapse">
|
||||
<input type="checkbox" checked />
|
||||
<div class="collapse-title text-xl font-medium">Task Result</div>
|
||||
<div class="collapse-content">
|
||||
{% if job.job_name == 'engineer_pathways' %}
|
||||
<div class="card bg-base-100">
|
||||
<div class="card-body">
|
||||
<p>Engineered Pathways:</p>
|
||||
<ul class="menu bg-base-200 rounded-box w-full">
|
||||
{% for engineered_url in job.parsed_result.0 %}
|
||||
<li>
|
||||
<a href="{{ engineered_url }}" class="hover:bg-base-300"
|
||||
>{{ engineered_url }}</a
|
||||
>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card bg-base-100">
|
||||
<div class="card-body">
|
||||
<p>Predicted Pathways:</p>
|
||||
<ul class="menu bg-base-200 rounded-box w-full">
|
||||
{% for engineered_url in job.parsed_result.1 %}
|
||||
<li>
|
||||
<a href="{{ engineered_url }}" class="hover:bg-base-300"
|
||||
>{{ engineered_url }}</a
|
||||
>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{{ job.parsed_result }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script>
|
||||
// Show actions button if there are actions
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const actionsButton = document.getElementById("actionsButton");
|
||||
const actionsList = actionsButton?.querySelector("ul");
|
||||
if (actionsList && actionsList.children.length > 0) {
|
||||
actionsButton?.classList.remove("hidden");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@ -81,6 +81,7 @@
|
||||
{% include "modals/objects/delete_pathway_node_modal.html" %}
|
||||
{% include "modals/objects/delete_pathway_edge_modal.html" %}
|
||||
{% include "modals/objects/generic_delete_modal.html" %}
|
||||
{% include "modals/objects/engineer_pathway_modal.html" %}
|
||||
{% endblock action_modals %}
|
||||
|
||||
<div class="space-y-2 p-4">
|
||||
@ -103,38 +104,36 @@
|
||||
<div class="bg-base-100 mb-2 rounded-lg p-2">
|
||||
<div class="navbar bg-base-100 rounded-lg">
|
||||
<div class="flex-1">
|
||||
{% if meta.can_edit %}
|
||||
<div class="dropdown">
|
||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="lucide lucide-edit"
|
||||
>
|
||||
<path
|
||||
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||
/>
|
||||
<path
|
||||
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||
/>
|
||||
</svg>
|
||||
Edit
|
||||
</div>
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2"
|
||||
<div class="dropdown">
|
||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="lucide lucide-edit"
|
||||
>
|
||||
{% include "actions/objects/pathway.html" %}
|
||||
</ul>
|
||||
<path
|
||||
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
||||
/>
|
||||
<path
|
||||
d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
|
||||
/>
|
||||
</svg>
|
||||
Actions
|
||||
</div>
|
||||
{% endif %}
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2"
|
||||
>
|
||||
{% include "actions/objects/pathway.html" %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if pathway.setting.model.app_domain %}
|
||||
<div class="dropdown">
|
||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
||||
|
||||
Reference in New Issue
Block a user