fix(sidebar): no branch line that only repeats the name, any card style (JA-13)

This commit is contained in:
Neil
2026-11-10 22:23:43 -08:00
parent 8f34de95c5
commit 206582aa74
2 changed files with 15 additions and 8 deletions
@@ -11,18 +11,18 @@ const probe = compileCardTemplate(
defs: undefined,
root: {
el: 'Probe',
props: { host: '=vars.hostLabel', identity: '=vars.identityInMeta' }
props: { host: '=vars.hostLabel', identity: '=vars.identityInMeta', branch: '=vars.branch' }
}
},
{
...CARD_PRIMITIVES,
Probe: cardElement<null>(['host', 'identity'], (props) => (
<i>{`${String(props.host)}|${String(props.identity)}`}</i>
Probe: cardElement<null>(['host', 'identity', 'branch'], (props) => (
<i>{`${String(props.host)}|${String(props.identity)}|${String(props.branch)}`}</i>
))
}
)
function facts(host: { kind: string; contextLabel: string | null }, title: string) {
function facts(host: { kind: string; contextLabel: string | null }, title: string, style = 'new') {
return {
ws: {
id: 'w',
@@ -54,7 +54,7 @@ function facts(host: { kind: string; contextLabel: string | null }, title: strin
deleteQuickAction: false
},
options: {
style: 'new',
style,
show: {
host: true,
branch: true,
@@ -88,10 +88,17 @@ describe('default workspace card host row (JA-13)', () => {
it('does not repeat the name as the branch line', () => {
expect(read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, 'ja-hello'))).toContain(
'|false'
'|false|'
)
expect(read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, 'Fix login'))).toContain(
'|true'
'|true|'
)
})
it('classic cards drop the branch line when it is the name too', () => {
const classic = (title: string): string =>
read(facts({ kind: 'runtime', contextLabel: 'Orca Cloud' }, title, 'classic'))
expect(classic('ja-hello')).toMatch(/\|false<\/i>$/)
expect(classic('Fix login')).toMatch(/\|true<\/i>$/)
})
})
@@ -13,7 +13,7 @@
"hostBadge": "vars.hostLabel != null && (!vars.compact || place.showProjectName)",
"metaRow": "!vars.compact",
"detachedInMeta": "vars.metaRow && !vars.folder && ws.detachedHead",
"branch": "!vars.folder && len(ws.branch) > 0 && !vars.newStyle && (!vars.compact || ws.branch != ws.name)",
"branch": "!vars.folder && len(ws.branch) > 0 && !vars.newStyle && ws.branch != ws.name && ws.branch != trim(ws.title)",
"identityInMeta": "vars.newStyle && options.show.branch && ws.identity != null && ws.identity != trim(ws.title)",
"folderInMeta": "vars.newStyle ? options.show.branch && vars.folder && ws.identity != null : vars.folder",
"conflict": "git.conflictOperation == 'cherry-pick'",