mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
Refactoring
This commit is contained in:
@@ -55,32 +55,32 @@ class CreatePermissionForm extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadUserAutocompletion = (inputValue: string) => {
|
loadUserAutocompletion = (inputValue: string) => {
|
||||||
const url = this.props.userAutoCompleteLink + "?q=";
|
return this.loadAutocompletion(this.props.userAutoCompleteLink, inputValue);
|
||||||
return fetch(url + inputValue)
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(json => {
|
|
||||||
return json.map(element => {
|
|
||||||
return {
|
|
||||||
value: element,
|
|
||||||
label: `${element.displayName} (${element.id})`
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
loadGroupAutocompletion = (inputValue: string) => {
|
loadGroupAutocompletion = (inputValue: string) => {
|
||||||
const url = this.props.groupAutoCompleteLink + "?q=";
|
return this.loadAutocompletion(
|
||||||
return fetch(url + inputValue)
|
this.props.groupAutoCompleteLink,
|
||||||
|
inputValue
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
loadAutocompletion(url: string, inputValue: string) {
|
||||||
|
const link = url + "?q=";
|
||||||
|
return fetch(link + inputValue)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(json => {
|
.then(json => {
|
||||||
return json.map(element => {
|
return json.map(element => {
|
||||||
|
const label = element.displayName
|
||||||
|
? `${element.displayName} (${element.id})`
|
||||||
|
: element.id;
|
||||||
return {
|
return {
|
||||||
value: element,
|
value: element,
|
||||||
label: `${element.displayName} (${element.id})`
|
label
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
renderAutocompletionField = () => {
|
renderAutocompletionField = () => {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
if (this.state.groupPermission) {
|
if (this.state.groupPermission) {
|
||||||
|
|||||||
Reference in New Issue
Block a user