Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed-19113-customers-identities-table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Customers: a profile shows its identities as a compact table (Type, Identity, Source, with the row actions in the last column) instead of one bordered box per identity. At phone width the table scrolls inside its own frame, not the page. Same data, actions and empty state.
1 change: 1 addition & 0 deletions src/pkg/dashboard/customers_ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ must(list.includes('data-action="customersAccept"') && list.includes('data-actio
must(list.includes('data-arg0="me"') && list.includes('data-arg0="p_abc"'), 'list rows do not open me and the customer');
must(!list.includes('<b>Ada</b>') && list.includes('&lt;b&gt;Ada&lt;/b&gt;'), 'a name reached the page unescaped');
must(prof.includes('data-action="customersForget"'), 'owner profile lacks Forget');
must(prof.includes('<table class="customers-ident-table"') && prof.includes('<th scope="col">Identity</th>') && prof.includes('<th scope="row" class="customers-ident-value">') && prof.includes('data-action="customersIdentityRemove"') && prof.includes('<th scope="col">Source</th>'), 'identities are not a table with headers, a row header and row actions');
must(customersFlagEmoji('DE') === '\u{1F1E9}\u{1F1EA}' && customersFlagEmoji('de') === '' && customersFlagEmoji('<b>') === '' && customersFlagEmoji(null) === '', 'flag emoji');
must(list.includes('class="kc-pill customers-pill customers-country" role="img" aria-label="Country: ') && list.includes(' DE</span>'), 'the row lacks the country pill with its text code and accessible name');
must(customersCountryPill({ profile: { country: { value: '<b>' } } }) === '' && customersCountryPill({}) === '', 'a malformed or missing country must render nothing');
Expand Down
7 changes: 7 additions & 0 deletions src/pkg/dashboard/static-src/css/customers.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/pkg/dashboard/static-src/js/customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,17 @@
if (!fixed) {
buttons += '<button type="button" class="hv-btn btn-secondary btn-sm" data-action="customersIdentityRemove" data-arg0="' + escapeHtml(key) + '">Remove</button>';
}
return '<div class="customers-row" data-claimed="' + (i.claimed ? 'true' : 'false') + '"><span class="badge">' + escapeHtml(CUSTOMERS_KIND_LABELS[i.kind] || i.kind) + '</span>' +
'<div class="customers-row-main"><div class="customers-row-title">' + escapeHtml(i.value) + '</div>' +
(meta.length ? '<div class="muted-xs">' + escapeHtml(meta.join(' · ')) + '</div>' : '') + '</div>' + buttons + '</div>';
return '<tr data-claimed="' + (i.claimed ? 'true' : 'false') + '"><td><span class="badge">' + escapeHtml(CUSTOMERS_KIND_LABELS[i.kind] || i.kind) + '</span></td>' +
'<th scope="row" class="customers-ident-value">' + escapeHtml(i.value) + '</th>' +
'<td class="muted-xs">' + escapeHtml(meta.join(' · ')) + '</td>' +
'<td class="customers-ident-actions">' + buttons + '</td></tr>';
}

function customersIdentitiesHtml(p) {
const ids = p.identities || [];
const note = customersIsFull() ? '' : '<p class="muted-xs">What you add here is shown as unconfirmed until the hive owner or a read-write user confirms it.</p>';
return '<div class="customers-block"><div class="section-label m-0">Identities</div>' + note +
'<div class="customers-list">' + (ids.length ? ids.map(i => customersIdentityRowHtml(p, i)).join('') : '<p class="empty-dashed">No identities.</p>') + '</div>' +
(ids.length ? '<div class="customers-table-wrap"><table class="customers-ident-table"><thead><tr><th scope="col">Type</th><th scope="col">Identity</th><th scope="col">Source</th><th scope="col" aria-label="Actions"></th></tr></thead><tbody>' + ids.map(i => customersIdentityRowHtml(p, i)).join('') + '</tbody></table></div>' : '<p class="empty-dashed">No identities.</p>') +
'<div class="customers-inline"><label>Known by<select class="kb-search-box" data-customers-field="identity-kind">' + customersKindOptions() + '</select></label>' +
'<label>Login, address or id<input class="kb-search-box" type="text" maxlength="254" data-customers-field="identity-value" autocomplete="off"></label>' +
'<button type="button" class="hv-btn btn-secondary btn-sm" data-action="customersIdentityAdd">Add identity</button></div></div>';
Expand Down
16 changes: 12 additions & 4 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6517,6 +6517,13 @@
.customers-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); min-width: 0; max-width: 100%; }
.customers-row[data-me="true"] { border-color: var(--accent); }
.customers-row .customers-row-title { overflow-wrap: anywhere; }
/* Identities table: one aligned grid; it scrolls inside its own wrapper at phone width, never the page. */
.customers-table-wrap { max-width: 100%; overflow-x: auto; }
.customers-ident-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.customers-ident-table th, .customers-ident-table td { text-align: left; vertical-align: middle; padding: var(--table-cell-pad-y) var(--table-cell-pad-x); border-bottom: var(--line-width) solid var(--line-subtle); }
.customers-ident-table thead th { color: var(--muted); font-weight: 600; }
.customers-ident-table .customers-ident-value { font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.customers-ident-table .customers-ident-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); border-bottom: 0; }
.customers-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); min-width: 0; }
/* The tag toggle in a profile is the row's tag pill as a button: one pill recipe in both places. Off is dimmed and neutral; the auto marker is small. */
button.kc-pill.customers-tag-toggle { position: relative; font-family: inherit; cursor: pointer; }
Expand Down Expand Up @@ -54499,16 +54506,17 @@ <h3 class="modal-h">How Agents Use Knowledge (Priming)</h3>
if (!fixed) {
buttons += '<button type="button" class="hv-btn btn-secondary btn-sm" data-action="customersIdentityRemove" data-arg0="' + escapeHtml(key) + '">Remove</button>';
}
return '<div class="customers-row" data-claimed="' + (i.claimed ? 'true' : 'false') + '"><span class="badge">' + escapeHtml(CUSTOMERS_KIND_LABELS[i.kind] || i.kind) + '</span>' +
'<div class="customers-row-main"><div class="customers-row-title">' + escapeHtml(i.value) + '</div>' +
(meta.length ? '<div class="muted-xs">' + escapeHtml(meta.join(' · ')) + '</div>' : '') + '</div>' + buttons + '</div>';
return '<tr data-claimed="' + (i.claimed ? 'true' : 'false') + '"><td><span class="badge">' + escapeHtml(CUSTOMERS_KIND_LABELS[i.kind] || i.kind) + '</span></td>' +
'<th scope="row" class="customers-ident-value">' + escapeHtml(i.value) + '</th>' +
'<td class="muted-xs">' + escapeHtml(meta.join(' · ')) + '</td>' +
'<td class="customers-ident-actions">' + buttons + '</td></tr>';
}

function customersIdentitiesHtml(p) {
const ids = p.identities || [];
const note = customersIsFull() ? '' : '<p class="muted-xs">What you add here is shown as unconfirmed until the hive owner or a read-write user confirms it.</p>';
return '<div class="customers-block"><div class="section-label m-0">Identities</div>' + note +
'<div class="customers-list">' + (ids.length ? ids.map(i => customersIdentityRowHtml(p, i)).join('') : '<p class="empty-dashed">No identities.</p>') + '</div>' +
(ids.length ? '<div class="customers-table-wrap"><table class="customers-ident-table"><thead><tr><th scope="col">Type</th><th scope="col">Identity</th><th scope="col">Source</th><th scope="col" aria-label="Actions"></th></tr></thead><tbody>' + ids.map(i => customersIdentityRowHtml(p, i)).join('') + '</tbody></table></div>' : '<p class="empty-dashed">No identities.</p>') +
'<div class="customers-inline"><label>Known by<select class="kb-search-box" data-customers-field="identity-kind">' + customersKindOptions() + '</select></label>' +
'<label>Login, address or id<input class="kb-search-box" type="text" maxlength="254" data-customers-field="identity-value" autocomplete="off"></label>' +
'<button type="button" class="hv-btn btn-secondary btn-sm" data-action="customersIdentityAdd">Add identity</button></div></div>';
Expand Down
Loading