Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ember 5.8 #621

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/dist/
/declarations/

# dependencies
/node_modules
/bower_components
/node_modules/

# misc
/.sass-cache
/.env*
/.pnp*
/.eslintcache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log*
testem.log
*.swp
*.orig

/.vscode/
/.idea/
/coverage/
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
14 changes: 1 addition & 13 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/
.*/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
2 changes: 1 addition & 1 deletion frontend/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": ["dist"]
}
47 changes: 29 additions & 18 deletions frontend/app/components/task-selection.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { action } from "@ember/object";
import { service } from "@ember/service";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { restartableTask, timeout, dropTask } from "ember-concurrency";
import { runTask } from "ember-lifeline";
import { trackedTask } from "reactiveweb/ember-concurrency";
import { trackedFunction } from "reactiveweb/function";
import { resolve } from "rsvp";
import { localCopy } from "tracked-toolbox";

import customerOptionTemplate from "timed/components/optimized-power-select/custom-options/customer-option";
import projectOptionTemplate from "timed/components/optimized-power-select/custom-options/project-option";
Expand All @@ -30,7 +28,8 @@
* @property {Customer} _customer
* @private
*/
@localCopy("args.initial.customer")
// @localCopy("args.initial.customer")
@tracked
_customer;

/**
Expand All @@ -39,7 +38,7 @@
* @property {Project} _project
* @private
*/
@localCopy("args.initial.project")
@tracked
_project;

/**
Expand All @@ -48,7 +47,7 @@
* @property {Task} _task
* @private
*/
@localCopy("args.initial.task")
@tracked
_task;

constructor(...args) {
Expand All @@ -63,7 +62,7 @@

if (this.args.liveTracking) {
// we track "_activity" here since we can not track the public getters directly
this.tracking.addObserver(

Check warning on line 65 in frontend/app/components/task-selection.js

View workflow job for this annotation

GitHub Actions / lint (js)

Don't use observers
"_activity",
this.handleTrackingActiveActivityChanged.perform,
);
Expand Down Expand Up @@ -108,12 +107,20 @@
initial.task,
]);

if (task) {
this.onTaskChange(task, options);
} else if (project) {
this.onProjectChange(project, options);
} else if (customer) {
this.onCustomerChange(customer, options);
this._task = task ?? this.args.task;
this._project = this._task
? await this._task.customer
: project ?? this.args.project;
this._customer = this._project
? await this._project.customer
: customer ?? this.args.customer;

if (this._task) {
this.onTaskChange(this._task, options);
} else if (this._project) {
this.onProjectChange(this._project, options);
} else if (this._customer) {
this.onCustomerChange(this._customer, options);
} else {
this.tracking.fetchCustomers.perform();
}
Expand Down Expand Up @@ -257,24 +264,28 @@
return this._customersAndRecentTasks.value ?? [];
}

#projects = trackedFunction(this, async () => {
_projects = dropTask(this, async () => {
return (await this.customer?.projects)
?.filter(this.filterByArchived)
.toSorted((p) => p.name);
});

_projectsTask = trackedTask(this, this._projects, () => [this._customer?.id]);

get projects() {
return this.#projects.value ?? [];
return this._projectsTask.value ?? [];
}

#tasks = trackedFunction(this, async () => {
_tasks = dropTask(this, async () => {
return (await this.project?.tasks)
?.filter(this.filterByArchived)
.toSorted((t) => t.name);
});

_tasksTask = trackedTask(this, this._tasks, () => [this._project?.id]);

get tasks() {
return this.#tasks.value ?? [];
return this._tasksTask.value ?? [];
}

@action
Expand Down Expand Up @@ -351,7 +362,7 @@
}

if (!this.customer && value?.get("customer.id")) {
resolve(value.get("customer")).then((c) => {
Promise.resolve(value.get("customer")).then((c) => {
this.onCustomerChange(c, {
preventAction: true,
});
Expand All @@ -376,7 +387,7 @@
(!this.project && projectId) ||
(projectId && this.project?.id !== projectId)
) {
resolve(value.get("project")).then((p) => {
Promise.resolve(value.get("project")).then((p) => {
this.onProjectChange(p, {
preventAction: true,
});
Expand Down
Loading
Loading