@bakers-build/addon-bakers-ui 0.5.1-next.843 → 0.5.1-next.845
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.
|
@@ -3,7 +3,7 @@ export interface WorkflowKind {
|
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
-
/** The single source of truth, in the
|
|
6
|
+
/** The single source of truth, in the create form picker's order. */
|
|
7
7
|
export declare const WORKFLOW_KINDS: readonly WorkflowKind[];
|
|
8
8
|
/** The picker's `{id, label}` list — what the create form's `workflow` field offers. */
|
|
9
9
|
export declare const WORKFLOW_OPTIONS: WorkflowKind[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// The `bb_ticket` `workflow` field's fixed vocabulary — a ticket property, so it
|
|
2
2
|
// lives in the ticket slice.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
4
|
+
// BB-236 entity-slice phase 4 merged what were TWO spellings of this same enum
|
|
5
|
+
// into one declaration. BB-299 D2 then removed the filter consumer (the `t type`
|
|
6
|
+
// filter is gone), leaving exactly ONE consumer: the create form's workflow picker.
|
|
7
|
+
// The declaration stays because the `workflow` ATTRIBUTE stays (spec F4).
|
|
8
|
+
/** The single source of truth, in the create form picker's order. */
|
|
8
9
|
export const WORKFLOW_KINDS = [
|
|
9
|
-
// feature/bug/chore is the
|
|
10
|
+
// BAKERS-17: one workflow for every work ticket; feature/bug/chore is the
|
|
11
|
+
// ticket's `ticket_type` term now, not its workflow.
|
|
10
12
|
{ id: 'bb_work', label: 'work' },
|
|
11
|
-
// Same states as bb_work; its gates approve automatically except the merge.
|
|
12
|
-
{ id: 'bb_autopilot', label: 'autopilot' },
|
|
13
13
|
];
|
|
14
14
|
/** The picker's `{id, label}` list — what the create form's `workflow` field offers. */
|
|
15
15
|
export const WORKFLOW_OPTIONS = WORKFLOW_KINDS.map((k) => ({
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
import { listConductorsPreferringWrite, } from '../../conductor/Data/conductors.js';
|
|
16
16
|
import { listTerms } from '../../term/Data/terms.js';
|
|
17
17
|
import { listUsersPreferringWrite } from '../../user/Data/users.js';
|
|
18
|
-
import { WORKFLOW_OPTIONS } from '../Data/workflow.js';
|
|
19
18
|
import { ownFirst } from './create-data.js';
|
|
20
19
|
import { loadReviewerOptions } from './reviewer-options.js';
|
|
21
20
|
/** The vocabulary this popup offers as its labels (BB-360 D9 / D11). */
|
|
@@ -70,7 +69,6 @@ export async function loadEditFormOptions(clients, hints = {}) {
|
|
|
70
69
|
ticketTypes,
|
|
71
70
|
recipes,
|
|
72
71
|
labels,
|
|
73
|
-
workflows: WORKFLOW_OPTIONS,
|
|
74
72
|
...(reviewers.error === undefined
|
|
75
73
|
? {}
|
|
76
74
|
: { errors: { reviewers: reviewers.error } }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FormState } from '../../../Form/index.js';
|
|
2
2
|
import type { TicketDetailDocument } from '../../../types.js';
|
|
3
3
|
import type { FieldDef, Option } from './create.js';
|
|
4
|
-
export type EditFieldId = 'assignee' | 'reviewers' | 'conductor' | 'estimate' | 'spent' | 'parent' | 'ticketType' | 'recipe' | 'labels' | '
|
|
4
|
+
export type EditFieldId = 'assignee' | 'reviewers' | 'conductor' | 'estimate' | 'spent' | 'parent' | 'ticketType' | 'recipe' | 'labels' | 'submit' | 'cancelTicket';
|
|
5
5
|
/**
|
|
6
6
|
* BB-313 / BB-360 — the ONE lifecycle move this popup offers, as a named
|
|
7
7
|
* constant.
|
|
@@ -11,9 +11,8 @@ export type EditFieldId = 'assignee' | 'reviewers' | 'conductor' | 'estimate' |
|
|
|
11
11
|
* `cancelled`, so no served fact carries the cancel edge. The precedent is
|
|
12
12
|
* `STATE_FILTER_VALUES` in `Data/query.ts`, hardcoded for the same reason.
|
|
13
13
|
*
|
|
14
|
-
* One constant serves every ticket workflow because in
|
|
15
|
-
* (`bb_work
|
|
16
|
-
* states — so
|
|
14
|
+
* One constant serves every ticket workflow because in the ticket workflow
|
|
15
|
+
* (`bb_work`) `cancel.from` is exactly the set of non-terminal states — so
|
|
17
16
|
* "non-terminal" and "the workflow permits cancelling" are the same
|
|
18
17
|
* predicate, and no workflow id is needed to tell them apart.
|
|
19
18
|
*/
|
|
@@ -29,8 +28,7 @@ export declare const CANCEL_TICKET_ACTION_ID = "cancelTicket";
|
|
|
29
28
|
* The states no transition leaves, in every ticket workflow.
|
|
30
29
|
*
|
|
31
30
|
* The server's own definition (`TypeWorkflows::isTerminal` — "a state no
|
|
32
|
-
* transition leaves") evaluates to exactly this pair for
|
|
33
|
-
* workflow; `bb_autopilot` shares `bb_work`'s states and transitions.
|
|
31
|
+
* transition leaves") evaluates to exactly this pair for `bb_work`.
|
|
34
32
|
*/
|
|
35
33
|
export declare const TERMINAL_TICKET_STATES: ReadonlySet<string>;
|
|
36
34
|
/** The option lists the popup offers (loaded by `loadEditFormOptions`). */
|
|
@@ -43,8 +41,6 @@ export interface EditFormOptions {
|
|
|
43
41
|
/** The `recipe` vocabulary, for the single-valued `recipe` (BAKERS-17). */
|
|
44
42
|
recipes: Option[];
|
|
45
43
|
labels: Option[];
|
|
46
|
-
/** The fixed ticket workflow enum (`WORKFLOW_OPTIONS`), not a read. */
|
|
47
|
-
workflows: Option[];
|
|
48
44
|
errors?: {
|
|
49
45
|
reviewers?: string | undefined;
|
|
50
46
|
} | undefined;
|
|
@@ -73,8 +69,6 @@ interface EditValues {
|
|
|
73
69
|
ticketType: string | null;
|
|
74
70
|
recipe: string | null;
|
|
75
71
|
labels: ReadonlySet<string>;
|
|
76
|
-
/** The ticket's workflow id; null when the read carried none. */
|
|
77
|
-
workflow: string | null;
|
|
78
72
|
}
|
|
79
73
|
/** The payload of the ordinary Save PATCH (BB-233 Decision 2). */
|
|
80
74
|
export interface EditFormPayload {
|
|
@@ -21,9 +21,8 @@ import { PARENT_PAGE_SIZE } from '../Data/parents.js';
|
|
|
21
21
|
* `cancelled`, so no served fact carries the cancel edge. The precedent is
|
|
22
22
|
* `STATE_FILTER_VALUES` in `Data/query.ts`, hardcoded for the same reason.
|
|
23
23
|
*
|
|
24
|
-
* One constant serves every ticket workflow because in
|
|
25
|
-
* (`bb_work
|
|
26
|
-
* states — so
|
|
24
|
+
* One constant serves every ticket workflow because in the ticket workflow
|
|
25
|
+
* (`bb_work`) `cancel.from` is exactly the set of non-terminal states — so
|
|
27
26
|
* "non-terminal" and "the workflow permits cancelling" are the same
|
|
28
27
|
* predicate, and no workflow id is needed to tell them apart.
|
|
29
28
|
*/
|
|
@@ -39,8 +38,7 @@ export const CANCEL_TICKET_ACTION_ID = 'cancelTicket';
|
|
|
39
38
|
* The states no transition leaves, in every ticket workflow.
|
|
40
39
|
*
|
|
41
40
|
* The server's own definition (`TypeWorkflows::isTerminal` — "a state no
|
|
42
|
-
* transition leaves") evaluates to exactly this pair for
|
|
43
|
-
* workflow; `bb_autopilot` shares `bb_work`'s states and transitions.
|
|
41
|
+
* transition leaves") evaluates to exactly this pair for `bb_work`.
|
|
44
42
|
*/
|
|
45
43
|
export const TERMINAL_TICKET_STATES = new Set([
|
|
46
44
|
'done',
|
|
@@ -124,21 +122,14 @@ const declareEditForm = (savable, cancellable) => declareForm({
|
|
|
124
122
|
f.select('ticketType', 'Type', { from: 'ticketTypes', clearable: true }),
|
|
125
123
|
f.select('recipe', 'Recipe', { from: 'recipes', clearable: true }),
|
|
126
124
|
f.multi('labels', 'Labels', { from: 'labels' }),
|
|
127
|
-
// Not clearable: a ticket always runs one workflow. Both share their
|
|
128
|
-
// states, so a switch keeps the ticket's state.
|
|
129
|
-
f.select('workflow', 'Workflow', { from: 'workflows' }),
|
|
130
125
|
...(savable ? [f.action('Save', 'submit')] : []),
|
|
131
126
|
...(cancellable
|
|
132
127
|
? [f.action('Cancel ticket', CANCEL_TICKET_ACTION_ID)]
|
|
133
128
|
: []),
|
|
134
129
|
],
|
|
135
130
|
toObject: (v) => ({
|
|
136
|
-
// Ordinary Save never writes lifecycle state (D6/D7).
|
|
137
|
-
|
|
138
|
-
attributes: {
|
|
139
|
-
...timeAttributes(v),
|
|
140
|
-
...(v.workflow === null ? {} : { workflow: v.workflow }),
|
|
141
|
-
},
|
|
131
|
+
// Ordinary Save never writes lifecycle state (D6/D7).
|
|
132
|
+
attributes: { ...timeAttributes(v) },
|
|
142
133
|
relationships: {
|
|
143
134
|
assignee_user_id: linkage('user--user', v.assignee),
|
|
144
135
|
conductor_id: linkage('bb_conductor--bb_conductor', v.conductor),
|
|
@@ -207,7 +198,6 @@ export const EMPTY_EDIT_FORM_OPTIONS = {
|
|
|
207
198
|
ticketTypes: [],
|
|
208
199
|
recipes: [],
|
|
209
200
|
labels: [],
|
|
210
|
-
workflows: [],
|
|
211
201
|
};
|
|
212
202
|
const relId = (document, name) => {
|
|
213
203
|
const data = document.data?.relationships?.[name]?.data;
|
|
@@ -240,10 +230,6 @@ const reviewersFromDocument = (document) => {
|
|
|
240
230
|
}
|
|
241
231
|
return { ids: data.id ? new Set([data.id]) : new Set(), loaded: true };
|
|
242
232
|
};
|
|
243
|
-
const workflowValue = (document) => {
|
|
244
|
-
const value = document.data?.attributes?.workflow;
|
|
245
|
-
return typeof value === 'string' && value !== '' ? value : null;
|
|
246
|
-
};
|
|
247
233
|
const timeValue = (document, name) => {
|
|
248
234
|
const value = document.data?.attributes?.[name];
|
|
249
235
|
// An unset field prefills EMPTY, never `0m`: the popup must not turn "nobody
|
|
@@ -289,7 +275,6 @@ export function initialEditForm(document) {
|
|
|
289
275
|
ticketType: relId(document, 'ticket_type'),
|
|
290
276
|
recipe: relId(document, 'recipe'),
|
|
291
277
|
labels: labelIds(document),
|
|
292
|
-
workflow: workflowValue(document),
|
|
293
278
|
});
|
|
294
279
|
}
|
|
295
280
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-bakers-ui",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.845",
|
|
4
4
|
"description": "bakers.build TUI: interactive terminal UI (dashboard, projects, tickets) as a dropsh `tui` renderer plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"zustand": "^5.0.15"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@bakers-build/core": "^0.5.1-next.
|
|
34
|
-
"@bakers-build/message": "^0.5.1-next.
|
|
33
|
+
"@bakers-build/core": "^0.5.1-next.845",
|
|
34
|
+
"@bakers-build/message": "^0.5.1-next.845"
|
|
35
35
|
},
|
|
36
36
|
"bakersBuild": {
|
|
37
|
-
"commit": "
|
|
37
|
+
"commit": "cea454790c0e5173f650c42a4fdce8d1948e25f0",
|
|
38
38
|
"channel": "next"
|
|
39
39
|
}
|
|
40
40
|
}
|