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.
Add request flyout to Remote Clusters. (elastic#42900)
- Loading branch information
Showing
10 changed files
with
205 additions
and
37 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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
58 changes: 42 additions & 16 deletions
58
...pp/sections/components/remote_cluster_form/__snapshots__/remote_cluster_form.test.js.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
100 changes: 100 additions & 0 deletions
100
...gins/remote_clusters/public/app/sections/components/remote_cluster_form/request_flyout.js
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,100 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* 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, { PureComponent } from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { | ||
EuiButtonEmpty, | ||
EuiCodeBlock, | ||
EuiFlyout, | ||
EuiFlyoutBody, | ||
EuiFlyoutFooter, | ||
EuiFlyoutHeader, | ||
EuiSpacer, | ||
EuiText, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
|
||
import { serializeCluster } from '../../../../../common'; | ||
|
||
export class RequestFlyout extends PureComponent { | ||
static propTypes = { | ||
close: PropTypes.func.isRequired, | ||
name: PropTypes.string.isRequired, | ||
cluster: PropTypes.object.isRequired, | ||
}; | ||
|
||
render() { | ||
const { name, close, cluster } = this.props; | ||
const endpoint = 'PUT _cluster/settings'; | ||
const payload = JSON.stringify(serializeCluster(cluster), null, 2); | ||
const request = `${endpoint}\n${payload}`; | ||
|
||
return ( | ||
<EuiFlyout maxWidth={480} onClose={close}> | ||
<EuiFlyoutHeader> | ||
<EuiTitle> | ||
<h2> | ||
{name ? ( | ||
<FormattedMessage | ||
id="xpack.remoteClusters.requestFlyout.namedTitle" | ||
defaultMessage="Request for '{name}'" | ||
values={{ name }} | ||
/> | ||
) : ( | ||
<FormattedMessage | ||
id="xpack.remoteClusters.requestFlyout.unnamedTitle" | ||
defaultMessage="Request" | ||
/> | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
|
||
<EuiFlyoutBody> | ||
<EuiText> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.remoteClusters.requestFlyout.descriptionText" | ||
defaultMessage="This Elasticsearch request will create or update this remote cluster." | ||
/> | ||
</p> | ||
</EuiText> | ||
|
||
<EuiSpacer /> | ||
|
||
<EuiCodeBlock | ||
language="json" | ||
isCopyable | ||
> | ||
{request} | ||
</EuiCodeBlock> | ||
</EuiFlyoutBody> | ||
|
||
<EuiFlyoutFooter> | ||
<EuiButtonEmpty | ||
iconType="cross" | ||
onClick={close} | ||
flush="left" | ||
> | ||
<FormattedMessage | ||
id="xpack.remoteClusters.requestFlyout.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
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