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

Commit

Permalink
fix(TaskSelection): reset component filter when updating the page con…
Browse files Browse the repository at this point in the history
…troller properties
  • Loading branch information
MitanOmar committed Mar 1, 2024
1 parent 1aeede4 commit 2d373b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/analysis/index/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<fs.filter
data-test-filter-from-date
@type="date"
@selected={{moment this.fromDate}}
@selected={{if this.fromDate (moment this.fromDate)}}
@onChange={{fn this.updateParam "fromDate"}}
/>
</fs.label>
Expand All @@ -115,7 +115,7 @@
<fs.filter
data-test-filter-to-date
@type="date"
@selected={{moment this.toDate}}
@selected={{if this.toDate (moment this.toDate)}}
@onChange={{fn this.updateParam "toDate"}}
/>
</fs.label>
Expand Down
19 changes: 9 additions & 10 deletions app/components/task-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { action } from "@ember/object";
import { later } from "@ember/runloop";
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { restartableTask, timeout, dropTask } from "ember-concurrency";
import { trackedTask } from "ember-resources/util/ember-concurrency";
import { resolve } from "rsvp";
import customerOptionTemplate from "timed/components/optimized-power-select/custom-options/customer-option";
import projectOptionTemplate from "timed/components/optimized-power-select/custom-options/project-option";
import taskOptionTemplate from "timed/components/optimized-power-select/custom-options/task-option";
import customSelectedTemplate from "timed/components/optimized-power-select/custom-select/task-selection";

import { localCopy } from "tracked-toolbox";
/**
* Component for selecting a task, which consists of selecting a customer and
* project first.
Expand Down Expand Up @@ -79,11 +78,11 @@ export default class TaskSelectionComponent extends Component {
initial.task,
]);

if (task && !this.task) {
if (task) {
this.onTaskChange(task);
} else if (project && !this.project) {
} else if (project) {
this.onProjectChange(project);
} else if (customer && !this.customer) {
} else if (customer) {
this.onCustomerChange(customer);
} else {
this.tracking.fetchCustomers.perform();
Expand Down Expand Up @@ -128,25 +127,25 @@ export default class TaskSelectionComponent extends Component {
* @property {Customer} _customer
* @private
*/
@tracked
_customer = null;
@localCopy("args.initial.customer")
_customer = this.args.initial.customer || null;

Check warning on line 131 in app/components/task-selection/component.js

View check run for this annotation

Codecov / codecov/patch

app/components/task-selection/component.js#L131

Added line #L131 was not covered by tests

/**
* The manually selected project
*
* @property {Project} _project
* @private
*/
@tracked
_project = null;
@localCopy("args.initial.project")
_project = this.args.initial.project || null;

Check warning on line 140 in app/components/task-selection/component.js

View check run for this annotation

Codecov / codecov/patch

app/components/task-selection/component.js#L140

Added line #L140 was not covered by tests

/**
* The manually selected task
*
* @property {Task} _task
* @private
*/
@tracked
@localCopy("args.initial.task")
_task = null;

/**
Expand Down

0 comments on commit 2d373b0

Please sign in to comment.