mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
Move away from using toast in the plugin search (#6441)
This commit is contained in:
parent
8f3e6a4d8c
commit
a637921160
2 changed files with 34 additions and 34 deletions
|
@ -9,6 +9,8 @@ import {PackageData} from "../../types/PackageInfo";
|
|||
|
||||
const pluginDefs = require('../../../static/js/pluginfw/plugin_defs');
|
||||
import semver from 'semver';
|
||||
import log4js from 'log4js';
|
||||
const logger = log4js.getLogger('adminPlugins');
|
||||
|
||||
|
||||
exports.socketio = (hookName:string, args:ArgsExpressType, cb:Function) => {
|
||||
|
@ -61,6 +63,7 @@ exports.socketio = (hookName:string, args:ArgsExpressType, cb:Function) => {
|
|||
|
||||
socket.on('search', async (query: QueryType) => {
|
||||
try {
|
||||
if (query.searchTerm) logger.info(`Plugin search: ${query.searchTerm}'`);
|
||||
const results = await search(query.searchTerm, /* maxCacheAge:*/ 60 * 10);
|
||||
let res = Object.keys(results)
|
||||
.map((pluginName) => results[pluginName])
|
||||
|
@ -68,10 +71,9 @@ exports.socketio = (hookName:string, args:ArgsExpressType, cb:Function) => {
|
|||
res = sortPluginList(res, query.sortBy, query.sortDir)
|
||||
.slice(query.offset, query.offset + query.limit);
|
||||
socket.emit('results:search', {results: res, query});
|
||||
} catch (er) {
|
||||
console.error(er);
|
||||
|
||||
socket.emit('results:search', {results: {}, query});
|
||||
} catch (err: any) {
|
||||
logger.error(`Error searching plugins: ${err}`);
|
||||
socket.emit('results:searcherror', {error: err.message, query});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue