flowpilot 0.0.3 → 0.1.16

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