-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into ua/backport-depreca…
…tion-logs-improvement
- Loading branch information
Showing
131 changed files
with
20,585 additions
and
15,807 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/core/public/core_app/status/components/__snapshots__/server_status.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
45 changes: 35 additions & 10 deletions
45
src/core/public/core_app/status/components/__snapshots__/status_table.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/core/public/core_app/status/components/status_badge.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallowWithIntl } from '@kbn/test/jest'; | ||
import { StatusBadge, StatusWithoutMessage } from './status_badge'; | ||
|
||
const getStatus = (parts: Partial<StatusWithoutMessage> = {}): StatusWithoutMessage => ({ | ||
id: 'available', | ||
title: 'Green', | ||
uiColor: 'secondary', | ||
...parts, | ||
}); | ||
|
||
describe('StatusBadge', () => { | ||
it('propagates the correct properties to `EuiBadge`', () => { | ||
const status = getStatus(); | ||
|
||
const component = shallowWithIntl(<StatusBadge status={status} />); | ||
|
||
expect(component).toMatchInlineSnapshot(` | ||
<EuiBadge | ||
aria-label="Green" | ||
color="secondary" | ||
> | ||
Green | ||
</EuiBadge> | ||
`); | ||
}); | ||
|
||
it('propagates `data-test-subj` if provided', () => { | ||
const status = getStatus({ | ||
id: 'critical', | ||
title: 'Red', | ||
uiColor: 'danger', | ||
}); | ||
|
||
const component = shallowWithIntl( | ||
<StatusBadge status={status} data-test-subj="my-data-test-subj" /> | ||
); | ||
|
||
expect(component).toMatchInlineSnapshot(` | ||
<EuiBadge | ||
aria-label="Red" | ||
color="danger" | ||
data-test-subj="my-data-test-subj" | ||
> | ||
Red | ||
</EuiBadge> | ||
`); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
src/core/public/core_app/status/components/status_badge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { FC } from 'react'; | ||
import { EuiBadge } from '@elastic/eui'; | ||
import type { StatusState } from '../lib'; | ||
|
||
export type StatusWithoutMessage = Omit<StatusState, 'message'>; | ||
|
||
interface StatusBadgeProps { | ||
status: StatusWithoutMessage; | ||
'data-test-subj'?: string; | ||
} | ||
|
||
export const StatusBadge: FC<StatusBadgeProps> = (props) => { | ||
return ( | ||
<EuiBadge | ||
data-test-subj={props['data-test-subj']} | ||
color={props.status.uiColor} | ||
aria-label={props.status.title} | ||
> | ||
{props.status.title} | ||
</EuiBadge> | ||
); | ||
}; |
36 changes: 36 additions & 0 deletions
36
src/core/public/core_app/status/components/status_expanded_row.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { FC, useMemo } from 'react'; | ||
import { EuiCodeBlock, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
import type { FormattedStatus } from '../lib'; | ||
|
||
interface StatusExpandedRowProps { | ||
status: FormattedStatus; | ||
} | ||
|
||
export const StatusExpandedRow: FC<StatusExpandedRowProps> = ({ status }) => { | ||
const { original } = status; | ||
const statusAsString = useMemo(() => JSON.stringify(original, null, 2), [original]); | ||
|
||
return ( | ||
<EuiFlexGroup> | ||
<EuiFlexItem grow={true}> | ||
<EuiCodeBlock | ||
language="json" | ||
overflowHeight={300} | ||
isCopyable | ||
paddingSize="none" | ||
transparentBackground={true} | ||
> | ||
{statusAsString} | ||
</EuiCodeBlock> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}; |
Oops, something went wrong.