home · contact · privacy
To Condition view, add listings of related Processes.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 30 May 2024 04:55:31 +0000 (06:55 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 30 May 2024 04:55:31 +0000 (06:55 +0200)
plomtask/http.py
templates/condition.html

index 8255aa2469354f0f28f7c1fe907a2adc7dd781f0..b81083b26e35a4d3a6dfb140781d95f14bae5c3c 100644 (file)
@@ -207,7 +207,13 @@ class TaskHandler(BaseHTTPRequestHandler):
     def do_GET_condition(self) -> dict[str, object]:
         """Show Condition of ?id=."""
         id_ = self.params.get_int_or_none('id')
-        return {'condition': Condition.by_id(self.conn, id_, create=True)}
+        c = Condition.by_id(self.conn, id_, create=True)
+        ps = Process.all(self.conn)
+        return {'condition': c,
+                'enabled_processes': [p for p in ps if c in p.conditions],
+                'disabled_processes': [p for p in ps if c in p.blockers],
+                'enabling_processes': [p for p in ps if c in p.enables],
+                'disabling_processes': [p for p in ps if c in p.disables]}
 
     def do_GET_condition_titles(self) -> dict[str, object]:
         """Show title history of Condition of ?id=."""
index 1fc5902025c7cc21a04a656880a973ed5b6ed312..324c8f8a0efe9c6c05dba0307fd682807983bcdf 100644 (file)
 <td><textarea name="description">{{condition.description.newest|e}}</textarea>{% if condition.id_ %} [<a href="condition_descriptions?id={{condition.id_}}">history</a>]{% endif %}</td>
 <tr/>
 
+<tr>
+<th>enables</th>
+<td>
+{% for process in enabled_processes %}
+<a href="process?id=process.id_">{{process.title.newest|e}}</a><br />
+{% endfor %}
+</td>
+</tr>
+
+<tr>
+<th>disables</th>
+<td>
+{% for process in disabled_processes %}
+<a href="process?id=process.id_">{{process.title.newest|e}}</a><br />
+{% endfor %}
+</td>
+</tr>
+
+<tr>
+<th>enabled by</th>
+<td>
+{% for process in enabling_processes %}
+<a href="process?id=process.id_">{{process.title.newest|e}}</a><br />
+{% endfor %}
+</td>
+</tr>
+
+<tr>
+<th>disabled by</th>
+<td>
+{% for process in disabling_processes %}
+<a href="process?id=process.id_">{{process.title.newest|e}}</a><br />
+{% endfor %}
+</td>
+</tr>
+
 </table>
 {{ macros.edit_buttons() }}
 {% endblock %}