Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 1fbf833

Browse files
author
Akanksh Saxena
authored
Merge pull request #592 from aziiee/fix-projects-filtering
fix(projects): reset values when reapplying the filter
2 parents 6786ab2 + 30810dd commit 1fbf833

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

app/projects/controller.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,24 @@ export default Controller.extend({
8282
project: this.get("selectedProject")
8383
})
8484
);
85-
}).drop()
85+
}).drop(),
86+
87+
actions: {
88+
handleCustomerChange(customer) {
89+
this.set("selectedCustomer", customer);
90+
this.set("selectedProject", null);
91+
this.set("selectedTask", null);
92+
93+
this.filterProjects.perform();
94+
},
95+
96+
handleProjectChange(project) {
97+
this.set("selectedProject", project);
98+
this.set("selectedTask", null);
99+
100+
if (this.get("selectedProject") !== null) {
101+
this.fetchTasksOfProject.perform();
102+
}
103+
}
104+
}
86105
});

app/projects/template.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
options=customers
1313
placeholder="Select customer..."
1414
searchField="name"
15-
onchange=(action (queue (action (mut selectedCustomer)) (action (mut selectedProject) null) (perform filterProjects)))
15+
onchange=(action "handleCustomerChange")
1616
selected=selectedCustomer
1717
allowClear=true
1818
as |customer|
@@ -26,7 +26,7 @@
2626
options=filteredProjects
2727
placeholder="Select project..."
2828
searchField="name"
29-
onchange=(action (queue (action (mut selectedProject)) (perform fetchTasksOfProject)))
29+
onchange=(action "handleProjectChange")
3030
selected=selectedProject
3131
allowClear=true
3232
disabled=(not selectedCustomer)

0 commit comments

Comments
 (0)