Skip to content

Commit 5d343b8

Browse files
authored
Allow work tracker instance to be created (#1910)
* link project for new work tracker * do not throw error rather return undefined if no project id is found * remove unnecessary logs * change to padding-left * add catalog entry for work tracker * fix lint * add default for work tracker * fix work tracker after getCards
1 parent 8daa203 commit 5d343b8

12 files changed

+248
-75
lines changed

packages/base/card-api.gts

-1
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,6 @@ export function getFields(
29702970
return [];
29712971
}
29722972
}
2973-
29742973
return [[maybeFieldName, maybeField]];
29752974
});
29762975
fields = { ...fields, ...Object.fromEntries(currentFields) };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"title": "Work Tracker",
6+
"description": "Catalog entry for Work Tracker App card",
7+
"isField": false,
8+
"ref": {
9+
"module": "../work-tracker",
10+
"name": "WorkTracker"
11+
}
12+
},
13+
"meta": {
14+
"adoptsFrom": {
15+
"module": "https://cardstack.com/base/catalog-entry",
16+
"name": "CatalogEntry"
17+
}
18+
}
19+
}
20+
}

packages/experiments-realm/Project/51ca069b-1c55-4648-8654-bd82bf162f9d.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
}
1414
}
1515
}
16-
}
16+
}

packages/experiments-realm/Task/8ca45d40-adcb-437f-83ee-07ffd973cd17.json

+26-11
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
"data": {
33
"type": "card",
44
"attributes": {
5-
"taskName": "Resolve bug where overlay only appears on certain cards",
6-
"taskDetail": null,
5+
"priority": {
6+
"index": null,
7+
"label": null
8+
},
79
"status": {
10+
"completed": false,
811
"index": 3,
912
"label": "In Progress"
1013
},
11-
"priority": {
12-
"index": null,
13-
"label": null
14+
"taskName": "Resolve bug where overlay only appears on certain cards",
15+
"dateRange": {
16+
"start": null,
17+
"end": null
1418
},
19+
"taskDetail": null,
1520
"description": null,
1621
"thumbnailURL": null
1722
},
1823
"relationships": {
19-
"assignee": {
20-
"links": {
21-
"self": null
22-
}
23-
},
2424
"project": {
2525
"links": {
2626
"self": "../Project/51ca069b-1c55-4648-8654-bd82bf162f9d"
@@ -30,6 +30,21 @@
3030
"links": {
3131
"self": "../Team/cc574556-4253-44b8-ba80-0cfb844b4908"
3232
}
33+
},
34+
"children": {
35+
"links": {
36+
"self": null
37+
}
38+
},
39+
"assignee": {
40+
"links": {
41+
"self": null
42+
}
43+
},
44+
"tags": {
45+
"links": {
46+
"self": null
47+
}
3348
}
3449
},
3550
"meta": {
@@ -39,4 +54,4 @@
3954
}
4055
}
4156
}
42-
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"priority": {
6+
"index": 3,
7+
"label": "High"
8+
},
9+
"status": {
10+
"completed": false,
11+
"index": 0,
12+
"label": "Not Started"
13+
},
14+
"taskName": "Cleanup all the dbs",
15+
"dateRange": {
16+
"start": null,
17+
"end": null
18+
},
19+
"taskDetail": null,
20+
"description": null,
21+
"thumbnailURL": null
22+
},
23+
"relationships": {
24+
"project": {
25+
"links": {
26+
"self": "../Project/9b43240d-8c9c-42bc-a4d1-f9c626661562"
27+
}
28+
},
29+
"team": {
30+
"links": {
31+
"self": null
32+
}
33+
},
34+
"children": {
35+
"links": {
36+
"self": null
37+
}
38+
},
39+
"assignee": {
40+
"links": {
41+
"self": null
42+
}
43+
},
44+
"tags": {
45+
"links": {
46+
"self": null
47+
}
48+
}
49+
},
50+
"meta": {
51+
"adoptsFrom": {
52+
"module": "../productivity/task",
53+
"name": "Task"
54+
}
55+
}
56+
}
57+
}

packages/experiments-realm/Task/bb4323d6-1ea4-40d0-a039-85d13e55d4a6.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,25 @@
22
"data": {
33
"type": "card",
44
"attributes": {
5-
"taskName": "Create Tag List",
6-
"taskDetail": null,
7-
"status": {
8-
"index": 1,
9-
"label": "Next Sprint"
10-
},
115
"priority": {
126
"index": null,
137
"label": null
148
},
9+
"status": {
10+
"completed": false,
11+
"index": 1,
12+
"label": "Next Sprint"
13+
},
14+
"taskName": "Create Tag List",
1515
"dateRange": {
1616
"start": null,
1717
"end": null
1818
},
19+
"taskDetail": null,
1920
"description": null,
2021
"thumbnailURL": null
2122
},
2223
"relationships": {
23-
"assignee": {
24-
"links": {
25-
"self": "../TeamMember/03e293b9-e4c1-4592-b8d1-e6f963829086"
26-
}
27-
},
2824
"project": {
2925
"links": {
3026
"self": "../Project/9b43240d-8c9c-42bc-a4d1-f9c626661562"
@@ -40,6 +36,11 @@
4036
"self": null
4137
}
4238
},
39+
"assignee": {
40+
"links": {
41+
"self": "../TeamMember/03e293b9-e4c1-4592-b8d1-e6f963829086"
42+
}
43+
},
4344
"tags": {
4445
"links": {
4546
"self": null

packages/experiments-realm/Task/c734e2c7-71d9-446e-a2c1-e6e930fcee55.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,28 @@
22
"data": {
33
"type": "card",
44
"attributes": {
5-
"taskName": "Add functionality where + opens create card modal with correct status",
6-
"taskDetail": null,
7-
"status": {
8-
"index": null,
9-
"label": "In Progress"
10-
},
115
"priority": {
126
"index": 0,
137
"label": "Low"
148
},
9+
"status": {
10+
"completed": false,
11+
"index": null,
12+
"label": "In Progress"
13+
},
14+
"taskName": "Add functionality where + opens create card modal with correct status",
1515
"dateRange": {
1616
"start": null,
1717
"end": null
1818
},
19+
"taskDetail": null,
1920
"description": null,
2021
"thumbnailURL": null
2122
},
2223
"relationships": {
23-
"assignee": {
24-
"links": {
25-
"self": "../TeamMember/4c9614cd-ecda-42cf-bc18-37903019a7be"
26-
}
27-
},
2824
"project": {
2925
"links": {
30-
"self": null
26+
"self": "../Project/9b43240d-8c9c-42bc-a4d1-f9c626661562"
3127
}
3228
},
3329
"team": {
@@ -40,6 +36,11 @@
4036
"self": null
4137
}
4238
},
39+
"assignee": {
40+
"links": {
41+
"self": "../TeamMember/4c9614cd-ecda-42cf-bc18-37903019a7be"
42+
}
43+
},
4344
"tags": {
4445
"links": {
4546
"self": null
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"data": {
3+
"type": "card",
4+
"attributes": {
5+
"tabs": [],
6+
"headerIcon": {
7+
"altText": null,
8+
"size": "actual",
9+
"height": null,
10+
"width": null,
11+
"base64": null
12+
},
13+
"moduleId": null,
14+
"description": null,
15+
"thumbnailURL": null
16+
},
17+
"relationships": {
18+
"project": {
19+
"links": {
20+
"self": "../Project/9b43240d-8c9c-42bc-a4d1-f9c626661562"
21+
}
22+
}
23+
},
24+
"meta": {
25+
"adoptsFrom": {
26+
"module": "../work-tracker",
27+
"name": "WorkTracker"
28+
}
29+
}
30+
}
31+
}

packages/experiments-realm/WorkTracker/89209d31-328a-4c18-9758-53eb3c38d4f0.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,18 @@
1414
"description": null,
1515
"thumbnailURL": null
1616
},
17+
"relationships": {
18+
"project": {
19+
"links": {
20+
"self": "../Project/51ca069b-1c55-4648-8654-bd82bf162f9d"
21+
}
22+
}
23+
},
1724
"meta": {
1825
"adoptsFrom": {
1926
"module": "../work-tracker",
2027
"name": "WorkTracker"
2128
}
2229
}
2330
}
24-
}
31+
}

packages/experiments-realm/productivity/task-cards-resource.gts

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Resource } from 'ember-resources';
1111

1212
interface Args {
1313
named: {
14-
query: Query;
14+
query: Query | undefined;
1515
realm: string;
1616
};
1717
}
@@ -95,15 +95,18 @@ class TaskCollection extends Resource<Args> {
9595
}
9696

9797
modify(_positional: never[], named: Args['named']) {
98-
if (this.query === undefined || this.queryHasChanged(named.query)) {
98+
if (
99+
named.query &&
100+
(this.query === undefined || this.queryHasChanged(named.query))
101+
) {
99102
this.run.perform(named.query, named.realm);
100103
}
101104
}
102105
}
103106

104107
export default function getTaskCardsResource(
105108
parent: object,
106-
query: () => Query,
109+
query: () => Query | undefined,
107110
realm: () => string,
108111
) {
109112
return TaskCollection.from(parent, () => ({

packages/experiments-realm/productivity/task.gts

+2-2
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ export class Task extends TaskBase {
508508
static displayName = 'Task';
509509
static icon = CheckboxIcon;
510510
@field priority = contains(BaseTaskPriority);
511-
@field project = linksTo(Project);
512-
@field team = linksTo(Team);
511+
@field project = linksTo(() => Project);
512+
@field team = linksTo(() => Team);
513513
@field children = linksToMany(() => Task);
514514
@field status = contains(TaskStatusField);
515515

0 commit comments

Comments
 (0)