mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Rewriting team pages in react * teams to react progress * teams: getting team by id returns same DTO as search, needed for AvatarUrl * teams: progress on new team pages * fix: team test * listing team members and removing team members now works * teams: team member page now works * ux: fixed adding team member issue * refactoring TeamPicker to conform to react coding styles better * teams: very close to being done with team page rewrite * minor style tweak * ux: polish to team pages * feature: team pages in react & everything working * fix: removed flickering when changing tabs by always rendering PageHeader
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import React, { Component } from 'react';
|
|
import Select from 'react-select';
|
|
import DescriptionOption from './DescriptionOption';
|
|
|
|
export interface Props {
|
|
optionsWithDesc: OptionWithDescription[];
|
|
onSelected: (permission) => void;
|
|
value: number;
|
|
disabled: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
export interface OptionWithDescription {
|
|
value: any;
|
|
label: string;
|
|
description: string;
|
|
}
|
|
|
|
class DescriptionPicker extends Component<Props, any> {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {};
|
|
}
|
|
|
|
render() {
|
|
const { optionsWithDesc, onSelected, value, disabled, className } = this.props;
|
|
|
|
return (
|
|
<div className="permissions-picker">
|
|
<Select
|
|
value={value}
|
|
valueKey="value"
|
|
multi={false}
|
|
clearable={false}
|
|
labelKey="label"
|
|
options={optionsWithDesc}
|
|
onChange={onSelected}
|
|
className={`width-7 gf-form-input gf-form-input--form-dropdown ${className || ''}`}
|
|
optionComponent={DescriptionOption}
|
|
placeholder="Choose"
|
|
disabled={disabled}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default DescriptionPicker;
|