2022-01-29 02:30:11 +05:30
|
|
|
import $ from 'jquery';
|
2023-02-19 09:36:14 +05:30
|
|
|
import {hideElem, showElem} from '../utils/dom.js';
|
2022-01-29 02:30:11 +05:30
|
|
|
|
2021-10-21 13:07:43 +05:30
|
|
|
const {appSubUrl} = window.config;
|
2021-10-16 22:58:04 +05:30
|
|
|
|
|
|
|
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') {
|
2023-02-19 09:36:14 +05:30
|
|
|
hideElem($('.organization.new.team .team-units'));
|
2021-10-16 22:58:04 +05:30
|
|
|
} else {
|
2023-02-19 09:36:14 +05:30
|
|
|
showElem($('.organization.new.team .team-units'));
|
2021-10-16 22:58:04 +05:30
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function initOrgTeamSearchRepoBox() {
|
|
|
|
const $searchRepoBox = $('#search-repo-box');
|
|
|
|
$searchRepoBox.search({
|
|
|
|
minCharacters: 2,
|
|
|
|
apiSettings: {
|
2022-04-08 00:29:56 +05:30
|
|
|
url: `${appSubUrl}/repo/search?q={query}&uid=${$searchRepoBox.data('uid')}`,
|
2021-10-16 22:58:04 +05:30
|
|
|
onResponse(response) {
|
|
|
|
const items = [];
|
|
|
|
$.each(response.data, (_i, item) => {
|
|
|
|
items.push({
|
2023-05-14 03:29:01 +05:30
|
|
|
title: item.repository.full_name.split('/')[1],
|
|
|
|
description: item.repository.full_name
|
2021-10-16 22:58:04 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return {results: items};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
searchFields: ['full_name'],
|
|
|
|
showNoResults: false
|
|
|
|
});
|
|
|
|
}
|