Merge pull request #14532 from grafana/fixes-to-user-and-team-picker

Fixes issues with user and team picker
This commit is contained in:
Torkel Ödegaard 2018-12-17 14:56:05 +01:00 committed by GitHub
commit cfae98fae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react';
import _ from 'lodash';
import { AsyncSelect } from './Select';
import { debounce } from 'lodash';
import { getBackendSrv } from 'app/core/services/backend_srv';
@ -37,6 +38,10 @@ export class TeamPicker extends Component<Props, State> {
const backendSrv = getBackendSrv();
this.setState({ isLoading: true });
if (_.isNil(query)) {
query = '';
}
return backendSrv.get(`/api/teams/search?perpage=10&page=1&query=${query}`).then(result => {
const teams = result.teams.map(team => {
return {

View File

@ -1,5 +1,6 @@
// Libraries
import React, { Component } from 'react';
import _ from 'lodash';
// Components
import { AsyncSelect } from './Select';
@ -38,6 +39,10 @@ export class UserPicker extends Component<Props, State> {
const backendSrv = getBackendSrv();
this.setState({ isLoading: true });
if (_.isNil(query)) {
query = '';
}
return backendSrv
.get(`/api/org/users?query=${query}&limit=10`)
.then(result => {