@jmanuelcorral/bond-app 0.1.4 → 0.1.5
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/README.md +41 -1
- package/app/mods/bond-agents/config.js +4 -0
- package/app/mods/bond-agents/main.js +10 -5
- package/app/mods/bond-agents/model.js +47 -2
- package/app/mods/bond-board/config.js +4 -0
- package/app/mods/bond-board/main.js +500 -54
- package/app/mods/bond-board/model.js +47 -0
- package/app/mods/bond-settings/config.js +4 -0
- package/app/mods/bond-settings/main.js +689 -12
- package/app/mods/bond-settings/pi-models.js +144 -0
- package/app/mods/bond-status/config.js +4 -0
- package/app/mods/bond-titlebar/main.js +47 -43
- package/package.json +1 -1
- package/runner/Dockerfile +42 -13
- package/runner/SPIKE-BOND.md +85 -0
- package/runner/build-config/.none +0 -0
- package/runner/build-creds/.none +0 -0
- package/runner/config.example/README.md +27 -0
- package/runner/config.example/pi/models.json +22 -0
- package/runner/credentials.example.env +27 -0
- package/runner/setup.sh +496 -0
- package/runner/versions.env +30 -0
- package/scripts/app-install.ts +4 -0
- package/src/config.ts +8 -0
- package/src/core/hub-session.ts +9 -7
- package/src/core/orchestrator.ts +459 -99
- package/src/core/setup.ts +178 -0
- package/src/db/database.ts +14 -0
- package/src/db/settings-repo.ts +108 -0
- package/src/db/ticket-repo.ts +34 -4
- package/src/runner/docker-client.ts +29 -0
- package/src/runner/github-client.ts +119 -0
- package/src/runner/hc-client.ts +9 -2
- package/src/runner/image-builder.ts +146 -6
- package/src/server/app.ts +211 -7
- package/src/types.ts +40 -0
|
@@ -21,11 +21,12 @@ import { View, div } from "gpui-kit";
|
|
|
21
21
|
import { v_flex, h_flex, TextareaState, Textarea, InputState, Input } from "gpui-base";
|
|
22
22
|
import { run, spaces, props, theme, openOverlay, closeOverlay, notify, shared, setShared, exec } from "herdr";
|
|
23
23
|
import { api, hcGet, apiUrl } from "./api.js";
|
|
24
|
+
import { CONFIG } from "./config.js";
|
|
24
25
|
import {
|
|
25
26
|
COLUMNS, POLL_MS, buildCards, groupByColumn, loadBoard, launchTicket, cancelRun, launchSummary,
|
|
26
27
|
deliverRun, nudgeRun, finishRun, approveHubFixes, deleteTicket, getDeletePreview,
|
|
27
28
|
columnCounts, filterOptions, filterCards, validateNewTicket, createTicket, AGENTS, TICKET_MODES, TEAM_ENGINES,
|
|
28
|
-
cleanRepoChips,
|
|
29
|
+
cleanRepoChips, listAssignedIssues, issueTicketId, searchRepos, listRepoIssues, needsWizard,
|
|
29
30
|
} from "./model.js";
|
|
30
31
|
import { stateColor, UI } from "./brand.js";
|
|
31
32
|
|
|
@@ -34,6 +35,10 @@ const REFRESH_KEY = "bond.board.refresh";
|
|
|
34
35
|
const FILTER_KEY = "bond.board.filter";
|
|
35
36
|
const SELECTED_RUN_KEY = "bond.selected_run";
|
|
36
37
|
const SELECTED_TICKET_KEY = "bond.selected_ticket";
|
|
38
|
+
// W-P2: the wizard is offered once per session (D-W2: afterwards it lives in Ajustes).
|
|
39
|
+
let wizardOffered = false;
|
|
40
|
+
|
|
41
|
+
const slug = (s) => String(s).replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
37
42
|
|
|
38
43
|
function spanishStateLabel(col, status) {
|
|
39
44
|
const s = String(status || col || "").toLowerCase();
|
|
@@ -60,6 +65,9 @@ export default class BondBoard extends View {
|
|
|
60
65
|
try {
|
|
61
66
|
run("layout.hide", { id: "console" });
|
|
62
67
|
} catch {}
|
|
68
|
+
try {
|
|
69
|
+
run("layout.resize", { id: "board", weight: 3 });
|
|
70
|
+
} catch {}
|
|
63
71
|
}
|
|
64
72
|
if (this.view === "launch") {
|
|
65
73
|
// D20: the clone uses the GitHub credential stored in Ajustes (the user's gh
|
|
@@ -100,19 +108,46 @@ export default class BondBoard extends View {
|
|
|
100
108
|
this.agent = "pi";
|
|
101
109
|
this.team_engine = "hc";
|
|
102
110
|
this.errors = {};
|
|
111
|
+
this.setup = null;
|
|
112
|
+
this.selectedModel = null; // null = '(por defecto)'
|
|
113
|
+
cx.spawn(async (cx) => {
|
|
114
|
+
try {
|
|
115
|
+
this.setup = await api("/setup");
|
|
116
|
+
} catch {
|
|
117
|
+
this.setup = null;
|
|
118
|
+
}
|
|
119
|
+
cx.notify();
|
|
120
|
+
});
|
|
103
121
|
this.fields = {
|
|
104
122
|
title: InputState.new({ placeholder: "título del ticket" }),
|
|
105
|
-
|
|
123
|
+
model: InputState.new({ placeholder: "por defecto" }),
|
|
124
|
+
issue: InputState.new({ placeholder: "https://github.com/org/repo/issues/123 (o pulsa Buscar)" }),
|
|
106
125
|
repo: InputState.new({ placeholder: "https://github.com/org/repo" }),
|
|
107
126
|
repos: TextareaState.new({ placeholder: "un repo por línea: https://github.com/org/repo [agente]" }),
|
|
108
127
|
hub: InputState.new({ placeholder: "https://github.com/org/hub" }),
|
|
109
128
|
base: InputState.new({ placeholder: "rama base (opcional: main)" }),
|
|
110
129
|
budget: InputState.new({ value: "2" }),
|
|
111
130
|
timeout: InputState.new({ value: "30" }),
|
|
112
|
-
description: TextareaState.new({ placeholder: "qué hay que hacer (va al PR)" }),
|
|
113
|
-
prompt: TextareaState.new({ placeholder: "encargo al agente (opcional)" }),
|
|
114
|
-
verify: TextareaState.new({ placeholder: "comandos de verificación, uno por línea (opcional)" }),
|
|
115
131
|
};
|
|
132
|
+
// Plan bond-app-nuevo-ticket (P2): la issue se busca, no se pega (D2/D4). Jira hasta P3.
|
|
133
|
+
this.issueProvider = "github";
|
|
134
|
+
this.pickedIssue = null;
|
|
135
|
+
this.carryBody = true; // lleva el cuerpo de la issue a la historia salvo que se desmarque
|
|
136
|
+
this.bondify = true; // bondifica el repo si no lo está salvo que se desmarque (P4, D-U)
|
|
137
|
+
this.issuePanel = null;
|
|
138
|
+
this.issues = null;
|
|
139
|
+
this.issuesLoading = false;
|
|
140
|
+
this.issuesError = null;
|
|
141
|
+
this.issueQuery = InputState.new({ placeholder: "filtrar por título…" });
|
|
142
|
+
this.issueQuery.on("change", (_e, cx) => cx.notify());
|
|
143
|
+
this.issueRepo = null;
|
|
144
|
+
this.repoQuery = InputState.new({ placeholder: "buscar repo…" });
|
|
145
|
+
this.repoQuery.on("change", (_e, cx) => cx.notify());
|
|
146
|
+
this.assignedPool = null;
|
|
147
|
+
this.poolLoading = false;
|
|
148
|
+
this.repoResults = [];
|
|
149
|
+
this.reposLoading = false;
|
|
150
|
+
this.reposError = null;
|
|
116
151
|
this.fields.title.focus();
|
|
117
152
|
return;
|
|
118
153
|
}
|
|
@@ -151,6 +186,27 @@ export default class BondBoard extends View {
|
|
|
151
186
|
}
|
|
152
187
|
if (dirty) cx.notify();
|
|
153
188
|
});
|
|
189
|
+
this.checkSetup(cx);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// W-P2: first launch — GET /setup says the orchestrator is not configured and the
|
|
193
|
+
// wizard never finished, open the bond-settings wizard once per session. Everything
|
|
194
|
+
// the person does is stored in the orchestrator, so closing it with Esc loses nothing.
|
|
195
|
+
checkSetup(cx) {
|
|
196
|
+
cx.spawn(async () => {
|
|
197
|
+
if (wizardOffered) return;
|
|
198
|
+
try {
|
|
199
|
+
const state = await api("/setup");
|
|
200
|
+
if (!needsWizard(state)) return;
|
|
201
|
+
wizardOffered = true;
|
|
202
|
+
openOverlay({
|
|
203
|
+
mod: "bond-settings", kind: "dialog", modal: true, width: 560, height: 0.92,
|
|
204
|
+
props: { view: "wizard", step: 1 },
|
|
205
|
+
});
|
|
206
|
+
} catch {
|
|
207
|
+
// no API: the board already shows its own «sin conexión» card.
|
|
208
|
+
}
|
|
209
|
+
});
|
|
154
210
|
}
|
|
155
211
|
|
|
156
212
|
refresh(cx) {
|
|
@@ -308,10 +364,20 @@ export default class BondBoard extends View {
|
|
|
308
364
|
if (this.busy) return;
|
|
309
365
|
const p = props();
|
|
310
366
|
const v = (k) => this.fields[k].value();
|
|
367
|
+
let modelVal = null;
|
|
368
|
+
if (this.agent === "pi") {
|
|
369
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
370
|
+
if (models.length > 0) {
|
|
371
|
+
modelVal = this.selectedModel || null;
|
|
372
|
+
} else {
|
|
373
|
+
modelVal = v("model") || null;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
311
376
|
const check = validateNewTicket({
|
|
312
377
|
title: v("title"), issue: v("issue"), mode: this.mode, repo: v("repo"), repos: v("repos"), hub: v("hub"),
|
|
313
|
-
base: v("base"), agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
314
|
-
|
|
378
|
+
base: v("base"), model: modelVal, agent: this.agent, team_engine: this.team_engine, budget: v("budget"), timeout: v("timeout"),
|
|
379
|
+
story: this.carryBody && this.pickedIssue ? String(this.pickedIssue.body ?? "") : "",
|
|
380
|
+
bondify: this.bondify,
|
|
315
381
|
});
|
|
316
382
|
this.errors = check.errors;
|
|
317
383
|
this.error = null;
|
|
@@ -347,6 +413,11 @@ export default class BondBoard extends View {
|
|
|
347
413
|
closeOverlay(props().overlay);
|
|
348
414
|
cx.stop_propagation();
|
|
349
415
|
}
|
|
416
|
+
// Enter en el panel de repos busca en GitHub sin salir del teclado.
|
|
417
|
+
if (e.key === "enter" && this.view === "create" && this.issuePanel === "repos") {
|
|
418
|
+
this.searchReposOn(cx);
|
|
419
|
+
cx.stop_propagation();
|
|
420
|
+
}
|
|
350
421
|
}
|
|
351
422
|
|
|
352
423
|
// ---- board actions ----
|
|
@@ -519,6 +590,16 @@ export default class BondBoard extends View {
|
|
|
519
590
|
}
|
|
520
591
|
|
|
521
592
|
selectCard(card, cx) {
|
|
593
|
+
// Un ticket Ready sin run no tiene sesión propia: no se salta a ninguna consola
|
|
594
|
+
// (antes caía en el espacio que estuviera seleccionado, que no era el suyo);
|
|
595
|
+
// el clic abre el lanzador, que es la acción de un Ready (D4).
|
|
596
|
+
if (!card.run) {
|
|
597
|
+
this.selectedCardId = card.id;
|
|
598
|
+
setShared(SELECTED_TICKET_KEY, card.id);
|
|
599
|
+
if (cx) cx.notify();
|
|
600
|
+
this.openLaunch(card);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
522
603
|
this.selectedCardId = card.id;
|
|
523
604
|
setShared(SELECTED_RUN_KEY, card.run?.id ?? null);
|
|
524
605
|
setShared(SELECTED_TICKET_KEY, card.id);
|
|
@@ -665,10 +746,24 @@ export default class BondBoard extends View {
|
|
|
665
746
|
)
|
|
666
747
|
)
|
|
667
748
|
)
|
|
668
|
-
.
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
749
|
+
.child(
|
|
750
|
+
h_flex().items_center().gap(4)
|
|
751
|
+
.when(Boolean(card.canOpen), (el) =>
|
|
752
|
+
el.child(
|
|
753
|
+
div().text_size(UI.text.tiny).font_family("JetBrains Mono").text_color(t.accent).child("Abrir sesión →")
|
|
754
|
+
)
|
|
755
|
+
)
|
|
756
|
+
.child(
|
|
757
|
+
div().id(`card-menu-btn-${card.id}`).px(4).py(0.5).rounded(UI.radius)
|
|
758
|
+
.text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.muted).cursor_pointer()
|
|
759
|
+
.hover((s) => s.bg(t.hover).text_color(t.foreground))
|
|
760
|
+
.on_mouse_down("left", (_e, cx) => cx.stop_propagation())
|
|
761
|
+
.on_click((_e, cx) => {
|
|
762
|
+
cx.stop_propagation();
|
|
763
|
+
this.openCardMenu(card);
|
|
764
|
+
})
|
|
765
|
+
.child("⋯")
|
|
766
|
+
)
|
|
672
767
|
)
|
|
673
768
|
)
|
|
674
769
|
// Ticket title in sans UI font
|
|
@@ -702,21 +797,22 @@ export default class BondBoard extends View {
|
|
|
702
797
|
)
|
|
703
798
|
// Agent & state
|
|
704
799
|
.child(dim(`${card.agent || "agente"} · ${card.agentState || "listo"}`))
|
|
705
|
-
// Metrics bar: Cost + Time
|
|
706
|
-
.
|
|
800
|
+
// Metrics bar: Cost + Time. Los costes están desactivados por defecto
|
|
801
|
+
// (CONFIG.costs); el tiempo se sigue mostrando si hay run.
|
|
802
|
+
.when(CONFIG.costs || Boolean(time), (bar) => bar.child(
|
|
707
803
|
h_flex().items_center().justify_between().p(5).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border).font_family("JetBrains Mono").text_size(UI.text.small)
|
|
708
|
-
.child(
|
|
804
|
+
.when(CONFIG.costs, (el) => el.child(
|
|
709
805
|
h_flex().gap(3).items_center()
|
|
710
806
|
.child(div().text_color(t.dim).child("Gasto:"))
|
|
711
807
|
.child(div().font_semibold().text_color(t.working).child(money))
|
|
712
808
|
.child(div().text_color(t.dim).text_size(UI.text.tiny).child(budget))
|
|
713
|
-
)
|
|
809
|
+
))
|
|
714
810
|
.when(Boolean(time), (el) =>
|
|
715
811
|
el.child(
|
|
716
812
|
div().text_color(t.bond_waiting ?? t.blocked).font_medium().child(String(time))
|
|
717
813
|
)
|
|
718
814
|
)
|
|
719
|
-
)
|
|
815
|
+
))
|
|
720
816
|
// Diagnostic box with motivo: and bond hub check:
|
|
721
817
|
.when(Boolean(card.failureReason) || Boolean(card.hub && card.analysis), (el) =>
|
|
722
818
|
el.child(
|
|
@@ -750,7 +846,8 @@ export default class BondBoard extends View {
|
|
|
750
846
|
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) => el.child(div().text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.accent).truncate().child(String(`PR #${card.prNumber} · ${card.prUrl}`))))
|
|
751
847
|
// Footer
|
|
752
848
|
.child(
|
|
753
|
-
div().pt(2).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).text_right()
|
|
849
|
+
div().pt(2).text_size(UI.text.tiny).font_family(UI.fontSans).text_color(t.dim).text_right()
|
|
850
|
+
.child(card.run ? "Haz clic para abrir sesión y consola" : "Haz clic para lanzar")
|
|
754
851
|
);
|
|
755
852
|
|
|
756
853
|
return h_flex().id(`card-${card.id}`).flex_none().items_stretch().rounded(UI.radiusLg).overflow_hidden()
|
|
@@ -988,6 +1085,47 @@ export default class BondBoard extends View {
|
|
|
988
1085
|
);
|
|
989
1086
|
}
|
|
990
1087
|
|
|
1088
|
+
// El orquestador nunca respondió: tarjeta centrada que explica cómo arreglarlo y permite
|
|
1089
|
+
// reintentar ya; el error crudo queda pequeño y tenue, para revisar (decisión 2026-11-19).
|
|
1090
|
+
renderApiDown() {
|
|
1091
|
+
const t = theme();
|
|
1092
|
+
return v_flex()
|
|
1093
|
+
.id("bond-api-down")
|
|
1094
|
+
.size_full()
|
|
1095
|
+
.items_center()
|
|
1096
|
+
.justify_center()
|
|
1097
|
+
.p(10)
|
|
1098
|
+
.bg(t.canvas)
|
|
1099
|
+
.text_color(t.foreground)
|
|
1100
|
+
.font_family("JetBrains Mono")
|
|
1101
|
+
.child(
|
|
1102
|
+
v_flex()
|
|
1103
|
+
.w(520)
|
|
1104
|
+
.max_w_full()
|
|
1105
|
+
.p(24)
|
|
1106
|
+
.gap(8)
|
|
1107
|
+
.items_center()
|
|
1108
|
+
.rounded(UI.radiusLg)
|
|
1109
|
+
.bg(t.chrome)
|
|
1110
|
+
.border_1()
|
|
1111
|
+
.border_color(t.border)
|
|
1112
|
+
.child(div().text_size(26).child("🔌"))
|
|
1113
|
+
.child(div().text_size(UI.text.title + 2).font_semibold().child("Sin conexión con el orquestador"))
|
|
1114
|
+
.child(div().text_size(UI.text.small).text_center().text_color(t.muted)
|
|
1115
|
+
.child(`El tablero necesita la API local en ${apiUrl()}. Arranca «bond-app start» en una terminal.`))
|
|
1116
|
+
.child(div().text_size(UI.text.tiny).text_color(t.dim).child("Se reintenta cada 3 segundos; al responder, el tablero solo se refresca."))
|
|
1117
|
+
.child(this.button("btn-api-retry", "Reintentar", "primary", (cx) => this.refresh(cx)))
|
|
1118
|
+
.child(div().pt(6).text_size(UI.text.tiny).text_center().text_color(t.dim).child(String(this.apiError ?? "")))
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// Primer refresco en vuelo: nada de kanbanes falsos con ceros.
|
|
1123
|
+
renderLoading() {
|
|
1124
|
+
const t = theme();
|
|
1125
|
+
return v_flex().id("bond-loading").size_full().items_center().justify_center().bg(t.canvas)
|
|
1126
|
+
.child(div().font_family("JetBrains Mono").text_size(UI.text.small).text_color(t.dim).child("Cargando el tablero…"));
|
|
1127
|
+
}
|
|
1128
|
+
|
|
991
1129
|
renderBoard() {
|
|
992
1130
|
const t = theme();
|
|
993
1131
|
const cards = buildCards(this.tickets, this.runs, this.agentStatus);
|
|
@@ -1000,12 +1138,18 @@ export default class BondBoard extends View {
|
|
|
1000
1138
|
totalCost += c.costUsd || 0;
|
|
1001
1139
|
totalBudget += c.budgetUsd || 0;
|
|
1002
1140
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1141
|
+
// Las estadísticas solo se publican con carga real: sin ellas la barra de título
|
|
1142
|
+
// muestra «—» en vez de mentir con ceros (decisión 2026-11-19).
|
|
1143
|
+
if (this.loaded) {
|
|
1144
|
+
setShared("bond.board_stats", {
|
|
1145
|
+
total: cards.length,
|
|
1146
|
+
counts,
|
|
1147
|
+
cost: totalCost,
|
|
1148
|
+
budget: totalBudget,
|
|
1149
|
+
});
|
|
1150
|
+
} else {
|
|
1151
|
+
setShared("bond.board_stats", null);
|
|
1152
|
+
}
|
|
1009
1153
|
|
|
1010
1154
|
if (this.boardMode === "session" && this.selectedCardId) {
|
|
1011
1155
|
const activeCard = cards.find((c) => c.id === this.selectedCardId);
|
|
@@ -1022,12 +1166,20 @@ export default class BondBoard extends View {
|
|
|
1022
1166
|
? filter.text
|
|
1023
1167
|
: (inputSearch.length > 0 ? inputSearch : (sharedSearch ? String(sharedSearch) : ""));
|
|
1024
1168
|
const searchVal = activeSearch.trim();
|
|
1169
|
+
// El primer refresco no ha completado: no se finge un tablero vacio, se dice lo que pasa
|
|
1170
|
+
// (decisión 2026-11-19).
|
|
1171
|
+
if (!this.loaded) {
|
|
1172
|
+
return this.apiError ? this.renderApiDown() : this.renderLoading();
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1025
1175
|
const shown = filterCards(cards, { repo: filter.repo, agent: filter.agent, text: searchVal });
|
|
1026
1176
|
const columns = groupByColumn(shown);
|
|
1027
1177
|
|
|
1028
1178
|
return v_flex().id("bond-board").size_full().p(10).gap(8).bg(t.canvas).text_color(t.foreground)
|
|
1029
|
-
|
|
1030
|
-
|
|
1179
|
+
// La API cae tras haber cargado: se conserva el último kanban; el aviso no lleva el crudo.
|
|
1180
|
+
.when(Boolean(this.apiError), (el) => el.child(div().px(10).py(6).rounded(UI.radius).bg(t.raised).border_1().border_color(t.blocked)
|
|
1181
|
+
.text_size(UI.text.small).font_family("JetBrains Mono").text_color(t.blocked)
|
|
1182
|
+
.child(`Sin respuesta del orquestador (${apiUrl()}); se reintenta cada 3 s`)))
|
|
1031
1183
|
.child(h_flex().id("bond-columns").flex_1().min_h(0).gap(8).items_stretch().overflow_x_scrollbar()
|
|
1032
1184
|
.children(columns.map((col) => this.column(col))));
|
|
1033
1185
|
}
|
|
@@ -1062,6 +1214,230 @@ export default class BondBoard extends View {
|
|
|
1062
1214
|
.child(label);
|
|
1063
1215
|
}
|
|
1064
1216
|
|
|
1217
|
+
// Plan bond-app-nuevo-ticket (P2): búsqueda combinada en el diálogo. Paso 1: repos —
|
|
1218
|
+
// los de tus issues asignadas, y búsqueda por nombre en GitHub (buscar + Buscar/Enter).
|
|
1219
|
+
// Paso 2: issues abiertas del repo elegido (ready primero, luego las tuyas).
|
|
1220
|
+
ghErrorText(e) {
|
|
1221
|
+
const msg = String(e?.message ?? e);
|
|
1222
|
+
return msg === "github_not_configured"
|
|
1223
|
+
? "No hay sesión de GitHub: conéctala en Ajustes («Usar mi sesión de gh») y reintenta."
|
|
1224
|
+
: msg === "github_api_error" || msg.startsWith("HTTP")
|
|
1225
|
+
? "GitHub no responde ahora mismo; reintenta."
|
|
1226
|
+
: msg;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
searchIssues(cx) {
|
|
1230
|
+
this.issuePanel = "repos";
|
|
1231
|
+
this.loadPool(cx);
|
|
1232
|
+
if (String(this.repoQuery.value() ?? "").trim()) this.searchReposOn(cx);
|
|
1233
|
+
else cx.notify();
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
loadPool(cx) {
|
|
1237
|
+
if (this.assignedPool || this.poolLoading) { cx.notify(); return; }
|
|
1238
|
+
this.poolLoading = true;
|
|
1239
|
+
cx.notify();
|
|
1240
|
+
cx.spawn(async (cx) => {
|
|
1241
|
+
try {
|
|
1242
|
+
const data = await listAssignedIssues(api, this.issueProvider);
|
|
1243
|
+
this.assignedPool = Array.isArray(data?.issues) ? data.issues : [];
|
|
1244
|
+
} catch (e) {
|
|
1245
|
+
this.reposError = this.ghErrorText(e);
|
|
1246
|
+
} finally {
|
|
1247
|
+
this.poolLoading = false;
|
|
1248
|
+
cx.notify();
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
searchReposOn(cx) {
|
|
1254
|
+
const term = String(this.repoQuery.value() ?? "").trim();
|
|
1255
|
+
if (!term || this.reposLoading) return;
|
|
1256
|
+
this.reposLoading = true;
|
|
1257
|
+
this.reposError = null;
|
|
1258
|
+
cx.notify();
|
|
1259
|
+
cx.spawn(async (cx) => {
|
|
1260
|
+
try {
|
|
1261
|
+
const data = await searchRepos(api, term);
|
|
1262
|
+
this.repoResults = (Array.isArray(data?.repos) ? data.repos : []).map((r) => ({ key: String(r.full_name) }));
|
|
1263
|
+
} catch (e) {
|
|
1264
|
+
this.reposError = this.ghErrorText(e);
|
|
1265
|
+
} finally {
|
|
1266
|
+
this.reposLoading = false;
|
|
1267
|
+
cx.notify();
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
pickRepo(key, cx) {
|
|
1273
|
+
this.issueRepo = key;
|
|
1274
|
+
this.issuePanel = "issues";
|
|
1275
|
+
this.issues = null;
|
|
1276
|
+
this.issuesLoading = true;
|
|
1277
|
+
this.issuesError = null;
|
|
1278
|
+
cx.notify();
|
|
1279
|
+
const [owner, repo] = String(key).split("/");
|
|
1280
|
+
cx.spawn(async (cx) => {
|
|
1281
|
+
try {
|
|
1282
|
+
const data = await listRepoIssues(api, owner, repo);
|
|
1283
|
+
this.issues = Array.isArray(data?.issues) ? data.issues : [];
|
|
1284
|
+
} catch (e) {
|
|
1285
|
+
this.issuesError = this.ghErrorText(e);
|
|
1286
|
+
} finally {
|
|
1287
|
+
this.issuesLoading = false;
|
|
1288
|
+
cx.notify();
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// Check del alta: el cuerpo de la issue viaja como historia del ticket (primer mensaje
|
|
1294
|
+
// del agente). Sin esto el agente arranca sin la US.
|
|
1295
|
+
issueBodyRow() {
|
|
1296
|
+
const t = theme();
|
|
1297
|
+
const bodyText = String(this.pickedIssue?.body ?? "").trim();
|
|
1298
|
+
if (!bodyText) return null;
|
|
1299
|
+
return h_flex()
|
|
1300
|
+
.id("iss-carry-body")
|
|
1301
|
+
.gap(7)
|
|
1302
|
+
.items_center()
|
|
1303
|
+
.px(2)
|
|
1304
|
+
.py(3)
|
|
1305
|
+
.cursor_pointer()
|
|
1306
|
+
.text_color(t.foreground)
|
|
1307
|
+
.font_family(UI.fontSans)
|
|
1308
|
+
.text_size(UI.text.small)
|
|
1309
|
+
.on_click((_e, cx) => {
|
|
1310
|
+
this.carryBody = !this.carryBody;
|
|
1311
|
+
cx.notify();
|
|
1312
|
+
})
|
|
1313
|
+
.child(
|
|
1314
|
+
div()
|
|
1315
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1316
|
+
.border_color(this.carryBody ? t.accent : t.border)
|
|
1317
|
+
.bg(this.carryBody ? t.accent : t.input)
|
|
1318
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.carryBody ? "✓" : ""))
|
|
1319
|
+
)
|
|
1320
|
+
.child(`Llevar el cuerpo de la issue a la historia (${bodyText.length} caracteres). Sin marcar, el agente arranca sin la US.`);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
// P4 (D-U): bondificar automáticamente el repo si no tiene .bond/bond.toml
|
|
1324
|
+
bondifyRow() {
|
|
1325
|
+
const t = theme();
|
|
1326
|
+
return h_flex()
|
|
1327
|
+
.id("ticket-bondify")
|
|
1328
|
+
.gap(7)
|
|
1329
|
+
.items_center()
|
|
1330
|
+
.px(2)
|
|
1331
|
+
.py(3)
|
|
1332
|
+
.cursor_pointer()
|
|
1333
|
+
.text_color(t.foreground)
|
|
1334
|
+
.font_family(UI.fontSans)
|
|
1335
|
+
.text_size(UI.text.small)
|
|
1336
|
+
.on_click((_e, cx) => {
|
|
1337
|
+
this.bondify = !this.bondify;
|
|
1338
|
+
cx.notify();
|
|
1339
|
+
})
|
|
1340
|
+
.child(
|
|
1341
|
+
div()
|
|
1342
|
+
.w(13).h(13).rounded(3).border_1()
|
|
1343
|
+
.border_color(this.bondify ? t.accent : t.border)
|
|
1344
|
+
.bg(this.bondify ? t.accent : t.input)
|
|
1345
|
+
.child(div().text_size(10).text_center().text_color(t.chrome).child(this.bondify ? "✓" : ""))
|
|
1346
|
+
)
|
|
1347
|
+
.child("Bondificar el repo si no lo está (bond init + commit propio)");
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
pickIssue(it) {
|
|
1351
|
+
this.pickedIssue = it;
|
|
1352
|
+
this.issuePanel = null;
|
|
1353
|
+
this.fields.issue.set_value(it.url ?? "");
|
|
1354
|
+
if (it.title) this.fields.title.set_value(it.title); // D4: automático y editable
|
|
1355
|
+
if (this.mode === "repo" && it.owner && it.repo) {
|
|
1356
|
+
this.fields.repo.set_value(`https://github.com/${it.owner}/${it.repo}`);
|
|
1357
|
+
}
|
|
1358
|
+
this.errors = {};
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
useIssueUrl() {
|
|
1362
|
+
const url = String(this.fields.issue.value() ?? "").trim();
|
|
1363
|
+
if (!url) {
|
|
1364
|
+
this.errors = { ...this.errors, issue: "Pega antes la URL de la issue" };
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
this.pickedIssue = { url, title: "", manual: true };
|
|
1368
|
+
this.issuePanel = null;
|
|
1369
|
+
this.errors = {};
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
clearIssue() {
|
|
1373
|
+
this.pickedIssue = null;
|
|
1374
|
+
this.fields.issue.set_value("");
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// Repos con issues tuyas abiertas (pool asignado), ready primero; base del paso 1.
|
|
1378
|
+
issueRepoGroups() {
|
|
1379
|
+
const map = new Map();
|
|
1380
|
+
for (const it of this.assignedPool ?? []) {
|
|
1381
|
+
const key = `${it.owner}/${it.repo}`;
|
|
1382
|
+
const g = map.get(key) ?? { key, n: 0, ready: 0 };
|
|
1383
|
+
g.n += 1;
|
|
1384
|
+
if (it.ready) g.ready += 1;
|
|
1385
|
+
map.set(key, g);
|
|
1386
|
+
}
|
|
1387
|
+
return [...map.values()].sort((a, b) => b.ready - a.ready || b.n - a.n || a.key.localeCompare(b.key));
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// Los de tus issues asignadas primero; debajo, los golpes de la búsqueda en GitHub.
|
|
1391
|
+
issueRepoChoices() {
|
|
1392
|
+
const local = this.issueRepoGroups();
|
|
1393
|
+
const seen = new Set(local.map((g) => g.key));
|
|
1394
|
+
const remote = (this.repoResults ?? [])
|
|
1395
|
+
.filter((r) => r.key.includes("/") && !seen.has(r.key))
|
|
1396
|
+
.map((r) => ({ key: r.key, n: 0, ready: 0, remote: true }));
|
|
1397
|
+
return [...local, ...remote];
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
repoRow(g) {
|
|
1401
|
+
const t = theme();
|
|
1402
|
+
return h_flex().id(`iss-repo-${g.key.replace("/", "-")}`).h(26).px(8).gap(6).items_center()
|
|
1403
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1404
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1405
|
+
.on_click((_e, cx) => this.pickRepo(g.key, cx))
|
|
1406
|
+
.child(div().flex_1().truncate().child(g.key))
|
|
1407
|
+
.when(Boolean(g.remote), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child("GitHub")))
|
|
1408
|
+
.when(!g.remote && g.ready > 0, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child(`ready ${g.ready}`)))
|
|
1409
|
+
.when(!g.remote, (el) => el.child(div().text_size(UI.text.tiny).text_color(t.dim).child(`${g.n} ${g.n === 1 ? "issue" : "issues"}`)));
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
issueRow(it) {
|
|
1413
|
+
const t = theme();
|
|
1414
|
+
return h_flex().id(`iss-row-${it.owner}-${it.repo}-${it.number}`).h(26).px(8).gap(6).items_center()
|
|
1415
|
+
.rounded(UI.radius).text_size(12).font_family("JetBrains Mono").cursor_pointer()
|
|
1416
|
+
.text_color(t.foreground).hover((s) => s.bg(t.hover))
|
|
1417
|
+
.on_click((_e, cx) => { this.pickIssue(it); cx.notify(); })
|
|
1418
|
+
.child(div().w(12).text_center().text_color(it.ready ? t.accent : t.dim).child(it.ready ? "✓" : "#"))
|
|
1419
|
+
.child(div().w(46).text_color(t.dim).child(`#${it.number}`))
|
|
1420
|
+
.child(div().flex_1().truncate().child(String(it.title ?? "")))
|
|
1421
|
+
.when(Boolean(it.ready), (el) => el.child(div().text_size(UI.text.tiny).text_color(t.accent).child("ready")));
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
renderModelSelector(models) {
|
|
1425
|
+
const defaultLabel = this.setup?.default_model
|
|
1426
|
+
? `(por defecto — ${this.setup.default_model})`
|
|
1427
|
+
: "(por defecto)";
|
|
1428
|
+
const isDefault = !this.selectedModel;
|
|
1429
|
+
return h_flex().id("model-selector").gap(6).flex_wrap()
|
|
1430
|
+
.child(this.choice("model-choice-default", defaultLabel, isDefault, () => {
|
|
1431
|
+
this.selectedModel = null;
|
|
1432
|
+
}))
|
|
1433
|
+
.children(models.map((m) => {
|
|
1434
|
+
const on = this.selectedModel === m;
|
|
1435
|
+
return this.choice(`model-choice-${slug(m)}`, m, on, () => {
|
|
1436
|
+
this.selectedModel = m;
|
|
1437
|
+
});
|
|
1438
|
+
}));
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1065
1441
|
renderCreate(p) {
|
|
1066
1442
|
const t = theme();
|
|
1067
1443
|
const e = this.errors ?? {};
|
|
@@ -1074,35 +1450,105 @@ export default class BondBoard extends View {
|
|
|
1074
1450
|
: this.mode === "list"
|
|
1075
1451
|
? this.field("Repos (se crea un hub con ellos)", area("repos", 70), e.repos)
|
|
1076
1452
|
: this.field("Hub existente", input("hub"), e.hub);
|
|
1077
|
-
|
|
1453
|
+
|
|
1454
|
+
// Panel de búsqueda combinada: primero repos, luego las issues del repo elegido.
|
|
1455
|
+
// Filtro «contiene»: cada palabra escrita debe aparecer (en cualquier orden); los
|
|
1456
|
+
// separadores no importan — «bond app» encuentra «bond-app».
|
|
1457
|
+
const lq = (s) => String(s ?? "").trim().toLowerCase();
|
|
1458
|
+
const has = (text, words) => words.every((w) => String(text).toLowerCase().includes(w));
|
|
1459
|
+
const rq = lq(this.repoQuery.value()).split(/\s+/).filter(Boolean);
|
|
1460
|
+
const iq = lq(this.issueQuery.value()).split(/\s+/).filter(Boolean);
|
|
1461
|
+
const repos = this.issueRepoChoices().filter((g) => has(g.key, rq));
|
|
1462
|
+
const shown = (this.issues ?? [])
|
|
1463
|
+
.filter((it) => `${it.owner}/${it.repo}` === this.issueRepo)
|
|
1464
|
+
.filter((it) => has(`${it.title} #${it.number}`, iq));
|
|
1465
|
+
const withStatus = (el, loading, error, loadingText, tag) => el
|
|
1466
|
+
.when(Boolean(loading), (x) => x.child(div().px(6).py(2).text_size(UI.text.small).text_color(t.dim).child(String(loadingText))))
|
|
1467
|
+
.when(Boolean(error), (x) => x.child(h_flex().gap(8).items_center()
|
|
1468
|
+
.child(div().flex_1().text_size(UI.text.small).text_color(t.blocked).child(String(error)))
|
|
1469
|
+
.when(String(error).includes("Ajustes"), (y) => y.child(this.button(`iss-open-settings-${tag}`, "Abrir Ajustes", "plain", () => run("layout.toggle", { id: "settings" }))))));
|
|
1470
|
+
const urlRow = h_flex().gap(6).items_center()
|
|
1471
|
+
.child(div().flex_1().child(Input.new(this.fields.issue).h(26).px(8).rounded(UI.radius).border_1()
|
|
1472
|
+
.border_color(e.issue ? t.blocked : t.input).bg(t.background).text_size(11)))
|
|
1473
|
+
.child(this.button("iss-use-url", "Usar URL", "plain", () => this.useIssueUrl()));
|
|
1474
|
+
let panel = null;
|
|
1475
|
+
if (this.issuePanel === "repos") {
|
|
1476
|
+
panel = withStatus(v_flex().id("iss-repos-panel").gap(6).p(8).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1477
|
+
.child(h_flex().gap(6).items_center()
|
|
1478
|
+
.child(div().flex_1().child(Input.new(this.repoQuery).h(26).px(8).rounded(UI.radius).border_1().border_color(t.input).bg(t.background).text_size(12)))
|
|
1479
|
+
.child(this.button("iss-repo-go", this.reposLoading ? "Buscando…" : "Buscar", "plain", (cx) => this.searchReposOn(cx))))
|
|
1480
|
+
.child(v_flex().max_h(170).overflow_y_scrollbar().gap(1)
|
|
1481
|
+
.when(!this.reposLoading && !this.poolLoading && !this.reposError && repos.length === 0, (el) => el.child(
|
|
1482
|
+
div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(rq.length ? "Ningún repo coincide; pulsa Buscar para mirar en GitHub" : "No tienes issues asignadas abiertas")))
|
|
1483
|
+
.children(repos.map((g) => this.repoRow(g))))
|
|
1484
|
+
.child(urlRow),
|
|
1485
|
+
this.reposLoading || this.poolLoading, this.reposError,
|
|
1486
|
+
this.reposLoading ? "Buscando repositorios en GitHub…" : "Buscando tus issues asignadas…", "repos");
|
|
1487
|
+
} else if (this.issuePanel === "issues") {
|
|
1488
|
+
panel = withStatus(v_flex().id("iss-issues-panel").gap(6).p(8).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1489
|
+
.child(h_flex().gap(6).items_center()
|
|
1490
|
+
.child(this.button("iss-back-repos", "←", "plain", () => { this.issuePanel = "repos"; }))
|
|
1491
|
+
.child(div().text_size(12).font_medium().child(String(this.issueRepo ?? "")))
|
|
1492
|
+
.child(div().flex_1())
|
|
1493
|
+
.child(div().w(220).child(Input.new(this.issueQuery).h(26).px(8).rounded(UI.radius).border_1()
|
|
1494
|
+
.border_color(t.input).bg(t.background).text_size(12))))
|
|
1495
|
+
.child(v_flex().max_h(170).overflow_y_scrollbar().gap(1)
|
|
1496
|
+
.when(!this.issuesLoading && !this.issuesError && shown.length === 0, (el) => el.child(
|
|
1497
|
+
div().px(6).py(3).text_size(UI.text.small).text_color(t.dim).child(iq.length ? "Ninguna issue coincide" : "Sin issues abiertas en este repo")))
|
|
1498
|
+
.children(shown.map((it) => this.issueRow(it))))
|
|
1499
|
+
.child(urlRow),
|
|
1500
|
+
this.issuesLoading, this.issuesError, "Buscando issues del repo…", "issues");
|
|
1501
|
+
}
|
|
1502
|
+
const badge = this.pickedIssue ? (() => {
|
|
1503
|
+
const id = issueTicketId(this.pickedIssue);
|
|
1504
|
+
const text = this.pickedIssue.manual
|
|
1505
|
+
? `issue enlazada → ${this.pickedIssue.url}`
|
|
1506
|
+
: `issue enlazada → ${id ?? this.pickedIssue.url}${id ? ` · rama feat/${id}` : ""} · ${String(this.pickedIssue.title ?? "")}`;
|
|
1507
|
+
return div().id("iss-picked").px(8).py(5).rounded(UI.radius).bg(t.raised).border_1().border_color(t.border)
|
|
1508
|
+
.text_size(UI.text.tiny).text_color(t.muted).child(text);
|
|
1509
|
+
})() : null;
|
|
1510
|
+
|
|
1511
|
+
// El panel va justo debajo de la fila de Buscar, no al pie del diálogo.
|
|
1512
|
+
const body = [
|
|
1078
1513
|
this.field("Título", input("title"), e.title),
|
|
1079
|
-
this.field("Historia de usuario (
|
|
1514
|
+
this.field("Historia de usuario (issue)", h_flex().gap(6).flex_wrap().items_center()
|
|
1515
|
+
.child(this.choice("iss-provider-github", "GitHub", this.issueProvider === "github", () => { this.issueProvider = "github"; }))
|
|
1516
|
+
.child(this.choice("iss-provider-jira", "Jira (después)", false, () => { this.errors = { ...this.errors, issue: "Jira llega en su fase del plan" }; }))
|
|
1517
|
+
.child(this.button("iss-search", this.issuesLoading ? "Buscando…" : "Buscar", "plain", (cx) => this.searchIssues(cx)))
|
|
1518
|
+
.when(Boolean(this.pickedIssue), (el) => el.child(this.button("iss-clear", "quitar", "plain", () => this.clearIssue()))), e.issue),
|
|
1519
|
+
];
|
|
1520
|
+
if (badge) body.push(badge);
|
|
1521
|
+
if (panel) body.push(panel);
|
|
1522
|
+
if (this.pickedIssue && String(this.pickedIssue.body ?? "").trim()) {
|
|
1523
|
+
const row = this.issueBodyRow();
|
|
1524
|
+
if (row) body.push(row);
|
|
1525
|
+
}
|
|
1526
|
+
body.push(this.bondifyRow());
|
|
1527
|
+
body.push(
|
|
1080
1528
|
this.field("Dónde trabaja", h_flex().gap(6).flex_wrap()
|
|
1081
1529
|
.children(TICKET_MODES.map((m) => this.choice(`mode-${m.id}`, m.label, this.mode === m.id, () => { this.mode = m.id; }))), null),
|
|
1082
1530
|
where,
|
|
1083
1531
|
h_flex().gap(10)
|
|
1084
1532
|
.child(div().flex_1().child(this.field(this.mode === "hub" ? "Rama base del hub" : "Rama base", input("base"), e.base)))
|
|
1085
|
-
.child(div().w(90).child(this.field("Tope USD", input("budget"), e.budget)))
|
|
1533
|
+
.when(CONFIG.costs, (el) => el.child(div().w(90).child(this.field("Tope USD", input("budget"), e.budget))))
|
|
1086
1534
|
.child(div().w(90).child(this.field("Timeout min", input("timeout"), e.timeout))),
|
|
1087
1535
|
this.field("Agente", h_flex().gap(6).flex_wrap()
|
|
1088
1536
|
.children(AGENTS.map((a) => this.choice(`agent-${a}`, a, this.agent === a, () => { this.agent = a; }))), e.agent),
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
div().text_size(UI.text.small).text_color(t.dim).child("El ticket queda en Ready: no arranca hasta que lo lances (D4)."),
|
|
1105
|
-
], [
|
|
1537
|
+
);
|
|
1538
|
+
if (this.agent === "pi") {
|
|
1539
|
+
const models = Array.isArray(this.setup?.models) ? this.setup.models : [];
|
|
1540
|
+
if (models.length > 0) {
|
|
1541
|
+
body.push(this.field("Modelo", this.renderModelSelector(models), e.model));
|
|
1542
|
+
} else {
|
|
1543
|
+
body.push(this.field("Modelo", input("model"), e.model));
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
if (this.mode !== "repo") {
|
|
1547
|
+
body.push(this.field("Motor de equipo", h_flex().gap(6).flex_wrap()
|
|
1548
|
+
.children(TEAM_ENGINES.map((en) => this.choice(`engine-${en.id}`, en.label, this.team_engine === en.id, () => { this.team_engine = en.id; }))), null));
|
|
1549
|
+
}
|
|
1550
|
+
body.push(div().text_size(UI.text.small).text_color(t.dim).child("El ticket queda en Ready: no arranca hasta que lo lances (D4)."));
|
|
1551
|
+
return this.renderDialog("Nuevo ticket", body, [
|
|
1106
1552
|
this.button("dlg-back", "Volver", "plain", () => closeOverlay(p.overlay)),
|
|
1107
1553
|
this.button("dlg-create", this.busy ? "Creando…" : "Crear ticket", "primary", (cx) => this.create(cx)),
|
|
1108
1554
|
]);
|
|
@@ -1128,7 +1574,7 @@ export default class BondBoard extends View {
|
|
|
1128
1574
|
renderCardMenu(p) {
|
|
1129
1575
|
const t = theme();
|
|
1130
1576
|
const card = p.card ?? (this.tickets && this.runs ? buildCards(this.tickets, this.runs, this.agentStatus).find((c) => c.id === p.cardId) : null) ?? {};
|
|
1131
|
-
const item = (id, label, icon, danger, action) =>
|
|
1577
|
+
const item = (id, label, icon, danger, action, keep = false) =>
|
|
1132
1578
|
h_flex()
|
|
1133
1579
|
.id(id)
|
|
1134
1580
|
.h(28)
|
|
@@ -1143,7 +1589,7 @@ export default class BondBoard extends View {
|
|
|
1143
1589
|
.hover((s) => s.bg(t.hover))
|
|
1144
1590
|
.on_click((_e, cx) => {
|
|
1145
1591
|
cx.stop_propagation();
|
|
1146
|
-
closeOverlay(p.overlay);
|
|
1592
|
+
if (!keep) closeOverlay(p.overlay);
|
|
1147
1593
|
action(cx);
|
|
1148
1594
|
})
|
|
1149
1595
|
.child(div().w(16).text_size(UI.text.small).text_center().child(icon))
|
|
@@ -1168,19 +1614,19 @@ export default class BondBoard extends View {
|
|
|
1168
1614
|
el.child(item(`menu-shell-${card.id}`, "Shell del contenedor", "", false, (cx) => this.openContainerShell(card, cx)))
|
|
1169
1615
|
)
|
|
1170
1616
|
.when(Boolean(card.canLaunch), (el) =>
|
|
1171
|
-
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card)))
|
|
1617
|
+
el.child(item(`menu-launch-${card.id}`, "Lanzar run", "▶", false, () => this.openLaunch(card), true))
|
|
1172
1618
|
)
|
|
1173
1619
|
.when(Boolean(card.canDeliver), (el) =>
|
|
1174
|
-
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card)))
|
|
1620
|
+
el.child(item(`menu-deliver-${card.id}`, "Entregar…", "↑", false, () => this.openDeliver(card), true))
|
|
1175
1621
|
)
|
|
1176
1622
|
.when(Boolean(card.canNudge), (el) =>
|
|
1177
|
-
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card)))
|
|
1623
|
+
el.child(item(`menu-nudge-${card.id}`, "Desbloquear…", "💬", false, () => this.openNudge(card), true))
|
|
1178
1624
|
)
|
|
1179
1625
|
.when(Boolean(card.canFinish), (el) =>
|
|
1180
|
-
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card)))
|
|
1626
|
+
el.child(item(`menu-finish-${card.id}`, "Terminado…", "✓", false, () => this.openFinish(card), true))
|
|
1181
1627
|
)
|
|
1182
1628
|
.when(Boolean(card.canApprove), (el) =>
|
|
1183
|
-
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card)))
|
|
1629
|
+
el.child(item(`menu-approve-${card.id}`, "Aprobar arreglos…", "✓", false, () => this.openApprove(card), true))
|
|
1184
1630
|
)
|
|
1185
1631
|
.when(Boolean(card.prUrl) && (card.deliveries || []).length === 0, (el) =>
|
|
1186
1632
|
el.child(item(`menu-pr-${card.id}`, "Abrir PR", "↗", false, () => this.openPr(card)))
|
|
@@ -1194,10 +1640,10 @@ export default class BondBoard extends View {
|
|
|
1194
1640
|
el.child(item(`menu-copy-docker-${card.id}`, "Copiar docker exec", "📋", false, (cx) => this.copyToClipboard(card.containerCommand, cx)))
|
|
1195
1641
|
)
|
|
1196
1642
|
.when(Boolean(card.canCancel), (el) =>
|
|
1197
|
-
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card)))
|
|
1643
|
+
el.child(item(`menu-cancel-${card.id}`, "Cancelar run…", "✕", true, () => this.openCancel(card), true))
|
|
1198
1644
|
)
|
|
1199
1645
|
.child(div().h(1).my(2).bg(t.border))
|
|
1200
|
-
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card)));
|
|
1646
|
+
.child(item(`menu-delete-${card.id}`, "Borrar ticket…", "🗑", true, () => this.openDelete(card), true));
|
|
1201
1647
|
}
|
|
1202
1648
|
|
|
1203
1649
|
render() {
|