forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Added a flyout with linked index templates (elastic#106734)
* [ILM] Server to use new in_use_by property returned by ES API * [ILM] Cleaning up the PR changes * [ILM] Fixed functional test * [ILM] Fixed 'modifiedDate' display in the table * [ILM] Fixed sorting test * [ILM] Removed a not needed function declaration * [ILM] Added index templates flyout to the policies list * [ILM] Added test for the index templates flyout * [ILM] Added an a11y test for the index templates flyout * Update x-pack/plugins/index_lifecycle_management/public/application/components/index_templates_flyout.tsx Co-authored-by: debadair <debadair@elastic.co> * [ILM] Fixed jest test and made 0 index templates to not open the flyout * [ILM] Fixed a11y test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: debadair <debadair@elastic.co>
- Loading branch information
1 parent
5802dde
commit 379c085
Showing
22 changed files
with
296 additions
and
181 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/index_lifecycle_management/__jest__/__snapshots__/policy_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
86 changes: 86 additions & 0 deletions
86
...ugins/index_lifecycle_management/public/application/components/index_templates_flyout.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,86 @@ | ||
/* | ||
* 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 React, { FunctionComponent } from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { | ||
EuiButtonEmpty, | ||
EuiFlyout, | ||
EuiFlyoutBody, | ||
EuiFlyoutFooter, | ||
EuiFlyoutHeader, | ||
EuiInMemoryTable, | ||
EuiLink, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
import { PolicyFromES } from '../../../common/types'; | ||
import { useKibana } from '../../shared_imports'; | ||
import { getTemplateDetailsLink } from '../../../../index_management/public/'; | ||
|
||
interface Props { | ||
policy: PolicyFromES; | ||
close: () => void; | ||
} | ||
export const IndexTemplatesFlyout: FunctionComponent<Props> = ({ policy, close }) => { | ||
const { | ||
services: { getUrlForApp }, | ||
} = useKibana(); | ||
const getUrlForIndexTemplate = (name: string) => { | ||
return getUrlForApp('management', { | ||
path: `data/index_management${getTemplateDetailsLink(name)}`, | ||
}); | ||
}; | ||
return ( | ||
<EuiFlyout onClose={close}> | ||
<EuiFlyoutHeader hasBorder> | ||
<EuiTitle size="m" data-test-subj="indexTemplatesFlyoutHeader"> | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.policyTable.indexTemplatesFlyout.headerText" | ||
defaultMessage="Index templates that apply {policyName}" | ||
values={{ policyName: policy.name }} | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
<EuiInMemoryTable | ||
pagination={true} | ||
items={policy.indexTemplates ?? []} | ||
columns={[ | ||
{ | ||
name: i18n.translate( | ||
'xpack.indexLifecycleMgmt.policyTable.indexTemplatesTable.nameHeader', | ||
{ defaultMessage: 'Index template name' } | ||
), | ||
render: (value: string) => { | ||
return ( | ||
<EuiLink | ||
data-test-subj="indexTemplateLink" | ||
className="eui-textBreakAll" | ||
href={getUrlForIndexTemplate(value)} | ||
> | ||
{value} | ||
</EuiLink> | ||
); | ||
}, | ||
}, | ||
]} | ||
/> | ||
</EuiFlyoutBody> | ||
<EuiFlyoutFooter> | ||
<EuiButtonEmpty iconType="cross" onClick={close} flush="left"> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.indexTemplatesFlyout.closeButtonLabel" | ||
defaultMessage="Close" | ||
/> | ||
</EuiButtonEmpty> | ||
</EuiFlyoutFooter> | ||
</EuiFlyout> | ||
); | ||
}; |
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.