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