Show virtual parallel_fetch in UI and TUI (#173)
Virtuals carry a `parallel_fetch` flag in the v2 API, but the UI type omits it and neither the UI nor the TUI displays it, so the setting is invisible to operators. - add `parallel_fetch` to the TS `Virtual` type - add a Parallel column with a yellow badge to the UI virtuals table - use one `selected` lookup for the virtual detail panel - add a parallel column to the TUI virtuals list, padding the member count (`%3d members`) so columns align Reviewed-on: #173 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #173.
This commit is contained in:
@@ -109,8 +109,12 @@ func (m *model) viewVirtualsList() string {
|
||||
}
|
||||
|
||||
for i, v := range m.virtuals {
|
||||
line := fmt.Sprintf(" %-25s %-12s %d members %s",
|
||||
v.Name, v.PackageType, len(v.Members), v.Description)
|
||||
parallel := "-"
|
||||
if v.ParallelFetch {
|
||||
parallel = "parallel"
|
||||
}
|
||||
line := fmt.Sprintf(" %-25s %-12s %3d members %-8s %s",
|
||||
v.Name, v.PackageType, len(v.Members), parallel, v.Description)
|
||||
if i == m.cursor {
|
||||
sb.WriteString(selStyle.Render(line))
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface Virtual {
|
||||
description: string;
|
||||
members: string[];
|
||||
managed_by: string;
|
||||
parallel_fetch: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
+23
-21
@@ -26,6 +26,8 @@ export function Virtuals() {
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
const selected = virtuals.find(x => x.name === expanded);
|
||||
|
||||
function memberLink(name: string) {
|
||||
const remote = remoteMap[name];
|
||||
if (remote?.repo_type === 'local') {
|
||||
@@ -67,6 +69,13 @@ export function Virtuals() {
|
||||
header: 'Description',
|
||||
render: (v: Virtual) => v.description || <span className="text-muted">—</span>,
|
||||
},
|
||||
{
|
||||
key: 'parallel',
|
||||
header: 'Parallel',
|
||||
render: (v: Virtual) =>
|
||||
v.parallel_fetch ? <Badge variant="yellow">parallel</Badge> : <span className="text-muted">—</span>,
|
||||
width: '100px',
|
||||
},
|
||||
{
|
||||
key: 'managed',
|
||||
header: 'Managed',
|
||||
@@ -81,30 +90,23 @@ export function Virtuals() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{expanded && (
|
||||
{selected && (
|
||||
<div className="virtual-detail-panel">
|
||||
<h3 className="section-label">Members of {expanded}</h3>
|
||||
<h3 className="section-label">Members of {selected.name}</h3>
|
||||
<ul className="member-list">
|
||||
{virtuals
|
||||
.find(v => v.name === expanded)
|
||||
?.members?.map((m, i) => {
|
||||
const remote = remoteMap[m];
|
||||
const typeLabel = remote?.repo_type === 'local' ? 'local' : 'remote';
|
||||
return (
|
||||
<li key={m}>
|
||||
<span className="member-priority">{i + 1}</span>
|
||||
<Link to={memberLink(m)} className="mono">{m}</Link>
|
||||
<Badge variant={typeLabel === 'local' ? 'yellow' : 'default'}>{typeLabel}</Badge>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
{selected.members?.map((m, i) => {
|
||||
const remote = remoteMap[m];
|
||||
const typeLabel = remote?.repo_type === 'local' ? 'local' : 'remote';
|
||||
return (
|
||||
<li key={m}>
|
||||
<span className="member-priority">{i + 1}</span>
|
||||
<Link to={memberLink(m)} className="mono">{m}</Link>
|
||||
<Badge variant={typeLabel === 'local' ? 'yellow' : 'default'}>{typeLabel}</Badge>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
{(() => {
|
||||
const v = virtuals.find(x => x.name === expanded);
|
||||
return v ? (
|
||||
<UsageInstructions packageType={v.package_type} repoClass="virtual" name={v.name} defaultOpen />
|
||||
) : null;
|
||||
})()}
|
||||
<UsageInstructions packageType={selected.package_type} repoClass="virtual" name={selected.name} defaultOpen />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user