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,1949 @@
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
+ mrBranchOpen: false,
567
+ mrBranchSearch: "",
568
+ mrBranchIndex: -1
569
+ };
570
+ case "CLEAR_PROJECT": return {
571
+ ...state,
572
+ selected: null,
573
+ branches: [],
574
+ selectedBranch: "",
575
+ branchOpen: false,
576
+ branchSearch: "",
577
+ branchIndex: -1,
578
+ pomInfo: null,
579
+ pomError: "",
580
+ pomLoading: false,
581
+ selectedJiraProject: null,
582
+ jiraStatus: "idle",
583
+ jiraResult: null,
584
+ jiraError: "",
585
+ mrStatus: "idle",
586
+ mrUrl: "",
587
+ mrError: "",
588
+ mrBranches: [],
589
+ mrSourceBranch: "",
590
+ mrBranchOpen: false,
591
+ mrBranchSearch: "",
592
+ mrBranchIndex: -1
593
+ };
594
+ case "BRANCHES_LOADING": return {
595
+ ...state,
596
+ branchesLoading: true,
597
+ branches: [],
598
+ selectedBranch: ""
599
+ };
600
+ case "BRANCHES_LOADED": return {
601
+ ...state,
602
+ branches: action.branches,
603
+ branchesLoading: false
604
+ };
605
+ case "SET_BRANCH_OPEN": return {
606
+ ...state,
607
+ branchOpen: action.open,
608
+ ...action.open ? {} : {
609
+ branchSearch: "",
610
+ branchIndex: -1
611
+ }
612
+ };
613
+ case "SET_BRANCH_SEARCH": return {
614
+ ...state,
615
+ branchSearch: action.search,
616
+ branchIndex: -1
617
+ };
618
+ case "SET_BRANCH_INDEX": return {
619
+ ...state,
620
+ branchIndex: action.index
621
+ };
622
+ case "SELECT_BRANCH": return {
623
+ ...state,
624
+ selectedBranch: action.branch,
625
+ branchOpen: false,
626
+ branchSearch: "",
627
+ branchIndex: -1
628
+ };
629
+ case "POM_LOADING": return {
630
+ ...state,
631
+ pomLoading: true,
632
+ pomError: "",
633
+ pomInfo: null
634
+ };
635
+ case "POM_LOADED": return {
636
+ ...state,
637
+ pomLoading: false,
638
+ pomInfo: action.info
639
+ };
640
+ case "POM_ERROR": return {
641
+ ...state,
642
+ pomLoading: false,
643
+ pomError: action.error
644
+ };
645
+ case "JIRA_PROJECTS_LOADING": return {
646
+ ...state,
647
+ jiraProjectsLoading: true
648
+ };
649
+ case "JIRA_PROJECTS_LOADED": return {
650
+ ...state,
651
+ jiraProjects: action.projects,
652
+ jiraProjectsLoading: false
653
+ };
654
+ case "JIRA_PROJECTS_ERROR": return {
655
+ ...state,
656
+ jiraProjectsLoading: false
657
+ };
658
+ case "SET_JIRA_PROJECT_OPEN": return {
659
+ ...state,
660
+ jiraProjectOpen: action.open,
661
+ ...action.open ? {} : {
662
+ jiraProjectSearch: "",
663
+ jiraProjectIndex: -1
664
+ }
665
+ };
666
+ case "SET_JIRA_PROJECT_SEARCH": return {
667
+ ...state,
668
+ jiraProjectSearch: action.search,
669
+ jiraProjectIndex: -1
670
+ };
671
+ case "SET_JIRA_PROJECT_INDEX": return {
672
+ ...state,
673
+ jiraProjectIndex: action.index
674
+ };
675
+ case "SELECT_JIRA_PROJECT": return {
676
+ ...state,
677
+ selectedJiraProject: action.project,
678
+ jiraProjectOpen: false,
679
+ jiraProjectSearch: "",
680
+ jiraProjectIndex: -1,
681
+ jiraStatus: "idle",
682
+ jiraResult: null,
683
+ jiraError: ""
684
+ };
685
+ case "CLEAR_JIRA_PROJECT": return {
686
+ ...state,
687
+ selectedJiraProject: null,
688
+ jiraProjectOpen: false,
689
+ jiraProjectSearch: "",
690
+ jiraProjectIndex: -1,
691
+ jiraStatus: "idle",
692
+ jiraResult: null,
693
+ jiraError: ""
694
+ };
695
+ case "JIRA_CHECKING": return {
696
+ ...state,
697
+ jiraStatus: "checking",
698
+ jiraResult: null,
699
+ jiraError: ""
700
+ };
701
+ case "JIRA_CREATING": return {
702
+ ...state,
703
+ jiraStatus: "creating"
704
+ };
705
+ case "JIRA_DONE": return {
706
+ ...state,
707
+ jiraStatus: "done",
708
+ jiraResult: action.result
709
+ };
710
+ case "JIRA_ERROR": return {
711
+ ...state,
712
+ jiraStatus: "error",
713
+ jiraError: action.error
714
+ };
715
+ case "JIRA_RESET": return {
716
+ ...state,
717
+ jiraStatus: "idle",
718
+ jiraResult: null,
719
+ jiraError: ""
720
+ };
721
+ case "SET_HISTORY": return {
722
+ ...state,
723
+ history: action.history,
724
+ historyLoading: false
725
+ };
726
+ case "QUICK_EXEC_START": return {
727
+ ...state,
728
+ quickExecuting: action.id
729
+ };
730
+ case "QUICK_EXEC_SUCCESS": return {
731
+ ...state,
732
+ quickExecuting: null,
733
+ quickResults: {
734
+ ...state.quickResults,
735
+ [action.id]: action.result
736
+ }
737
+ };
738
+ case "QUICK_EXEC_FAIL": return {
739
+ ...state,
740
+ quickExecuting: null,
741
+ quickErrors: {
742
+ ...state.quickErrors,
743
+ [action.id]: action.error
744
+ }
745
+ };
746
+ case "SHOW_NEW_MODAL": return {
747
+ ...state,
748
+ showNewModal: true
749
+ };
750
+ case "HIDE_NEW_MODAL": return {
751
+ ...state,
752
+ showNewModal: false
753
+ };
754
+ case "CLEAR_CONFIRM_TOGGLE": return {
755
+ ...state,
756
+ clearConfirm: !state.clearConfirm
757
+ };
758
+ case "CLEAR_HISTORY_DONE": return {
759
+ ...state,
760
+ history: [],
761
+ clearConfirm: false,
762
+ quickResults: {},
763
+ quickErrors: {}
764
+ };
765
+ case "TOGGLE_CREATE_MR": return {
766
+ ...state,
767
+ createMrChecked: {
768
+ ...state.createMrChecked,
769
+ [action.id]: !state.createMrChecked[action.id]
770
+ }
771
+ };
772
+ case "MR_SELECTING": return {
773
+ ...state,
774
+ mrStatus: "selecting",
775
+ mrBranches: action.branches,
776
+ mrSourceBranch: "",
777
+ mrError: ""
778
+ };
779
+ case "MR_SOURCE_SELECTED": return {
780
+ ...state,
781
+ mrSourceBranch: action.branch,
782
+ mrBranchOpen: false,
783
+ mrBranchSearch: "",
784
+ mrBranchIndex: -1
785
+ };
786
+ case "SET_MR_BRANCH_OPEN": return {
787
+ ...state,
788
+ mrBranchOpen: action.open,
789
+ ...action.open ? {} : {
790
+ mrBranchSearch: "",
791
+ mrBranchIndex: -1
792
+ }
793
+ };
794
+ case "SET_MR_BRANCH_SEARCH": return {
795
+ ...state,
796
+ mrBranchSearch: action.search,
797
+ mrBranchIndex: -1
798
+ };
799
+ case "SET_MR_BRANCH_INDEX": return {
800
+ ...state,
801
+ mrBranchIndex: action.index
802
+ };
803
+ case "MR_LOADING": return {
804
+ ...state,
805
+ mrStatus: "loading",
806
+ mrBranches: [],
807
+ mrSourceBranch: "",
808
+ mrError: ""
809
+ };
810
+ case "MR_CREATING": return {
811
+ ...state,
812
+ mrStatus: "creating",
813
+ mrUrl: "",
814
+ mrError: ""
815
+ };
816
+ case "MR_DONE": return {
817
+ ...state,
818
+ mrStatus: "done",
819
+ mrUrl: action.mrUrl,
820
+ mrSourceBranch: action.mrSourceBranch,
821
+ mrTargetBranch: action.mrTargetBranch
822
+ };
823
+ case "MR_ERROR": return {
824
+ ...state,
825
+ mrStatus: "error",
826
+ mrError: action.error
827
+ };
828
+ }
829
+ };
830
+ const cleanVersion = (v) => (v ?? "").split("-")[0];
831
+ const selKeyDown = (e, open, len, idx, onSelect, onClose) => {
832
+ if (!open || len === 0) return void 0;
833
+ switch (e.key) {
834
+ case "ArrowDown":
835
+ e.preventDefault();
836
+ return Math.min(idx + 1, len - 1);
837
+ case "ArrowUp":
838
+ e.preventDefault();
839
+ return Math.max(idx - 1, -1);
840
+ case "Enter":
841
+ e.preventDefault();
842
+ if (idx >= 0) onSelect(idx);
843
+ return;
844
+ case "Escape":
845
+ onClose();
846
+ return;
847
+ }
848
+ };
849
+ const pipelineStepClass = (done, active) => done ? "pipeline-step done" : active ? "pipeline-step active" : "pipeline-step";
850
+ const pipelineLineClass = (done) => done ? "pipeline-line done" : "pipeline-line";
851
+ const HistoryList = ({ s, d }) => {
852
+ const handleQuickExecute = async (id) => {
853
+ d({
854
+ type: "QUICK_EXEC_START",
855
+ id
856
+ });
857
+ try {
858
+ const data = await (await fetch(`/release/api/history/${id}/execute`, {
859
+ method: "POST",
860
+ headers: { "Content-Type": "application/json" },
861
+ body: JSON.stringify({ createMr: s.createMrChecked[id] ?? false })
862
+ })).json();
863
+ if (data.error) d({
864
+ type: "QUICK_EXEC_FAIL",
865
+ id,
866
+ error: data.error
867
+ });
868
+ else {
869
+ d({
870
+ type: "QUICK_EXEC_SUCCESS",
871
+ id,
872
+ result: data
873
+ });
874
+ d({
875
+ type: "SET_HISTORY",
876
+ history: await (await fetch("/release/api/history")).json()
877
+ });
878
+ }
879
+ } catch (e) {
880
+ d({
881
+ type: "QUICK_EXEC_FAIL",
882
+ id,
883
+ error: e instanceof Error ? e.message : String(e)
884
+ });
885
+ }
886
+ };
887
+ const handleClearHistory = async () => {
888
+ await fetch("/release/api/history", { method: "DELETE" });
889
+ d({ type: "CLEAR_HISTORY_DONE" });
890
+ };
891
+ return /* @__PURE__ */ jsxDEV("div", {
892
+ class: "history-section",
893
+ children: [
894
+ /* @__PURE__ */ jsxDEV("div", {
895
+ class: "history-title",
896
+ children: t("web.historyTitle")
897
+ }),
898
+ s.history.length > 0 ? /* @__PURE__ */ jsxDEV("div", {
899
+ class: "history-list",
900
+ children: s.history.map((entry) => /* @__PURE__ */ jsxDEV("div", {
901
+ class: "history-item",
902
+ children: [
903
+ /* @__PURE__ */ jsxDEV("div", {
904
+ class: "history-item-row",
905
+ children: [/* @__PURE__ */ jsxDEV("div", {
906
+ class: "history-info",
907
+ children: [
908
+ /* @__PURE__ */ jsxDEV("span", {
909
+ class: "history-project",
910
+ children: entry.projectName
911
+ }),
912
+ /* @__PURE__ */ jsxDEV("span", {
913
+ class: "history-detail",
914
+ children: [
915
+ entry.branch,
916
+ " / ",
917
+ entry.jiraProjectKey
918
+ ]
919
+ }),
920
+ entry.mrUrl && /* @__PURE__ */ jsxDEV("a", {
921
+ href: entry.mrUrl,
922
+ target: "_blank",
923
+ rel: "noreferrer",
924
+ style: "font-size:12px;color:var(--cyan);text-decoration:none;margin-left:6px",
925
+ children: t("release.mrFromTo", {
926
+ source: entry.mrSourceBranch ?? "",
927
+ target: entry.mrTargetBranch ?? entry.branch
928
+ })
929
+ })
930
+ ]
931
+ }), /* @__PURE__ */ jsxDEV("div", {
932
+ class: "history-actions",
933
+ children: [entry.mrUrl && /* @__PURE__ */ jsxDEV("label", {
934
+ style: "display:flex;align-items:center;gap:4px;font-size:12px;color:var(--text-3);cursor:pointer",
935
+ children: [/* @__PURE__ */ jsxDEV("input", {
936
+ type: "checkbox",
937
+ checked: s.createMrChecked[entry.id] ?? false,
938
+ onChange: () => d({
939
+ type: "TOGGLE_CREATE_MR",
940
+ id: entry.id
941
+ })
942
+ }), t("web.createMrCheckbox")]
943
+ }), /* @__PURE__ */ jsxDEV("button", {
944
+ class: `history-quick-btn${s.quickExecuting === entry.id ? " executing" : ""}`,
945
+ type: "button",
946
+ disabled: s.quickExecuting !== null,
947
+ onClick: () => handleQuickExecute(entry.id),
948
+ children: s.quickExecuting === entry.id ? t("web.executing") : t("web.quickExecute")
949
+ })]
950
+ })]
951
+ }),
952
+ s.quickResults[entry.id] && /* @__PURE__ */ jsxDEV("div", {
953
+ class: "history-result",
954
+ children: [
955
+ /* @__PURE__ */ jsxDEV("a", {
956
+ class: "history-result-key",
957
+ href: s.quickResults[entry.id].issueUrl,
958
+ target: "_blank",
959
+ rel: "noreferrer",
960
+ children: s.quickResults[entry.id].issueKey
961
+ }),
962
+ /* @__PURE__ */ jsxDEV("span", {
963
+ class: `jira-result-badge ${s.quickResults[entry.id].issueCreated ? "created" : "exists"}`,
964
+ children: s.quickResults[entry.id].issueCreated ? t("web.createdBadge") : t("web.existsBadge")
965
+ }),
966
+ /* @__PURE__ */ jsxDEV("span", {
967
+ style: "font-size:12px;color:var(--text-3);margin-left:8px",
968
+ children: ["v", s.quickResults[entry.id].version]
969
+ }),
970
+ s.quickResults[entry.id].versionCreated && /* @__PURE__ */ jsxDEV("span", {
971
+ style: "font-size:10px;color:var(--neon);margin-left:4px",
972
+ children: t("web.createdBadge")
973
+ }),
974
+ s.quickResults[entry.id].mrUrl && /* @__PURE__ */ jsxDEV("span", {
975
+ style: "font-size:12px;margin-left:12px",
976
+ children: /* @__PURE__ */ jsxDEV("a", {
977
+ href: s.quickResults[entry.id].mrUrl,
978
+ target: "_blank",
979
+ rel: "noreferrer",
980
+ style: "color:var(--cyan);text-decoration:none;border-bottom:1px dashed var(--cyan)",
981
+ children: t("release.mrFromTo", {
982
+ source: s.quickResults[entry.id].mrSourceBranch ?? "",
983
+ target: s.quickResults[entry.id].mrTargetBranch ?? entry.branch
984
+ })
985
+ })
986
+ })
987
+ ]
988
+ }),
989
+ s.quickErrors[entry.id] && /* @__PURE__ */ jsxDEV("div", {
990
+ class: "history-result-error",
991
+ children: s.quickErrors[entry.id]
992
+ })
993
+ ]
994
+ }))
995
+ }) : /* @__PURE__ */ jsxDEV("div", {
996
+ class: "empty-hint",
997
+ children: t("web.noHistory")
998
+ }),
999
+ /* @__PURE__ */ jsxDEV("div", {
1000
+ class: "history-footer",
1001
+ children: [/* @__PURE__ */ jsxDEV("button", {
1002
+ class: "history-new-btn",
1003
+ type: "button",
1004
+ onClick: () => d({ type: "SHOW_NEW_MODAL" }),
1005
+ children: t("web.createNew")
1006
+ }), s.history.length > 0 && (s.clearConfirm ? /* @__PURE__ */ jsxDEV("div", {
1007
+ style: "display:flex;align-items:center;gap:8px",
1008
+ children: [
1009
+ /* @__PURE__ */ jsxDEV("span", {
1010
+ style: "font-size:12px;color:var(--text-3)",
1011
+ children: t("web.clearConfirm")
1012
+ }),
1013
+ /* @__PURE__ */ jsxDEV("button", {
1014
+ class: "history-clear-btn",
1015
+ type: "button",
1016
+ style: "border-color:var(--error);color:var(--error)",
1017
+ onClick: handleClearHistory,
1018
+ children: t("web.clearHistory")
1019
+ }),
1020
+ /* @__PURE__ */ jsxDEV("button", {
1021
+ class: "history-clear-btn",
1022
+ type: "button",
1023
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1024
+ children: t("web.cancel")
1025
+ })
1026
+ ]
1027
+ }) : /* @__PURE__ */ jsxDEV("button", {
1028
+ class: "history-clear-btn",
1029
+ type: "button",
1030
+ onClick: () => d({ type: "CLEAR_CONFIRM_TOGGLE" }),
1031
+ children: t("web.clearHistory")
1032
+ }))]
1033
+ })
1034
+ ]
1035
+ });
1036
+ };
1037
+ const ReleaseFlow = ({ s, d }) => {
1038
+ const projectSearchRef = useRef(null);
1039
+ const branchSearchRef = useRef(null);
1040
+ const jiraSearchRef = useRef(null);
1041
+ const mrBranchSearchRef = useRef(null);
1042
+ useEffect(() => {
1043
+ fetch("/release/api/config").then((r) => r.json()).then((data) => {
1044
+ if (data.jiraHost) d({
1045
+ type: "SET_JIRA_HOST",
1046
+ host: data.jiraHost
1047
+ });
1048
+ }).catch(() => {});
1049
+ }, []);
1050
+ useEffect(() => {
1051
+ fetch("/release/api/projects").then((r) => r.json()).then((data) => {
1052
+ if (data.error) d({
1053
+ type: "PROJECTS_ERROR",
1054
+ error: data.error
1055
+ });
1056
+ else d({
1057
+ type: "PROJECTS_LOADED",
1058
+ projects: data
1059
+ });
1060
+ }).catch((e) => d({
1061
+ type: "PROJECTS_ERROR",
1062
+ error: e.message
1063
+ }));
1064
+ }, []);
1065
+ useEffect(() => {
1066
+ if (!s.projectOpen && !s.branchOpen && !s.jiraProjectOpen && !s.mrBranchOpen) return;
1067
+ const handler = (e) => {
1068
+ const target = e.target;
1069
+ if (!target.closest(".sel") && !target.closest(".mr-branch-sel")) {
1070
+ d({
1071
+ type: "SET_PROJECT_OPEN",
1072
+ open: false
1073
+ });
1074
+ d({
1075
+ type: "SET_BRANCH_OPEN",
1076
+ open: false
1077
+ });
1078
+ d({
1079
+ type: "SET_MR_BRANCH_OPEN",
1080
+ open: false
1081
+ });
1082
+ d({
1083
+ type: "SET_JIRA_PROJECT_OPEN",
1084
+ open: false
1085
+ });
1086
+ }
1087
+ };
1088
+ document.addEventListener("click", handler);
1089
+ return () => document.removeEventListener("click", handler);
1090
+ }, [
1091
+ s.projectOpen,
1092
+ s.branchOpen,
1093
+ s.jiraProjectOpen
1094
+ ]);
1095
+ useEffect(() => {
1096
+ if (s.projectOpen) setTimeout(() => projectSearchRef.current?.focus(), 50);
1097
+ if (s.branchOpen) setTimeout(() => branchSearchRef.current?.focus(), 50);
1098
+ if (s.jiraProjectOpen) setTimeout(() => jiraSearchRef.current?.focus(), 50);
1099
+ if (s.mrBranchOpen) setTimeout(() => mrBranchSearchRef.current?.focus(), 50);
1100
+ }, [
1101
+ s.projectOpen,
1102
+ s.branchOpen,
1103
+ s.jiraProjectOpen,
1104
+ s.mrBranchOpen
1105
+ ]);
1106
+ useEffect(() => {
1107
+ if (s.mrStatus !== "creating" || !s.mrSourceBranch || !s.selected) return;
1108
+ const jiraUrl2 = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1109
+ fetch("/release/api/create-mr", {
1110
+ method: "POST",
1111
+ headers: { "Content-Type": "application/json" },
1112
+ body: JSON.stringify({
1113
+ projectId: s.selected.id,
1114
+ targetBranch: s.selectedBranch,
1115
+ sourceBranch: s.mrSourceBranch,
1116
+ jiraUrl: jiraUrl2
1117
+ })
1118
+ }).then((r) => r.json()).then((data) => {
1119
+ if (data.mrUrl) d({
1120
+ type: "MR_DONE",
1121
+ mrUrl: data.mrUrl,
1122
+ mrSourceBranch: data.sourceBranch,
1123
+ mrTargetBranch: data.targetBranch
1124
+ });
1125
+ else d({
1126
+ type: "MR_ERROR",
1127
+ error: data.error ?? "Failed"
1128
+ });
1129
+ }).catch((e) => d({
1130
+ type: "MR_ERROR",
1131
+ error: e instanceof Error ? e.message : "Failed"
1132
+ }));
1133
+ }, [s.mrStatus, s.mrSourceBranch]);
1134
+ useEffect(() => {
1135
+ if (!s.pomInfo?.version || s.jiraProjects.length > 0 || s.jiraProjectsLoading) return;
1136
+ d({ type: "JIRA_PROJECTS_LOADING" });
1137
+ fetch("/release/api/jira/projects").then((r) => r.json()).then((data) => {
1138
+ if (Array.isArray(data)) d({
1139
+ type: "JIRA_PROJECTS_LOADED",
1140
+ projects: data
1141
+ });
1142
+ else d({
1143
+ type: "JIRA_PROJECTS_ERROR",
1144
+ error: data.error ?? "Failed"
1145
+ });
1146
+ }).catch(() => d({
1147
+ type: "JIRA_PROJECTS_ERROR",
1148
+ error: "Failed"
1149
+ }));
1150
+ }, [s.pomInfo?.version]);
1151
+ const fetchPom = (projectId, ref) => {
1152
+ d({ type: "POM_LOADING" });
1153
+ fetch(`/release/api/projects/${projectId}/pom-version?ref=${encodeURIComponent(ref)}`).then((r) => r.json()).then((data) => {
1154
+ if (data.error) d({
1155
+ type: "POM_ERROR",
1156
+ error: data.error
1157
+ });
1158
+ else d({
1159
+ type: "POM_LOADED",
1160
+ info: data
1161
+ });
1162
+ }).catch(() => d({
1163
+ type: "POM_ERROR",
1164
+ error: "Failed to fetch version"
1165
+ }));
1166
+ };
1167
+ const handleSelectProject = (project) => {
1168
+ d({
1169
+ type: "SELECT_PROJECT",
1170
+ project
1171
+ });
1172
+ d({ type: "BRANCHES_LOADING" });
1173
+ fetch(`/release/api/projects/${project.id}/branches`).then((r) => r.json()).then((data) => {
1174
+ d({
1175
+ type: "BRANCHES_LOADED",
1176
+ branches: "error" in data ? [] : data
1177
+ });
1178
+ }).catch(() => d({
1179
+ type: "BRANCHES_LOADED",
1180
+ branches: []
1181
+ }));
1182
+ };
1183
+ const handleSelectBranch = (name) => {
1184
+ d({
1185
+ type: "SELECT_BRANCH",
1186
+ branch: name
1187
+ });
1188
+ if (s.selected) fetchPom(s.selected.id, name);
1189
+ };
1190
+ const handleCreateIssue = async () => {
1191
+ if (!s.selected || !s.pomInfo?.version || !s.selectedJiraProject) return;
1192
+ const artifactId = s.pomInfo.artifactId ?? s.selected.name;
1193
+ const projectVersion = cleanVersion(s.pomInfo.version);
1194
+ const versionName = `${artifactId}-${projectVersion}`;
1195
+ const summary = `${artifactId}-${projectVersion} ${t("web.releaseSuffix") ?? t("release.releaseSuffix")}`;
1196
+ d({ type: "JIRA_CHECKING" });
1197
+ try {
1198
+ const searchData = await (await fetch("/release/api/jira/search", {
1199
+ method: "POST",
1200
+ headers: { "Content-Type": "application/json" },
1201
+ body: JSON.stringify({
1202
+ jql: `summary ~ "${summary}" AND project = ${s.selectedJiraProject.key}`,
1203
+ maxResults: 1
1204
+ })
1205
+ })).json();
1206
+ if (searchData.error) {
1207
+ d({
1208
+ type: "JIRA_ERROR",
1209
+ error: searchData.error
1210
+ });
1211
+ return;
1212
+ }
1213
+ if (searchData.total > 0 && searchData.issues?.[0]) {
1214
+ d({
1215
+ type: "JIRA_DONE",
1216
+ result: {
1217
+ key: searchData.issues[0].key,
1218
+ exists: true,
1219
+ versionName
1220
+ }
1221
+ });
1222
+ await fetch("/release/api/history", {
1223
+ method: "POST",
1224
+ headers: { "Content-Type": "application/json" },
1225
+ body: JSON.stringify({
1226
+ id: Date.now().toString(36),
1227
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1228
+ projectId: s.selected.id,
1229
+ projectName: s.selected.name,
1230
+ projectPath: s.selected.pathWithNamespace ?? "",
1231
+ branch: s.selectedBranch,
1232
+ jiraProjectKey: s.selectedJiraProject.key
1233
+ })
1234
+ });
1235
+ return;
1236
+ }
1237
+ d({ type: "JIRA_CREATING" });
1238
+ const verData = await (await fetch("/release/api/jira/ensure-version", {
1239
+ method: "POST",
1240
+ headers: { "Content-Type": "application/json" },
1241
+ body: JSON.stringify({
1242
+ projectKey: s.selectedJiraProject.key,
1243
+ versionName
1244
+ })
1245
+ })).json();
1246
+ if (verData.error) {
1247
+ d({
1248
+ type: "JIRA_ERROR",
1249
+ error: verData.error
1250
+ });
1251
+ return;
1252
+ }
1253
+ const issueData = await (await fetch("/release/api/jira/create-issue", {
1254
+ method: "POST",
1255
+ headers: { "Content-Type": "application/json" },
1256
+ body: JSON.stringify({
1257
+ projectKey: s.selectedJiraProject.key,
1258
+ summary,
1259
+ issuetypeId: "10000",
1260
+ customfield_15800: "无",
1261
+ customfield_13410: [{ id: verData.id }],
1262
+ customfield_13341: [{ name: "licheng.li" }]
1263
+ })
1264
+ })).json();
1265
+ if (issueData.error) {
1266
+ d({
1267
+ type: "JIRA_ERROR",
1268
+ error: issueData.error
1269
+ });
1270
+ return;
1271
+ }
1272
+ d({
1273
+ type: "JIRA_DONE",
1274
+ result: {
1275
+ key: issueData.key,
1276
+ exists: false,
1277
+ versionName: verData.name
1278
+ }
1279
+ });
1280
+ await fetch("/release/api/history", {
1281
+ method: "POST",
1282
+ headers: { "Content-Type": "application/json" },
1283
+ body: JSON.stringify({
1284
+ id: Date.now().toString(36),
1285
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1286
+ projectId: s.selected.id,
1287
+ projectName: s.selected.name,
1288
+ projectPath: s.selected.pathWithNamespace ?? "",
1289
+ branch: s.selectedBranch,
1290
+ jiraProjectKey: s.selectedJiraProject.key
1291
+ })
1292
+ });
1293
+ } catch (e) {
1294
+ d({
1295
+ type: "JIRA_ERROR",
1296
+ error: e instanceof Error ? e.message : String(e)
1297
+ });
1298
+ }
1299
+ };
1300
+ const fp = filterByRelevance(s.projects.map((p) => ({
1301
+ ...p,
1302
+ name: p.name,
1303
+ path: p.pathWithNamespace ?? ""
1304
+ })), s.projectSearch);
1305
+ const fb = filterByRelevance(s.branches.map((b) => ({
1306
+ ...b,
1307
+ name: b.name
1308
+ })), s.branchSearch);
1309
+ const fj = filterByRelevance(s.jiraProjects.map((p) => ({
1310
+ ...p,
1311
+ name: `${p.key} ${p.name ?? ""}`
1312
+ })), s.jiraProjectSearch);
1313
+ const jiraUrl = s.jiraResult && s.jiraHost ? `${s.jiraHost}/browse/${s.jiraResult.key}` : "";
1314
+ const step1Done = !!s.selected;
1315
+ const step1Active = !s.projectsLoading && !step1Done;
1316
+ const step2Done = !!s.selectedBranch;
1317
+ const step2Active = !!s.selected && !step2Done;
1318
+ const step3Done = !!s.pomInfo?.version;
1319
+ const step3Active = !!s.selectedBranch && !step3Done;
1320
+ const step4Done = !!s.selectedJiraProject;
1321
+ const step4Active = !!s.pomInfo?.version && !step4Done;
1322
+ const step5Done = !!s.jiraResult;
1323
+ const step5Active = !!s.selectedJiraProject && !step5Done;
1324
+ if (s.projectsLoading) return /* @__PURE__ */ jsxDEV("div", {
1325
+ class: "loading-row",
1326
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingProjects")]
1327
+ });
1328
+ if (s.projectsError) return /* @__PURE__ */ jsxDEV("div", {
1329
+ class: "state-error",
1330
+ children: s.projectsError
1331
+ });
1332
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1333
+ /* @__PURE__ */ jsxDEV("div", {
1334
+ class: "pipeline",
1335
+ children: [
1336
+ /* @__PURE__ */ jsxDEV("div", {
1337
+ class: pipelineStepClass(step1Done, step1Active),
1338
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.projectLabel")]
1339
+ }),
1340
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step1Done) }),
1341
+ /* @__PURE__ */ jsxDEV("div", {
1342
+ class: pipelineStepClass(step2Done, step2Active),
1343
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.branchLabel")]
1344
+ }),
1345
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step2Done) }),
1346
+ /* @__PURE__ */ jsxDEV("div", {
1347
+ class: pipelineStepClass(step3Done, step3Active),
1348
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.versionTag")]
1349
+ }),
1350
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step3Done) }),
1351
+ /* @__PURE__ */ jsxDEV("div", {
1352
+ class: pipelineStepClass(step4Done, step4Active),
1353
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.jiraProjectLabel")]
1354
+ }),
1355
+ /* @__PURE__ */ jsxDEV("div", { class: pipelineLineClass(step4Done) }),
1356
+ /* @__PURE__ */ jsxDEV("div", {
1357
+ class: pipelineStepClass(step5Done, step5Active),
1358
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "pipeline-node" }), t("web.createBtn")]
1359
+ })
1360
+ ]
1361
+ }),
1362
+ /* @__PURE__ */ jsxDEV("div", {
1363
+ class: "sel",
1364
+ "data-sel": "project",
1365
+ style: `z-index:${s.projectOpen ? 100 : 1}`,
1366
+ children: [/* @__PURE__ */ jsxDEV("button", {
1367
+ class: `sel-trigger${s.projectOpen ? " open" : ""}`,
1368
+ type: "button",
1369
+ role: "combobox",
1370
+ "aria-expanded": s.projectOpen,
1371
+ "aria-haspopup": "listbox",
1372
+ onClick: () => {
1373
+ d({
1374
+ type: "SET_BRANCH_OPEN",
1375
+ open: false
1376
+ });
1377
+ d({
1378
+ type: "SET_JIRA_PROJECT_OPEN",
1379
+ open: false
1380
+ });
1381
+ d({
1382
+ type: "SET_MR_BRANCH_OPEN",
1383
+ open: false
1384
+ });
1385
+ d({
1386
+ type: "SET_PROJECT_OPEN",
1387
+ open: !s.projectOpen
1388
+ });
1389
+ },
1390
+ children: [
1391
+ /* @__PURE__ */ jsxDEV("span", {
1392
+ class: "sel-trigger-label",
1393
+ children: t("web.projectLabel")
1394
+ }),
1395
+ /* @__PURE__ */ jsxDEV("span", {
1396
+ class: `sel-trigger-value${s.selected ? "" : " empty"}`,
1397
+ children: s.selected ? s.selected.name : t("web.selectProject")
1398
+ }),
1399
+ /* @__PURE__ */ jsxDEV("span", {
1400
+ class: "sel-trigger-arrow",
1401
+ children: "▼"
1402
+ })
1403
+ ]
1404
+ }), s.projectOpen && /* @__PURE__ */ jsxDEV("div", {
1405
+ class: "sel-dropdown",
1406
+ role: "listbox",
1407
+ "aria-label": t("web.selectProject"),
1408
+ children: [/* @__PURE__ */ jsxDEV("div", {
1409
+ class: "sel-search",
1410
+ children: /* @__PURE__ */ jsxDEV("input", {
1411
+ ref: projectSearchRef,
1412
+ class: "sel-search-input",
1413
+ type: "text",
1414
+ placeholder: t("web.searchProjects"),
1415
+ value: s.projectSearch,
1416
+ onChange: (e) => d({
1417
+ type: "SET_PROJECT_SEARCH",
1418
+ search: e.target.value
1419
+ }),
1420
+ onKeyDown: (e) => {
1421
+ const n = selKeyDown(e, s.projectOpen, fp.length, s.projectIndex, (i) => {
1422
+ const p = fp[i];
1423
+ if (p) handleSelectProject(p);
1424
+ }, () => d({
1425
+ type: "SET_PROJECT_OPEN",
1426
+ open: false
1427
+ }));
1428
+ if (n !== void 0) d({
1429
+ type: "SET_PROJECT_INDEX",
1430
+ index: n
1431
+ });
1432
+ }
1433
+ })
1434
+ }), fp.length > 0 ? fp.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1435
+ class: `sel-item${s.selected?.id === p.id ? " active" : ""}${i === s.projectIndex ? " highlighted" : ""}`,
1436
+ onMouseEnter: () => d({
1437
+ type: "SET_PROJECT_INDEX",
1438
+ index: i
1439
+ }),
1440
+ onClick: () => handleSelectProject(p),
1441
+ children: [/* @__PURE__ */ jsxDEV("div", {
1442
+ class: "sel-item-name",
1443
+ children: p.name
1444
+ }), /* @__PURE__ */ jsxDEV("div", {
1445
+ class: "sel-item-sub",
1446
+ children: p.pathWithNamespace
1447
+ })]
1448
+ })) : /* @__PURE__ */ jsxDEV("div", {
1449
+ class: "sel-empty",
1450
+ children: t("web.noProjects")
1451
+ })]
1452
+ })]
1453
+ }),
1454
+ s.selected && (s.branchesLoading ? /* @__PURE__ */ jsxDEV("div", {
1455
+ class: "loading-row",
1456
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingBranches")]
1457
+ }) : s.branches.length > 0 && /* @__PURE__ */ jsxDEV("div", {
1458
+ class: "sel",
1459
+ "data-sel": "branch",
1460
+ style: `z-index:${s.branchOpen ? 100 : 1}`,
1461
+ children: [/* @__PURE__ */ jsxDEV("button", {
1462
+ class: `sel-trigger${s.branchOpen ? " open" : ""}`,
1463
+ type: "button",
1464
+ role: "combobox",
1465
+ "aria-expanded": s.branchOpen,
1466
+ "aria-haspopup": "listbox",
1467
+ onClick: () => {
1468
+ d({
1469
+ type: "SET_PROJECT_OPEN",
1470
+ open: false
1471
+ });
1472
+ d({
1473
+ type: "SET_JIRA_PROJECT_OPEN",
1474
+ open: false
1475
+ });
1476
+ d({
1477
+ type: "SET_MR_BRANCH_OPEN",
1478
+ open: false
1479
+ });
1480
+ d({
1481
+ type: "SET_BRANCH_OPEN",
1482
+ open: !s.branchOpen
1483
+ });
1484
+ },
1485
+ children: [
1486
+ /* @__PURE__ */ jsxDEV("span", {
1487
+ class: "sel-trigger-label",
1488
+ children: t("web.branchLabel")
1489
+ }),
1490
+ /* @__PURE__ */ jsxDEV("span", {
1491
+ class: `sel-trigger-value${s.selectedBranch ? "" : " empty"}`,
1492
+ children: s.selectedBranch || t("web.selectBranch")
1493
+ }),
1494
+ /* @__PURE__ */ jsxDEV("span", {
1495
+ class: "sel-trigger-arrow",
1496
+ children: "▼"
1497
+ })
1498
+ ]
1499
+ }), s.branchOpen && /* @__PURE__ */ jsxDEV("div", {
1500
+ class: "sel-dropdown",
1501
+ role: "listbox",
1502
+ "aria-label": t("web.selectBranch"),
1503
+ children: [/* @__PURE__ */ jsxDEV("div", {
1504
+ class: "sel-search",
1505
+ children: /* @__PURE__ */ jsxDEV("input", {
1506
+ ref: branchSearchRef,
1507
+ class: "sel-search-input",
1508
+ type: "text",
1509
+ placeholder: t("web.filterBranches"),
1510
+ value: s.branchSearch,
1511
+ onChange: (e) => d({
1512
+ type: "SET_BRANCH_SEARCH",
1513
+ search: e.target.value
1514
+ }),
1515
+ onKeyDown: (e) => {
1516
+ const n = selKeyDown(e, s.branchOpen, fb.length, s.branchIndex, (i) => {
1517
+ const b = fb[i];
1518
+ if (b) handleSelectBranch(b.name);
1519
+ }, () => d({
1520
+ type: "SET_BRANCH_OPEN",
1521
+ open: false
1522
+ }));
1523
+ if (n !== void 0) d({
1524
+ type: "SET_BRANCH_INDEX",
1525
+ index: n
1526
+ });
1527
+ }
1528
+ })
1529
+ }), fb.length > 0 ? fb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1530
+ class: `sel-item${b.name === s.selectedBranch ? " active" : ""}${i === s.branchIndex ? " highlighted" : ""}`,
1531
+ onMouseEnter: () => d({
1532
+ type: "SET_BRANCH_INDEX",
1533
+ index: i
1534
+ }),
1535
+ onClick: () => handleSelectBranch(b.name),
1536
+ children: [/* @__PURE__ */ jsxDEV("span", {
1537
+ class: "sel-item-name",
1538
+ children: b.name
1539
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1540
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1541
+ children: t("web.defaultBranch")
1542
+ })]
1543
+ })) : /* @__PURE__ */ jsxDEV("div", {
1544
+ class: "sel-empty",
1545
+ children: t("web.noBranches")
1546
+ })]
1547
+ })]
1548
+ })),
1549
+ s.selected && s.selectedBranch && !s.branchesLoading && (s.pomLoading ? /* @__PURE__ */ jsxDEV("div", {
1550
+ class: "loading-row",
1551
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingVersion")]
1552
+ }) : s.pomError ? /* @__PURE__ */ jsxDEV("div", {
1553
+ class: "version-error",
1554
+ role: "alert",
1555
+ children: s.pomError.includes("404") ? t("web.noPom") : s.pomError
1556
+ }) : s.pomInfo && /* @__PURE__ */ jsxDEV("div", {
1557
+ class: "version-display",
1558
+ children: [/* @__PURE__ */ jsxDEV("span", {
1559
+ class: "version-tag",
1560
+ children: t("web.versionTag")
1561
+ }), /* @__PURE__ */ jsxDEV("span", {
1562
+ class: "version-number",
1563
+ children: cleanVersion(s.pomInfo.version)
1564
+ })]
1565
+ })),
1566
+ s.selected && s.pomInfo?.version && !s.pomLoading && /* @__PURE__ */ jsxDEV("div", {
1567
+ class: "jira-section",
1568
+ children: [
1569
+ s.jiraProjectsLoading ? /* @__PURE__ */ jsxDEV("div", {
1570
+ class: "loading-row",
1571
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loadingJiraProjects")]
1572
+ }) : /* @__PURE__ */ jsxDEV("div", {
1573
+ class: "sel",
1574
+ "data-sel": "jira",
1575
+ style: `z-index:${s.jiraProjectOpen ? 100 : 1}`,
1576
+ children: [/* @__PURE__ */ jsxDEV("button", {
1577
+ class: `sel-trigger${s.jiraProjectOpen ? " open" : ""}`,
1578
+ type: "button",
1579
+ role: "combobox",
1580
+ "aria-expanded": s.jiraProjectOpen,
1581
+ "aria-haspopup": "listbox",
1582
+ onClick: () => {
1583
+ d({
1584
+ type: "SET_PROJECT_OPEN",
1585
+ open: false
1586
+ });
1587
+ d({
1588
+ type: "SET_BRANCH_OPEN",
1589
+ open: false
1590
+ });
1591
+ d({
1592
+ type: "SET_JIRA_PROJECT_OPEN",
1593
+ open: !s.jiraProjectOpen
1594
+ });
1595
+ },
1596
+ children: [
1597
+ /* @__PURE__ */ jsxDEV("span", {
1598
+ class: "sel-trigger-label",
1599
+ children: t("web.jiraProjectLabel")
1600
+ }),
1601
+ /* @__PURE__ */ jsxDEV("span", {
1602
+ class: `sel-trigger-value${s.selectedJiraProject ? "" : " empty"}`,
1603
+ children: s.selectedJiraProject ? `${s.selectedJiraProject.key} - ${s.selectedJiraProject.name ?? ""}` : t("web.selectJiraProject")
1604
+ }),
1605
+ /* @__PURE__ */ jsxDEV("span", {
1606
+ class: "sel-trigger-arrow",
1607
+ children: "▼"
1608
+ })
1609
+ ]
1610
+ }), s.jiraProjectOpen && /* @__PURE__ */ jsxDEV("div", {
1611
+ class: "sel-dropdown",
1612
+ role: "listbox",
1613
+ "aria-label": t("web.selectJiraProject"),
1614
+ children: [/* @__PURE__ */ jsxDEV("div", {
1615
+ class: "sel-search",
1616
+ children: /* @__PURE__ */ jsxDEV("input", {
1617
+ ref: jiraSearchRef,
1618
+ class: "sel-search-input",
1619
+ type: "text",
1620
+ placeholder: t("web.searchJiraProject"),
1621
+ value: s.jiraProjectSearch,
1622
+ onChange: (e) => d({
1623
+ type: "SET_JIRA_PROJECT_SEARCH",
1624
+ search: e.target.value
1625
+ }),
1626
+ onKeyDown: (e) => {
1627
+ const n = selKeyDown(e, s.jiraProjectOpen, fj.length, s.jiraProjectIndex, (i) => {
1628
+ const p = fj[i];
1629
+ if (p) d({
1630
+ type: "SELECT_JIRA_PROJECT",
1631
+ project: p
1632
+ });
1633
+ }, () => d({
1634
+ type: "SET_JIRA_PROJECT_OPEN",
1635
+ open: false
1636
+ }));
1637
+ if (n !== void 0) d({
1638
+ type: "SET_JIRA_PROJECT_INDEX",
1639
+ index: n
1640
+ });
1641
+ }
1642
+ })
1643
+ }), fj.length > 0 ? fj.map((p, i) => /* @__PURE__ */ jsxDEV("div", {
1644
+ class: `sel-item${s.selectedJiraProject?.key === p.key ? " active" : ""}${i === s.jiraProjectIndex ? " highlighted" : ""}`,
1645
+ onMouseEnter: () => d({
1646
+ type: "SET_JIRA_PROJECT_INDEX",
1647
+ index: i
1648
+ }),
1649
+ onClick: () => d({
1650
+ type: "SELECT_JIRA_PROJECT",
1651
+ project: p
1652
+ }),
1653
+ children: [/* @__PURE__ */ jsxDEV("span", {
1654
+ class: "sel-item-name",
1655
+ children: p.key
1656
+ }), p.name && /* @__PURE__ */ jsxDEV("div", {
1657
+ class: "sel-item-sub",
1658
+ children: p.name
1659
+ })]
1660
+ })) : /* @__PURE__ */ jsxDEV("div", {
1661
+ class: "sel-empty",
1662
+ children: t("web.noJiraProjects")
1663
+ })]
1664
+ })]
1665
+ }),
1666
+ /* @__PURE__ */ jsxDEV("button", {
1667
+ class: "jira-btn",
1668
+ type: "button",
1669
+ disabled: !s.selectedJiraProject || s.jiraStatus === "checking" || s.jiraStatus === "creating",
1670
+ onClick: handleCreateIssue,
1671
+ children: s.jiraStatus === "checking" ? t("web.checkingBtn") : s.jiraStatus === "creating" ? t("web.creatingBtn") : t("web.createBtn")
1672
+ }),
1673
+ (s.jiraStatus === "checking" || s.jiraStatus === "creating") && /* @__PURE__ */ jsxDEV("div", {
1674
+ class: "loading-row",
1675
+ style: "margin-top:12px",
1676
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), s.jiraStatus === "checking" ? t("web.checkingIssues") : t("web.creatingIssue")]
1677
+ }),
1678
+ s.jiraResult && /* @__PURE__ */ jsxDEV("div", {
1679
+ class: "jira-result",
1680
+ children: [
1681
+ /* @__PURE__ */ jsxDEV("div", {
1682
+ class: "jira-result-label",
1683
+ children: s.jiraResult.exists ? t("web.versionExistsResult", { version: s.jiraResult.versionName }) : t("web.versionCreatedResult", { version: s.jiraResult.versionName })
1684
+ }),
1685
+ /* @__PURE__ */ jsxDEV("a", {
1686
+ class: "jira-result-key",
1687
+ href: jiraUrl,
1688
+ target: "_blank",
1689
+ rel: "noreferrer",
1690
+ children: s.jiraResult.key
1691
+ }),
1692
+ /* @__PURE__ */ jsxDEV("span", {
1693
+ class: `jira-result-badge ${s.jiraResult.exists ? "exists" : "created"}`,
1694
+ children: s.jiraResult.exists ? t("web.existsBadge") : t("web.createdBadge")
1695
+ })
1696
+ ]
1697
+ }),
1698
+ s.jiraError && /* @__PURE__ */ jsxDEV("div", {
1699
+ class: "jira-error",
1700
+ role: "alert",
1701
+ children: s.jiraError
1702
+ }),
1703
+ s.jiraResult && (s.mrStatus === "idle" || s.mrStatus === "loading") && /* @__PURE__ */ jsxDEV("button", {
1704
+ class: "jira-btn",
1705
+ type: "button",
1706
+ disabled: s.mrStatus === "loading",
1707
+ style: "background:var(--cyan);margin-top:12px",
1708
+ onClick: async () => {
1709
+ if (s.mrStatus === "loading") return;
1710
+ d({ type: "MR_LOADING" });
1711
+ try {
1712
+ const data = await (await fetch(`/release/api/projects/${s.selected.id}/branches`)).json();
1713
+ const branches = (Array.isArray(data) ? data : []).filter((b) => b.name !== s.selectedBranch);
1714
+ if (branches.length === 0) {
1715
+ d({
1716
+ type: "MR_ERROR",
1717
+ error: t("release.noSourceBranches")
1718
+ });
1719
+ return;
1720
+ }
1721
+ d({
1722
+ type: "MR_SELECTING",
1723
+ branches
1724
+ });
1725
+ } catch (e) {
1726
+ d({
1727
+ type: "MR_ERROR",
1728
+ error: e instanceof Error ? e.message : "Failed"
1729
+ });
1730
+ }
1731
+ },
1732
+ children: s.mrStatus === "loading" ? /* @__PURE__ */ jsxDEV(Fragment, { children: [/* @__PURE__ */ jsxDEV("span", {
1733
+ class: "spinner",
1734
+ style: "width:12px;height:12px;border-width:1px;margin-right:6px;vertical-align:middle"
1735
+ }), t("web.loadingMr")] }) : t("web.createMrBtn")
1736
+ }),
1737
+ s.mrStatus === "selecting" && (() => {
1738
+ const mrb = s.mrBranches.filter((b) => b.name.toLowerCase().includes(s.mrBranchSearch.toLowerCase()));
1739
+ return /* @__PURE__ */ jsxDEV("div", {
1740
+ class: "mr-branch-sel",
1741
+ style: "margin-top:12px",
1742
+ children: [/* @__PURE__ */ jsxDEV("div", {
1743
+ style: "font-size:13px;color:var(--text-2);margin-bottom:4px",
1744
+ children: t("release.selectMrBranch")
1745
+ }), /* @__PURE__ */ jsxDEV("div", {
1746
+ class: "sel",
1747
+ style: "position:relative;z-index:100",
1748
+ children: [/* @__PURE__ */ jsxDEV("button", {
1749
+ type: "button",
1750
+ class: "sel-trigger",
1751
+ onClick: () => d({
1752
+ type: "SET_MR_BRANCH_OPEN",
1753
+ open: !s.mrBranchOpen
1754
+ }),
1755
+ children: [
1756
+ /* @__PURE__ */ jsxDEV("span", {
1757
+ class: "sel-trigger-label",
1758
+ children: t("web.branchLabel")
1759
+ }),
1760
+ /* @__PURE__ */ jsxDEV("span", {
1761
+ class: `sel-trigger-value${s.mrSourceBranch ? "" : " empty"}`,
1762
+ children: s.mrSourceBranch || t("web.selectBranch")
1763
+ }),
1764
+ /* @__PURE__ */ jsxDEV("span", {
1765
+ class: "sel-trigger-arrow",
1766
+ children: "▼"
1767
+ })
1768
+ ]
1769
+ }), s.mrBranchOpen && /* @__PURE__ */ jsxDEV("div", {
1770
+ class: "sel-dropdown",
1771
+ role: "listbox",
1772
+ "aria-label": t("release.selectMrBranch"),
1773
+ children: [/* @__PURE__ */ jsxDEV("div", {
1774
+ class: "sel-search",
1775
+ children: /* @__PURE__ */ jsxDEV("input", {
1776
+ ref: mrBranchSearchRef,
1777
+ class: "sel-search-input",
1778
+ type: "text",
1779
+ placeholder: t("web.filterBranches"),
1780
+ value: s.mrBranchSearch,
1781
+ onChange: (e) => d({
1782
+ type: "SET_MR_BRANCH_SEARCH",
1783
+ search: e.target.value
1784
+ }),
1785
+ onKeyDown: (e) => {
1786
+ const n = selKeyDown(e, s.mrBranchOpen, mrb.length, s.mrBranchIndex, (i) => {
1787
+ if (mrb[i]) d({
1788
+ type: "MR_SOURCE_SELECTED",
1789
+ branch: mrb[i].name
1790
+ });
1791
+ }, () => d({
1792
+ type: "SET_MR_BRANCH_OPEN",
1793
+ open: false
1794
+ }));
1795
+ if (n !== void 0) d({
1796
+ type: "SET_MR_BRANCH_INDEX",
1797
+ index: n
1798
+ });
1799
+ }
1800
+ })
1801
+ }), mrb.length > 0 ? mrb.map((b, i) => /* @__PURE__ */ jsxDEV("div", {
1802
+ class: `sel-item${b.name === s.mrSourceBranch ? " active" : ""}${i === s.mrBranchIndex ? " highlighted" : ""}`,
1803
+ onMouseEnter: () => d({
1804
+ type: "SET_MR_BRANCH_INDEX",
1805
+ index: i
1806
+ }),
1807
+ onClick: () => d({
1808
+ type: "MR_SOURCE_SELECTED",
1809
+ branch: b.name
1810
+ }),
1811
+ children: [/* @__PURE__ */ jsxDEV("span", {
1812
+ class: "sel-item-name",
1813
+ children: b.name
1814
+ }), b.default && /* @__PURE__ */ jsxDEV("span", {
1815
+ style: "font-size:10px;color:var(--neon);margin-left:6px",
1816
+ children: t("web.defaultBranch")
1817
+ })]
1818
+ })) : /* @__PURE__ */ jsxDEV("div", {
1819
+ class: "sel-empty",
1820
+ children: t("web.noBranches")
1821
+ })]
1822
+ })]
1823
+ })]
1824
+ });
1825
+ })(),
1826
+ s.mrStatus === "selecting" && s.mrSourceBranch && /* @__PURE__ */ jsxDEV("div", {
1827
+ style: "margin-top:8px",
1828
+ children: [/* @__PURE__ */ jsxDEV("div", {
1829
+ style: "font-size:13px;color:var(--text-2);margin-bottom:6px",
1830
+ children: t("release.mrFromTo", {
1831
+ source: s.mrSourceBranch,
1832
+ target: s.selectedBranch
1833
+ })
1834
+ }), /* @__PURE__ */ jsxDEV("button", {
1835
+ class: "jira-btn",
1836
+ type: "button",
1837
+ style: "background:var(--cyan);font-size:13px;padding:4px 12px",
1838
+ onClick: () => d({ type: "MR_CREATING" }),
1839
+ children: t("release.confirmCreateMr")
1840
+ })]
1841
+ }),
1842
+ s.mrStatus === "creating" && /* @__PURE__ */ jsxDEV("div", {
1843
+ class: "loading-row",
1844
+ style: "margin-top:12px",
1845
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("release.creatingMrBtn")]
1846
+ }),
1847
+ s.mrStatus === "done" && s.mrUrl && /* @__PURE__ */ jsxDEV("div", {
1848
+ class: "jira-result",
1849
+ style: "margin-top:12px",
1850
+ children: [/* @__PURE__ */ jsxDEV("div", {
1851
+ class: "jira-result-label",
1852
+ children: "MR"
1853
+ }), /* @__PURE__ */ jsxDEV("a", {
1854
+ class: "jira-result-key",
1855
+ href: s.mrUrl,
1856
+ target: "_blank",
1857
+ rel: "noreferrer",
1858
+ children: t("release.mrFromTo", {
1859
+ source: s.mrSourceBranch,
1860
+ target: s.selectedBranch
1861
+ })
1862
+ })]
1863
+ }),
1864
+ s.mrStatus === "error" && s.mrError && /* @__PURE__ */ jsxDEV("div", {
1865
+ class: "jira-error",
1866
+ role: "alert",
1867
+ style: "margin-top:12px",
1868
+ children: s.mrError
1869
+ })
1870
+ ]
1871
+ }),
1872
+ !s.selected && /* @__PURE__ */ jsxDEV("div", {
1873
+ class: "empty-hint",
1874
+ children: t("web.emptyHint")
1875
+ })
1876
+ ] });
1877
+ };
1878
+ const ReleaseClient = () => {
1879
+ const [s, d] = useReducer(reducer, initial);
1880
+ useEffect(() => {
1881
+ fetch("/release/api/history").then((r) => r.json()).then((data) => d({
1882
+ type: "SET_HISTORY",
1883
+ history: Array.isArray(data) ? data : []
1884
+ })).catch(() => d({
1885
+ type: "SET_HISTORY",
1886
+ history: []
1887
+ }));
1888
+ }, []);
1889
+ return /* @__PURE__ */ jsxDEV("div", { children: [
1890
+ /* @__PURE__ */ jsxDEV("style", { children: releaseStyle }),
1891
+ /* @__PURE__ */ jsxDEV("div", {
1892
+ class: "page-header",
1893
+ children: [/* @__PURE__ */ jsxDEV("h2", { children: t("web.releaseTitle") }), /* @__PURE__ */ jsxDEV("p", { children: t("web.releaseDesc") })]
1894
+ }),
1895
+ s.historyLoading ? /* @__PURE__ */ jsxDEV("div", {
1896
+ class: "loading-row",
1897
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "spinner" }), t("web.loading")]
1898
+ }) : s.showNewModal ? /* @__PURE__ */ jsxDEV("div", {
1899
+ class: "modal-overlay",
1900
+ onClick: (e) => {
1901
+ if (e.target.classList.contains("modal-overlay")) fetch("/release/api/history").then((r) => r.json()).then((data) => {
1902
+ d({
1903
+ type: "SET_HISTORY",
1904
+ history: Array.isArray(data) ? data : []
1905
+ });
1906
+ d({ type: "HIDE_NEW_MODAL" });
1907
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1908
+ },
1909
+ children: /* @__PURE__ */ jsxDEV("div", {
1910
+ class: "modal-content",
1911
+ children: [/* @__PURE__ */ jsxDEV("div", {
1912
+ class: "modal-header",
1913
+ children: [/* @__PURE__ */ jsxDEV("span", {
1914
+ class: "modal-title",
1915
+ children: t("web.newModalTitle")
1916
+ }), /* @__PURE__ */ jsxDEV("button", {
1917
+ class: "modal-close",
1918
+ type: "button",
1919
+ onClick: () => {
1920
+ fetch("/release/api/history").then((r) => r.json()).then((data) => {
1921
+ d({
1922
+ type: "SET_HISTORY",
1923
+ history: Array.isArray(data) ? data : []
1924
+ });
1925
+ d({ type: "HIDE_NEW_MODAL" });
1926
+ }).catch(() => d({ type: "HIDE_NEW_MODAL" }));
1927
+ },
1928
+ children: "✕"
1929
+ })]
1930
+ }), /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1931
+ s,
1932
+ d
1933
+ })]
1934
+ })
1935
+ }) : s.history.length > 0 ? /* @__PURE__ */ jsxDEV(HistoryList, {
1936
+ s,
1937
+ d
1938
+ }) : /* @__PURE__ */ jsxDEV(ReleaseFlow, {
1939
+ s,
1940
+ d
1941
+ })
1942
+ ] });
1943
+ };
1944
+ const mount = async (el) => {
1945
+ await initPromise;
1946
+ render(/* @__PURE__ */ jsxDEV(ReleaseClient, {}), el);
1947
+ };
1948
+ //#endregion
1949
+ export { mount };