Skip to content

Commit

Permalink
[W-15595110] server list template (#46)
Browse files Browse the repository at this point in the history
* space when no description in server added

* 4.6.8
  • Loading branch information
NazaQuintero authored May 6, 2024
1 parent c3f48d4 commit 0bf363d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ApiDemo extends ApiDemoPage {
["APIC-641", "APIC-641"],
["W-10881270", "W-10881270"],
["async-api26", "AsyncAPI26"],
["asyncApi-2.62", "AsyncAPI26-2"],
].map(
([file, label]) => html`
<anypoint-item data-src="${file}-compact.json">${label}</anypoint-item>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@api-components/api-summary",
"description": "A summary view for an API base on AMF data model",
"version": "4.6.7",
"version": "4.6.8",
"license": "Apache-2.0",
"main": "index.js",
"module": "index.js",
Expand Down
7 changes: 4 additions & 3 deletions src/ApiSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ export class ApiSummary extends AmfHelperMixin(LitElement) {
* whether it's defined in the main API definition or not.
*/
_serversTemplate() {
const { servers } = this;
const { servers, amf } = this;
if (!servers || !servers.length) {
return "";
}
if (servers.length === 1) {
if (servers.length === 1 && !this._isAsyncAPI(amf)) {
return this._baseUriTemplate(servers[0]);
}

Expand All @@ -423,7 +423,8 @@ export class ApiSummary extends AmfHelperMixin(LitElement) {
const description = this._computeDescription(server);
const serverNameTemplate = this._serverNameTemplate(server);
const serverTagsTemplate = this._serverTagsTemplate(server);
return html`<li>
const listItemClass = description ? "" : "without-description";
return html`<li class=${listItemClass}>
${serverNameTemplate} ${uri} ${serverTagsTemplate}
<arc-marked
.markdown=${description}
Expand Down
4 changes: 4 additions & 0 deletions src/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export default css`
max-width: fit-content;
}
.without-description {
margin-bottom: 14px;
}
.server-tag {
display: inline-block;
border: 1px solid var(--anypoint-color-coreBlue2);
Expand Down

0 comments on commit 0bf363d

Please sign in to comment.