[Reporting] Clean up types for internal APIs needed for UI#105508
[Reporting] Clean up types for internal APIs needed for UI#105508tsullivan merged 13 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-app-services (Team:AppServices) |
|
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
There was a problem hiding this comment.
This was all nearly duplicated from ReportSource
There was a problem hiding this comment.
Hoisted this to a class defined in another file
There was a problem hiding this comment.
The map is no longer needed as apiClient.list returns data in a usable format
980ac90 to
5d548ed
Compare
There was a problem hiding this comment.
This component is updated with a minor UI improvement to show a tooltip over the "info" icon. This makes it consistent with the "download" icon.
Fixes #103360
There was a problem hiding this comment.
Max attempts is set on the report once it is claimed. The main reason to do this is to show the information in the "info" panel in the UI.
6fc3653 to
eefc828
Compare
There was a problem hiding this comment.
This is done. The /list endpoint had the most inconsistencies.
There was a problem hiding this comment.
This comment is no longer true as of this PR
eefc828 to
3a85a26
Compare
| } | ||
|
|
||
| if (!report) { | ||
| this.reporting.untrackReport(jobId); |
jloleysens
left a comment
There was a problem hiding this comment.
Great job @tsullivan ! I did not run this locally, but all the changes make sense and I'm happy for this to be merged given green CI.
| * This class represents a report job for the UI | ||
| * It can be instantiated with ReportApiJSON: the response data format for the report job APIs | ||
| */ | ||
| export class Job { |
There was a problem hiding this comment.
Why are we using a class here? I think we could accomplish the same thing with just an interface and a function that maps one object to another (if needed). Unless we intend to associate behaviours with this in way that is in keeping with how we use classes elsewhere in Reporting.
There was a problem hiding this comment.
Unless we intend to associate behaviours with this in way that is in keeping with how we use classes elsewhere in Reporting.
Yes, this is the case. In an earlier incarnation of the code, there are methods on this class for achieving consistency about warnings [1], and then further on, showing some info about deprecated export types. That got to be a lot of changes in the UI that just needed to be isolated to a separate PR.
[1] Why is the only warning shown in a table cell about when the max size was reached? Why don't we use the table to show that a CSV could contain formulas, but we do show it in the toast notification? Why doesn't the info side panel show "status" the same way it's shown in the table?
x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts
Outdated
Show resolved
Hide resolved
| public verifyConfig = (): Promise<DiagnoseResponse> => | ||
| this.http.post(`${API_BASE_URL}/diagnose/config`, { | ||
| public async verifyConfig() { | ||
| return await this.http.post(`${API_BASE_URL}/diagnose/config`, { |
There was a problem hiding this comment.
Just FWIW: these functions don't do anything with the call result so we don't need async await sugar. I think the return type gaurds have us covered.
There was a problem hiding this comment.
It's kind of been preached to me to use this way instead of "desugared promises." It makes stack traces more readable, and there are some optimizations in V8 that went into making async and await native. https://v8.dev/blog/fast-async
x-pack/plugins/reporting/public/management/report_info_button.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/reporting/public/management/report_info_button.tsx
Outdated
Show resolved
Hide resolved
dokmic
left a comment
There was a problem hiding this comment.
Left a few minor suggestions. LGTM, great job 👍
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>
|
Found some bugs in the info panel due to usage of The next PR will have functional tests that cover the info panel in Reporting Management. |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
…05508) * [Reporting] Refactor types for API response data * fix api test * Update x-pack/plugins/reporting/common/types.ts Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com> * more verbose comments * set comments in interface type definition * Update x-pack/plugins/reporting/common/types.ts Co-authored-by: Michael Dokolin <dokmic@gmail.com> * more strict * Update x-pack/plugins/reporting/public/management/report_info_button.tsx Co-authored-by: Michael Dokolin <dokmic@gmail.com> * Update x-pack/plugins/reporting/public/management/report_info_button.tsx Co-authored-by: Michael Dokolin <dokmic@gmail.com> * fix suggestion * fix accidental declaration of interface methods as function properties * fix info panel Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com> Co-authored-by: Michael Dokolin <dokmic@gmail.com>
…105702) * [Reporting] Refactor types for API response data * fix api test * Update x-pack/plugins/reporting/common/types.ts Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com> * more verbose comments * set comments in interface type definition * Update x-pack/plugins/reporting/common/types.ts Co-authored-by: Michael Dokolin <dokmic@gmail.com> * more strict * Update x-pack/plugins/reporting/public/management/report_info_button.tsx Co-authored-by: Michael Dokolin <dokmic@gmail.com> * Update x-pack/plugins/reporting/public/management/report_info_button.tsx Co-authored-by: Michael Dokolin <dokmic@gmail.com> * fix suggestion * fix accidental declaration of interface methods as function properties * fix info panel Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com> Co-authored-by: Michael Dokolin <dokmic@gmail.com> Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com> Co-authored-by: Michael Dokolin <dokmic@gmail.com>
…-png-pdf-report-type * 'master' of github.com:elastic/kibana: (75 commits) [Search Sessions] Don’t try to delete errored searches (elastic#105434) [Search Sessions] fix saved object can be created even if courier:batchSearches is enabled (elastic#105407) [Remote Clusters] Fixed remote clusters details flyout for long strings (elastic#105592) [ML] Functional tests - re-activate a11y tests (elastic#105198) [APM] Typed client-side routing (elastic#104274) [Canvas] Expression error (elastic#103048) [ML] Fixing job wizard with missing description (elastic#105574) [Security Solution][Alerts] - Add alerts subfeature UI (elastic#105505) Upgrade EUI to v35.0.0 (elastic#105127) [Reporting] Clean up types for internal APIs needed for UI (elastic#105508) skip flaky suite (elastic#105087) [Workplace Search] Fix Chrome issues with GitHub sources (elastic#105680) [Fleet] Add containerized fleet server instructions to Fleet README (elastic#105669) [ML] Add api integration test for analytics map endpoint (elastic#105531) Fixes cypress flake across two tests (elastic#105645) [Logs&Metrics UI] add owner properties to plugin manifest (elastic#105580) chore(NA): introduce preset for jest-integration tests on @kbn/test (elastic#105144) [Enterprise Search] Added Thumbnails to Search UI (elastic#104199) Translate App Search credentials list (elastic#105619) [APM] APM agent config created prior to Fleet migration is not injected into integration policy (elastic#105504) ... # Conflicts: # x-pack/plugins/reporting/common/types.ts # x-pack/plugins/reporting/public/management/report_listing.test.tsx
Summary
Needed for #102833
Closes #104791
Closes #105155
Closes #103360
Cleanups to achieve type consistency:
ReportSource['max_attempts']is allowed to be undefined.Note: The max attempts number is taken from configuration of the Kibana instance executing the job. This makes the max attempts number more consistent with other fields that only apply to jobs that have been claimed such as
timeoutandbrowser_type.ReportApiJSON:ReportSourceas the source of truthpayload.headersandoutput.contentare omitted to avoid long strings of encrypted text in API responsesJobclass inreporting/public/lib/job.tsto handle implementation details of the fields of a report job for the UI.public/lib/reporting_api_client/reporting_api_client.tsany_.get()Changes to API responses:
/api/reporting/jobs/listReportApiJSON[]format. Previously, the response data was unformatted from the original document in Elasticsearch (ReportSourceformat).These are internal APIs and are not subject to backwards compatibility with older scripts.
This PR will not contain any user-facing changes as those will be isolated to #102833
Checklist
Delete any items that are not applicable to this PR.
For maintainers