@bakers-build/addon-bakers-ui 0.4.1-next.476 → 0.4.1-next.513
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 pickers' order; the first is the default. */
|
|
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
|
-
|
|
8
|
-
/** The single source of truth, in the create form picker's order. */
|
|
4
|
+
// One declaration with two consumers: the create form's workflow picker and the
|
|
5
|
+
// edit form's workflow select. It mirrors the `bb_ticket` group of
|
|
6
|
+
// `bb_core.workflows.yml`.
|
|
7
|
+
/** The single source of truth, in the pickers' order; the first is the default. */
|
|
9
8
|
export const WORKFLOW_KINDS = [
|
|
10
|
-
//
|
|
11
|
-
// ticket's `ticket_type` term now, not its workflow.
|
|
9
|
+
// feature/bug/chore is the ticket's `ticket_type` term, not its workflow.
|
|
12
10
|
{ 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,6 +15,7 @@
|
|
|
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';
|
|
18
19
|
import { ownFirst } from './create-data.js';
|
|
19
20
|
import { loadReviewerOptions } from './reviewer-options.js';
|
|
20
21
|
/** The vocabulary this popup offers as its labels (BB-360 D9 / D11). */
|
|
@@ -69,6 +70,7 @@ export async function loadEditFormOptions(clients, hints = {}) {
|
|
|
69
70
|
ticketTypes,
|
|
70
71
|
recipes,
|
|
71
72
|
labels,
|
|
73
|
+
workflows: WORKFLOW_OPTIONS,
|
|
72
74
|
...(reviewers.error === undefined
|
|
73
75
|
? {}
|
|
74
76
|
: { 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' | 'submit' | 'cancelTicket';
|
|
4
|
+
export type EditFieldId = 'assignee' | 'reviewers' | 'conductor' | 'estimate' | 'spent' | 'parent' | 'ticketType' | 'recipe' | 'labels' | 'workflow' | 'submit' | 'cancelTicket';
|
|
5
5
|
/**
|
|
6
6
|
* BB-313 / BB-360 — the ONE lifecycle move this popup offers, as a named
|
|
7
7
|
* constant.
|
|
@@ -11,8 +11,9 @@ 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`) `cancel.from` is exactly the set of non-terminal
|
|
14
|
+
* One constant serves every ticket workflow because in each ticket workflow
|
|
15
|
+
* (`bb_work`, `bb_autopilot`) `cancel.from` is exactly the set of non-terminal
|
|
16
|
+
* states — so
|
|
16
17
|
* "non-terminal" and "the workflow permits cancelling" are the same
|
|
17
18
|
* predicate, and no workflow id is needed to tell them apart.
|
|
18
19
|
*/
|
|
@@ -28,7 +29,8 @@ export declare const CANCEL_TICKET_ACTION_ID = "cancelTicket";
|
|
|
28
29
|
* The states no transition leaves, in every ticket workflow.
|
|
29
30
|
*
|
|
30
31
|
* The server's own definition (`TypeWorkflows::isTerminal` — "a state no
|
|
31
|
-
* transition leaves") evaluates to exactly this pair for
|
|
32
|
+
* transition leaves") evaluates to exactly this pair for every ticket
|
|
33
|
+
* workflow; `bb_autopilot` shares `bb_work`'s states and transitions.
|
|
32
34
|
*/
|
|
33
35
|
export declare const TERMINAL_TICKET_STATES: ReadonlySet<string>;
|
|
34
36
|
/** The option lists the popup offers (loaded by `loadEditFormOptions`). */
|
|
@@ -41,6 +43,8 @@ export interface EditFormOptions {
|
|
|
41
43
|
/** The `recipe` vocabulary, for the single-valued `recipe` (BAKERS-17). */
|
|
42
44
|
recipes: Option[];
|
|
43
45
|
labels: Option[];
|
|
46
|
+
/** The fixed ticket workflow enum (`WORKFLOW_OPTIONS`), not a read. */
|
|
47
|
+
workflows: Option[];
|
|
44
48
|
errors?: {
|
|
45
49
|
reviewers?: string | undefined;
|
|
46
50
|
} | undefined;
|
|
@@ -69,6 +73,8 @@ interface EditValues {
|
|
|
69
73
|
ticketType: string | null;
|
|
70
74
|
recipe: string | null;
|
|
71
75
|
labels: ReadonlySet<string>;
|
|
76
|
+
/** The ticket's workflow id; null when the read carried none. */
|
|
77
|
+
workflow: string | null;
|
|
72
78
|
}
|
|
73
79
|
/** The payload of the ordinary Save PATCH (BB-233 Decision 2). */
|
|
74
80
|
export interface EditFormPayload {
|
|
@@ -21,8 +21,9 @@ 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`) `cancel.from` is exactly the set of non-terminal
|
|
24
|
+
* One constant serves every ticket workflow because in each ticket workflow
|
|
25
|
+
* (`bb_work`, `bb_autopilot`) `cancel.from` is exactly the set of non-terminal
|
|
26
|
+
* states — so
|
|
26
27
|
* "non-terminal" and "the workflow permits cancelling" are the same
|
|
27
28
|
* predicate, and no workflow id is needed to tell them apart.
|
|
28
29
|
*/
|
|
@@ -38,7 +39,8 @@ export const CANCEL_TICKET_ACTION_ID = 'cancelTicket';
|
|
|
38
39
|
* The states no transition leaves, in every ticket workflow.
|
|
39
40
|
*
|
|
40
41
|
* The server's own definition (`TypeWorkflows::isTerminal` — "a state no
|
|
41
|
-
* transition leaves") evaluates to exactly this pair for
|
|
42
|
+
* transition leaves") evaluates to exactly this pair for every ticket
|
|
43
|
+
* workflow; `bb_autopilot` shares `bb_work`'s states and transitions.
|
|
42
44
|
*/
|
|
43
45
|
export const TERMINAL_TICKET_STATES = new Set([
|
|
44
46
|
'done',
|
|
@@ -122,14 +124,21 @@ const declareEditForm = (savable, cancellable) => declareForm({
|
|
|
122
124
|
f.select('ticketType', 'Type', { from: 'ticketTypes', clearable: true }),
|
|
123
125
|
f.select('recipe', 'Recipe', { from: 'recipes', clearable: true }),
|
|
124
126
|
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' }),
|
|
125
130
|
...(savable ? [f.action('Save', 'submit')] : []),
|
|
126
131
|
...(cancellable
|
|
127
132
|
? [f.action('Cancel ticket', CANCEL_TICKET_ACTION_ID)]
|
|
128
133
|
: []),
|
|
129
134
|
],
|
|
130
135
|
toObject: (v) => ({
|
|
131
|
-
// Ordinary Save never writes lifecycle state (D6/D7).
|
|
132
|
-
|
|
136
|
+
// Ordinary Save never writes lifecycle state (D6/D7). The workflow is
|
|
137
|
+
// written only when known, never as an empty value.
|
|
138
|
+
attributes: {
|
|
139
|
+
...timeAttributes(v),
|
|
140
|
+
...(v.workflow === null ? {} : { workflow: v.workflow }),
|
|
141
|
+
},
|
|
133
142
|
relationships: {
|
|
134
143
|
assignee_user_id: linkage('user--user', v.assignee),
|
|
135
144
|
conductor_id: linkage('bb_conductor--bb_conductor', v.conductor),
|
|
@@ -198,6 +207,7 @@ export const EMPTY_EDIT_FORM_OPTIONS = {
|
|
|
198
207
|
ticketTypes: [],
|
|
199
208
|
recipes: [],
|
|
200
209
|
labels: [],
|
|
210
|
+
workflows: [],
|
|
201
211
|
};
|
|
202
212
|
const relId = (document, name) => {
|
|
203
213
|
const data = document.data?.relationships?.[name]?.data;
|
|
@@ -230,6 +240,10 @@ const reviewersFromDocument = (document) => {
|
|
|
230
240
|
}
|
|
231
241
|
return { ids: data.id ? new Set([data.id]) : new Set(), loaded: true };
|
|
232
242
|
};
|
|
243
|
+
const workflowValue = (document) => {
|
|
244
|
+
const value = document.data?.attributes?.workflow;
|
|
245
|
+
return typeof value === 'string' && value !== '' ? value : null;
|
|
246
|
+
};
|
|
233
247
|
const timeValue = (document, name) => {
|
|
234
248
|
const value = document.data?.attributes?.[name];
|
|
235
249
|
// An unset field prefills EMPTY, never `0m`: the popup must not turn "nobody
|
|
@@ -275,6 +289,7 @@ export function initialEditForm(document) {
|
|
|
275
289
|
ticketType: relId(document, 'ticket_type'),
|
|
276
290
|
recipe: relId(document, 'recipe'),
|
|
277
291
|
labels: labelIds(document),
|
|
292
|
+
workflow: workflowValue(document),
|
|
278
293
|
});
|
|
279
294
|
}
|
|
280
295
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-bakers-ui",
|
|
3
|
-
"version": "0.4.1-next.
|
|
3
|
+
"version": "0.4.1-next.513",
|
|
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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"zustand": "^5.0.15"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@bakers-build/core": "^0.4.1-next.
|
|
33
|
-
"@bakers-build/message": "^0.4.1-next.
|
|
32
|
+
"@bakers-build/core": "^0.4.1-next.513",
|
|
33
|
+
"@bakers-build/message": "^0.4.1-next.513"
|
|
34
34
|
}
|
|
35
35
|
}
|