-
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.
[ILM] Convert node details flyout to TS
- Loading branch information
Showing
14 changed files
with
137 additions
and
191 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
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, error: errorString, message } = error; | ||
content = ( | ||
<EuiCallOut | ||
title={ | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.nodeDetailsLoadingFailedTitle" | ||
defaultMessage="Unable to load node attribute details." | ||
/> | ||
} | ||
color="danger" | ||
> | ||
<p> | ||
{statusCode}: {errorString}. {message} | ||
</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
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.