-
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.
Browse files
Browse the repository at this point in the history
* wip * match design for selecting grid view * wip to integrate event rendered view * wip * integration of the event rendered * fix perPage action on Euibasic table * Add bulding block background color to EventRenderedView * styling * remove header * fix types * fix unit tests * use memo for listProps * fix styling + add feature flag * review I * fix merge * change the gutter size Co-authored-by: Pablo Neves Machado <pablo.nevesmachado@elastic.co> Co-authored-by: Angela Chuang <yi-chun.chuang@elastic.co> Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Co-authored-by: Pablo Neves Machado <pablo.nevesmachado@elastic.co> Co-authored-by: Angela Chuang <yi-chun.chuang@elastic.co>
- Loading branch information
1 parent
4fa3943
commit 809e218
Showing
14 changed files
with
635 additions
and
470 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
51 changes: 51 additions & 0 deletions
51
x-pack/plugins/timelines/public/components/rule_name/index.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,51 @@ | ||
/* | ||
* 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 { EuiLink } from '@elastic/eui'; | ||
import { isEmpty } from 'lodash'; | ||
import React, { useCallback, useMemo } from 'react'; | ||
import { CoreStart } from '../../../../../../src/core/public'; | ||
import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; | ||
|
||
interface RuleNameProps { | ||
name: string; | ||
id: string; | ||
} | ||
|
||
const appendSearch = (search?: string) => | ||
isEmpty(search) ? '' : `${search?.startsWith('?') ? search : `?${search}`}`; | ||
|
||
const RuleNameComponents = ({ name, id }: RuleNameProps) => { | ||
const { navigateToApp, getUrlForApp } = useKibana<CoreStart>().services.application; | ||
|
||
const hrefRuleDetails = useMemo( | ||
() => | ||
getUrlForApp('securitySolution', { | ||
deepLinkId: 'rules', | ||
path: `/id/${id}${appendSearch(window.location.search)}`, | ||
}), | ||
[getUrlForApp, id] | ||
); | ||
const goToRuleDetails = useCallback( | ||
(ev) => { | ||
ev.preventDefault(); | ||
navigateToApp('securitySolution', { | ||
deepLinkId: 'rules', | ||
path: `/id/${id}${appendSearch(window.location.search)}`, | ||
}); | ||
}, | ||
[navigateToApp, id] | ||
); | ||
return ( | ||
// eslint-disable-next-line @elastic/eui/href-or-on-click | ||
<EuiLink href={hrefRuleDetails} onClick={goToRuleDetails}> | ||
{name} | ||
</EuiLink> | ||
); | ||
}; | ||
|
||
export const RuleName = React.memo(RuleNameComponents); |
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
Oops, something went wrong.