@bakers-build/addon-bakers-ui 0.10.0 → 0.10.1-next.10
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.
- package/dist/src/Entity/run/Form/edit.d.ts +0 -13
- package/dist/src/Entity/run/Form/edit.js +0 -7
- package/dist/src/Entity/run/Screen/run-actions.d.ts +18 -0
- package/dist/src/Entity/run/Screen/run-actions.js +48 -0
- package/dist/src/Entity/run/Screen/run-detail.d.ts +2 -10
- package/dist/src/Entity/run/Screen/run-detail.js +14 -15
- package/dist/src/Entity/ticket/Component/edit-form/index.js +3 -3
- package/dist/src/Entity/ticket/Form/edit.d.ts +13 -32
- package/dist/src/Entity/ticket/Form/edit.js +21 -46
- package/dist/src/Entity/ticket/Screen/edit-assignment-form.js +6 -17
- package/dist/src/Entity/ticket/Screen/ticket-actions.d.ts +13 -0
- package/dist/src/Entity/ticket/Screen/ticket-actions.js +61 -0
- package/dist/src/Entity/ticket/Screen/ticket-content-screen.d.ts +2 -0
- package/dist/src/Entity/ticket/Screen/ticket-content-screen.js +46 -10
- package/dist/src/Entity/ticket/Screen/ticket-runs.d.ts +3 -3
- package/dist/src/Entity/ticket/Screen/ticket-runs.js +12 -18
- package/dist/src/Kernel/splash.d.ts +13 -8
- package/dist/src/Kernel/splash.js +74 -51
- package/dist/src/Kernel/tui-kernel.js +1 -1
- package/dist/src/Routing/routes.js +2 -2
- package/dist/src/Screen/confirm-dialog.d.ts +49 -0
- package/dist/src/Screen/confirm-dialog.js +148 -0
- package/package.json +5 -5
- package/dist/src/Entity/run/Screen/edit-run-form.d.ts +0 -26
- package/dist/src/Entity/run/Screen/edit-run-form.js +0 -117
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { actionItem } from '../../../Component/footer-actions/index.js';
|
|
2
|
-
import { columnNode, textNode } from '../../../lib/vnode.js';
|
|
3
|
-
import { AsyncModalScreen } from '../../../Screen/async-modal-screen.js';
|
|
4
|
-
import { runResource } from '../Component/run-detail/index.js';
|
|
5
|
-
import { cancelRunPayload, isRunCancellable } from '../Form/edit.js';
|
|
6
|
-
import { runDetailInputContext } from './run-detail.js';
|
|
7
|
-
export class EditRunFormScreen extends AsyncModalScreen {
|
|
8
|
-
modal = true;
|
|
9
|
-
static route = {
|
|
10
|
-
id: 'run.edit',
|
|
11
|
-
path: '/tickets/:ticketId/runs/:runId/edit',
|
|
12
|
-
parent: 'run.detail',
|
|
13
|
-
presentation: 'modal',
|
|
14
|
-
context: (_params, state, base) => state
|
|
15
|
-
? base.set(runDetailInputContext, {
|
|
16
|
-
document: state,
|
|
17
|
-
})
|
|
18
|
-
: base,
|
|
19
|
-
};
|
|
20
|
-
id = EditRunFormScreen.route.id;
|
|
21
|
-
action;
|
|
22
|
-
message = '';
|
|
23
|
-
submitting = false;
|
|
24
|
-
load(context) {
|
|
25
|
-
if (context.contexts?.has(runDetailInputContext))
|
|
26
|
-
return Promise.resolve(context.contexts.get(runDetailInputContext).document);
|
|
27
|
-
return Promise.resolve({});
|
|
28
|
-
}
|
|
29
|
-
renderLoading() {
|
|
30
|
-
return ['Loading run edit…'];
|
|
31
|
-
}
|
|
32
|
-
renderReady(document, context) {
|
|
33
|
-
const run = runResource(document, context.params?.runId);
|
|
34
|
-
return columnNode('run-edit-form', textNode({
|
|
35
|
-
id: 'run-edit-form-label',
|
|
36
|
-
content: `Cancel run${run ? ` #${String(run.attributes?.drupal_internal__id ?? run.id)}` : ''}?`,
|
|
37
|
-
}), textNode({
|
|
38
|
-
id: 'run-edit-form-message',
|
|
39
|
-
content: this.message || 'This marks the run as cancelled.',
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
modalChrome(_context) {
|
|
43
|
-
return { title: '✕ Cancel run' };
|
|
44
|
-
}
|
|
45
|
-
actions() {
|
|
46
|
-
return [
|
|
47
|
-
actionItem('run-cancel-submit', 'Enter', 'cancel'),
|
|
48
|
-
actionItem('run-cancel-esc', 'Esc', 'close'),
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
takeAction() {
|
|
52
|
-
const action = this.action;
|
|
53
|
-
this.action = undefined;
|
|
54
|
-
return action;
|
|
55
|
-
}
|
|
56
|
-
handleInput(input, context) {
|
|
57
|
-
if (super.handleInput(input, context))
|
|
58
|
-
return true;
|
|
59
|
-
if (input === 'escape') {
|
|
60
|
-
this.action = { type: 'back' };
|
|
61
|
-
context.requestDraw();
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
if (input !== 'enter' || this.submitting)
|
|
65
|
-
return false;
|
|
66
|
-
const document = this.readyValue;
|
|
67
|
-
const runId = context.params?.runId;
|
|
68
|
-
if (!document || !runId)
|
|
69
|
-
return false;
|
|
70
|
-
const run = runResource(document, runId);
|
|
71
|
-
if (!run || !isRunCancellable(String(run.attributes?.state ?? '')))
|
|
72
|
-
return false;
|
|
73
|
-
const client = context.services?.writeClient ?? context.services?.client;
|
|
74
|
-
if (!client)
|
|
75
|
-
return false;
|
|
76
|
-
this.submitting = true;
|
|
77
|
-
void client
|
|
78
|
-
.update('bb_run--bb_run', runId, cancelRunPayload())
|
|
79
|
-
.then(() => {
|
|
80
|
-
const updatedDocument = {
|
|
81
|
-
...document,
|
|
82
|
-
...(document.included
|
|
83
|
-
? {
|
|
84
|
-
included: document.included.map((resource) => resource.id === runId
|
|
85
|
-
? {
|
|
86
|
-
...resource,
|
|
87
|
-
attributes: {
|
|
88
|
-
...resource.attributes,
|
|
89
|
-
state: 'cancelled',
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
: resource),
|
|
93
|
-
}
|
|
94
|
-
: {}),
|
|
95
|
-
};
|
|
96
|
-
const result = {
|
|
97
|
-
type: 'run-cancelled',
|
|
98
|
-
runId,
|
|
99
|
-
document: updatedDocument,
|
|
100
|
-
};
|
|
101
|
-
if (context.back)
|
|
102
|
-
context.back(result);
|
|
103
|
-
else
|
|
104
|
-
this.action = { type: 'back', result };
|
|
105
|
-
})
|
|
106
|
-
.catch((caught) => {
|
|
107
|
-
this.message =
|
|
108
|
-
caught instanceof Error ? caught.message : String(caught);
|
|
109
|
-
})
|
|
110
|
-
.finally(() => {
|
|
111
|
-
this.submitting = false;
|
|
112
|
-
if (context.isActive())
|
|
113
|
-
context.requestDraw();
|
|
114
|
-
});
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
}
|