Sync UserProfile interface in kbn/user-profile-components package with the one in Security plugin. (#138704)

This commit is contained in:
Aleh Zasypkin 2022-08-12 21:56:13 +02:00 committed by GitHub
parent 5188e4b63e
commit c868daad50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 2 deletions

View file

@ -8,11 +8,13 @@
import React, { FunctionComponent } from 'react';
import { EuiTitle, EuiSpacer } from '@elastic/eui';
import { UserAvatar } from '@kbn/user-profile-components';
import type { UserProfile, UserProfileAvatarData } from '@kbn/user-profile-components';
import { PanelWithCodeBlock } from './panel_with_code_block';
export const AvatarDemo: FunctionComponent = () => {
const userProfile = {
const userProfile: UserProfile<{ avatar: UserProfileAvatarData }> = {
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
enabled: true,
user: {
username: 'delighted_nightingale',
email: 'delighted_nightingale@elastic.co',
@ -49,6 +51,7 @@ const code = `import { UserAvatar } from '@kbn/user-profile-components';
const userProfile = {
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
enabled: true,
user: {
username: 'delighted_nightingale',
email: 'delighted_nightingale@elastic.co',

View file

@ -15,6 +15,7 @@ export const PopoverDemo: FunctionComponent = () => {
const [selectedOptions, setSelectedOptions] = useState<UserProfileWithAvatar[]>([
{
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
enabled: true,
data: {},
user: {
username: 'delighted_nightingale',
@ -26,6 +27,7 @@ export const PopoverDemo: FunctionComponent = () => {
const defaultOptions: UserProfileWithAvatar[] = [
{
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
enabled: true,
data: {},
user: {
username: 'damaged_raccoon',
@ -35,6 +37,7 @@ export const PopoverDemo: FunctionComponent = () => {
},
{
uid: 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0',
enabled: true,
data: {},
user: {
username: 'physical_dinosaur',
@ -44,6 +47,7 @@ export const PopoverDemo: FunctionComponent = () => {
},
{
uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0',
enabled: true,
data: {},
user: {
username: 'wet_dingo',
@ -83,6 +87,7 @@ const code = `import { UserProfilesPopover } from '@kbn/user-profile-components'
const [selectedOptions, setSelectedOptions] = useState([
{
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
enabled: true,
data: {},
user: {
username: 'delighted_nightingale',
@ -92,7 +97,7 @@ const [selectedOptions, setSelectedOptions] = useState([
},
]);
<UserProfilesPopover
<UserProfilesPopover
title="Edit assignees"
button={
<EuiButton>

View file

@ -13,6 +13,7 @@ export const SelectableDemo: FunctionComponent = () => {
const [selectedOptions, setSelectedOptions] = useState<UserProfileWithAvatar[]>([
{
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
enabled: true,
data: {},
user: {
username: 'delighted_nightingale',
@ -25,6 +26,7 @@ export const SelectableDemo: FunctionComponent = () => {
const defaultOptions: UserProfileWithAvatar[] = [
{
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
enabled: true,
data: {},
user: {
username: 'damaged_raccoon',
@ -34,6 +36,7 @@ export const SelectableDemo: FunctionComponent = () => {
},
{
uid: 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0',
enabled: true,
data: {},
user: {
username: 'physical_dinosaur',
@ -43,6 +46,7 @@ export const SelectableDemo: FunctionComponent = () => {
},
{
uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0',
enabled: true,
data: {},
user: {
username: 'wet_dingo',
@ -68,6 +72,7 @@ const code = `import { UserProfilesSelectable } from '@kbn/user-profile-componen
const [selectedOptions, setSelectedOptions] = useState([
{
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
enabled: true,
data: {},
user: {
username: 'delighted_nightingale',