-
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
[File upload] Migrate routing to NP & add route validation #52313
Conversation
💚 Build Succeeded |
…-validation # Conflicts: # x-pack/legacy/plugins/file_upload/server/plugin.js # x-pack/legacy/plugins/file_upload/server/routes/file_upload.js
💚 Build SucceededTo update your PR or re-run it, just comment with: |
…gic on server-side
const { appName, index, data, settings, mappings, ingestPipeline } = indexingDetails; | ||
|
||
return await httpService({ | ||
url: `${apiBasePath}/fileupload/import${paramString}`, | ||
url: `/api/fileupload/import`, |
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.
Using NP internal fetch, it's no longer necessary to prepend a basepath
method: 'POST', | ||
...(query ? { query }: {}), |
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.
We were appending this to the request string. Add here as a query instead when it exists
@@ -17,11 +14,10 @@ export async function http(options) { | |||
}); | |||
} | |||
const url = options.url || ''; | |||
const headers = addSystemApiHeader({ |
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.
FYI you should be passing the asSystemRequest
option to http.fetch if you still need this. That said, I'm not sure this request should be a system request. That flag is mostly used to bypass logic like session expiration or unauthorized responses that should redirect to the login page.
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.
Good to know. I don't think we'd want to treat it as a system request since eventually we'll want it to redirect to login if needed (i.e.- not bypass the logic that checks auth, etc.). So, sounds like the changes in place make sense?
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
tested in chrome. lgtm from Maps-end.
…2313) * Cursory validation * Handle empty data arrays and settings conditionally * Set validation defaults. Move logic to routes folder and separate for testing * Move plugin init back into routes folder. Syntax updates * Migrate router to NP * Use new np router and fetch. Add placeholder schema validation * Override default 'maxBytes' * Body with first-level schema keys in place * Add conditional validation of mappings, data and settings. Clean up old joi code * Ensure query is handled correctly on both sides. Iron out decision logic on server-side * Move conditional validation to first step in payload handling * Update http_service to work with latest NP changes on master * Some reorg. Only update telemetry if no errors * Clean up * Test file upload validation logic * Linting * Review feedback. Remove unneeded apiBasePath var * Pass entire req object with through to ES, not just the validated fields
…b.com:jloleysens/kibana into console/feature/text-objects-in-saved-objects * 'console/feature/text-objects-in-saved-objects' of github.com:jloleysens/kibana: (103 commits) fix auto closing new vis modal when navigating to lens or when navigating away with browser history (elastic#56998) TS of esKuery\node_types (elastic#56857) Kibana app migration: Move static code dependencies into kibana_legacy plugin, part 1 (elastic#56408) Retry ES API calls that fail with 410/Gone (elastic#56950) [APM] Show missing permissions message to the user on the Services overview (elastic#56374) Fixing flaky CI tests for custom appRoutes (elastic#55763) [State Management][Docs] State syncing utils docs (elastic#56479) [Index management] Remove index mapper setting in tests (elastic#57066) Exposed common EuiExpressions to separate components be able to reuse for building new for Alert Types (elastic#56466) [SIEM] update url state between page if date is relative (elastic#56813) fix for chart_types test (elastic#57056) chore(NA): remove compress from dll minimizer (elastic#57023) [File upload] Migrate routing to NP & add route validation (elastic#52313) Adding docs for grouped nav advanced setting (elastic#57013) Use i18n titles for field formatters, human names for numeral locales (elastic#56348) [Maps] Remove EMS catalogue url from docs (elastic#57020) [Endpoint] ERT-82 ERT-83 ERT-84: Alert list API with pagination (elastic#56538) [DOCS] Adds Apple notarization info to install doc (elastic#57042) [ML] New Platform server shim: update results service routes to use new platform router (elastic#56886) Fix typo on detection engine rule (elastic#56993) ...
…57063) * Cursory validation * Handle empty data arrays and settings conditionally * Set validation defaults. Move logic to routes folder and separate for testing * Move plugin init back into routes folder. Syntax updates * Migrate router to NP * Use new np router and fetch. Add placeholder schema validation * Override default 'maxBytes' * Body with first-level schema keys in place * Add conditional validation of mappings, data and settings. Clean up old joi code * Ensure query is handled correctly on both sides. Iron out decision logic on server-side * Move conditional validation to first step in payload handling * Update http_service to work with latest NP changes on master * Some reorg. Only update telemetry if no errors * Clean up * Test file upload validation logic * Linting * Review feedback. Remove unneeded apiBasePath var * Pass entire req object with through to ES, not just the validated fields
Adds validation for file_upload route
/api/fileupload/import
for both initial index creation and subsequent index population using the NP router and schema validation