-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cloud Posture] search bar styles update #128361
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 { useTheme as useEmotionTheme } from '@emotion/react'; | ||
import { EuiTheme } from '../../../../../../src/plugins/kibana_react/common'; | ||
|
||
export function useTheme() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets drop this and use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It exists, look at shades in the colors documentation
|
||
// TODO: augment @emotion/react#Theme to EuiTheme | ||
const theme = useEmotionTheme(); | ||
return theme as EuiTheme; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,13 @@ import type { DataView } from '../../../../../../src/plugins/data/common'; | |
|
||
jest.mock('../../common/api/use_kubebeat_data_view'); | ||
jest.mock('../../common/api/use_cis_kubernetes_integration'); | ||
jest.mock('../../common/hooks/use_theme', () => ({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of mocking this I suggest adding a theme provider to our There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you mean, we do add it explicitly, Kibana does not do that for us (we add it here) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
useTheme: () => ({ | ||
eui: { | ||
paddingSizes: {}, | ||
}, | ||
}), | ||
})); | ||
|
||
beforeEach(() => { | ||
jest.restoreAllMocks(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,25 +5,27 @@ | |
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import type { EuiPageHeaderProps } from '@elastic/eui'; | ||
// eslint-disable-next-line @kbn/eslint/module_migration | ||
import styled from 'styled-components'; | ||
import { useKubebeatDataView } from '../../common/api/use_kubebeat_data_view'; | ||
import { allNavigationItems } from '../../common/navigation/constants'; | ||
import { useCspBreadcrumbs } from '../../common/navigation/use_csp_breadcrumbs'; | ||
import { FindingsContainer } from './findings_container'; | ||
import { CspPageTemplate } from '../../components/csp_page_template'; | ||
import { FINDINGS } from './translations'; | ||
|
||
const pageHeader: EuiPageHeaderProps = { | ||
pageTitle: FINDINGS, | ||
}; | ||
const FindingsPageTemplate = styled(CspPageTemplate)` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to do anything, when I remove it and use |
||
header.euiPageHeader { | ||
display: none; | ||
} | ||
`; | ||
|
||
export const Findings = () => { | ||
const dataViewQuery = useKubebeatDataView(); | ||
useCspBreadcrumbs([allNavigationItems.findings]); | ||
|
||
return ( | ||
<CspPageTemplate pageHeader={pageHeader} query={dataViewQuery}> | ||
<FindingsPageTemplate paddingSize="none" query={dataViewQuery}> | ||
{dataViewQuery.data && <FindingsContainer dataView={dataViewQuery.data} />} | ||
</CspPageTemplate> | ||
</FindingsPageTemplate> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { EuiSpacer } from '@elastic/eui'; | ||
import { EuiSpacer, EuiTitle } from '@elastic/eui'; | ||
import { css } from '@emotion/react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { FindingsTable } from './findings_table'; | ||
import { FindingsSearchBar } from './findings_search_bar'; | ||
import * as TEST_SUBJECTS from './test_subjects'; | ||
|
@@ -15,14 +17,9 @@ import { useUrlQuery } from '../../common/hooks/use_url_query'; | |
import { useFindings, type CspFindingsRequest } from './use_findings'; | ||
|
||
// TODO: define this as a schema with default values | ||
// need to get Query and DateRange schema | ||
const getDefaultQuery = (): CspFindingsRequest => ({ | ||
query: { language: 'kuery', query: '' }, | ||
filters: [], | ||
dateRange: { | ||
from: 'now-15m', | ||
to: 'now', | ||
}, | ||
sort: [{ ['@timestamp']: SortDirection.desc }], | ||
from: 0, | ||
size: 10, | ||
|
@@ -40,8 +37,23 @@ export const FindingsContainer = ({ dataView }: { dataView: DataView }) => { | |
{...findingsQuery} | ||
{...findingsResult} | ||
/> | ||
<EuiSpacer /> | ||
<FindingsTable setQuery={setUrlQuery} {...findingsQuery} {...findingsResult} /> | ||
<div | ||
css={css` | ||
padding: 24px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to start using sizes from the eui theme, lets use |
||
`} | ||
> | ||
<PageTitle /> | ||
<EuiSpacer /> | ||
<FindingsTable setQuery={setUrlQuery} {...findingsQuery} {...findingsResult} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const PageTitle = () => ( | ||
<EuiTitle size="l"> | ||
<h2> | ||
<FormattedMessage id="xpack.csp.findings.findingsLabel" defaultMessage="Findings" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the ID should end with |
||
</h2> | ||
</EuiTitle> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to wrap in a theme provider, our entire app is wrapped in a
<KibanaThemeProvider />
which is a wrapper of<EuiThemeProvider />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KibanaThemeProvider
doesn't include the context foreui
's emotion theme, which is what this bit addsalthough if we manage to only useuseEuiTheme()
, we won't need this at allremoved this, not used anymore.