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

Commit

Permalink
Merge pull request #1179 from MitanOmar/Review-indicator-should-reset…
Browse files Browse the repository at this point in the history
…-the-filter

fix(TaskSelection): reset component filter when updating the page controller properties
  • Loading branch information
MitanOmar authored Mar 6, 2024
2 parents 1aeede4 + 4939095 commit bc6ac99
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 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
63 changes: 31 additions & 32 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 All @@ -23,6 +22,33 @@ export default class TaskSelectionComponent extends Component {
@service store;
@service tracking;

/**
* The manually selected customer
*
* @property {Customer} _customer
* @private
*/
@localCopy("args.initial.customer")
_customer;

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

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

constructor(...args) {
super(...args);

Expand Down Expand Up @@ -79,11 +105,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 @@ -122,33 +148,6 @@ export default class TaskSelectionComponent extends Component {
*/
selectedTemplate = customSelectedTemplate;

/**
* The manually selected customer
*
* @property {Customer} _customer
* @private
*/
@tracked
_customer = null;

/**
* The manually selected project
*
* @property {Project} _project
* @private
*/
@tracked
_project = null;

/**
* The manually selected task
*
* @property {Task} _task
* @private
*/
@tracked
_task = null;

/**
* Whether to show archived customers, projects or tasks
*
Expand Down

0 comments on commit bc6ac99

Please sign in to comment.