-
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.
[Enterprise Search] Name and description flyout for connectors (#143827)
- Loading branch information
1 parent
879b101
commit 8974e82
Showing
9 changed files
with
219 additions
and
84 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
99 changes: 99 additions & 0 deletions
99
..._index/connector/connector_name_and_description/connector_name_and_description_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,99 @@ | ||
/* | ||
* 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 { useValues, useActions } from 'kea'; | ||
|
||
import { | ||
EuiFlyout, | ||
EuiFlyoutHeader, | ||
EuiFlyoutBody, | ||
EuiFormRow, | ||
EuiText, | ||
EuiSpacer, | ||
EuiFlyoutFooter, | ||
EuiButtonEmpty, | ||
EuiButton, | ||
EuiTitle, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { Status } from '../../../../../../../common/types/api'; | ||
import { CANCEL_BUTTON_LABEL } from '../../../../../shared/constants'; | ||
|
||
import { ConnectorNameAndDescriptionApiLogic } from '../../../../api/connector/update_connector_name_and_description_api_logic'; | ||
|
||
import { ConnectorNameAndDescriptionFormContent } from './connector_name_and_description_form_content'; | ||
import { ConnectorNameAndDescriptionLogic } from './connector_name_and_description_logic'; | ||
|
||
export const ConnectorNameAndDescriptionFlyout: React.FC = () => { | ||
const { status } = useValues(ConnectorNameAndDescriptionApiLogic); | ||
const { isEditing } = useValues(ConnectorNameAndDescriptionLogic); | ||
const { saveNameAndDescription, setIsEditing } = useActions(ConnectorNameAndDescriptionLogic); | ||
|
||
if (!isEditing) return null; | ||
|
||
return ( | ||
<EuiFlyout onClose={() => setIsEditing(false)} size="s"> | ||
<EuiFlyoutHeader> | ||
<EuiTitle size="m"> | ||
<h3> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.configurationConnector.nameAndDescriptionFlyout.title', | ||
{ | ||
defaultMessage: 'Describe this crawler', | ||
} | ||
)} | ||
</h3> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
|
||
<EuiFlyoutBody> | ||
<EuiFormRow> | ||
<EuiText size="s"> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.configurationConnector.nameAndDescriptionFlyout.description', | ||
{ | ||
defaultMessage: | ||
'By naming and describing this connector your colleagues and wider team will know what this connector is meant for.', | ||
} | ||
)} | ||
</EuiText> | ||
</EuiFormRow> | ||
<EuiSpacer /> | ||
<ConnectorNameAndDescriptionFormContent /> | ||
</EuiFlyoutBody> | ||
|
||
<EuiFlyoutFooter> | ||
<EuiFlexGroup justifyContent="spaceBetween"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonEmpty | ||
onClick={() => setIsEditing(false)} | ||
isLoading={status === Status.LOADING} | ||
> | ||
{CANCEL_BUTTON_LABEL} | ||
</EuiButtonEmpty> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton isLoading={status === Status.LOADING} fill onClick={saveNameAndDescription}> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.content.indices.configurationConnector.nameAndDescriptionFlyout.saveButtonLabel', | ||
{ | ||
defaultMessage: 'Save name and description', | ||
} | ||
)} | ||
</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</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
46 changes: 46 additions & 0 deletions
46
.../connector/connector_name_and_description/connector_name_and_description_form_content.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,46 @@ | ||
/* | ||
* 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 { useActions, useValues } from 'kea'; | ||
|
||
import { EuiFieldText, EuiFormRow, EuiTextArea } from '@elastic/eui'; | ||
|
||
import { NAME_LABEL, DESCRIPTION_LABEL, OPTIONAL_LABEL } from '../../../../../shared/constants'; | ||
|
||
import { ConnectorNameAndDescriptionLogic } from './connector_name_and_description_logic'; | ||
|
||
export const ConnectorNameAndDescriptionFormContent: React.FC = () => { | ||
const { | ||
localNameAndDescription: { name, description }, | ||
} = useValues(ConnectorNameAndDescriptionLogic); | ||
const { updateLocalNameAndDescription } = useActions(ConnectorNameAndDescriptionLogic); | ||
|
||
return ( | ||
<> | ||
<EuiFormRow label={NAME_LABEL}> | ||
<EuiFieldText | ||
required | ||
value={name ?? ''} | ||
onChange={(event) => { | ||
updateLocalNameAndDescription({ name: event.target.value }); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
<EuiFormRow label={DESCRIPTION_LABEL}> | ||
<EuiTextArea | ||
placeholder={OPTIONAL_LABEL} | ||
value={description || ''} | ||
onChange={(event) => { | ||
updateLocalNameAndDescription({ description: event.target.value }); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
</> | ||
); | ||
}; |
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.