@bakers-build/addon-bakers-ui 0.6.1-next.5 → 0.6.1-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/src/Component/section-list/index.d.ts +5 -5
  2. package/dist/src/Component/section-list/index.js +2 -2
  3. package/dist/src/Entity/conductor/Data/conductors.d.ts +2 -12
  4. package/dist/src/Entity/conductor/Data/conductors.js +3 -25
  5. package/dist/src/Entity/conductor/Data/own-conductor.d.ts +5 -7
  6. package/dist/src/Entity/conductor/Data/own-conductor.js +9 -16
  7. package/dist/src/Entity/project/Screen/projects-screen.js +1 -4
  8. package/dist/src/Entity/run/Component/run-detail/index.d.ts +1 -1
  9. package/dist/src/Entity/run/Component/run-detail/index.js +1 -1
  10. package/dist/src/Entity/run/Data/query.d.ts +0 -5
  11. package/dist/src/Entity/run/Data/query.js +0 -8
  12. package/dist/src/Entity/run/Data/runs.d.ts +0 -2
  13. package/dist/src/Entity/run/Data/runs.js +1 -26
  14. package/dist/src/Entity/run/Screen/run-detail.d.ts +5 -2
  15. package/dist/src/Entity/run/Screen/run-detail.js +13 -2
  16. package/dist/src/Entity/ticket/Component/edit-form/index.d.ts +1 -2
  17. package/dist/src/Entity/ticket/Component/edit-form/index.js +1 -2
  18. package/dist/src/Entity/ticket/Component/ticket-content/index.d.ts +3 -8
  19. package/dist/src/Entity/ticket/Component/ticket-content/index.js +4 -71
  20. package/dist/src/Entity/ticket/Component/ticket-content/model.d.ts +0 -25
  21. package/dist/src/Entity/ticket/Component/ticket-content/model.js +0 -195
  22. package/dist/src/Entity/ticket/Data/parents.d.ts +3 -3
  23. package/dist/src/Entity/ticket/Data/parents.js +8 -9
  24. package/dist/src/Entity/ticket/Data/query.d.ts +0 -2
  25. package/dist/src/Entity/ticket/Data/query.js +0 -8
  26. package/dist/src/Entity/ticket/Data/tickets.d.ts +0 -2
  27. package/dist/src/Entity/ticket/Data/tickets.js +1 -20
  28. package/dist/src/Entity/ticket/Data/write.d.ts +0 -32
  29. package/dist/src/Entity/ticket/Data/write.js +0 -94
  30. package/dist/src/Entity/ticket/Form/edit-data.js +10 -4
  31. package/dist/src/Entity/ticket/Form/edit-parent-source.d.ts +1 -1
  32. package/dist/src/Entity/ticket/Form/edit.d.ts +11 -8
  33. package/dist/src/Entity/ticket/Form/edit.js +1 -1
  34. package/dist/src/Entity/ticket/Form/parent-filter.d.ts +2 -2
  35. package/dist/src/Entity/ticket/Form/parent-filter.js +1 -1
  36. package/dist/src/Entity/ticket/Form/parent-source.d.ts +11 -2
  37. package/dist/src/Entity/ticket/Form/parent-source.js +5 -7
  38. package/dist/src/Entity/ticket/Screen/edit-assignment-form.d.ts +2 -2
  39. package/dist/src/Entity/ticket/Screen/edit-assignment-form.js +3 -3
  40. package/dist/src/Entity/ticket/Screen/parent-filter-form.js +3 -4
  41. package/dist/src/Entity/ticket/Screen/ticket-content-screen.d.ts +1 -1
  42. package/dist/src/Entity/ticket/Screen/ticket-content-screen.js +1 -1
  43. package/dist/src/Entity/ticket/Screen/ticket-react-markdown.js +2 -2
  44. package/dist/src/Entity/ticket/Screen/ticket-runs.d.ts +2 -0
  45. package/dist/src/Entity/ticket/Screen/ticket-runs.js +26 -16
  46. package/dist/src/Entity/ticket/Screen/ticket-search.d.ts +1 -1
  47. package/dist/src/Entity/ticket/Screen/tickets.d.ts +1 -2
  48. package/dist/src/Entity/ticket/Screen/tickets.js +0 -23
  49. package/dist/src/Entity/user/Data/member-context.d.ts +1 -1
  50. package/dist/src/Entity/user/Data/users.d.ts +17 -98
  51. package/dist/src/Entity/user/Data/users.js +27 -74
  52. package/dist/src/Entity/user/Screen/member-overview.d.ts +12 -29
  53. package/dist/src/Entity/user/Screen/member-overview.js +38 -38
  54. package/dist/src/Entity/workspace/Screen/workspace-picker.js +1 -2
  55. package/dist/src/Form/field.js +1 -1
  56. package/dist/src/Kernel/key-input.d.ts +1 -2
  57. package/dist/src/Kernel/key-input.js +1 -2
  58. package/dist/src/Kernel/logo.d.ts +3 -0
  59. package/dist/src/Kernel/logo.js +48 -0
  60. package/dist/src/Kernel/splash.js +5 -5
  61. package/dist/src/Kernel/tui-kernel.js +1 -5
  62. package/dist/src/Routing/context.d.ts +0 -5
  63. package/dist/src/Routing/context.js +0 -6
  64. package/dist/src/Routing/registry.js +3 -6
  65. package/dist/src/Routing/routes.js +1 -24
  66. package/dist/src/Screen/async-modal-screen.d.ts +1 -1
  67. package/dist/src/Screen/async-modal-screen.js +1 -1
  68. package/dist/src/Widget/chrome.d.ts +1 -1
  69. package/dist/src/Widget/chrome.js +1 -1
  70. package/dist/src/Widget/option-source.js +3 -3
  71. package/dist/src/Widget/types.d.ts +2 -3
  72. package/dist/src/index.d.ts +0 -1
  73. package/dist/src/index.js +1 -2
  74. package/dist/src/launcher.d.ts +7 -14
  75. package/dist/src/launcher.js +2 -10
  76. package/dist/src/lib/cursor.d.ts +5 -5
  77. package/dist/src/lib/cursor.js +5 -5
  78. package/dist/src/lib/refresh-signal.d.ts +2 -2
  79. package/dist/src/lib/refresh-signal.js +3 -2
  80. package/dist/src/lib/theme.d.ts +7 -23
  81. package/dist/src/lib/theme.js +7 -23
  82. package/dist/src/plugin.d.ts +1 -2
  83. package/dist/src/plugin.js +3 -7
  84. package/dist/src/react-experiment.js +0 -2
  85. package/dist/src/route.js +1 -1
  86. package/dist/src/types.d.ts +5 -56
  87. package/package.json +4 -4
  88. package/dist/src/Agent/launch.d.ts +0 -25
  89. package/dist/src/Agent/launch.js +0 -57
  90. package/dist/src/Component/badge/index.d.ts +0 -11
  91. package/dist/src/Component/badge/index.js +0 -10
  92. package/dist/src/Component/bar-chart/index.d.ts +0 -16
  93. package/dist/src/Component/bar-chart/index.js +0 -63
  94. package/dist/src/Component/heat-map/index.d.ts +0 -21
  95. package/dist/src/Component/heat-map/index.js +0 -86
  96. package/dist/src/Component/stats-panel/index.d.ts +0 -61
  97. package/dist/src/Component/stats-panel/index.js +0 -112
  98. package/dist/src/Component/team-member-workload-list/index.d.ts +0 -9
  99. package/dist/src/Component/team-member-workload-list/index.js +0 -31
  100. package/dist/src/Entity/team/Data/members.d.ts +0 -30
  101. package/dist/src/Entity/team/Data/members.js +0 -83
  102. package/dist/src/Entity/team/Data/projects.d.ts +0 -3
  103. package/dist/src/Entity/team/Data/projects.js +0 -23
  104. package/dist/src/Entity/team/Data/team.d.ts +0 -22
  105. package/dist/src/Entity/team/Data/team.js +0 -38
  106. package/dist/src/Entity/team/Data/teams.d.ts +0 -223
  107. package/dist/src/Entity/team/Data/teams.js +0 -268
  108. package/dist/src/Entity/team/Data/workload.d.ts +0 -25
  109. package/dist/src/Entity/team/Data/workload.js +0 -60
  110. package/dist/src/Entity/team/Screen/team-member-work.d.ts +0 -41
  111. package/dist/src/Entity/team/Screen/team-member-work.js +0 -56
  112. package/dist/src/Entity/team/Screen/team-users.d.ts +0 -63
  113. package/dist/src/Entity/team/Screen/team-users.js +0 -210
  114. package/dist/src/Entity/team/Screen/team-work.d.ts +0 -39
  115. package/dist/src/Entity/team/Screen/team-work.js +0 -112
  116. package/dist/src/Entity/team/Screen/teams-screen.d.ts +0 -110
  117. package/dist/src/Entity/team/Screen/teams-screen.js +0 -264
  118. package/dist/src/Entity/ticket/Component/create-form/index.d.ts +0 -28
  119. package/dist/src/Entity/ticket/Component/create-form/index.js +0 -74
  120. package/dist/src/Entity/ticket/Component/demo-statistics.d.ts +0 -14
  121. package/dist/src/Entity/ticket/Component/demo-statistics.js +0 -88
  122. package/dist/src/Entity/ticket/Component/react-statistics.d.ts +0 -14
  123. package/dist/src/Entity/ticket/Component/react-statistics.js +0 -23
  124. package/dist/src/Entity/ticket/Data/workflow.d.ts +0 -9
  125. package/dist/src/Entity/ticket/Data/workflow.js +0 -18
  126. package/dist/src/Entity/ticket/Form/create-data.d.ts +0 -75
  127. package/dist/src/Entity/ticket/Form/create-data.js +0 -217
  128. package/dist/src/Entity/ticket/Form/create.d.ts +0 -230
  129. package/dist/src/Entity/ticket/Form/create.js +0 -198
  130. package/dist/src/Entity/ticket/Screen/create-ticket-form.d.ts +0 -133
  131. package/dist/src/Entity/ticket/Screen/create-ticket-form.js +0 -621
  132. package/dist/src/Entity/ticket/Screen/ticket-agents.d.ts +0 -134
  133. package/dist/src/Entity/ticket/Screen/ticket-agents.js +0 -253
  134. package/dist/src/Entity/ticket/Screen/ticket-react.d.ts +0 -41
  135. package/dist/src/Entity/ticket/Screen/ticket-react.js +0 -136
  136. package/dist/src/Entity/ticket-template/Data/templates.d.ts +0 -26
  137. package/dist/src/Entity/ticket-template/Data/templates.js +0 -62
  138. package/dist/src/Kernel/braid.d.ts +0 -4
  139. package/dist/src/Kernel/braid.js +0 -10
  140. package/dist/src/Screen/empty-overview.d.ts +0 -9
  141. package/dist/src/Screen/empty-overview.js +0 -14
  142. package/dist/src/Statistics/client.d.ts +0 -73
  143. package/dist/src/Statistics/client.js +0 -220
  144. package/dist/src/Statistics/comparison-chart.d.ts +0 -7
  145. package/dist/src/Statistics/comparison-chart.js +0 -525
  146. package/dist/src/Statistics/dashboard.d.ts +0 -93
  147. package/dist/src/Statistics/dashboard.js +0 -206
  148. package/dist/src/Statistics/figures.d.ts +0 -18
  149. package/dist/src/Statistics/figures.js +0 -162
  150. package/dist/src/Statistics/member-stats.d.ts +0 -58
  151. package/dist/src/Statistics/member-stats.js +0 -152
  152. package/dist/src/Statistics/presentation.d.ts +0 -8
  153. package/dist/src/Statistics/presentation.js +0 -36
  154. package/dist/src/Statistics/screen.d.ts +0 -44
  155. package/dist/src/Statistics/screen.js +0 -204
@@ -1,268 +0,0 @@
1
- import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
- import { loadPage, } from '../../collection.js';
3
- import { messageOf } from '../../transport.js';
4
- // BB-391 (AC4) — the `bb_team` collection read. The EIGHTH entity slice, and a
5
- // clean G2 leaf: it reads two resources and imports nothing from another slice.
6
- //
7
- // It mirrors `Entity/project/Data/projects.ts` throughout: a `get` with an
8
- // `include` rather than `collection().list()`, because the row needs a sideloaded
9
- // relationship resolved into a name and the collection builder cannot ask for one.
10
- //
11
- // BB-321 fixed what a team IS, and this file is downstream of that: a team is
12
- // the crew for reporting (`by_team` statistics), NOT an access carrier. So there
13
- // is no membership editing here (that is BB-320) and no team filter on tickets
14
- // — `bb_ticket` has no `team_id` at all, and a client-side
15
- // team → og_membership → assignee expansion would build exactly the access
16
- // carrier BB-321 decided against.
17
- /**
18
- * Drupal JSON:API default page size (`OffsetPage::SIZE_MAX`), declared because
19
- * this read ASKS for it rather than letting the server apply it silently — the
20
- * Teams tab does not page further, and `page[limit]` bounds the QUERY, so the
21
- * bound has to be a number this file can name in its own chrome.
22
- */
23
- export const TEAM_LIST_PAGE_SIZE = 50;
24
- /** One page of `og_membership` rows, at the same server-imposed bound. */
25
- export const MEMBERSHIP_PAGE_SIZE = 50;
26
- /**
27
- * How many membership pages the count is allowed to walk before giving up.
28
- *
29
- * A BOUND rather than a while-true: this read runs on every draw of the Teams
30
- * tab, and `og_membership` is the one collection in this renderer whose size is
31
- * a property of the whole instance rather than of a screen. 20 pages is 1000
32
- * active `bb_team` memberships; past that the walk stops and the count is
33
- * reported as NOT COUNTED (`null`), never as the partial sum it reached — see
34
- * {@link countActiveMembersByTeam}.
35
- */
36
- export const MEMBERSHIP_PAGE_CAP = 20;
37
- /** How an unknown or uncountable value is shown, matching the ticket list's `—`. */
38
- const EM_DASH = '—';
39
- /**
40
- * The Teams list table — its columns, the noun every node id is prefixed with,
41
- * and what it says when there is nothing.
42
- */
43
- export const TEAM_TABLE = {
44
- noun: 'team',
45
- emptyMessage: 'No teams.',
46
- columns: [
47
- {
48
- /**
49
- * FREE TEXT, and therefore the GROWER — the same trade the projects list
50
- * takes, for the same reason: a fixed width cuts an ordinary team name at
51
- * every terminal size, while a `width: 0` column declared FIRST takes the
52
- * row's surplus and leaves the two bounded columns their budgets.
53
- */
54
- key: 'name',
55
- label: 'TEAM',
56
- width: 0,
57
- fields: ['name'],
58
- get: (row) => row.name,
59
- },
60
- {
61
- /** A workspace name is free text too, but it is not the row's subject, so
62
- * it takes a budget and says when it was cut. */
63
- key: 'workspace',
64
- label: 'WORKSPACE',
65
- width: 20,
66
- fields: ['workspace_id'],
67
- get: (row) => row.workspace,
68
- },
69
- {
70
- /**
71
- * A count and an em dash, so 8 columns show every value this can hold
72
- * whole — a DOMAIN constant read off the vocabulary, never a measurement of
73
- * the page.
74
- */
75
- key: 'members',
76
- label: 'MEMBERS',
77
- width: 8,
78
- // Not a `bb_team` field at all: it is counted from `og_membership`, and
79
- // saying so here is what keeps that a fact about this loader rather than a
80
- // hole in the column model.
81
- fields: [],
82
- get: (row) => row.members,
83
- },
84
- ],
85
- };
86
- /** Id of a single-valued relationship linkage (`data` object), or null. */
87
- function singleRelId(rel) {
88
- const data = rel?.data;
89
- if (!data || Array.isArray(data))
90
- return null;
91
- return data.id ?? null;
92
- }
93
- const str = (value) => {
94
- if (typeof value === 'string' && value.length > 0)
95
- return value;
96
- // `drupal_internal__id` arrives as a NUMBER; `og_membership.entity_id` is a
97
- // string. One of the two has to be coerced, and coercing here is what keeps the
98
- // comparison in `countActiveMembersByTeam` a plain string equality.
99
- if (typeof value === 'number' && Number.isFinite(value))
100
- return String(value);
101
- return undefined;
102
- };
103
- /**
104
- * The team collection in server order, with each team's workspace name.
105
- *
106
- * Yields the OUTCOME rather than a swallowed array, for the reason BB-257 D4
107
- * gives: "there are no teams" and "the read was refused" are different answers,
108
- * and only the read knows which one happened. Read through `loadPage`, the ONE
109
- * page read this renderer has (BB-294), so the truncation signal is the same
110
- * `links.next` reading every other list uses rather than a second one here.
111
- */
112
- export async function listTeams(client) {
113
- const params = new DrupalJsonApiParams()
114
- .addInclude(['workspace_id'])
115
- .addPageLimit(TEAM_LIST_PAGE_SIZE);
116
- try {
117
- const page = await loadPage(client, 'bb_team/bb_team', params, (data, included) => teamsFrom({ data, included }), 0, { offset: 0, limit: TEAM_LIST_PAGE_SIZE });
118
- return { rows: page.rows, hasNext: page.hasNext };
119
- }
120
- catch (caught) {
121
- return { rows: [], hasNext: false, error: messageOf(caught) };
122
- }
123
- }
124
- /** Map one `bb_team` collection document onto {@link Team} rows. */
125
- export function teamsFrom(doc) {
126
- const workspaceNameById = new Map();
127
- for (const inc of doc.included ?? []) {
128
- const name = str(inc.attributes?.name);
129
- if (inc.id && name !== undefined)
130
- workspaceNameById.set(inc.id, name);
131
- }
132
- return (doc.data ?? []).map((resource) => {
133
- const id = resource.id ?? '';
134
- const workspaceId = singleRelId(resource.relationships?.workspace_id);
135
- return {
136
- id,
137
- // The uuid is the last honest fallback — nothing renders blank.
138
- name: str(resource.attributes?.name) ?? id,
139
- internalId: str(resource.attributes?.drupal_internal__id),
140
- workspace: workspaceId ? workspaceNameById.get(workspaceId) : undefined,
141
- };
142
- });
143
- }
144
- /** OG's own constant for an active membership (`OgMembershipInterface::STATE_ACTIVE`). */
145
- export const MEMBERSHIP_STATE_ACTIVE = 'active';
146
- /** The og_membership JSON:API resource, spelled once for both readers here. */
147
- export const MEMBERSHIP_RESOURCE = 'og_membership/default';
148
- /**
149
- * Reads one page of `og_membership`, filtered as the caller asked.
150
- *
151
- * Shared by the Teams-list COUNT and the team-level ROSTER so the two cannot
152
- * disagree about what a refusal looks like, and so both send the same three
153
- * filters. Throws whatever the client throws: a transport failure and a withheld
154
- * page are different answers and each caller says so in its own vocabulary.
155
- *
156
- * @param client The dropsh client.
157
- * @param filters The `filter[…]` pairs to send beyond `state`.
158
- * @param offset The `page[offset]` to send; omitted when 0, as the first read is.
159
- */
160
- export async function readMembershipPage(client, filters, offset) {
161
- const params = new DrupalJsonApiParams()
162
- .addFilter('state', MEMBERSHIP_STATE_ACTIVE)
163
- .addSort('drupal_internal__id', 'ASC')
164
- .addPageLimit(MEMBERSHIP_PAGE_SIZE);
165
- for (const [field, value] of Object.entries(filters)) {
166
- params.addFilter(field, value);
167
- }
168
- if (offset > 0)
169
- params.addPageOffset(offset);
170
- const doc = (await client.get(MEMBERSHIP_RESOURCE, params));
171
- return {
172
- rows: doc?.data ?? [],
173
- hasNext: Boolean(doc?.links?.next),
174
- // Presence is the signal, not its contents: the block is a `detail` string
175
- // and a `links` map whose shape is JSON:API's, not this client's.
176
- withheld: doc?.meta?.omitted !== undefined,
177
- };
178
- }
179
- /**
180
- * Active `bb_team` memberships, counted per INTERNAL team id.
181
- *
182
- * `null` — not an empty Map — when the count could not be COMPLETED, and that is
183
- * the whole contract of this function. An empty Map means "every team measured
184
- * zero members", which is a measurement an operator can act on; anything that
185
- * did not finish has measured nothing. The refusal is the likely case rather
186
- * than the exotic one: `og_membership` is OG's resource, not a bakers.build one, so
187
- * nothing in this project's rank model has an opinion about reading it.
188
- *
189
- * Both filters are load-bearing. Without `entity_type` the count would fold in
190
- * project and workspace memberships, which use the same table; without `state` it
191
- * would count pending and blocked people as crew.
192
- *
193
- * PAGED, and that is the second-round fix: the read used to send no
194
- * `page[limit]` at all and read `data` once. The control plane caps every page
195
- * at `OffsetPage::SIZE_MAX` regardless — `page[limit]` bounds the QUERY, not the
196
- * rows it returns — so past 50 active memberships the MEMBERS column showed a
197
- * number that was quietly a fraction of the crew. A wrong number is worse than
198
- * the `—` this file falls back to, because only one of the two admits it does
199
- * not know. The walk therefore follows `links.next`, the sole end-of-collection
200
- * signal, and gives up as `null` when it outruns {@link MEMBERSHIP_PAGE_CAP}
201
- * rather than returning the partial sum it had reached.
202
- *
203
- * A WITHHELD page is the third-round fix, and it is the one that was actually
204
- * biting. A refusal on this resource is not a throw: the control plane answered
205
- * HTTP 200 with `data: []` and a `meta.omitted` block, so the walk saw an empty
206
- * page, no `links.next`, and reported `0` for every crew — a NUMBER, which this
207
- * function's whole contract reserves for a measurement. BB-391's server half
208
- * makes the rows filtered rather than omitted, so a current deployment never
209
- * sends that shape; a deployment without the `bb:session:view_bakers_memberships`
210
- * child scope still does, and it must read as `—`.
211
- */
212
- export async function countActiveMembersByTeam(client) {
213
- const counts = new Map();
214
- for (let index = 0; index < MEMBERSHIP_PAGE_CAP; index += 1) {
215
- let page;
216
- try {
217
- page = await readMembershipPage(client, { entity_type: 'bb_team' }, index * MEMBERSHIP_PAGE_SIZE);
218
- }
219
- catch {
220
- // A refusal on ANY page, including a later one, leaves the count
221
- // incomplete — and an incomplete count is not a count.
222
- return null;
223
- }
224
- // Checked BEFORE the rows are folded in: a page that withheld some of its
225
- // rows and returned others would otherwise contribute a partial sum.
226
- if (page.withheld)
227
- return null;
228
- for (const row of page.rows) {
229
- const entityId = str(row.attributes?.entity_id);
230
- if (entityId === undefined)
231
- continue;
232
- counts.set(entityId, (counts.get(entityId) ?? 0) + 1);
233
- }
234
- if (!page.hasNext)
235
- return counts;
236
- }
237
- return null;
238
- }
239
- /** Format one team's member count for a cell: `—` when it was never counted. */
240
- export const formatMemberCount = (count) => count === null ? EM_DASH : String(count);
241
- /**
242
- * The Teams screen's rows: the collection and the membership count, read in
243
- * parallel because neither answer depends on the other.
244
- *
245
- * The two failures are deliberately NOT merged. A refused COLLECTION read has no
246
- * rows to show and the screen says so; a refused or incomplete MEMBERSHIP count
247
- * still has every team's identity and loses only the MEMBERS cell, which is what
248
- * the `—` says. Folding them into one flag would make the second look like the
249
- * first.
250
- */
251
- export async function loadTeamRows({ client, }) {
252
- const [teams, counts] = await Promise.all([
253
- listTeams(client),
254
- countActiveMembersByTeam(client),
255
- ]);
256
- return {
257
- rows: teams.rows.map((team) => ({
258
- id: team.id,
259
- name: team.name,
260
- workspace: team.workspace ?? EM_DASH,
261
- members: formatMemberCount(counts === null || team.internalId === undefined
262
- ? null
263
- : (counts.get(team.internalId) ?? 0)),
264
- })),
265
- ...(teams.error === undefined ? {} : { error: teams.error }),
266
- hasNext: teams.hasNext,
267
- };
268
- }
@@ -1,25 +0,0 @@
1
- import type { DropshClient } from '../../../types.js';
2
- export interface TeamMemberWorkload {
3
- userId: string;
4
- open: number;
5
- running: number;
6
- waiting: number;
7
- }
8
- export interface TeamWorkloadResult {
9
- team: {
10
- id: string;
11
- name: string;
12
- workspace?: string;
13
- memberCount: number;
14
- projectCount: number;
15
- };
16
- members: TeamMemberWorkload[];
17
- total: {
18
- open: number;
19
- running: number;
20
- waiting: number;
21
- };
22
- }
23
- export declare function loadTeamWorkload(client: DropshClient, teamId: string,
24
- /** The `/` line: the workload counts only the tickets it finds. */
25
- query?: string): Promise<TeamWorkloadResult>;
@@ -1,60 +0,0 @@
1
- import { DEFAULT_TICKET_CRITERIA } from '../../ticket/Data/query.js';
2
- import { loadFilteredTickets, } from '../../ticket/Data/tickets.js';
3
- import { classifyWorkload } from '../../ticket/Data/workload.js';
4
- import { listTeamMemberIds } from './members.js';
5
- import { listLinkedProjectIds } from './projects.js';
6
- import { resolveTeam } from './team.js';
7
- async function listProjectTickets(client, projectId, query) {
8
- const rows = [];
9
- let pageIndex = 0;
10
- while (true) {
11
- const page = await loadFilteredTickets(client, projectId, { ...DEFAULT_TICKET_CRITERIA, query }, pageIndex);
12
- if (page.withheld) {
13
- throw new Error('the control plane withheld project ticket rows');
14
- }
15
- rows.push(...page.rows);
16
- if (!page.hasNext)
17
- return rows;
18
- pageIndex++;
19
- }
20
- }
21
- export async function loadTeamWorkload(client, teamId,
22
- /** The `/` line: the workload counts only the tickets it finds. */
23
- query = '') {
24
- const [team, membership, projectIds] = await Promise.all([
25
- resolveTeam(client, teamId),
26
- listTeamMemberIds(client, teamId),
27
- listLinkedProjectIds(client, teamId),
28
- ]);
29
- if (membership.ids === null) {
30
- throw new Error(membership.error ?? 'The team membership is unavailable.');
31
- }
32
- const tickets = (await Promise.all(projectIds.map((projectId) => listProjectTickets(client, projectId, query)))).flat();
33
- const memberSet = new Set(membership.ids);
34
- const assigned = tickets.filter((ticket) => ticket.assigneeId && memberSet.has(ticket.assigneeId));
35
- const members = membership.ids.map((userId) => {
36
- const workload = classifyWorkload(assigned.filter((ticket) => ticket.assigneeId === userId));
37
- return {
38
- userId,
39
- open: workload.open.length,
40
- running: workload.running.length,
41
- waiting: workload.waiting.length,
42
- };
43
- });
44
- const total = members.reduce((sum, member) => ({
45
- open: sum.open + member.open,
46
- running: sum.running + member.running,
47
- waiting: sum.waiting + member.waiting,
48
- }), { open: 0, running: 0, waiting: 0 });
49
- return {
50
- team: {
51
- id: team.id,
52
- name: team.name,
53
- memberCount: members.length,
54
- projectCount: projectIds.length,
55
- ...(team.workspace ? { workspace: team.workspace } : {}),
56
- },
57
- members,
58
- total,
59
- };
60
- }
@@ -1,41 +0,0 @@
1
- import type { ScreenContext } from '../../../Screen/screen.js';
2
- import { type RunPage } from '../../run/Data/runs.js';
3
- import { MemberRunsScreen } from '../../run/Screen/user-runs.js';
4
- import { type TicketPage } from '../../ticket/Data/tickets.js';
5
- import { MemberTicketsScreen } from '../../ticket/Screen/user-tickets.js';
6
- export declare class TeamMemberTicketsScreen extends MemberTicketsScreen {
7
- static readonly route: {
8
- id: string;
9
- path: string;
10
- fallback: {
11
- routeId: string;
12
- preserveParams: true;
13
- };
14
- tab: {
15
- id: string;
16
- label: string;
17
- scope: string;
18
- weight: number;
19
- };
20
- };
21
- readonly id: string;
22
- protected loadRows(context: ScreenContext, page: number): Promise<TicketPage>;
23
- }
24
- export declare class TeamMemberRunsScreen extends MemberRunsScreen {
25
- static readonly route: {
26
- id: string;
27
- path: string;
28
- fallback: {
29
- routeId: string;
30
- preserveParams: true;
31
- };
32
- tab: {
33
- id: string;
34
- label: string;
35
- scope: string;
36
- weight: number;
37
- };
38
- };
39
- readonly id: string;
40
- protected loadRows(context: ScreenContext, page: number): Promise<RunPage>;
41
- }
@@ -1,56 +0,0 @@
1
- import { loadTeamMemberRuns } from '../../run/Data/runs.js';
2
- import { MemberRunsScreen } from '../../run/Screen/user-runs.js';
3
- import { loadTeamMemberTickets, } from '../../ticket/Data/tickets.js';
4
- import { MemberTicketsScreen } from '../../ticket/Screen/user-tickets.js';
5
- import { assertActiveMember } from '../../user/Data/member-context.js';
6
- import { listLinkedProjectIds } from '../Data/projects.js';
7
- export class TeamMemberTicketsScreen extends MemberTicketsScreen {
8
- static route = {
9
- id: 'team.member.tickets',
10
- path: '/teams/:teamId/members/:userId/tickets',
11
- fallback: { routeId: 'team.members', preserveParams: true },
12
- tab: {
13
- id: 'tickets',
14
- label: 'Tickets',
15
- scope: 'team-member',
16
- weight: 30,
17
- },
18
- };
19
- id = TeamMemberTicketsScreen.route.id;
20
- async loadRows(context, page) {
21
- if (!context.services)
22
- throw new Error('Member tickets requires services');
23
- const userId = context.user?.id ?? context.params?.userId;
24
- const teamId = context.params?.teamId;
25
- if (!userId || !teamId)
26
- throw new Error('Team member tickets require teamId and userId');
27
- await assertActiveMember(context.services.client, 'bb_team', teamId, userId);
28
- const projectIds = await listLinkedProjectIds(context.services.client, teamId);
29
- return loadTeamMemberTickets(context.services.client, userId, projectIds, this.ticketCriteria(), page);
30
- }
31
- }
32
- export class TeamMemberRunsScreen extends MemberRunsScreen {
33
- static route = {
34
- id: 'team.member.runs',
35
- path: '/teams/:teamId/members/:userId/runs',
36
- fallback: { routeId: 'team.members', preserveParams: true },
37
- tab: {
38
- id: 'runs',
39
- label: 'Runs',
40
- scope: 'team-member',
41
- weight: 40,
42
- },
43
- };
44
- id = TeamMemberRunsScreen.route.id;
45
- async loadRows(context, page) {
46
- if (!context.services)
47
- throw new Error('Member runs requires services');
48
- const userId = context.user?.id ?? context.params?.userId;
49
- const teamId = context.params?.teamId;
50
- if (!userId || !teamId)
51
- throw new Error('Team member runs require teamId and userId');
52
- await assertActiveMember(context.services.client, 'bb_team', teamId, userId);
53
- const projectIds = await listLinkedProjectIds(context.services.client, teamId);
54
- return loadTeamMemberRuns(context.services.client, userId, projectIds, this.runCriteria(), page);
55
- }
56
- }
@@ -1,63 +0,0 @@
1
- import type { VNode } from '@opentui/core';
2
- import { AsyncScreen } from '../../../Screen/async-screen.js';
3
- import type { FullScreenChrome } from '../../../Screen/full-screen.js';
4
- import type { ScreenContext } from '../../../Screen/screen.js';
5
- import { type UserListRow } from '../../user/Data/users.js';
6
- /** The crew as rows, or the reason there are none. */
7
- interface CrewList {
8
- rows: UserListRow[];
9
- /**
10
- * Present only when the crew could not be ESTABLISHED — a refused membership
11
- * read, a team that did not resolve, a refused user collection. Never set for
12
- * a crew that is genuinely empty: that is `rows: []`, and the table's own
13
- * `emptyMessage` says it.
14
- */
15
- error?: string;
16
- /**
17
- * No crew was named at all, which is NOT a failure — see
18
- * {@link TeamUsersScreen.load}. Kept apart from `error` so the two are not
19
- * reported in the same words: one says a read went wrong, the other says
20
- * nothing has been chosen yet.
21
- */
22
- unscoped?: boolean;
23
- }
24
- /**
25
- * One crew's people — the team level's Members tab.
26
- *
27
- * `fallback` points at the crews list: Escape lands where the operator came from,
28
- * which after the ruling is Teams and no longer a root Users tab.
29
- */
30
- export declare class TeamUsersScreen extends AsyncScreen<CrewList> {
31
- readonly frameId = "team-users";
32
- reload(context: ScreenContext): void;
33
- static readonly route: {
34
- id: string;
35
- path: string;
36
- tab: {
37
- id: string;
38
- label: string;
39
- scope: string;
40
- weight: number;
41
- };
42
- fallback: {
43
- routeId: string;
44
- };
45
- };
46
- readonly id: string;
47
- private readonly cursor;
48
- get selectedIndex(): number;
49
- set selectedIndex(value: number);
50
- get rows(): readonly UserListRow[];
51
- /** Whether the ready value is a CREW at all, rather than a notice about one. */
52
- private get drawable();
53
- protected load(context: ScreenContext): Promise<CrewList>;
54
- protected renderLoading(): string[];
55
- protected renderReady(result: CrewList): VNode;
56
- protected chrome(context: ScreenContext): FullScreenChrome;
57
- protected actions(): import("../../../Component/footer-actions/index.js").ActionItem[];
58
- activate(index: number, context: ScreenContext): boolean;
59
- select(index: number, context: ScreenContext): boolean;
60
- handleInput(input: string, context: ScreenContext): boolean;
61
- reset(): void;
62
- }
63
- export {};