Skip to content

Commit 7e90997

Browse files
committed
fixes from staging deploy
1 parent 8ea09bb commit 7e90997

3 files changed

Lines changed: 39 additions & 7 deletions

File tree

preview-src/ui-model.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ site:
99
[
1010
{ "title": "Server", "startPage": "home::server.adoc", "components": ["server", "*-connector"], "url": "/index.html", "color": "#c41016" },
1111
{ "title": "Develop",
12-
"subPages": [
12+
"subGroups": [
1313
{
1414
"title": "Mobile",
1515
"startPage": "home::mobile.adoc",
@@ -19,8 +19,8 @@ site:
1919
{
2020
"title": "Cloud",
2121
"startPage": "home::cloud.adoc",
22-
"components": ["operator"],
23-
"url": "#"
22+
"components": ["cloud"],
23+
"url": "/cloud/index.html"
2424
}
2525
]
2626
}
@@ -167,6 +167,15 @@ site:
167167
url: /couchbase-lite/2.1/index.html
168168
sync-gateway:
169169
url: /sync-gateway/2.1/index.html
170+
cloud:
171+
# continuously-deployed/unversioned component -- exercises the search
172+
# catalog's handling of a genuine empty-string version (e.g. Capella)
173+
versions:
174+
- &latest_cloud
175+
version: ''
176+
title: Capella
177+
url: /cloud/index.html
178+
latest: *latest_cloud
170179
home:
171180
latest: &home_latest
172181
version: ''

src/helpers/search-catalog.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,18 @@ module.exports = (
8787
// playbook) -- subGroups/components deliberately carry none of their own
8888
// here, and the client is what walks this tree inheriting a parent's color
8989
// down, same as this data looked when it was still a hand-maintained mock.
90+
//
91+
// components is only set when the group actually has direct components
92+
// (never an empty array) -- the client tells "leaf group" apart from
93+
// "subGroups-holding group" with a plain truthiness check, and an empty
94+
// array is truthy in JS, so a subGroups-only group like "Develop" would
95+
// otherwise wrongly look like an (empty) leaf and never recurse.
9096
function serializeGroup (group) {
9197
return {
9298
title: group.title,
9399
url: group.url,
94100
color: group.color,
95-
components: (group.components || []).map(serializeComponent),
101+
components: group.components && group.components.length ? group.components.map(serializeComponent) : undefined,
96102
latestVersions: group.latestVersions,
97103
subGroups: group.subGroups ? group.subGroups.map(serializeGroup) : undefined,
98104
}

src/js/13-docsearch.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,34 @@
123123
return undefined
124124
}
125125

126+
// A continuously-deployed/unversioned component (Capella, AI Data Plane,
127+
// etc.) has a genuine version of "" in Antora, not a missing one -- a
128+
// plain truthiness check would silently drop it (same reasoning as the
129+
// ['', 'master'].includes(...) checks elsewhere in this file, just
130+
// inverted: there, '' means "don't show a redundant version picker";
131+
// here, '' must still count as "this component has a real, includable
132+
// version").
133+
function hasVersion (versionMap, name) {
134+
return versionMap && Object.prototype.hasOwnProperty.call(versionMap, name)
135+
}
136+
126137
function computeDefaultRefinement () {
127138
var pageUrl = metaContent('page-url')
128139
var landingGroup = pageUrl ? findGroupByUrl(componentCatalog.navGroups, pageUrl) : undefined
129140
if (landingGroup) {
130-
return landingGroup.components
131-
.filter(function (c) { return landingGroup.latestVersions && landingGroup.latestVersions[c.name] })
141+
return (landingGroup.components || [])
142+
.filter(function (c) { return hasVersion(landingGroup.latestVersions, c.name) })
132143
.map(function (c) { return c.name + '@' + landingGroup.latestVersions[c.name] })
133144
}
134145
var component = metaContent('docsearch:component')
135146
var version = metaContent('docsearch:cversion')
136-
return component && version ? [component + '@' + version] : []
147+
// "home" pages are landing/informational content (the site index, and
148+
// every home::*.adoc category landing page not already caught above by
149+
// its own group's url match) -- nav-group-for-page.js already treats
150+
// these as belonging to no specific group for the same reason, so don't
151+
// default search to "home"'s own (largely meaningless) component here.
152+
if (!component || component === 'home' || version === undefined) return []
153+
return [component + '@' + version]
137154
}
138155

139156
// The refinementList widget only ever exposes component_version values that

0 commit comments

Comments
 (0)