2022-01-29 00:00:11 +03:00
|
|
|
import $ from 'jquery';
|
|
|
|
|
2021-10-21 10:37:43 +03:00
|
|
|
const {appSubUrl} = window.config;
|
2021-10-16 20:28:04 +03:00
|
|
|
|
|
|
|
export function initOrgTeamSearchRepoBox() {
|
|
|
|
const $searchRepoBox = $('#search-repo-box');
|
|
|
|
$searchRepoBox.search({
|
|
|
|
minCharacters: 2,
|
|
|
|
apiSettings: {
|
2022-04-07 21:59:56 +03:00
|
|
|
url: `${appSubUrl}/repo/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
|
2021-10-16 20:28:04 +03:00
|
|
|
onResponse(response) {
|
|
|
|
const items = [];
|
|
|
|
$.each(response.data, (_i, item) => {
|
|
|
|
items.push({
|
2023-05-14 00:59:01 +03:00
|
|
|
title: item.repository.full_name.split('/')[1],
|
2024-03-22 17:06:53 +03:00
|
|
|
description: item.repository.full_name,
|
2021-10-16 20:28:04 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return {results: items};
|
2024-03-22 17:06:53 +03:00
|
|
|
},
|
2021-10-16 20:28:04 +03:00
|
|
|
},
|
|
|
|
searchFields: ['full_name'],
|
2024-03-22 17:06:53 +03:00
|
|
|
showNoResults: false,
|
2021-10-16 20:28:04 +03:00
|
|
|
});
|
|
|
|
}
|