Skip to content

Commit 64cfd26

Browse files
committed
add endpoint summary
1 parent 650432c commit 64cfd26

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

resources/common/index.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,24 @@
5050
color: #fff;
5151
min-width: 54px;
5252
text-align: center;
53+
flex-shrink: 0;
54+
}
55+
56+
.endpoint-info {
57+
display: flex;
58+
flex-direction: column;
59+
flex: 1;
5360
}
5461

5562
.endpoint-path {
5663
font-size: 13px;
5764
}
5865

66+
.endpoint-summary {
67+
font-size: 11px;
68+
color: #666;
69+
}
70+
5971
[data-theme=dark] {
6072
#search-dialog::backdrop {
6173
background-color: rgba(255, 255, 255, 0.1);
@@ -95,4 +107,8 @@
95107
.endpoint-path {
96108
color: #ccc;
97109
}
110+
111+
.endpoint-summary {
112+
color: #888;
113+
}
98114
}

resources/common/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SearchDialog {
1414
placeHolder: 'Search endpoints',
1515
data: {
1616
src: this.filterEndpoints(openapi),
17-
keys: ['name'],
17+
keys: ['method', 'path', 'summary'],
1818
},
1919
searchEngine: 'loose',
2020
threshold: 0,
@@ -28,8 +28,11 @@ class SearchDialog {
2828
const li = document.createElement('li')
2929
li.className = 'auto-complete-list-item'
3030
li.innerHTML = `
31-
<span class="method-tag method-${item.value.method.toLowerCase()}">${item.value.method}</span>
32-
<span class="endpoint-path">${item.value.path}</span>
31+
<div class="method-tag method-${item.value.method.toLowerCase()}">${item.value.method}</div>
32+
<div class="endpoint-info">
33+
<div class="endpoint-path">${item.value.path}</div>
34+
<div class="endpoint-summary">${item.value.summary}</div>
35+
</div>
3336
`
3437
list.appendChild(li)
3538
})
@@ -77,11 +80,11 @@ class SearchDialog {
7780
endpoints.push({
7881
method: method.toUpperCase(),
7982
path,
80-
name: `${method.toUpperCase()} ${path}`,
8183
operationId: paths[path][method].operationId,
8284
tag: paths[path][method].tags
8385
? paths[path][method].tags[0]
8486
: 'default',
87+
summary: paths[path][method].summary || '',
8588
})
8689
}
8790
}

0 commit comments

Comments
 (0)