Skip to content

Commit

Permalink
Merge branch 'main' into serverless-mki
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc authored Jun 5, 2024
2 parents c70ecbe + aa19cbc commit b5ae834
Show file tree
Hide file tree
Showing 119 changed files with 2,548 additions and 1,606 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The API returns the created private location as follows:
[source,json]
--------------------------------------------------
{
"id": "unique-location-id",
"id": "abcd1234",
"label": "Private Location 1",
"agentPolicyId": "abcd1234",
"tags": ["private", "testing"],
Expand Down
3 changes: 3 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ beta:[] Enables faster searching in APM tables by adding a handy search bar with
[[observability-enable-aws-lambda-metrics]]`observability:enableAwsLambdaMetrics`::
preview:[] Display Amazon Lambda metrics in the service metrics tab.

[[observability-enable-legacy-uptime-app]]`observability:enableLegacyUptimeApp`::
Shows the Uptime app even if there is no recent Heartbeat data.

[[observability-apm-enable-comparison]]`observability:enableComparisonByDefault`::
Determines whether the <<service-time-comparison, comparison feature>> is enabled or disabled by default in the APM app.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const UserFilterPanel: FC<{}> = () => {
},
onSearchChange: setSearchTerm,
}}
panelProps={{ css: { minWidth: euiTheme.base * 18 } }}
panelProps={{ css: { minWidth: euiTheme.base * 22 } }}
/>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-i18n/GUIDELINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Messages can contain placeholders for embedding a value of a variable. For examp

```js
{
'kbn.management.editIndexPattern.scripted.deleteFieldLabel': "Delete scripted field '{fieldName}'?"
'kbn.management.editIndexPattern.scripted.noFieldLabel': "'{indexPatternTitle}' index pattern doesn't have a scripted field called '{fieldName}'"
'kbn.management.editIndexPattern.scripted.deleteFieldLabel': "Delete scripted field ''{fieldName}''?"
'kbn.management.editIndexPattern.scripted.noFieldLabel': "''{indexPatternTitle}'' index pattern doesn't have a scripted field called ''{fieldName}''"
}
```

Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-user-profile-components/src/user_avatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('UserAvatar', () => {
<EuiAvatar
color="plain"
imageUrl="https://source.unsplash.com/64x64/?cat"
name="Delighted Nightingale"
name="Delighted Nightingale ([email protected])"
/>
`);
});
Expand All @@ -56,7 +56,7 @@ describe('UserAvatar', () => {
color="#09e8ca"
initials="DN"
initialsLength={2}
name="Delighted Nightingale"
name="Delighted Nightingale ([email protected])"
/>
`);
});
Expand All @@ -76,7 +76,7 @@ describe('UserAvatar', () => {
color="#AA6556"
initials="DN"
initialsLength={2}
name="Delighted Nightingale"
name="Delighted Nightingale ([email protected])"
/>
`);
});
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-user-profile-components/src/user_avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { UserProfile, UserProfileUserInfo } from './user_profile';
import {
getUserAvatarColor,
getUserAvatarInitials,
getUserDisplayName,
getUserDisplayLabel,
USER_AVATAR_MAX_INITIALS,
} from './user_profile';

Expand Down Expand Up @@ -62,15 +62,15 @@ export const UserAvatar: FunctionComponent<UserAvatarProps> = ({ user, avatar, .
return <EuiAvatar name="" color={euiTheme.colors.lightestShade} initials="?" {...rest} />;
}

const displayName = getUserDisplayName(user);
const displayLabel = getUserDisplayLabel(user);

if (avatar?.imageUrl) {
return <EuiAvatar name={displayName} imageUrl={avatar.imageUrl} color="plain" {...rest} />;
return <EuiAvatar name={displayLabel} imageUrl={avatar.imageUrl} color="plain" {...rest} />;
}

return (
<EuiAvatar
name={displayName}
name={displayLabel}
initials={getUserAvatarInitials(user, avatar)}
initialsLength={USER_AVATAR_MAX_INITIALS}
color={getUserAvatarColor(user, avatar)}
Expand Down
13 changes: 13 additions & 0 deletions packages/kbn-user-profile-components/src/user_profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,16 @@ export interface GetUserDisplayNameParams {
export function getUserDisplayName(params: GetUserDisplayNameParams) {
return params.full_name || params.email || params.username;
}

/**
* Determines the display label for the provided user information.
* Includes the email if it is different from the display name.
* @param params Set of available user's name-related fields.
*/
export function getUserDisplayLabel(user: GetUserDisplayNameParams): string {
const displayName = getUserDisplayName(user);
if (user.email && user.email !== displayName) {
return `${displayName} (${user.email})`;
}
return displayName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ import {
EuiText,
EuiCallOut,
EuiHighlight,
EuiTextColor,
} from '@elastic/eui';
import type { ReactNode } from 'react';
import React, { useEffect, useState } from 'react';

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import { getUserDisplayName } from './user_profile';
import { getUserDisplayLabel, getUserDisplayName } from './user_profile';
import type { UserProfileWithAvatar } from './user_avatar';
import { UserAvatar } from './user_avatar';

Expand Down Expand Up @@ -326,40 +325,33 @@ export const UserProfilesSelectable = <Option extends UserProfileWithAvatar | nu
id: searchInputId,
}}
isPreFiltered
listProps={{ onFocusBadge: false }}
listProps={{ onFocusBadge: false, rowHeight: 48 }}
loadingMessage={loadingMessage}
noMatchesMessage={noMatchesMessage}
emptyMessage={emptyMessage}
errorMessage={errorMessage}
renderOption={(option, searchValue) => {
if (option.user) {
const displayName = getUserDisplayName(option.user);
return (
<EuiFlexGroup
alignItems="center"
justifyContent="spaceBetween"
gutterSize="s"
responsive={false}
>
<EuiFlexItem css={{ maxWidth: '100%' }}>
<EuiHighlight className="eui-textTruncate" search={searchValue}>
{option.label}
</EuiHighlight>
</EuiFlexItem>
{option.user.email && option.user.email !== option.label ? (
<EuiFlexItem grow={false} css={{ minWidth: 0 }}>
<EuiTextColor
color={option.disabled ? 'disabled' : 'subdued'}
className="eui-textTruncate"
>
{searchValue ? (
<EuiHighlight search={searchValue}>{option.user.email}</EuiHighlight>
) : (
option.user.email
)}
</EuiTextColor>
</EuiFlexItem>
<>
<div className="eui-textTruncate">
<EuiHighlight search={searchValue}>{displayName}</EuiHighlight>
</div>
{option.user.email && option.user.email !== displayName ? (
<EuiText
size={'xs'}
color={option.disabled ? 'disabled' : 'subdued'}
className="eui-textTruncate"
>
{searchValue ? (
<EuiHighlight search={searchValue}>{option.user.email}</EuiHighlight>
) : (
option.user.email
)}
</EuiText>
) : undefined}
</EuiFlexGroup>
</>
);
}
return <EuiHighlight search={searchValue}>{option.label}</EuiHighlight>;
Expand Down Expand Up @@ -451,7 +443,7 @@ function toSelectableOption(
if (userProfile) {
return {
key: userProfile.uid,
label: getUserDisplayName(userProfile.user),
label: getUserDisplayLabel(userProfile.user),
data: userProfile,
'data-test-subj': `userProfileSelectableOption-${userProfile.user.username}`,
};
Expand Down
24 changes: 12 additions & 12 deletions packages/kbn-user-profile-components/src/user_tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ describe('UserToolTip', () => {
</EuiFlexItem>
<EuiFlexItem
grow={true}
style={
Object {
"minWidth": 0,
}
}
>
<EuiFlexGroup
direction="column"
gutterSize="none"
<div>
Delighted Nightingale
</div>
<EuiText
size="xs"
>
<EuiFlexItem>
<strong>
Delighted Nightingale
</strong>
</EuiFlexItem>
<EuiFlexItem>
[email protected]
</EuiFlexItem>
</EuiFlexGroup>
[email protected]
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
}
Expand Down
16 changes: 6 additions & 10 deletions packages/kbn-user-profile-components/src/user_tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import type { EuiToolTipProps } from '@elastic/eui';
import { EuiText, EuiToolTipProps } from '@elastic/eui';
import { EuiToolTip, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import type { FunctionComponent } from 'react';
import React from 'react';
Expand Down Expand Up @@ -43,15 +43,11 @@ export const UserToolTip: FunctionComponent<UserToolTipProps> = ({ user, avatar,
<EuiFlexItem grow={false}>
<UserAvatar user={user} avatar={avatar} size="l" />
</EuiFlexItem>
<EuiFlexItem grow>
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexItem>
<strong>{displayName}</strong>
</EuiFlexItem>
{user.email && user.email !== displayName ? (
<EuiFlexItem>{user.email}</EuiFlexItem>
) : undefined}
</EuiFlexGroup>
<EuiFlexItem grow style={{ minWidth: 0 }}>
<div>{displayName}</div>
{user.email && user.email !== displayName ? (
<EuiText size={'xs'}>{user.email}</EuiText>
) : undefined}
</EuiFlexItem>
</EuiFlexGroup>
}
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-user-profile-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"outDir": "target/types",
"types": [
"jest",
"node"
"node",
"@emotion/react/types/css-prop",
]
},
"include": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class PreviewController {

const afterSave = () => {
const message = i18n.translate('indexPatternFieldEditor.deleteField.savedHeader', {
defaultMessage: "Saved '{fieldName}'",
defaultMessage: "Saved ''{fieldName}''",
values: { fieldName: updatedField.name },
});
this.deps.notifications.toasts.addSuccess(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const CreateEditField = withRouter(
if (mode === 'edit' && !spec) {
const message = i18n.translate('indexPatternManagement.editDataView.scripted.noFieldLabel', {
defaultMessage:
"'{dataViewTitle}' data view doesn't have a scripted field called '{fieldName}'",
"''{dataViewTitle}'' data view doesn't have a scripted field called ''{fieldName}''",
values: { dataViewTitle: indexPattern.title, fieldName },
});
notifications.toasts.addWarning(message);
Expand Down
1 change: 1 addition & 0 deletions x-pack/packages/security/plugin_types_public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export type {
UserProfileSuggestParams,
UserProfileAPIClient,
} from './src/user_profile';
export type { RolePutPayload, RolesAPIClient } from './src/roles';
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
* 2.0.
*/

import type { RolesAPIClient } from '../roles';

export interface AuthorizationServiceSetup {
/**
* Determines if role management is enabled.
*/
isRoleManagementEnabled: () => boolean | undefined;

/**
* A set of methods to work with Kibana user roles.
*/
roles: RolesAPIClient;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export type { RolePutPayload, RolesAPIClient } from './roles_api_client';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { Role } from '@kbn/security-plugin-types-common';

export interface RolePutPayload {
role: Role;
createOnly?: boolean;
}

export interface RolesAPIClient {
getRoles: () => Promise<Role[]>;
getRole: (roleName: string) => Promise<Role>;
deleteRole: (roleName: string) => Promise<void>;
saveRole: (payload: RolePutPayload) => Promise<void>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const AssigneesFilterPopoverComponent: React.FC<AssigneesFilterPopoverProps> = (
isOpen={isPopoverOpen}
closePopover={togglePopover}
panelStyle={{
minWidth: 520,
width: 400,
}}
button={
<EuiFilterButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const SuggestUsersPopoverComponent: React.FC<SuggestUsersPopoverProps> = ({
isOpen={isPopoverOpen}
closePopover={onClosePopover}
panelStyle={{
minWidth: 520,
width: 400,
}}
selectableProps={{
onChange,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b5ae834

Please sign in to comment.