Skip to content

Commit 31df384

Browse files
fix(front): wf filtering add error msg (#322)
## 📝 Description renderedtext/project-tasks#2410 Add an error message if filtering options are not valid https://github.com/user-attachments/assets/a868fb73-07ac-4bc1-a1d5-f21643d50434 ## ✅ Checklist - [ ] I have tested this change - [ ] This change requires documentation update
1 parent 48103df commit 31df384

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

front/assets/js/workflow_list.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ export var WorkflowList = {
6161
const dateTo = dateToInput?.value;
6262
const author = authorInput?.value;
6363

64-
// Validate date range
6564
if (dateFrom && dateTo) {
65+
const filterErrorMessage = document.getElementById('filter_error_message');
6666
const fromDate = new Date(dateFrom);
6767
const toDate = new Date(dateTo);
6868

69-
if (fromDate > toDate) {
70-
alert('Start date must be before end date');
69+
if (fromDate > toDate && filterErrorMessage) {
70+
filterErrorMessage.hidden = false;
7171
return;
72+
} else if (filterErrorMessage) {
73+
filterErrorMessage.hidden = true;
7274
}
7375
}
7476

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
<div class="flex-m items-center">
2-
<%# <input id="author" name="author" type="text" placeholder="User" class="form-control mb3 mb0-m mr3 w5"> %>
3-
4-
<div class="flex items-center mr2">
5-
<span class="f6 gray mr1">From</span>
6-
<input id="date_from" name="date_from" type="date" class="form-control mb3 mb0-m w4">
1+
<div class="flex-m items-center justify-between mb3">
2+
<div class="f5 gray mr3 mb3 mb0-m">
3+
Most recent activity on this <%= branch_type_name(@branch_type) |> String.downcase() %>
74
</div>
8-
<div class="flex items-center">
9-
<span class="f6 gray mr1">To</span>
10-
<input id="date_to" name="date_to" type="date" class="form-control mb3 mb0-m w4">
5+
6+
<div class="flex-m items-center">
7+
<%# <input id="author" name="author" type="text" placeholder="User" class="form-control mb3 mb0-m mr3 w5"> %>
8+
<div class="flex items-center mr2">
9+
<span class="f6 gray mr1">From</span>
10+
<input id="date_from" name="date_from" type="date" class="form-control mb3 mb0-m w4">
11+
</div>
12+
<div class="flex items-center">
13+
<span class="f6 gray mr1">To</span>
14+
<input id="date_to" name="date_to" type="date" class="form-control mb3 mb0-m w4">
15+
</div>
1116
</div>
1217
</div>
18+
19+
<div id="filter_error_message" class="mt2 f6 dark-red tr" hidden="true">
20+
Error: "To" date cannot be earlier than "From" date.
21+
</div>

front/lib/front_web/templates/branch/member.html.eex

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
</div>
3131

3232
<div class="bg-washed-gray pa3 br3 ba b--black-075">
33-
<div class="flex-m items-center justify-between mb3">
34-
<div class="f5 gray mr3 mb3 mb0-m">
35-
Most recent activity on this <%= branch_type_name(@branch.type) |> String.downcase() %>
36-
</div>
33+
3734
<%= if FeatureProvider.feature_enabled?(:workflow_filtering, param: @organization.id) do %>
38-
<%= render FrontWeb.BranchView, "_filters.html" %>
35+
<%= render FrontWeb.BranchView, "_filters.html", branch_type: @branch.type %>
36+
<% else %>
37+
<div class="flex-m items-center justify-between mb3">
38+
<div class="f5 gray mr3 mb3 mb0-m">
39+
Most recent activity on this <%= branch_type_name(@branch.type) |> String.downcase() %>
40+
</div>
41+
</div>
3942
<% end %>
40-
</div>
4143
<div id="workflow-lists">
4244
<%= render FrontWeb.BranchView, "_workflows.html", project: @project, workflows: @workflows, branch: @branch, conn: @conn, page: :branch, pagination: @pagination, pollman: @pollman, conflict_info: @conflict_info %>
4345
</div>

0 commit comments

Comments
 (0)