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