Skip to content

Commit

Permalink
fix: still see name-related breadcrumbs and short-name header with fe…
Browse files Browse the repository at this point in the history
…ature flag sidecarName 'heroText'

Fixes #5013
  • Loading branch information
myan9 authored and starpit committed Jun 26, 2020
1 parent bf67173 commit 5da847d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Expand Up @@ -181,23 +181,26 @@ export default class TopNavSidecar extends BaseSidecar<MultiModalResponse, Histo
return { 'flex-direction': 'column' }
}

/** return the name from the response */
private name(): string {
/** return the pretty name or unadulterated name from the response */
private prettyName(): string {
return (
this.current.response &&
(this.current.response.prettyName ||
(this.current.response.metadata ? this.current.response.metadata.name : undefined))
)
}

/** display the unadulterated name from the response as sidecar header */
private namePart() {
if (this.context.sidecarName === 'heroText') {
return (
<div className="header-left-bits">
<div className="sidecar-header-text">
<div className="sidecar-header-name" data-base-class="sidecar-header-name">
<div className="sidecar-header-name-content" data-base-class="sidecar-header-name-content">
{this.name()}
{this.current.response && this.current.response.metadata
? this.current.response.metadata.name
: undefined}
</div>
</div>
</div>
Expand Down Expand Up @@ -344,15 +347,13 @@ export default class TopNavSidecar extends BaseSidecar<MultiModalResponse, Histo

/** show name as breadcrumb when not showing context as hero text in sidecar header */
private nameBreadcrumb(): BreadcrumbView {
if (this.context.sidecarName === 'breadcrumb') {
const { onclick } = this.current.response

return {
label: this.name(),
command: onclick && onclick.name,
isCurrentPage: true,
className: 'kui--sidecar-entity-name'
}
const { onclick } = this.current.response

return {
label: this.prettyName(),
command: onclick && onclick.name,
isCurrentPage: true,
className: 'kui--sidecar-entity-name'
}
}

Expand Down Expand Up @@ -390,14 +391,13 @@ export default class TopNavSidecar extends BaseSidecar<MultiModalResponse, Histo
return <div />
}

const nameBreadCrumbs =
this.context.sidecarName === 'breadcrumb'
? [this.nameBreadcrumb(), this.versionBreadcrumb(), this.nameHashBreadcrumb()]
: []

try {
const breadcrumbs = [
this.namespaceBreadcrumb(),
this.kindBreadcrumb(),
this.nameBreadcrumb(),
this.versionBreadcrumb(),
this.nameHashBreadcrumb()
].filter(_ => _)
const breadcrumbs = [this.namespaceBreadcrumb(), this.kindBreadcrumb()].concat(nameBreadCrumbs).filter(_ => _)

// Note: data-view helps with tests
return (
Expand Down
16 changes: 8 additions & 8 deletions plugins/plugin-client-test/src/test/response/mmr-name.ts
Expand Up @@ -38,18 +38,18 @@ const testPrettyName = new TestMMR({
})

testMetadataName.name({
nameHash: 'this is the namehash part',
// nameHash: 'this is the namehash part',
heroName: true,
onclick: {
nameHash: { command: 'test string --grumble 1', expect: 'hello world 1' }
}
// onclick: {
// nameHash: { command: 'test string --grumble 1', expect: 'hello world 1' }
// }
})

testPrettyName.name({
nameHash: 'this is the namehash part',
prettyName: 'this is the prettyName part',
// prettyName: 'this is the prettyName part',
heroName: true,
onclick: {
nameHash: { command: 'test string --grumble 1', expect: 'hello world 1' }
}
// onclick: {
// nameHash: { command: 'test string --grumble 1', expect: 'hello world 1' }
// }
})
8 changes: 4 additions & 4 deletions plugins/plugin-client-test/src/test/response/mmr-namespace.ts
Expand Up @@ -32,11 +32,11 @@ const test = new TestMMR({
})

test.name({
nameHash: 'this is the namehash part',
// nameHash: 'this is the namehash part',
heroName: true,
onclick: {
nameHash: { command: 'test string --grumble 3', expect: 'hello world 3' }
}
// onclick: {
// nameHash: { command: 'test string --grumble 3', expect: 'hello world 3' }
// }
})

test.namespace({
Expand Down

0 comments on commit 5da847d

Please sign in to comment.