flowpilot 0.0.2 → 0.0.3

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.
@@ -0,0 +1,1954 @@
1
+ import { a as useRef, c as Fragment, i as useReducer, n as instance, r as useEffect, s as render, t as jsxDEV } from "./jsx-dev-runtime-DOO7Tqjo.js";
2
+ import { t as filterByRelevance } from "./search-cPm8k8mK.js";
3
+ //#region src/commands/release/client.tsx
4
+ const initPromise = typeof window !== "undefined" && window.__I18N_LOCALE__ && window.__I18N_RESOURCES__ ? instance.init({
5
+ lng: window.__I18N_LOCALE__,
6
+ fallbackLng: "zh-CN",
7
+ resources: window.__I18N_RESOURCES__,
8
+ interpolation: { escapeValue: false }
9
+ }) : Promise.resolve();
10
+ const t = instance.t;
11
+ const releaseStyle = `
12
+ .page-header {
13
+ margin-bottom: 28px;
14
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
15
+ }
16
+ .page-header h2 {
17
+ font-size: 22px;
18
+ font-weight: 600;
19
+ letter-spacing: -0.02em;
20
+ margin-bottom: 6px;
21
+ }
22
+ .page-header p {
23
+ font-size: 13px;
24
+ color: var(--text-2);
25
+ font-weight: 300;
26
+ line-height: 1.5;
27
+ }
28
+
29
+ /* ── Pipeline ── */
30
+ .pipeline {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 0;
34
+ margin-bottom: 28px;
35
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
36
+ }
37
+ .pipeline-step {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 6px;
41
+ font-size: 11px;
42
+ font-family: var(--mono);
43
+ color: var(--text-3);
44
+ font-weight: 400;
45
+ white-space: nowrap;
46
+ }
47
+ .pipeline-step.active {
48
+ color: var(--neon);
49
+ font-weight: 500;
50
+ }
51
+ .pipeline-step.done {
52
+ color: var(--cyan);
53
+ }
54
+ .pipeline-node {
55
+ width: 8px; height: 8px;
56
+ border-radius: 50%;
57
+ background: var(--text-3);
58
+ transition: background 0.3s, box-shadow 0.3s;
59
+ }
60
+ .pipeline-step.active .pipeline-node {
61
+ background: var(--neon);
62
+ box-shadow: 0 0 8px var(--neon-glow);
63
+ animation: neon-pulse 2s ease infinite;
64
+ }
65
+ .pipeline-step.done .pipeline-node {
66
+ background: var(--cyan);
67
+ box-shadow: 0 0 4px var(--cyan-glow);
68
+ }
69
+ .pipeline-line {
70
+ width: 32px;
71
+ height: 1px;
72
+ background: var(--border);
73
+ margin: 0 4px;
74
+ transition: background 0.3s;
75
+ }
76
+ .pipeline-line.done { background: var(--cyan); }
77
+
78
+ /* ── Generic select ── */
79
+ .sel {
80
+ position: relative;
81
+ margin-bottom: 16px;
82
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
83
+ z-index: 1;
84
+ }
85
+ .sel-trigger {
86
+ width: 100%;
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 8px;
90
+ padding: 12px 14px;
91
+ font-size: 13px;
92
+ font-family: var(--sans);
93
+ color: var(--text-1, #E2E8F0);
94
+ background: var(--bg-input, #0A0E14);
95
+ border: 1px solid var(--border);
96
+ border-radius: 8px;
97
+ cursor: pointer;
98
+ outline: none;
99
+ transition: border-color 0.2s, box-shadow 0.2s;
100
+ text-align: left;
101
+ }
102
+ .sel-trigger:hover { border-color: var(--border-active); }
103
+ .sel-trigger:focus,
104
+ .sel-trigger.open {
105
+ border-color: var(--neon);
106
+ box-shadow: 0 0 0 2px var(--neon-soft), 0 0 8px var(--neon-glow);
107
+ }
108
+ .sel-trigger-label {
109
+ font-size: 11px;
110
+ color: var(--text-3, #64748B);
111
+ flex-shrink: 0;
112
+ }
113
+ .sel-trigger-value {
114
+ flex: 1;
115
+ font-family: var(--mono);
116
+ font-size: 13px;
117
+ font-weight: 500;
118
+ color: var(--text-1, #E2E8F0);
119
+ }
120
+ .sel-trigger-value.empty {
121
+ color: var(--text-3);
122
+ font-weight: 300;
123
+ }
124
+ .sel-trigger-arrow {
125
+ color: var(--text-3, #64748B);
126
+ font-size: 10px;
127
+ transition: transform 0.2s;
128
+ }
129
+ .sel-trigger.open .sel-trigger-arrow {
130
+ transform: rotate(180deg);
131
+ }
132
+ .sel-dropdown {
133
+ position: absolute;
134
+ top: calc(100% + 6px);
135
+ left: 0; right: 0;
136
+ max-height: 280px;
137
+ overflow-y: auto;
138
+ background: var(--bg-card, #111820);
139
+ border: 1px solid rgba(0,255,136,0.08);
140
+ border-radius: 8px;
141
+ box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 12px rgba(0,255,136,0.03);
142
+ z-index: 1000;
143
+ animation: dropdown-in 0.12s ease both;
144
+ }
145
+ .sel-dropdown::-webkit-scrollbar { width: 6px; }
146
+ .sel-dropdown::-webkit-scrollbar-track { background: transparent; }
147
+ .sel-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
148
+ .sel-search {
149
+ padding: 8px;
150
+ border-bottom: 1px solid var(--border);
151
+ position: sticky;
152
+ top: 0;
153
+ background: var(--bg-card, #111820);
154
+ z-index: 1;
155
+ }
156
+ .sel-search-input {
157
+ width: 100%;
158
+ padding: 6px 10px;
159
+ font-size: 12px;
160
+ font-family: var(--mono);
161
+ color: var(--text-1, #E2E8F0);
162
+ background: var(--bg-void, #0A0A0F);
163
+ border: 1px solid var(--border);
164
+ border-radius: 4px;
165
+ outline: none;
166
+ transition: border-color 0.15s;
167
+ }
168
+ .sel-search-input::placeholder { color: var(--text-3); }
169
+ .sel-search-input:focus { border-color: var(--neon); }
170
+ .sel-item {
171
+ padding: 10px 14px;
172
+ font-size: 13px;
173
+ cursor: pointer;
174
+ transition: background 0.1s;
175
+ border-left: 3px solid transparent;
176
+ color: var(--text-1, #E2E8F0);
177
+ }
178
+ .sel-item:first-child { border-radius: 7px 7px 0 0; }
179
+ .sel-item:last-child { border-radius: 0 0 7px 7px; }
180
+ .sel-item:hover,
181
+ .sel-item.highlighted { background: var(--bg-hover, rgba(0,255,136,0.04)); }
182
+ .sel-item.active {
183
+ background: var(--neon-soft, rgba(0,255,136,0.08));
184
+ border-left-color: var(--neon);
185
+ font-weight: 500;
186
+ }
187
+ .sel-item-name { font-weight: 500; color: var(--text-1, #E2E8F0); }
188
+ .sel-item-sub { font-size: 11px; color: var(--text-3, #64748B); font-family: var(--mono); margin-top: 2px; }
189
+ .sel-empty { padding: 12px; text-align: center; color: var(--text-3, #64748B); font-size: 12px; }
190
+
191
+ /* ── Spinner ── */
192
+ .spinner {
193
+ display: inline-block;
194
+ width: 14px; height: 14px;
195
+ border: 2px solid var(--border);
196
+ border-top-color: var(--neon);
197
+ border-radius: 50%;
198
+ animation: spin 0.6s linear infinite;
199
+ }
200
+ @keyframes spin { to { transform: rotate(360deg); } }
201
+ .loading-row {
202
+ display: flex;
203
+ align-items: center;
204
+ gap: 8px;
205
+ padding: 10px 14px;
206
+ color: var(--text-3);
207
+ font-size: 13px;
208
+ margin-bottom: 16px;
209
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
210
+ }
211
+
212
+ /* ── Version display ── */
213
+ .version-display {
214
+ display: flex;
215
+ align-items: center;
216
+ gap: 12px;
217
+ padding: 14px 20px;
218
+ background: var(--bg-card);
219
+ border: 1px solid rgba(0,212,255,0.08);
220
+ border-radius: 8px;
221
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
222
+ }
223
+ .version-tag { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--mono); }
224
+ .version-number { font-size: 20px; font-weight: 600; font-family: var(--mono); color: var(--cyan); letter-spacing: -0.01em; }
225
+ .version-error { color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
226
+
227
+ .empty-hint { text-align: center; padding: 32px 0; color: var(--text-3); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }
228
+ .state-error { color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
229
+
230
+ /* ── Jira ── */
231
+ .jira-section { margin-top: 20px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
232
+ .jira-btn {
233
+ width: 100%;
234
+ min-height: 44px;
235
+ padding: 10px 20px;
236
+ font-size: 13px;
237
+ font-family: var(--sans);
238
+ font-weight: 500;
239
+ color: var(--bg-void);
240
+ background: var(--neon);
241
+ border: none;
242
+ border-radius: 8px;
243
+ cursor: pointer;
244
+ transition: background 0.15s, box-shadow 0.2s;
245
+ margin-top: 16px;
246
+ position: relative;
247
+ z-index: 1;
248
+ }
249
+ .jira-btn:hover { background: var(--neon-hover); box-shadow: 0 0 12px var(--neon-glow), 0 2px 12px rgba(0,255,136,0.2); }
250
+ .jira-btn:disabled { opacity: 0.5; cursor: not-allowed; }
251
+
252
+ /* ── Custom Checkbox ── */
253
+ input[type="checkbox"] {
254
+ appearance: none;
255
+ width: 16px;
256
+ height: 16px;
257
+ border: 1px solid var(--border, rgba(0,255,136,0.2));
258
+ border-radius: 3px;
259
+ background: var(--bg-input, #0A0E14);
260
+ cursor: pointer;
261
+ position: relative;
262
+ transition: border-color 0.15s, background 0.15s;
263
+ }
264
+ input[type="checkbox"]:checked {
265
+ background: var(--neon, #00ff88);
266
+ border-color: var(--neon, #00ff88);
267
+ }
268
+ input[type="checkbox"]:checked::after {
269
+ content: "✓";
270
+ position: absolute;
271
+ top: -1px;
272
+ left: 2px;
273
+ font-size: 12px;
274
+ font-weight: 700;
275
+ color: var(--bg-void, #0A0A0F);
276
+ }
277
+ input[type="checkbox"]:focus-visible {
278
+ outline: 2px solid var(--neon-soft, rgba(0,255,136,0.2));
279
+ outline-offset: 2px;
280
+ }
281
+ .jira-result {
282
+ margin-top: 12px;
283
+ padding: 12px 16px;
284
+ background: var(--bg-card);
285
+ border: 1px solid var(--border);
286
+ border-radius: 8px;
287
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
288
+ position: relative;
289
+ z-index: 1;
290
+ }
291
+ .jira-result-key {
292
+ font-family: var(--mono);
293
+ font-size: 14px;
294
+ font-weight: 600;
295
+ color: var(--neon);
296
+ text-decoration: none;
297
+ border-bottom: 1px dashed rgba(0,255,136,0.3);
298
+ transition: border-color 0.2s;
299
+ }
300
+ .jira-result-key:hover { border-bottom-color: var(--neon); }
301
+ .jira-result-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
302
+ .jira-result-badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 4px; margin-left: 8px; font-weight: 500; }
303
+ .jira-result-badge.created { background: var(--neon-soft); color: var(--neon); }
304
+ .jira-result-badge.exists { background: var(--cyan-soft); color: var(--cyan); }
305
+ .jira-error { margin-top: 12px; color: var(--error); font-size: 13px; animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
306
+
307
+ /* ── History ── */
308
+ .history-section {
309
+ margin-bottom: 24px;
310
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
311
+ }
312
+ .history-title {
313
+ font-size: 16px;
314
+ font-weight: 600;
315
+ margin-bottom: 12px;
316
+ color: var(--text-1);
317
+ }
318
+ .history-list {
319
+ display: flex;
320
+ flex-direction: column;
321
+ gap: 8px;
322
+ }
323
+ .history-item {
324
+ display: flex;
325
+ flex-direction: column;
326
+ padding: 12px 16px;
327
+ background: var(--bg-card);
328
+ border: 1px solid var(--border);
329
+ border-radius: 8px;
330
+ transition: border-color 0.15s, box-shadow 0.15s;
331
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
332
+ }
333
+ .history-item-row {
334
+ display: flex;
335
+ align-items: center;
336
+ justify-content: space-between;
337
+ }
338
+ .history-item:hover {
339
+ border-color: var(--border-active);
340
+ box-shadow: 0 2px 8px rgba(0,0,0,0.3);
341
+ }
342
+ .history-info {
343
+ display: flex;
344
+ align-items: center;
345
+ gap: 12px;
346
+ flex: 1;
347
+ }
348
+ .history-project { font-weight: 500; color: var(--text-1); font-size: 14px; }
349
+ .history-detail { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
350
+ .history-actions { display: flex; align-items: center; gap: 8px; }
351
+ .history-quick-btn {
352
+ padding: 6px 14px;
353
+ font-size: 12px;
354
+ font-family: var(--sans);
355
+ font-weight: 500;
356
+ color: var(--bg-void);
357
+ background: var(--neon);
358
+ border: none;
359
+ border-radius: 6px;
360
+ cursor: pointer;
361
+ transition: background 0.15s;
362
+ }
363
+ .history-quick-btn:hover { background: var(--neon-hover); }
364
+ .history-quick-btn:disabled { opacity: 0.5; cursor: not-allowed; }
365
+ .history-quick-btn.executing {
366
+ background: var(--border);
367
+ color: var(--text-3);
368
+ }
369
+ .history-footer {
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: space-between;
373
+ margin-top: 16px;
374
+ padding-top: 16px;
375
+ border-top: 1px solid var(--border);
376
+ }
377
+ .history-new-btn {
378
+ padding: 8px 16px;
379
+ font-size: 13px;
380
+ font-family: var(--sans);
381
+ font-weight: 500;
382
+ color: var(--bg-void);
383
+ background: var(--neon);
384
+ border: none;
385
+ border-radius: 8px;
386
+ cursor: pointer;
387
+ transition: background 0.15s, box-shadow 0.2s;
388
+ }
389
+ .history-new-btn:hover { background: var(--neon-hover); box-shadow: 0 0 12px var(--neon-glow); }
390
+ .history-clear-btn {
391
+ padding: 8px 16px;
392
+ font-size: 13px;
393
+ font-family: var(--sans);
394
+ font-weight: 400;
395
+ color: var(--text-3);
396
+ background: transparent;
397
+ border: 1px solid var(--border);
398
+ border-radius: 8px;
399
+ cursor: pointer;
400
+ transition: border-color 0.15s, color 0.15s;
401
+ }
402
+ .history-clear-btn:hover { border-color: var(--error); color: var(--error); }
403
+ .history-result {
404
+ margin-top: 12px;
405
+ padding: 10px 14px;
406
+ background: var(--bg-void);
407
+ border: 1px solid rgba(0,255,136,0.08);
408
+ border-radius: 8px;
409
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
410
+ }
411
+ .history-result-key {
412
+ font-family: var(--mono);
413
+ font-size: 14px;
414
+ font-weight: 600;
415
+ color: var(--neon);
416
+ text-decoration: none;
417
+ }
418
+ .history-result-error {
419
+ color: var(--error);
420
+ font-size: 13px;
421
+ }
422
+
423
+ /* ── Modal ── */
424
+ .modal-overlay {
425
+ position: fixed;
426
+ top: 0; left: 0; right: 0; bottom: 0;
427
+ background: rgba(0,0,0,0.7);
428
+ display: flex;
429
+ align-items: center;
430
+ justify-content: center;
431
+ z-index: 2000;
432
+ animation: fade-in 0.2s ease both;
433
+ }
434
+ .modal-content {
435
+ width: 90%;
436
+ max-width: 560px;
437
+ background: var(--bg-void);
438
+ border: 1px solid var(--border);
439
+ border-radius: 12px;
440
+ padding: 24px;
441
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
442
+ }
443
+ .modal-header {
444
+ display: flex;
445
+ align-items: center;
446
+ justify-content: space-between;
447
+ margin-bottom: 20px;
448
+ }
449
+ .modal-title { font-size: 18px; font-weight: 600; color: var(--text-1); }
450
+ .modal-close {
451
+ width: 32px; height: 32px;
452
+ display: flex;
453
+ align-items: center;
454
+ justify-content: center;
455
+ font-size: 16px;
456
+ color: var(--text-3);
457
+ background: transparent;
458
+ border: 1px solid var(--border);
459
+ border-radius: 6px;
460
+ cursor: pointer;
461
+ transition: border-color 0.15s, color 0.15s;
462
+ }
463
+ .modal-close:hover { border-color: var(--text-2); color: var(--text-2); }
464
+ `;
465
+ const initial = {
466
+ jiraHost: "",
467
+ projects: [],
468
+ projectsLoading: true,
469
+ projectsError: "",
470
+ projectOpen: false,
471
+ projectSearch: "",
472
+ projectIndex: -1,
473
+ selected: null,
474
+ branches: [],
475
+ branchesLoading: false,
476
+ branchOpen: false,
477
+ branchSearch: "",
478
+ branchIndex: -1,
479
+ selectedBranch: "",
480
+ pomInfo: null,
481
+ pomLoading: false,
482
+ pomError: "",
483
+ jiraProjects: [],
484
+ jiraProjectsLoading: false,
485
+ jiraProjectOpen: false,
486
+ jiraProjectSearch: "",
487
+ jiraProjectIndex: -1,
488
+ selectedJiraProject: null,
489
+ jiraStatus: "idle",
490
+ jiraResult: null,
491
+ jiraError: "",
492
+ mrStatus: "idle",
493
+ mrUrl: "",
494
+ mrError: "",
495
+ mrBranches: [],
496
+ mrSourceBranch: "",
497
+ mrTargetBranch: "",
498
+ mrBranchOpen: false,
499
+ mrBranchSearch: "",
500
+ mrBranchIndex: -1,
501
+ history: [],
502
+ historyLoading: true,
503
+ quickExecuting: null,
504
+ quickResults: {},
505
+ quickErrors: {},
506
+ showNewModal: false,
507
+ clearConfirm: false,
508
+ createMrChecked: {}
509
+ };
510
+ const reducer = (state, action) => {
511
+ switch (action.type) {
512
+ case "SET_JIRA_HOST": return {
513
+ ...state,
514
+ jiraHost: action.host
515
+ };
516
+ case "PROJECTS_LOADED": return {
517
+ ...state,
518
+ projects: action.projects,
519
+ projectsLoading: false
520
+ };
521
+ case "PROJECTS_ERROR": return {
522
+ ...state,
523
+ projectsError: action.error,
524
+ projectsLoading: false
525
+ };
526
+ case "SET_PROJECT_OPEN": return {
527
+ ...state,
528
+ projectOpen: action.open,
529
+ ...action.open ? {} : {
530
+ projectSearch: "",
531
+ projectIndex: -1
532
+ }
533
+ };
534
+ case "SET_PROJECT_SEARCH": return {
535
+ ...state,
536
+ projectSearch: action.search,
537
+ projectIndex: -1
538
+ };
539
+ case "SET_PROJECT_INDEX": return {
540
+ ...state,
541
+ projectIndex: action.index
542
+ };
543
+ case "SELECT_PROJECT": return {
544
+ ...state,
545
+ selected: action.project,
546
+ projectOpen: false,
547
+ projectSearch: "",
548
+ projectIndex: -1,
549
+ branches: [],
550
+ branchesLoading: false,
551
+ selectedBranch: "",
552
+ branchOpen: false,
553
+ branchSearch: "",
554
+ branchIndex: -1,
555
+ pomInfo: null,
556
+ pomError: "",
557
+ selectedJiraProject: null,
558
+ jiraStatus: "idle",
559
+ jiraResult: null,
560
+ jiraError: "",
561
+ mrStatus: "idle",
562
+ mrUrl: "",
563
+ mrError: "",
564
+ mrBranches: [],
565
+ mrSourceBranch: "",
566
+ mrTargetBranch: "",
567
+ mrBranchOpen: false,
568
+ mrBranchSearch: "",
569
+ mrBranchIndex: -1
570
+ };
571
+ case "CLEAR_PROJECT": return {
572
+ ...state,
573
+ selected: null,
574
+ branches: [],
575
+ selectedBranch: "",
576
+ branchOpen: false,
577
+ branchSearch: "",
578
+ branchIndex: -1,
579
+ pomInfo: null,
580
+ pomError: "",
581
+ pomLoading: false,
582
+ selectedJiraProject: null,
583
+ jiraStatus: "idle",
584
+ jiraResult: null,
585
+ jiraError: "",
586
+ mrStatus: "idle",
587
+ mrUrl: "",
588
+ mrError: "",
589
+ mrBranches: [],
590
+ mrSourceBranch: "",
591
+ mrTargetBranch: "",
592
+ mrBranchOpen: false,
593
+ mrBranchSearch: "",
594
+ mrBranchIndex: -1
595
+ };
596
+ case "BRANCHES_LOADING": return {
597
+ ...state,
598
+ branchesLoading: true,
599
+ branches: [],
600
+ selectedBranch: ""
601
+ };
602
+ case "BRANCHES_LOADED": return {
603
+ ...state,
604
+ branches: action.branches,
605
+ branchesLoading: false
606
+ };
607
+ case "SET_BRANCH_OPEN": return {
608
+ ...state,
609
+ branchOpen: action.open,
610
+ ...action.open ? {} : {
611
+ branchSearch: "",
612
+ branchIndex: -1
613
+ }
614
+ };
615
+ case "SET_BRANCH_SEARCH": return {
616
+ ...state,
617
+ branchSearch: action.search,
618
+ branchIndex: -1
619
+ };
620
+ case "SET_BRANCH_INDEX": return {
621
+ ...state,
622
+ branchIndex: action.index
623
+ };
624
+ case "SELECT_BRANCH": return {
625
+ ...state,
626
+ selectedBranch: action.branch,
627
+ branchOpen: false,
628
+ branchSearch: "",
629
+ branchIndex: -1
630
+ };
631
+ case "POM_LOADING": return {
632
+ ...state,
633
+ pomLoading: true,
634
+ pomError: "",
635
+ pomInfo: null
636
+ };
637
+ case "POM_LOADED": return {
638
+ ...state,
639
+ pomLoading: false,
640
+ pomInfo: action.info
641
+ };
642
+ case "POM_ERROR": return {
643
+ ...state,
644
+ pomLoading: false,
645
+ pomError: action.error
646
+ };
647
+ case "JIRA_PROJECTS_LOADING": return {
648
+ ...state,
649
+ jiraProjectsLoading: true
650
+ };
651
+ case "JIRA_PROJECTS_LOADED": return {
652
+ ...state,
653
+ jiraProjects: action.projects,
654
+ jiraProjectsLoading: false
655
+ };
656
+ case "JIRA_PROJECTS_ERROR": return {
657
+ ...state,
658
+ jiraProjectsLoading: false
659
+ };
660
+ case "SET_JIRA_PROJECT_OPEN": return {
661
+ ...state,
662
+ jiraProjectOpen: action.open,
663
+ ...action.open ? {} : {
664
+ jiraProjectSearch: "",
665
+ jiraProjectIndex: -1
666
+ }
667
+ };
668
+ case "SET_JIRA_PROJECT_SEARCH": return {
669
+ ...state,
670
+ jiraProjectSearch: action.search,
671
+ jiraProjectIndex: -1
672
+ };
673
+ case "SET_JIRA_PROJECT_INDEX": return {
674
+ ...state,
675
+ jiraProjectIndex: action.index
676
+ };
677
+ case "SELECT_JIRA_PROJECT": return {
678
+ ...state,
679
+ selectedJiraProject: action.project,
680
+ jiraProjectOpen: false,
681
+ jiraProjectSearch: "",
682
+ jiraProjectIndex: -1,
683
+ jiraStatus: "idle",
684
+ jiraResult: null,
685
+ jiraError: ""
686
+ };
687
+ case "CLEAR_JIRA_PROJECT": return {
688
+ ...state,
689
+ selectedJiraProject: null,
690
+ jiraProjectOpen: false,
691
+ jiraProjectSearch: "",
692
+ jiraProjectIndex: -1,
693
+ jiraStatus: "idle",
694
+ jiraResult: null,
695
+ jiraError: ""
696
+ };
697
+ case "JIRA_CHECKING": return {
698
+ ...state,
699
+ jiraStatus: "checking",
700
+ jiraResult: null,
701
+ jiraError: ""
702
+ };
703
+ case "JIRA_CREATING": return {
704
+ ...state,
705
+ jiraStatus: "creating"
706
+ };
707
+ case "JIRA_DONE": return {
708
+ ...state,
709
+ jiraStatus: "done",
710
+ jiraResult: action.result
711
+ };
712
+ case "JIRA_ERROR": return {
713
+ ...state,
714
+ jiraStatus: "error",
715
+ jiraError: action.error
716
+ };
717
+ case "JIRA_RESET": return {
718
+ ...state,
719
+ jiraStatus: "idle",
720
+ jiraResult: null,
721
+ jiraError: ""
722
+ };
723
+ case "SET_HISTORY": return {
724
+ ...state,
725
+ history: action.history,
726
+ historyLoading: false
727
+ };
728
+ case "QUICK_EXEC_START": return {
729
+ ...state,
730
+ quickExecuting: action.id
731
+ };
732
+ case "QUICK_EXEC_SUCCESS": return {
733
+ ...state,
734
+ quickExecuting: null,
735
+ quickResults: {
736
+ ...state.quickResults,
737
+ [action.id]: action.result
738
+ }
739
+ };
740
+ case "QUICK_EXEC_FAIL": return {
741
+ ...state,
742
+ quickExecuting: null,
743
+ quickErrors: {
744
+ ...state.quickErrors,
745
+ [action.id]: action.error
746
+ }
747
+ };
748
+ case "SHOW_NEW_MODAL": return {
749
+ ...state,
750
+ showNewModal: true
751
+ };
752
+ case "HIDE_NEW_MODAL": return {
753
+ ...state,
754
+ showNewModal: false
755
+ };
756
+ case "CLEAR_CONFIRM_TOGGLE": return {
757
+ ...state,
758
+ clearConfirm: !state.clearConfirm
759
+ };
760
+ case "CLEAR_HISTORY_DONE": return {
761
+ ...state,
762
+ history: [],
763
+ clearConfirm: false,
764
+ quickResults: {},
765
+ quickErrors: {}
766
+ };
767
+ case "TOGGLE_CREATE_MR": return {
768
+ ...state,
769
+ createMrChecked: {
770
+ ...state.createMrChecked,
771
+ [action.id]: !state.createMrChecked[action.id]
772
+ }
773
+ };
774
+ case "MR_SELECTING": return {
775
+ ...state,
776
+ mrStatus: "selecting",
777
+ mrBranches: action.branches,
778
+ mrSourceBranch: "",
779
+ mrTargetBranch: "",
780
+ mrError: ""
781
+ };
782
+ case "MR_SOURCE_SELECTED": return {
783
+ ...state,
784
+ mrSourceBranch: action.branch,
785
+ mrBranchOpen: false,
786
+ mrBranchSearch: "",
787
+ mrBranchIndex: -1
788
+ };
789
+ case "SET_MR_BRANCH_OPEN": return {
790
+ ...state,
791
+ mrBranchOpen: action.open,
792
+ ...action.open ? {} : {
793
+ mrBranchSearch: "",
794
+ mrBranchIndex: -1
795
+ }
796
+ };
797
+ case "SET_MR_BRANCH_SEARCH": return {
798
+ ...state,
799
+ mrBranchSearch: action.search,
800
+ mrBranchIndex: -1
801
+ };
802
+ case "SET_MR_BRANCH_INDEX": return {
803
+ ...state,
804
+ mrBranchIndex: action.index
805
+ };
806
+ case "MR_LOADING": return {
807
+ ...state,
808
+ mrStatus: "loading",
809
+ mrBranches: [],
810
+ mrSourceBranch: "",
811
+ mrTargetBranch: "",
812
+ mrError: ""
813
+ };
814
+ case "MR_CREATING": return {
815
+ ...state,
816
+ mrStatus: "creating",
817
+ mrUrl: "",
818
+ mrTargetBranch: "",
819
+ mrError: ""
820
+ };
821
+ case "MR_DONE": return {
822
+ ...state,
823
+ mrStatus: "done",
824
+ mrUrl: action.mrUrl,
825
+ mrSourceBranch: action.mrSourceBranch,
826
+ mrTargetBranch: action.mrTargetBranch
827
+ };
828
+ case "MR_ERROR": return {
829
+ ...state,
830
+ mrStatus: "error",
831
+ mrError: action.error
832
+ };
833
+ }
834
+ };
835
+ const cleanVersion = (v) => (v ?? "").split("-")[0];
836
+ const selKeyDown = (e, open, len, idx, onSelect, onClose) => {
837
+ if (!open || len === 0) return void 0;
838
+ switch (e.key) {
839
+ case "ArrowDown":
840
+ e.preventDefault();
841
+ return Math.min(idx + 1, len - 1);
842
+ case "ArrowUp":
843
+ e.preventDefault();
844
+ return Math.max(idx - 1, -1);
845
+ case "Enter":
846
+ e.preventDefault();
847
+ if (idx >= 0) onSelect(idx);
848
+ return;
849
+ case "Escape":
850
+ onClose();
851
+ return;
852
+ }
853
+ };
854
+ const pipelineStepClass = (done, active) => done ? "pipeline-step done" : active ? "pipeline-step active" : "pipeline-step";
855
+ const pipelineLineClass = (done) => done ? "pipeline-line done" : "pipeline-line";
856
+ const HistoryList = ({ s, d }) => {
857
+ const handleQuickExecute = async (id) => {
858
+ d({
859
+ type: "QUICK_EXEC_START",
860
+ id
861
+ });
862
+ try {
863
+ const data = await (await fetch(`/release/api/history/${id}/execute`, {
864
+ method: "POST",
865
+ headers: { "Content-Type": "application/json" },
866
+ body: JSON.stringify({ createMr: s.createMrChecked[id] ?? false })
867
+ })).json();
868
+ if (data.error) d({
869
+ type: "QUICK_EXEC_FAIL",
870
+ id,
871
+ error: data.error
872
+ });
873
+ else {
874
+ d({
875
+ type: "QUICK_EXEC_SUCCESS",
876
+ id,
877
+ result: data
878
+ });
879
+ d({
880
+ type: "SET_HISTORY",
881
+ history: await (await fetch("/release/api/history")).json()
882
+ });
883
+ }
884
+ } catch (e) {
885
+ d({
886
+ type: "QUICK_EXEC_FAIL",
887
+ id,
888
+ error: e instanceof Error ? e.message : String(e)
889
+ });
890
+ }
891
+ };
892
+ const handleClearHistory = async () => {
893
+ await fetch("/release/api/history", { method: "DELETE" });
894
+ d({ type: "CLEAR_HISTORY_DONE" });
895
+ };
896
+ return /* @__PURE__ */ jsxDEV("div", {
897
+ class: "history-section",
898
+ children: [
899
+ /* @__PURE__ */ jsxDEV("div", {
900
+ class: "history-title",
901
+ children: t("web.historyTitle")
902
+ }),
903
+ s.history.length > 0 ? /* @__PURE__ */ jsxDEV("div", {
904
+ class: "history-list",
905
+ children: s.history.map((entry) => /* @__PURE__ */ jsxDEV("div", {
906
+ class: "history-item",
907
+ children: [
908
+ /* @__PURE__ */ jsxDEV("div", {
909
+ class: "history-item-row",
910
+ children: [/* @__PURE__ */ jsxDEV("div", {
911
+ class: "history-info",
912
+ children: [
913
+ /* @__PURE__ */ jsxDEV("span", {
914
+ class: "history-project",
915
+ children: entry.projectName
916
+ }),
917
+ /* @__PURE__ */ jsxDEV("span", {
918
+ class: "history-detail",
919
+ children: [
920
+ entry.branch,
921
+ " / ",
922
+ entry.jiraProjectKey
923
+ ]
924
+ }),
925
+ entry.mrUrl && /* @__PURE__ */ jsxDEV("a", {
926
+ href: entry.mrUrl,
927
+ target: "_blank",
928
+ rel: "noreferrer",
929
+ style: "font-size:12px;color:var(--cyan);text-decoration:none;margin-left:6px",
930
+ children: t("release.mrFromTo", {
931
+ source: entry.mrSourceBranch ?? "",
932
+ target: entry.mrTargetBranch ?? entry.branch
933
+ })
934
+ })
935
+ ]
936
+ }), /* @__PURE__ */ jsxDEV("div", {
937
+ class: "history-actions",
938
+ children: [entry.mrUrl && /* @__PURE__ */ jsxDEV("label", {
939
+ style: "display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-3);cursor:pointer",
940
+ children: [/* @__PURE__ */ jsxDEV("input", {
941
+ type: "checkbox",
942
+ checked: s.createMrChecked[entry.id] ?? false,
943
+ onChange: () => d({
944
+ type: "TOGGLE_CREATE_MR",
945
+ id: entry.id
946
+ })
947
+ }), t("web.createMrCheckbox")]
948
+ }), /* @__PURE__ */ jsxDEV("button", {
949
+ class: `history-quick-btn${s.quickExecuting === entry.id ? " executing" : ""}`,
950
+ type: "button",
951
+ disabled: s.quickExecuting !== null,
952
+ onClick: () => handleQuickExecute(entry.id),
953
+ children: s.quickExecuting === entry.id ? t("web.executing") : t("web.quickExecute")
954
+ })]
955
+ })]
956
+ }),
957
+ s.quickResults[entry.id] && /* @__PURE__ */ jsxDEV("div", {
958
+ class: "history-result",
959
+ children: [
960
+ /* @__PURE__ */ jsxDEV("a", {
961
+ class: "history-result-key",
962
+ href: s.quickResults[entry.id].issueUrl,
963
+ target: "_blank",
964
+ rel: "noreferrer",
965
+ children: s.quickResults[entry.id].issueKey
966
+ }),
967
+ /* @__PURE__ */ jsxDEV("span", {
968
+ class: `jira-result-badge ${s.quickResults[entry.id].issueCreated ? "created" : "exists"}`,
969
+ children: s.quickResults[entry.id].issueCreated ? t("web.createdBadge") : t("web.existsBadge")
970
+ }),
971
+ /* @__PURE__ */ jsxDEV("span", {
972
+ style: "font-size:12px;color:var(--text-3);margin-left:8px",
973
+ children: ["v", s.quickResults[entry.id].version]
974
+ }),
975
+ s.quickResults[entry.id].versionCreated && /* @__PURE__ */ jsxDEV("span", {
976
+ style: "font-size:10px;color:var(--neon);margin-left:4px",
977
+ children: t("web.createdBadge")
978
+ }),
979
+ s.quickResults[entry.id].mrUrl && /* @__PURE__ */ jsxDEV("span", {
980
+ style: "font-size:12px;margin-left:12px",
981
+ children: /* @__PURE__ */ jsxDEV("a", {
982
+ href: s.quickResults[entry.id].mrUrl,
983
+ target: "_blank",
984
+ rel: "noreferrer",
985
+ style: "color:var(--cyan);text-decoration:none;border-bottom:1px dashed var(--cyan)",
986
+ children: t("release.mrFromTo", {
987
+ source: s.quickResults[entry.id].mrSourceBranch ?? "",
988
+ target: s.quickResults[entry.id].mrTargetBranch ?? entry.branch
989
+ })
990
+ })
991
+ })
992
+ ]
993
+ }),
994
+ s.quickErrors[entry.id] && /* @__PURE__ */ jsxDEV("div", {
995
+ class: "history-result-error",
996
+ children: s.quickErrors[entry.id]
997
+ })
998
+ ]
999
+ }))
1000
+ }) : /* @__PURE__ */ jsxDEV("div", {
1001
+ class: "empty-hint",
1002
+ children: t("web.noHistory")
1003
+ }),
1004
+ /* @__PURE__ */ jsxDEV("div", {
1005
+ class: "history-footer",
1006
+ children: [/* @__PURE__ */ jsxDEV("button", {
1007
+ class: "history-new-btn",
1008
+ type: "button",
1009
+ onClick: () => d({ type: "SHOW_NEW_MODAL" }),
1010
+ children: t("web.createNew")
1011
+ }), s.history.length > 0 && (s.clearConfirm ? /* @__PURE__ */ jsxDEV("div", {
1012
+ style: "display:flex;align-items:center;gap:8px",
1013
+ children: [
1014
+ /* @__PURE__ */ jsxDEV("span", {
1015
+ style: "font-size:12px;color:var(--text-3)",
1016
+ children: t("web.clearConfirm")
1017
+ }),
1018
+ /* @__PURE__ */ jsxDEV("button", {
1019
+ class: "history-clear-btn",
1020
+ type: "button",
1021
+ style: "border-color:var(--error);color:var(--error)",
1022
+ onClick: handleClearHistory,
1023
+ children: t("web.clearHistory")
1024
+ }),
1025
+ /* @__PURE__ */ jsxDEV("button", {
1026
+ class: "history-clear-btn",
1027
+ type: "button",
1028
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1029
+ children: t("web.cancel")
1030
+ })
1031
+ ]
1032
+ }) : /* @__PURE__ */ jsxDEV("button", {
1033
+ class: "history-clear-btn",
1034
+ type: "button",
1035
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1036
+ children: t("web.clearHistory")
1037
+ }))]
1038
+ })
1039
+ ]
1040
+ });
1041
+ };
1042
+ const ReleaseFlow = ({ s, d }) => {
1043
+ const projectSearchRef = useRef(null);
1044
+ const branchSearchRef = useRef(null);
1045
+ const jiraSearchRef = useRef(null);
1046
+ const mrBranchSearchRef = useRef(null);
1047
+ useEffect(() => {
1048
+ fetch("/release/api/config").then((r) => r.json()).then((data) => {
1049
+ if (data.jiraHost) d({
1050
+ type: "SET_JIRA_HOST",
1051
+ host: data.jiraHost
1052
+ });
1053
+ }).catch(() => {});
1054
+ }, []);
1055
+ useEffect(() => {
1056
+ fetch("/release/api/projects").then((r) => r.json()).then((data) => {
1057
+ if (data.error) d({
1058
+ type: "PROJECTS_ERROR",
1059
+ error: data.error
1060
+ });
1061
+ else d({
1062
+ type: "PROJECTS_LOADED",
1063
+ projects: data
1064
+ });
1065
+ }).catch((e) => d({
1066
+ type: "PROJECTS_ERROR",
1067
+ error: e.message
1068
+ }));
1069
+ }, []);
1070
+ useEffect(() => {
1071
+ if (!s.projectOpen && !s.branchOpen && !s.jiraProjectOpen && !s.mrBranchOpen) return;
1072
+ const handler = (e) => {
1073
+ const target = e.target;
1074
+ if (!target.closest(".sel") && !target.closest(".mr-branch-sel")) {
1075
+ d({
1076
+ type: "SET_PROJECT_OPEN",
1077
+ open: false
1078
+ });
1079
+ d({
1080
+ type: "SET_BRANCH_OPEN",
1081
+ open: false
1082
+ });
1083
+ d({
1084
+ type: "SET_MR_BRANCH_OPEN",
1085
+ open: false
1086
+ });
1087
+ d({
1088
+ type: "SET_JIRA_PROJECT_OPEN",
1089
+ open: false
1090
+ });
1091
+ }
1092
+ };
1093
+ document.addEventListener("click", handler);
1094
+ return () => document.removeEventListener("click", handler);
1095
+ }, [
1096
+ s.projectOpen,
1097
+ s.branchOpen,
1098
+ s.jiraProjectOpen
1099
+ ]);
1100
+ useEffect(() => {
1101
+ if (s.projectOpen) setTimeout(() => projectSearchRef.current?.focus(), 50);
1102
+ if (s.branchOpen) setTimeout(() => branchSearchRef.current?.focus(), 50);
1103
+ if (s.jiraProjectOpen) setTimeout(() => jiraSearchRef.current?.focus(), 50);
1104
+ if (s.mrBranchOpen) setTimeout(() => mrBranchSearchRef.current?.focus(), 50);
1105
+ }, [
1106
+ s.projectOpen,
1107
+ s.branchOpen,
1108
+ s.jiraProjectOpen,
1109
+ s.mrBranchOpen
1110
+ ]);
1111
+ useEffect(() => {
1112
+ if (s.mrStatus !== "creating" || !s.mrSourceBranch || !s.selected) return;
1113
+ const jiraUrl2 = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1114
+ fetch("/release/api/create-mr", {
1115
+ method: "POST",
1116
+ headers: { "Content-Type": "application/json" },
1117
+ body: JSON.stringify({
1118
+ projectId: s.selected.id,
1119
+ targetBranch: s.selectedBranch,
1120
+ sourceBranch: s.mrSourceBranch,
1121
+ jiraUrl: jiraUrl2
1122
+ })
1123
+ }).then((r) => r.json()).then((data) => {
1124
+ if (data.mrUrl) d({
1125
+ type: "MR_DONE",
1126
+ mrUrl: data.mrUrl,
1127
+ mrSourceBranch: data.sourceBranch,
1128
+ mrTargetBranch: data.targetBranch
1129
+ });
1130
+ else d({
1131
+ type: "MR_ERROR",
1132
+ error: data.error ?? "Failed"
1133
+ });
1134
+ }).catch((e) => d({
1135
+ type: "MR_ERROR",
1136
+ error: e instanceof Error ? e.message : "Failed"
1137
+ }));
1138
+ }, [s.mrStatus, s.mrSourceBranch]);
1139
+ useEffect(() => {
1140
+ if (!s.pomInfo?.version || s.jiraProjects.length > 0 || s.jiraProjectsLoading) return;
1141
+ d({ type: "JIRA_PROJECTS_LOADING" });
1142
+ fetch("/release/api/jira/projects").then((r) => r.json()).then((data) => {
1143
+ if (Array.isArray(data)) d({
1144
+ type: "JIRA_PROJECTS_LOADED",
1145
+ projects: data
1146
+ });
1147
+ else d({
1148
+ type: "JIRA_PROJECTS_ERROR",
1149
+ error: data.error ?? "Failed"
1150
+ });
1151
+ }).catch(() => d({
1152
+ type: "JIRA_PROJECTS_ERROR",
1153
+ error: "Failed"
1154
+ }));
1155
+ }, [s.pomInfo?.version]);
1156
+ const fetchPom = (projectId, ref) => {
1157
+ d({ type: "POM_LOADING" });
1158
+ fetch(`/release/api/projects/${projectId}/pom-version?ref=${encodeURIComponent(ref)}`).then((r) => r.json()).then((data) => {
1159
+ if (data.error) d({
1160
+ type: "POM_ERROR",
1161
+ error: data.error
1162
+ });
1163
+ else d({
1164
+ type: "POM_LOADED",
1165
+ info: data
1166
+ });
1167
+ }).catch(() => d({
1168
+ type: "POM_ERROR",
1169
+ error: "Failed to fetch version"
1170
+ }));
1171
+ };
1172
+ const handleSelectProject = (project) => {
1173
+ d({
1174
+ type: "SELECT_PROJECT",
1175
+ project
1176
+ });
1177
+ d({ type: "BRANCHES_LOADING" });
1178
+ fetch(`/release/api/projects/${project.id}/branches`).then((r) => r.json()).then((data) => {
1179
+ d({
1180
+ type: "BRANCHES_LOADED",
1181
+ branches: "error" in data ? [] : data
1182
+ });
1183
+ }).catch(() => d({
1184
+ type: "BRANCHES_LOADED",
1185
+ branches: []
1186
+ }));
1187
+ };
1188
+ const handleSelectBranch = (name) => {
1189
+ d({
1190
+ type: "SELECT_BRANCH",
1191
+ branch: name
1192
+ });
1193
+ if (s.selected) fetchPom(s.selected.id, name);
1194
+ };
1195
+ const handleCreateIssue = async () => {
1196
+ if (!s.selected || !s.pomInfo?.version || !s.selectedJiraProject) return;
1197
+ const artifactId = s.pomInfo.artifactId ?? s.selected.name;
1198
+ const projectVersion = cleanVersion(s.pomInfo.version);
1199
+ const versionName = `${artifactId}-${projectVersion}`;
1200
+ const summary = `${artifactId}-${projectVersion} ${t("web.releaseSuffix") ?? t("release.releaseSuffix")}`;
1201
+ d({ type: "JIRA_CHECKING" });
1202
+ try {
1203
+ const searchData = await (await fetch("/release/api/jira/search", {
1204
+ method: "POST",
1205
+ headers: { "Content-Type": "application/json" },
1206
+ body: JSON.stringify({
1207
+ jql: `summary ~ "${summary}" AND project = ${s.selectedJiraProject.key}`,
1208
+ maxResults: 1
1209
+ })
1210
+ })).json();
1211
+ if (searchData.error) {
1212
+ d({
1213
+ type: "JIRA_ERROR",
1214
+ error: searchData.error
1215
+ });
1216
+ return;
1217
+ }
1218
+ if (searchData.total > 0 && searchData.issues?.[0]) {
1219
+ d({
1220
+ type: "JIRA_DONE",
1221
+ result: {
1222
+ key: searchData.issues[0].key,
1223
+ exists: true,
1224
+ versionName
1225
+ }
1226
+ });
1227
+ await fetch("/release/api/history", {
1228
+ method: "POST",
1229
+ headers: { "Content-Type": "application/json" },
1230
+ body: JSON.stringify({
1231
+ id: Date.now().toString(36),
1232
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1233
+ projectId: s.selected.id,
1234
+ projectName: s.selected.name,
1235
+ projectPath: s.selected.pathWithNamespace ?? "",
1236
+ branch: s.selectedBranch,
1237
+ jiraProjectKey: s.selectedJiraProject.key
1238
+ })
1239
+ });
1240
+ return;
1241
+ }
1242
+ d({ type: "JIRA_CREATING" });
1243
+ const verData = await (await fetch("/release/api/jira/ensure-version", {
1244
+ method: "POST",
1245
+ headers: { "Content-Type": "application/json" },
1246
+ body: JSON.stringify({
1247
+ projectKey: s.selectedJiraProject.key,
1248
+ versionName
1249
+ })
1250
+ })).json();
1251
+ if (verData.error) {
1252
+ d({
1253
+ type: "JIRA_ERROR",
1254
+ error: verData.error
1255
+ });
1256
+ return;
1257
+ }
1258
+ const issueData = await (await fetch("/release/api/jira/create-issue", {
1259
+ method: "POST",
1260
+ headers: { "Content-Type": "application/json" },
1261
+ body: JSON.stringify({
1262
+ projectKey: s.selectedJiraProject.key,
1263
+ summary,
1264
+ issuetypeId: "10000",
1265
+ customfield_15800: "无",
1266
+ customfield_13410: [{ id: verData.id }],
1267
+ customfield_13341: [{ name: "licheng.li" }]
1268
+ })
1269
+ })).json();
1270
+ if (issueData.error) {
1271
+ d({
1272
+ type: "JIRA_ERROR",
1273
+ error: issueData.error
1274
+ });
1275
+ return;
1276
+ }
1277
+ d({
1278
+ type: "JIRA_DONE",
1279
+ result: {
1280
+ key: issueData.key,
1281
+ exists: false,
1282
+ versionName: verData.name
1283
+ }
1284
+ });
1285
+ await fetch("/release/api/history", {
1286
+ method: "POST",
1287
+ headers: { "Content-Type": "application/json" },
1288
+ body: JSON.stringify({
1289
+ id: Date.now().toString(36),
1290
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1291
+ projectId: s.selected.id,
1292
+ projectName: s.selected.name,
1293
+ projectPath: s.selected.pathWithNamespace ?? "",
1294
+ branch: s.selectedBranch,
1295
+ jiraProjectKey: s.selectedJiraProject.key
1296
+ })
1297
+ });
1298
+ } catch (e) {
1299
+ d({
1300
+ type: "JIRA_ERROR",
1301
+ error: e instanceof Error ? e.message : String(e)
1302
+ });
1303
+ }
1304
+ };
1305
+ const fp = filterByRelevance(s.projects.map((p) => ({
1306
+ ...p,
1307
+ name: p.name,
1308
+ path: p.pathWithNamespace ?? ""
1309
+ })), s.projectSearch);
1310
+ const fb = filterByRelevance(s.branches.map((b) => ({
1311
+ ...b,
1312
+ name: b.name
1313
+ })), s.branchSearch);
1314
+ const fj = filterByRelevance(s.jiraProjects.map((p) => ({
1315
+ ...p,
1316
+ name: `${p.key} ${p.name ?? ""}`
1317
+ })), s.jiraProjectSearch);
1318
+ const jiraUrl = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1319
+ const step1Done = !!s.selected;
1320
+ const step1Active = !s.projectsLoading && !step1Done;
1321
+ const step2Done = !!s.selectedBranch;
1322
+ const step2Active = !!s.selected && !step2Done;
1323
+ const step3Done = !!s.pomInfo?.version;
1324
+ const step3Active = !!s.selectedBranch && !step3Done;
1325
+ const step4Done = !!s.selectedJiraProject;
1326
+ const step4Active = !!s.pomInfo?.version && !step4Done;
1327
+ const step5Done = !!s.jiraResult;
1328
+ const step5Active = !!s.selectedJiraProject && !step5Done;
1329
+ if (s.projectsLoading) return /* @__PURE__ */ jsxDEV("div", {
1330
+ class: "loading-row",
1331
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingProjects")]
1332
+ });
1333
+ if (s.projectsError) return /* @__PURE__ */ jsxDEV("div", {
1334
+ class: "state-error",
1335
+ children: s.projectsError
1336
+ });
1337
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1338
+ /* @__PURE__ */ jsxDEV("div", {
1339
+ class: "pipeline",
1340
+ children: [
1341
+ /* @__PURE__ */ jsxDEV("div", {
1342
+ class: pipelineStepClass(step1Done, step1Active),
1343
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.projectLabel")]
1344
+ }),
1345
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step1Done) }),
1346
+ /* @__PURE__ */ jsxDEV("div", {
1347
+ class: pipelineStepClass(step2Done, step2Active),
1348
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.branchLabel")]
1349
+ }),
1350
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step2Done) }),
1351
+ /* @__PURE__ */ jsxDEV("div", {
1352
+ class: pipelineStepClass(step3Done, step3Active),
1353
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.versionTag")]
1354
+ }),
1355
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step3Done) }),
1356
+ /* @__PURE__ */ jsxDEV("div", {
1357
+ class: pipelineStepClass(step4Done, step4Active),
1358
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.jiraProjectLabel")]
1359
+ }),
1360
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step4Done) }),
1361
+ /* @__PURE__ */ jsxDEV("div", {
1362
+ class: pipelineStepClass(step5Done, step5Active),
1363
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.createBtn")]
1364
+ })
1365
+ ]
1366
+ }),
1367
+ /* @__PURE__ */ jsxDEV("div", {
1368
+ class: "sel",
1369
+ "data-sel": "project",
1370
+ style: `z-index:${s.projectOpen ? 100 : 1}`,
1371
+ children: [/* @__PURE__ */ jsxDEV("button", {
1372
+ class: `sel-trigger${s.projectOpen ? " open" : ""}`,
1373
+ type: "button",
1374
+ role: "combobox",
1375
+ "aria-expanded": s.projectOpen,
1376
+ "aria-haspopup": "listbox",
1377
+ onClick: () => {
1378
+ d({
1379
+ type: "SET_BRANCH_OPEN",
1380
+ open: false
1381
+ });
1382
+ d({
1383
+ type: "SET_JIRA_PROJECT_OPEN",
1384
+ open: false
1385
+ });
1386
+ d({
1387
+ type: "SET_MR_BRANCH_OPEN",
1388
+ open: false
1389
+ });
1390
+ d({
1391
+ type: "SET_PROJECT_OPEN",
1392
+ open: !s.projectOpen
1393
+ });
1394
+ },
1395
+ children: [
1396
+ /* @__PURE__ */ jsxDEV("span", {
1397
+ class: "sel-trigger-label",
1398
+ children: t("web.projectLabel")
1399
+ }),
1400
+ /* @__PURE__ */ jsxDEV("span", {
1401
+ class: `sel-trigger-value${s.selected ? "" : " empty"}`,
1402
+ children: s.selected ? s.selected.name : t("web.selectProject")
1403
+ }),
1404
+ /* @__PURE__ */ jsxDEV("span", {
1405
+ class: "sel-trigger-arrow",
1406
+ children: "▼"
1407
+ })
1408
+ ]
1409
+ }), s.projectOpen && /* @__PURE__ */ jsxDEV("div", {
1410
+ class: "sel-dropdown",
1411
+ role: "listbox",
1412
+ "aria-label": t("web.selectProject"),
1413
+ children: [/* @__PURE__ */ jsxDEV("div", {
1414
+ class: "sel-search",
1415
+ children: /* @__PURE__ */ jsxDEV("input", {
1416
+ ref: projectSearchRef,
1417
+ class: "sel-search-input",
1418
+ type: "text",
1419
+ placeholder: t("web.searchProjects"),
1420
+ value: s.projectSearch,
1421
+ onChange: (e) => d({
1422
+ type: "SET_PROJECT_SEARCH",
1423
+ search: e.target.value
1424
+ }),
1425
+ onKeyDown: (e) => {
1426
+ const n = selKeyDown(e, s.projectOpen, fp.length, s.projectIndex, (i) => {
1427
+ const p = fp[i];
1428
+ if (p) handleSelectProject(p);
1429
+ }, () => d({
1430
+ type: "SET_PROJECT_OPEN",
1431
+ open: false
1432
+ }));
1433
+ if (n !== void 0) d({
1434
+ type: "SET_PROJECT_INDEX",
1435
+ index: n
1436
+ });
1437
+ }
1438
+ })
1439
+ }), fp.length > 0 ? fp.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1440
+ class: `sel-item${s.selected?.id === p.id ? " active" : ""}${i === s.projectIndex ? " highlighted" : ""}`,
1441
+ onMouseEnter: () => d({
1442
+ type: "SET_PROJECT_INDEX",
1443
+ index: i
1444
+ }),
1445
+ onClick: () => handleSelectProject(p),
1446
+ children: [/* @__PURE__ */ jsxDEV("div", {
1447
+ class: "sel-item-name",
1448
+ children: p.name
1449
+ }), /* @__PURE__ */ jsxDEV("div", {
1450
+ class: "sel-item-sub",
1451
+ children: p.pathWithNamespace
1452
+ })]
1453
+ })) : /* @__PURE__ */ jsxDEV("div", {
1454
+ class: "sel-empty",
1455
+ children: t("web.noProjects")
1456
+ })]
1457
+ })]
1458
+ }),
1459
+ s.selected && (s.branchesLoading ? /* @__PURE__ */ jsxDEV("div", {
1460
+ class: "loading-row",
1461
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingBranches")]
1462
+ }) : s.branches.length > 0 && /* @__PURE__ */ jsxDEV("div", {
1463
+ class: "sel",
1464
+ "data-sel": "branch",
1465
+ style: `z-index:${s.branchOpen ? 100 : 1}`,
1466
+ children: [/* @__PURE__ */ jsxDEV("button", {
1467
+ class: `sel-trigger${s.branchOpen ? " open" : ""}`,
1468
+ type: "button",
1469
+ role: "combobox",
1470
+ "aria-expanded": s.branchOpen,
1471
+ "aria-haspopup": "listbox",
1472
+ onClick: () => {
1473
+ d({
1474
+ type: "SET_PROJECT_OPEN",
1475
+ open: false
1476
+ });
1477
+ d({
1478
+ type: "SET_JIRA_PROJECT_OPEN",
1479
+ open: false
1480
+ });
1481
+ d({
1482
+ type: "SET_MR_BRANCH_OPEN",
1483
+ open: false
1484
+ });
1485
+ d({
1486
+ type: "SET_BRANCH_OPEN",
1487
+ open: !s.branchOpen
1488
+ });
1489
+ },
1490
+ children: [
1491
+ /* @__PURE__ */ jsxDEV("span", {
1492
+ class: "sel-trigger-label",
1493
+ children: t("web.branchLabel")
1494
+ }),
1495
+ /* @__PURE__ */ jsxDEV("span", {
1496
+ class: `sel-trigger-value${s.selectedBranch ? "" : " empty"}`,
1497
+ children: s.selectedBranch || t("web.selectBranch")
1498
+ }),
1499
+ /* @__PURE__ */ jsxDEV("span", {
1500
+ class: "sel-trigger-arrow",
1501
+ children: "▼"
1502
+ })
1503
+ ]
1504
+ }), s.branchOpen && /* @__PURE__ */ jsxDEV("div", {
1505
+ class: "sel-dropdown",
1506
+ role: "listbox",
1507
+ "aria-label": t("web.selectBranch"),
1508
+ children: [/* @__PURE__ */ jsxDEV("div", {
1509
+ class: "sel-search",
1510
+ children: /* @__PURE__ */ jsxDEV("input", {
1511
+ ref: branchSearchRef,
1512
+ class: "sel-search-input",
1513
+ type: "text",
1514
+ placeholder: t("web.filterBranches"),
1515
+ value: s.branchSearch,
1516
+ onChange: (e) => d({
1517
+ type: "SET_BRANCH_SEARCH",
1518
+ search: e.target.value
1519
+ }),
1520
+ onKeyDown: (e) => {
1521
+ const n = selKeyDown(e, s.branchOpen, fb.length, s.branchIndex, (i) => {
1522
+ const b = fb[i];
1523
+ if (b) handleSelectBranch(b.name);
1524
+ }, () => d({
1525
+ type: "SET_BRANCH_OPEN",
1526
+ open: false
1527
+ }));
1528
+ if (n !== void 0) d({
1529
+ type: "SET_BRANCH_INDEX",
1530
+ index: n
1531
+ });
1532
+ }
1533
+ })
1534
+ }), fb.length > 0 ? fb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1535
+ class: `sel-item${b.name === s.selectedBranch ? " active" : ""}${i === s.branchIndex ? " highlighted" : ""}`,
1536
+ onMouseEnter: () => d({
1537
+ type: "SET_BRANCH_INDEX",
1538
+ index: i
1539
+ }),
1540
+ onClick: () => handleSelectBranch(b.name),
1541
+ children: [/* @__PURE__ */ jsxDEV("span", {
1542
+ class: "sel-item-name",
1543
+ children: b.name
1544
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1545
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1546
+ children: t("web.defaultBranch")
1547
+ })]
1548
+ })) : /* @__PURE__ */ jsxDEV("div", {
1549
+ class: "sel-empty",
1550
+ children: t("web.noBranches")
1551
+ })]
1552
+ })]
1553
+ })),
1554
+ s.selected && s.selectedBranch && !s.branchesLoading && (s.pomLoading ? /* @__PURE__ */ jsxDEV("div", {
1555
+ class: "loading-row",
1556
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingVersion")]
1557
+ }) : s.pomError ? /* @__PURE__ */ jsxDEV("div", {
1558
+ class: "version-error",
1559
+ role: "alert",
1560
+ children: s.pomError.includes("404") ? t("web.noPom") : s.pomError
1561
+ }) : s.pomInfo && /* @__PURE__ */ jsxDEV("div", {
1562
+ class: "version-display",
1563
+ children: [/* @__PURE__ */ jsxDEV("span", {
1564
+ class: "version-tag",
1565
+ children: t("web.versionTag")
1566
+ }), /* @__PURE__ */ jsxDEV("span", {
1567
+ class: "version-number",
1568
+ children: cleanVersion(s.pomInfo.version)
1569
+ })]
1570
+ })),
1571
+ s.selected && s.pomInfo?.version && !s.pomLoading && /* @__PURE__ */ jsxDEV("div", {
1572
+ class: "jira-section",
1573
+ children: [
1574
+ s.jiraProjectsLoading ? /* @__PURE__ */ jsxDEV("div", {
1575
+ class: "loading-row",
1576
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingJiraProjects")]
1577
+ }) : /* @__PURE__ */ jsxDEV("div", {
1578
+ class: "sel",
1579
+ "data-sel": "jira",
1580
+ style: `z-index:${s.jiraProjectOpen ? 100 : 1}`,
1581
+ children: [/* @__PURE__ */ jsxDEV("button", {
1582
+ class: `sel-trigger${s.jiraProjectOpen ? " open" : ""}`,
1583
+ type: "button",
1584
+ role: "combobox",
1585
+ "aria-expanded": s.jiraProjectOpen,
1586
+ "aria-haspopup": "listbox",
1587
+ onClick: () => {
1588
+ d({
1589
+ type: "SET_PROJECT_OPEN",
1590
+ open: false
1591
+ });
1592
+ d({
1593
+ type: "SET_BRANCH_OPEN",
1594
+ open: false
1595
+ });
1596
+ d({
1597
+ type: "SET_JIRA_PROJECT_OPEN",
1598
+ open: !s.jiraProjectOpen
1599
+ });
1600
+ },
1601
+ children: [
1602
+ /* @__PURE__ */ jsxDEV("span", {
1603
+ class: "sel-trigger-label",
1604
+ children: t("web.jiraProjectLabel")
1605
+ }),
1606
+ /* @__PURE__ */ jsxDEV("span", {
1607
+ class: `sel-trigger-value${s.selectedJiraProject ? "" : " empty"}`,
1608
+ children: s.selectedJiraProject ? `${s.selectedJiraProject.key} - ${s.selectedJiraProject.name ?? ""}` : t("web.selectJiraProject")
1609
+ }),
1610
+ /* @__PURE__ */ jsxDEV("span", {
1611
+ class: "sel-trigger-arrow",
1612
+ children: "▼"
1613
+ })
1614
+ ]
1615
+ }), s.jiraProjectOpen && /* @__PURE__ */ jsxDEV("div", {
1616
+ class: "sel-dropdown",
1617
+ role: "listbox",
1618
+ "aria-label": t("web.selectJiraProject"),
1619
+ children: [/* @__PURE__ */ jsxDEV("div", {
1620
+ class: "sel-search",
1621
+ children: /* @__PURE__ */ jsxDEV("input", {
1622
+ ref: jiraSearchRef,
1623
+ class: "sel-search-input",
1624
+ type: "text",
1625
+ placeholder: t("web.searchJiraProject"),
1626
+ value: s.jiraProjectSearch,
1627
+ onChange: (e) => d({
1628
+ type: "SET_JIRA_PROJECT_SEARCH",
1629
+ search: e.target.value
1630
+ }),
1631
+ onKeyDown: (e) => {
1632
+ const n = selKeyDown(e, s.jiraProjectOpen, fj.length, s.jiraProjectIndex, (i) => {
1633
+ const p = fj[i];
1634
+ if (p) d({
1635
+ type: "SELECT_JIRA_PROJECT",
1636
+ project: p
1637
+ });
1638
+ }, () => d({
1639
+ type: "SET_JIRA_PROJECT_OPEN",
1640
+ open: false
1641
+ }));
1642
+ if (n !== void 0) d({
1643
+ type: "SET_JIRA_PROJECT_INDEX",
1644
+ index: n
1645
+ });
1646
+ }
1647
+ })
1648
+ }), fj.length > 0 ? fj.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1649
+ class: `sel-item${s.selectedJiraProject?.key === p.key ? " active" : ""}${i === s.jiraProjectIndex ? " highlighted" : ""}`,
1650
+ onMouseEnter: () => d({
1651
+ type: "SET_JIRA_PROJECT_INDEX",
1652
+ index: i
1653
+ }),
1654
+ onClick: () => d({
1655
+ type: "SELECT_JIRA_PROJECT",
1656
+ project: p
1657
+ }),
1658
+ children: [/* @__PURE__ */ jsxDEV("span", {
1659
+ class: "sel-item-name",
1660
+ children: p.key
1661
+ }), p.name && /* @__PURE__ */ jsxDEV("div", {
1662
+ class: "sel-item-sub",
1663
+ children: p.name
1664
+ })]
1665
+ })) : /* @__PURE__ */ jsxDEV("div", {
1666
+ class: "sel-empty",
1667
+ children: t("web.noJiraProjects")
1668
+ })]
1669
+ })]
1670
+ }),
1671
+ /* @__PURE__ */ jsxDEV("button", {
1672
+ class: "jira-btn",
1673
+ type: "button",
1674
+ disabled: !s.selectedJiraProject || s.jiraStatus === "checking" || s.jiraStatus === "creating",
1675
+ onClick: handleCreateIssue,
1676
+ children: s.jiraStatus === "checking" ? t("web.checkingBtn") : s.jiraStatus === "creating" ? t("web.creatingBtn") : t("web.createBtn")
1677
+ }),
1678
+ (s.jiraStatus === "checking" || s.jiraStatus === "creating") && /* @__PURE__ */ jsxDEV("div", {
1679
+ class: "loading-row",
1680
+ style: "margin-top:12px",
1681
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), s.jiraStatus === "checking" ? t("web.checkingIssues") : t("web.creatingIssue")]
1682
+ }),
1683
+ s.jiraResult && /* @__PURE__ */ jsxDEV("div", {
1684
+ class: "jira-result",
1685
+ children: [
1686
+ /* @__PURE__ */ jsxDEV("div", {
1687
+ class: "jira-result-label",
1688
+ children: s.jiraResult.exists ? t("web.versionExistsResult", { version: s.jiraResult.versionName }) : t("web.versionCreatedResult", { version: s.jiraResult.versionName })
1689
+ }),
1690
+ /* @__PURE__ */ jsxDEV("a", {
1691
+ class: "jira-result-key",
1692
+ href: jiraUrl,
1693
+ target: "_blank",
1694
+ rel: "noreferrer",
1695
+ children: s.jiraResult.key
1696
+ }),
1697
+ /* @__PURE__ */ jsxDEV("span", {
1698
+ class: `jira-result-badge ${s.jiraResult.exists ? "exists" : "created"}`,
1699
+ children: s.jiraResult.exists ? t("web.existsBadge") : t("web.createdBadge")
1700
+ })
1701
+ ]
1702
+ }),
1703
+ s.jiraError && /* @__PURE__ */ jsxDEV("div", {
1704
+ class: "jira-error",
1705
+ role: "alert",
1706
+ children: s.jiraError
1707
+ }),
1708
+ s.jiraResult && (s.mrStatus === "idle" || s.mrStatus === "loading") && /* @__PURE__ */ jsxDEV("button", {
1709
+ class: "jira-btn",
1710
+ type: "button",
1711
+ disabled: s.mrStatus === "loading",
1712
+ style: "background:var(--cyan);margin-top:12px",
1713
+ onClick: async () => {
1714
+ if (s.mrStatus === "loading") return;
1715
+ d({ type: "MR_LOADING" });
1716
+ try {
1717
+ const data = await (await fetch(`/release/api/projects/${s.selected.id}/branches`)).json();
1718
+ const branches = (Array.isArray(data) ? data : []).filter((b) => b.name !== s.selectedBranch);
1719
+ if (branches.length === 0) {
1720
+ d({
1721
+ type: "MR_ERROR",
1722
+ error: t("release.noSourceBranches")
1723
+ });
1724
+ return;
1725
+ }
1726
+ d({
1727
+ type: "MR_SELECTING",
1728
+ branches
1729
+ });
1730
+ } catch (e) {
1731
+ d({
1732
+ type: "MR_ERROR",
1733
+ error: e instanceof Error ? e.message : "Failed"
1734
+ });
1735
+ }
1736
+ },
1737
+ children: s.mrStatus === "loading" ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("span", {
1738
+ class: "spinner",
1739
+ style: "width:12px;height:12px;border-width:1px;margin-right:6px;vertical-align:middle"
1740
+ }), t("web.loadingMr")] }) : t("web.createMrBtn")
1741
+ }),
1742
+ s.mrStatus === "selecting" && (() => {
1743
+ const mrb = s.mrBranches.filter((b) => b.name.toLowerCase().includes(s.mrBranchSearch.toLowerCase()));
1744
+ return /* @__PURE__ */ jsxDEV("div", {
1745
+ class: "mr-branch-sel",
1746
+ style: "margin-top:12px",
1747
+ children: [/* @__PURE__ */ jsxDEV("div", {
1748
+ style: "font-size:13px;color:var(--text-2);margin-bottom:4px",
1749
+ children: t("release.selectMrBranch")
1750
+ }), /* @__PURE__ */ jsxDEV("div", {
1751
+ class: "sel",
1752
+ style: "position:relative;z-index:100",
1753
+ children: [/* @__PURE__ */ jsxDEV("button", {
1754
+ type: "button",
1755
+ class: "sel-trigger",
1756
+ onClick: () => d({
1757
+ type: "SET_MR_BRANCH_OPEN",
1758
+ open: !s.mrBranchOpen
1759
+ }),
1760
+ children: [
1761
+ /* @__PURE__ */ jsxDEV("span", {
1762
+ class: "sel-trigger-label",
1763
+ children: t("web.branchLabel")
1764
+ }),
1765
+ /* @__PURE__ */ jsxDEV("span", {
1766
+ class: `sel-trigger-value${s.mrSourceBranch ? "" : " empty"}`,
1767
+ children: s.mrSourceBranch || t("web.selectBranch")
1768
+ }),
1769
+ /* @__PURE__ */ jsxDEV("span", {
1770
+ class: "sel-trigger-arrow",
1771
+ children: "▼"
1772
+ })
1773
+ ]
1774
+ }), s.mrBranchOpen && /* @__PURE__ */ jsxDEV("div", {
1775
+ class: "sel-dropdown",
1776
+ role: "listbox",
1777
+ "aria-label": t("release.selectMrBranch"),
1778
+ children: [/* @__PURE__ */ jsxDEV("div", {
1779
+ class: "sel-search",
1780
+ children: /* @__PURE__ */ jsxDEV("input", {
1781
+ ref: mrBranchSearchRef,
1782
+ class: "sel-search-input",
1783
+ type: "text",
1784
+ placeholder: t("web.filterBranches"),
1785
+ value: s.mrBranchSearch,
1786
+ onChange: (e) => d({
1787
+ type: "SET_MR_BRANCH_SEARCH",
1788
+ search: e.target.value
1789
+ }),
1790
+ onKeyDown: (e) => {
1791
+ const n = selKeyDown(e, s.mrBranchOpen, mrb.length, s.mrBranchIndex, (i) => {
1792
+ if (mrb[i]) d({
1793
+ type: "MR_SOURCE_SELECTED",
1794
+ branch: mrb[i].name
1795
+ });
1796
+ }, () => d({
1797
+ type: "SET_MR_BRANCH_OPEN",
1798
+ open: false
1799
+ }));
1800
+ if (n !== void 0) d({
1801
+ type: "SET_MR_BRANCH_INDEX",
1802
+ index: n
1803
+ });
1804
+ }
1805
+ })
1806
+ }), mrb.length > 0 ? mrb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1807
+ class: `sel-item${b.name === s.mrSourceBranch ? " active" : ""}${i === s.mrBranchIndex ? " highlighted" : ""}`,
1808
+ onMouseEnter: () => d({
1809
+ type: "SET_MR_BRANCH_INDEX",
1810
+ index: i
1811
+ }),
1812
+ onClick: () => d({
1813
+ type: "MR_SOURCE_SELECTED",
1814
+ branch: b.name
1815
+ }),
1816
+ children: [/* @__PURE__ */ jsxDEV("span", {
1817
+ class: "sel-item-name",
1818
+ children: b.name
1819
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1820
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1821
+ children: t("web.defaultBranch")
1822
+ })]
1823
+ })) : /* @__PURE__ */ jsxDEV("div", {
1824
+ class: "sel-empty",
1825
+ children: t("web.noBranches")
1826
+ })]
1827
+ })]
1828
+ })]
1829
+ });
1830
+ })(),
1831
+ s.mrStatus === "selecting" && s.mrSourceBranch && /* @__PURE__ */ jsxDEV("div", {
1832
+ style: "margin-top:8px",
1833
+ children: [/* @__PURE__ */ jsxDEV("div", {
1834
+ style: "font-size:13px;color:var(--text-2);margin-bottom:6px",
1835
+ children: t("release.mrFromTo", {
1836
+ source: s.mrSourceBranch,
1837
+ target: s.selectedBranch
1838
+ })
1839
+ }), /* @__PURE__ */ jsxDEV("button", {
1840
+ class: "jira-btn",
1841
+ type: "button",
1842
+ style: "background:var(--cyan);font-size:13px;padding:4px 12px",
1843
+ onClick: () => d({ type: "MR_CREATING" }),
1844
+ children: t("release.confirmCreateMr")
1845
+ })]
1846
+ }),
1847
+ s.mrStatus === "creating" && /* @__PURE__ */ jsxDEV("div", {
1848
+ class: "loading-row",
1849
+ style: "margin-top:12px",
1850
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("release.creatingMrBtn")]
1851
+ }),
1852
+ s.mrStatus === "done" && s.mrUrl && /* @__PURE__ */ jsxDEV("div", {
1853
+ class: "jira-result",
1854
+ style: "margin-top:12px",
1855
+ children: [/* @__PURE__ */ jsxDEV("div", {
1856
+ class: "jira-result-label",
1857
+ children: "MR"
1858
+ }), /* @__PURE__ */ jsxDEV("a", {
1859
+ class: "jira-result-key",
1860
+ href: s.mrUrl,
1861
+ target: "_blank",
1862
+ rel: "noreferrer",
1863
+ children: t("release.mrFromTo", {
1864
+ source: s.mrSourceBranch,
1865
+ target: s.selectedBranch
1866
+ })
1867
+ })]
1868
+ }),
1869
+ s.mrStatus === "error" && s.mrError && /* @__PURE__ */ jsxDEV("div", {
1870
+ class: "jira-error",
1871
+ role: "alert",
1872
+ style: "margin-top:12px",
1873
+ children: s.mrError
1874
+ })
1875
+ ]
1876
+ }),
1877
+ !s.selected && /* @__PURE__ */ jsxDEV("div", {
1878
+ class: "empty-hint",
1879
+ children: t("web.emptyHint")
1880
+ })
1881
+ ] });
1882
+ };
1883
+ const ReleaseClient = () => {
1884
+ const [s, d] = useReducer(reducer, initial);
1885
+ useEffect(() => {
1886
+ fetch("/release/api/history").then((r) => r.json()).then((data) => d({
1887
+ type: "SET_HISTORY",
1888
+ history: Array.isArray(data) ? data : []
1889
+ })).catch(() => d({
1890
+ type: "SET_HISTORY",
1891
+ history: []
1892
+ }));
1893
+ }, []);
1894
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1895
+ /* @__PURE__ */ jsxDEV("style", { children: releaseStyle }),
1896
+ /* @__PURE__ */ jsxDEV("div", {
1897
+ class: "page-header",
1898
+ children: [/* @__PURE__ */ jsxDEV("h2", { children: t("web.releaseTitle") }), /* @__PURE__ */ jsxDEV("p", { children: t("web.releaseDesc") })]
1899
+ }),
1900
+ s.historyLoading ? /* @__PURE__ */ jsxDEV("div", {
1901
+ class: "loading-row",
1902
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loading")]
1903
+ }) : s.showNewModal ? /* @__PURE__ */ jsxDEV("div", {
1904
+ class: "modal-overlay",
1905
+ onClick: (e) => {
1906
+ if (e.target.classList.contains("modal-overlay")) fetch("/release/api/history").then((r) => r.json()).then((data) => {
1907
+ d({
1908
+ type: "SET_HISTORY",
1909
+ history: Array.isArray(data) ? data : []
1910
+ });
1911
+ d({ type: "HIDE_NEW_MODAL" });
1912
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1913
+ },
1914
+ children: /* @__PURE__ */ jsxDEV("div", {
1915
+ class: "modal-content",
1916
+ children: [/* @__PURE__ */ jsxDEV("div", {
1917
+ class: "modal-header",
1918
+ children: [/* @__PURE__ */ jsxDEV("span", {
1919
+ class: "modal-title",
1920
+ children: t("web.newModalTitle")
1921
+ }), /* @__PURE__ */ jsxDEV("button", {
1922
+ class: "modal-close",
1923
+ type: "button",
1924
+ onClick: () => {
1925
+ fetch("/release/api/history").then((r) => r.json()).then((data) => {
1926
+ d({
1927
+ type: "SET_HISTORY",
1928
+ history: Array.isArray(data) ? data : []
1929
+ });
1930
+ d({ type: "HIDE_NEW_MODAL" });
1931
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1932
+ },
1933
+ children: "✕"
1934
+ })]
1935
+ }), /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1936
+ s,
1937
+ d
1938
+ })]
1939
+ })
1940
+ }) : s.history.length > 0 ? /* @__PURE__ */ jsxDEV(HistoryList, {
1941
+ s,
1942
+ d
1943
+ }) : /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1944
+ s,
1945
+ d
1946
+ })
1947
+ ] });
1948
+ };
1949
+ const mount = async (el) => {
1950
+ await initPromise;
1951
+ render(/* @__PURE__ */ jsxDEV(ReleaseClient, {}), el);
1952
+ };
1953
+ //#endregion
1954
+ export { mount };