Skip to content

Commit 2e245c2

Browse files
authored
feat: ember 5.12 (#622)
* fix(frontend): use ember-cli-update to update to ember v5.8 * fix(frontend/task-selection): fix reactivity and error thingies * fix(frontend/statistics): race condition causing initial filters to be blank * fix(frontend): ember v5.12 marked as feature to prevent it being included as a "patch"
1 parent a9420f6 commit 2e245c2

File tree

10 files changed

+1406
-4089
lines changed

10 files changed

+1406
-4089
lines changed

frontend/.gitignore

+9-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
1-
# See https://help.github.com/ignore-files/ for more about ignoring files.
2-
31
# compiled output
4-
/dist
5-
/tmp
2+
/dist/
3+
/declarations/
64

75
# dependencies
8-
/node_modules
9-
/bower_components
6+
/node_modules/
107

118
# misc
12-
/.sass-cache
9+
/.env*
10+
/.pnp*
1311
/.eslintcache
14-
/connect.lock
15-
/coverage/*
16-
/libpeerconnection.log
17-
npm-debug.log*
18-
testem.log
19-
*.swp
20-
*.orig
21-
22-
/.vscode/
23-
/.idea/
12+
/coverage/
13+
/npm-debug.log*
14+
/testem.log
15+
/yarn-error.log
2416

2517
# ember-try
2618
/.node_modules.ember-try/
27-
/bower.json.ember-try
2819
/npm-shrinkwrap.json.ember-try
2920
/package.json.ember-try
3021
/package-lock.json.ember-try

frontend/.prettierignore

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
# unconventional js
22
/blueprints/*/files/
3-
/vendor/
43

54
# compiled output
65
/dist/
7-
/tmp/
8-
9-
# dependencies
10-
/bower_components/
11-
/node_modules/
126

137
# misc
148
/coverage/
159
!.*
16-
.eslintcache
17-
.lint-todo/
10+
.*/
1811

1912
# ember-try
2013
/.node_modules.ember-try/
21-
/bower.json.ember-try
22-
/npm-shrinkwrap.json.ember-try
23-
/package.json.ember-try
24-
/package-lock.json.ember-try
25-
/yarn.lock.ember-try

frontend/.watchmanconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"ignore_dirs": ["tmp", "dist"]
2+
"ignore_dirs": ["dist"]
33
}

frontend/app/components/task-selection.js

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { action } from "@ember/object";
22
import { service } from "@ember/service";
33
import Component from "@glimmer/component";
4+
import { tracked } from "@glimmer/tracking";
45
import { restartableTask, timeout, dropTask } from "ember-concurrency";
56
import { runTask } from "ember-lifeline";
67
import { trackedTask } from "reactiveweb/ember-concurrency";
7-
import { trackedFunction } from "reactiveweb/function";
8-
import { resolve } from "rsvp";
9-
import { localCopy } from "tracked-toolbox";
108

119
import customerOptionTemplate from "timed/components/optimized-power-select/custom-options/customer-option";
1210
import projectOptionTemplate from "timed/components/optimized-power-select/custom-options/project-option";
@@ -30,7 +28,7 @@ export default class TaskSelectionComponent extends Component {
3028
* @property {Customer} _customer
3129
* @private
3230
*/
33-
@localCopy("args.initial.customer")
31+
@tracked
3432
_customer;
3533

3634
/**
@@ -39,7 +37,7 @@ export default class TaskSelectionComponent extends Component {
3937
* @property {Project} _project
4038
* @private
4139
*/
42-
@localCopy("args.initial.project")
40+
@tracked
4341
_project;
4442

4543
/**
@@ -48,7 +46,7 @@ export default class TaskSelectionComponent extends Component {
4846
* @property {Task} _task
4947
* @private
5048
*/
51-
@localCopy("args.initial.task")
49+
@tracked
5250
_task;
5351

5452
constructor(...args) {
@@ -108,12 +106,20 @@ export default class TaskSelectionComponent extends Component {
108106
initial.task,
109107
]);
110108

111-
if (task) {
112-
this.onTaskChange(task, options);
113-
} else if (project) {
114-
this.onProjectChange(project, options);
115-
} else if (customer) {
116-
this.onCustomerChange(customer, options);
109+
this._task = task ?? this.args.task;
110+
this._project = this._task
111+
? await this._task.customer
112+
: (project ?? this.args.project);
113+
this._customer = this._project
114+
? await this._project.customer
115+
: (customer ?? this.args.customer);
116+
117+
if (this._task) {
118+
this.onTaskChange(this._task, options);
119+
} else if (this._project) {
120+
this.onProjectChange(this._project, options);
121+
} else if (this._customer) {
122+
this.onCustomerChange(this._customer, options);
117123
} else {
118124
this.tracking.fetchCustomers.perform();
119125
}
@@ -257,24 +263,28 @@ export default class TaskSelectionComponent extends Component {
257263
return this._customersAndRecentTasks.value ?? [];
258264
}
259265

260-
#projects = trackedFunction(this, async () => {
266+
_projects = dropTask(this, async () => {
261267
return (await this.customer?.projects)
262268
?.filter(this.filterByArchived)
263269
.toSorted((p) => p.name);
264270
});
265271

272+
_projectsTask = trackedTask(this, this._projects, () => [this._customer?.id]);
273+
266274
get projects() {
267-
return this.#projects.value ?? [];
275+
return this._projectsTask.value ?? [];
268276
}
269277

270-
#tasks = trackedFunction(this, async () => {
278+
_tasks = dropTask(this, async () => {
271279
return (await this.project?.tasks)
272280
?.filter(this.filterByArchived)
273281
.toSorted((t) => t.name);
274282
});
275283

284+
_tasksTask = trackedTask(this, this._tasks, () => [this._project?.id]);
285+
276286
get tasks() {
277-
return this.#tasks.value ?? [];
287+
return this._tasksTask.value ?? [];
278288
}
279289

280290
@action
@@ -351,7 +361,7 @@ export default class TaskSelectionComponent extends Component {
351361
}
352362

353363
if (!this.customer && value?.get("customer.id")) {
354-
resolve(value.get("customer")).then((c) => {
364+
Promise.resolve(value.get("customer")).then((c) => {
355365
this.onCustomerChange(c, {
356366
preventAction: true,
357367
});
@@ -376,7 +386,7 @@ export default class TaskSelectionComponent extends Component {
376386
(!this.project && projectId) ||
377387
(projectId && this.project?.id !== projectId)
378388
) {
379-
resolve(value.get("project")).then((p) => {
389+
Promise.resolve(value.get("project")).then((p) => {
380390
this.onProjectChange(p, {
381391
preventAction: true,
382392
});

0 commit comments

Comments
 (0)