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