Clean up TSVB type client code to conform to the schema#68519
Clean up TSVB type client code to conform to the schema#68519DianaDerevyankina merged 11 commits intoelastic:masterfrom
Conversation
| nested?: { path: string }; | ||
| } | ||
|
|
||
| export interface FieldDescriptor { |
There was a problem hiding this comment.
I assume IFieldType from data plugin is fully suitable for TSVB, isn't it?
| onDelete: (event: MouseEvent) => void; | ||
| } | ||
|
|
||
| export function AddDeleteButtons(props: AddDeleteButtonsProps) { |
There was a problem hiding this comment.
Does it make sense to type in addition the test file for this component: add_delete_buttons.test.js ?
| panel: PanelSchema; | ||
| series: SeriesItemsSchema; | ||
| siblings: MetricsItemsSchema[]; | ||
| uiRestrictions: { '*': boolean }; |
There was a problem hiding this comment.
There is a list of possible ui restrictions keys exist in src/plugins/vis_type_timeseries/common/ui_restrictions.ts.
Could you please add them as possible keys?
# Conflicts: # src/plugins/vis_type_timeseries/common/post_vis_schema.ts
| */ | ||
|
|
||
| import React from 'react'; | ||
| // @ts-ignore |
There was a problem hiding this comment.
I think import { expect } from 'chai'; was added by mistake. Please remove it
|
|
||
| let enablePipelines = siblings.some((s) => !!metricAggs.find((m) => m.value === s.type)); | ||
| let enablePipelines = siblings.some( | ||
| (s: { id: string; type: string }) => !!metricAggs.find((m) => m.value === s.type) |
There was a problem hiding this comment.
Please don't add extra types like e.g. { id: string; type: string }. You already set type for siblings variable.
|
Pinging @elastic/kibana-app (Team:KibanaApp) |
|
@elasticmachine merge upstream |
alexwizp
left a comment
There was a problem hiding this comment.
Good first step of migrating js -> ts
|
@elasticmachine merge upstream |
sulemanof
left a comment
There was a problem hiding this comment.
Left few comments, but overall LGTM
| export interface TimeseriesUIRestrictions { | ||
| [RESTRICTIONS_KEYS.WHITE_LISTED_GROUP_BY_FIELDS]: Record<string, UIRestrictions>; | ||
| [RESTRICTIONS_KEYS.WHITE_LISTED_METRICS]: Record<string, UIRestrictions>; | ||
| [RESTRICTIONS_KEYS.WHITE_LISTED_TIMERANGE_MODES]: Record<string, UIRestrictions>; | ||
| } |
There was a problem hiding this comment.
Will this work for your case?
| export interface TimeseriesUIRestrictions { | |
| [RESTRICTIONS_KEYS.WHITE_LISTED_GROUP_BY_FIELDS]: Record<string, UIRestrictions>; | |
| [RESTRICTIONS_KEYS.WHITE_LISTED_METRICS]: Record<string, UIRestrictions>; | |
| [RESTRICTIONS_KEYS.WHITE_LISTED_TIMERANGE_MODES]: Record<string, UIRestrictions>; | |
| } | |
| export type TimeseriesUIRestrictions = { | |
| [key in RESTRICTIONS_KEYS]: Record<string, UIRestrictions>; | |
| }; |
|
|
||
| export const PercentileRankValues = (props) => { | ||
| interface PercentileRankValuesProps { | ||
| model: any[]; |
There was a problem hiding this comment.
Doesnt it receive MetricsItemsSchema['values']; ?
| const handlePercentileRankValuesChange = (values: Array<string | null> | null | undefined) => { | ||
| handleChange( | ||
| assign({}, model, { | ||
| values, |
There was a problem hiding this comment.
| const handlePercentileRankValuesChange = (values: Array<string | null> | null | undefined) => { | |
| handleChange( | |
| assign({}, model, { | |
| values, | |
| const handlePercentileRankValuesChange = (values: MetricsItemsSchema['values']) => { | |
| handleChange( | |
| assign({}, model, { | |
| values, |
You could also get rid of lodash here (we are trying to do it if possible):
handleChange({
...model,
values
})
| const htmlId = htmlIdGenerator(); | ||
|
|
||
| const onFieldNumberChange = (event) => | ||
| const onFieldNumberChange = (event: any) => |
| <EuiFieldNumber | ||
| value={model.value === '' ? '' : Number(model.value)} | ||
| placeholder={0} | ||
| placeholder={'0'} |
There was a problem hiding this comment.
Nit: you could also omit curly brackets with "0"
stratoula
left a comment
There was a problem hiding this comment.
LGTM, nice first touch :) I have also tested it on Chrome. Works as expected
|
@elasticmachine merge upstream |
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
* Clean up TSVB type client code to conform to the schema Part of elastic#57342 * Replace FieldDescriptor with IFieldType, add UIRestrictions interface * Replace expect from chai with @kbn/expect, remove unnecessary type * Add TimeseriesUIRestrictions type and refactor add_delete_buttons.test * Replace some types with MetricsItemsSchema['values'] to avoid duplications Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* master: (45 commits) [QA] Unskip functional tests (elastic#69760) [SIEM][Detection Engine] - Update DE to work with new exceptions schema (elastic#69715) Fixes elastic#69639: Ignore url.url fields above 2048 characters (elastic#69863) PR: Provide limit warnings to user when API limits are reached. (elastic#69590) [Maps] Remove broken button (elastic#69853) Makes usage collection methods available on start (elastic#69836) [SIEM][CASE] Improve Jira's labelling (elastic#69892) [Logs UI] Access ML via the programmatic plugin API (elastic#68905) [ML] DF Analytics: Creation wizard part 3 (elastic#69456) Update Resolver generator script documentation (elastic#69912) [ML] Changes View results button text on new job page (elastic#69809) Add master branch to backport config (elastic#69893) [Ingest Manager] Kibana, not EPR, controls removable packages (elastic#69761) unskips 'Events columns' test (elastic#69684) [ML] Changes the ML overview empty analytics panel text (elastic#69801) [DOCS] Emphasizes where File Data Visualizer is located. (elastic#69812) add the `exactRoute` property to app registration (elastic#69772) Bump backport to 5.4.6 (elastic#69880) [Logs UI] ML log integration splash screen (elastic#69288) Clean up TSVB type client code to conform to the schema (elastic#68519) ...
) * Clean up TSVB type client code to conform to the schema Part of #57342 * Replace FieldDescriptor with IFieldType, add UIRestrictions interface * Replace expect from chai with @kbn/expect, remove unnecessary type * Add TimeseriesUIRestrictions type and refactor add_delete_buttons.test * Replace some types with MetricsItemsSchema['values'] to avoid duplications Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Part of #57342
Summary
Summarize your PR. If it involves visual changes include a screenshot or gif.
Checklist
Delete any items that are not applicable to this PR.
For maintainers