-
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
[App Search] Credentials: implement working flyout form #81541
Conversation
export { FormKeyName } from './key_name'; | ||
export { FormKeyType } from './key_type'; | ||
export { FormKeyReadWriteAccess } from './key_read_write_access'; | ||
export { FormKeyEngineAccess } from './key_engine_access'; | ||
export { FormKeyUpdateWarning } from './key_update_warning'; |
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.
Super quick note about the naming schema I went with - I'm not in love with it or anything so definitely happy to take suggestions. One thing that drives me slightly nuts (but no idea how to fix lol) is the alternating terminology we use:
- "Credentials" in the routing/file/folder names
- "Tokens" in our actual code vars
- "API Keys" in our user-facing copy (and now I guess these file names)
Anyway, don't mind me, I'm just dead inside over here
<p> | ||
{tokenDescription && <strong>{tokenDescription}</strong>}{' '} | ||
<EuiLink href={DOCS_HREF}> | ||
{i18n.translate('xpack.enterpriseSearch.appSearch.tokens.documentationLink1', { | ||
defaultMessage: 'Visit the documentation', | ||
})} | ||
</EuiLink>{' '} | ||
{i18n.translate('xpack.enterpriseSearch.appSearch.tokens.documentationLink2', { | ||
defaultMessage: 'to learn more about keys.', | ||
})} | ||
</p> |
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.
I'm not sure if there's a better way of i18n'ing sentences broken up by JSX/HTML (a link in this case). Hoping our amazing i18n folks are ok handling this 😬
005f93d
to
05b1625
Compare
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.
The way you broke these down into independent form components makes the code, and this PR, way more manageable. Thank you for doing that.
I don't have any blocking feedback, but I did make some comments to consider.
Great work on this.
...s/app_search/components/credentials/credentials_flyout/form_components/key_engine_access.tsx
Outdated
Show resolved
Hide resolved
...tions/app_search/components/credentials/credentials_flyout/form_components/key_type.test.tsx
Show resolved
Hide resolved
...plications/app_search/components/credentials/credentials_flyout/form_components/key_type.tsx
Outdated
Show resolved
Hide resolved
); | ||
}; | ||
|
||
export const EngineSelection: React.FC = () => { |
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.
Are you OK with the fact that we're exporting two components from a single file? Seems counter to common practice.
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.
Definitely my opinion, but I don't think there's a standard/best practice for this. I generally prefer taking advantage of multiple exports (the same way we export multiple string consts, utility fns, etc.) and I don't 100% see why components are significantly different.
In this case EngineSelection is a subcomponent and primarily exported to make unit testing easier - but I think that's a feature, not a bug, of unit testing, because it helps us break code down into substantially more readable blocks. I also don't think exporting for the sake of a test file is a major faux pas or anything - conceptually it's not any different from mocks or other const's exported to make tests easier.
@@ -21,7 +21,7 @@ import { IMeta } from '../../../../../common/types'; | |||
import { IEngine } from '../../types'; | |||
import { IApiToken, ICredentialsDetails, ITokenReadWrite } from './types'; | |||
|
|||
const defaultApiToken: IApiToken = { | |||
export const defaultApiToken: IApiToken = { |
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.
Nice way to clean up tests 👍
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
History
To update your PR or re-run it, just comment with: |
* Add key name field * Add key type field * Add key read/write fields * Add key engine access / selection * Add key update warning callout * Update flyout body with form components * [PR feedback] i18n - change appSearch.tokens to appSearch.credentials * [PR feedback] Remove unnecessary conditional
) * Add key name field * Add key type field * Add key read/write fields * Add key engine access / selection * Add key update warning callout * Update flyout body with form components * [PR feedback] i18n - change appSearch.tokens to appSearch.credentials * [PR feedback] Remove unnecessary conditional Co-authored-by: Kibana Machine <[email protected]>
* master: (37 commits) [ILM] Migrate Warm phase to Form Lib (elastic#81323) [Security Solutions][Detection Engine] Fixes critical bug with error reporting that was doing a throw (elastic#81549) [Detection Rules] Add 7.10 rules (elastic#81676) [kbn/optimizer] ignore missing metrics when updating limits with --focus (elastic#81696) [SECURITY SOLUTIONS] Bugs overview page + investigate eql in timeline (elastic#81550) [Maps] fix unable to edit cluster vector styles styled by count when switching to super fine grid resolution (elastic#81525) Fixed migration issue for case specific actions, by extending email action migrator checks (elastic#81673) [CI] Preparation for APM tracking on CI (elastic#80399) [Home] Fixes Kibana app description order on home page and updates Canvas copy (elastic#80057) Make sure `to` is 'now' and not the same as `from` (elastic#81524) Nitpicking the 8.0 Breaking Change issue template (elastic#81678) [SECURITY_SOLUTION] Fix text on onboarding screen (elastic#81672) [data.search] Skip async search tests in build candidates and production builds (elastic#81547) Fix previousStartedAt by not changing when execution fails (elastic#81388) [Monitoring] Fix a couple of issues with the cpu usage alert (elastic#80737) Telemetry collection xpack to ts project references (elastic#81269) Elasticsearch: don't use url authentication for new client (elastic#81564) [App Search] Credentials: implement working flyout form (elastic#81541) Properly encode links to edit user page (elastic#81562) [Alerting UI] Don't wait for health check before showing Create Alert flyout (elastic#80996) ...
PR sequence
This PR is part of a set of 3 PRs that implements the Credentials flyout form + functionality. It's broken up into PRs in the 400-800 line range so as not to open a 1700~ line PR.
List of all PRs (may be helpful for obtaining more context / QAing the entire final feature)
Summary
This PR achieves:
Screencaps
Creating, updating, and deleting a key:
Example errors returned by API:
^ Note - I don't super love how the errors are "off screen" and sometimes not visible on smaller screens. I wish there was a way to address this, but it's probably out of scope for the migration. We also have the same issue on some scrolling modals so it's potentially something to address all at once later.
QA
Checklist