Commit e38a04ba by Torkel Ödegaard

Fixes issues with user and team picker

parent 3efaf520
import React, { Component } from 'react'; import React, { Component } from 'react';
import _ from 'lodash';
import { AsyncSelect } from './Select'; import { AsyncSelect } from './Select';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { getBackendSrv } from 'app/core/services/backend_srv'; import { getBackendSrv } from 'app/core/services/backend_srv';
...@@ -37,6 +38,10 @@ export class TeamPicker extends Component<Props, State> { ...@@ -37,6 +38,10 @@ export class TeamPicker extends Component<Props, State> {
const backendSrv = getBackendSrv(); const backendSrv = getBackendSrv();
this.setState({ isLoading: true }); this.setState({ isLoading: true });
if (_.isNil(query)) {
query = '';
}
return backendSrv.get(`/api/teams/search?perpage=10&page=1&query=${query}`).then(result => { return backendSrv.get(`/api/teams/search?perpage=10&page=1&query=${query}`).then(result => {
const teams = result.teams.map(team => { const teams = result.teams.map(team => {
return { return {
......
// Libraries // Libraries
import React, { Component } from 'react'; import React, { Component } from 'react';
import _ from 'lodash';
// Components // Components
import { AsyncSelect } from './Select'; import { AsyncSelect } from './Select';
...@@ -38,6 +39,10 @@ export class UserPicker extends Component<Props, State> { ...@@ -38,6 +39,10 @@ export class UserPicker extends Component<Props, State> {
const backendSrv = getBackendSrv(); const backendSrv = getBackendSrv();
this.setState({ isLoading: true }); this.setState({ isLoading: true });
if (_.isNil(query)) {
query = '';
}
return backendSrv return backendSrv
.get(`/api/org/users?query=${query}&limit=10`) .get(`/api/org/users?query=${query}&limit=10`)
.then(result => { .then(result => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment