-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fleet] implements new design for outputs UI #118910
Merged
nchaulet
merged 9 commits into
elastic:main
from
nchaulet:feature-fleet-multiple-output-ui
Nov 24, 2021
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3ae6fec
[Fleet] Add multiple outputs UI
nchaulet 4ea6c6b
Merge branch 'main' of github.com:elastic/kibana into feature-fleet-m…
nchaulet 842143b
fix 18n and typos
nchaulet ebbaa96
Merge branch 'main' of github.com:elastic/kibana into feature-fleet-m…
nchaulet 0aafc18
AEnable save button on change
nchaulet 46bb72e
Fix after design review
nchaulet ef1ed44
Fix typo
nchaulet 5280e72
fix i18n
nchaulet 97b5718
Adress PR feedback
nchaulet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
229 changes: 229 additions & 0 deletions
229
...fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/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,229 @@ | ||
/* | ||
* 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 from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { | ||
EuiFlyout, | ||
EuiFlyoutBody, | ||
EuiFlyoutHeader, | ||
EuiTitle, | ||
EuiFlyoutFooter, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiButtonEmpty, | ||
EuiButton, | ||
EuiForm, | ||
EuiFormRow, | ||
EuiFieldText, | ||
EuiSelect, | ||
EuiSwitch, | ||
EuiCallOut, | ||
EuiSpacer, | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { HostsInput } from '../hosts_input'; | ||
import type { Output } from '../../../../types'; | ||
import { FLYOUT_MAX_WIDTH } from '../../constants'; | ||
|
||
import { YamlCodeEditorWithPlaceholder } from './yaml_code_editor_with_placeholder'; | ||
import { useOutputForm } from './use_output_form'; | ||
|
||
export interface EditOutputFlyoutProps { | ||
output?: Output; | ||
onClose: () => void; | ||
} | ||
|
||
export const EditOutputFlyout: React.FunctionComponent<EditOutputFlyoutProps> = ({ | ||
onClose, | ||
output, | ||
}) => { | ||
const form = useOutputForm(onClose, output); | ||
const inputs = form.inputs; | ||
|
||
return ( | ||
<EuiFlyout maxWidth={FLYOUT_MAX_WIDTH} onClose={onClose}> | ||
<EuiFlyoutHeader hasBorder={true}> | ||
<EuiTitle size="m"> | ||
<h2 id="FleetEditOutputFlyoutTitle"> | ||
{!output ? ( | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.createTitle" | ||
defaultMessage="Add new output" | ||
/> | ||
) : ( | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.editTitle" | ||
defaultMessage="Edit output" | ||
/> | ||
)} | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
{output?.is_preconfigured && ( | ||
<> | ||
<EuiCallOut | ||
iconType="lock" | ||
title={ | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.preconfiguredOutputCalloutTitle" | ||
defaultMessage="This output is managed outside of Fleet" | ||
/> | ||
} | ||
> | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.preconfiguredOutputCalloutDescription" | ||
defaultMessage="Most actions related to this output are unavailable. Refer to your kibana config for more | ||
detail." | ||
/> | ||
</EuiCallOut> | ||
<EuiSpacer size="m" /> | ||
</> | ||
)} | ||
<EuiForm> | ||
<EuiFormRow | ||
fullWidth | ||
label={ | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.nameInputLabel" | ||
defaultMessage="Name" | ||
/> | ||
} | ||
{...inputs.nameInput.formRowProps} | ||
> | ||
<EuiFieldText | ||
fullWidth | ||
{...inputs.nameInput.props} | ||
placeholder={i18n.translate( | ||
'xpack.fleet.settings.editOutputFlyout.nameInputPlaceholder', | ||
{ | ||
defaultMessage: 'Specify name', | ||
} | ||
)} | ||
/> | ||
</EuiFormRow> | ||
<EuiFormRow | ||
fullWidth | ||
label={ | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.typeInputLabel" | ||
defaultMessage="Type" | ||
/> | ||
} | ||
> | ||
<EuiSelect | ||
fullWidth | ||
{...inputs.typeInput.props} | ||
options={[{ value: 'elasticsearch', text: 'Elasticsearch' }]} | ||
placeholder={i18n.translate( | ||
'xpack.fleet.settings.editOutputFlyout.typeInputPlaceholder', | ||
{ | ||
defaultMessage: 'Specify type', | ||
} | ||
)} | ||
/> | ||
</EuiFormRow> | ||
<HostsInput | ||
label={i18n.translate('xpack.fleet.settings.editOutputFlyout.hostsInputLabel', { | ||
defaultMessage: 'Hosts', | ||
})} | ||
{...inputs.elasticsearchUrlInput.props} | ||
/> | ||
<EuiFormRow | ||
label={i18n.translate('xpack.fleet.settings.editOutputFlyout.yamlConfigInputLabel', { | ||
defaultMessage: 'Advanced YAML configuration', | ||
})} | ||
{...inputs.additionalYamlConfigInput.formRowProps} | ||
fullWidth | ||
> | ||
<YamlCodeEditorWithPlaceholder | ||
value={inputs.additionalYamlConfigInput.value} | ||
onChange={inputs.additionalYamlConfigInput.setValue} | ||
disabled={inputs.additionalYamlConfigInput.props.disabled} | ||
placeholder={i18n.translate( | ||
'xpack.fleet.settings.editOutputFlyout.yamlConfigInputPlaceholder', | ||
{ | ||
defaultMessage: | ||
'# YAML settings here will be added to the Elasticsearch output section of each agent policy.', | ||
} | ||
)} | ||
/> | ||
</EuiFormRow> | ||
<EuiFormRow fullWidth {...inputs.defaultOutputInput.formRowProps}> | ||
<EuiSwitch | ||
{...inputs.defaultOutputInput.props} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.defaultOutputSwitchLabel" | ||
defaultMessage="Make this output the default for {boldAgentIntegrations}." | ||
values={{ | ||
boldAgentIntegrations: ( | ||
<strong> | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.agentIntegrationsBold" | ||
defaultMessage="agent integrations" | ||
/> | ||
</strong> | ||
), | ||
}} | ||
/> | ||
} | ||
/> | ||
</EuiFormRow> | ||
<EuiFormRow fullWidth {...inputs.defaultMonitoringOutputInput.formRowProps}> | ||
<EuiSwitch | ||
{...inputs.defaultMonitoringOutputInput.props} | ||
label={ | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.defaultMontoringOutputSwitchLabel" | ||
defaultMessage="Make this output the default for {boldAgentMonitoring}." | ||
values={{ | ||
boldAgentMonitoring: ( | ||
<strong> | ||
<FormattedMessage | ||
id="xpack.fleet.settings.editOutputFlyout.agentMonitoringBold" | ||
defaultMessage="agent monitoring" | ||
/> | ||
</strong> | ||
), | ||
}} | ||
/> | ||
} | ||
/> | ||
</EuiFormRow> | ||
</EuiForm> | ||
</EuiFlyoutBody> | ||
<EuiFlyoutFooter> | ||
<EuiFlexGroup justifyContent="spaceBetween"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty onClick={() => onClose()} flush="left"> | ||
<FormattedMessage | ||
id="xpack.fleet.settings.fleetServerHostsFlyout.cancelButtonLabel" | ||
defaultMessage="Cancel" | ||
/> | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton | ||
fill | ||
isLoading={form.isLoading} | ||
isDisabled={form.isDisabled} | ||
onClick={form.submit} | ||
> | ||
<FormattedMessage | ||
id="xpack.fleet.settings.fleetServerHostsFlyout.saveButton" | ||
defaultMessage="Save and apply settings" | ||
/> | ||
</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlyoutFooter> | ||
</EuiFlyout> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: using arrow function here is less optimal