/
uzer_007
/
Rixea
Обзор
Документация
Войти
/
uzer_007
/
Rixea
Код
Запросы
0
Задачи
Вики
Пакеты
5
Релизы
2
CI/CD
Аналитика
Безопасность
master
web_src/js/features/comp/SearchRepoBox.ts
18 строк
888 B
uzer_007
feat: первая версия Rixea
02 авг 2026, 22:16
02 авг 2026, 22:16
d4f7504
Код
Авторство
О чём код?
import {attachSearchBox} from '../../modules/search.ts'; const {appSubUrl} = window.config; type RepoSearchResponse = {data: Array<{repository: {full_name: string}}>}; export function initCompSearchRepoBox(el: HTMLElement) { const uid = el.getAttribute('data-uid'); const exclusive = el.getAttribute('data-exclusive'); // when set, the selected value is the full "owner/name" rather than the bare repo name, so a cross-owner search can be resolved unambiguously const fullName = el.getAttribute('data-full-name') === 'true'; let url = `${appSubUrl}/repo/search?q={query}&uid=${uid}`; if (exclusive === 'true') url += `&exclusive=true`; attachSearchBox(el, url, (response: RepoSearchResponse) => response.data.map((item) => ({ title: fullName ? item.repository.full_name : item.repository.full_name.split('/')[1], description: item.repository.full_name, }))); }