Skip to content

Commit

Permalink
[8.13] [Search] Move create button into a more clean UI (#178546) (#1…
Browse files Browse the repository at this point in the history
…78646)

# Backport

This will backport the following commits from `main` to `8.13`:
- [[Search] Move create button into a more clean UI
(#178546)](#178546)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Efe Gürkan
YALAMAN","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-03-13T15:39:57Z","message":"[Search]
Move create button into a more clean UI (#178546)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot
or\r\ngif.\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/1410658/c9af49f6-9290-4086-8848-8eda6923f37e\r\n\r\nMove
Create button to more clean UI as requested by feedback.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"47668225932f18d1d9b6f9f7e04fe4a8b91c7dd2","branchLabelMapping":{"^v8.14.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.13.0","v8.14.0"],"title":"[Search]
Move create button into a more clean
UI","number":178546,"url":"https://github.com/elastic/kibana/pull/178546","mergeCommit":{"message":"[Search]
Move create button into a more clean UI (#178546)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot
or\r\ngif.\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/1410658/c9af49f6-9290-4086-8848-8eda6923f37e\r\n\r\nMove
Create button to more clean UI as requested by feedback.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"47668225932f18d1d9b6f9f7e04fe4a8b91c7dd2"}},"sourceBranch":"main","suggestedTargetBranches":["8.13"],"targetPullRequestStates":[{"branch":"8.13","label":"v8.13.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.14.0","branchLabelMappingKey":"^v8.14.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/178546","number":178546,"mergeCommit":{"message":"[Search]
Move create button into a more clean UI (#178546)\n\n##
Summary\r\n\r\nSummarize your PR. If it involves visual changes include
a screenshot
or\r\ngif.\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/1410658/c9af49f6-9290-4086-8848-8eda6923f37e\r\n\r\nMove
Create button to more clean UI as requested by feedback.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] Any UI touched in this PR is
usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[ ] If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[ ] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)","sha":"47668225932f18d1d9b6f9f7e04fe4a8b91c7dd2"}}]}]
BACKPORT-->

Co-authored-by: Efe Gürkan YALAMAN <[email protected]>
  • Loading branch information
kibanamachine and efegurkan authored Mar 13, 2024
1 parent 57774b9 commit 51daa35
Showing 1 changed file with 56 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiFormRow,
EuiHorizontalRule,
EuiPanel,
EuiSpacer,
EuiText,
Expand Down Expand Up @@ -236,34 +237,6 @@ export const AttachIndexBox: React.FC<AttachIndexBoxProps> = ({ connector }) =>
</EuiFlexGroup>
<EuiSpacer />
<EuiFlexGroup>
{!connector.index_name && (
<EuiFlexItem grow={false}>
<EuiButton
color="primary"
fill
onClick={() => {
createIndex({ indexName: connector.name, language: null });
}}
isLoading={isSaveLoading || isExistLoading}
disabled={indexExists[connector.name]}
>
{i18n.translate('xpack.enterpriseSearch.attachIndexBox.createSameIndexButtonLabel', {
defaultMessage: 'Create and attach an index named {indexName}',
values: { indexName: connector.name },
})}
</EuiButton>
{indexExists[connector.name] ? (
<EuiText size="xs">
{i18n.translate('xpack.enterpriseSearch.attachIndexBox.indexNameExistsError', {
defaultMessage: 'Index with name {indexName} already exists',
values: { indexName: connector.name },
})}
</EuiText>
) : (
<></>
)}
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiButton
onClick={() => onSave()}
Expand All @@ -276,6 +249,61 @@ export const AttachIndexBox: React.FC<AttachIndexBoxProps> = ({ connector }) =>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>

{!connector.index_name && (
<>
<EuiSpacer size="m" />
<EuiFlexGroup responsive={false} justifyContent="center" alignItems="center">
<EuiFlexItem>
<EuiHorizontalRule size="full" />
</EuiFlexItem>
<EuiText>
<p>
{i18n.translate('xpack.enterpriseSearch.attachIndexBox.orPanelLabel', {
defaultMessage: 'OR',
})}
</p>
</EuiText>
<EuiFlexItem>
<EuiHorizontalRule size="full" />
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton
iconType="sparkles"
color="primary"
fill
onClick={() => {
createIndex({ indexName: connector.name, language: null });
setSelectedIndex({ label: connector.name });
}}
isLoading={isSaveLoading || isExistLoading}
disabled={indexExists[connector.name]}
>
{i18n.translate(
'xpack.enterpriseSearch.attachIndexBox.createSameIndexButtonLabel',
{
defaultMessage: 'Create and attach an index named {indexName}',
values: { indexName: connector.name },
}
)}
</EuiButton>
{indexExists[connector.name] ? (
<EuiText size="xs">
{i18n.translate('xpack.enterpriseSearch.attachIndexBox.indexNameExistsError', {
defaultMessage: 'Index with name {indexName} already exists',
values: { indexName: connector.name },
})}
</EuiText>
) : (
<></>
)}
</EuiFlexItem>
</EuiFlexGroup>
</>
)}
</EuiPanel>
);
};

0 comments on commit 51daa35

Please sign in to comment.