Repository navigation
Expand file tree
/
Copy pathdrupal-issue.html
More file actions
716 lines (625 loc) · 25.8 KB
/
Copy pathdrupal-issue.html
File metadata and controls
716 lines (625 loc) · 25.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Drupal Core Issue Picker — DDEV Coder Workspaces</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #0e0e10;
color: #e8e8e8;
line-height: 1.6;
min-height: 100vh;
}
header {
padding: 1.25rem 2rem;
border-bottom: 1px solid #1c1c1e;
display: flex;
align-items: center;
gap: 1rem;
}
header a {
color: #a78bfa;
text-decoration: none;
font-size: 0.9rem;
}
header a:hover { text-decoration: underline; }
/* Separator is aria-hidden (decorative), but still needs visible contrast for sighted users.
#666 on #0e0e10 gives ~3.6:1, meeting WCAG 1.4.3 (Level AA) for UI text.
Previous #444 yielded ~2.3:1 and failed. */
header .sep { color: #666; }
header .title { color: #e8e8e8; font-weight: 600; font-size: 0.9rem; }
.page {
max-width: 640px;
margin: 0 auto;
padding: 3rem 2rem 5rem;
}
h1 {
font-size: 1.75rem;
font-weight: 700;
letter-spacing: -0.02em;
margin-bottom: 0.5rem;
}
.subtitle {
color: #777;
font-size: 1rem;
margin-bottom: 2.5rem;
}
/* ── Input section ───────────────────────────────── */
.input-row {
display: flex;
gap: 0.75rem;
margin-bottom: 2rem;
}
.input-row input {
flex: 1;
background: #161619;
/* #636377 on #161619 gives ~3.5:1, meeting WCAG 1.4.11 Non-text Contrast (Level AA) minimum 3:1.
Previous #2a2a32 yielded ~1.3:1 and failed. */
border: 1px solid #636377;
border-radius: 8px;
padding: 0.7rem 1rem;
color: #e8e8e8;
font-size: 0.95rem;
outline: none;
transition: border-color 0.15s;
}
/* #888 on #161619 gives ~5.9:1 contrast, meeting WCAG 1.4.3 (Level AA) minimum 4.5:1.
Previous #555 yielded ~2.4:1 and failed. */
.input-row input::placeholder { color: #888; }
/* Combined border+outline focus indicator meets WCAG 2.4.11 Focus Appearance (Level AA).
outline: none was an anti-pattern; replaced with a visible 2px offset outline. */
.input-row input:focus {
border-color: #7c5af0;
outline: 2px solid #7c5af0;
outline-offset: 2px;
}
.btn-load {
background: #7c5af0;
color: #fff;
border: none;
border-radius: 8px;
padding: 0.7rem 1.25rem;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: background 0.15s;
}
.btn-load:hover { background: #6d4de0; }
.btn-load:disabled { background: #3a3050; color: #777; cursor: not-allowed; }
/* WCAG 2.4.11 Focus Appearance (Level AA): explicit focus outline prevents relying on the
dim browser default (#21397f) which fails contrast requirements. */
.btn-load:focus-visible {
outline: 2px solid #c4b5fd;
outline-offset: 2px;
}
/* ── Status / error ──────────────────────────────── */
.status {
font-size: 0.9rem;
padding: 0.75rem 1rem;
border-radius: 8px;
margin-bottom: 1.5rem;
display: none;
}
.status.loading {
display: block;
background: #161619;
/* #636377 on #161619 gives ~3.5:1, meeting WCAG 1.4.11 Non-text Contrast (Level AA) minimum 3:1.
Previous #2a2a32 yielded ~1.3:1 and failed. */
border: 1px solid #636377;
color: #999;
}
.status.error {
display: block;
background: #1f0f0f;
border: 1px solid #5a1a1a;
color: #f87171;
}
.status.info {
display: block;
background: #0f1a1f;
border: 1px solid #1a4a5a;
color: #7dd3fc;
}
/* ── Result form ─────────────────────────────────── */
#result-form { display: none; }
.issue-title {
font-size: 1.05rem;
font-weight: 600;
color: #c4b5fd;
margin-bottom: 1.75rem;
padding: 0.75rem 1rem;
background: #13101f;
border: 1px solid #2a2040;
border-radius: 8px;
}
.issue-title span {
display: block;
font-size: 0.75rem;
font-weight: 400;
/* #888 on #13101f gives ~4.9:1, meeting WCAG 1.4.3 (Level AA) minimum 4.5:1 for normal text.
Previous #666 yielded ~3.4:1 and failed. */
color: #888;
margin-bottom: 0.2rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.fields {
display: flex;
flex-direction: column;
gap: 1.25rem;
margin-bottom: 2rem;
}
.field label {
display: block;
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
color: #777;
margin-bottom: 0.4rem;
}
.field select,
.field input[type="text"] {
width: 100%;
background: #161619;
/* #636377 on #161619 gives ~3.5:1 — WCAG 1.4.11 Non-text Contrast (Level AA) requires 3:1.
Previous #2a2a32 yielded ~1.3:1 and failed. */
border: 1px solid #636377;
border-radius: 8px;
padding: 0.65rem 1rem;
color: #e8e8e8;
font-size: 0.95rem;
outline: none;
transition: border-color 0.15s;
appearance: none;
}
.field select {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23777' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 1rem center;
padding-right: 2.5rem;
}
/* WCAG 2.4.11 Focus Appearance (Level AA): visible focus indicator with 3:1 contrast.
Combined border + outline replaces the single border-color change that was easy to miss. */
.field select:focus,
.field input[type="text"]:focus {
border-color: #7c5af0;
outline: 2px solid #7c5af0;
outline-offset: 2px;
}
.field .hint {
font-size: 0.8rem;
/* #888 on #161619 gives ~5.9:1, meeting WCAG 1.4.3 (Level AA) minimum 4.5:1.
Previous #555 yielded ~2.5:1 and failed. */
color: #888;
margin-top: 0.3rem;
}
.btn-open {
width: 100%;
background: #7c5af0;
color: #fff;
border: none;
border-radius: 8px;
padding: 0.85rem 1.5rem;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
}
.btn-open:hover { background: #6d4de0; }
/* WCAG 2.4.11 Focus Appearance (Level AA) */
.btn-open:focus-visible {
outline: 2px solid #c4b5fd;
outline-offset: 2px;
}
/* ── Manual fallback ─────────────────────────────── */
#manual-form { display: none; }
.manual-notice {
font-size: 0.85rem;
color: #888;
margin-bottom: 1.25rem;
padding: 0.65rem 0.9rem;
background: #111114;
border: 1px solid #222228;
border-radius: 6px;
}
/* ── Notes ───────────────────────────────────────── */
.notes {
margin-top: 2.5rem;
border-top: 1px solid #1c1c1e;
padding-top: 2rem;
}
.notes h2 {
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
/* #888 on #0e0e10 gives ~5.9:1, meeting WCAG 1.4.3 (Level AA) minimum 4.5:1 for normal text.
Previous #555 yielded ~2.6:1 and failed. */
color: #888;
margin-bottom: 0.9rem;
}
.notes ul {
list-style: none;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.notes li {
font-size: 0.88rem;
/* #888 on #0e0e10 gives ~5.9:1 contrast ratio, meeting WCAG 2.2 §1.4.3 (Level AA) minimum 4.5:1 for normal text.
Previous value #666 yielded ~3.6:1 and failed. */
color: #888;
padding-left: 1rem;
position: relative;
}
.notes li::before {
content: '·';
position: absolute;
left: 0;
color: #444;
}
code {
background: #1a1a1f;
border: 1px solid #2a2a30;
padding: 0.1em 0.35em;
border-radius: 4px;
font-family: 'SF Mono', Consolas, monospace;
font-size: 0.85em;
color: #c4b5fd;
}
/* Visually hidden but available to assistive technology.
Use for labels that would be redundant visually but are required for AT.
WCAG 1.3.1 Info and Relationships (Level A) */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* Skip link — visually hidden until focused; lets keyboard users bypass the header nav.
WCAG 2.4.1 Bypass Blocks (Level A) */
.skip-link {
position: absolute;
top: -100%;
left: 1rem;
background: #7c5af0;
color: #fff;
padding: 0.5rem 1rem;
border-radius: 0 0 6px 6px;
font-size: 0.9rem;
font-weight: 600;
text-decoration: none;
z-index: 999;
}
.skip-link:focus { top: 0; }
</style>
</head>
<body>
<!-- WCAG 2.4.1 Bypass Blocks (Level A): skip link lets keyboard users jump past the site header -->
<a class="skip-link" href="#main-content">Skip to main content</a>
<header>
<a href="/">DDEV Coder Workspaces</a>
<!-- Decorative separator — hidden from AT to avoid noise; WCAG 1.3.1 Info and Relationships (Level A) -->
<span class="sep" aria-hidden="true">/</span>
<span class="title">Drupal Core Issue Picker</span>
</header>
<!-- id="main-content" is the skip link target (WCAG 2.4.1) -->
<div class="page" id="main-content">
<h1>Drupal Core Issue Picker</h1>
<p class="subtitle">Enter a Drupal core issue URL or number to launch a pre-configured workspace.</p>
<div class="input-row">
<!-- Explicit <label> associates the field name with the input for screen readers.
Visually hidden because the heading and subtitle already describe the field.
WCAG 1.3.1 Info and Relationships / 3.3.2 Labels or Instructions (Level A) -->
<label for="issue-input" class="sr-only">Issue number or URL</label>
<input type="text" id="issue-input"
placeholder="e.g. 3568144 or https://www.drupal.org/project/drupal/issues/3568144"
autofocus>
<button class="btn-load" id="load-btn" onclick="loadIssue()">Load Issue</button>
</div>
<!-- role="status" announces dynamic updates to screen readers without interrupting current speech.
WCAG 4.1.3 Status Messages (Level AA) -->
<div class="status" id="status" role="status" aria-live="polite"></div>
<!-- Auto-populated form -->
<div id="result-form">
<div class="issue-title">
<span>Issue</span>
<span id="issue-title-text"></span>
</div>
<div class="fields">
<div class="field">
<label for="branch-select">Branch</label>
<select id="branch-select"></select>
</div>
<div class="field">
<label for="profile-select">Install Profile</label>
<select id="profile-select">
<option value="demo_umami">demo_umami</option>
<option value="minimal">minimal</option>
<option value="standard">standard</option>
</select>
<div class="hint">demo_umami uses a pre-built database snapshot. Issue fork workspaces always run a full site install regardless of profile.</div>
</div>
<div class="field">
<label for="drupal-version-select">Drupal Version</label>
<select id="drupal-version-select">
<option value="12">12.x (HEAD / upcoming)</option>
<option value="11">11.x (stable)</option>
<option value="10">10.x (stable)</option>
</select>
<div class="hint">Auto-detected from the issue. Sets the DDEV project type (drupal10/11/12).</div>
</div>
<div class="field">
<label for="workspace-name">Workspace Name</label>
<input type="text" id="workspace-name" placeholder="issue-3568144">
<div class="hint">Must be lowercase letters, numbers, and hyphens only.</div>
</div>
</div>
<button class="btn-open" onclick="openWorkspace()">Open Dev Environment</button>
</div>
<!-- Manual fallback form (shown on API error) -->
<div id="manual-form">
<div class="manual-notice">
Could not fetch issue data automatically. Enter values manually below.
</div>
<div class="fields">
<div class="field">
<label for="manual-fork">Issue Fork Name</label>
<input type="text" id="manual-fork" placeholder="drupal-3568144">
<div class="hint">Format: drupal-{issue-number}</div>
</div>
<div class="field">
<label for="manual-branch">Issue Branch</label>
<input type="text" id="manual-branch" placeholder="3568144-editorfilterxss-11.x">
</div>
<div class="field">
<label for="manual-profile">Install Profile</label>
<select id="manual-profile">
<option value="demo_umami">demo_umami</option>
<option value="minimal">minimal</option>
<option value="standard">standard</option>
</select>
</div>
<div class="field">
<label for="manual-drupal-version">Drupal Version</label>
<select id="manual-drupal-version">
<option value="12">12.x (HEAD / upcoming)</option>
<option value="11">11.x (stable)</option>
<option value="10">10.x (stable)</option>
</select>
</div>
<div class="field">
<label for="manual-workspace-name">Workspace Name</label>
<input type="text" id="manual-workspace-name" placeholder="issue-3568144">
</div>
</div>
<button class="btn-open" onclick="openManualWorkspace()">Open Dev Environment</button>
</div>
<div class="notes">
<h2>Notes</h2>
<ul>
<li>Requires a GitHub account — <a href="https://coder.ddev.com/login" style="color:#a78bfa">sign in at coder.ddev.com</a> first</li>
<li>Issue fork workspaces always run a full <code>ddev drush si</code> (branch code may differ from the cached database)</li>
<li>The <code>demo_umami</code> fast path (about a minute) is only used for standard Drupal core without an issue fork</li>
<li>Issue fork must exist on <a href="https://git.drupalcode.org" style="color:#a78bfa">git.drupalcode.org</a> — click "Get push access" on the issue page to create one</li>
</ul>
</div>
<div class="notes" style="margin-top:1.5rem;">
<h2>Feedback & Community</h2>
<p style="color:#999;font-size:0.95rem;line-height:1.7;">Any problems or friction? Create an issue at <a href="https://github.com/ddev/coder-ddev/issues" style="color:#a78bfa;">ddev/coder-ddev</a> or join us for conversation on Drupal Slack <strong>#ddev</strong> or <a href="https://ddev.com/s/discord" style="color:#a78bfa;">DDEV Discord</a>.</p>
</div>
</div>
<script>
const CODER_BASE = 'https://coder.ddev.com';
const CODER_TEMPLATE = 'coder/drupal-core';
let currentIssueFork = '';
let currentNid = '';
let currentDrupalMajor = '12';
function setStatus(msg, type) {
const el = document.getElementById('status');
el.textContent = msg;
el.className = 'status ' + type;
}
function clearStatus() {
const el = document.getElementById('status');
el.className = 'status';
}
function parseIssueNumber(raw) {
const s = raw.trim();
// Plain number
if (/^\d+$/.test(s)) return s;
// URL: .../issues/3568144 or .../issues/3568144/...
const m = s.match(/\/issues\/(\d+)/);
if (m) return m[1];
return null;
}
function sanitizeWorkspaceName(name) {
return name.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
}
async function loadIssue() {
const raw = document.getElementById('issue-input').value;
const nid = parseIssueNumber(raw);
if (!nid) {
setStatus('Could not parse an issue number from that input. Enter a number like 3568144 or a full drupal.org issue URL.', 'error');
return;
}
currentNid = nid;
document.getElementById('result-form').style.display = 'none';
document.getElementById('manual-form').style.display = 'none';
document.getElementById('load-btn').disabled = true;
setStatus('Loading issue ' + nid + '...', 'loading');
try {
// Issue fork name is always drupal-{nid} by convention on git.drupalcode.org
const issueFork = 'drupal-' + nid;
const encodedProject = encodeURIComponent('issue/' + issueFork);
// Step 1: verify fork exists and fetch branches from git.drupalcode.org
setStatus('Loading issue fork ' + issueFork + '...', 'loading');
const branchResp = await fetch(
'https://git.drupalcode.org/api/v4/projects/' + encodedProject + '/repository/branches?per_page=100'
);
if (branchResp.status === 404) {
// Distinguish: issue doesn't exist vs. issue exists but no fork yet
try {
const checkResp = await fetch('https://www.drupal.org/api-d7/node/' + nid + '.json');
if (!checkResp.ok) {
setStatus('Issue #' + nid + ' does not exist on drupal.org. Check the issue number and try again.', 'error');
} else {
// Verify the response is actually a valid node (not a redirect or error page)
let nodeData;
try { nodeData = await checkResp.json(); } catch (_) { nodeData = null; }
const projectName = nodeData && nodeData.field_project && nodeData.field_project.machine_name;
if (!nodeData || String(nodeData.nid) !== String(nid)) {
setStatus('Issue #' + nid + ' does not exist on drupal.org. Check the issue number and try again.', 'error');
} else if (projectName && projectName !== 'drupal') {
setStatus('Issue #' + nid + ' is a ' + projectName + ' issue, not a Drupal core issue. At this time this picker only supports Drupal core.', 'error');
} else {
setStatus('No issue fork exists for #' + nid + ' yet. To work on this issue, visit the issue page on drupal.org and click "Get push access" to create a fork, then come back here.', 'info');
}
}
} catch (_) {
setStatus('Issue #' + nid + ' does not appear to exist on drupal.org. Check the issue number and try again.', 'error');
}
document.getElementById('load-btn').disabled = false;
return;
}
if (!branchResp.ok) throw new Error('git.drupalcode.org API returned ' + branchResp.status);
const branches = await branchResp.json();
currentIssueFork = issueFork;
// Step 2: fetch issue title and version from Drupal.org API (best-effort — don't block on failure)
let title = 'Issue #' + nid;
let drupalMajor = '12';
try {
const issueResp = await fetch('https://www.drupal.org/api-d7/node/' + nid + '.json');
if (issueResp.ok) {
const issue = await issueResp.json();
if (issue.title) title = issue.title;
// field_issue_version is "10.6.x-dev", "11.x-dev", "12.x-dev", or "main"
// "main" means the current development branch (D12+); no leading digit → use 12.
const ver = issue.field_issue_version || '';
const m = ver.match(/^(\d+)\./);
if (m) drupalMajor = m[1];
else if (ver === 'main' || ver.startsWith('12')) drupalMajor = '12';
}
} catch (_) { /* title/version stay as fallback */ }
// Step 2.5: Try to get visible branches from Drupal.org issue page.
// The drupalorgBranchData settings key lists only non-hidden branches (those with MRs).
// Hidden branches exist in GitLab but are suppressed in the Drupal.org UI.
let visibleBranchNames = null;
try {
const pageResp = await fetch('https://www.drupal.org/project/drupal/issues/' + nid);
if (pageResp.ok) {
const html = await pageResp.text();
const settingsMatch = html.match(/<script[^>]+data-drupal-selector="drupal-settings-json"[^>]*>([\s\S]*?)<\/script>/);
if (settingsMatch) {
const settings = JSON.parse(settingsMatch[1]);
if (settings.drupalorgBranchData && Object.keys(settings.drupalorgBranchData).length > 0) {
visibleBranchNames = new Set(Object.keys(settings.drupalorgBranchData));
}
}
}
} catch (_) { /* CORS or parse error — fall through to prefix filter */ }
// Filter to visible branches only:
// - Primary: use Drupal.org's drupalorgBranchData (excludes hidden branches)
// - Fallback: branches matching the issue number prefix (excludes inherited upstream branches)
const issueBranches = visibleBranchNames
? branches.filter(b => visibleBranchNames.has(b.name))
: branches.filter(b => b.name.startsWith(nid + '-'));
// Use filtered list, falling back to all branches only if filtering yields nothing
const displayBranches = issueBranches.length > 0 ? issueBranches : branches;
// Populate branch selector
const branchSelect = document.getElementById('branch-select');
branchSelect.innerHTML = '';
displayBranches.forEach(b => {
const opt = document.createElement('option');
opt.value = b.name;
opt.textContent = b.name;
branchSelect.appendChild(opt);
});
// Pre-select the most recently committed branch (most actively worked on)
const preferred = displayBranches.reduce((best, b) => {
if (!best) return b;
return b.commit.committed_date > best.commit.committed_date ? b : best;
}, null);
if (preferred) branchSelect.value = preferred.name;
// Set issue title with clickable link
const titleEl = document.getElementById('issue-title-text');
titleEl.innerHTML = '';
const issueLink = document.createElement('a');
issueLink.href = 'https://www.drupal.org/project/drupal/issues/' + nid;
issueLink.target = '_blank';
issueLink.textContent = '#' + nid + ': ' + title;
issueLink.style.cssText = 'color: inherit; text-decoration: underline;';
titleEl.appendChild(issueLink);
// Store and display detected Drupal version
currentDrupalMajor = drupalMajor;
document.getElementById('drupal-version-select').value = drupalMajor;
// Pre-fill workspace name
const wsName = document.getElementById('workspace-name');
wsName.value = 'issue-' + nid;
clearStatus();
document.getElementById('result-form').style.display = 'block';
} catch (err) {
console.error(err);
// Show manual fallback
setStatus('Could not load issue data automatically (' + err.message + '). Enter values below.', 'error');
document.getElementById('manual-workspace-name').value = 'issue-' + nid;
document.getElementById('manual-fork').value = 'drupal-' + nid;
document.getElementById('manual-form').style.display = 'block';
}
document.getElementById('load-btn').disabled = false;
}
function buildCoderUrl(issueFork, issueBranch, installProfile, drupalVersion, workspaceName) {
const base = CODER_BASE + '/templates/' + CODER_TEMPLATE + '/workspace';
const params = new URLSearchParams({
mode: 'manual',
name: sanitizeWorkspaceName(workspaceName),
'param.issue_fork': issueFork,
'param.issue_branch': issueBranch,
'param.install_profile': installProfile,
'param.drupal_version': drupalVersion,
});
return base + '?' + params.toString();
}
function openWorkspace() {
const branch = document.getElementById('branch-select').value;
const profile = document.getElementById('profile-select').value;
const drupalVersion = document.getElementById('drupal-version-select').value;
const wsName = document.getElementById('workspace-name').value || ('issue-' + currentNid);
if (!currentIssueFork || !branch) {
setStatus('Please load an issue first.', 'error');
return;
}
const url = buildCoderUrl(currentIssueFork, branch, profile, drupalVersion, wsName);
window.open(url, '_blank');
}
function openManualWorkspace() {
const fork = document.getElementById('manual-fork').value.trim();
const branch = document.getElementById('manual-branch').value.trim();
const profile = document.getElementById('manual-profile').value;
const drupalVersion = document.getElementById('manual-drupal-version').value;
const wsName = document.getElementById('manual-workspace-name').value || ('issue-' + currentNid);
if (!fork || !branch) {
setStatus('Issue fork name and branch are required.', 'error');
return;
}
const url = buildCoderUrl(fork, branch, profile, drupalVersion, wsName);
window.open(url, '_blank');
}
// Allow Enter key in input
document.getElementById('issue-input').addEventListener('keydown', function(e) {
if (e.key === 'Enter') loadIssue();
});
</script>
</body>
</html>