-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Convert node details flyout to TS (#73707)
* [ILM] Convert node allocation component to TS and use hooks * [ILM] Fix jest tests * [ILM] Fix i18n check * [ILM] Implement code review suggestions * [ILM] Fix type check, docs link and button maxWidth in NodeAllocation component * Fix internaliation error * [ILM] Convert node details flyout to TS * [ILM] Fix useState declaration * [ILM] Fix useState declaration * [ILM] Fix jest test * [ILM] Change error message when unable to load node attributes * [ILM] Change error message when unable to load node details * [ILM] Delete a period in error callout * [ILM] Delete a period in error callout * [ILM] Convert node details flyout to TS * [ILM] Fix i18n check * [ILM] Fix useState declaration * [ILM] Fix useState declaration * [ILM] Fix jest test * [ILM] Change error message when unable to load node details * [ILM] Delete a period in error callout Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
92289b6
commit a4ec433
Showing
16 changed files
with
149 additions
and
193 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
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
18 changes: 0 additions & 18 deletions
18
...cation/sections/edit_policy/components/node_attrs_details/node_attrs_details.container.js
This file was deleted.
Oops, something went wrong.
81 changes: 0 additions & 81 deletions
81
...blic/application/sections/edit_policy/components/node_attrs_details/node_attrs_details.js
This file was deleted.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
...lic/application/sections/edit_policy/components/node_attrs_details/node_attrs_details.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,106 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
||
import { | ||
EuiFlyoutBody, | ||
EuiFlyout, | ||
EuiTitle, | ||
EuiInMemoryTable, | ||
EuiSpacer, | ||
EuiPortal, | ||
EuiLoadingContent, | ||
EuiCallOut, | ||
EuiButton, | ||
} from '@elastic/eui'; | ||
|
||
import { useLoadNodeDetails } from '../../../../services/api'; | ||
|
||
interface Props { | ||
close: () => void; | ||
selectedNodeAttrs: string; | ||
} | ||
|
||
export const NodeAttrsDetails: React.FunctionComponent<Props> = ({ close, selectedNodeAttrs }) => { | ||
const { data, isLoading, error, sendRequest } = useLoadNodeDetails(selectedNodeAttrs); | ||
let content; | ||
if (isLoading) { | ||
content = <EuiLoadingContent lines={3} />; | ||
} else if (error) { | ||
const { statusCode, message } = error; | ||
content = ( | ||
<EuiCallOut | ||
title={ | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.nodeDetailsLoadingFailedTitle" | ||
defaultMessage="Unable to load node attribute details" | ||
/> | ||
} | ||
color="danger" | ||
> | ||
<p> | ||
{message} ({statusCode}) | ||
</p> | ||
<EuiButton onClick={sendRequest} iconType="refresh" color="danger"> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.nodeDetailsReloadButton" | ||
defaultMessage="Try again" | ||
/> | ||
</EuiButton> | ||
</EuiCallOut> | ||
); | ||
} else { | ||
content = ( | ||
<EuiInMemoryTable | ||
items={data || []} | ||
columns={[ | ||
{ | ||
field: 'nodeId', | ||
name: i18n.translate('xpack.indexLifecycleMgmt.nodeAttrDetails.idField', { | ||
defaultMessage: 'ID', | ||
}), | ||
}, | ||
{ | ||
field: 'stats.name', | ||
name: i18n.translate('xpack.indexLifecycleMgmt.nodeAttrDetails.nameField', { | ||
defaultMessage: 'Name', | ||
}), | ||
}, | ||
{ | ||
field: 'stats.host', | ||
name: i18n.translate('xpack.indexLifecycleMgmt.nodeAttrDetails.hostField', { | ||
defaultMessage: 'Host', | ||
}), | ||
}, | ||
]} | ||
pagination={true} | ||
sorting={true} | ||
/> | ||
); | ||
} | ||
return ( | ||
<EuiPortal> | ||
<EuiFlyout ownFocus onClose={close}> | ||
<EuiFlyoutBody> | ||
<EuiTitle> | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.nodeAttrDetails.title" | ||
defaultMessage="Nodes that contain the attribute {selectedNodeAttrs}" | ||
values={{ selectedNodeAttrs }} | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
<EuiSpacer size="s" /> | ||
{content} | ||
</EuiFlyoutBody> | ||
</EuiFlyout> | ||
</EuiPortal> | ||
); | ||
}; |
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.