17
17
<link rel =" stylesheet" href =" https://unpkg.com/prismjs/themes/prism-tomorrow.css" />
18
18
19
19
<script src =" https://unpkg.com/faker@5.5.3/dist/faker.min.js" referrerpolicy =" no-referrer" ></script >
20
+ <script src =" https://unpkg.com/string-similarity@4.0.2/umd/string-similarity.min.js" referrerpolicy =" no-referrer" ></script >
20
21
21
22
<script src =" https://unpkg.com/vue-markdown@2.2.4/dist/vue-markdown.js" ></script >
22
23
<script src =" https://cdnjs.cloudflare.com/ajax/libs/sql-formatter/3.1.0/sql-formatter.min.js" crossorigin =" anonymous" referrerpolicy =" no-referrer" ></script >
47
48
}
48
49
.dropdown-input , .dropdown-selected {
49
50
width : 100% ;
51
+ font-size :14px ;
50
52
padding : 10px 16px ;
51
53
border : 1px solid transparent ;
52
54
background : #edf2f7 ;
77
79
.dropdown-item {
78
80
display : flex ;
79
81
width : 100% ;
80
- padding : 11 px 16 px ;
82
+ padding : 2 px 6 px ;
81
83
cursor : pointer ;
82
- font-size : 15 ;
84
+ font-size : 12 px ;
83
85
}
84
86
.dropdown-item :hover {
85
87
background : #edf2f7 ;
96
98
</div >
97
99
</nav >
98
100
<div id =" app" v-cloak class =" w-full flex lg:pt-10" >
99
- <aside class =" text-xl text-grey-darkest break-all bg-gray-200 pl-2 h-screen sticky top-1 overflow-auto" style =" width : 25 % " >
101
+ <aside class =" text-xl text-grey-darkest break-all bg-gray-200 pl-2 h-screen sticky top-1 overflow-auto" style =" width : 35 % " >
100
102
<h1 class =" font-light mx-3" >Routes List</h1 >
101
103
<div class =" dropdown" >
102
104
<input
103
105
v-model.trim =" search"
104
- v-chang
105
- class =" dropdown-input shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
106
+ class =" dropdown-input appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
106
107
type =" text"
107
108
placeholder =" Search"
108
109
@focus =" showRoute = true;$event.target.select()"
109
110
@blur =" setTimeout(() => { showRoute = false}, 200)"
110
111
/>
111
112
<div class =" dropdown-list" >
112
113
@foreach ($docs as $index => $doc )
113
- <div v-show =" showRoute" @click =" searched('{{ $doc [" methods" ][0 ] } } ', '{{ $doc [" uri" ] } } ')" class =" dropdown-item" >
114
+ <div v-if =" filter('{{ $doc [" uri" ] } } ')"
115
+ v-show =" showRoute"
116
+ @click =" searched('{{ $doc [" methods" ][0 ] } } ', '{{ $doc [" uri" ] } } ') ; highlightSidebar('{{ $index } } ')"
117
+ class =" dropdown-item" >
114
118
{{ str_replace (' api/' , ' ' , $doc [' uri' ]) } }
115
119
</div >
116
120
@endforeach
@@ -126,10 +130,10 @@ class="dropdown-input shadow appearance-none border rounded w-full py-2 px-3 tex
126
130
<tr >
127
131
<td >
128
132
@if ($previousController [' controller' ] !== $doc [' controller' ] )
129
- <h3 class =" my -2 font-semibold " style = " font-size : 18 px " >{{ str_replace (' Controller' , ' ' , $doc [' controller' ]) } } </h3 >
133
+ <h3 class =" mt -2 font-thin " >{{ str_replace (' Controller' , ' ' , $doc [' controller' ]) } } </h3 >
130
134
@endif
131
135
<a href =" #{{ $doc [' methods' ][0 ] . ' -' . $doc [' uri' ]} }" @click =" highlightSidebar({{ $index } } )" >
132
- <span class =" w-20
136
+ <span class ="
133
137
font-thin
134
138
inline-flex
135
139
items-center
@@ -201,7 +205,7 @@ class="dropdown-input shadow appearance-none border rounded w-full py-2 px-3 tex
201
205
<tbody >
202
206
<tr >
203
207
<td class =" align-left border border-gray-300 pl-2 pr-2 bg-gray-200 font-bold" >Controller</td >
204
- <td class =" align-left border pl-2 pr-2 break-all" >{{ $doc [' controller ' ]} } </td >
208
+ <td class =" align-left border pl-2 pr-2 break-all" >{{ $doc [' controller_full_path ' ]} } </td >
205
209
</tr >
206
210
<tr >
207
211
<td class =" align-left border border-gray-300 pl-2 pr-2 bg-gray-200 font-bold" >Method</td >
@@ -494,6 +498,13 @@ class="my-prism-editor"
494
498
showRoute: false
495
499
},
496
500
methods: {
501
+ filter (uri ) {
502
+ if (! this .search ) {
503
+ return true
504
+ }
505
+ var similarity = stringSimilarity .compareTwoStrings (uri, this .search );
506
+ return similarity > 0.1
507
+ },
497
508
searched (method , uri ) {
498
509
var oldUrl = new URL (document .URL );
499
510
oldUrl .hash = ' #' + method + ' -' + uri;
@@ -567,8 +578,12 @@ class="my-prism-editor"
567
578
doc .queries = error .data [' _lrd' ][' queries' ]
568
579
delete error .data [' _lrd' ]
569
580
}
570
- doc .response = JSON .stringify (error .response .data , null , 2 )
571
- doc .responseCode = error .response .status ;
581
+ doc .loading = false
582
+ if (error && error .response && error .response .data ) {
583
+ doc .response = JSON .stringify (error .response .data , null , 2 )
584
+ doc .responseCode = error .response .status ;
585
+ }
586
+
572
587
doc .responseOk = false
573
588
}).then (function () {
574
589
doc .loading = false
0 commit comments