File tree Expand file tree Collapse file tree 5 files changed +30
-7
lines changed Expand file tree Collapse file tree 5 files changed +30
-7
lines changed Original file line number Diff line number Diff line change 2222/**
2323 * @typedef {Object } PluginFilter
2424 * @property {import('$commonTypes').Pagination } pager - Pagination
25+ * @property {string[] } [names] - The plugin names
2526 */
2627
2728export default { } ;
Original file line number Diff line number Diff line change 8989 flex : 0 0 fit-content ;
9090 flex-direction : column ;
9191 height : 100% ;
92+ gap : 5px ;
9293
9394 .chat-head-agent {
9495 flex : 0.5 ;
108109 display : flex ;
109110 gap : 5px ;
110111 width : fit-content ;
112+ font-size : 12px ;
111113 }
112114 }
113115 }
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ export async function getPlugins(filter) {
1111 let url = endpoints . pluginListUrl ;
1212 const response = await axios . get ( url , { params : filter ,
1313 paramsSerializer : {
14- dots : true
14+ dots : true ,
15+ indexes : null
1516 }
1617 } ) ;
1718 return response . data ;
Original file line number Diff line number Diff line change 201201 return path? .startsWith (' /' ) ? path .substring (1 ) : path;
202202 };
203203
204- /** @param {string} link */
205- const goToPage = (link ) => {
204+ const goToPage = () => {
206205 globalEventStore .reset ();
207206 }
208207< / script>
231230 < / Link>
232231 < ul class = " sub-menu mm-collapse" >
233232 {#each subMenu .childItems as childItem}
234- < li>< Link href= {childItem .link } on: click= {() => goToPage (childItem . link )}> {$_ (childItem .label )}< / Link>< / li>
233+ < li>< Link href= {childItem .link } on: click= {() => goToPage ()}> {$_ (childItem .label )}< / Link>< / li>
235234 {/ each}
236235 < / ul>
237236 < / li>
238237 {: else }
239- < li>< Link href= {subMenu .link } on: click= {() => goToPage (subMenu . link )}> {$_ (subMenu .label )}< / Link>< / li>
238+ < li>< Link href= {subMenu .link } on: click= {() => goToPage ()}> {$_ (subMenu .label )}< / Link>< / li>
240239 {/ if }
241240 {/ each}
242241 < / ul>
243242 < / li>
244243 {: else }
245244 < li>
246- < Link class = " waves-effect" href= {item .link } on: click= {() => goToPage (item . link )} >
245+ < Link class = " waves-effect" href= {item .link } on: click= {() => goToPage ()} >
247246 < i class = {item .icon } / > < span> {$_ (item .label )}< / span>
248247 < / Link>
249248 < / li>
Original file line number Diff line number Diff line change 22 import Breadcrumb from ' $lib/common/Breadcrumb.svelte' ;
33 import HeadTitle from ' $lib/common/HeadTitle.svelte' ;
44 import Plugins from ' ./plugin-list.svelte' ;
5- import { onMount } from ' svelte' ;
5+ import { onDestroy , onMount } from ' svelte' ;
66 import { getPlugins } from ' $lib/services/plugin-service' ;
77 import { PUBLIC_PLUGIN_DEFAULT_ICON } from ' $env/static/public' ;
88 import PlainPagination from ' $lib/common/PlainPagination.svelte' ;
99 import { _ } from ' svelte-i18n' ;
10+ import { globalEventStore } from ' $lib/helpers/store' ;
11+ import { GlobalEvent } from ' $lib/helpers/enums' ;
1012
1113 const firstPage = 1 ;
1214 const pageSize = 12 ;
2527 /** @type {import('$commonTypes').Pagination} */
2628 let pager = filter .pager ;
2729
30+ /** @type {any} */
31+ let unsubscriber;
32+
2833 onMount (async () => {
2934 await getPagedPlugins ();
35+
36+ unsubscriber = globalEventStore .subscribe ((/** @type {import('$commonTypes').GlobalEvent} */ event ) => {
37+ if (event .name !== GlobalEvent .Search ) return ;
38+
39+ const names = event .payload ? [event .payload ] : undefined ;
40+ filter = {
41+ pager: { page: firstPage, size: pageSize, count: 0 },
42+ names: names
43+ };
44+ getPagedPlugins ();
45+ });
3046 });
3147
48+ onDestroy (() => {
49+ unsubscriber? .();
50+ });
51+
3252 async function getPagedPlugins () {
3353 plugins = await getPlugins (filter);
3454 refresh ();
You can’t perform that action at this time.
0 commit comments