mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Sync UserProfile
interface in kbn/user-profile-components
package with the one in Security plugin. (#138704)
This commit is contained in:
parent
5188e4b63e
commit
c868daad50
6 changed files with 30 additions and 2 deletions
|
@ -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',
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -26,6 +26,11 @@ export interface UserProfile<D extends UserProfileData = UserProfileData> {
|
|||
*/
|
||||
uid: string;
|
||||
|
||||
/**
|
||||
* Indicates whether user profile is enabled or not.
|
||||
*/
|
||||
enabled: boolean;
|
||||
|
||||
/**
|
||||
* Information about the user that owns profile.
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,7 @@ import { UserProfilesPopover } from './user_profiles_popover';
|
|||
const userProfiles = [
|
||||
{
|
||||
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'delighted_nightingale',
|
||||
|
@ -23,6 +24,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'damaged_raccoon',
|
||||
|
@ -32,6 +34,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'physical_dinosaur',
|
||||
|
@ -41,6 +44,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'wet_dingo',
|
||||
|
@ -88,6 +92,7 @@ describe('UserProfilesPopover', () => {
|
|||
Array [
|
||||
Object {
|
||||
"data": Object {},
|
||||
"enabled": true,
|
||||
"uid": "u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0",
|
||||
"user": Object {
|
||||
"email": "damaged_raccoon@profiles.elastic.co",
|
||||
|
@ -101,6 +106,7 @@ describe('UserProfilesPopover', () => {
|
|||
Array [
|
||||
Object {
|
||||
"data": Object {},
|
||||
"enabled": true,
|
||||
"uid": "u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0",
|
||||
"user": Object {
|
||||
"email": "delighted_nightingale@profiles.elastic.co",
|
||||
|
|
|
@ -14,6 +14,7 @@ import { UserProfilesSelectable } from './user_profiles_selectable';
|
|||
const userProfiles = [
|
||||
{
|
||||
uid: 'u_BOulL4QMPSyV9jg5lQI2JmCkUnokHTazBnet3xVHNv0_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'delighted_nightingale',
|
||||
|
@ -23,6 +24,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'damaged_raccoon',
|
||||
|
@ -32,6 +34,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_A_tM4n0wPkdiQ9smmd8o0Hr_h61XQfu8aRPh9GMoRoc_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'physical_dinosaur',
|
||||
|
@ -41,6 +44,7 @@ const userProfiles = [
|
|||
},
|
||||
{
|
||||
uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0',
|
||||
enabled: true,
|
||||
data: {},
|
||||
user: {
|
||||
username: 'wet_dingo',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue