home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add text-based search/filter for Conditions and Processes.
[plomtask]
/
plomtask
/
http.py
diff --git
a/plomtask/http.py
b/plomtask/http.py
index 41ce5d6a5da6738fe9eae35b5abff6cc2fd4a243..484147239ae8f3ef91d2ece69458d4b94c27e596 100644
(file)
--- a/
plomtask/http.py
+++ b/
plomtask/http.py
@@
-154,7
+154,8
@@
class TaskHandler(BaseHTTPRequestHandler):
def do_GET_conditions(self) -> dict[str, object]:
"""Show all Conditions."""
def do_GET_conditions(self) -> dict[str, object]:
"""Show all Conditions."""
- conditions = Condition.all(self.conn)
+ pattern = self.params.get_str('pattern')
+ conditions = Condition.matching(self.conn, pattern)
sort_by = self.params.get_str('sort_by')
if sort_by == 'is_active':
conditions.sort(key=lambda c: c.is_active)
sort_by = self.params.get_str('sort_by')
if sort_by == 'is_active':
conditions.sort(key=lambda c: c.is_active)
@@
-164,7
+165,9
@@
class TaskHandler(BaseHTTPRequestHandler):
conditions.sort(key=lambda c: c.title.newest, reverse=True)
else:
conditions.sort(key=lambda c: c.title.newest)
conditions.sort(key=lambda c: c.title.newest, reverse=True)
else:
conditions.sort(key=lambda c: c.title.newest)
- return {'conditions': conditions, 'sort_by': sort_by}
+ return {'conditions': conditions,
+ 'sort_by': sort_by,
+ 'pattern': pattern}
def do_GET_condition(self) -> dict[str, object]:
"""Show Condition of ?id=."""
def do_GET_condition(self) -> dict[str, object]:
"""Show Condition of ?id=."""
@@
-213,7
+216,8
@@
class TaskHandler(BaseHTTPRequestHandler):
def do_GET_processes(self) -> dict[str, object]:
"""Show all Processes."""
def do_GET_processes(self) -> dict[str, object]:
"""Show all Processes."""
- processes = Process.all(self.conn)
+ pattern = self.params.get_str('pattern')
+ processes = Process.matching(self.conn, pattern)
sort_by = self.params.get_str('sort_by')
if sort_by == 'steps':
processes.sort(key=lambda c: len(c.explicit_steps))
sort_by = self.params.get_str('sort_by')
if sort_by == 'steps':
processes.sort(key=lambda c: len(c.explicit_steps))
@@
-223,7
+227,7
@@
class TaskHandler(BaseHTTPRequestHandler):
processes.sort(key=lambda c: c.title.newest, reverse=True)
else:
processes.sort(key=lambda c: c.title.newest)
processes.sort(key=lambda c: c.title.newest, reverse=True)
else:
processes.sort(key=lambda c: c.title.newest)
- return {'processes': processes, 'sort_by': sort_by}
+ return {'processes': processes, 'sort_by': sort_by
, 'pattern': pattern
}
def do_POST(self) -> None:
"""Handle any POST request."""
def do_POST(self) -> None:
"""Handle any POST request."""