2022-01-28 22:00:11 +01:00
|
|
|
import $ from 'jquery';
|
|
|
|
|
2021-10-21 09:37:43 +02:00
|
|
|
const {appSubUrl} = window.config;
|
2021-10-16 19:28:04 +02:00
|
|
|
|
|
|
|
export function initOrgTeamSettings() {
|
|
|
|
// Change team access mode
|
|
|
|
$('.organization.new.team input[name=permission]').on('change', () => {
|
|
|
|
const val = $('input[name=permission]:checked', '.organization.new.team').val();
|
|
|
|
if (val === 'admin') {
|
|
|
|
$('.organization.new.team .team-units').hide();
|
|
|
|
} else {
|
|
|
|
$('.organization.new.team .team-units').show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function initOrgTeamSearchRepoBox() {
|
|
|
|
const $searchRepoBox = $('#search-repo-box');
|
|
|
|
$searchRepoBox.search({
|
|
|
|
minCharacters: 2,
|
|
|
|
apiSettings: {
|
2022-04-07 20:59:56 +02:00
|
|
|
url: `${appSubUrl}/repo/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
|
2021-10-16 19:28:04 +02:00
|
|
|
onResponse(response) {
|
|
|
|
const items = [];
|
|
|
|
$.each(response.data, (_i, item) => {
|
|
|
|
items.push({
|
|
|
|
title: item.full_name.split('/')[1],
|
|
|
|
description: item.full_name
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return {results: items};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
searchFields: ['full_name'],
|
|
|
|
showNoResults: false
|
|
|
|
});
|
|
|
|
}
|