diff --git a/changelog.d/fixed-15451-tracker-row-pill-helper.md b/changelog.d/fixed-15451-tracker-row-pill-helper.md new file mode 100644 index 0000000000..ae3329211f --- /dev/null +++ b/changelog.d/fixed-15451-tracker-row-pill-helper.md @@ -0,0 +1 @@ +- fix(dashboard): share the PR link → lineage → base-pill assembly between tracker row renderers; correct the tracker.css shrink-priority comment (#15447, #15451) diff --git a/src/pkg/dashboard/stage_tracker_motion_test.go b/src/pkg/dashboard/stage_tracker_motion_test.go index 73f2beb8cb..764fe59c71 100644 --- a/src/pkg/dashboard/stage_tracker_motion_test.go +++ b/src/pkg/dashboard/stage_tracker_motion_test.go @@ -447,6 +447,7 @@ func TestStageTrackerMotionRowStamp(t *testing.T) { jsConstBlock(t, html, "STAGE_TRACKER_ICONS"), stageTrackerActedJS(t, html), jsFunc(t, html, "stageTrackerSubRowHtml"), + jsFunc(t, html, "stageTrackerPRPillsHtml"), jsFunc(t, html, "stageTrackerLinkedPRItem"), jsFunc(t, html, "stageTrackerLinkedPROpen"), jsFunc(t, html, "stageTrackerNestedOpenPRs"), @@ -572,6 +573,7 @@ func TestStageTrackerMotionPreviewSample(t *testing.T) { jsFunc(t, html, "stageTrackerSinceHtml"), stageTrackerActedJS(t, html), jsFunc(t, html, "stageTrackerSubRowHtml"), + jsFunc(t, html, "stageTrackerPRPillsHtml"), jsFunc(t, html, "stageTrackerLinkedPRItem"), jsFunc(t, html, "stageTrackerLinkedPROpen"), jsFunc(t, html, "stageTrackerNestedOpenPRs"), diff --git a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go index 8b5289bc26..7061e1360f 100644 --- a/src/pkg/dashboard/stage_tracker_repo_grouping_test.go +++ b/src/pkg/dashboard/stage_tracker_repo_grouping_test.go @@ -160,6 +160,7 @@ func stageTrackerRepoGroupingHarness(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerHeadColsHtml"), jsFunc(t, html, "stageTrackerSinceHtml"), jsFunc(t, html, "stageTrackerSubRowHtml"), + jsFunc(t, html, "stageTrackerPRPillsHtml"), jsFunc(t, html, "stageTrackerLinkedPRItem"), jsFunc(t, html, "stageTrackerLinkedPROpen"), jsFunc(t, html, "stageTrackerNestedOpenPRs"), diff --git a/src/pkg/dashboard/stage_tracker_ui_test.go b/src/pkg/dashboard/stage_tracker_ui_test.go index f8caa76cab..774abc7fbf 100644 --- a/src/pkg/dashboard/stage_tracker_ui_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_test.go @@ -175,6 +175,7 @@ func stageTrackerRowsPreludeJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerHeadColsHtml"), jsFunc(t, html, "stageTrackerSinceHtml"), jsFunc(t, html, "stageTrackerSubRowHtml"), + jsFunc(t, html, "stageTrackerPRPillsHtml"), jsFunc(t, html, "stageTrackerAgoText"), jsConstBlock(t, html, "STAGE_TRACKER_LINEAGE_REASON_TIP"), jsFunc(t, html, "stageTrackerLineageText"), diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 28a016f164..cade002a7b 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -110,8 +110,8 @@ .ham-head-cols .ham-seg.ham-head-lead { flex: 0 0 calc((100% - 4em - 6 * var(--sp-1)) / 2 + 2 * var(--sp-1)); padding: 0 var(--sp-6) 0 0; } .ham-head-cols .ham-seg.ham-head-lead.ham-head-wide { flex: 1 1 0; } /* The PR cell is one line: connector, author icon + #N + title, lineage - chip and base pill sit side by side; the title gives way first (then - the lineage chip), the pills and the connector never shrink + chip and base pill sit side by side; the lineage chip gives way first + (flex-shrink 2), then the title (1), the pills and the connector never shrink (hivecommons/hive "consolidate from 3 lines of text to 1"). */ .ham-head-cols .ham-seg.ham-head-pr { flex: 1 1 0; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; } .ham-head-cols .ham-seg.ham-head-pr > .ham-linked-ico, .ham-head-cols .ham-seg.ham-head-pr > .ham-badge { flex: 0 0 auto; } diff --git a/src/pkg/dashboard/static-src/js/tracker-row.js b/src/pkg/dashboard/static-src/js/tracker-row.js index 2aeb30bb09..b048e6f487 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row.js +++ b/src/pkg/dashboard/static-src/js/tracker-row.js @@ -1005,6 +1005,10 @@ ctx.nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); return stageTrackerLeadActionHtml(item, ctx); } + // PR link, then the lineage chip (null = none), then the base pill. + function stageTrackerPRPillsHtml(ref, lineage, baseRef) { + return ref + (lineage == null ? '' : ' ' + lineage) + (baseRef ? ` ${esc(baseRef)}` : ''); + } function stageTrackerSubRowHtml(lp, issue, stages, nowMs, ctx) { const pr = stageTrackerLinkedPRItem(issue, lp); const superseded = typeof stageTrackerLinkedSupersededText === 'function' ? stageTrackerLinkedSupersededText(lp, issue) : ''; @@ -1016,8 +1020,7 @@ const lineage = superseded ? '' : ((typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(pr, nowMs) : '')); const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `${chip}${ref}`; - if (lineage) ref += ' ' + lineage; - if (lp.base_ref) ref += ` ${esc(lp.base_ref)}`; + ref = stageTrackerPRPillsHtml(ref, lineage || null, lp.base_ref); ref = STAGE_TRACKER_LINKED_GLYPH + ref; if (superseded) { // The adopted original: one dimmed line, no chevron track, no row @@ -1240,7 +1243,7 @@ // One covering PR: a single entry whose strip the PR's stage drives. const lp = linked[0]; const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : ''); - prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)) + (lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? ' ' + stageTrackerLineageChipHtml(lp, nowMs) : '') + (lp.base_ref ? ` ${esc(lp.base_ref)}` : '')]; + prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)), lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : null, lp.base_ref)]; shown = Object.assign({}, item, { via_pr: true, stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, hold: lp.hold || null, adoption: lp.adoption || null, stage_actor: lp.stage_actor || item.stage_actor || null, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, decided: lp.decided || item.decided || null }); } else if (linked.length) { diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 792f0b45eb..b5b8aed762 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1435,8 +1435,8 @@ .ham-head-cols .ham-seg.ham-head-lead { flex: 0 0 calc((100% - 4em - 6 * var(--sp-1)) / 2 + 2 * var(--sp-1)); padding: 0 var(--sp-6) 0 0; } .ham-head-cols .ham-seg.ham-head-lead.ham-head-wide { flex: 1 1 0; } /* The PR cell is one line: connector, author icon + #N + title, lineage - chip and base pill sit side by side; the title gives way first (then - the lineage chip), the pills and the connector never shrink + chip and base pill sit side by side; the lineage chip gives way first + (flex-shrink 2), then the title (1), the pills and the connector never shrink (hivecommons/hive "consolidate from 3 lines of text to 1"). */ .ham-head-cols .ham-seg.ham-head-pr { flex: 1 1 0; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: var(--sp-2); min-width: 0; overflow: hidden; } .ham-head-cols .ham-seg.ham-head-pr > .ham-linked-ico, .ham-head-cols .ham-seg.ham-head-pr > .ham-badge { flex: 0 0 auto; } @@ -16573,6 +16573,10 @@

Where to get help

ctx.nowMs = typeof nowMs === 'number' ? nowMs : Date.now(); return stageTrackerLeadActionHtml(item, ctx); } + // PR link, then the lineage chip (null = none), then the base pill. + function stageTrackerPRPillsHtml(ref, lineage, baseRef) { + return ref + (lineage == null ? '' : ' ' + lineage) + (baseRef ? ` ${esc(baseRef)}` : ''); + } function stageTrackerSubRowHtml(lp, issue, stages, nowMs, ctx) { const pr = stageTrackerLinkedPRItem(issue, lp); const superseded = typeof stageTrackerLinkedSupersededText === 'function' ? stageTrackerLinkedSupersededText(lp, issue) : ''; @@ -16584,8 +16588,7 @@

Where to get help

const lineage = superseded ? '' : ((typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(pr, nowMs) : '') || (typeof stageTrackerAdoptedFromChipHtml === 'function' ? stageTrackerAdoptedFromChipHtml(pr, nowMs) : '')); const chip = ctx && ctx.repoChips ? stageTrackerRepoChipHtml(pr.repo, ctx) : ''; if (chip) ref = `${chip}${ref}`; - if (lineage) ref += ' ' + lineage; - if (lp.base_ref) ref += ` ${esc(lp.base_ref)}`; + ref = stageTrackerPRPillsHtml(ref, lineage || null, lp.base_ref); ref = STAGE_TRACKER_LINKED_GLYPH + ref; if (superseded) { // The adopted original: one dimmed line, no chevron track, no row @@ -16808,7 +16811,7 @@

Where to get help

// One covering PR: a single entry whose strip the PR's stage drives. const lp = linked[0]; const who = (lp.author_kind || 'hive') + (lp.author ? ' · @' + lp.author : ''); - prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)) + (lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? ' ' + stageTrackerLineageChipHtml(lp, nowMs) : '') + (lp.base_ref ? ` ${esc(lp.base_ref)}` : '')]; + prRefs = [STAGE_TRACKER_LINKED_GLYPH + stageTrackerPRPillsHtml(stageTrackerPRRef(lp.number, lp.url, lp.author_kind || '', lp.author, lp.title, (lp.title ? lp.title + '\n' : '') + 'Author: ' + who + ' · ' + stageTrackerLinkedTip(item, lp.number, ctx)), lp.lineage && typeof stageTrackerLineageChipHtml === 'function' ? stageTrackerLineageChipHtml(lp, nowMs) : null, lp.base_ref)]; shown = Object.assign({}, item, { via_pr: true, stage: lp.stage || 40, stage_since: lp.stage_since || item.stage_since, modifiers: lp.modifiers || item.modifiers, deferred_modifiers: lp.deferred_modifiers || item.deferred_modifiers || [], caption: lp.caption || item.caption, reason: lp.reason || item.reason, human_approver: lp.human_approver || '', manual_merge: !!lp.manual_merge, human_merge_reason: lp.human_merge_reason || '', human_merge_reason_text: lp.human_merge_reason_text || '', sentinel_alert: !!lp.sentinel_alert, sentinel_reason: lp.sentinel_reason || '', head: lp.head || '', decision_needed: lp.decision_needed || null, hold: lp.hold || null, adoption: lp.adoption || null, stage_actor: lp.stage_actor || item.stage_actor || null, claimant: lp.claimant || null, presence: lp.presence || null, rework: lp.rework || null, merge_gate: lp.merge_gate || null, merge_train: lp.merge_train || null, decided: lp.decided || item.decided || null }); } else if (linked.length) {