diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bd73e60d1c9141..4e2abd5a3db1c3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -45,7 +45,6 @@ /x-pack/test/functional/services/transform.ts @elastic/ml-ui # Operations -/renovate.json5 @elastic/kibana-operations /src/dev/ @elastic/kibana-operations /src/setup_node_env/ @elastic/kibana-operations /src/optimize/ @elastic/kibana-operations diff --git a/docs/canvas/canvas-function-reference.asciidoc b/docs/canvas/canvas-function-reference.asciidoc index 07f3cf028dc0e3..330cc63d105488 100644 --- a/docs/canvas/canvas-function-reference.asciidoc +++ b/docs/canvas/canvas-function-reference.asciidoc @@ -28,7 +28,7 @@ Returns `true` if all of the conditions are met. See also <>. *Expression syntax* [source,js] ---- -all {neq “foo”} {neq “bar”} {neq “fizz”} +all {neq "foo"} {neq "bar"} {neq "fizz"} all condition={gt 10} condition={lt 20} ---- @@ -49,7 +49,7 @@ filters } | render ---- -This sets the color of the metric text to `”red”` if the context passed into `metric` is greater than or equal to 0 and less than 0.8. Otherwise, the color is set to `"green"`. +This sets the color of the metric text to `"red"` if the context passed into `metric` is greater than or equal to 0 and less than 0.8. Otherwise, the color is set to `"green"`. *Accepts:* `null` @@ -76,8 +76,8 @@ Converts between core types, including `string`, `number`, `null`, `boolean`, an *Expression syntax* [source,js] ---- -alterColumn “cost” type=”string” -alterColumn column=”@timestamp” name=”foo” +alterColumn "cost" type="string" +alterColumn column="@timestamp" name="foo" ---- *Code example* @@ -85,7 +85,7 @@ alterColumn column=”@timestamp” name=”foo” ---- filters | demodata -| alterColumn “time” name=”time_in_ms” type=”number” +| alterColumn "time" name="time_in_ms" type="number" | table | render ---- @@ -97,7 +97,7 @@ This renames the `time` column to `time_in_ms` and converts the type of the colu |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `column` |`string` @@ -124,7 +124,7 @@ Returns `true` if at least one of the conditions is met. See also <>. *Expression syntax* [source,js] ---- -any {eq “foo”} {eq “bar”} {eq “fizz”} +any {eq "foo"} {eq "bar"} {eq "fizz"} any condition={lte 10} condition={gt 30} ---- @@ -140,7 +140,7 @@ filters | pie | render ---- -This filters out any rows that don’t contain `“elasticsearch”`, `“kibana”` or `“x-pack”` in the `project` field. +This filters out any rows that don’t contain `"elasticsearch"`, `"kibana"` or `"x-pack"` in the `project` field. *Accepts:* `null` @@ -167,9 +167,9 @@ Creates a `datatable` with a single value. See also <>. *Expression syntax* [source,js] ---- -as -as “foo” -as name=”bar” +as +as "foo" +as name="bar" ---- *Code example* @@ -182,7 +182,7 @@ filters | plot | render ---- -`as` casts any primitive value (`string`, `number`, `date`, `null`) into a `datatable` with a single row and a single column with the given name (or defaults to `"value"` if no name is provided). This is useful when piping a primitive value into a function that only takes `datatable` as an input. +`as` casts any primitive value (`string`, `number`, `date`, `null`) into a `datatable` with a single row and a single column with the given name (or defaults to `"value"` if no name is provided). This is useful when piping a primitive value into a function that only takes `datatable` as an input. In the example above, `ply` expects each `fn` subexpression to return a `datatable` in order to merge the results of each `fn` back into a `datatable`, but using a `math` aggregation in the subexpressions returns a single `math` value, which is then cast into a `datatable` using `as`. @@ -192,7 +192,7 @@ In the example above, `ply` expects each `fn` subexpression to return a `datatab |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `name` |`string` @@ -223,7 +223,7 @@ asset id="asset-498f7429-4d56-42a2-a7e4-8bf08d98d114" image dataurl={asset "asset-c661a7cc-11be-45a1-a401-d7592ea7917a"} mode="contain" | render ---- -The image asset stored with the ID `“asset-c661a7cc-11be-45a1-a401-d7592ea7917a”` is passed into the `dataurl` argument of the `image` function to display the stored asset. +The image asset stored with the ID `"asset-c661a7cc-11be-45a1-a401-d7592ea7917a"` is passed into the `dataurl` argument of the `image` function to display the stored asset. *Accepts:* `null` @@ -251,7 +251,7 @@ Configures the axis of a visualization. Only used with <>. [source,js] ---- axisConfig show=false -axisConfig position=”right” min=0 max=10 tickSize=1 +axisConfig position="right" min=0 max=10 tickSize=1 ---- *Code example* @@ -260,9 +260,9 @@ axisConfig position=”right” min=0 max=10 tickSize=1 filters | demodata | pointseries x="size(cost)" y="project" color="project" -| plot defaultStyle={seriesStyle bars=0.75 horizontalBars=true} - legend=false - xaxis={axisConfig position="top" min=0 max=400 tickSize=100} +| plot defaultStyle={seriesStyle bars=0.75 horizontalBars=true} + legend=false + xaxis={axisConfig position="top" min=0 max=400 tickSize=100} yaxis={axisConfig position="right"} | render ---- @@ -276,21 +276,21 @@ This sets the `x-axis` to display on the top of the chart and sets the range of |`max` |`number`, `string`, `null` -|The maximum value displayed in the axis. Must be a `number`, a date in milliseconds since epoch, or an ISO8601 `string` +|The maximum value displayed in the axis. Must be a number, a date in milliseconds since epoch, or an ISO8601 string. |`min` |`number`, `string`, `null` -|The minimum value displayed in the axis. Must be a `number`, a date in milliseconds since epoch, or an ISO8601 `string` +|The minimum value displayed in the axis. Must be a number, a date in milliseconds since epoch, or an ISO8601 string. |`position` |`string` -|The position of the axis labels. For example, `"top"`, `"bottom"`, `"left"`, or `"right"`. +|The position of the axis labels. For example, `"top"`, `"bottom"`, `"left"`, or `"right"`. Default: `"left"` |`show` |`boolean` -|Show the axis labels? +|Show the axis labels? Default: `true` @@ -309,30 +309,30 @@ Default: `true` [[case_fn]] === `case` -Builds a `case` (including a condition/result) to pass to the <> function. +Builds a <>, including a condition and a result, to pass to the <> function. *Expression syntax* [source,js] ---- -case 0 then=”red” -case when=5 then=”yellow” -case if={lte 50} then=”green” +case 0 then="red" +case when=5 then="yellow" +case if={lte 50} then="green" ---- *Code example* [source,text] ---- math "random()" -| progress shape="gauge" label={formatnumber "0%"} - font={font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" align="center" +| progress shape="gauge" label={formatnumber "0%"} + font={font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" align="center" color={ - switch {case if={lte 0.5} then="green"} - {case if={all {gt 0.5} {lte 0.75}} then="orange"} + switch {case if={lte 0.5} then="green"} + {case if={all {gt 0.5} {lte 0.75}} then="orange"} default="red" - }} + }} valueColor={ - switch {case if={lte 0.5} then="green"} - {case if={all {gt 0.5} {lte 0.75}} then="orange"} + switch {case if={lte 0.5} then="green"} + {case if={all {gt 0.5} {lte 0.75}} then="orange"} default="red" } | render @@ -345,7 +345,7 @@ This sets the color of the progress indicator and the color of the label to `"gr |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `when` |`any` @@ -378,13 +378,13 @@ Clears the _context_, and returns `null`. [[columns_fn]] === `columns` -Includes or excludes columns from a data table. If you specify both, this will exclude first. +Includes or excludes columns from a `datatable`. When both arguments are specified, the excluded columns will be removed first. *Expression syntax* [source,js] ---- -columns include=”@timestamp, projects, cost” -columns exclude=”username, country, age” +columns include="@timestamp, projects, cost" +columns exclude="username, country, age" ---- *Code example* @@ -404,11 +404,11 @@ This only keeps the `price`, `cost`, `state`, and `project` columns from the `de |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `include` |`string` -|A comma-separated list of column names to keep in the `datatable`. +|A comma-separated list of column names to keep in the `datatable`. |`exclude` |`string` @@ -417,20 +417,18 @@ Alias: `include` *Returns:* `datatable` - + [float] [[compare_fn]] === `compare` -Compares the _context_ to specified value to determine `true` or `false`. -Usually used in combination with <> or <>. This only works with primitive types, -such as `number`, `string`, and `boolean`. See also <>, <>, <>, <>, <>, and <>. +Compares the _context_ to specified value to determine `true` or `false`. Usually used in combination with `<>` or <>. This only works with primitive types, such as `number`, `string`, `boolean`, `null`. See also <>, <>, <>, <>, <>, <> *Expression syntax* [source,js] ---- -compare “neq” to=”elasticsearch” -compare op=”lte” to=100 +compare "neq" to="elasticsearch" +compare op="lte" to=100 ---- *Code example* @@ -438,18 +436,18 @@ compare op=”lte” to=100 ---- filters | demodata -| mapColumn project - fn=${getCell project | - switch +| mapColumn project + fn={getCell project | + switch {case if={compare eq to=kibana} then=kibana} {case if={compare eq to=elasticsearch} then=elasticsearch} default="other" } | pointseries size="size(cost)" color="project" -| pie +| pie | render ---- -This maps all `project` values that aren’t `“kibana”` and `“elasticsearch”` to `“other”`. Alternatively, you can use the individual comparator functions instead of compare. See <>, <>, <>, <>, <>, and <>. +This maps all `project` values that aren’t `"kibana"` and `"elasticsearch"` to `"other"`. Alternatively, you can use the individual comparator functions instead of compare. *Accepts:* `string`, `number`, `boolean`, `null` @@ -457,17 +455,17 @@ This maps all `project` values that aren’t `“kibana”` and `“elasticsearc |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `op` |`string` -|The operator to use in the comparison: `eq` (equal to), `gt` (greater than), `gte` (greater than or equal to), `lt` (less than), `lte` (less than or equal to), `ne` or `neq` (not equal to). +|The operator to use in the comparison: `"eq"` (equal to), `"gt"` (greater than), `"gte"` (greater than or equal to), `"lt"` (less than), `"lte"` (less than or equal to), `"ne"` or `"neq"` (not equal to). Default: `"eq"` -|`to` +|`to` -Alias: `this`, `b` +Aliases: `b`, `this` |`any` |The value compared to the _context_. |=== @@ -484,29 +482,28 @@ Creates an object used for styling an element's container, including background, *Expression syntax* [source,js] ---- -containerStyle backgroundColor=”red”’ -containerStyle borderRadius=”50px” -containerStyle border=”1px solid black” -containerStyle padding=”5px” -containerStyle opacity=”0.5” -containerStyle overflow=”hidden” -containerStyle backgroundImage={asset id=asset-f40d2292-cf9e-4f2c-8c6f-a504a25e949c} - backgroundRepeat="no-repeat" - backgroundSize="cover" +containerStyle backgroundColor="red"’ +containerStyle borderRadius="50px" +containerStyle border="1px solid black" +containerStyle padding="5px" +containerStyle opacity="0.5" +containerStyle overflow="hidden" +containerStyle backgroundImage={asset id=asset-f40d2292-cf9e-4f2c-8c6f-a504a25e949c} + backgroundRepeat="no-repeat" + backgroundSize="cover" ---- *Code example* [source,text] ---- -shape "star" fill="#E61D35" maintainAspect=true -| render - containerStyle={ - containerStyle backgroundColor="#F8D546" - borderRadius="200px" - border="4px solid #05509F" - padding="0px" - opacity="0.9" - overflow="hidden" +shape "star" fill="#E61D35" maintainAspect=true +| render containerStyle={ + containerStyle backgroundColor="#F8D546" + borderRadius="200px" + border="4px solid #05509F" + padding="0px" + opacity="0.9" + overflow="hidden" } ---- @@ -566,8 +563,7 @@ Default: `"hidden"` [[context_fn]] === `context` -Returns whatever you pass into it. This can be useful when you need to use the -_context_ as an argument to a function as a sub-expression. +Returns whatever you pass into it. This can be useful when you need to use _context_ as argument to a function as a sub-expression. *Expression syntax* [source,js] @@ -580,40 +576,41 @@ context ---- date | formatdate "LLLL" -| markdown "Last updated: " {context} +| markdown "Last updated: " {context} | render ---- Using the `context` function allows us to pass the output, or _context_, of the previous function as a value to an argument in the next function. Here we get the formatted date string from the previous function and pass it as `content` for the markdown element. *Accepts:* `any` -*Returns:* Original _context_ +*Returns:* Depends on your input and arguments + [float] [[csv_fn]] -=== `csv` +=== `csv` Creates a `datatable` from CSV input. *Expression syntax* [source,js] ---- -csv “fruit, stock - kiwi, 10 - Banana, 5” +csv "fruit, stock + kiwi, 10 + Banana, 5" ---- *Code example* [source,text] ---- csv "fruit,stock - kiwi,10 - banana,5" + kiwi,10 + banana,5" | pointseries color=fruit size=stock | pie | render ---- -This is useful for quickly mocking data. +This creates a `datatable` with `fruit` and `stock` columns with two rows. This is useful for quickly mocking data. *Accepts:* `null` @@ -621,7 +618,7 @@ This is useful for quickly mocking data. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `data` |`string` @@ -631,14 +628,13 @@ Alias: `data` |`string` |The data separation character. -|`newLine` +|`newline` |`string` |The row separation character. |=== *Returns:* `datatable` - [float] [[d_fns]] == D @@ -647,15 +643,15 @@ Alias: `data` [[date_fn]] === `date` -Returns the current time, or a time parsed from a `string`, as milliseconds since epoch. +Returns the current time, or a time parsed from a specified string, as milliseconds since epoch. *Expression syntax* [source,js] ---- date date value=1558735195 -date “2019-05-24T21:59:55+0000” -date “01/31/2019” format=”MM/DD/YYYY” +date "2019-05-24T21:59:55+0000" +date "01/31/2019" format="MM/DD/YYYY" ---- *Code example* @@ -663,11 +659,11 @@ date “01/31/2019” format=”MM/DD/YYYY” ---- date | formatdate "LLL" -| markdown {context} - font={font family="Arial, sans-serif" size=30 align="left" - color="#000000" - weight="normal" - underline=false +| markdown {context} + font={font family="Arial, sans-serif" size=30 align="left" + color="#000000" + weight="normal" + underline=false italic=false} | render ---- @@ -679,17 +675,15 @@ Using `date` without passing any arguments will return the current date and time |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `value` |`string` -|A date string to be parsed into milliseconds since epoch. The date string be either a valid JavaScript Date input or a string to parse -using the `format` argument. Must be an ISO8601 string or you must provide the format. +|An optional date string that is parsed into milliseconds since epoch. The date string can be either a valid JavaScript `Date` input or a string to parse using the `format` argument. Must be an ISO8601 string, or you must provide the format. |`format` |`string` -|The MomentJS format for parsing the optional date -`string`. See the https://momentjs.com/docs/#/displaying/[MomentJS documentation]. +|The MomentJS format used to parse the specified date string. For more information, see https://momentjs.com/docs/#/displaying/. |=== *Returns:* `number` @@ -701,35 +695,17 @@ using the `format` argument. Must be an ISO8601 string or you must provide the f A mock data set that includes project CI times with usernames, countries, and run phases. -*Expression syntax* -[source,js] ----- -demodata -demodata “ci” -demodata type=”shirts” ----- - -*Code example* -[source,text] ----- -filters -| demodata -| table -| render ----- -`demodata` is a mock data set that you can use to start playing around in Canvas. - *Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `type` |`string` -|The name of the demo data set to use. +|The name of the demo data set to use. Default: `"ci"` |=== @@ -741,24 +717,7 @@ Default: `"ci"` [[do_fn]] === `do` -Executes multiple sub-expressions, then returns the original _context_. Use for running functions that produce an action or side effect without changing the original _context_. - -*Expression syntax* -[source,js] ----- -do fn={something cool} ----- - -*Code example* -[source,text] ----- -filters -| demodata -| do fn={something cool} -| table -| render ----- -`do` should be used to invoke a function that produces as a side effect without changing the `context`. +Executes multiple sub-expressions, then returns the original _context_. Use for running functions that produce an action or a side effect without changing the original _context_. *Accepts:* `any` @@ -768,12 +727,12 @@ filters |_Unnamed_ † -Aliases: `expression`, `exp`, `fn`, `function` +Aliases: `exp`, `expression`, `fn`, `function` |`any` -|The sub-expressions to execute. The return values of these sub-expressions are not available in the root pipeline as this function simply returns the _context_. +|The sub-expressions to execute. The return values of these sub-expressions are not available in the root pipeline as this function simply returns the original _context_. |=== -*Returns:* Original _context_ +*Returns:* Depends on your input and arguments [float] @@ -793,7 +752,7 @@ dropdownControl valueColumn=agent filterColumn=agent.keyword filterGroup=group1 [source,text] ---- demodata -| dropdownControl valueColumn=project filterColumn=project +| dropdownControl valueColumn=project filterColumn=project | render ---- This creates a dropdown filter element. It requires a data source and uses the unique values from the given `valueColumn` (i.e. `project`) and applies the filter to the `project` column. Note: `filterColumn` should point to a keyword type field for Elasticsearch data sources. @@ -808,18 +767,17 @@ This creates a dropdown filter element. It requires a data source and uses the u |`string` |The column or field that you want to filter. -|`valueColumn` *** -|`string` -|The column or field to extract the unique values for the drop-down control. - |`filterGroup` |`string` |The group name for the filter. + +|`valueColumn` *** +|`string` +|The column or field from which to extract the unique values for the dropdown control. |=== *Returns:* `render` - [float] [[e_fns]] == E @@ -836,7 +794,7 @@ Returns whether the _context_ is equal to the argument. eq true eq null eq 10 -eq “foo” +eq "foo" ---- *Code example* @@ -844,18 +802,18 @@ eq “foo” ---- filters | demodata -| mapColumn project - fn=${getCell project | - switch +| mapColumn project + fn={getCell project | + switch {case if={eq kibana} then=kibana} {case if={eq elasticsearch} then=elasticsearch} default="other" } | pointseries size="size(cost)" color="project" -| pie +| pie | render ---- -This changes all values in the project column that don’t equal `“kibana”` or `“elasticsearch”` to `“other”`. +This changes all values in the project column that don’t equal `"kibana"` or `"elasticsearch"` to `"other"`. *Accepts:* `boolean`, `number`, `string`, `null` @@ -863,7 +821,7 @@ This changes all values in the project column that don’t equal `“kibana”` |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`boolean`, `number`, `string`, `null` @@ -877,29 +835,7 @@ Alias: `value` [[escount_fn]] === `escount` -Queries {es} for the number of hits matching the specified query. - -*Expression syntax* -[source,js] ----- -escount index=”logstash-*” -escount "currency:\"EUR\"" index=”kibana_sample_data_ecommerce” -escount query="response:404" index=”kibana_sample_data_logs” ----- - -*Code example* -[source,text] ----- -filters -| escount "Cancelled:true" index="kibana_sample_data_flights" -| math "value" -| progress shape="semicircle" - label={formatnumber 0,0} - font={font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center} - max={filters | escount index="kibana_sample_data_flights"} -| render ----- -The first `escount` expression retrieves the number of flights that were cancelled. The second `escount` expression retrieves the total number of flights. +Query Elasticsearch for the number of hits matching the specified query. *Accepts:* `filter` @@ -907,9 +843,9 @@ The first `escount` expression retrieves the number of flights that were cancell |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ -Alias: `q`, `query` +Aliases: `q`, `query` |`string` |A Lucene query string. @@ -929,36 +865,7 @@ Default: `_all` [[esdocs_fn]] === `esdocs` -Queries {es} for raw documents. Specify the fields you want to retrieve, -especially if you are asking for a lot of rows. - -*Expression syntax* -[source,js] ----- -esdocs index=”logstash-*” -esdocs "currency:\"EUR\"" index=”kibana_sample_data_ecommerce” -esdocs query="response:404" index=”kibana_sample_data_logs” -esdocs index=”kibana_sample_data_flights” count=100 -esdocs index="kibana_sample_data_flights" sort="AvgTicketPrice, asc" ----- - -*Code example* -[source,text] ----- -filters -| esdocs index="kibana_sample_data_ecommerce" - fields="customer_gender, taxful_total_price, order_date" - sort="order_date, asc" - count=10000 -| mapColumn "order_date" - fn={getCell "order_date" | date {context} | rounddate "YYYY-MM-DD"} -| alterColumn "order_date" type="date" -| pointseries x="order_date" y="sum(taxful_total_price)" color="customer_gender" -| plot defaultStyle={seriesStyle lines=3} - palette={palette "#7ECAE3" "#003A4D" gradient=true} -| render ----- -This retrieves the latest 10000 documents data from the `kibana_sample_data_ecommerce` index sorted by `order_date` in ascending order and only requests the `customer_gender`, `taxful_total_price`, and `order_date` fields. +Query Elasticsearch for raw documents. Specify the fields you want to retrieve, especially if you are asking for a lot of rows. *Accepts:* `filter` @@ -966,7 +873,7 @@ This retrieves the latest 10000 documents data from the `kibana_sample_data_ecom |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Aliases: `q`, `query` |`string` @@ -986,9 +893,13 @@ Default: `1000` |`index` |`string` -|An index or index pattern. For example, `"logstash-*"`. +|An index or index pattern. For example, `"logstash-*"`. -Default: `"_all"` +Default: `_all` + +|`metaFields` +|`string` +|Comma separated list of meta fields. For example, `"_index,_type"`. |`sort` |`string` @@ -1002,22 +913,7 @@ Default: `"_all"` [[essql_fn]] === `essql` -Queries {es} using {es} SQL. - -*Expression syntax* -[source,js] ----- -essql query=”SELECT * FROM \”logstash*\”” -essql “SELECT * FROM \”apm*\”” count=10000 ----- - -*Code example* -[source,text] ----- -filters -| essql query="SELECT Carrier, FlightDelayMin, AvgTicketPrice FROM \"kibana_sample_data_flights\"" ----- -This retrieves the `Carrier`, `FlightDelayMin`, and `AvgTicketPrice` fields from the “kibana_sample_data_flights” index. +Queries Elasticsearch using Elasticsearch SQL. *Accepts:* `filter` @@ -1025,19 +921,21 @@ This retrieves the `Carrier`, `FlightDelayMin`, and `AvgTicketPrice` fields from |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ -Alias: `q`, `query` +Aliases: `q`, `query` |`string` -|An {es} SQL query. +|An Elasticsearch SQL query. |`count` |`number` -|The number of documents to retrieve. Smaller numbers perform better. +|The number of documents to retrieve. For better performance, use a smaller data set. Default: `1000` |`timezone` + +Alias: `tz` |`string` |The timezone to use for date operations. Valid ISO8601 formats and UTC offsets both work. @@ -1056,9 +954,9 @@ Creates a filter that matches a given column to an exact value. *Expression syntax* [source,js] ---- -exactly “state” value=”running” -exactly “age” value=50 filterGroup=”group2” -exactly column=“project” value=”beats” +exactly "state" value="running" +exactly "age" value=50 filterGroup="group2" +exactly column="project" value="beats" ---- *Code example* @@ -1071,7 +969,7 @@ filters | plot defaultStyle={seriesStyle bars=1} | render ---- -The `exactly` filter here is added to existing filters retrieved by the `filters` function and further filters down the data to only have `”elasticsearch”` data. The `exactly` filter only applies to this one specific element and will not affect other elements in the workpad. +The `exactly` filter here is added to existing filters retrieved by the `filters` function and further filters down the data to only have `"elasticsearch"` data. The `exactly` filter only applies to this one specific element and will not affect other elements in the workpad. *Accepts:* `filter` @@ -1081,25 +979,23 @@ The `exactly` filter here is added to existing filters retrieved by the `filters |`column` *** -Aliases: `field`, `c` +Aliases: `c`, `field` |`string` |The column or field that you want to filter. +|`filterGroup` +|`string` +|The group name for the filter. + |`value` *** Aliases: `v`, `val` |`string` -|The value to match exactly, including white space and -capitalization. - -|`filterGroup` -|`string` -|The group name for the filter. +|The value to match exactly, including white space and capitalization. |=== *Returns:* `filter` - [float] [[f_fns]] == F @@ -1113,8 +1009,8 @@ Filters rows in a `datatable` based on the return value of a sub-expression. *Expression syntax* [source,js] ---- -filterrows {getCell “project” | eq “kibana”} -filterrows fn={getCell “age” | gt 50} +filterrows {getCell "project" | eq "kibana"} +filterrows fn={getCell "age" | gt 50} ---- *Code example* @@ -1123,11 +1019,11 @@ filterrows fn={getCell “age” | gt 50} filters | demodata | filterrows {getCell "country" | any {eq "IN"} {eq "US"} {eq "CN"}} -| mapColumn "@timestamp" +| mapColumn "@timestamp" fn={getCell "@timestamp" | rounddate "YYYY-MM"} | alterColumn "@timestamp" type="date" | pointseries x="@timestamp" y="mean(cost)" color="country" -| plot defaultStyle={seriesStyle points="2" lines="1"} +| plot defaultStyle={seriesStyle points="2" lines="1"} palette={palette "#01A4A4" "#CC6666" "#D0D102" "#616161" "#00A1CB" "#32742C" "#F18D05" "#113F8C" "#61AE24" "#D70060" gradient=false} | render ---- @@ -1139,13 +1035,11 @@ This uses `filterrows` to only keep data from India (`IN`), the United States (` |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** -Aliases: `fn`, `exp`, `expression` +Aliases: `exp`, `expression`, `fn`, `function` |`boolean` -|An expression to pass into each row in the `datatable.` -The expression should return a `boolean`. A `true` value preserves the row, -and a `false` value removes it. +|An expression to pass into each row in the `datatable`. The expression should return a `boolean`. A `true` value preserves the row, and a `false` value removes it. |=== *Returns:* `datatable` @@ -1161,8 +1055,8 @@ Aggregates element filters from the workpad for use elsewhere, usually a data so [source,js] ---- filters -filters group=”timefilter1” -filters group=”timefilter2” group=”dropdownfilter1” ungrouped=true +filters group="timefilter1" +filters group="timefilter2" group="dropdownfilter1" ungrouped=true ---- *Code example* @@ -1171,19 +1065,19 @@ filters group=”timefilter2” group=”dropdownfilter1” ungrouped=true filters group=group2 ungrouped=true | demodata | pointseries x="project" y="size(cost)" color="project" -| plot defaultStyle={seriesStyle bars=0.75} legend=false +| plot defaultStyle={seriesStyle bars=0.75} legend=false font={ - font size=14 - family="'Open Sans', Helvetica, Arial, sans-serif" - align="left" - color="#FFFFFF" - weight="lighter" - underline=true + font size=14 + family="'Open Sans', Helvetica, Arial, sans-serif" + align="left" + color="#FFFFFF" + weight="lighter" + underline=true italic=true } | render ---- -`filters` sets the existing filters as context and accepts `group` parameter to create filter groups. +`filters` sets the existing filters as context and accepts a `group` parameter to opt into specific filter groups. Setting `ungrouped` to `true` opts out of using global filters. *Accepts:* `null` @@ -1191,7 +1085,7 @@ filters group=group2 ungrouped=true |=== |Argument |Type |Description -|_Unnamed_ † +|_Unnamed_ † Alias: `group` |`string` @@ -1199,7 +1093,7 @@ Alias: `group` |`ungrouped` -Alias: `nogroup`, `nogroups` +Aliases: `nogroup`, `nogroups` |`boolean` |Exclude filters that belong to a filter group? @@ -1234,14 +1128,14 @@ font lHeight=32 filters | demodata | pointseries x="project" y="size(cost)" color="project" -| plot defaultStyle={seriesStyle bars=0.75} legend=false +| plot defaultStyle={seriesStyle bars=0.75} legend=false font={ - font size=14 - family="'Open Sans', Helvetica, Arial, sans-serif" - align="left" - color="#FFFFFF" - weight="lighter" - underline=true + font size=14 + family="'Open Sans', Helvetica, Arial, sans-serif" + align="left" + color="#FFFFFF" + weight="lighter" + underline=true italic=true } | render @@ -1255,7 +1149,7 @@ filters |`align` |`string` -|The horizontal alignment of text. +|The horizontal text alignment. Default: `left` @@ -1265,40 +1159,41 @@ Default: `left` |`family` |`string` -|An acceptable CSS web font string. +|An acceptable CSS web font string Default: `"'Open Sans', Helvetica, Arial, sans-serif"` |`italic` |`boolean` -|Italicize the text? +|Italicize the text? Default: `false` -|`lHeight` +|`lHeight` Alias: `lineHeight` |`number`, `null` -|The line height in pixels. +|The line height in pixels + +Default: `null` |`size` |`number` -|The font size in pixels. +|The font size in pixels Default: `14` |`underline` |`boolean` -|Underline the text? +|Underline the text? Default: `false` |`weight` |`string` -|The font weight. For example, `"normal"`, `"bold"`, `"bolder"`, `"lighter"`, `"100"`, `"200"`, `"300"`, `"400"`, `"500"`, `"600"`, `"700"`, `"800"`, or `"900"`. - -Default: `"normal"` +|The font weight. For example, `"normal"`, `"bold"`, `"bolder"`, `"lighter"`, `"100"`, `"200"`, `"300"`, `"400"`, `"500"`, `"600"`, `"700"`, `"800"`, or `"900"`. +Default: `normal` |=== *Returns:* `style` @@ -1313,8 +1208,8 @@ Formats an ISO8601 date string or a date in milliseconds since epoch using Momen *Expression syntax* [source,js] ---- -formatdate format=”YYYY-MM-DD” -formatdate “MM/DD/YYYY” +formatdate format="YYYY-MM-DD" +formatdate "MM/DD/YYYY" ---- *Code example* @@ -1327,7 +1222,7 @@ filters | plot defaultStyle={seriesStyle points=5} | render ---- -This transforms the dates in the `time` field into strings that look like `“Jan ‘19”`, `“Feb ‘19”`, etc. using a MomentJS format. +This transforms the dates in the `time` field into strings that look like `"Jan ‘19"`, `"Feb ‘19"`, etc. using a MomentJS format. *Accepts:* `number`, `string` @@ -1335,7 +1230,7 @@ This transforms the dates in the `time` field into strings that look like `“Ja |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `format` |`string` @@ -1349,13 +1244,13 @@ Alias: `format` [[formatnumber_fn]] === `formatnumber` -Formats a `number` into a formatted `string` using NumeralJS. See http://numeraljs.com/#format. +Formats a number into a formatted number string using NumeralJS. For more information, see http://numeraljs.com/#format. *Expression syntax* [source,js] ---- -formatnumber format=”$0,0.00” -formatnumber “0.0a” +formatnumber format="$0,0.00" +formatnumber "0.0a" ---- *Code example* @@ -1364,8 +1259,8 @@ formatnumber “0.0a” filters | demodata | math "mean(percent_uptime)" -| progress shape="gauge" - label={formatnumber "0%"} +| progress shape="gauge" + label={formatnumber "0%"} font={font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"} | render ---- @@ -1377,7 +1272,7 @@ The `formatnumber` subexpression receives the same `context` as the `progress` f |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `format` |`string` @@ -1386,7 +1281,6 @@ Alias: `format` *Returns:* `string` - [float] [[g_fns]] == G @@ -1403,13 +1297,13 @@ Fetches a single cell from a `datatable`. |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ -Aliases: `column`, `c` +Aliases: `c`, `column` |`string` |The name of the column to fetch the value from. If not provided, the value is retrieved from the first column. -|`row` +|`row` Alias: `r` |`number` @@ -1418,7 +1312,7 @@ Alias: `r` Default: `0` |=== -*Returns:* Depends on the data in the cell +*Returns:* Depends on your input and arguments [float] @@ -1433,7 +1327,7 @@ Returns whether the _context_ is greater than the argument. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`number`, `string` @@ -1455,7 +1349,7 @@ Returns whether the _context_ is greater or equal to the argument. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`number`, `string` @@ -1464,7 +1358,6 @@ Alias: `value` *Returns:* `boolean` - [float] [[h_fns]] == H @@ -1481,7 +1374,7 @@ Retrieves the first N rows from the `datatable`. See also <>. |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `count` |`number` @@ -1492,7 +1385,6 @@ Default: `1` *Returns:* `datatable` - [float] [[i_fns]] == I @@ -1509,22 +1401,22 @@ Performs conditional logic. |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ *** Alias: `condition` |`boolean` |A `true` or `false` indicating whether a condition is met, usually returned by a sub-expression. When unspecified, the original _context_ is returned. -|`then` -|`any` -|The return value when the condition is `true`. When unspecified and the condition is met, the original _context_ is returned. - |`else` |`any` |The return value when the condition is `false`. When unspecified and the condition is not met, the original _context_ is returned. + +|`then` +|`any` +|The return value when the condition is `true`. When unspecified and the condition is met, the original _context_ is returned. |=== -*Returns:* Depends on your _context_ and arguments +*Returns:* Depends on your input and arguments [float] @@ -1539,37 +1431,31 @@ Displays an image. Provide an image asset as a `base64` data URL, or pass in a s |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Aliases: `dataurl`, `url` |`string`, `null` |The HTTP(S) URL or `base64` data URL of an image. +Example value for the _Unnamed_ argument, formatted as a `base64` data URL: +[source, url] +------------ +data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmlld0JveD0iMCAwIDI3MC42MDAwMSAyNjkuNTQ2NjYiCiAgIGhlaWdodD0iMjY5LjU0NjY2IgogICB3aWR0aD0iMjcwLjYwMDAxIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpZD0ic3ZnMiIKICAgdmVyc2lvbj0iMS4xIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGE4Ij48cmRmOlJERj48Y2M6V29yawogICAgICAgICByZGY6YWJvdXQ9IiI+PGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+PGRjOnR5cGUKICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPjwvY2M6V29yaz48L3JkZjpSREY+PC9tZXRhZGF0YT48ZGVmcwogICAgIGlkPSJkZWZzNiIgLz48ZwogICAgIHRyYW5zZm9ybT0ibWF0cml4KDEuMzMzMzMzMywwLDAsLTEuMzMzMzMzMywwLDI2OS41NDY2NykiCiAgICAgaWQ9ImcxMCI+PGcKICAgICAgIHRyYW5zZm9ybT0ic2NhbGUoMC4xKSIKICAgICAgIGlkPSJnMTIiPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMTQiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMjAyOS40OCw5NjIuNDQxIGMgMCwxNzAuMDk5IC0xMDUuNDYsMzE4Ljc5OSAtMjY0LjE3LDM3Ni42NTkgNi45OCwzNS44NiAxMC42Miw3MS43MSAxMC42MiwxMDkuMDUgMCwzMTYuMTkgLTI1Ny4yNCw1NzMuNDMgLTU3My40Nyw1NzMuNDMgLTE4NC43MiwwIC0zNTYuNTU4LC04OC41OSAtNDY0LjUzLC0yMzcuODUgLTUzLjA5LDQxLjE4IC0xMTguMjg1LDYzLjc1IC0xODYuMzA1LDYzLjc1IC0xNjcuODM2LDAgLTMwNC4zODMsLTEzNi41NCAtMzA0LjM4MywtMzA0LjM4IDAsLTM3LjA4IDYuNjE3LC03Mi41OCAxOS4wMzEsLTEwNi4wOCBDIDEwOC40ODgsMTM4MC4wOSAwLDEyMjcuODkgMCwxMDU4Ljg4IDAsODg3LjkxIDEwNS45NzcsNzM4LjUzOSAyNjUuMzk4LDY4MS4wOSBjIC02Ljc2OSwtMzUuNDQyIC0xMC40NiwtNzIuMDIgLTEwLjQ2LC0xMDkgQyAyNTQuOTM4LDI1Ni42MjEgNTExLjU2NiwwIDgyNy4wMjcsMCAxMDEyLjIsMCAxMTgzLjk0LDg4Ljk0MTQgMTI5MS4zLDIzOC44MzIgYyA1My40NSwtNDEuOTYxIDExOC44LC02NC45OTIgMTg2LjU2LC02NC45OTIgMTY3LjgzLDAgMzA0LjM4LDEzNi40OTIgMzA0LjM4LDMwNC4zMzIgMCwzNy4wNzggLTYuNjIsNzIuNjI5IC0xOS4wMywxMDYuMTI5IDE1Ny43OCw1Ni44NzkgMjY2LjI3LDIwOS4xMjkgMjY2LjI3LDM3OC4xNCIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDE2IgogICAgICAgICBzdHlsZT0iZmlsbDojZmFjZjA5O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDc5Ny44OTgsMTE1MC45MyA0NDQuMDcyLC0yMDIuNDUgNDQ4LjA1LDM5Mi41OCBjIDYuNDksMzIuMzkgOS42Niw2NC42NyA5LjY2LDk4LjQ2IDAsMjc2LjIzIC0yMjQuNjgsNTAwLjk1IC01MDAuOSw1MDAuOTUgLTE2NS4yNCwwIC0zMTkuMzcsLTgxLjM2IC00MTMuMDUzLC0yMTcuNzkgbCAtNzQuNTI0LC0zODYuNjQgODYuNjk1LC0xODUuMTEiIC8+PHBhdGgKICAgICAgICAgaWQ9InBhdGgxOCIKICAgICAgICAgc3R5bGU9ImZpbGw6IzQ5YzFhZTtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIKICAgICAgICAgZD0ibSAzMzguMjIzLDY4MC42NzIgYyAtNi40ODksLTMyLjM4MyAtOS44MDksLTY1Ljk4MSAtOS44MDksLTk5Ljk3MyAwLC0yNzYuOTI5IDIyNS4zMzYsLTUwMi4yNTc2IDUwMi4zMTMsLTUwMi4yNTc2IDE2Ni41OTMsMCAzMjEuNDczLDgyLjExNzYgNDE1LjAxMywyMTkuOTQ5NiBsIDczLjk3LDM4NS4zNDcgLTk4LjcyLDE4OC42MjEgTCA3NzUuMTU2LDEwNzUuNTcgMzM4LjIyMyw2ODAuNjcyIiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjAiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNlZjI5OWI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMzM1LjQxLDE0NDkuMTggMzA0LjMzMiwtNzEuODYgNjYuNjgsMzQ2LjAyIGMgLTQxLjU4NiwzMS43OCAtOTIuOTMsNDkuMTggLTE0NS43MzEsNDkuMTggLTEzMi4yNSwwIC0yMzkuODEyLC0xMDcuNjEgLTIzOS44MTIsLTIzOS44NyAwLC0yOS4yMSA0Ljg3OSwtNTcuMjIgMTQuNTMxLC04My40NyIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDIyIgogICAgICAgICBzdHlsZT0iZmlsbDojNGNhYmU0O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJNIDMwOC45OTIsMTM3Ni43IEMgMTczLjAyLDEzMzEuNjQgNzguNDgwNSwxMjAxLjMgNzguNDgwNSwxMDU3LjkzIDc4LjQ4MDUsOTE4LjM0IDE2NC44Miw3OTMuNjggMjk0LjQwNiw3NDQuMzUyIGwgNDI2Ljk4MSwzODUuOTM4IC03OC4zOTUsMTY3LjUxIC0zMzQsNzguOSIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDI0IgogICAgICAgICBzdHlsZT0iZmlsbDojODVjZTI2O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDEzMjMuOCwyOTguNDEgYyA0MS43NCwtMzIuMDkgOTIuODMsLTQ5LjU5IDE0NC45OCwtNDkuNTkgMTMyLjI1LDAgMjM5LjgxLDEwNy41NTkgMjM5LjgxLDIzOS44MjEgMCwyOS4xNiAtNC44OCw1Ny4xNjggLTE0LjUzLDgzLjQxOCBsIC0zMDQuMDgsNzEuMTYgLTY2LjE4LC0zNDQuODA5IiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjYiCiAgICAgICAgIHN0eWxlPSJmaWxsOiMzMTc3YTc7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMTM4NS42Nyw3MjIuOTMgMzM0Ljc2LC03OC4zMDEgYyAxMzYuMDIsNDQuOTYxIDIzMC41NiwxNzUuMzUxIDIzMC41NiwzMTguNzYyIDAsMTM5LjMzOSAtODYuNTQsMjYzLjg1OSAtMjE2LjM4LDMxMy4wMzkgbCAtNDM3Ljg0LC0zODMuNTkgODguOSwtMTY5LjkxIiAvPjwvZz48L2c+PC9zdmc+ +------------ + |`mode` |`string` -|`"contain"` shows the entire image, scaled to fit. -`"cover"` fills the container with the image, cropping from the sides or bottom as needed. -`"stretch"` resizes the height and width of the image to 100% of the container. - +|`"contain"` shows the entire image, scaled to fit. `"cover"` fills the container with the image, cropping from the sides or bottom as needed. `"stretch"` resizes the height and width of the image to 100% of the container. Default: `"contain"` |=== -Example value for the `dataurl` argument, formatted as a `base64` data URL: -[source, url] -------------- -data:image/svg+xml;`base64`,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmlld0JveD0iMCAwIDI3MC42MDAwMSAyNjkuNTQ2NjYiCiAgIGhlaWdodD0iMjY5LjU0NjY2IgogICB3aWR0aD0iMjcwLjYwMDAxIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpZD0ic3ZnMiIKICAgdmVyc2lvbj0iMS4xIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGE4Ij48cmRmOlJERj48Y2M6V29yawogICAgICAgICByZGY6YWJvdXQ9IiI+PGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+PGRjOnR5cGUKICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPjwvY2M6V29yaz48L3JkZjpSREY+PC9tZXRhZGF0YT48ZGVmcwogICAgIGlkPSJkZWZzNiIgLz48ZwogICAgIHRyYW5zZm9ybT0ibWF0cml4KDEuMzMzMzMzMywwLDAsLTEuMzMzMzMzMywwLDI2OS41NDY2NykiCiAgICAgaWQ9ImcxMCI+PGcKICAgICAgIHRyYW5zZm9ybT0ic2NhbGUoMC4xKSIKICAgICAgIGlkPSJnMTIiPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMTQiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMjAyOS40OCw5NjIuNDQxIGMgMCwxNzAuMDk5IC0xMDUuNDYsMzE4Ljc5OSAtMjY0LjE3LDM3Ni42NTkgNi45OCwzNS44NiAxMC42Miw3MS43MSAxMC42MiwxMDkuMDUgMCwzMTYuMTkgLTI1Ny4yNCw1NzMuNDMgLTU3My40Nyw1NzMuNDMgLTE4NC43MiwwIC0zNTYuNTU4LC04OC41OSAtNDY0LjUzLC0yMzcuODUgLTUzLjA5LDQxLjE4IC0xMTguMjg1LDYzLjc1IC0xODYuMzA1LDYzLjc1IC0xNjcuODM2LDAgLTMwNC4zODMsLTEzNi41NCAtMzA0LjM4MywtMzA0LjM4IDAsLTM3LjA4IDYuNjE3LC03Mi41OCAxOS4wMzEsLTEwNi4wOCBDIDEwOC40ODgsMTM4MC4wOSAwLDEyMjcuODkgMCwxMDU4Ljg4IDAsODg3LjkxIDEwNS45NzcsNzM4LjUzOSAyNjUuMzk4LDY4MS4wOSBjIC02Ljc2OSwtMzUuNDQyIC0xMC40NiwtNzIuMDIgLTEwLjQ2LC0xMDkgQyAyNTQuOTM4LDI1Ni42MjEgNTExLjU2NiwwIDgyNy4wMjcsMCAxMDEyLjIsMCAxMTgzLjk0LDg4Ljk0MTQgMTI5MS4zLDIzOC44MzIgYyA1My40NSwtNDEuOTYxIDExOC44LC02NC45OTIgMTg2LjU2LC02NC45OTIgMTY3LjgzLDAgMzA0LjM4LDEzNi40OTIgMzA0LjM4LDMwNC4zMzIgMCwzNy4wNzggLTYuNjIsNzIuNjI5IC0xOS4wMywxMDYuMTI5IDE1Ny43OCw1Ni44NzkgMjY2LjI3LDIwOS4xMjkgMjY2LjI3LDM3OC4xNCIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDE2IgogICAgICAgICBzdHlsZT0iZmlsbDojZmFjZjA5O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDc5Ny44OTgsMTE1MC45MyA0NDQuMDcyLC0yMDIuNDUgNDQ4LjA1LDM5Mi41OCBjIDYuNDksMzIuMzkgOS42Niw2NC42NyA5LjY2LDk4LjQ2IDAsMjc2LjIzIC0yMjQuNjgsNTAwLjk1IC01MDAuOSw1MDAuOTUgLTE2NS4yNCwwIC0zMTkuMzcsLTgxLjM2IC00MTMuMDUzLC0yMTcuNzkgbCAtNzQuNTI0LC0zODYuNjQgODYuNjk1LC0xODUuMTEiIC8+PHBhdGgKICAgICAgICAgaWQ9InBhdGgxOCIKICAgICAgICAgc3R5bGU9ImZpbGw6IzQ5YzFhZTtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIKICAgICAgICAgZD0ibSAzMzguMjIzLDY4MC42NzIgYyAtNi40ODksLTMyLjM4MyAtOS44MDksLTY1Ljk4MSAtOS44MDksLTk5Ljk3MyAwLC0yNzYuOTI5IDIyNS4zMzYsLTUwMi4yNTc2IDUwMi4zMTMsLTUwMi4yNTc2IDE2Ni41OTMsMCAzMjEuNDczLDgyLjExNzYgNDE1LjAxMywyMTkuOTQ5NiBsIDczLjk3LDM4NS4zNDcgLTk4LjcyLDE4OC42MjEgTCA3NzUuMTU2LDEwNzUuNTcgMzM4LjIyMyw2ODAuNjcyIiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjAiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNlZjI5OWI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMzM1LjQxLDE0NDkuMTggMzA0LjMzMiwtNzEuODYgNjYuNjgsMzQ2LjAyIGMgLTQxLjU4NiwzMS43OCAtOTIuOTMsNDkuMTggLTE0NS43MzEsNDkuMTggLTEzMi4yNSwwIC0yMzkuODEyLC0xMDcuNjEgLTIzOS44MTIsLTIzOS44NyAwLC0yOS4yMSA0Ljg3OSwtNTcuMjIgMTQuNTMxLC04My40NyIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDIyIgogICAgICAgICBzdHlsZT0iZmlsbDojNGNhYmU0O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJNIDMwOC45OTIsMTM3Ni43IEMgMTczLjAyLDEzMzEuNjQgNzguNDgwNSwxMjAxLjMgNzguNDgwNSwxMDU3LjkzIDc4LjQ4MDUsOTE4LjM0IDE2NC44Miw3OTMuNjggMjk0LjQwNiw3NDQuMzUyIGwgNDI2Ljk4MSwzODUuOTM4IC03OC4zOTUsMTY3LjUxIC0zMzQsNzguOSIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDI0IgogICAgICAgICBzdHlsZT0iZmlsbDojODVjZTI2O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDEzMjMuOCwyOTguNDEgYyA0MS43NCwtMzIuMDkgOTIuODMsLTQ5LjU5IDE0NC45OCwtNDkuNTkgMTMyLjI1LDAgMjM5LjgxLDEwNy41NTkgMjM5LjgxLDIzOS44MjEgMCwyOS4xNiAtNC44OCw1Ny4xNjggLTE0LjUzLDgzLjQxOCBsIC0zMDQuMDgsNzEuMTYgLTY2LjE4LC0zNDQuODA5IiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjYiCiAgICAgICAgIHN0eWxlPSJmaWxsOiMzMTc3YTc7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMTM4NS42Nyw3MjIuOTMgMzM0Ljc2LC03OC4zMDEgYyAxMzYuMDIsNDQuOTYxIDIzMC41NiwxNzUuMzUxIDIzMC41NiwzMTguNzYyIDAsMTM5LjMzOSAtODYuNTQsMjYzLjg1OSAtMjE2LjM4LDMxMy4wMzkgbCAtNDM3Ljg0LC0zODMuNTkgODguOSwtMTY5LjkxIiAvPjwvZz48L2c+PC9zdmc+ -------------- - *Returns:* `image` - [float] [[j_fns]] == J -[float] - [float] [[joinRows_fn]] === `joinRows` @@ -1582,47 +1468,44 @@ Concatenates values from rows in a `datatable` into a single string. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `column` |`string` -|The column or field from which to extract the values. +|The column or field from which to extract the values. -|distinct +|`distinct` |`boolean` -|Extract only unique values? +|Extract only unique values? Default: `true` -|quote +|`quote` |`string` -|The quote character to wrap around each extracted value. +|The quote character to wrap around each extracted value. Default: `"'"` -|separator +|`separator` -Aliases: `sep`, `delimiter` +Aliases: `delimiter`, `sep` |`string` |The delimiter to insert between each extracted value. -Default: `", "` +Default: `","` |=== *Returns:* `string` - [float] [[l_fns]] == L -[float] [float] [[location_fn]] === `location` -Find your current location using the Geolocation API of the browser. Performance can vary, but is fairly accurate. -See: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation. +Find your current location using the Geolocation API of the browser. Performance can vary, but is fairly accurate. See https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation. Don’t use <> if you plan to generate PDFs as this function requires user input. *Accepts:* `null` @@ -1641,7 +1524,7 @@ Returns whether the _context_ is less than the argument. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`number`, `string` @@ -1663,7 +1546,7 @@ Returns whether the _context_ is less than or equal to the argument. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`number`, `string` @@ -1672,7 +1555,6 @@ Alias: `value` *Returns:* `boolean` - [float] [[m_fns]] == M @@ -1681,7 +1563,7 @@ Alias: `value` [[mapColumn_fn]] === `mapColumn` -Adds a column calculated as the result of other columns. Changes are made only when you provide arguments. See also <> and <>. +Adds a column calculated as the result of other columns. Changes are made only when you provide arguments.See also <> and <>. *Accepts:* `datatable` @@ -1689,15 +1571,15 @@ Adds a column calculated as the result of other columns. Changes are made only w |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** -Alias: `column` +Aliases: `column`, `name` |`string` |The name of the resulting column. |`expression` *** -Alias: `exp`, `fn`, `function` +Aliases: `exp`, `fn`, `function` |`boolean`, `number`, `string`, `null` |A Canvas expression that is passed to each row as a single row `datatable`. |=== @@ -1719,17 +1601,17 @@ Adds an element that renders Markdown text. TIP: Use the <> functio |_Unnamed_ † -Alias: `expression`, `content` +Aliases: `content`, `expression` |`string` -|A string of text that contains Markdown. To concatenate, pass the <> function multiple times. +|A string of text that contains Markdown. To concatenate, pass the `string` function multiple times. Default: `""` |`font` |`style` -|The CSS font properties for the content. For example, `font-family` or `font-weight`. +|The CSS font properties for the content. For example, "font-family" or "font-weight". -Default: `{font}` +Default: `${font}` |=== *Returns:* `render` @@ -1739,7 +1621,7 @@ Default: `{font}` [[math_fn]] === `math` -Interprets a `TinyMath` math expression using a `number` or `datatable` as _context_. The `datatable` columns are available by their column name. If the _context_ is a `number`, it is available as `value`. +Interprets a `TinyMath` math expression using a `number` or `datatable` as _context_. The `datatable` columns are available by their column name. If the _context_ is a number it is available as `value`. *Accepts:* `number`, `datatable` @@ -1747,11 +1629,11 @@ Interprets a `TinyMath` math expression using a `number` or `datatable` as _cont |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ Alias: `expression` |`string` -|An evaluated TinyMath expression. See <>. +|An evaluated `TinyMath` expression. See https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html. |=== *Returns:* `number` @@ -1771,7 +1653,7 @@ Displays a number over a label. |_Unnamed_ -Aliases: `label`, `text`, `description` +Aliases: `description`, `label`, `text` |`string` |The text describing the metric. @@ -1781,13 +1663,13 @@ Default: `""` |`style` |The CSS font properties for the label. For example, `font-family` or `font-weight`. -Default: `{font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}`. +Default: `${font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}` |`metricFont` |`style` |The CSS font properties for the metric. For example, `font-family` or `font-weight`. -Default: `{font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center lHeight=48}`. +Default: `${font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center lHeight=48}` |`metricFormat` @@ -1798,7 +1680,6 @@ Alias: `format` *Returns:* `render` - [float] [[n_fns]] == N @@ -1815,7 +1696,7 @@ Returns whether the _context_ is not equal to the argument. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** Alias: `value` |`boolean`, `number`, `string`, `null` @@ -1824,7 +1705,6 @@ Alias: `value` *Returns:* `boolean` - [float] [[p_fns]] == P @@ -1841,7 +1721,7 @@ Creates a color palette. |=== |Argument |Type |Description -|_Unnamed_ *** † +|_Unnamed_ † Alias: `color` |`string` @@ -1849,7 +1729,7 @@ Alias: `color` |`gradient` |`boolean` -|Make a gradient where supported? +|Make a gradient palette where supported? Default: `false` @@ -1879,17 +1759,17 @@ Configures a pie chart element. |`style` |The CSS font properties for the labels. For example, `font-family` or `font-weight`. -Default: `{font}` +Default: `${font}` |`hole` |`number` -|Draws a hole in the pie, 0-100, as a percentage of the pie radius. +|Draws a hole in the pie, between `0` and `100`, as a percentage of the pie radius. Default: `0` |`labelRadius` |`number` -|The percentage of the container area to use as a radius for the label circle. +|The percentage of the container area to use as a radius for the label circle. Default: `100` @@ -1901,19 +1781,19 @@ Default: `true` |`legend` |`string`, `boolean` -|The legend position. For example, `"nw"`, `"sw"`, `"ne"`, `"se"`. When `false`, the legend is hidden. +|The legend position. For example, `"nw"`, `"sw"`, `"ne"`, `"se"`, or `false`. When `false`, the legend is hidden. Default: `false` |`palette` |`palette` -|A `palette` object for describing the colors to use in this pie chart +|A `palette` object for describing the colors to use in this pie chart. -Default: `{palette}` +Default: `${palette}` |`radius` |`string`, `number` -|The radius of the pie as a percentage (between 0 and 1) of the available space. To automatically set radius, use `"auto"`. +|The radius of the pie as a percentage, between `0` and `1`, of the available space. To automatically set the radius, use `"auto"`. Default: `"auto"` @@ -1923,7 +1803,7 @@ Default: `"auto"` |`tilt` |`number` -|The percentage of tilt, where 1 is fully vertical, and 0 is completely flat. +|The percentage of tilt where `1` is fully vertical, and `0` is completely flat. Default: `1` |=== @@ -1935,7 +1815,7 @@ Default: `1` [[plot_fn]] === `plot` -Configures a plot element. +Configures a chart element. *Accepts:* `pointseries` @@ -1947,13 +1827,13 @@ Configures a plot element. |`seriesStyle` |The default style to use for every series. -Default: `{seriesStyle points=5}` +Default: `${seriesStyle points=5}` |`font` |`style` |The CSS font properties for the labels. For example, `font-family` or `font-weight`. -Default: `{font}` +Default: `${font}` |`legend` |`string`, `boolean` @@ -1963,9 +1843,9 @@ Default: `"ne"` |`palette` |`palette` -|A `palette` object for describing the colors to use in this chart +|A `palette` object for describing the colors to use in this chart. -Default: `{palette}` +Default: `${palette}` |`seriesStyle` † |`seriesStyle` @@ -1999,15 +1879,15 @@ Subdivides a `datatable` by the unique values of the specified columns, and pass |=== |Argument |Type |Description -|`by` *** † +|`by` † |`string` |The column to subdivide the `datatable`. -|`expression` *** † +|`expression` † -Alias: `fn`, `exp`, `function` +Aliases: `exp`, `fn`, `function` |`datatable` -|An expression to pass into each resulting data table. Expressions must return a `datatable`. Use `as` to turn literals into `datatable`s. Multiple expressions must return the same number of rows. If you need to return a different row count, pipe into another instance of <>. If multiple expressions return `datatable`s with the same column names, the last one wins. +|An expression to pass each resulting `datatable` into. Tips: Expressions must return a `datatable`. Use <> to turn literals into `datatable`s. Multiple expressions must return the same number of rows.If you need to return a different row count, pipe into another instance of <>. If multiple expressions returns the columns with the same name, the last one wins. |=== *Returns:* `datatable` @@ -2017,8 +1897,7 @@ Alias: `fn`, `exp`, `function` [[pointseries_fn]] === `pointseries` -Turns a `datatable` into a point series model. Currently we differentiate measure from dimensions by looking for a <>. If you enter a TinyMath -expression in your argument, Canvas treats that argument as a measure. Otherwise, it is a dimension. Dimensions are combined to create unique keys. Measures are then deduplicated by those keys using the specified TinyMath function. +Turn a `datatable` into a point series model. Currently we differentiate measure from dimensions by looking for a `TinyMath` expression. See https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html. If you enter a `TinyMath` expression in your argument, we treat that argument as a measure, otherwise it is a dimension. Dimensions are combined to create unique keys. Measures are then deduplicated by those keys using the specified `TinyMath` function *Accepts:* `datatable` @@ -2054,7 +1933,7 @@ expression in your argument, Canvas treats that argument as a measure. Otherwise [[progress_fn]] === `progress` -Configures a progress element +Configures a progress element. *Accepts:* `number` @@ -2062,7 +1941,7 @@ Configures a progress element |=== |Argument |Type |Description -| _Unnamed_ +|_Unnamed_ Alias: `shape` |`string` @@ -2086,14 +1965,14 @@ Default: `20` |`style` |The CSS font properties for the label. For example, `font-family` or `font-weight`. -Default: `{font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}` +Default: `${font size=24 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}` |`label` |`boolean`, `string` -|To show or hide the value, use `true` or `false`. Alternatively, provide a string to display as a label. +|To show or hide the label, use `true` or `false`. Alternatively, provide a string to display as a label. Default: `true` - + |`max` |`number` |The maximum value of the progress element. @@ -2115,7 +1994,6 @@ Default: `20` *Returns:* `render` - [float] [[r_fns]] == R @@ -2134,19 +2012,19 @@ Renders the _context_ as a specific element and sets element level options, such |`as` |`string` -|The element type to render. You might want to use a specialized function instead, such as <> or <>. - -|`css` -|`string` -|Any block of custom CSS to be scoped to the element - -Default: `".canvasRenderEl{\n\n}"` +|The element type to render. You probably want a specialized function instead, such as <> or <>. |`containerStyle` |`containerStyle` |The style for the container, including background, border, and opacity. -Default: `{containerStyle}` +Default: `${containerStyle}` + +|`css` +|`string` +|Any block of custom CSS to be scoped to the element. + +Default: `".canvasRenderEl${}"` |=== *Returns:* `render` @@ -2165,20 +2043,26 @@ Configures a repeating image element. |Argument |Type |Description |`emptyImage` -|`string` +|`string`, `null` |Fills the difference between the _context_ and `max` parameter for the element with this image. Provide an image asset as a `base64` data URL, or pass in a sub-expression. Default: `null` |`image` -|`string` +|`string`, `null` |The image to repeat. Provide an image asset as a `base64` data URL, or pass in a sub-expression. +Example value for the `image` argument, formatted as a `base64` data URL: +[source, url] +------------ +data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E +------------ + |`max` |`number` |The maximum number of times the image can repeat. -Default: `100` +Default: `1000` |`size` |`number` @@ -2187,13 +2071,6 @@ Default: `100` Default: `100` |=== - -Example value for the `image` argument, formatted as a `base64` data URL: -[source, url] ------------- -data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------- - *Returns:* `render` @@ -2209,27 +2086,23 @@ Uses a regular expression to replace parts of a string. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ -Alias: `pattern`, `regex` +Aliases: `pattern`, `regex` |`string` -|The text or pattern of a JavaScript regular expression. For example, `"[aeiou]"`. -You can use capturing groups here. +|The text or pattern of a JavaScript regular expression. For example, `"[aeiou]"`. You can use capturing groups here. -|`flags` +|`flags` Alias: `modifiers` -|`datatable` -|Specify flags. See the -https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp[RegExp documentation] -for reference +|`string` +|Specify flags. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp. Default: `"g"` |`replacement` |`string` -|The replacement for the matching parts of `string`. Capturing groups can be accessed -by their index. For example, `$1`. +|The replacement for the matching parts of string. Capturing groups can be accessed by their index. For example, `"$1"`. Default: `""` |=== @@ -2249,28 +2122,29 @@ Configures an image reveal element. |=== |Argument |Type |Description +|`emptyImage` +|`string`, `null` +|An optional background image to reveal over. Provide an image asset as a ``base64`` data URL, or pass in a sub-expression. + +Default: `null` + |`image` -|`string` +|`string`, `null` |The image to reveal. Provide an image asset as a `base64` data URL, or pass in a sub-expression. -|`emptyImage` -|`string` -|An optional background image to reveal over. Provide an image asset as a `base64` data URL, or pass in a sub-expression. +Example value for the `image` argument, formatted as a `base64` data URL: +[source, url] +------------ +data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E +------------ |`origin` |`string` -|The position to start the image fill. For example, `"top"`, `"left"`, `"bottom"`, or `"right"` +|The position to start the image fill. For example, `"top"`, `"bottom"`, `"left"`, or right. Default: `"bottom"` |=== - -Example value for the `image` argument, formatted as a `base64` data URL: -[source, url] ------------- -data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------- - *Returns:* `render` @@ -2286,11 +2160,11 @@ Uses a MomentJS formatting string to round milliseconds since epoch, and returns |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `format` |`string` -|The MomentJS Format to use for bucketing. For example, `"YYYY-MM"` rounds to months. See https://momentjs.com/docs/#/displaying/. +|The MomentJS format to use for bucketing. For example, `"YYYY-MM"` rounds to months. See https://momentjs.com/docs/#/displaying/. |=== *Returns:* `number` @@ -2322,44 +2196,42 @@ Creates an object used for describing the properties of a series on a chart. Use |=== |Argument |Type |Description -|`label` -|`string` -|The name of the series to style. +|`bars` +|`number` +|The width of bars. |`color` |`string` |The line color. +|`fill` +|`number`, `boolean` +|Should we fill in the points? + +Default: `false` + +|`horizontalBars` +|`boolean` +|Sets the orientation of the bars in the chart to horizontal. + +|`label` +|`string` +|The name of the series to style. + |`lines` |`number` |The width of the line. -|`bars` -|`number` -|The width of bars. - |`points` |`number` |The size of points on line. -|`fill` -|`number`, `boolean` -|Should we fill in the points? - -Default: `false` - |`stack` |`number`, `null` |Specifies if the series should be stacked. The number is the stack ID. Series with the same stack ID are stacked together. - -|`horizontalBars` -|`boolean` -|Sets the orientation of the bars in the chart to horizontal. - -Default: `false` |=== -*Returns:* `seriesStyle` +*Returns:* `seriesStyle` [float] @@ -2374,25 +2246,25 @@ Creates a shape. |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Alias: `shape` |`string` -|Pick a shape +|Pick a shape. -Default: `"square"` +Default: `square` -|`border` +|`border` -Alias `stroke` -|`number` +Alias: `stroke` +|`string` |An SVG color for the border outlining the shape. -|`borderWidth` +|`borderWidth` Alias: `strokeWidth` |`number` -|The thickness of the border +|The thickness of the border. Default: `0` @@ -2409,7 +2281,7 @@ Default: `"black"` Default: `false` |=== -*Returns:* shape +*Returns:* `shape` [float] @@ -2426,13 +2298,13 @@ Sorts a `datatable` by the specified column. |_Unnamed_ -Alias: `column` +Aliases: `by`, `column` |`string` |The column to sort by. When unspecified, the `datatable` is sorted by the first column. |`reverse` |`boolean` -|Reverse the sorting order? When unspecified, the `datatable` is sorted in ascending order. +|Reverses the sorting order. When unspecified, the `datatable` is sorted in ascending order. Default: `false` |=== @@ -2452,15 +2324,15 @@ Adds a column with the same static value in every row. See also <>. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ Alias: `count` |`number` -|The number of rows to retrieve from the end of the datatable. +|The number of rows to retrieve from the end of the `datatable`. + +Default: `1` |=== *Returns:* `datatable` @@ -2596,29 +2469,29 @@ Creates a time filter for querying a source. |=== |Argument |Type |Description -|`column` +|`column` -Alias: `field`, `c` +Aliases: `c`, `field` |`string` |The column or field that you want to filter. Default: `"@timestamp"` -|`from` - -Alias: `f`, `start` +|`filterGroup` |`string` -|The beginning of the range, in ISO8601 or {es} `datemath` format +|The group name for the filter -|`to` +|`from` -Alias: `t`, `end` +Aliases: `f`, `start` |`string` -|The end of the range, in ISO8601 or {es} `datemath` format +|The beginning of the range, in ISO8601 or Elasticsearch `datemath` format -|`filterGroup` +|`to` + +Aliases: `end`, `t` |`string` -|The group name for the filter +|The end of the range, in ISO8601 or Elasticsearch `datemath` format |=== *Returns:* `filter` @@ -2636,13 +2509,13 @@ Configures a time filter control element. |=== |Argument |Type |Description -|`column` +|`column` -Alias: `field`, `c` +Aliases: `c`, `field` |`string` |The column or field that you want to filter. -Default: `"@timestamp"` +Default: `@timestamp` |`compact` |`boolean` @@ -2655,7 +2528,6 @@ Default: `true` |The group name for the filter. |=== - *Returns:* `render` @@ -2671,37 +2543,37 @@ Uses Timelion to extract one or more time series from many sources. |=== |Argument |Type |Description -|_Unnamed_ +|_Unnamed_ Aliases: `q`, `query` |`string` -|A Timelion query +|A Timelion query Default: `".es(*)"` -|`interval` -|`string` -|The bucket interval for the time series - -Default: `"auto"` - |`from` |`string` -|The {es} `datemath` string for the beginning of the time range. +|The Elasticsearch `datemath` string for the beginning of the time range. Default: `"now-1y"` -|`to` +|`interval` |`string` -|The {es} `datemath` string for the end of the time range. +|The bucket interval for the time series. -Default: `"now"` +Default: `"auto"` |`timezone` |`string` -|The timezone for the time range. See [Moment Timezone](https://momentjs.com/timezone/). +|The timezone for the time range. See https://momentjs.com/timezone/. Default: `"UTC"` + +|`to` +|`string` +|The Elasticsearch `datemath` string for the end of the time range. + +Default: `"now"` |=== *Returns:* `datatable` @@ -2719,16 +2591,15 @@ Explicitly casts the type of the _context_ from one type to the specified type. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ † Alias: `type` |`string` -|A known type +|A known data type in the expression language. |=== *Returns:* Depends on your input and arguments - [float] [[u_fns]] == U @@ -2737,7 +2608,7 @@ Alias: `type` [[urlparam_fn]] === `urlparam` -Retrieves a URL parameter to use in an expression. The <> function always returns a `string`. For example, you can retrieve the value `"20"` from the parameter `myVar` from the URL `https://localhost:5601/app/canvas?myVar=20`. +Retrieves a URL parameter to use in an expression. The <> function always returns a `string`. For example, you can retrieve the value `"20"` from the parameter `myVar` from the URL `https://localhost:5601/app/canvas?myVar=20`. *Accepts:* `null` @@ -2745,9 +2616,9 @@ Retrieves a URL parameter to use in an expression. The <> function |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** -Aliases: `var`, `variable` +Aliases: `param`, `var`, `variable` |`string` |The URL hash parameter to retrieve. @@ -2759,4 +2630,3 @@ Default: `""` |=== *Returns:* `string` - diff --git a/package.json b/package.json index 04415b481d5ddd..a4f7b869aef6f6 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,8 @@ "**/typescript": "3.7.2", "**/graphql-toolkit/lodash": "^4.17.13", "**/isomorphic-git/**/base64-js": "^1.2.1", - "**/image-diff/gm/debug": "^2.6.9" + "**/image-diff/gm/debug": "^2.6.9", + "**/deepmerge": "^4.2.2" }, "workspaces": { "packages": [ @@ -155,6 +156,7 @@ "custom-event-polyfill": "^0.3.0", "d3": "3.5.17", "d3-cloud": "1.2.5", + "deepmerge": "^4.2.2", "del": "^5.1.0", "elasticsearch": "^16.5.0", "elasticsearch-browser": "^16.5.0", @@ -169,7 +171,7 @@ "globby": "^8.0.1", "good-squeeze": "2.1.0", "h2o2": "^8.1.2", - "handlebars": "4.3.5", + "handlebars": "4.5.3", "hapi": "^17.5.3", "hapi-auth-cookie": "^9.0.0", "history": "^4.9.0", diff --git a/renovate.json5 b/renovate.json5 index aefbc61e8dc12f..3886715618e99b 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -21,6 +21,7 @@ ], labels: [ 'release_note:skip', + 'Team:Operations', 'renovate', 'v8.0.0', 'v7.6.0', @@ -28,6 +29,7 @@ major: { labels: [ 'release_note:skip', + 'Team:Operations', 'renovate', 'v8.0.0', 'v7.6.0', @@ -228,6 +230,7 @@ ], labels: [ 'release_note:skip', + 'Team:Operations', 'renovate', 'v8.0.0', 'v7.6.0', diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index f3532cd717ac8f..22c96110742e0e 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1167,8 +1167,8 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy'; | Legacy Platform | New Platform | Notes | | ------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `import 'ui/apply_filters'` | `import { ApplyFiltersPopover } from '../data/public'` | `import '../data/public/legacy` should be called to load legacy directives | -| `import 'ui/filter_bar'` | `import { FilterBar } from '../data/public'` | `import '../data/public/legacy` should be called to load legacy directives | +| `import 'ui/apply_filters'` | `import { ApplyFiltersPopover } from '../data/public'` | Directive is deprecated. | +| `import 'ui/filter_bar'` | `import { FilterBar } from '../data/public'` | Directive is deprecated. | | `import 'ui/query_bar'` | `import { QueryBarInput } from '../data/public'` | Directives are deprecated. | | `import 'ui/search_bar'` | `import { SearchBar } from '../data/public'` | Directive is deprecated. | | `import 'ui/kbn_top_nav'` | `import { TopNavMenu } from '../navigation/public'` | Directive is still available in `ui/kbn_top_nav`. | diff --git a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap index d159c588718fec..d0374511515d1e 100644 --- a/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap +++ b/src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap @@ -10,6 +10,7 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiBasicTable.selectThisRow": "Select this row", "euiBasicTable.tableDescription": [Function], "euiBottomBar.screenReaderAnnouncement": "There is a new menu opening with page level controls at the end of the document.", + "euiBreadcrumbs.collapsedBadge.ariaLabel": "Show all breadcrumbs", "euiCardSelect.select": "Select", "euiCardSelect.selected": "Selected", "euiCardSelect.unavailable": "Unavailable", @@ -21,6 +22,20 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiCollapsedItemActions.allActions": "All actions", "euiColorPicker.screenReaderAnnouncement": "A popup with a range of selectable colors opened. Tab forward to cycle through colors choices or press escape to close this popup.", "euiColorPicker.swatchAriaLabel": [Function], + "euiColorStopThumb.removeLabel": "Remove this stop", + "euiColorStopThumb.screenReaderAnnouncement": "A popup with a color stop edit form opened. Tab forward to cycle through form controls or press escape to close this popup.", + "euiColorStops.screenReaderAnnouncement": [Function], + "euiColumnSelector.hideAll": "Hide all", + "euiColumnSelector.selectAll": "Show all", + "euiColumnSorting.clearAll": "Clear sorting", + "euiColumnSorting.emptySorting": "Currently no fields are sorted", + "euiColumnSorting.pickFields": "Pick fields to sort by", + "euiColumnSorting.sortFieldAriaLabel": "Sort by:", + "euiColumnSortingDraggable.activeSortLabel": "is sorting this data grid", + "euiColumnSortingDraggable.defaultSortAsc": "A-Z", + "euiColumnSortingDraggable.defaultSortDesc": "Z-A", + "euiColumnSortingDraggable.removeSortLabel": "Remove from data grid sort:", + "euiColumnSortingDraggable.toggleLegend": "Select sorting method for field:", "euiComboBoxOptionsList.allOptionsSelected": "You've selected all available options", "euiComboBoxOptionsList.alreadyAdded": [Function], "euiComboBoxOptionsList.createCustomOption": [Function], @@ -28,6 +43,19 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiComboBoxOptionsList.noAvailableOptions": "There aren't any options available", "euiComboBoxOptionsList.noMatchingOptions": [Function], "euiComboBoxPill.removeSelection": [Function], + "euiCommonlyUsedTimeRanges.legend": "Commonly used", + "euiDataGrid.screenReaderNotice": "Cell contains interactive content.", + "euiDataGridCell.expandButtonTitle": "Click or hit enter to interact with cell content", + "euiDataGridSchema.booleanSortTextAsc": "True-False", + "euiDataGridSchema.booleanSortTextDesc": "False-True", + "euiDataGridSchema.currencySortTextAsc": "Low-High", + "euiDataGridSchema.currencySortTextDesc": "High-Low", + "euiDataGridSchema.dateSortTextAsc": "New-Old", + "euiDataGridSchema.dateSortTextDesc": "Old-New", + "euiDataGridSchema.jsonSortTextAsc": "Small-Large", + "euiDataGridSchema.jsonSortTextDesc": "Large-Small", + "euiDataGridSchema.numberSortTextAsc": "Low-High", + "euiDataGridSchema.numberSortTextDesc": "High-Low", "euiFilterButton.filterBadge": [Function], "euiForm.addressFormErrors": "Please address the errors in your form.", "euiFormControlLayoutClearButton.label": "Clear input", @@ -35,25 +63,45 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiHeaderLinks.appNavigation": "App navigation", "euiHeaderLinks.openNavigationMenu": "Open navigation menu", "euiHue.label": "Select the HSV color mode \\"hue\\" value", + "euiImage.closeImage": [Function], + "euiImage.openImage": [Function], + "euiLink.external.ariaLabel": "External link", "euiModal.closeModal": "Closes this modal window", "euiPagination.jumpToLastPage": [Function], "euiPagination.nextPage": "Next page", "euiPagination.pageOfTotal": [Function], "euiPagination.previousPage": "Previous page", - "euiPopover.screenReaderAnnouncement": "You are in a popup. To exit this popup, hit Escape.", + "euiPopover.screenReaderAnnouncement": "You are in a dialog. To close this dialog, hit escape.", + "euiQuickSelect.applyButton": "Apply", + "euiQuickSelect.fullDescription": [Function], + "euiQuickSelect.legendText": "Quick select a time range", + "euiQuickSelect.nextLabel": "Next time window", + "euiQuickSelect.previousLabel": "Previous time window", + "euiQuickSelect.quickSelectTitle": "Quick select", + "euiQuickSelect.tenseLabel": "Time tense", + "euiQuickSelect.unitLabel": "Time unit", + "euiQuickSelect.valueLabel": "Time value", + "euiRefreshInterval.fullDescription": [Function], + "euiRefreshInterval.legend": "Refresh every", + "euiRefreshInterval.start": "Start", + "euiRefreshInterval.stop": "Stop", + "euiRelativeTab.fullDescription": [Function], + "euiRelativeTab.relativeDate": [Function], + "euiRelativeTab.roundingLabel": [Function], + "euiRelativeTab.unitInputLabel": "Relative time span", "euiSaturation.roleDescription": "HSV color mode saturation and value selection", "euiSaturation.screenReaderAnnouncement": "Use the arrow keys to navigate the square color gradient. The coordinates resulting from each key press will be used to calculate HSV color mode \\"saturation\\" and \\"value\\" numbers, in the range of 0 to 1. Left and right decrease and increase (respectively) the \\"saturation\\" value. Up and down decrease and increase (respectively) the \\"value\\" value.", "euiSelectable.loadingOptions": "Loading options", "euiSelectable.noAvailableOptions": "There aren't any options available", "euiSelectable.noMatchingOptions": [Function], "euiStat.loadingText": "Statistic is loading", - "euiStep.completeStep": "Step", - "euiStep.incompleteStep": "Incomplete Step", + "euiStep.ariaLabel": [Function], "euiStepHorizontal.buttonTitle": [Function], "euiStepHorizontal.step": "Step", "euiStepNumber.hasErrors": "has errors", "euiStepNumber.hasWarnings": "has warnings", "euiStepNumber.isComplete": "complete", + "euiStyleSelector.buttonText": "Density", "euiSuperDatePicker.showDatesButtonLabel": "Show dates", "euiSuperSelect.screenReaderAnnouncement": [Function], "euiSuperSelectControl.selectAnOption": [Function], @@ -68,6 +116,8 @@ exports[`#start() returns \`Context\` component 1`] = ` "euiToast.dismissToast": "Dismiss toast", "euiToast.newNotification": "A new notification appears", "euiToast.notification": "Notification", + "euiTreeView.ariaLabel": [Function], + "euiTreeView.listNavigationInstructions": "You can quickly navigate this list using arrow keys.", }, } } diff --git a/src/core/public/i18n/i18n_service.tsx b/src/core/public/i18n/i18n_service.tsx index 17cdf56cd43c09..721c5d49634f4b 100644 --- a/src/core/public/i18n/i18n_service.tsx +++ b/src/core/public/i18n/i18n_service.tsx @@ -65,6 +65,13 @@ export class I18nService { 'Screen reader announcement that functionality is available in the page document', } ), + 'euiBreadcrumbs.collapsedBadge.ariaLabel': i18n.translate( + 'core.euiBreadcrumbs.collapsedBadge.ariaLabel', + { + defaultMessage: 'Show all breadcrumbs', + description: 'Displayed when one or more breadcrumbs are hidden.', + } + ), 'euiCardSelect.select': i18n.translate('core.euiCardSelect.select', { defaultMessage: 'Select', description: 'Displayed button text when a card option can be selected.', @@ -117,6 +124,80 @@ export class I18nService { description: 'Screen reader text to describe the action and hex value of the selectable option', }), + 'euiColorStopThumb.removeLabel': i18n.translate('core.euiColorStopThumb.removeLabel', { + defaultMessage: 'Remove this stop', + description: 'Label accompanying a button whose action will remove the color stop', + }), + 'euiColorStopThumb.screenReaderAnnouncement': i18n.translate( + 'core.euiColorStopThumb.screenReaderAnnouncement', + { + defaultMessage: + 'A popup with a color stop edit form opened. Tab forward to cycle through form controls or press escape to close this popup.', + description: + 'Message when the color picker popover has opened for an individual color stop thumb.', + } + ), + 'euiColorStops.screenReaderAnnouncement': ({ label, readOnly, disabled }: EuiValues) => + i18n.translate('core.euiColorStops.screenReaderAnnouncement', { + defaultMessage: + '{label}: {readOnly} {disabled} Color stop picker. Each stop consists of a number and corresponding color value. Use the Down and Up arrow keys to select individual stops. Press the Enter key to create a new stop.', + values: { label, readOnly, disabled }, + description: + 'Screen reader text to describe the composite behavior of the color stops component.', + }), + 'euiColumnSelector.hideAll': i18n.translate('core.euiColumnSelector.hideAll', { + defaultMessage: 'Hide all', + }), + 'euiColumnSelector.selectAll': i18n.translate('core.euiColumnSelector.selectAll', { + defaultMessage: 'Show all', + }), + 'euiColumnSorting.clearAll': i18n.translate('core.euiColumnSorting.clearAll', { + defaultMessage: 'Clear sorting', + }), + 'euiColumnSorting.emptySorting': i18n.translate('core.euiColumnSorting.emptySorting', { + defaultMessage: 'Currently no fields are sorted', + }), + 'euiColumnSorting.pickFields': i18n.translate('core.euiColumnSorting.pickFields', { + defaultMessage: 'Pick fields to sort by', + }), + 'euiColumnSorting.sortFieldAriaLabel': i18n.translate( + 'core.euiColumnSorting.sortFieldAriaLabel', + { + defaultMessage: 'Sort by:', + } + ), + 'euiColumnSortingDraggable.activeSortLabel': i18n.translate( + 'core.euiColumnSortingDraggable.activeSortLabel', + { + defaultMessage: 'is sorting this data grid', + } + ), + 'euiColumnSortingDraggable.defaultSortAsc': i18n.translate( + 'core.euiColumnSortingDraggable.defaultSortAsc', + { + defaultMessage: 'A-Z', + description: 'Ascending sort label', + } + ), + 'euiColumnSortingDraggable.defaultSortDesc': i18n.translate( + 'core.euiColumnSortingDraggable.defaultSortDesc', + { + defaultMessage: 'Z-A', + description: 'Descending sort label', + } + ), + 'euiColumnSortingDraggable.removeSortLabel': i18n.translate( + 'core.euiColumnSortingDraggable.removeSortLabel', + { + defaultMessage: 'Remove from data grid sort:', + } + ), + 'euiColumnSortingDraggable.toggleLegend': i18n.translate( + 'core.euiColumnSortingDraggable.toggleLegend', + { + defaultMessage: 'Select sorting method for field:', + } + ), 'euiComboBoxOptionsList.allOptionsSelected': i18n.translate( 'core.euiComboBoxOptionsList.allOptionsSelected', { @@ -163,6 +244,88 @@ export class I18nService { values: { children }, description: 'ARIA label, `children` is the human-friendly value of an option', }), + 'euiCommonlyUsedTimeRanges.legend': i18n.translate('core.euiCommonlyUsedTimeRanges.legend', { + defaultMessage: 'Commonly used', + }), + 'euiDataGrid.screenReaderNotice': i18n.translate('core.euiDataGrid.screenReaderNotice', { + defaultMessage: 'Cell contains interactive content.', + }), + 'euiDataGridCell.expandButtonTitle': i18n.translate( + 'core.euiDataGridCell.expandButtonTitle', + { + defaultMessage: 'Click or hit enter to interact with cell content', + } + ), + 'euiDataGridSchema.booleanSortTextAsc': i18n.translate( + 'core.euiDataGridSchema.booleanSortTextAsc', + { + defaultMessage: 'True-False', + description: 'Ascending boolean label', + } + ), + 'euiDataGridSchema.booleanSortTextDesc': i18n.translate( + 'core.euiDataGridSchema.booleanSortTextDesc', + { + defaultMessage: 'False-True', + description: 'Descending boolean label', + } + ), + 'euiDataGridSchema.currencySortTextAsc': i18n.translate( + 'core.euiDataGridSchema.currencySortTextAsc', + { + defaultMessage: 'Low-High', + description: 'Ascending currency label', + } + ), + 'euiDataGridSchema.currencySortTextDesc': i18n.translate( + 'core.euiDataGridSchema.currencySortTextDesc', + { + defaultMessage: 'High-Low', + description: 'Descending currency label', + } + ), + 'euiDataGridSchema.dateSortTextAsc': i18n.translate( + 'core.euiDataGridSchema.dateSortTextAsc', + { + defaultMessage: 'New-Old', + description: 'Ascending date label', + } + ), + 'euiDataGridSchema.dateSortTextDesc': i18n.translate( + 'core.euiDataGridSchema.dateSortTextDesc', + { + defaultMessage: 'Old-New', + description: 'Descending date label', + } + ), + 'euiDataGridSchema.numberSortTextAsc': i18n.translate( + 'core.euiDataGridSchema.numberSortTextAsc', + { + defaultMessage: 'Low-High', + description: 'Ascending number label', + } + ), + 'euiDataGridSchema.numberSortTextDesc': i18n.translate( + 'core.euiDataGridSchema.numberSortTextDesc', + { + defaultMessage: 'High-Low', + description: 'Descending number label', + } + ), + 'euiDataGridSchema.jsonSortTextAsc': i18n.translate( + 'core.euiDataGridSchema.jsonSortTextAsc', + { + defaultMessage: 'Small-Large', + description: 'Ascending size label', + } + ), + 'euiDataGridSchema.jsonSortTextDesc': i18n.translate( + 'core.euiDataGridSchema.jsonSortTextDesc', + { + defaultMessage: 'Large-Small', + description: 'Descending size label', + } + ), 'euiFilterButton.filterBadge': ({ count, hasActiveFilters }: EuiValues) => i18n.translate('core.euiFilterButton.filterBadge', { defaultMessage: '${count} ${filterCountLabel} filters', @@ -195,6 +358,19 @@ export class I18nService { 'euiHue.label': i18n.translate('core.euiHue.label', { defaultMessage: 'Select the HSV color mode "hue" value', }), + 'euiImage.closeImage': ({ alt }: EuiValues) => + i18n.translate('core.euiImage.closeImage', { + defaultMessage: 'Close full screen {alt} image', + values: { alt }, + }), + 'euiImage.openImage': ({ alt }: EuiValues) => + i18n.translate('core.euiImage.openImage', { + defaultMessage: 'Open full screen {alt} image', + values: { alt }, + }), + 'euiLink.external.ariaLabel': i18n.translate('core.euiLink.external.ariaLabel', { + defaultMessage: 'External link', + }), 'euiModal.closeModal': i18n.translate('core.euiModal.closeModal', { defaultMessage: 'Closes this modal window', }), @@ -217,9 +393,70 @@ export class I18nService { 'euiPopover.screenReaderAnnouncement': i18n.translate( 'core.euiPopover.screenReaderAnnouncement', { - defaultMessage: 'You are in a popup. To exit this popup, hit Escape.', + defaultMessage: 'You are in a dialog. To close this dialog, hit escape.', } ), + 'euiQuickSelect.applyButton': i18n.translate('core.euiQuickSelect.applyButton', { + defaultMessage: 'Apply', + }), + 'euiQuickSelect.fullDescription': ({ timeTense, timeValue, timeUnit }: EuiValues) => + i18n.translate('core.euiQuickSelect.fullDescription', { + defaultMessage: 'Currently set to {timeTense} {timeValue} {timeUnit}.', + values: { timeTense, timeValue, timeUnit }, + }), + 'euiQuickSelect.legendText': i18n.translate('core.euiQuickSelect.legendText', { + defaultMessage: 'Quick select a time range', + }), + 'euiQuickSelect.nextLabel': i18n.translate('core.euiQuickSelect.nextLabel', { + defaultMessage: 'Next time window', + }), + 'euiQuickSelect.previousLabel': i18n.translate('core.euiQuickSelect.previousLabel', { + defaultMessage: 'Previous time window', + }), + 'euiQuickSelect.quickSelectTitle': i18n.translate('core.euiQuickSelect.quickSelectTitle', { + defaultMessage: 'Quick select', + }), + 'euiQuickSelect.tenseLabel': i18n.translate('core.euiQuickSelect.tenseLabel', { + defaultMessage: 'Time tense', + }), + 'euiQuickSelect.unitLabel': i18n.translate('core.euiQuickSelect.unitLabel', { + defaultMessage: 'Time unit', + }), + 'euiQuickSelect.valueLabel': i18n.translate('core.euiQuickSelect.valueLabel', { + defaultMessage: 'Time value', + }), + 'euiRefreshInterval.fullDescription': ({ optionValue, optionText }: EuiValues) => + i18n.translate('core.euiRefreshInterval.fullDescription', { + defaultMessage: 'Currently set to {optionValue} {optionText}.', + values: { optionValue, optionText }, + }), + 'euiRefreshInterval.legend': i18n.translate('core.euiRefreshInterval.legend', { + defaultMessage: 'Refresh every', + }), + 'euiRefreshInterval.start': i18n.translate('core.euiRefreshInterval.start', { + defaultMessage: 'Start', + }), + 'euiRefreshInterval.stop': i18n.translate('core.euiRefreshInterval.stop', { + defaultMessage: 'Stop', + }), + 'euiRelativeTab.fullDescription': ({ unit }: EuiValues) => + i18n.translate('core.euiRelativeTab.fullDescription', { + defaultMessage: 'The unit is changeable. Currently set to {unit}.', + values: { unit }, + }), + 'euiRelativeTab.relativeDate': ({ position }: EuiValues) => + i18n.translate('core.euiRelativeTab.relativeDate', { + defaultMessage: '{position} date', + values: { position }, + }), + 'euiRelativeTab.roundingLabel': ({ unit }: EuiValues) => + i18n.translate('core.euiRelativeTab.roundingLabel', { + defaultMessage: 'Round to the {unit}', + values: { unit }, + }), + 'euiRelativeTab.unitInputLabel': i18n.translate('core.euiRelativeTab.unitInputLabel', { + defaultMessage: 'Relative time span', + }), 'euiSaturation.roleDescription': i18n.translate('core.euiSaturation.roleDescription', { defaultMessage: 'HSV color mode saturation and value selection', }), @@ -247,22 +484,18 @@ export class I18nService { 'euiStat.loadingText': i18n.translate('core.euiStat.loadingText', { defaultMessage: 'Statistic is loading', }), - 'euiStep.completeStep': i18n.translate('core.euiStep.completeStep', { - defaultMessage: 'Step', - description: - 'See https://elastic.github.io/eui/#/navigation/steps to know how Step control looks like', - }), - 'euiStep.incompleteStep': i18n.translate('core.euiStep.incompleteStep', { - defaultMessage: 'Incomplete Step', - }), + 'euiStep.ariaLabel': ({ status }: EuiValues) => + i18n.translate('core.euiStep.ariaLabel', { + defaultMessage: '{stepStatus}', + values: { stepStatus: status === 'incomplete' ? 'Incomplete Step' : 'Step' }, + }), 'euiStepHorizontal.buttonTitle': ({ step, title, disabled, isComplete }: EuiValues) => { return i18n.translate('core.euiStepHorizontal.buttonTitle', { - defaultMessage: - 'Step {step}: {title}{titleAppendix, select, completed { is completed} disabled { is disabled} other {}}', + defaultMessage: 'Step {step}: {title}{titleAppendix}', values: { step, title, - titleAppendix: disabled ? 'disabled' : isComplete ? 'completed' : '', + titleAppendix: disabled ? ' is disabled' : isComplete ? ' is complete' : '', }, }); }, @@ -285,6 +518,9 @@ export class I18nService { description: 'Used as the title attribute on an image or svg icon to indicate a given process step is complete', }), + 'euiStyleSelector.buttonText': i18n.translate('core.euiStyleSelector.buttonText', { + defaultMessage: 'Density', + }), 'euiSuperDatePicker.showDatesButtonLabel': i18n.translate( 'core.euiSuperDatePicker.showDatesButtonLabel', { @@ -362,6 +598,17 @@ export class I18nService { defaultMessage: 'Notification', description: 'ARIA label on an element containing a notification', }), + 'euiTreeView.ariaLabel': ({ nodeLabel, ariaLabel }: EuiValues) => + i18n.translate('core.euiTreeView.ariaLabel', { + defaultMessage: '{nodeLabel} child of {ariaLabel}', + values: { nodeLabel, ariaLabel }, + }), + 'euiTreeView.listNavigationInstructions': i18n.translate( + 'core.euiTreeView.listNavigationInstructions', + { + defaultMessage: 'You can quickly navigate this list using arrow keys.', + } + ), }; return { diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index edd818e1b42de8..e18852e353b00c 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -167,7 +167,6 @@ export const TEMPORARILY_IGNORED_PATHS = [ 'x-pack/legacy/plugins/index_management/public/lib/editSettings.js', 'x-pack/legacy/plugins/license_management/public/store/reducers/licenseManagement.js', 'x-pack/legacy/plugins/monitoring/public/components/sparkline/__mocks__/plugins/xpack_main/jquery_flot.js', - 'x-pack/legacy/plugins/ml/public/jobs/new_job/simple/components/watcher/email-influencers.html', 'x-pack/legacy/plugins/monitoring/public/icons/alert-blue.svg', 'x-pack/legacy/plugins/monitoring/public/icons/health-gray.svg', 'x-pack/legacy/plugins/monitoring/public/icons/health-green.svg', diff --git a/src/dev/renovate/config.ts b/src/dev/renovate/config.ts index 7e62059f5059a4..6acbbaa4d5255a 100644 --- a/src/dev/renovate/config.ts +++ b/src/dev/renovate/config.ts @@ -21,7 +21,7 @@ import { RENOVATE_PACKAGE_GROUPS } from './package_groups'; import { PACKAGE_GLOBS } from './package_globs'; import { wordRegExp, maybeFlatMap, maybeMap, getTypePackageName } from './utils'; -const DEFAULT_LABELS = ['release_note:skip', 'renovate', 'v8.0.0', 'v7.6.0']; +const DEFAULT_LABELS = ['release_note:skip', 'Team:Operations', 'renovate', 'v8.0.0', 'v7.6.0']; export const RENOVATE_CONFIG = { extends: ['config:base'], diff --git a/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js index e6cae3f1710bcf..0c00b2f93ee6f9 100644 --- a/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js +++ b/src/legacy/core_plugins/console/public/quarantined/src/autocomplete/components/template_autocomplete_component.js @@ -21,7 +21,7 @@ import { ListComponent } from './list_component'; export class TemplateAutocompleteComponent extends ListComponent { constructor(name, parent) { - super(name, mappings.getTemplates, parent); + super(name, mappings.getTemplates, parent, true, true); } getContextKey() { return 'template'; diff --git a/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js b/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js index e54bc2476698a3..c2596dc4258daf 100644 --- a/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js +++ b/src/legacy/core_plugins/console/server/api_server/es_6_0/aggregations.js @@ -352,6 +352,13 @@ const rules = { }, missing: '', }, + cumulative_cardinality: { + __template: { + buckets_path: '', + }, + buckets_path: '', + format: '', + }, scripted_metric: { __template: { init_script: '', diff --git a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json index cc7218be2e48d6..c19836e2f9eb0b 100644 --- a/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json +++ b/src/legacy/core_plugins/console/server/api_server/spec/overrides/indices.put_template.json @@ -1,10 +1,16 @@ { "indices.put_template": { "data_autocomplete_rules": { - "template": "index*", - "warmers": { "__scope_link": "_warmer" }, + "index_patterns": [], "mappings": { "__scope_link": "put_mapping" }, - "settings": { "__scope_link": "put_settings" } + "settings": { "__scope_link": "put_settings" }, + "version": 0, + "order": 0, + "aliases": { + "__template": { + "NAME": {} + } + } }, "patterns": [ "_template/{template}" diff --git a/src/legacy/core_plugins/data/public/filter/apply_filters/apply_filter_popover_content.tsx b/src/legacy/core_plugins/data/public/filter/apply_filters/apply_filter_popover_content.tsx index 37d96a51d66d25..954cbca8f054ba 100644 --- a/src/legacy/core_plugins/data/public/filter/apply_filters/apply_filter_popover_content.tsx +++ b/src/legacy/core_plugins/data/public/filter/apply_filters/apply_filter_popover_content.tsx @@ -31,8 +31,12 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import React, { Component } from 'react'; import { IndexPattern } from '../../index_patterns'; -import { FilterLabel } from '../filter_bar/filter_editor/lib/filter_label'; -import { mapAndFlattenFilters, esFilters, utils } from '../../../../../../plugins/data/public'; +import { + mapAndFlattenFilters, + esFilters, + utils, + FilterLabel, +} from '../../../../../../plugins/data/public'; interface Props { filters: esFilters.Filter[]; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_bar.less b/src/legacy/core_plugins/data/public/filter/filter_bar/filter_bar.less deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/src/legacy/core_plugins/data/public/filter/index.tsx b/src/legacy/core_plugins/data/public/filter/index.tsx index 005c4904a4f392..e48a18fc53a76e 100644 --- a/src/legacy/core_plugins/data/public/filter/index.tsx +++ b/src/legacy/core_plugins/data/public/filter/index.tsx @@ -17,6 +17,4 @@ * under the License. */ -export { FilterBar } from './filter_bar'; - export { ApplyFiltersPopover } from './apply_filters'; diff --git a/src/legacy/core_plugins/data/public/index.scss b/src/legacy/core_plugins/data/public/index.scss index 14274d27c13eef..913141666c7b9a 100644 --- a/src/legacy/core_plugins/data/public/index.scss +++ b/src/legacy/core_plugins/data/public/index.scss @@ -2,6 +2,6 @@ @import './query/query_bar/index'; -@import './filter/filter_bar/index'; +@import 'src/plugins/data/public/ui/filter_bar/index'; @import './search/search_bar/index'; diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index ffce162cadde45..b33aef75e6756e 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -29,7 +29,7 @@ export function plugin() { /** @public types */ export { DataSetup, DataStart }; -export { FilterBar, ApplyFiltersPopover } from './filter'; +export { ApplyFiltersPopover } from './filter'; export { Field, FieldType, diff --git a/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.test.tsx b/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.test.tsx index 44637365247fbd..0ca9482fefa301 100644 --- a/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.test.tsx +++ b/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.test.tsx @@ -35,9 +35,14 @@ const mockTimeHistory = { }, }; -jest.mock('../../../../../data/public', () => { +jest.mock('../../../../../../../plugins/data/public', () => { return { FilterBar: () =>
, + }; +}); + +jest.mock('../../../../../data/public', () => { + return { QueryBarInput: () =>
, }; }); diff --git a/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.tsx b/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.tsx index c8b76c9cda99db..6a1ef77a566538 100644 --- a/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.tsx +++ b/src/legacy/core_plugins/data/public/search/search_bar/components/search_bar.tsx @@ -24,7 +24,7 @@ import React, { Component } from 'react'; import ResizeObserver from 'resize-observer-polyfill'; import { get, isEqual } from 'lodash'; -import { IndexPattern, FilterBar } from '../../../../../data/public'; +import { IndexPattern } from '../../../../../data/public'; import { QueryBarTopRow } from '../../../query'; import { SavedQuery, SavedQueryAttributes } from '../index'; import { SavedQueryMeta, SaveQueryForm } from './saved_query_management/save_query_form'; @@ -41,6 +41,7 @@ import { Query, esFilters, TimeHistoryContract, + FilterBar, } from '../../../../../../../plugins/data/public'; interface SearchBarInjectedDeps { diff --git a/src/legacy/ui/public/management/components/sidebar_nav.tsx b/src/legacy/ui/public/management/components/sidebar_nav.tsx index f0ac787e0ef446..cd3d85090dce01 100644 --- a/src/legacy/ui/public/management/components/sidebar_nav.tsx +++ b/src/legacy/ui/public/management/components/sidebar_nav.tsx @@ -17,7 +17,7 @@ * under the License. */ -import { EuiIcon, EuiSideNav, IconType } from '@elastic/eui'; +import { EuiIcon, EuiSideNav, IconType, EuiScreenReaderOnly } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import React from 'react'; @@ -72,17 +72,26 @@ export class SidebarNav extends React.Component + <> + +

+ {i18n.translate('common.ui.management.nav.label', { + defaultMessage: 'Management', + })} +

+
+ + ); } diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 6a2df6a61d1366..ace0b44378b459 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -36,3 +36,5 @@ export * from './types'; export { IRequestTypesMap, IResponseTypesMap } from './search'; export * from './search'; export * from './query'; + +export * from './ui'; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/_global_filter_group.scss b/src/plugins/data/public/ui/filter_bar/_global_filter_group.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/_global_filter_group.scss rename to src/plugins/data/public/ui/filter_bar/_global_filter_group.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/_global_filter_item.scss b/src/plugins/data/public/ui/filter_bar/_global_filter_item.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/_global_filter_item.scss rename to src/plugins/data/public/ui/filter_bar/_global_filter_item.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/_index.scss b/src/plugins/data/public/ui/filter_bar/_index.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/_index.scss rename to src/plugins/data/public/ui/filter_bar/_index.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/_variables.scss b/src/plugins/data/public/ui/filter_bar/_variables.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/_variables.scss rename to src/plugins/data/public/ui/filter_bar/_variables.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_bar.tsx b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx similarity index 97% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_bar.tsx rename to src/plugins/data/public/ui/filter_bar/filter_bar.tsx index e80bffb5e3c68e..2f1b1f8588eb92 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_bar.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_bar.tsx @@ -25,8 +25,8 @@ import React, { useState } from 'react'; import { FilterEditor } from './filter_editor'; import { FilterItem } from './filter_item'; import { FilterOptions } from './filter_options'; -import { useKibana } from '../../../../../../plugins/kibana_react/public'; -import { IIndexPattern, esFilters } from '../../../../../../plugins/data/public'; +import { useKibana } from '../../../../kibana_react/public'; +import { IIndexPattern, esFilters } from '../..'; interface Props { filters: esFilters.Filter[]; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/_filter_editor.scss b/src/plugins/data/public/ui/filter_bar/filter_editor/_filter_editor.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/_filter_editor.scss rename to src/plugins/data/public/ui/filter_bar/filter_editor/_filter_editor.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/_index.scss b/src/plugins/data/public/ui/filter_bar/filter_editor/_index.scss similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/_index.scss rename to src/plugins/data/public/ui/filter_bar/filter_editor/_index.scss diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/generic_combo_box.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/generic_combo_box.tsx similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/generic_combo_box.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/generic_combo_box.tsx diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/index.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx similarity index 99% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/index.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx index 4f9424f30f5163..12da4cbab02da3 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/index.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/index.tsx @@ -48,12 +48,7 @@ import { Operator } from './lib/filter_operators'; import { PhraseValueInput } from './phrase_value_input'; import { PhrasesValuesInput } from './phrases_values_input'; import { RangeValueInput } from './range_value_input'; -import { - esFilters, - utils, - IIndexPattern, - IFieldType, -} from '../../../../../../../plugins/data/public'; +import { esFilters, utils, IIndexPattern, IFieldType } from '../../..'; interface Props { filter: esFilters.Filter; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.js.snap b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.js.snap similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.js.snap rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/__snapshots__/filter_label.test.js.snap diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.test.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts similarity index 79% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.test.ts rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts index 6dc9bc2300e044..2cc7f16cfe261b 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.test.ts +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.test.ts @@ -17,7 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ import { existsFilter, phraseFilter, @@ -25,8 +24,8 @@ import { rangeFilter, stubIndexPattern, stubFields, -} from '../../../../../../../../plugins/data/public/stubs'; -import { IndexPattern, Field } from '../../../../index'; +} from '../../../../stubs'; +import { esFilters } from '../../../../index'; import { getFieldFromFilter, getFilterableFields, @@ -37,17 +36,12 @@ import { import { existsOperator, isBetweenOperator, isOneOfOperator, isOperator } from './filter_operators'; -import { esFilters } from '../../../../../../../../plugins/data/public'; - jest.mock('ui/new_platform'); -const mockedFields = stubFields as Field[]; -const mockedIndexPattern = stubIndexPattern as IndexPattern; - describe('Filter editor utils', () => { describe('getFieldFromFilter', () => { it('should return the field from the filter', () => { - const field = getFieldFromFilter(phraseFilter, mockedIndexPattern); + const field = getFieldFromFilter(phraseFilter, stubIndexPattern); expect(field).not.toBeUndefined(); expect(field && field.name).toBe(phraseFilter.meta.key); }); @@ -117,12 +111,12 @@ describe('Filter editor utils', () => { describe('getFilterableFields', () => { it('returns the list of fields from the given index pattern', () => { - const fieldOptions = getFilterableFields(mockedIndexPattern); + const fieldOptions = getFilterableFields(stubIndexPattern); expect(fieldOptions.length).toBeGreaterThan(0); }); it('limits the fields to the filterable fields', () => { - const fieldOptions = getFilterableFields(mockedIndexPattern); + const fieldOptions = getFilterableFields(stubIndexPattern); const nonFilterableFields = fieldOptions.filter(field => !field.filterable); expect(nonFilterableFields.length).toBe(0); }); @@ -131,14 +125,14 @@ describe('Filter editor utils', () => { describe('getOperatorOptions', () => { it('returns range for number fields', () => { const [field] = stubFields.filter(({ type }) => type === 'number'); - const operatorOptions = getOperatorOptions(field as Field); + const operatorOptions = getOperatorOptions(field); const rangeOperator = operatorOptions.find(operator => operator.type === 'range'); expect(rangeOperator).not.toBeUndefined(); }); it('does not return range for string fields', () => { const [field] = stubFields.filter(({ type }) => type === 'string'); - const operatorOptions = getOperatorOptions(field as Field); + const operatorOptions = getOperatorOptions(field); const rangeOperator = operatorOptions.find(operator => operator.type === 'range'); expect(rangeOperator).toBeUndefined(); }); @@ -146,49 +140,44 @@ describe('Filter editor utils', () => { describe('isFilterValid', () => { it('should return false if index pattern is not provided', () => { - const isValid = isFilterValid(undefined, mockedFields[0], isOperator, 'foo'); + const isValid = isFilterValid(undefined, stubFields[0], isOperator, 'foo'); expect(isValid).toBe(false); }); it('should return false if field is not provided', () => { - const isValid = isFilterValid(mockedIndexPattern, undefined, isOperator, 'foo'); + const isValid = isFilterValid(stubIndexPattern, undefined, isOperator, 'foo'); expect(isValid).toBe(false); }); it('should return false if operator is not provided', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], undefined, 'foo'); + const isValid = isFilterValid(stubIndexPattern, stubFields[0], undefined, 'foo'); expect(isValid).toBe(false); }); it('should return false for phrases filter without phrases', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], isOneOfOperator, []); + const isValid = isFilterValid(stubIndexPattern, stubFields[0], isOneOfOperator, []); expect(isValid).toBe(false); }); it('should return true for phrases filter with phrases', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], isOneOfOperator, ['foo']); + const isValid = isFilterValid(stubIndexPattern, stubFields[0], isOneOfOperator, ['foo']); expect(isValid).toBe(true); }); it('should return false for range filter without range', () => { - const isValid = isFilterValid( - mockedIndexPattern, - mockedFields[0], - isBetweenOperator, - undefined - ); + const isValid = isFilterValid(stubIndexPattern, stubFields[0], isBetweenOperator, undefined); expect(isValid).toBe(false); }); it('should return true for range filter with from', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], isBetweenOperator, { + const isValid = isFilterValid(stubIndexPattern, stubFields[0], isBetweenOperator, { from: 'foo', }); expect(isValid).toBe(true); }); it('should return true for range filter with from/to', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], isBetweenOperator, { + const isValid = isFilterValid(stubIndexPattern, stubFields[0], isBetweenOperator, { from: 'foo', too: 'goo', }); @@ -196,7 +185,7 @@ describe('Filter editor utils', () => { }); it('should return true for exists filter without params', () => { - const isValid = isFilterValid(mockedIndexPattern, mockedFields[0], existsOperator); + const isValid = isFilterValid(stubIndexPattern, stubFields[0], existsOperator); expect(isValid).toBe(true); }); }); diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts similarity index 93% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.ts rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts index e4487af42beaf4..422ffb162125d9 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_editor_utils.ts +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_editor_utils.ts @@ -18,14 +18,9 @@ */ import dateMath from '@elastic/datemath'; -import { Ipv4Address } from '../../../../../../../../plugins/kibana_utils/public'; +import { Ipv4Address } from '../../../../../../kibana_utils/public'; import { FILTER_OPERATORS, Operator } from './filter_operators'; -import { - esFilters, - IIndexPattern, - IFieldType, - isFilterable, -} from '../../../../../../../../plugins/data/public'; +import { esFilters, IIndexPattern, IFieldType, isFilterable } from '../../../..'; export function getFieldFromFilter(filter: esFilters.FieldFilter, indexPattern: IIndexPattern) { return indexPattern.fields.find(field => field.name === filter.meta.key); diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.test.js b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.js similarity index 88% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.test.js rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.js index 0f45a33a79ebbc..3eb46645522e18 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.test.js +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.test.js @@ -20,10 +20,7 @@ import React from 'react'; import { FilterLabel } from './filter_label'; import { shallow } from 'enzyme'; - -/* eslint-disable @kbn/eslint/no-restricted-paths */ -import { phraseFilter } from '../../../../../../../../plugins/data/public/stubs'; -/* eslint-enable @kbn/eslint/no-restricted-paths */ +import { phraseFilter } from '../../../../stubs'; test('alias', () => { const filter = { diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx similarity index 97% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx index 1b4bdb881116b2..49a0d6f2ab3bdb 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_label.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_label.tsx @@ -21,7 +21,7 @@ import React, { Fragment } from 'react'; import { EuiTextColor } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { existsOperator, isOneOfOperator } from './filter_operators'; -import { esFilters } from '../../../../../../../../plugins/data/public'; +import { esFilters } from '../../../..'; interface Props { filter: esFilters.Filter; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_operators.ts b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts similarity index 97% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_operators.ts rename to src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts index a3da03db71d6ea..bb15cffa67b599 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/lib/filter_operators.ts +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/lib/filter_operators.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { esFilters } from '../../../../../../../../plugins/data/public'; +import { esFilters } from '../../../..'; export interface Operator { message: string; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx similarity index 91% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_suggestor.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx index 092bf8daa8f2eb..61290cc16b8a88 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_suggestor.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx @@ -19,16 +19,9 @@ import { Component } from 'react'; import { debounce } from 'lodash'; -import { - withKibana, - KibanaReactContextValue, -} from '../../../../../../../plugins/kibana_react/public'; -import { - IDataPluginServices, - IIndexPattern, - IFieldType, -} from '../../../../../../../plugins/data/public'; +import { withKibana, KibanaReactContextValue } from '../../../../../kibana_react/public'; +import { IDataPluginServices, IIndexPattern, IFieldType } from '../../..'; export interface PhraseSuggestorProps { kibana: KibanaReactContextValue; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx similarity index 97% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx index 7ef51f88ba57e1..b16994cb0057b7 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_value_input.tsx @@ -24,7 +24,7 @@ import React from 'react'; import { GenericComboBox, GenericComboBoxProps } from './generic_combo_box'; import { PhraseSuggestorUI, PhraseSuggestorProps } from './phrase_suggestor'; import { ValueInputType } from './value_input_type'; -import { withKibana } from '../../../../../../../plugins/kibana_react/public'; +import { withKibana } from '../../../../../kibana_react/public'; interface Props extends PhraseSuggestorProps { value?: string; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrases_values_input.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrases_values_input.tsx similarity index 96% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrases_values_input.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/phrases_values_input.tsx index f3b30e2ad5fd92..aa76684239b63f 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrases_values_input.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrases_values_input.tsx @@ -23,7 +23,7 @@ import { uniq } from 'lodash'; import React from 'react'; import { GenericComboBox, GenericComboBoxProps } from './generic_combo_box'; import { PhraseSuggestorUI, PhraseSuggestorProps } from './phrase_suggestor'; -import { withKibana } from '../../../../../../../plugins/kibana_react/public'; +import { withKibana } from '../../../../../kibana_react/public'; interface Props extends PhraseSuggestorProps { values?: string[]; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/range_value_input.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/range_value_input.tsx similarity index 96% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/range_value_input.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/range_value_input.tsx index 3c39a770377a0e..65b842f0bd4aae 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/range_value_input.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/range_value_input.tsx @@ -21,8 +21,8 @@ import { EuiIcon, EuiLink, EuiFormHelpText, EuiFormControlLayoutDelimited } from import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import { get } from 'lodash'; import React from 'react'; -import { useKibana } from '../../../../../../../plugins/kibana_react/public'; -import { IFieldType } from '../../../../../../../plugins/data/public'; +import { useKibana } from '../../../../../kibana_react/public'; +import { IFieldType } from '../../..'; import { ValueInputType } from './value_input_type'; interface RangeParams { diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/value_input_type.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/value_input_type.tsx similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/value_input_type.tsx rename to src/plugins/data/public/ui/filter_bar/filter_editor/value_input_type.tsx diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx similarity index 98% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_item.tsx rename to src/plugins/data/public/ui/filter_bar/filter_item.tsx index 27406232dd5d3a..4ef0b2740e5fad 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_item.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_item.tsx @@ -24,7 +24,7 @@ import React, { Component } from 'react'; import { UiSettingsClientContract } from 'src/core/public'; import { FilterEditor } from './filter_editor'; import { FilterView } from './filter_view'; -import { esFilters, utils, IIndexPattern } from '../../../../../../plugins/data/public'; +import { esFilters, utils, IIndexPattern } from '../..'; interface Props { id: string; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_options.tsx b/src/plugins/data/public/ui/filter_bar/filter_options.tsx similarity index 100% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_options.tsx rename to src/plugins/data/public/ui/filter_bar/filter_options.tsx diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_view/index.tsx b/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx similarity index 97% rename from src/legacy/core_plugins/data/public/filter/filter_bar/filter_view/index.tsx rename to src/plugins/data/public/ui/filter_bar/filter_view/index.tsx index 39d4a80cdf540c..dd12789d15a9d7 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_view/index.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_view/index.tsx @@ -21,7 +21,7 @@ import { EuiBadge, useInnerText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { FC } from 'react'; import { FilterLabel } from '../filter_editor/lib/filter_label'; -import { esFilters } from '../../../../../../../plugins/data/public'; +import { esFilters } from '../../..'; interface Props { filter: esFilters.Filter; diff --git a/src/plugins/data/public/ui/filter_bar/index.ts b/src/plugins/data/public/ui/filter_bar/index.ts new file mode 100644 index 00000000000000..b975317d466303 --- /dev/null +++ b/src/plugins/data/public/ui/filter_bar/index.ts @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { FilterBar } from './filter_bar'; +export { FilterLabel } from './filter_editor/lib/filter_label'; diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/index.ts b/src/plugins/data/public/ui/index.ts similarity index 95% rename from src/legacy/core_plugins/data/public/filter/filter_bar/index.ts rename to src/plugins/data/public/ui/index.ts index 438d292b9f5836..d0aaf2f6aac1c3 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/index.ts +++ b/src/plugins/data/public/ui/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export { FilterBar } from './filter_bar'; +export * from './filter_bar'; diff --git a/src/plugins/es_ui_shared/static/forms/components/field.tsx b/src/plugins/es_ui_shared/static/forms/components/field.tsx index 3f4050e98f64d6..89dea53d75b38a 100644 --- a/src/plugins/es_ui_shared/static/forms/components/field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/field.tsx @@ -29,20 +29,26 @@ interface Props { import { TextField, + TextAreaField, NumericField, CheckBoxField, ComboBoxField, MultiSelectField, + RadioGroupField, + RangeField, SelectField, ToggleField, } from './fields'; const mapTypeToFieldComponent = { [FIELD_TYPES.TEXT]: TextField, + [FIELD_TYPES.TEXTAREA]: TextAreaField, [FIELD_TYPES.NUMBER]: NumericField, [FIELD_TYPES.CHECKBOX]: CheckBoxField, [FIELD_TYPES.COMBO_BOX]: ComboBoxField, [FIELD_TYPES.MULTI_SELECT]: MultiSelectField, + [FIELD_TYPES.RADIO_GROUP]: RadioGroupField, + [FIELD_TYPES.RANGE]: RangeField, [FIELD_TYPES.SELECT]: SelectField, [FIELD_TYPES.TOGGLE]: ToggleField, }; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/checkbox_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/checkbox_field.tsx index 73e8c1ff1426bd..0443b4ff09e603 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/checkbox_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/checkbox_field.tsx @@ -21,8 +21,7 @@ import React from 'react'; import { EuiFormRow, EuiCheckbox } from '@elastic/eui'; import uuid from 'uuid'; -import { FieldHook } from '../../hook_form_lib'; -import { getFieldValidityAndErrorMessage } from '../helpers'; +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; interface Props { field: FieldHook; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/combobox_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/combobox_field.tsx index 5c2e4a4165d5f1..fa73e5a663863a 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/combobox_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/combobox_field.tsx @@ -82,6 +82,7 @@ export const ComboBoxField = ({ field, euiFieldProps = {}, ...rest }: Props) => return ( ; + idAria?: string; + [key: string]: any; +} + +export const RadioGroupField = ({ field, euiFieldProps = {}, ...rest }: Props) => { + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + + return ( + + + + ); +}; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/range_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/range_field.tsx new file mode 100644 index 00000000000000..4ed2dd40968e5b --- /dev/null +++ b/src/plugins/es_ui_shared/static/forms/components/fields/range_field.tsx @@ -0,0 +1,68 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React, { useCallback } from 'react'; +import { EuiFormRow, EuiRange } from '@elastic/eui'; + +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; + +interface Props { + field: FieldHook; + euiFieldProps?: Record; + idAria?: string; + [key: string]: any; +} + +export const RangeField = ({ field, euiFieldProps = {}, ...rest }: Props) => { + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + + const onChange = useCallback( + (e: React.ChangeEvent | React.MouseEvent) => { + const event = ({ ...e, value: `${e.currentTarget.value}` } as unknown) as React.ChangeEvent<{ + value: string; + }>; + field.onChange(event); + }, + [field.onChange] + ); + + return ( + + + + ); +}; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/select_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/select_field.tsx index b7eb1c5fa3bd3e..a6d77e3b179edd 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/select_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/select_field.tsx @@ -20,8 +20,7 @@ import React from 'react'; import { EuiFormRow, EuiSelect } from '@elastic/eui'; -import { FieldHook } from '../../hook_form_lib'; -import { getFieldValidityAndErrorMessage } from '../helpers'; +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; interface Props { field: FieldHook; @@ -49,10 +48,11 @@ export const SelectField = ({ field, euiFieldProps = {}, ...rest }: Props) => { onChange={e => { field.setValue(e.target.value); }} + options={[]} hasNoInitialSelection={true} isInvalid={isInvalid} data-test-subj="select" - {...(euiFieldProps as { options: any; [key: string]: any })} + {...euiFieldProps} /> ); diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/text_area_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/text_area_field.tsx index 6916f224f8bda9..b9c6424a00656b 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/text_area_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/text_area_field.tsx @@ -20,8 +20,7 @@ import React from 'react'; import { EuiFormRow, EuiTextArea } from '@elastic/eui'; -import { FieldHook } from '../../hook_form_lib'; -import { getFieldValidityAndErrorMessage } from '../helpers'; +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; interface Props { field: FieldHook; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/text_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/text_field.tsx index 6e1bc639e65ce8..9e255d8eda22ce 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/text_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/text_field.tsx @@ -20,8 +20,7 @@ import React from 'react'; import { EuiFormRow, EuiFieldText } from '@elastic/eui'; -import { FieldHook } from '../../hook_form_lib'; -import { getFieldValidityAndErrorMessage } from '../helpers'; +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; interface Props { field: FieldHook; diff --git a/src/plugins/es_ui_shared/static/forms/components/fields/toggle_field.tsx b/src/plugins/es_ui_shared/static/forms/components/fields/toggle_field.tsx index 0c075c497a4d07..c6d89d0bfde212 100644 --- a/src/plugins/es_ui_shared/static/forms/components/fields/toggle_field.tsx +++ b/src/plugins/es_ui_shared/static/forms/components/fields/toggle_field.tsx @@ -20,8 +20,7 @@ import React from 'react'; import { EuiFormRow, EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; -import { FieldHook } from '../../hook_form_lib'; -import { getFieldValidityAndErrorMessage } from '../helpers'; +import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib'; interface Props { field: FieldHook; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/constants.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/constants.ts index f65b7cd0aa0b0c..df2807e59ab465 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/constants.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/constants.ts @@ -20,10 +20,13 @@ // Field types export const FIELD_TYPES = { TEXT: 'text', + TEXTAREA: 'textarea', NUMBER: 'number', TOGGLE: 'toggle', CHECKBOX: 'checkbox', COMBO_BOX: 'comboBox', + RADIO_GROUP: 'radioGroup', + RANGE: 'range', SELECT: 'select', MULTI_SELECT: 'multiSelect', }; diff --git a/src/plugins/es_ui_shared/static/forms/components/helpers.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/helpers.ts similarity index 96% rename from src/plugins/es_ui_shared/static/forms/components/helpers.ts rename to src/plugins/es_ui_shared/static/forms/hook_form_lib/helpers.ts index a7543d31bb5470..e71d52d6ff003a 100644 --- a/src/plugins/es_ui_shared/static/forms/components/helpers.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/helpers.ts @@ -17,7 +17,7 @@ * under the License. */ -import { FieldHook } from '../hook_form_lib'; +import { FieldHook } from './types'; export const getFieldValidityAndErrorMessage = ( field: FieldHook diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts index 8a1012404b3772..d7ef798bf2e03a 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_field.ts @@ -27,6 +27,7 @@ export const useField = (form: FormHook, path: string, config: FieldConfig = {}) type = FIELD_TYPES.TEXT, defaultValue = '', label = '', + labelAppend = '', helpText = '', validations = [], formatters = [], @@ -382,6 +383,7 @@ export const useField = (form: FormHook, path: string, config: FieldConfig = {}) path, type, label, + labelAppend, helpText, value, errors, diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/index.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/index.ts index 6e1a5b075d3180..3079814c9ad14b 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/index.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/index.ts @@ -20,6 +20,7 @@ // Only export the useForm hook. The "useField" hook is for internal use // as the consumer of the library must use the component export { useForm } from './hooks'; +export { getFieldValidityAndErrorMessage } from './helpers'; export * from './form_context'; export * from './components'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts index 28e2a346bd5c4c..9946020132354f 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/types.ts @@ -71,6 +71,7 @@ export interface FormOptions { export interface FieldHook { readonly path: string; readonly label?: string; + readonly labelAppend?: string | ReactNode; readonly helpText?: string | ReactNode; readonly type: string; readonly value: unknown; @@ -98,6 +99,7 @@ export interface FieldHook { export interface FieldConfig { readonly path?: string; readonly label?: string; + readonly labelAppend?: string | ReactNode; readonly helpText?: string | ReactNode; readonly type?: HTMLInputElement['type']; readonly defaultValue?: unknown; diff --git a/x-pack/README.md b/x-pack/README.md index bd50181afee692..3f1fc819d145b0 100644 --- a/x-pack/README.md +++ b/x-pack/README.md @@ -23,7 +23,7 @@ By default, this will also set the password for native realm accounts to the pas Examples: - Run the jest test case whose description matches 'filtering should skip values of null': - `cd x-pack && yarn test:jest -t 'filtering should skip values of null' plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.js` + `cd x-pack && yarn test:jest -t 'filtering should skip values of null' plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js` - Run the x-pack api integration test case whose description matches the given string: `node scripts/functional_tests_server --config x-pack/test/api_integration/config.js` `node scripts/functional_test_runner --config x-pack/test/api_integration/config.js --grep='apis Monitoring Beats list with restarted beat instance should load multiple clusters'` diff --git a/x-pack/legacy/plugins/alerting/README.md b/x-pack/legacy/plugins/alerting/README.md index 456eb6732c81cf..40f61d11e9ace0 100644 --- a/x-pack/legacy/plugins/alerting/README.md +++ b/x-pack/legacy/plugins/alerting/README.md @@ -202,7 +202,7 @@ Payload: |tags|A list of keywords to reference and search in the future.|string[]| |alertTypeId|The id value of the alert type you want to call when the alert is scheduled to execute.|string| |interval|The interval in seconds, minutes, hours or days the alert should execute. Example: `10s`, `5m`, `1h`, `1d`.|string| -|alertTypeParams|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object| +|params|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object| |actions|Array of the following:
- `group` (string): We support grouping actions in the scenario of escalations or different types of alert instances. If you don't need this, feel free to use `default` as a value.
- `id` (string): The id of the action saved object to execute.
- `params` (object): The map to the `params` the action type will receive. In order to help apply context to strings, we handle them as mustache templates and pass in a default set of context. (see templating actions).|array| #### `DELETE /api/alert/{id}`: Delete alert @@ -246,7 +246,7 @@ Payload: |interval|The interval in seconds, minutes, hours or days the alert should execute. Example: `10s`, `5m`, `1h`, `1d`.|string| |name|A name to reference and search in the future.|string| |tags|A list of keywords to reference and search in the future.|string[]| -|alertTypeParams|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object| +|params|The parameters to pass in to the alert type executor `params` value. This will also validate against the alert type params validator if defined.|object| |actions|Array of the following:
- `group` (string): We support grouping actions in the scenario of escalations or different types of alert instances. If you don't need this, feel free to use `default` as a value.
- `id` (string): The id of the action saved object to execute.
- `params` (object): There map to the `params` the action type will receive. In order to help apply context to strings, we handle them as mustache templates and pass in a default set of context. (see templating actions).|array| #### `POST /api/alert/{id}/_enable`: Enable an alert diff --git a/x-pack/legacy/plugins/alerting/mappings.json b/x-pack/legacy/plugins/alerting/mappings.json index 7a1be777aff449..f840c019d5e024 100644 --- a/x-pack/legacy/plugins/alerting/mappings.json +++ b/x-pack/legacy/plugins/alerting/mappings.json @@ -31,7 +31,7 @@ } } }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, diff --git a/x-pack/legacy/plugins/alerting/server/alerts_client.test.ts b/x-pack/legacy/plugins/alerting/server/alerts_client.test.ts index dc3aaaf5cf23c8..08607f04a52355 100644 --- a/x-pack/legacy/plugins/alerting/server/alerts_client.test.ts +++ b/x-pack/legacy/plugins/alerting/server/alerts_client.test.ts @@ -48,7 +48,7 @@ function getMockData(overwrites: Record = {}) { alertTypeId: '123', interval: '10s', throttle: null, - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -80,7 +80,7 @@ describe('create()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -130,25 +130,25 @@ describe('create()', () => { }); const result = await alertsClient.create({ data }); expect(result).toMatchInlineSnapshot(` - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, - "id": "1", - "interval": "10s", - "scheduledTaskId": "task-123", - } - `); + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "alertTypeId": "123", + "id": "1", + "interval": "10s", + "params": Object { + "bar": true, + }, + "scheduledTaskId": "task-123", + } + `); expect(savedObjectsClient.create).toHaveBeenCalledTimes(1); expect(savedObjectsClient.create.mock.calls[0]).toHaveLength(3); expect(savedObjectsClient.create.mock.calls[0][0]).toEqual('alert'); @@ -164,9 +164,6 @@ describe('create()', () => { }, ], "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, "apiKey": undefined, "apiKeyOwner": undefined, "createdBy": "elastic", @@ -175,6 +172,9 @@ describe('create()', () => { "muteAll": false, "mutedInstanceIds": Array [], "name": "abc", + "params": Object { + "bar": true, + }, "tags": Array [ "foo", ], @@ -240,7 +240,7 @@ describe('create()', () => { enabled: false, alertTypeId: '123', interval: 10000, - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -263,30 +263,30 @@ describe('create()', () => { }); const result = await alertsClient.create({ data }); expect(result).toMatchInlineSnapshot(` - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, - "enabled": false, - "id": "1", - "interval": 10000, - } - `); + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "alertTypeId": "123", + "enabled": false, + "id": "1", + "interval": 10000, + "params": Object { + "bar": true, + }, + } + `); expect(savedObjectsClient.create).toHaveBeenCalledTimes(1); expect(taskManager.schedule).toHaveBeenCalledTimes(0); }); - test('should validate alertTypeParams', async () => { + test('should validate params', async () => { const alertsClient = new AlertsClient(alertsClientParams); const data = getMockData(); alertTypeRegistry.get.mockReturnValueOnce({ @@ -302,7 +302,7 @@ describe('create()', () => { async executor() {}, }); await expect(alertsClient.create({ data })).rejects.toThrowErrorMatchingInlineSnapshot( - `"alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]"` + `"params invalid: [param1]: expected value of type [string] but got [undefined]"` ); }); @@ -337,7 +337,7 @@ describe('create()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -387,7 +387,7 @@ describe('create()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -448,7 +448,7 @@ describe('create()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -511,7 +511,7 @@ describe('create()', () => { ], alertTypeId: '123', name: 'abc', - alertTypeParams: { bar: true }, + params: { bar: true }, apiKey: Buffer.from('123:abc').toString('base64'), apiKeyOwner: 'elastic', createdBy: 'elastic', @@ -923,7 +923,7 @@ describe('get()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -946,24 +946,24 @@ describe('get()', () => { }); const result = await alertsClient.get({ id: '1' }); expect(result).toMatchInlineSnapshot(` - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, - "id": "1", - "interval": "10s", - } - `); + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "alertTypeId": "123", + "id": "1", + "interval": "10s", + "params": Object { + "bar": true, + }, + } + `); expect(savedObjectsClient.get).toHaveBeenCalledTimes(1); expect(savedObjectsClient.get.mock.calls[0]).toMatchInlineSnapshot(` Array [ @@ -981,7 +981,7 @@ describe('get()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1016,7 +1016,7 @@ describe('find()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1041,31 +1041,31 @@ describe('find()', () => { }); const result = await alertsClient.find(); expect(result).toMatchInlineSnapshot(` - Object { - "data": Array [ - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, - "id": "1", - "interval": "10s", - }, - ], - "page": 1, - "perPage": 10, - "total": 1, - } - `); + Object { + "data": Array [ + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "alertTypeId": "123", + "id": "1", + "interval": "10s", + "params": Object { + "bar": true, + }, + }, + ], + "page": 1, + "perPage": 10, + "total": 1, + } + `); expect(savedObjectsClient.find).toHaveBeenCalledTimes(1); expect(savedObjectsClient.find.mock.calls[0]).toMatchInlineSnapshot(` Array [ @@ -1086,7 +1086,7 @@ describe('delete()', () => { attributes: { alertTypeId: '123', interval: '10s', - alertTypeParams: { + params: { bar: true, }, scheduledTaskId: 'task-123', @@ -1155,7 +1155,7 @@ describe('update()', () => { attributes: { enabled: true, interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1183,7 +1183,7 @@ describe('update()', () => { interval: '10s', name: 'abc', tags: ['foo'], - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1198,25 +1198,25 @@ describe('update()', () => { }, }); expect(result).toMatchInlineSnapshot(` - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeParams": Object { - "bar": true, - }, - "enabled": true, - "id": "1", - "interval": "10s", - "scheduledTaskId": "task-123", - } - `); + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "enabled": true, + "id": "1", + "interval": "10s", + "params": Object { + "bar": true, + }, + "scheduledTaskId": "task-123", + } + `); expect(savedObjectsClient.update).toHaveBeenCalledTimes(1); expect(savedObjectsClient.update.mock.calls[0]).toHaveLength(4); expect(savedObjectsClient.update.mock.calls[0][0]).toEqual('alert'); @@ -1233,14 +1233,14 @@ describe('update()', () => { }, ], "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, "apiKey": null, "apiKeyOwner": null, "enabled": true, "interval": "10s", "name": "abc", + "params": Object { + "bar": true, + }, "scheduledTaskId": "task-123", "tags": Array [ "foo", @@ -1291,7 +1291,7 @@ describe('update()', () => { attributes: { enabled: true, interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1320,7 +1320,7 @@ describe('update()', () => { interval: '10s', name: 'abc', tags: ['foo'], - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1335,26 +1335,26 @@ describe('update()', () => { }, }); expect(result).toMatchInlineSnapshot(` - Object { - "actions": Array [ - Object { - "group": "default", - "id": "1", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeParams": Object { - "bar": true, - }, - "apiKey": "MTIzOmFiYw==", - "enabled": true, - "id": "1", - "interval": "10s", - "scheduledTaskId": "task-123", - } - `); + Object { + "actions": Array [ + Object { + "group": "default", + "id": "1", + "params": Object { + "foo": true, + }, + }, + ], + "apiKey": "MTIzOmFiYw==", + "enabled": true, + "id": "1", + "interval": "10s", + "params": Object { + "bar": true, + }, + "scheduledTaskId": "task-123", + } + `); expect(savedObjectsClient.update).toHaveBeenCalledTimes(1); expect(savedObjectsClient.update.mock.calls[0]).toHaveLength(4); expect(savedObjectsClient.update.mock.calls[0][0]).toEqual('alert'); @@ -1371,14 +1371,14 @@ describe('update()', () => { }, ], "alertTypeId": "123", - "alertTypeParams": Object { - "bar": true, - }, "apiKey": "MTIzOmFiYw==", "apiKeyOwner": "elastic", "enabled": true, "interval": "10s", "name": "abc", + "params": Object { + "bar": true, + }, "scheduledTaskId": "task-123", "tags": Array [ "foo", @@ -1400,7 +1400,7 @@ describe('update()', () => { `); }); - it('should validate alertTypeParams', async () => { + it('should validate params', async () => { const alertsClient = new AlertsClient(alertsClientParams); alertTypeRegistry.get.mockReturnValueOnce({ id: '123', @@ -1428,7 +1428,7 @@ describe('update()', () => { interval: '10s', name: 'abc', tags: ['foo'], - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -1443,7 +1443,7 @@ describe('update()', () => { }, }) ).rejects.toThrowErrorMatchingInlineSnapshot( - `"alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]"` + `"params invalid: [param1]: expected value of type [string] but got [undefined]"` ); }); }); diff --git a/x-pack/legacy/plugins/alerting/server/alerts_client.ts b/x-pack/legacy/plugins/alerting/server/alerts_client.ts index c260a754e45940..3916ec1d62b6c3 100644 --- a/x-pack/legacy/plugins/alerting/server/alerts_client.ts +++ b/x-pack/legacy/plugins/alerting/server/alerts_client.ts @@ -77,7 +77,7 @@ interface UpdateOptions { tags: string[]; interval: string; actions: AlertAction[]; - alertTypeParams: Record; + params: Record; }; } @@ -111,7 +111,7 @@ export class AlertsClient { public async create({ data, options }: CreateOptions) { // Throws an error if alert type isn't registered const alertType = this.alertTypeRegistry.get(data.alertTypeId); - const validatedAlertTypeParams = validateAlertTypeParams(alertType, data.alertTypeParams); + const validatedAlertTypeParams = validateAlertTypeParams(alertType, data.params); const apiKey = await this.createAPIKey(); const username = await this.getUserName(); @@ -125,7 +125,7 @@ export class AlertsClient { apiKey: apiKey.created ? Buffer.from(`${apiKey.result.id}:${apiKey.result.api_key}`).toString('base64') : undefined, - alertTypeParams: validatedAlertTypeParams, + params: validatedAlertTypeParams, muteAll: false, mutedInstanceIds: [], }); @@ -199,7 +199,7 @@ export class AlertsClient { const apiKey = await this.createAPIKey(); // Validate - const validatedAlertTypeParams = validateAlertTypeParams(alertType, data.alertTypeParams); + const validatedAlertTypeParams = validateAlertTypeParams(alertType, data.params); this.validateActions(alertType, data.actions); const { actions, references } = this.extractReferences(data.actions); @@ -210,7 +210,7 @@ export class AlertsClient { { ...attributes, ...data, - alertTypeParams: validatedAlertTypeParams, + params: validatedAlertTypeParams, actions, updatedBy: username, apiKeyOwner: apiKey.created ? username : null, diff --git a/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.test.ts b/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.test.ts index dcc74ed9488cea..1d91d4a35d5889 100644 --- a/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.test.ts +++ b/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.test.ts @@ -76,7 +76,7 @@ const mockedAlertTypeSavedObject = { alertTypeId: '123', interval: '10s', mutedInstanceIds: [], - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -253,7 +253,7 @@ test('validates params before executing the alert type', async () => { references: [], }); await expect(taskRunner.run()).rejects.toThrowErrorMatchingInlineSnapshot( - `"alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]"` + `"params invalid: [param1]: expected value of type [string] but got [undefined]"` ); }); diff --git a/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.ts b/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.ts index 66d445f57fe73e..051b15fc8dd8f7 100644 --- a/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.ts +++ b/x-pack/legacy/plugins/alerting/server/lib/task_runner_factory.ts @@ -94,12 +94,12 @@ export class TaskRunnerFactory { const services = getServices(fakeRequest); // Ensure API key is still valid and user has access const { - attributes: { alertTypeParams, actions, interval, throttle, muteAll, mutedInstanceIds }, + attributes: { params, actions, interval, throttle, muteAll, mutedInstanceIds }, references, } = await services.savedObjectsClient.get('alert', alertId); // Validate - const validatedAlertTypeParams = validateAlertTypeParams(alertType, alertTypeParams); + const validatedAlertTypeParams = validateAlertTypeParams(alertType, params); // Inject ids into actions const actionsWithIds = actions.map(action => { diff --git a/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.test.ts b/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.test.ts index f33746798769b6..e9a61354001f12 100644 --- a/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.test.ts +++ b/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.test.ts @@ -61,6 +61,6 @@ test('should validate and throw error when params is invalid', () => { {} ) ).toThrowErrorMatchingInlineSnapshot( - `"alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]"` + `"params invalid: [param1]: expected value of type [string] but got [undefined]"` ); }); diff --git a/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.ts b/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.ts index 6070f2d99b6056..248d896c06ac2d 100644 --- a/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.ts +++ b/x-pack/legacy/plugins/alerting/server/lib/validate_alert_type_params.ts @@ -19,6 +19,6 @@ export function validateAlertTypeParams>( try { return validator.validate(params); } catch (err) { - throw Boom.badRequest(`alertTypeParams invalid: ${err.message}`); + throw Boom.badRequest(`params invalid: ${err.message}`); } } diff --git a/x-pack/legacy/plugins/alerting/server/routes/create.test.ts b/x-pack/legacy/plugins/alerting/server/routes/create.test.ts index c67d1a7b323524..318dbdf068d6a9 100644 --- a/x-pack/legacy/plugins/alerting/server/routes/create.test.ts +++ b/x-pack/legacy/plugins/alerting/server/routes/create.test.ts @@ -15,7 +15,7 @@ const mockedAlert = { name: 'abc', interval: '10s', tags: ['foo'], - alertTypeParams: { + params: { bar: true, }, actions: [ @@ -57,12 +57,12 @@ test('creates an alert with proper parameters', async () => { }, ], "alertTypeId": "1", - "alertTypeParams": Object { - "bar": true, - }, "id": "123", "interval": "10s", "name": "abc", + "params": Object { + "bar": true, + }, "tags": Array [ "foo", ], @@ -83,12 +83,12 @@ test('creates an alert with proper parameters', async () => { }, ], "alertTypeId": "1", - "alertTypeParams": Object { - "bar": true, - }, "enabled": true, "interval": "10s", "name": "abc", + "params": Object { + "bar": true, + }, "tags": Array [ "foo", ], @@ -112,12 +112,12 @@ test('creates an alert with proper parameters', async () => { }, ], "alertTypeId": "1", - "alertTypeParams": Object { - "bar": true, - }, "enabled": true, "interval": "10s", "name": "abc", + "params": Object { + "bar": true, + }, "tags": Array [ "foo", ], diff --git a/x-pack/legacy/plugins/alerting/server/routes/create.ts b/x-pack/legacy/plugins/alerting/server/routes/create.ts index 65fbae7c8b2985..fb82a03f172b3b 100644 --- a/x-pack/legacy/plugins/alerting/server/routes/create.ts +++ b/x-pack/legacy/plugins/alerting/server/routes/create.ts @@ -17,7 +17,7 @@ interface ScheduleRequest extends Hapi.Request { alertTypeId: string; interval: string; actions: AlertAction[]; - alertTypeParams: Record; + params: Record; throttle: string | null; }; } @@ -41,7 +41,7 @@ export const createAlertRoute = { alertTypeId: Joi.string().required(), throttle: getDurationSchema().default(null), interval: getDurationSchema().required(), - alertTypeParams: Joi.object().required(), + params: Joi.object().required(), actions: Joi.array() .items( Joi.object().keys({ diff --git a/x-pack/legacy/plugins/alerting/server/routes/get.test.ts b/x-pack/legacy/plugins/alerting/server/routes/get.test.ts index 84938a0e927d13..19618bc9e39feb 100644 --- a/x-pack/legacy/plugins/alerting/server/routes/get.test.ts +++ b/x-pack/legacy/plugins/alerting/server/routes/get.test.ts @@ -14,7 +14,7 @@ const mockedAlert = { id: '1', alertTypeId: '1', interval: '10s', - alertTypeParams: { + params: { bar: true, }, actions: [ diff --git a/x-pack/legacy/plugins/alerting/server/routes/update.test.ts b/x-pack/legacy/plugins/alerting/server/routes/update.test.ts index ee98f7d6dd9d30..7fc3f459110107 100644 --- a/x-pack/legacy/plugins/alerting/server/routes/update.test.ts +++ b/x-pack/legacy/plugins/alerting/server/routes/update.test.ts @@ -17,7 +17,7 @@ const mockedResponse = { alertTypeId: '1', tags: ['foo'], interval: '12s', - alertTypeParams: { + params: { otherField: false, }, actions: [ @@ -40,7 +40,7 @@ test('calls the update function with proper parameters', async () => { name: 'abc', tags: ['bar'], interval: '12s', - alertTypeParams: { + params: { otherField: false, }, actions: [ @@ -74,11 +74,11 @@ test('calls the update function with proper parameters', async () => { }, }, ], - "alertTypeParams": Object { - "otherField": false, - }, "interval": "12s", "name": "abc", + "params": Object { + "otherField": false, + }, "tags": Array [ "bar", ], diff --git a/x-pack/legacy/plugins/alerting/server/routes/update.ts b/x-pack/legacy/plugins/alerting/server/routes/update.ts index 9c8e0296c2f78e..6aeedb93a10985 100644 --- a/x-pack/legacy/plugins/alerting/server/routes/update.ts +++ b/x-pack/legacy/plugins/alerting/server/routes/update.ts @@ -19,7 +19,7 @@ interface UpdateRequest extends Hapi.Request { tags: string[]; interval: string; actions: AlertAction[]; - alertTypeParams: Record; + params: Record; throttle: string | null; }; } @@ -43,7 +43,7 @@ export const updateAlertRoute = { .items(Joi.string()) .required(), interval: getDurationSchema().required(), - alertTypeParams: Joi.object().required(), + params: Joi.object().required(), actions: Joi.array() .items( Joi.object().keys({ diff --git a/x-pack/legacy/plugins/alerting/server/types.ts b/x-pack/legacy/plugins/alerting/server/types.ts index 359b88e21cc3b0..e2460c549c05db 100644 --- a/x-pack/legacy/plugins/alerting/server/types.ts +++ b/x-pack/legacy/plugins/alerting/server/types.ts @@ -65,7 +65,7 @@ export interface Alert { alertTypeId: string; interval: string; actions: AlertAction[]; - alertTypeParams: Record; + params: Record; scheduledTaskId?: string; createdBy: string | null; updatedBy: string | null; @@ -83,7 +83,7 @@ export interface RawAlert extends SavedObjectAttributes { alertTypeId: string; interval: string; actions: RawAlertAction[]; - alertTypeParams: SavedObjectAttributes; + params: SavedObjectAttributes; scheduledTaskId?: string; createdBy: string | null; updatedBy: string | null; diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts index 38684cb22e237f..378e32cb3582ca 100644 --- a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts +++ b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts @@ -5,3 +5,4 @@ */ export * from './results'; +export * from './validation'; diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/index.ts b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/index.ts new file mode 100644 index 00000000000000..727faca69298ee --- /dev/null +++ b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './indices'; diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/indices.ts b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/indices.ts new file mode 100644 index 00000000000000..62d81dc1368538 --- /dev/null +++ b/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/indices.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as rt from 'io-ts'; + +export const LOG_ANALYSIS_VALIDATION_INDICES_PATH = '/api/infra/log_analysis/validation/indices'; + +/** + * Request types + */ +export const validationIndicesRequestPayloadRT = rt.type({ + data: rt.type({ + timestampField: rt.string, + indices: rt.array(rt.string), + }), +}); + +export type ValidationIndicesRequestPayload = rt.TypeOf; + +/** + * Response types + * */ +export const validationIndicesErrorRT = rt.union([ + rt.type({ + error: rt.literal('INDEX_NOT_FOUND'), + index: rt.string, + }), + rt.type({ + error: rt.literal('FIELD_NOT_FOUND'), + index: rt.string, + field: rt.string, + }), + rt.type({ + error: rt.literal('FIELD_NOT_VALID'), + index: rt.string, + field: rt.string, + }), +]); + +export type ValidationIndicesError = rt.TypeOf; + +export const validationIndicesResponsePayloadRT = rt.type({ + data: rt.type({ + errors: rt.array(validationIndicesErrorRT), + }), +}); + +export type ValidationIndicesResponsePayload = rt.TypeOf; diff --git a/x-pack/legacy/plugins/infra/package.json b/x-pack/legacy/plugins/infra/package.json index 63812bb2da5132..7aa8cb9b5269a2 100644 --- a/x-pack/legacy/plugins/infra/package.json +++ b/x-pack/legacy/plugins/infra/package.json @@ -16,4 +16,4 @@ "boom": "7.3.0", "lodash": "^4.17.15" } -} \ No newline at end of file +} diff --git a/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx b/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx index a99b265fc3ea96..5df1fc07e83b99 100644 --- a/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx +++ b/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx @@ -40,4 +40,5 @@ const OverlayDiv = euiStyled.div` position: absolute; top: 0; width: 100%; + z-index: ${props => props.theme.eui.euiZLevel1}; `; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/index_patterns_validate.ts b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/index_patterns_validate.ts new file mode 100644 index 00000000000000..440ee10e4223da --- /dev/null +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/index_patterns_validate.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { fold } from 'fp-ts/lib/Either'; +import { pipe } from 'fp-ts/lib/pipeable'; +import { identity } from 'fp-ts/lib/function'; +import { kfetch } from 'ui/kfetch'; + +import { + LOG_ANALYSIS_VALIDATION_INDICES_PATH, + validationIndicesRequestPayloadRT, + validationIndicesResponsePayloadRT, +} from '../../../../../common/http_api'; + +import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; + +export const callIndexPatternsValidate = async (timestampField: string, indices: string[]) => { + const response = await kfetch({ + method: 'POST', + pathname: LOG_ANALYSIS_VALIDATION_INDICES_PATH, + body: JSON.stringify( + validationIndicesRequestPayloadRT.encode({ data: { timestampField, indices } }) + ), + }); + + return pipe( + validationIndicesResponsePayloadRT.decode(response), + fold(throwErrors(createPlainError), identity) + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_jobs.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_jobs.tsx index 163f0e39d1228b..0f386f416b866c 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_jobs.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_jobs.tsx @@ -94,8 +94,8 @@ export const useLogAnalysisJobs = ({ dispatch({ type: 'fetchingJobStatuses' }); return await callJobsSummaryAPI(spaceId, sourceId); }, - onResolve: response => { - dispatch({ type: 'fetchedJobStatuses', payload: response, spaceId, sourceId }); + onResolve: jobResponse => { + dispatch({ type: 'fetchedJobStatuses', payload: jobResponse, spaceId, sourceId }); }, onReject: err => { dispatch({ type: 'failedFetchingJobStatuses' }); @@ -158,6 +158,7 @@ export const useLogAnalysisJobs = ({ setup: setupMlModule, setupMlModuleRequest, setupStatus: statusState.setupStatus, + timestampField: timeField, viewSetupForReconfiguration, viewSetupForUpdate, viewResults, diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx index 79426570184553..c965c50bedcccc 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx @@ -4,9 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { useState, useCallback, useMemo } from 'react'; +import { useState, useCallback, useMemo, useEffect } from 'react'; import { isExampleDataIndex } from '../../../../common/log_analysis'; +import { + ValidationIndicesError, + ValidationIndicesResponsePayload, +} from '../../../../common/http_api'; +import { useTrackedPromise } from '../../../utils/use_tracked_promise'; +import { callIndexPatternsValidate } from './api/index_patterns_validate'; type SetupHandler = ( indices: string[], @@ -14,42 +20,75 @@ type SetupHandler = ( endTime: number | undefined ) => void; +export type ValidationIndicesUIError = + | ValidationIndicesError + | { error: 'NETWORK_ERROR' } + | { error: 'TOO_FEW_SELECTED_INDICES' }; + +export interface ValidatedIndex { + index: string; + errors: ValidationIndicesError[]; + isSelected: boolean; +} + interface AnalysisSetupStateArguments { availableIndices: string[]; cleanupAndSetupModule: SetupHandler; setupModule: SetupHandler; + timestampField: string; } -type IndicesSelection = Record; - -type ValidationErrors = 'TOO_FEW_SELECTED_INDICES'; - const fourWeeksInMs = 86400000 * 7 * 4; export const useAnalysisSetupState = ({ availableIndices, cleanupAndSetupModule, setupModule, + timestampField, }: AnalysisSetupStateArguments) => { const [startTime, setStartTime] = useState(Date.now() - fourWeeksInMs); const [endTime, setEndTime] = useState(undefined); - const [selectedIndices, setSelectedIndices] = useState( - availableIndices.reduce( - (indexMap, indexName) => ({ - ...indexMap, - [indexName]: !(availableIndices.length > 1 && isExampleDataIndex(indexName)), - }), - {} - ) + // Prepare the validation + const [validatedIndices, setValidatedIndices] = useState( + availableIndices.map(index => ({ + index, + errors: [], + isSelected: false, + })) + ); + const [validateIndicesRequest, validateIndices] = useTrackedPromise( + { + cancelPreviousOn: 'resolution', + createPromise: async () => { + return await callIndexPatternsValidate(timestampField, availableIndices); + }, + onResolve: ({ data }: ValidationIndicesResponsePayload) => { + setValidatedIndices( + availableIndices.map(index => { + const errors = data.errors.filter(error => error.index === index); + return { + index, + errors, + isSelected: errors.length === 0 && !isExampleDataIndex(index), + }; + }) + ); + }, + onReject: () => { + setValidatedIndices([]); + }, + }, + [availableIndices, timestampField] ); + useEffect(() => { + validateIndices(); + }, [validateIndices]); + const selectedIndexNames = useMemo( - () => - Object.entries(selectedIndices) - .filter(([_indexName, isSelected]) => isSelected) - .map(([indexName]) => indexName), - [selectedIndices] + () => validatedIndices.filter(i => i.isSelected).map(i => i.index), + [validatedIndices] ); const setup = useCallback(() => { @@ -60,24 +99,42 @@ export const useAnalysisSetupState = ({ return cleanupAndSetupModule(selectedIndexNames, startTime, endTime); }, [cleanupAndSetupModule, selectedIndexNames, startTime, endTime]); - const validationErrors: ValidationErrors[] = useMemo( + const isValidating = useMemo( () => - Object.values(selectedIndices).some(isSelected => isSelected) - ? [] - : ['TOO_FEW_SELECTED_INDICES' as const], - [selectedIndices] + validateIndicesRequest.state === 'pending' || + validateIndicesRequest.state === 'uninitialized', + [validateIndicesRequest.state] ); + const validationErrors = useMemo(() => { + if (isValidating) { + return []; + } + + if (validateIndicesRequest.state === 'rejected') { + return [{ error: 'NETWORK_ERROR' }]; + } + + if (selectedIndexNames.length === 0) { + return [{ error: 'TOO_FEW_SELECTED_INDICES' }]; + } + + return validatedIndices.reduce((errors, index) => { + return selectedIndexNames.includes(index.index) ? errors.concat(index.errors) : errors; + }, []); + }, [selectedIndexNames, validatedIndices, validateIndicesRequest.state]); + return { cleanupAndSetup, endTime, + isValidating, selectedIndexNames, - selectedIndices, setEndTime, - setSelectedIndices, setStartTime, setup, startTime, + validatedIndices, + setValidatedIndices, validationErrors, }; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_content.tsx index 04d7520c0ca88d..f0a26eae25ecb5 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_content.tsx @@ -27,6 +27,7 @@ export const AnalysisPageContent = () => { lastSetupErrorMessages, setup, setupStatus, + timestampField, viewResults, } = useContext(LogAnalysisJobs.Context); @@ -61,6 +62,7 @@ export const AnalysisPageContent = () => { errorMessages={lastSetupErrorMessages} setup={setup} setupStatus={setupStatus} + timestampField={timestampField} viewResults={viewResults} /> ); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_setup_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_setup_content.tsx index 097cccf5dca338..7ae174c4a78993 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_setup_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/page_setup_content.tsx @@ -34,6 +34,7 @@ interface AnalysisSetupContentProps { errorMessages: string[]; setup: SetupHandler; setupStatus: SetupStatus; + timestampField: string; viewResults: () => void; } @@ -43,6 +44,7 @@ export const AnalysisSetupContent: React.FunctionComponent { useTrackPageview({ app: 'infra_logs', path: 'analysis_setup' }); @@ -82,6 +84,7 @@ export const AnalysisSetupContent: React.FunctionComponent diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/analysis_setup_indices_form.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/analysis_setup_indices_form.tsx index defcefd69a7ab8..585a65b9ad1c8b 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/analysis_setup_indices_form.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/analysis_setup_indices_form.tsx @@ -4,37 +4,58 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiCheckboxGroup, EuiCode, EuiDescribedFormGroup, EuiFormRow } from '@elastic/eui'; +import { EuiCode, EuiDescribedFormGroup, EuiFormRow, EuiCheckbox, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useCallback, useMemo } from 'react'; - -export type IndicesSelection = Record; - -export type IndicesValidationError = 'TOO_FEW_SELECTED_INDICES'; +import { + ValidatedIndex, + ValidationIndicesUIError, +} from '../../../../../containers/logs/log_analysis/log_analysis_setup_state'; +import { LoadingOverlayWrapper } from '../../../../../components/loading_overlay_wrapper'; export const AnalysisSetupIndicesForm: React.FunctionComponent<{ - indices: IndicesSelection; - onChangeSelectedIndices: (selectedIndices: IndicesSelection) => void; - validationErrors?: IndicesValidationError[]; -}> = ({ indices, onChangeSelectedIndices, validationErrors = [] }) => { + indices: ValidatedIndex[]; + isValidating: boolean; + onChangeSelectedIndices: (selectedIndices: ValidatedIndex[]) => void; + valid: boolean; +}> = ({ indices, isValidating, onChangeSelectedIndices, valid }) => { + const handleCheckboxChange = useCallback( + (event: React.ChangeEvent) => { + onChangeSelectedIndices( + indices.map(index => { + const checkbox = event.currentTarget; + return index.index === checkbox.id ? { ...index, isSelected: checkbox.checked } : index; + }) + ); + }, + [indices, onChangeSelectedIndices] + ); + const choices = useMemo( () => - Object.keys(indices).map(indexName => ({ - id: indexName, - label: {indexName}, - })), - [indices] - ); + indices.map(index => { + const validIndex = index.errors.length === 0; + const checkbox = ( + {index.index}} + onChange={handleCheckboxChange} + checked={index.isSelected} + disabled={!validIndex} + /> + ); - const handleCheckboxGroupChange = useCallback( - indexName => { - onChangeSelectedIndices({ - ...indices, - [indexName]: !indices[indexName], - }); - }, - [indices, onChangeSelectedIndices] + return validIndex ? ( + checkbox + ) : ( +
+ {checkbox} +
+ ); + }), + [indices] ); return ( @@ -53,20 +74,17 @@ export const AnalysisSetupIndicesForm: React.FunctionComponent<{ /> } > - 0} - label={indicesSelectionLabel} - labelType="legend" - > - - + + + <>{choices} + + ); }; @@ -75,14 +93,50 @@ const indicesSelectionLabel = i18n.translate('xpack.infra.analysisSetup.indicesS defaultMessage: 'Indices', }); -const formatValidationError = (validationError: IndicesValidationError) => { - switch (validationError) { - case 'TOO_FEW_SELECTED_INDICES': - return i18n.translate( - 'xpack.infra.analysisSetup.indicesSelectionTooFewSelectedIndicesDescription', - { - defaultMessage: 'Select at least one index name.', - } - ); - } +const formatValidationError = (errors: ValidationIndicesUIError[]): React.ReactNode => { + return errors.map(error => { + switch (error.error) { + case 'INDEX_NOT_FOUND': + return ( +

+ {error.index} }} + /> +

+ ); + + case 'FIELD_NOT_FOUND': + return ( +

+ {error.index}, + field: {error.field}, + }} + /> +

+ ); + + case 'FIELD_NOT_VALID': + return ( +

+ {error.index}, + field: {error.field}, + }} + /> +

+ ); + + default: + return ''; + } + }); }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/initial_configuration_step.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/initial_configuration_step.tsx index 929fba26f23235..3b5497fb918649 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/initial_configuration_step.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/initial_configuration_step/initial_configuration_step.tsx @@ -4,24 +4,27 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiSpacer, EuiForm } from '@elastic/eui'; -import React, { useMemo } from 'react'; +import { EuiSpacer, EuiForm, EuiCallOut } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import React from 'react'; -import { - AnalysisSetupIndicesForm, - IndicesSelection, - IndicesValidationError, -} from './analysis_setup_indices_form'; +import { AnalysisSetupIndicesForm } from './analysis_setup_indices_form'; import { AnalysisSetupTimerangeForm } from './analysis_setup_timerange_form'; +import { + ValidatedIndex, + ValidationIndicesUIError, +} from '../../../../../containers/logs/log_analysis/log_analysis_setup_state'; interface InitialConfigurationStepProps { setStartTime: (startTime: number | undefined) => void; setEndTime: (endTime: number | undefined) => void; startTime: number | undefined; endTime: number | undefined; - selectedIndices: IndicesSelection; - setSelectedIndices: (selectedIndices: IndicesSelection) => void; - validationErrors?: IndicesValidationError[]; + isValidating: boolean; + validatedIndices: ValidatedIndex[]; + setValidatedIndices: (selectedIndices: ValidatedIndex[]) => void; + validationErrors?: ValidationIndicesUIError[]; } export const InitialConfigurationStep: React.FunctionComponent = ({ @@ -29,16 +32,11 @@ export const InitialConfigurationStep: React.FunctionComponent { - const indicesFormValidationErrors = useMemo( - () => - validationErrors.filter(validationError => validationError === 'TOO_FEW_SELECTED_INDICES'), - [validationErrors] - ); - return ( <> @@ -50,11 +48,63 @@ export const InitialConfigurationStep: React.FunctionComponent + + ); }; + +const errorCalloutTitle = i18n.translate( + 'xpack.infra.analysisSetup.steps.initialConfigurationStep.errorCalloutTitle', + { + defaultMessage: 'Your index configuration is not valid', + } +); + +const ValidationErrors: React.FC<{ errors: ValidationIndicesUIError[] }> = ({ errors }) => { + if (errors.length === 0) { + return null; + } + + return ( + <> + +
    + {errors.map((error, i) => ( +
  • {formatValidationError(error)}
  • + ))} +
+
+ + + ); +}; + +const formatValidationError = (error: ValidationIndicesUIError): React.ReactNode => { + switch (error.error) { + case 'NETWORK_ERROR': + return ( + + ); + + case 'TOO_FEW_SELECTED_INDICES': + return ( + + ); + + default: + return ''; + } +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/process_step/process_step.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/process_step/process_step.tsx index 27fc8a83bc086b..978e45e26b7333 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/process_step/process_step.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/process_step/process_step.tsx @@ -60,8 +60,8 @@ export const ProcessStep: React.FunctionComponent = ({ defaultMessage="Something went wrong creating the necessary ML jobs. Please ensure all selected log indices exist." /> - {errorMessages.map(errorMessage => ( - + {errorMessages.map((errorMessage, i) => ( + {errorMessage} ))} diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/setup_steps.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/setup_steps.tsx index aebb44d4c93729..4643516e73fac6 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/setup_steps.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/setup/setup_steps.tsx @@ -25,6 +25,7 @@ interface AnalysisSetupStepsProps { errorMessages: string[]; setup: SetupHandler; setupStatus: SetupStatus; + timestampField: string; viewResults: () => void; } @@ -34,6 +35,7 @@ export const AnalysisSetupSteps: React.FunctionComponent { const { @@ -43,13 +45,15 @@ export const AnalysisSetupSteps: React.FunctionComponent ), diff --git a/x-pack/legacy/plugins/infra/server/infra_server.ts b/x-pack/legacy/plugins/infra/server/infra_server.ts index 98536f4c85d36f..0093a6c21af570 100644 --- a/x-pack/legacy/plugins/infra/server/infra_server.ts +++ b/x-pack/legacy/plugins/infra/server/infra_server.ts @@ -13,7 +13,10 @@ import { createSnapshotResolvers } from './graphql/snapshot'; import { createSourceStatusResolvers } from './graphql/source_status'; import { createSourcesResolvers } from './graphql/sources'; import { InfraBackendLibs } from './lib/infra_types'; -import { initLogAnalysisGetLogEntryRateRoute } from './routes/log_analysis'; +import { + initLogAnalysisGetLogEntryRateRoute, + initIndexPatternsValidateRoute, +} from './routes/log_analysis'; import { initMetricExplorerRoute } from './routes/metrics_explorer'; import { initMetadataRoute } from './routes/metadata'; @@ -33,6 +36,7 @@ export const initInfraServer = (libs: InfraBackendLibs) => { initIpToHostName(libs); initLogAnalysisGetLogEntryRateRoute(libs); + initIndexPatternsValidateRoute(libs); initMetricExplorerRoute(libs); initMetadataRoute(libs); }; diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts index f0d26e5f5869f3..63fded49d8222b 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -45,7 +45,12 @@ export interface InfraBackendFrameworkAdapter { ): Promise; callWithRequest( req: InfraFrameworkRequest, - method: 'indices.getAlias' | 'indices.get', + method: 'indices.getAlias', + options?: object + ): Promise; + callWithRequest( + req: InfraFrameworkRequest, + method: 'indices.get', options?: object ): Promise; callWithRequest( @@ -137,14 +142,32 @@ export interface InfraDatabaseMultiResponse extends InfraDatab } export interface InfraDatabaseFieldCapsResponse extends InfraDatabaseResponse { + indices: string[]; fields: InfraFieldsResponse; } +export interface InfraDatabaseGetIndicesAliasResponse { + [indexName: string]: { + aliases: { + [aliasName: string]: any; + }; + }; +} + export interface InfraDatabaseGetIndicesResponse { [indexName: string]: { aliases: { [aliasName: string]: any; }; + mappings: { + _meta: object; + dynamic_templates: any[]; + date_detection: boolean; + properties: { + [fieldName: string]: any; + }; + }; + settings: { index: object }; }; } diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts index 38684cb22e237f..7364d167efe474 100644 --- a/x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts +++ b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts @@ -5,3 +5,4 @@ */ export * from './results'; +export * from './index_patterns'; diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/index.ts b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/index.ts new file mode 100644 index 00000000000000..a85e119e7318aa --- /dev/null +++ b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './validate'; diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/validate.ts b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/validate.ts new file mode 100644 index 00000000000000..0a369adb7ca293 --- /dev/null +++ b/x-pack/legacy/plugins/infra/server/routes/log_analysis/index_patterns/validate.ts @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import Boom from 'boom'; + +import { pipe } from 'fp-ts/lib/pipeable'; +import { fold } from 'fp-ts/lib/Either'; +import { identity } from 'fp-ts/lib/function'; + +import { InfraBackendLibs } from '../../../lib/infra_types'; +import { + LOG_ANALYSIS_VALIDATION_INDICES_PATH, + validationIndicesRequestPayloadRT, + validationIndicesResponsePayloadRT, + ValidationIndicesError, +} from '../../../../common/http_api'; + +import { throwErrors } from '../../../../common/runtime_types'; + +const partitionField = 'event.dataset'; + +export const initIndexPatternsValidateRoute = ({ framework }: InfraBackendLibs) => { + framework.registerRoute({ + method: 'POST', + path: LOG_ANALYSIS_VALIDATION_INDICES_PATH, + handler: async (req, res) => { + const payload = pipe( + validationIndicesRequestPayloadRT.decode(req.payload), + fold(throwErrors(Boom.badRequest), identity) + ); + + const { timestampField, indices } = payload.data; + const errors: ValidationIndicesError[] = []; + + // Query each pattern individually, to map correctly the errors + await Promise.all( + indices.map(async index => { + const fieldCaps = await framework.callWithRequest(req, 'fieldCaps', { + index, + fields: `${timestampField},${partitionField}`, + }); + + if (fieldCaps.indices.length === 0) { + errors.push({ + error: 'INDEX_NOT_FOUND', + index, + }); + return; + } + + ([ + [timestampField, 'date'], + [partitionField, 'keyword'], + ] as const).forEach(([field, fieldType]) => { + const fieldMetadata = fieldCaps.fields[field]; + + if (fieldMetadata === undefined) { + errors.push({ + error: 'FIELD_NOT_FOUND', + index, + field, + }); + } else { + const fieldTypes = Object.keys(fieldMetadata); + + if (fieldTypes.length > 1 || fieldTypes[0] !== fieldType) { + errors.push({ + error: `FIELD_NOT_VALID`, + index, + field, + }); + } + } + }); + }) + ); + + return res.response(validationIndicesResponsePayloadRT.encode({ data: { errors } })); + }, + }); +}; diff --git a/x-pack/legacy/plugins/maps/public/components/__snapshots__/add_tooltip_field_popover.test.js.snap b/x-pack/legacy/plugins/maps/public/components/__snapshots__/add_tooltip_field_popover.test.js.snap index 968915905cd318..f37dfdd879c5bf 100644 --- a/x-pack/legacy/plugins/maps/public/components/__snapshots__/add_tooltip_field_popover.test.js.snap +++ b/x-pack/legacy/plugins/maps/public/components/__snapshots__/add_tooltip_field_popover.test.js.snap @@ -22,7 +22,7 @@ exports[`Should remove selected fields from selectable 1`] = ` hasArrow={true} id="addTooltipFieldPopover" isOpen={false} - ownFocus={false} + ownFocus={true} panelPaddingSize="m" > {this._renderContent()} diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js index 20520ad3ff8f1c..0086c5067ba123 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/filter_editor/filter_editor.js @@ -90,6 +90,7 @@ export class FilterEditor extends Component { isOpen={this.state.isPopoverOpen} closePopover={this._close} anchorPosition="leftCenter" + ownFocus >
{ publicDir: resolve(__dirname, 'public'), uiExports: { - managementSections: ['plugins/ml/management'], + managementSections: ['plugins/ml/application/management'], app: { title: i18n.translate('xpack.ml.mlNavTitle', { defaultMessage: 'Machine Learning', @@ -36,12 +36,12 @@ export const ml = (kibana: any) => { description: i18n.translate('xpack.ml.mlNavDescription', { defaultMessage: 'Machine Learning for the Elastic Stack', }), - icon: 'plugins/ml/ml.svg', + icon: 'plugins/ml/application/ml.svg', euiIconType: 'machineLearningApp', - main: 'plugins/ml/app', + main: 'plugins/ml/application/app', }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), - hacks: ['plugins/ml/hacks/toggle_app_link_in_nav'], + hacks: ['plugins/ml/application/hacks/toggle_app_link_in_nav'], savedObjectSchemas: { 'ml-telemetry': { isNamespaceAgnostic: true, diff --git a/x-pack/legacy/plugins/ml/public/_app.scss b/x-pack/legacy/plugins/ml/public/application/_app.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/_app.scss rename to x-pack/legacy/plugins/ml/public/application/_app.scss diff --git a/x-pack/legacy/plugins/ml/public/_hacks.scss b/x-pack/legacy/plugins/ml/public/application/_hacks.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/_hacks.scss rename to x-pack/legacy/plugins/ml/public/application/_hacks.scss diff --git a/x-pack/legacy/plugins/ml/public/_variables.scss b/x-pack/legacy/plugins/ml/public/application/_variables.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/_variables.scss rename to x-pack/legacy/plugins/ml/public/application/_variables.scss diff --git a/x-pack/legacy/plugins/ml/public/access_denied/index.tsx b/x-pack/legacy/plugins/ml/public/application/access_denied/index.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/access_denied/index.tsx rename to x-pack/legacy/plugins/ml/public/application/access_denied/index.tsx diff --git a/x-pack/legacy/plugins/ml/public/access_denied/page.tsx b/x-pack/legacy/plugins/ml/public/application/access_denied/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/access_denied/page.tsx rename to x-pack/legacy/plugins/ml/public/application/access_denied/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/app.js b/x-pack/legacy/plugins/ml/public/application/app.js similarity index 56% rename from x-pack/legacy/plugins/ml/public/app.js rename to x-pack/legacy/plugins/ml/public/application/app.js index ead1af5f64e07f..722e2c8d05e9b9 100644 --- a/x-pack/legacy/plugins/ml/public/app.js +++ b/x-pack/legacy/plugins/ml/public/application/app.js @@ -12,17 +12,17 @@ import 'ui/autoload/all'; // needed to make syntax highlighting work in ace editors import 'ace'; -import 'plugins/ml/access_denied'; -import 'plugins/ml/jobs'; -import 'plugins/ml/overview'; -import 'plugins/ml/services/calendar_service'; -import 'plugins/ml/data_frame_analytics'; -import 'plugins/ml/datavisualizer'; -import 'plugins/ml/explorer'; -import 'plugins/ml/timeseriesexplorer'; -import 'plugins/ml/components/navigation_menu'; -import 'plugins/ml/components/loading_indicator'; -import 'plugins/ml/settings'; +import './access_denied'; +import './jobs'; +import './overview'; +import './services/calendar_service'; +import './data_frame_analytics'; +import './datavisualizer'; +import './explorer'; +import './timeseriesexplorer'; +import './components/navigation_menu'; +import './components/loading_indicator'; +import './settings'; import uiRoutes from 'ui/routes'; diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/__snapshots__/index.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/__snapshots__/index.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/__snapshots__/index.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/index.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/index.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/index.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/index.tsx b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/index.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/index.tsx rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/index.tsx index 52224e5fc3fb6e..3d98e2d66935c1 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_description_list/index.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_description_list/index.tsx @@ -14,7 +14,7 @@ import React from 'react'; import { EuiDescriptionList } from '@elastic/eui'; import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; -import { Annotation } from '../../../../common/types/annotations'; +import { Annotation } from '../../../../../common/types/annotations'; import { formatHumanReadableDateTimeSeconds } from '../../../util/date_utils'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/__snapshots__/index.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/__snapshots__/index.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/__snapshots__/index.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx index 871dcd74d0907e..7fa47f3518b81b 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx @@ -10,7 +10,7 @@ import mockAnnotations from '../annotations_table/__mocks__/mock_annotations.jso import React, { ComponentType } from 'react'; import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers'; -import { Annotation } from '../../../../common/types/annotations'; +import { Annotation } from '../../../../../common/types/annotations'; import { annotation$ } from '../../../services/annotations_service'; import { AnnotationFlyout } from './index'; diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.tsx b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.tsx rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx index 586e503632eb92..84c16360795ea5 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotation_flyout/index.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx @@ -26,7 +26,7 @@ import { CommonProps } from '@elastic/eui'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; import { InjectedIntlProps } from 'react-intl'; import { toastNotifications } from 'ui/notify'; -import { ANNOTATION_MAX_LENGTH_CHARS } from '../../../../common/constants/annotations'; +import { ANNOTATION_MAX_LENGTH_CHARS } from '../../../../../common/constants/annotations'; import { annotation$, annotationsRefresh$, diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/__mocks__/mock_annotations.json b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/__mocks__/mock_annotations.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/__mocks__/mock_annotations.json rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/__mocks__/mock_annotations.json diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/__snapshots__/annotations_table.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/__snapshots__/annotations_table.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/__snapshots__/annotations_table.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/__snapshots__/annotations_table.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.js b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.js rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js index ecd1c43eeb9abe..909abfd4abc233 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.js +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js @@ -41,8 +41,8 @@ import { addItemToRecentlyAccessed } from '../../../util/recently_accessed'; import { ml } from '../../../services/ml_api_service'; import { mlJobService } from '../../../services/job_service'; import { mlTableService } from '../../../services/table_service'; -import { ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE } from '../../../../common/constants/search'; -import { getLatestDataOrBucketTimestamp, isTimeSeriesViewJob } from '../../../../common/util/job_utils'; +import { ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE } from '../../../../../common/constants/search'; +import { getLatestDataOrBucketTimestamp, isTimeSeriesViewJob } from '../../../../../common/util/job_utils'; import { annotation$, annotationsRefresh$ } from '../../../services/annotations_service'; @@ -87,7 +87,7 @@ const AnnotationsTable = injectI18n(class AnnotationsTable extends Component { earliestMs: null, latestMs: null, maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE - }).then((resp) => { + }).toPromise().then((resp) => { this.setState((prevState, props) => ({ annotations: resp.annotations[props.jobs[0].job_id] || [], errorMessage: undefined, diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.js b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js similarity index 79% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.js rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js index 32d30741f43da2..c3ca28dc96bfc7 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import jobConfig from '../../../../common/types/__mocks__/job_config_farequote'; +import jobConfig from '../../../../../common/types/__mocks__/job_config_farequote'; import mockAnnotations from './__mocks__/mock_annotations.json'; import './annotations_table.test.mocks'; @@ -24,13 +24,17 @@ jest.mock('../../../services/job_service', () => ({ } })); -jest.mock('../../../services/ml_api_service', () => ({ - ml: { - annotations: { - getAnnotations: jest.fn().mockResolvedValue({ annotations: [] }) +jest.mock('../../../services/ml_api_service', () => { + const { of } = require('rxjs'); + const mockAnnotations$ = of({ annotations: [] }); + return { + ml: { + annotations: { + getAnnotations: jest.fn().mockReturnValue(mockAnnotations$) + } } - } -})); + };} +); describe('AnnotationsTable', () => { test('Minimal initialization without props.', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.mocks.ts similarity index 81% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.mocks.ts index fd3b04b2332d86..4a29fec03da85d 100644 --- a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/annotations_table.test.mocks.ts +++ b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.test.mocks.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { chromeServiceMock } from '../../../../../../../../src/core/public/mocks'; +import { chromeServiceMock } from '../../../../../../../../../src/core/public/mocks'; jest.doMock('ui/new_platform', () => ({ npStart: { diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/index.js b/x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/annotations_table/index.js rename to x-pack/legacy/plugins/ml/public/application/components/annotations/annotations_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/annotations/delete_annotation_modal/index.tsx b/x-pack/legacy/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/annotations/delete_annotation_modal/index.tsx rename to x-pack/legacy/plugins/ml/public/application/components/annotations/delete_annotation_modal/index.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/_anomalies_table.scss b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/_anomalies_table.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/_anomalies_table.scss rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/_anomalies_table.scss diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table.js index dda516c819bf4b..f3913879ff12ca 100644 --- a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table.js +++ b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table.js @@ -30,7 +30,7 @@ import { getColumns } from './anomalies_table_columns'; import { AnomalyDetails } from './anomaly_details'; import { mlTableService } from '../../services/table_service'; -import { RuleEditorFlyout } from '../../components/rule_editor'; +import { RuleEditorFlyout } from '../rule_editor'; import { ml } from '../../services/ml_api_service'; import { INFLUENCERS_LIMIT, diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table.test.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table.test.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_columns.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_columns.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js index be2a3e1f4223b8..3e5d1e7acc4509 100644 --- a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_columns.js +++ b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js @@ -30,7 +30,7 @@ import { InfluencersCell } from './influencers_cell'; import { LinksMenu } from './links_menu'; import { checkPermission } from '../../privilege/check_privilege'; import { mlFieldFormatService } from '../../services/field_format_service'; -import { isRuleSupported } from '../../../common/util/anomaly_utils'; +import { isRuleSupported } from '../../../../common/util/anomaly_utils'; import { formatValue } from '../../formatters/format_value'; import { INFLUENCERS_LIMIT, diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_constants.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table_constants.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomalies_table_constants.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomalies_table_constants.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomaly_details.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomaly_details.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomaly_details.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomaly_details.js index b1eada31fbf5b7..bbbf7f704c614a 100644 --- a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomaly_details.js +++ b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomaly_details.js @@ -35,8 +35,8 @@ import { getSeverity, showActualForFunction, showTypicalForFunction, -} from '../../../common/util/anomaly_utils'; -import { MULTI_BUCKET_IMPACT } from '../../../common/constants/multi_bucket_impact'; +} from '../../../../common/util/anomaly_utils'; +import { MULTI_BUCKET_IMPACT } from '../../../../common/constants/multi_bucket_impact'; import { formatValue } from '../../formatters/format_value'; import { MAX_CHARS } from './anomalies_table_constants'; diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/anomaly_details.test.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/anomaly_details.test.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/anomaly_details.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/description_cell.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/description_cell.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/description_cell.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/description_cell.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/detector_cell.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/detector_cell.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/detector_cell.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/detector_cell.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/index.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/index.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/influencers_cell.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/influencers_cell.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/influencers_cell.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/influencers_cell.js diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/links_menu.js b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/links_menu.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/links_menu.js rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/links_menu.js index dfa12e34928d2c..19cd77655f97c4 100644 --- a/x-pack/legacy/plugins/ml/public/components/anomalies_table/links_menu.js +++ b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/links_menu.js @@ -22,11 +22,11 @@ import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import chrome from 'ui/chrome'; import { toastNotifications } from 'ui/notify'; -import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { ES_FIELD_TYPES } from '../../../../../../../../src/plugins/data/public'; import { checkPermission } from '../../privilege/check_privilege'; -import { SEARCH_QUERY_LANGUAGE } from '../../../common/constants/search'; -import { isRuleSupported } from '../../../common/util/anomaly_utils'; -import { parseInterval } from '../../../common/util/parse_interval'; +import { SEARCH_QUERY_LANGUAGE } from '../../../../common/constants/search'; +import { isRuleSupported } from '../../../../common/util/anomaly_utils'; +import { parseInterval } from '../../../../common/util/parse_interval'; import { escapeDoubleQuotes } from '../kql_filter_bar/utils'; import { getFieldTypeFromMapping } from '../../services/mapping_service'; import { ml } from '../../services/ml_api_service'; diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/index.ts b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/severity_cell.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/severity_cell.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/severity_cell.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/severity_cell.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/severity_cell.tsx b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/severity_cell.tsx similarity index 91% rename from x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/severity_cell.tsx rename to x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/severity_cell.tsx index e74d1a73b3332b..2288106c6a8eda 100644 --- a/x-pack/legacy/plugins/ml/public/components/anomalies_table/severity_cell/severity_cell.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/anomalies_table/severity_cell/severity_cell.tsx @@ -6,8 +6,8 @@ import React, { FC, memo } from 'react'; import { EuiHealth, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { MULTI_BUCKET_IMPACT } from '../../../../common/constants/multi_bucket_impact'; -import { getSeverityColor } from '../../../../common/util/anomaly_utils'; +import { MULTI_BUCKET_IMPACT } from '../../../../../common/constants/multi_bucket_impact'; +import { getSeverityColor } from '../../../../../common/util/anomaly_utils'; interface SeverityCellProps { /** diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/_chart_tooltip.scss b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/_chart_tooltip.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/_chart_tooltip.scss rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/_chart_tooltip.scss diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip.tsx b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip.tsx rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx index ea9bc4f0f92eed..42a3e975094523 100644 --- a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip.tsx @@ -10,7 +10,7 @@ import { TooltipValueFormatter } from '@elastic/charts'; // TODO: Below import is temporary, use `react-use` lib instead. // eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { useObservable } from '../../../../../../../src/plugins/kibana_react/public/util/use_observable'; +import { useObservable } from '../../../../../../../../src/plugins/kibana_react/public/util/use_observable'; import { chartTooltip$, ChartTooltipValue } from './chart_tooltip_service'; diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.d.ts b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.d.ts rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.d.ts diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.js b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.js rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.js diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.test.ts b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/chart_tooltip_service.test.ts rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/chart_tooltip_service.test.ts diff --git a/x-pack/legacy/plugins/ml/public/components/chart_tooltip/index.ts b/x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/chart_tooltip/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/chart_tooltip/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/controls/_controls.scss b/x-pack/legacy/plugins/ml/public/application/components/controls/_controls.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/_controls.scss rename to x-pack/legacy/plugins/ml/public/application/components/controls/_controls.scss diff --git a/x-pack/legacy/plugins/ml/public/components/controls/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/controls/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/controls/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts.js b/x-pack/legacy/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/checkbox_showcharts/checkbox_showcharts.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/checkbox_showcharts/index.js b/x-pack/legacy/plugins/ml/public/application/components/controls/checkbox_showcharts/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/checkbox_showcharts/index.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/checkbox_showcharts/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/index.js b/x-pack/legacy/plugins/ml/public/application/components/controls/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/index.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_interval/index.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_interval/index.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_interval/select_interval.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/select_interval.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_interval/select_interval.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/select_interval.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_interval/select_interval.test.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/select_interval.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_interval/select_interval.test.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_interval/select_interval.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_severity/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/_select_severity.scss b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/_select_severity.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_severity/_select_severity.scss rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/_select_severity.scss diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/index.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_severity/index.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/select_severity.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/select_severity.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/controls/select_severity/select_severity.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/select_severity.js index 502d6078ffd3b7..9e6cffa21c5fa2 100644 --- a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/select_severity.js +++ b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/select_severity.js @@ -22,7 +22,7 @@ import { EuiText, } from '@elastic/eui'; -import { getSeverityColor } from '../../../../common/util/anomaly_utils'; +import { getSeverityColor } from '../../../../../common/util/anomaly_utils'; import { injectObservablesAsProps } from '../../../util/observable_utils'; const warningLabel = i18n.translate('xpack.ml.controls.selectSeverity.warningLabel', { defaultMessage: 'warning' }); diff --git a/x-pack/legacy/plugins/ml/public/components/controls/select_severity/select_severity.test.js b/x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/select_severity.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/controls/select_severity/select_severity.test.js rename to x-pack/legacy/plugins/ml/public/application/components/controls/select_severity/select_severity.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/create_job_link_card/create_job_link_card.tsx b/x-pack/legacy/plugins/ml/public/application/components/create_job_link_card/create_job_link_card.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/create_job_link_card/create_job_link_card.tsx rename to x-pack/legacy/plugins/ml/public/application/components/create_job_link_card/create_job_link_card.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/create_job_link_card/index.ts b/x-pack/legacy/plugins/ml/public/application/components/create_job_link_card/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/create_job_link_card/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/create_job_link_card/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/custom_hooks/index.ts b/x-pack/legacy/plugins/ml/public/application/components/custom_hooks/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/custom_hooks/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/custom_hooks/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/custom_hooks/use_partial_state.ts b/x-pack/legacy/plugins/ml/public/application/components/custom_hooks/use_partial_state.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/custom_hooks/use_partial_state.ts rename to x-pack/legacy/plugins/ml/public/application/components/custom_hooks/use_partial_state.ts diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer.d.ts b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer.d.ts rename to x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.d.ts diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer.js b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer.js rename to x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.js index b303ed9b7f008b..9c4baacd9eec73 100644 --- a/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer.js +++ b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/data_recognizer.js @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { RecognizedResult } from './recognized_result'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { ml } from '../../services/ml_api_service'; export class DataRecognizer extends Component { constructor(props) { diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/data_recognizer/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/recognized_result.js b/x-pack/legacy/plugins/ml/public/application/components/data_recognizer/recognized_result.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/data_recognizer/recognized_result.js rename to x-pack/legacy/plugins/ml/public/application/components/data_recognizer/recognized_result.js diff --git a/x-pack/legacy/plugins/ml/public/components/display_value/display_value.tsx b/x-pack/legacy/plugins/ml/public/application/components/display_value/display_value.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/display_value/display_value.tsx rename to x-pack/legacy/plugins/ml/public/application/components/display_value/display_value.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/display_value/index.ts b/x-pack/legacy/plugins/ml/public/application/components/display_value/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/display_value/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/display_value/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/entity_cell/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/entity_cell/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/entity_cell/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/entity_cell/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.js b/x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.js rename to x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.js diff --git a/x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.scss b/x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.scss rename to x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.scss diff --git a/x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.test.js b/x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/entity_cell/entity_cell.test.js rename to x-pack/legacy/plugins/ml/public/application/components/entity_cell/entity_cell.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/entity_cell/index.js b/x-pack/legacy/plugins/ml/public/application/components/entity_cell/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/entity_cell/index.js rename to x-pack/legacy/plugins/ml/public/application/components/entity_cell/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/_field_title_bar.scss b/x-pack/legacy/plugins/ml/public/application/components/field_title_bar/_field_title_bar.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_title_bar/_field_title_bar.scss rename to x-pack/legacy/plugins/ml/public/application/components/field_title_bar/_field_title_bar.scss diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/field_title_bar/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_title_bar/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/field_title_bar/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar.js b/x-pack/legacy/plugins/ml/public/application/components/field_title_bar/field_title_bar.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar.js rename to x-pack/legacy/plugins/ml/public/application/components/field_title_bar/field_title_bar.js diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar.test.js b/x-pack/legacy/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar.test.js rename to x-pack/legacy/plugins/ml/public/application/components/field_title_bar/field_title_bar.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js b/x-pack/legacy/plugins/ml/public/application/components/field_title_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/components/field_title_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/__snapshots__/field_type_icon.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/__snapshots__/field_type_icon.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/__snapshots__/field_type_icon.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/__snapshots__/field_type_icon.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/_field_type_icon.scss b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/_field_type_icon.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/_field_type_icon.scss rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/_field_type_icon.scss diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.js b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.js rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.js index 20c8e5310788d8..c219aeb84772c5 100644 --- a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.js +++ b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.js @@ -12,7 +12,7 @@ import { EuiToolTip } from '@elastic/eui'; // don't use something like plugins/ml/../common // because it won't work with the jest tests import { getMLJobTypeAriaLabel } from '../../util/field_types_utils'; -import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; import { i18n } from '@kbn/i18n'; export const FieldTypeIcon = ({ tooltipEnabled = false, type, needsAria = true }) => { diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.test.js b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.test.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.test.js rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.test.js index 11e98549684ee0..c21a173db4a854 100644 --- a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/field_type_icon.test.js @@ -8,7 +8,7 @@ import React from 'react'; import { mount, shallow } from 'enzyme'; import { FieldTypeIcon } from './field_type_icon'; -import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; describe('FieldTypeIcon', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js b/x-pack/legacy/plugins/ml/public/application/components/field_type_icon/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js rename to x-pack/legacy/plugins/ml/public/application/components/field_type_icon/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/__snapshots__/full_time_range_selector.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/__snapshots__/full_time_range_selector.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/full_time_range_selector/__snapshots__/full_time_range_selector.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/__snapshots__/full_time_range_selector.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector.tsx b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector.tsx rename to x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_service.ts b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_service.ts rename to x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector_service.ts diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/index.tsx b/x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/index.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/full_time_range_selector/index.tsx rename to x-pack/legacy/plugins/ml/public/application/components/full_time_range_selector/index.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/influencers_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/influencers_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/influencers_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/influencers_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/influencers_list/_influencers_list.scss b/x-pack/legacy/plugins/ml/public/application/components/influencers_list/_influencers_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/influencers_list/_influencers_list.scss rename to x-pack/legacy/plugins/ml/public/application/components/influencers_list/_influencers_list.scss diff --git a/x-pack/legacy/plugins/ml/public/components/influencers_list/index.js b/x-pack/legacy/plugins/ml/public/application/components/influencers_list/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/influencers_list/index.js rename to x-pack/legacy/plugins/ml/public/application/components/influencers_list/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/influencers_list/influencers_list.js b/x-pack/legacy/plugins/ml/public/application/components/influencers_list/influencers_list.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/influencers_list/influencers_list.js rename to x-pack/legacy/plugins/ml/public/application/components/influencers_list/influencers_list.js index 7794d3fd23497b..6551996e2d1940 100644 --- a/x-pack/legacy/plugins/ml/public/components/influencers_list/influencers_list.js +++ b/x-pack/legacy/plugins/ml/public/application/components/influencers_list/influencers_list.js @@ -22,8 +22,8 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { abbreviateWholeNumber } from 'plugins/ml/formatters/abbreviate_whole_number'; -import { getSeverity } from 'plugins/ml/../common/util/anomaly_utils'; +import { abbreviateWholeNumber } from '../../formatters/abbreviate_whole_number'; +import { getSeverity } from '../../../../common/util/anomaly_utils'; import { EntityCell } from '../entity_cell'; diff --git a/x-pack/legacy/plugins/ml/public/components/items_grid/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/items_grid/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/items_grid/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/items_grid/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/items_grid/_items_grid.scss b/x-pack/legacy/plugins/ml/public/application/components/items_grid/_items_grid.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/items_grid/_items_grid.scss rename to x-pack/legacy/plugins/ml/public/application/components/items_grid/_items_grid.scss diff --git a/x-pack/legacy/plugins/ml/public/components/items_grid/index.js b/x-pack/legacy/plugins/ml/public/application/components/items_grid/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/items_grid/index.js rename to x-pack/legacy/plugins/ml/public/application/components/items_grid/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/items_grid/items_grid.js b/x-pack/legacy/plugins/ml/public/application/components/items_grid/items_grid.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/items_grid/items_grid.js rename to x-pack/legacy/plugins/ml/public/application/components/items_grid/items_grid.js diff --git a/x-pack/legacy/plugins/ml/public/components/items_grid/items_grid_pagination.js b/x-pack/legacy/plugins/ml/public/application/components/items_grid/items_grid_pagination.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/items_grid/items_grid_pagination.js rename to x-pack/legacy/plugins/ml/public/application/components/items_grid/items_grid_pagination.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_message_icon/index.ts b/x-pack/legacy/plugins/ml/public/application/components/job_message_icon/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_message_icon/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/job_message_icon/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/job_message_icon/job_message_icon.tsx b/x-pack/legacy/plugins/ml/public/application/components/job_message_icon/job_message_icon.tsx similarity index 93% rename from x-pack/legacy/plugins/ml/public/components/job_message_icon/job_message_icon.tsx rename to x-pack/legacy/plugins/ml/public/application/components/job_message_icon/job_message_icon.tsx index 545e9231699fd2..7546121250013f 100644 --- a/x-pack/legacy/plugins/ml/public/components/job_message_icon/job_message_icon.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/job_message_icon/job_message_icon.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { EuiIcon, EuiToolTip } from '@elastic/eui'; -import { AuditMessageBase } from '../../../common/types/audit_message'; +import { AuditMessageBase } from '../../../../common/types/audit_message'; interface Props { message: AuditMessageBase; diff --git a/x-pack/legacy/plugins/ml/public/components/job_messages/index.ts b/x-pack/legacy/plugins/ml/public/application/components/job_messages/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_messages/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/job_messages/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/job_messages/job_messages.tsx b/x-pack/legacy/plugins/ml/public/application/components/job_messages/job_messages.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/components/job_messages/job_messages.tsx rename to x-pack/legacy/plugins/ml/public/application/components/job_messages/job_messages.tsx index 08f9a4379559b6..aedb8b6d17d067 100644 --- a/x-pack/legacy/plugins/ml/public/components/job_messages/job_messages.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/job_messages/job_messages.tsx @@ -12,7 +12,7 @@ import { formatDate } from '@elastic/eui/lib/services/format'; import { i18n } from '@kbn/i18n'; import theme from '@elastic/eui/dist/eui_theme_light.json'; -import { JobMessage } from '../../../common/types/audit_message'; +import { JobMessage } from '../../../../common/types/audit_message'; import { JobIcon } from '../job_message_icon'; const TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/job_selector/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/_job_selector.scss b/x-pack/legacy/plugins/ml/public/application/components/job_selector/_job_selector.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/_job_selector.scss rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/_job_selector.scss diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/custom_selection_table/custom_selection_table.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/custom_selection_table/custom_selection_table.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/custom_selection_table.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/custom_selection_table/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/custom_selection_table/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/custom_selection_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/id_badges.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/id_badges.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/id_badges.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/id_badges.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/id_badges.test.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/id_badges.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/id_badges.test.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/id_badges.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/id_badges/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/id_badges/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_select_service_utils.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_select_service_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_select_service_utils.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_select_service_utils.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector.js index 13899be8604284..7725cf5e594829 100644 --- a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector.js +++ b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector.js @@ -10,7 +10,7 @@ import { PropTypes } from 'prop-types'; import moment from 'moment'; import { ml } from '../../services/ml_api_service'; -import { JobSelectorTable } from './job_selector_table/'; +import { JobSelectorTable } from './job_selector_table'; import { IdBadges } from './id_badges'; import { NewSelectionIdBadges } from './new_selection_id_badges'; import { timefilter } from 'ui/timefilter'; diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_badge/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_badge/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_badge/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_badge/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_badge/job_selector_badge.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_badge/job_selector_badge.js similarity index 94% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_badge/job_selector_badge.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_badge/job_selector_badge.js index 2cb8a9da3dfdfc..97f46c7cb59eaa 100644 --- a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_badge/job_selector_badge.js +++ b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_badge/job_selector_badge.js @@ -9,7 +9,7 @@ import React from 'react'; import { PropTypes } from 'prop-types'; import { EuiBadge } from '@elastic/eui'; -import { tabColor } from '../../../../common/util/group_color_utils'; +import { tabColor } from '../../../../../common/util/group_color_utils'; import { i18n } from '@kbn/i18n'; export function JobSelectorBadge({ diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/job_selector_table.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/job_selector_table.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/job_selector_table.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/job_selector_table.js index a754fbfab5ca6c..76417984828d23 100644 --- a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/job_selector_table.js +++ b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/job_selector_table.js @@ -10,7 +10,7 @@ import React, { Fragment, useState, useEffect } from 'react'; import { PropTypes } from 'prop-types'; import { CustomSelectionTable } from '../custom_selection_table'; import { JobSelectorBadge } from '../job_selector_badge'; -import { TimeRangeBar } from '../timerange_bar/'; +import { TimeRangeBar } from '../timerange_bar'; import { EuiFlexGroup, diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/job_selector_table.test.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/job_selector_table.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/job_selector_table/job_selector_table.test.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/job_selector_table/job_selector_table.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/new_selection_id_badges.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/new_selection_id_badges.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/new_selection_id_badges.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/new_selection_id_badges.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/new_selection_id_badges.test.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/new_selection_id_badges.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/new_selection_id_badges/new_selection_id_badges.test.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/new_selection_id_badges/new_selection_id_badges.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/index.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/timerange_bar.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/timerange_bar.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/timerange_bar.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/timerange_bar.js diff --git a/x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/timerange_bar.test.js b/x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/timerange_bar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/job_selector/timerange_bar/timerange_bar.test.js rename to x-pack/legacy/plugins/ml/public/application/components/job_selector/timerange_bar/timerange_bar.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/__snapshots__/kql_filter_bar.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/__snapshots__/kql_filter_bar.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/__snapshots__/kql_filter_bar.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/__snapshots__/kql_filter_bar.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/__tests__/utils.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/__tests__/utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/__tests__/utils.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/__tests__/utils.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/__snapshots__/click_outside.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/__snapshots__/click_outside.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/__snapshots__/click_outside.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/__snapshots__/click_outside.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/click_outside.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/click_outside.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/click_outside.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/click_outside.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/click_outside.test.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/click_outside.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/click_outside.test.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/click_outside.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/index.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/click_outside/index.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/click_outside/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/__snapshots__/filter_bar.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/__snapshots__/filter_bar.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/__snapshots__/filter_bar.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/__snapshots__/filter_bar.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/filter_bar.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/filter_bar.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/filter_bar.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/filter_bar.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/filter_bar.test.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/filter_bar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/filter_bar.test.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/filter_bar.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/index.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/filter_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/filter_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/index.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/kql_filter_bar.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/kql_filter_bar.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/kql_filter_bar.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/kql_filter_bar.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/kql_filter_bar.test.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/kql_filter_bar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/kql_filter_bar.test.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/kql_filter_bar.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/__snapshots__/suggestion.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/__snapshots__/suggestion.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/__snapshots__/suggestion.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/__snapshots__/suggestion.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/index.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/index.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/suggestion.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/suggestion.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/suggestion.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/suggestion.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/suggestion.test.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/suggestion.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestion/suggestion.test.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestion/suggestion.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/__snapshots__/suggestions.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/__snapshots__/suggestions.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/__snapshots__/suggestions.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/__snapshots__/suggestions.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/index.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/index.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/suggestions.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/suggestions.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/suggestions.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/suggestions.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/suggestions.test.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/suggestions.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/suggestions/suggestions.test.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/suggestions/suggestions.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/kql_filter_bar/utils.js b/x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/kql_filter_bar/utils.js rename to x-pack/legacy/plugins/ml/public/application/components/kql_filter_bar/utils.js diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/__tests__/loading_indicator_directive.js b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/__tests__/loading_indicator_directive.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/__tests__/loading_indicator_directive.js rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/__tests__/loading_indicator_directive.js diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/_loading_indicator.scss b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/_loading_indicator.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/_loading_indicator.scss rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/_loading_indicator.scss diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/index.js b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/index.js rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator.html b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator.html similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator.html rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator.html diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator.js b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator.js rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator.js diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator_directive.js b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator_directive.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator_directive.js rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator_directive.js diff --git a/x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator_wrapper.html b/x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator_wrapper.html similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/loading_indicator/loading_indicator_wrapper.html rename to x-pack/legacy/plugins/ml/public/application/components/loading_indicator/loading_indicator_wrapper.html diff --git a/x-pack/legacy/plugins/ml/public/components/message_call_out/index.js b/x-pack/legacy/plugins/ml/public/application/components/message_call_out/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/message_call_out/index.js rename to x-pack/legacy/plugins/ml/public/application/components/message_call_out/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/message_call_out/message_call_out.js b/x-pack/legacy/plugins/ml/public/application/components/message_call_out/message_call_out.js similarity index 94% rename from x-pack/legacy/plugins/ml/public/components/message_call_out/message_call_out.js rename to x-pack/legacy/plugins/ml/public/application/components/message_call_out/message_call_out.js index 830510df256593..d26fc296e97446 100644 --- a/x-pack/legacy/plugins/ml/public/components/message_call_out/message_call_out.js +++ b/x-pack/legacy/plugins/ml/public/application/components/message_call_out/message_call_out.js @@ -16,7 +16,7 @@ import { EuiCallOut } from '@elastic/eui'; // don't use something like plugins/ml/../common // because it won't work with the jest tests -import { MESSAGE_LEVEL } from '../../../common/constants/message_levels'; +import { MESSAGE_LEVEL } from '../../../../common/constants/message_levels'; function getCallOutAttributes(message, status) { diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/index.ts b/x-pack/legacy/plugins/ml/public/application/components/messagebar/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/messagebar/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/messagebar/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts b/x-pack/legacy/plugins/ml/public/application/components/messagebar/messagebar_service.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts rename to x-pack/legacy/plugins/ml/public/application/components/messagebar/messagebar_service.d.ts diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js b/x-pack/legacy/plugins/ml/public/application/components/messagebar/messagebar_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js rename to x-pack/legacy/plugins/ml/public/application/components/messagebar/messagebar_service.js diff --git a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/index.ts b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/index.ts similarity index 77% rename from x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/index.ts index 91bf31ea1e7ab0..bbd793696e005c 100644 --- a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/index.ts +++ b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/index.ts @@ -4,5 +4,5 @@ * you may not use this file except in compliance with the Elastic License. */ -export { ProgressBar, MlInMemoryTable } from './ml_in_memory_table'; +export { ProgressBar, mlInMemoryTableFactory } from './ml_in_memory_table'; export * from './types'; diff --git a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/ml_in_memory_table.tsx b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/ml_in_memory_table.tsx similarity index 69% rename from x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/ml_in_memory_table.tsx rename to x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/ml_in_memory_table.tsx index d5316b22a6a6f1..7caaadf65d6da8 100644 --- a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/ml_in_memory_table.tsx +++ b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/ml_in_memory_table.tsx @@ -71,34 +71,38 @@ const getInitialSorting = (columns: any, sorting: any) => { }; }; -import { MlInMemoryTableBasic } from './types'; - -export class MlInMemoryTable extends MlInMemoryTableBasic { - static getDerivedStateFromProps(nextProps: any, prevState: any) { - const derivedState = { - ...prevState.prevProps, - pageIndex: nextProps.pagination.initialPageIndex, - pageSize: nextProps.pagination.initialPageSize, - }; +import { mlInMemoryTableBasicFactory } from './types'; - if (nextProps.items !== prevState.prevProps.items) { - Object.assign(derivedState, { - prevProps: { - items: nextProps.items, - }, - }); - } +export function mlInMemoryTableFactory() { + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + + return class MlInMemoryTable extends MlInMemoryTableBasic { + static getDerivedStateFromProps(nextProps: any, prevState: any) { + const derivedState = { + ...prevState.prevProps, + pageIndex: nextProps.pagination.initialPageIndex, + pageSize: nextProps.pagination.initialPageSize, + }; - const { sortName, sortDirection } = getInitialSorting(nextProps.columns, nextProps.sorting); - if ( - sortName !== prevState.prevProps.sortName || - sortDirection !== prevState.prevProps.sortDirection - ) { - Object.assign(derivedState, { - sortName, - sortDirection, - }); + if (nextProps.items !== prevState.prevProps.items) { + Object.assign(derivedState, { + prevProps: { + items: nextProps.items, + }, + }); + } + + const { sortName, sortDirection } = getInitialSorting(nextProps.columns, nextProps.sorting); + if ( + sortName !== prevState.prevProps.sortName || + sortDirection !== prevState.prevProps.sortDirection + ) { + Object.assign(derivedState, { + sortName, + sortDirection, + }); + } + return derivedState; } - return derivedState; - } + }; } diff --git a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/types.ts b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/types.ts similarity index 70% rename from x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/types.ts rename to x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/types.ts index fac0309e0aeb6b..49d831de47387b 100644 --- a/x-pack/legacy/plugins/ml/public/components/ml_in_memory_table/types.ts +++ b/x-pack/legacy/plugins/ml/public/application/components/ml_in_memory_table/types.ts @@ -8,24 +8,21 @@ import { Component, HTMLAttributes, ReactElement, ReactNode } from 'react'; import { CommonProps, EuiInMemoryTable } from '@elastic/eui'; -// At some point this could maybe solved with a generic . -type Item = any; - // Not using an enum here because the original HorizontalAlignment is also a union type of string. type HorizontalAlignment = 'left' | 'center' | 'right'; -type SortableFunc = (item: Item) => any; -type Sortable = boolean | SortableFunc; +type SortableFunc = (item: T) => any; +type Sortable = boolean | SortableFunc; type DATA_TYPES = any; -type FooterFunc = (payload: { items: Item[]; pagination: any }) => ReactNode; +type FooterFunc = (payload: { items: T[]; pagination: any }) => ReactNode; type RenderFunc = (value: any, record?: any) => ReactNode; -export interface FieldDataColumnType { +export interface FieldDataColumnType { field: string; name: ReactNode; description?: string; dataType?: DATA_TYPES; width?: string; - sortable?: Sortable; + sortable?: Sortable; align?: HorizontalAlignment; truncateText?: boolean; render?: RenderFunc; @@ -34,38 +31,38 @@ export interface FieldDataColumnType { 'data-test-subj'?: string; } -export interface ComputedColumnType { +export interface ComputedColumnType { render: RenderFunc; name?: ReactNode; description?: string; - sortable?: (item: Item) => any; + sortable?: (item: T) => any; width?: string; truncateText?: boolean; 'data-test-subj'?: string; } type ICON_TYPES = any; -type IconTypesFunc = (item: Item) => ICON_TYPES; // (item) => oneOf(ICON_TYPES) +type IconTypesFunc = (item: T) => ICON_TYPES; // (item) => oneOf(ICON_TYPES) type BUTTON_ICON_COLORS = any; -type ButtonIconColorsFunc = (item: Item) => BUTTON_ICON_COLORS; // (item) => oneOf(ICON_BUTTON_COLORS) -interface DefaultItemActionType { +type ButtonIconColorsFunc = (item: T) => BUTTON_ICON_COLORS; // (item) => oneOf(ICON_BUTTON_COLORS) +interface DefaultItemActionType { type?: 'icon' | 'button'; name: string; description: string; - onClick?(item: Item): void; + onClick?(item: T): void; href?: string; target?: string; - available?(item: Item): boolean; - enabled?(item: Item): boolean; + available?(item: T): boolean; + enabled?(item: T): boolean; isPrimary?: boolean; - icon?: ICON_TYPES | IconTypesFunc; // required when type is 'icon' - color?: BUTTON_ICON_COLORS | ButtonIconColorsFunc; + icon?: ICON_TYPES | IconTypesFunc; // required when type is 'icon' + color?: BUTTON_ICON_COLORS | ButtonIconColorsFunc; } -interface CustomItemActionType { - render(item: Item, enabled: boolean): ReactNode; - available?(item: Item): boolean; - enabled?(item: Item): boolean; +interface CustomItemActionType { + render(item: T, enabled: boolean): ReactNode; + available?(item: T): boolean; + enabled?(item: T): boolean; isPrimary?: boolean; } @@ -76,20 +73,20 @@ export interface ExpanderColumnType { render: RenderFunc; } -type SupportedItemActionType = DefaultItemActionType | CustomItemActionType; +type SupportedItemActionType = DefaultItemActionType | CustomItemActionType; -export interface ActionsColumnType { - actions: SupportedItemActionType[]; +export interface ActionsColumnType { + actions: Array>; name?: ReactNode; description?: string; width?: string; } -export type ColumnType = - | ActionsColumnType - | ComputedColumnType +export type ColumnType = + | ActionsColumnType + | ComputedColumnType | ExpanderColumnType - | FieldDataColumnType; + | FieldDataColumnType; type QueryType = any; @@ -161,17 +158,17 @@ export interface OnTableChangeArg extends Sorting { page: { index: number; size: number }; } -type ItemIdTypeFunc = (item: Item) => string; +type ItemIdTypeFunc = (item: T) => string; type ItemIdType = | string // the name of the item id property | ItemIdTypeFunc; -export type EuiInMemoryTableProps = CommonProps & { - columns: ColumnType[]; +export type EuiInMemoryTableProps = CommonProps & { + columns: Array>; hasActions?: boolean; isExpandable?: boolean; isSelectable?: boolean; - items?: Item[]; + items?: T[]; loading?: boolean; message?: HTMLAttributes; error?: string; @@ -184,16 +181,18 @@ export type EuiInMemoryTableProps = CommonProps & { responsive?: boolean; selection?: SelectionType; itemId?: ItemIdType; - itemIdToExpandedRowMap?: Record; - rowProps?: (item: Item) => void | Record; + itemIdToExpandedRowMap?: Record; + rowProps?: (item: T) => void | Record; cellProps?: () => void | Record; onTableChange?: (arg: OnTableChangeArg) => void; }; -interface ComponentWithConstructor extends Component { +type EuiInMemoryTableType = typeof EuiInMemoryTable; + +interface ComponentWithConstructor extends EuiInMemoryTableType { new (): Component; } -export const MlInMemoryTableBasic = (EuiInMemoryTable as any) as ComponentWithConstructor< - EuiInMemoryTableProps ->; +export function mlInMemoryTableBasicFactory() { + return EuiInMemoryTable as ComponentWithConstructor>; +} diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/_navigation_menu.scss b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/_navigation_menu.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/_navigation_menu.scss rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/_navigation_menu.scss diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/main_tabs.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/main_tabs.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/main_tabs.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/navigation_menu.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/navigation_menu.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/tabs.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/tabs.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/tabs.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/tabs.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/tabs.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/tabs.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/tabs.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/tabs.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/__snapshots__/top_nav.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/__snapshots__/top_nav.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/__snapshots__/top_nav.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/__snapshots__/top_nav.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/index.ts b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.test.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/top_nav.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.test.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/top_nav.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx b/x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/top_nav.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx rename to x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/top_nav.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/node_available_warning/index.ts b/x-pack/legacy/plugins/ml/public/application/components/node_available_warning/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/node_available_warning/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/node_available_warning/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/node_available_warning/node_available_warning.tsx b/x-pack/legacy/plugins/ml/public/application/components/node_available_warning/node_available_warning.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/node_available_warning/node_available_warning.tsx rename to x-pack/legacy/plugins/ml/public/application/components/node_available_warning/node_available_warning.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/actions_section.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/actions_section.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/actions_section.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/condition_expression.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/condition_expression.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/condition_expression.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/condition_expression.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/conditions_section.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/conditions_section.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/conditions_section.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/rule_editor_flyout.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/scope_expression.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/scope_expression.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/scope_expression.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/scope_expression.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/scope_section.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__snapshots__/scope_section.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__snapshots__/scope_section.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/__tests__/utils.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__tests__/utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/__tests__/utils.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/__tests__/utils.js index 88818a3c978b35..77d2ed4643fcae 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/__tests__/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/__tests__/utils.js @@ -16,7 +16,7 @@ import { APPLIES_TO, OPERATOR, FILTER_TYPE, -} from '../../../../common/constants/detector_rule'; +} from '../../../../../common/constants/detector_rule'; describe('ML - rule editor utils', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/_rule_editor.scss b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/_rule_editor.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/_rule_editor.scss rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/_rule_editor.scss diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.js index 9ed6b2220f196b..f5340c9fc2374d 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.js @@ -21,7 +21,7 @@ import { EuiText, } from '@elastic/eui'; -import { ACTION } from '../../../common/constants/detector_rule'; +import { ACTION } from '../../../../common/constants/detector_rule'; import { FormattedMessage } from '@kbn/i18n/react'; export function ActionsSection({ diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.test.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.test.js index 9ba85c5caddbac..04e2c764e5ed9d 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/actions_section.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/actions_section.test.js @@ -9,7 +9,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ActionsSection } from './actions_section'; -import { ACTION } from '../../../common/constants/detector_rule'; +import { ACTION } from '../../../../common/constants/detector_rule'; describe('ActionsSection', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/__snapshots__/detector_description_list.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/__snapshots__/detector_description_list.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/__snapshots__/detector_description_list.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/__snapshots__/detector_description_list.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/_detector_description_list.scss b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/_detector_description_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/_detector_description_list.scss rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/_detector_description_list.scss diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/detector_description_list.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/detector_description_list.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/detector_description_list.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/detector_description_list.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/detector_description_list.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/index.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/components/detector_description_list/index.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/components/detector_description_list/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.js index a69ed1d7a55838..aeadcb8bf58ad1 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.js @@ -25,7 +25,7 @@ import { EuiFieldNumber, } from '@elastic/eui'; -import { APPLIES_TO, OPERATOR } from '../../../common/constants/detector_rule'; +import { APPLIES_TO, OPERATOR } from '../../../../common/constants/detector_rule'; import { appliesToText, operatorToText } from './utils'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.test.js similarity index 94% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.test.js index 5dcbe845f11760..640f90744aa8ea 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/condition_expression.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/condition_expression.test.js @@ -11,7 +11,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ConditionExpression } from './condition_expression'; -import { APPLIES_TO, OPERATOR } from '../../../common/constants/detector_rule'; +import { APPLIES_TO, OPERATOR } from '../../../../common/constants/detector_rule'; describe('ConditionExpression', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/conditions_section.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/conditions_section.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/conditions_section.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/conditions_section.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/conditions_section.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/conditions_section.test.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/conditions_section.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/conditions_section.test.js index 8db05d4752e458..e2bb62fa037908 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/conditions_section.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/conditions_section.test.js @@ -12,7 +12,7 @@ import React from 'react'; import { ConditionsSection } from './conditions_section'; import { getNewConditionDefaults } from './utils'; -import { APPLIES_TO, OPERATOR } from '../../../common/constants/detector_rule'; +import { APPLIES_TO, OPERATOR } from '../../../../common/constants/detector_rule'; describe('ConditionsSectionExpression', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/index.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/index.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/rule_editor_flyout.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/rule_editor_flyout.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.js index 904185fccf3f34..1ccfa5b664f597 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/rule_editor_flyout.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.js @@ -47,8 +47,8 @@ import { addItemToFilter, } from './utils'; -import { ACTION, CONDITIONS_NOT_SUPPORTED_FUNCTIONS } from '../../../common/constants/detector_rule'; -import { getPartitioningFieldNames } from '../../../common/util/job_utils'; +import { ACTION, CONDITIONS_NOT_SUPPORTED_FUNCTIONS } from '../../../../common/constants/detector_rule'; +import { getPartitioningFieldNames } from '../../../../common/util/job_utils'; import { mlJobService } from '../../services/job_service'; import { ml } from '../../services/ml_api_service'; import { metadata } from 'ui/metadata'; diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/rule_editor_flyout.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/rule_editor_flyout.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/rule_editor_flyout.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.js index 18fdf8887dc7a0..fe7bf81b6aca25 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.js @@ -24,7 +24,7 @@ import { EuiSelect, } from '@elastic/eui'; -import { FILTER_TYPE } from '../../../common/constants/detector_rule'; +import { FILTER_TYPE } from '../../../../common/constants/detector_rule'; import { filterTypeToText } from './utils'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.test.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.test.js index 3acd46b5d6aefe..68be030d7c28ac 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_expression.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_expression.test.js @@ -12,7 +12,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ScopeExpression } from './scope_expression'; -import { FILTER_TYPE } from '../../../common/constants/detector_rule'; +import { FILTER_TYPE } from '../../../../common/constants/detector_rule'; describe('ScopeExpression', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_section.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_section.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/scope_section.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_section.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_section.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_section.test.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/scope_section.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_section.test.js index f3a6c57e1cab4f..b7c961758fbf24 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/scope_section.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/scope_section.test.js @@ -20,7 +20,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { ScopeSection } from './scope_section'; -import { FILTER_TYPE } from '../../../common/constants/detector_rule'; +import { FILTER_TYPE } from '../../../../common/constants/detector_rule'; describe('ScopeSection', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/add_to_filter_list_link.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/add_to_filter_list_link.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/add_to_filter_list_link.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/add_to_filter_list_link.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/delete_rule_modal.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/edit_condition_link.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/edit_condition_link.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/edit_condition_link.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/edit_condition_link.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/rule_action_panel.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/rule_action_panel.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/__snapshots__/rule_action_panel.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/__snapshots__/rule_action_panel.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/add_to_filter_list_link.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/add_to_filter_list_link.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/add_to_filter_list_link.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/delete_rule_modal.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/delete_rule_modal.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/delete_rule_modal.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/delete_rule_modal.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/delete_rule_modal.test.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.js index 0df0ded392be24..48dd62b436852d 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.js @@ -23,7 +23,7 @@ import { EuiText, } from '@elastic/eui'; -import { APPLIES_TO } from '../../../../common/constants/detector_rule'; +import { APPLIES_TO } from '../../../../../common/constants/detector_rule'; import { formatValue } from '../../../formatters/format_value'; import { getAppliesToValueFromAnomaly, diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js index 206acb65b4ba31..866f2ff40a6d49 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/edit_condition_link.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/edit_condition_link.test.js @@ -10,7 +10,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { EditConditionLink } from './edit_condition_link'; -import { APPLIES_TO } from '../../../../common/constants/detector_rule'; +import { APPLIES_TO } from '../../../../../common/constants/detector_rule'; function prepareTest(updateConditionValueFn, appliesTo) { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/index.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/index.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/index.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/rule_action_panel.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/rule_action_panel.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/rule_action_panel.test.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/rule_action_panel.test.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js index d9fc6b9ed64cfb..c0553c32eaf24a 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/rule_action_panel.test.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/rule_action_panel.test.js @@ -32,7 +32,7 @@ import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { RuleActionPanel } from './rule_action_panel'; -import { ACTION } from '../../../../common/constants/detector_rule'; +import { ACTION } from '../../../../../common/constants/detector_rule'; describe('RuleActionPanel', () => { diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/select_rule_action.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/select_rule_action.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/select_rule_action/select_rule_action.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/select_rule_action/select_rule_action.js diff --git a/x-pack/legacy/plugins/ml/public/components/rule_editor/utils.js b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/rule_editor/utils.js rename to x-pack/legacy/plugins/ml/public/application/components/rule_editor/utils.js index 84f1c8207f3ff8..a6e3950a75a01e 100644 --- a/x-pack/legacy/plugins/ml/public/components/rule_editor/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/components/rule_editor/utils.js @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ACTION, APPLIES_TO, FILTER_TYPE, OPERATOR } from '../../../common/constants/detector_rule'; +import { ACTION, APPLIES_TO, FILTER_TYPE, OPERATOR } from '../../../../common/constants/detector_rule'; import { cloneDeep } from 'lodash'; import { ml } from '../../services/ml_api_service'; import { mlJobService } from '../../services/job_service'; import { i18n } from '@kbn/i18n'; -import { processCreatedBy } from '../../../common/util/job_utils'; +import { processCreatedBy } from '../../../../common/util/job_utils'; export function getNewConditionDefaults() { return { diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/_index.scss b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/_index.scss rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/_stat.scss b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/_stat.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/_stat.scss rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/_stat.scss diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/_stats_bar.scss b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/_stats_bar.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/_stats_bar.scss rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/_stats_bar.scss diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/index.ts b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/stat.tsx b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/stat.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/stat.tsx rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/stat.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/stats_bar/stats_bar.tsx b/x-pack/legacy/plugins/ml/public/application/components/stats_bar/stats_bar.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/stats_bar/stats_bar.tsx rename to x-pack/legacy/plugins/ml/public/application/components/stats_bar/stats_bar.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/upgrade/index.ts b/x-pack/legacy/plugins/ml/public/application/components/upgrade/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/upgrade/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/upgrade/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/upgrade/upgrade_warning.tsx b/x-pack/legacy/plugins/ml/public/application/components/upgrade/upgrade_warning.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/upgrade/upgrade_warning.tsx rename to x-pack/legacy/plugins/ml/public/application/components/upgrade/upgrade_warning.tsx diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/__snapshots__/validate_job_view.test.js.snap b/x-pack/legacy/plugins/ml/public/application/components/validate_job/__snapshots__/validate_job_view.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/validate_job/__snapshots__/validate_job_view.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/components/validate_job/__snapshots__/validate_job_view.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/index.ts b/x-pack/legacy/plugins/ml/public/application/components/validate_job/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/validate_job/index.ts rename to x-pack/legacy/plugins/ml/public/application/components/validate_job/index.ts diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.d.ts b/x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.d.ts rename to x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.d.ts diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js b/x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js rename to x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.js index a400e37e852197..50dc2b7f43f992 100644 --- a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js +++ b/x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.js @@ -37,8 +37,8 @@ const jobTipsUrl = `https://www.elastic.co/guide/en/kibana/${metadata.branch}/jo // don't use something like plugins/ml/../common // because it won't work with the jest tests -import { VALIDATION_STATUS } from '../../../common/constants/validation'; -import { getMostSevereMessageStatus } from '../../../common/util/validation_utils'; +import { VALIDATION_STATUS } from '../../../../common/constants/validation'; +import { getMostSevereMessageStatus } from '../../../../common/util/validation_utils'; const defaultIconType = 'questionInCircle'; const getDefaultState = () => ({ diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.test.js b/x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.test.js rename to x-pack/legacy/plugins/ml/public/application/components/validate_job/validate_job_view.test.js diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/index_pattern.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/index_pattern.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_pattern.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/index_patterns.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_patterns.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/index_patterns.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/index_patterns.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/kibana_config.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/kibana_config.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/kibana_config.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/kibana_config.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/kibana_context_value.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/kibana_context_value.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/kibana_context_value.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/kibana_context_value.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/saved_search.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/saved_search.ts similarity index 79% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/saved_search.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/saved_search.ts index 07979d7c1bd116..2e442c5c61b1e4 100644 --- a/x-pack/legacy/plugins/ml/public/contexts/kibana/__mocks__/saved_search.ts +++ b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/__mocks__/saved_search.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { searchSourceMock } from '../../../../../../../../src/legacy/ui/public/courier/search_source/mocks'; +import { searchSourceMock } from '../../../../../../../../../src/legacy/ui/public/courier/search_source/mocks'; export const savedSearchMock = { id: 'the-saved-search-id', diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/index.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/index.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/index.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/kibana_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/kibana_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/kibana_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/kibana_context.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/use_current_index_pattern.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_current_index_pattern.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/use_current_index_pattern.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_current_index_pattern.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/use_current_saved_search.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_current_saved_search.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/use_current_saved_search.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_current_saved_search.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/kibana/use_kibana_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_kibana_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/kibana/use_kibana_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/kibana/use_kibana_context.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/mocks.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/mocks.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/use_ui_chrome_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/use_ui_chrome_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/use_ui_chrome_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/use_ui_chrome_context.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/use_ui_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/use_ui_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/__mocks__/use_ui_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/__mocks__/use_ui_context.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/index.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/index.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/index.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/ui_context.tsx b/x-pack/legacy/plugins/ml/public/application/contexts/ui/ui_context.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/ui_context.tsx rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/ui_context.tsx diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/use_ui_chrome_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/use_ui_chrome_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/use_ui_chrome_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/use_ui_chrome_context.ts diff --git a/x-pack/legacy/plugins/ml/public/contexts/ui/use_ui_context.ts b/x-pack/legacy/plugins/ml/public/application/contexts/ui/use_ui_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/contexts/ui/use_ui_context.ts rename to x-pack/legacy/plugins/ml/public/application/contexts/ui/use_ui_context.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/breadcrumbs.ts similarity index 91% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/breadcrumbs.ts index 23de4c5b69ac7e..fde854b7f41c3f 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/breadcrumbs.ts @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; -import { ML_BREADCRUMB } from '../breadcrumbs'; +import { ML_BREADCRUMB } from '../../breadcrumbs'; export function getDataFrameAnalyticsBreadcrumbs() { return [ diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/common/analytics.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/common/analytics.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/common/analytics.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts similarity index 99% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/common/analytics.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts index f910b8ea8a2338..344a82f4d54d40 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/common/analytics.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts @@ -11,7 +11,7 @@ import { Subscription } from 'rxjs'; import { idx } from '@kbn/elastic-idx'; import { cloneDeep } from 'lodash'; import { ml } from '../../services/ml_api_service'; -import { Dictionary } from '../../../common/types/common'; +import { Dictionary } from '../../../../common/types/common'; import { getErrorMessage } from '../pages/analytics_management/hooks/use_create_analytics_form'; import { SavedSearchQuery } from '../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/common/fields.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/fields.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/common/fields.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/fields.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/common/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/common/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/_exploration.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/_exploration.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/_exploration.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/_exploration.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/common.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/common.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/common.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/common.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/common.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/common.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/common.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/common.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx index fea4c861551a3d..c4bba08353d843 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/exploration.tsx @@ -35,7 +35,7 @@ import euiThemeDark from '@elastic/eui/dist/eui_theme_dark.json'; import { ColumnType, - MlInMemoryTableBasic, + mlInMemoryTableBasicFactory, OnTableChangeArg, SortingPropType, SORT_DIRECTION, @@ -59,7 +59,7 @@ import { } from '../../../../common'; import { getOutlierScoreFieldName } from './common'; -import { useExploreData } from './use_explore_data'; +import { useExploreData, TableItem } from './use_explore_data'; import { DATA_FRAME_TASK_STATE, Query as QueryType, @@ -167,7 +167,7 @@ export const Exploration: FC = React.memo(({ jobId, jobStatus }) => { docFieldsCount = docFields.length; } - const columns: ColumnType[] = []; + const columns: Array> = []; if (jobConfig !== undefined && selectedFields.length > 0 && tableItems.length > 0) { // table cell color coding takes into account: @@ -188,7 +188,7 @@ export const Exploration: FC = React.memo(({ jobId, jobStatus }) => { columns.push( ...selectedFields.sort(sortColumns(tableItems[0], jobConfig.dest.results_field)).map(k => { - const column: ColumnType = { + const column: ColumnType = { field: k, name: k, sortable: true, @@ -425,6 +425,8 @@ export const Exploration: FC = React.memo(({ jobId, jobStatus }) => { }); } + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + return ( diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts similarity index 99% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts index a0728e0bae4463..e76cbaa463f1d4 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration/use_explore_data.ts @@ -27,7 +27,7 @@ import { import { getOutlierScoreFieldName } from './common'; import { SavedSearchQuery } from '../../../../../contexts/kibana'; -type TableItem = Record; +export type TableItem = Record; interface LoadExploreDataArg { field: string; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_regression_exploration.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_regression_exploration.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_regression_exploration.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/_regression_exploration.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/error_callout.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/error_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/error_callout.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/error_callout.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_panel.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_stat.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_stat.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_stat.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/evaluate_stat.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/regression_exploration.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/regression_exploration.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/regression_exploration.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/regression_exploration.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx index ec504492e0a5e0..37c2e40c89c3c2 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/results_table.tsx @@ -30,7 +30,7 @@ import { Query as QueryType } from '../../../analytics_management/components/ana import { ColumnType, - MlInMemoryTableBasic, + mlInMemoryTableBasicFactory, OnTableChangeArg, SortingPropType, SORT_DIRECTION, @@ -55,7 +55,7 @@ import { import { getTaskStateBadge } from '../../../analytics_management/components/analytics_list/columns'; import { DATA_FRAME_TASK_STATE } from '../../../analytics_management/components/analytics_list/common'; -import { useExploreData } from './use_explore_data'; +import { useExploreData, TableItem } from './use_explore_data'; import { ExplorationTitle } from './regression_exploration'; const PAGE_SIZE_OPTIONS = [5, 10, 25, 50]; @@ -108,12 +108,12 @@ export const ResultsTable: FC = React.memo( docFieldsCount = docFields.length; } - const columns: ColumnType[] = []; + const columns: Array> = []; if (jobConfig !== undefined && selectedFields.length > 0 && tableItems.length > 0) { columns.push( ...selectedFields.sort(sortRegressionResultsColumns(tableItems[0], jobConfig)).map(k => { - const column: ColumnType = { + const column: ColumnType = { field: k, name: k, sortable: true, @@ -363,6 +363,8 @@ export const ResultsTable: FC = React.memo( ? errorMessage : searchError; + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + return ( diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts similarity index 99% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts index bf3565abd8de45..3a83ad238d0e19 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/regression_exploration/use_explore_data.ts @@ -31,7 +31,7 @@ import { SearchQuery, } from '../../../../common'; -type TableItem = Record; +export type TableItem = Record; interface LoadExploreDataArg { field: string; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/directive.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/directive.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/directive.tsx index 76df839b9346bf..c41285f40d64b2 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/directive.tsx @@ -14,7 +14,7 @@ const module = uiModules.get('apps/ml', ['react']); import { IndexPatterns } from 'ui/index_patterns'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../common/types/angular'; +import { InjectorService } from '../../../../../common/types/angular'; import { createSearchItems } from '../../../jobs/new_job/utils/new_job_utils'; import { KibanaConfigTypeFix, KibanaContext } from '../../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/route.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/route.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/route.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_list_item.json b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_list_item.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_list_item.json rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_list_item.json diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_stats.json b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_stats.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_stats.json rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/__mocks__/analytics_stats.json diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/_analytics_table.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/_analytics_table.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/_analytics_table.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/_analytics_table.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_delete.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_start.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_start.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/action_start.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/action_start.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/actions.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/actions.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/actions.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/actions.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx index 6de278cda16e6b..f98ce486f7337c 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/analytics_list.tsx @@ -34,7 +34,7 @@ import { getColumns } from './columns'; import { ExpandedRow } from './expanded_row'; import { ProgressBar, - MlInMemoryTable, + mlInMemoryTableFactory, OnTableChangeArg, SortDirection, SORT_DIRECTION, @@ -326,6 +326,8 @@ export const DataFrameAnalyticsList: FC = ({ setSortDirection(direction); }; + const MlInMemoryTable = mlInMemoryTableFactory(); + return ( diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/columns.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/columns.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/columns.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/columns.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/common.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/common.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/common.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/common.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/common.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_details_pane.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_details_pane.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_details_pane.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_details_pane.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_json_pane.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_json_pane.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_json_pane.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_json_pane.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx index e639f32116d4ae..fc860251bf83d7 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/expanded_row_messages_pane.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { ml } from '../../../../../services/ml_api_service'; import { useRefreshAnalyticsList } from '../../../../common'; import { JobMessages } from '../../../../../components/job_messages'; -import { JobMessage } from '../../../../../../common/types/audit_message'; +import { JobMessage } from '../../../../../../../common/types/audit_message'; interface Props { analyticsId: string; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/progress_bar.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/progress_bar.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/progress_bar.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/progress_bar.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts index cfd900b303aa3d..4ccfa8a562c6ce 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_refresh_interval.ts @@ -11,7 +11,7 @@ import { timefilter } from 'ui/timefilter'; import { DEFAULT_REFRESH_INTERVAL_MS, MINIMUM_REFRESH_INTERVAL_MS, -} from '../../../../../../common/constants/jobs_list'; +} from '../../../../../../../common/constants/jobs_list'; import { useRefreshAnalyticsList } from '../../../../common'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/create_analytics_advanced_editor.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_advanced_editor/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx index 027acf6fa2e798..15f30b6cca6c48 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.test.tsx @@ -6,7 +6,7 @@ import { mount } from 'enzyme'; import React from 'react'; -import { mountHook } from '../../../../../../../../../test_utils/enzyme_helpers'; +import { mountHook } from '../../../../../../../../../../test_utils/enzyme_helpers'; import { CreateAnalyticsButton } from './create_analytics_button'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/create_analytics_button.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_button/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_button/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_create_analytics_flyout.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_create_analytics_flyout.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_create_analytics_flyout.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_create_analytics_flyout.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx index 2bcc7305c5df7d..880a1354e7a649 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.test.tsx @@ -6,7 +6,7 @@ import { mount } from 'enzyme'; import React from 'react'; -import { mountHook } from '../../../../../../../../../test_utils/enzyme_helpers'; +import { mountHook } from '../../../../../../../../../../test_utils/enzyme_helpers'; import { CreateAnalyticsFlyout } from './create_analytics_flyout'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/create_analytics_flyout.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/create_analytics_flyout_wrapper.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/create_analytics_flyout_wrapper.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/create_analytics_flyout_wrapper.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/create_analytics_flyout_wrapper.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_flyout_wrapper/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_create_analytics_form.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_create_analytics_form.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_create_analytics_form.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_create_analytics_form.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_index.scss b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_index.scss rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx index 846397aa939294..592b53dcecba0b 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.test.tsx @@ -6,7 +6,7 @@ import { mount } from 'enzyme'; import React from 'react'; -import { mountHook } from '../../../../../../../../../test_utils/enzyme_helpers'; +import { mountHook } from '../../../../../../../../../../test_utils/enzyme_helpers'; import { CreateAnalyticsForm } from './create_analytics_form'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx index 598f88387f4103..47af274424c444 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/create_analytics_form.tsx @@ -22,7 +22,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { metadata } from 'ui/metadata'; import { IndexPattern, INDEX_PATTERN_ILLEGAL_CHARACTERS } from 'ui/index_patterns'; import { ml } from '../../../../../services/ml_api_service'; -import { Field, EVENT_RATE_FIELD_ID } from '../../../../../../common/types/fields'; +import { Field, EVENT_RATE_FIELD_ID } from '../../../../../../../common/types/fields'; import { newJobCapsService } from '../../../../../services/new_job_capabilities_service'; import { useKibanaContext } from '../../../../../contexts/kibana'; @@ -32,7 +32,7 @@ import { DEFAULT_MODEL_MEMORY_LIMIT, getJobConfigFromFormState, } from '../../hooks/use_create_analytics_form/state'; -import { JOB_ID_MAX_LENGTH } from '../../../../../../common/constants/validation'; +import { JOB_ID_MAX_LENGTH } from '../../../../../../../common/constants/validation'; import { Messages } from './messages'; import { JobType } from './job_type'; import { mmlUnitInvalidErrorMessage } from '../../hooks/use_create_analytics_form/reducer'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/job_type.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/job_type.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/job_type.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/job_type.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/messages.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/messages.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/create_analytics_form/messages.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/create_analytics_form/messages.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/refresh_analytics_list_button.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/refresh_analytics_list_button.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/refresh_analytics_list_button.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/refresh_analytics_list_button/refresh_analytics_list_button.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/directive.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/directive.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/directive.tsx index 63ddedaf65689a..8299ff53393bb4 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/directive.tsx @@ -13,7 +13,7 @@ const module = uiModules.get('apps/ml', ['react']); import { IndexPatterns } from 'ui/index_patterns'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../common/types/angular'; +import { InjectorService } from '../../../../../common/types/angular'; import { createSearchItems } from '../../../jobs/new_job/utils/new_job_utils'; import { KibanaConfigTypeFix, KibanaContext } from '../../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/actions.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/actions.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/actions.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/actions.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts index f0fa2ad3b66db8..56d09169a3c390 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/reducer.ts @@ -9,19 +9,19 @@ import { i18n } from '@kbn/i18n'; import { validateIndexPattern } from 'ui/index_patterns'; -import { isValidIndexName } from '../../../../../../common/util/es_utils'; +import { isValidIndexName } from '../../../../../../../common/util/es_utils'; import { Action, ACTION } from './actions'; import { getInitialState, getJobConfigFromFormState, State, JOB_TYPES } from './state'; import { isJobIdValid, validateModelMemoryLimitUnits, -} from '../../../../../../common/util/job_utils'; -import { maxLengthValidator } from '../../../../../../common/util/validators'; +} from '../../../../../../../common/util/job_utils'; +import { maxLengthValidator } from '../../../../../../../common/util/validators'; import { JOB_ID_MAX_LENGTH, ALLOWED_DATA_UNITS, -} from '../../../../../../common/constants/validation'; +} from '../../../../../../../common/constants/validation'; import { getDependentVar, isRegressionAnalysis } from '../../../../common/analytics'; const mmlAllowedUnitsStr = `${ALLOWED_DATA_UNITS.slice(0, ALLOWED_DATA_UNITS.length - 1).join( diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts index b90317015c8c9c..f911b5a45e158c 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts +++ b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/state.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { DeepPartial } from '../../../../../../common/types/common'; +import { DeepPartial } from '../../../../../../../common/types/common'; import { checkPermission } from '../../../../../privilege/check_privilege'; import { mlNodesAvailable } from '../../../../../ml_nodes_check/check_ml_nodes'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/hooks/use_create_analytics_form/use_create_analytics_form.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/route.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/route.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/route.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/delete_analytics.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/delete_analytics.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/delete_analytics.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/delete_analytics.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.test.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/get_analytics.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/index.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/index.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/index.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/start_analytics.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/start_analytics.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/start_analytics.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/start_analytics.ts diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/stop_analytics.ts b/x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/stop_analytics.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/services/analytics_service/stop_analytics.ts rename to x-pack/legacy/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/stop_analytics.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/breadcrumbs.ts similarity index 84% rename from x-pack/legacy/plugins/ml/public/datavisualizer/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/breadcrumbs.ts index 5534b37a6e4279..a4d1fd37bc3383 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/breadcrumbs.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ML_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB } from '../breadcrumbs'; +import { ML_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB } from '../../breadcrumbs'; export function getDataVisualizerBreadcrumbs() { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/datavisualizer_selector.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/directive.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/_file_datavisualizer.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/_file_datavisualizer.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/_file_datavisualizer.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/_file_datavisualizer.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/breadcrumbs.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/breadcrumbs.ts index 3e3f7e986b3d77..e8dd89f5db2647 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/breadcrumbs.ts @@ -5,7 +5,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ML_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB } from '../../breadcrumbs'; +import { ML_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB } from '../../../breadcrumbs'; export function getFileDataVisualizerBreadcrumbs() { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/_about_panel.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_about_panel.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/_about_panel.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_about_panel.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/about_panel.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/about_panel.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/about_panel.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/about_panel.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/welcome_content.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/welcome_content.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/about_panel/welcome_content.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/about_panel/welcome_content.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/_analysis_summary.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/_analysis_summary.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/_analysis_summary.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/_analysis_summary.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/analysis_summary.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/analysis_summary.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/analysis_summary.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/analysis_summary.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/analysis_summary/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/analysis_summary/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/bottom_bar/bottom_bar.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/bottom_bar.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/bottom_bar/bottom_bar.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/bottom_bar.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/bottom_bar/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/bottom_bar/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/bottom_bar/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/__snapshots__/overrides.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_edit_flyout.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/edit_flyout.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/edit_flyout.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/edit_flyout.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/edit_flyout.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/option_lists.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/option_lists.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/option_lists.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/option_lists.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/options.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/options.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/options/options.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/options/options.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides.test.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides.test.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides.test.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides_validation.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides_validation.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/edit_flyout/overrides_validation.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/edit_flyout/overrides_validation.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_experimental_badge.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/experimental_badge.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/experimental_badge.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/experimental_badge.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/experimental_badge.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/experimental_badge/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/experimental_badge/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_field_stats_card.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_fields_stats.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_fields_stats.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_fields_stats.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_fields_stats.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/field_stats_card.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/field_stats_card.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/field_stats_card.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/field_stats_card.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/fields_stats.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/fields_stats.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/fields_stats.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/fields_stats.js index e1a5bfba3fd1ef..c64a695772dde4 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/fields_stats.js +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/fields_stats.js @@ -11,7 +11,7 @@ import React, { import { FieldStatsCard } from './field_stats_card'; import { getFieldNames } from './get_field_names'; -import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; import { roundToDecimalPlace } from '../../../../formatters/round_to_decimal_place'; export class FieldsStats extends Component { diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/get_field_names.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/get_field_names.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/get_field_names.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/get_field_names.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/fields_stats/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/fields_stats/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/_file_contents.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_file_contents.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/_file_contents.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_file_contents.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/file_contents.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/file_contents.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/file_contents.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/file_contents.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_contents/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_contents/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/_file_datavisualizer_view.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/_file_datavisualizer_view.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/_file_datavisualizer_view.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/_file_datavisualizer_view.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/constants.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/constants.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/constants.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/constants.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js index 852f068ef419f4..1f249dcdb01280 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_datavisualizer_view.js @@ -23,7 +23,7 @@ import { ResultsView } from '../results_view'; import { FileCouldNotBeRead, FileTooLarge } from './file_error_callouts'; import { EditFlyout } from '../edit_flyout'; import { ImportView } from '../import_view'; -import { MAX_BYTES } from '../../../../../common/constants/file_datavisualizer'; +import { MAX_BYTES } from '../../../../../../common/constants/file_datavisualizer'; import { readFile, createUrlOverrides, diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/file_error_callouts.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/file_datavisualizer_view/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/file_datavisualizer_view/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_errors/errors.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/errors.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_errors/errors.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/errors.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_errors/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_errors/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_errors/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_progress/import_progress.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/import_progress.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_progress/import_progress.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/import_progress.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_progress/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_progress/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_progress/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/advanced.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/advanced.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/advanced.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/advanced.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/import_settings.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/import_settings.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/import_settings.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/import_settings.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/simple.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/simple.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_settings/simple.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_settings/simple.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/_import_sumary.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_import_sumary.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/_import_sumary.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_import_sumary.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/import_summary.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/import_summary.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/import_summary.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/import_summary.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_summary/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_summary/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/import_view.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/import_view.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/import_view.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/import_view.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/csv_importer.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/csv_importer.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/csv_importer.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/csv_importer.js index ac03bec8c25343..a3850b3def18d1 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/csv_importer.js +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/csv_importer.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; +import { ES_FIELD_TYPES } from '../../../../../../../../../../../src/plugins/data/public'; import { Importer } from './importer'; import Papa from 'papaparse'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/importer.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/importer.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/importer_factory.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer_factory.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/importer_factory.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/importer_factory.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/ndjson_importer.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/ndjson_importer.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/ndjson_importer.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/ndjson_importer.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/sst_importer.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/sst_importer.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/importer/sst_importer.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/importer/sst_importer.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/import_view/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/import_view/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_links/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_links/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_links/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_links/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_links/results_links.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_links/results_links.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/_results_view.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_results_view.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/_results_view.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/_results_view.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/results_view.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/results_view.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/results_view/results_view.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/results_view/results_view.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/index.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/index.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/index.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/overrides.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/overrides.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/overrides.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/overrides.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/utils.js b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/components/utils/utils.js rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/components/utils/utils.js diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx index eefa9e461697e0..3776245d90c819 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer.tsx @@ -12,7 +12,7 @@ import { KibanaConfigTypeFix } from '../../contexts/kibana'; import { NavigationMenu } from '../../components/navigation_menu'; // @ts-ignore -import { FileDataVisualizerView } from './components/file_datavisualizer_view'; +import { FileDataVisualizerView } from './components/file_datavisualizer_view/index'; export interface FileDataVisualizerPageProps { indexPatterns: IndexPatterns; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer_directive.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer_directive.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer_directive.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer_directive.tsx index 6a147aa1a991b4..291e03a96e85f8 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer_directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/file_datavisualizer_directive.tsx @@ -17,7 +17,7 @@ import uiRoutes from 'ui/routes'; import { IndexPatterns } from 'ui/index_patterns'; import { KibanaConfigTypeFix } from '../../contexts/kibana'; import { getFileDataVisualizerBreadcrumbs } from './breadcrumbs'; -import { InjectorService } from '../../../common/types/angular'; +import { InjectorService } from '../../../../common/types/angular'; import { checkBasicLicense } from '../../license/check_license'; import { checkFindFileStructurePrivilege } from '../../privilege/check_privilege'; import { getMlNodeCount } from '../../ml_nodes_check/check_ml_nodes'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/file_based/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/file_based/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/breadcrumbs.ts similarity index 95% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/breadcrumbs.ts index 03c66335ddb6cc..aba45e04c638fd 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/breadcrumbs.ts @@ -9,7 +9,7 @@ import { ML_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB, // @ts-ignore -} from '../../breadcrumbs'; +} from '../../../breadcrumbs'; export function getDataVisualizerBreadcrumbs() { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/field_vis_config.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/field_vis_config.ts similarity index 88% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/field_vis_config.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/field_vis_config.ts index 55b8f136316114..bf39cbb90e8f30 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/field_vis_config.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/field_vis_config.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; // The internal representation of the configuration used to build the visuals // which display the field information. diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/request.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/request.ts similarity index 81% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/request.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/request.ts index 83acda0419a0ca..9a886cbc899c24 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/common/request.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/common/request.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; export interface FieldRequestConfig { fieldName?: string; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/actions_panel/actions_panel.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/actions_panel/actions_panel.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/actions_panel/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/actions_panel/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/_field_data_card.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/_field_data_card.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/_field_data_card.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/_field_data_card.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/_index.scss b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/_index.scss rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/boolean_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/boolean_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/boolean_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/boolean_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/date_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/date_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/date_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/date_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/document_count_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/document_count_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/document_count_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/document_count_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/geo_point_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/geo_point_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/geo_point_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/geo_point_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/ip_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/ip_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/ip_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/ip_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/keyword_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/keyword_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/keyword_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/keyword_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/not_in_docs_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/not_in_docs_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/not_in_docs_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/not_in_docs_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/number_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/number_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/number_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/number_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/other_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/other_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/other_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/other_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/text_content.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/text_content.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/content_types/text_content.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/content_types/text_content.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/document_count_chart/document_count_chart.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/document_count_chart/document_count_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/document_count_chart/document_count_chart.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/document_count_chart/document_count_chart.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/document_count_chart/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/document_count_chart/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/document_count_chart/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/document_count_chart/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/example.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/example.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/example.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/example.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/examples_list.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/examples_list.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/examples_list.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/examples_list.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/examples_list/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/examples_list/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/field_data_card.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/field_data_card.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/field_data_card.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/field_data_card.tsx index d162d166e8f6bb..0493beed924827 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/field_data_card.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/field_data_card.tsx @@ -6,11 +6,11 @@ import React, { FC } from 'react'; -import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; import { FieldVisConfig } from '../../common'; // @ts-ignore -import { FieldTitleBar } from '../../../../components/field_title_bar'; +import { FieldTitleBar } from '../../../../components/field_title_bar/index'; import { BooleanContent, DateContent, diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/loading_indicator/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/loading_indicator/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/loading_indicator/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/loading_indicator/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/loading_indicator/loading_indicator.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/loading_indicator/loading_indicator.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/loading_indicator/loading_indicator.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/loading_indicator/loading_indicator.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_data_builder.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_data_builder.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_data_builder.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_data_builder.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/metric_distribution_chart/metric_distribution_chart_tooltip_header.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/top_values/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/top_values/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/top_values/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/top_values/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/top_values/top_values.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/top_values/top_values.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_data_card/top_values/top_values.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_data_card/top_values/top_values.tsx diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_types_select/field_types_select.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_types_select/field_types_select.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_types_select/field_types_select.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_types_select/field_types_select.tsx index 80a6f3d2d6743d..6fd08076e1f469 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_types_select/field_types_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_types_select/field_types_select.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { EuiSelect } from '@elastic/eui'; -import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; interface Props { fieldTypes: ML_JOB_FIELD_TYPES[]; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_types_select/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_types_select/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/field_types_select/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/field_types_select/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/fields_panel/fields_panel.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/fields_panel/fields_panel.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/fields_panel/fields_panel.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/fields_panel/fields_panel.tsx index f0b163c5c9e298..e32d1ca17e12eb 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/fields_panel/fields_panel.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/fields_panel/fields_panel.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { toastNotifications } from 'ui/notify'; -import { ML_JOB_FIELD_TYPES } from '../../../../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../../../../common/constants/field_types'; import { FieldDataCard } from '../field_data_card'; import { FieldTypesSelect } from '../field_types_select'; import { FieldVisConfig } from '../../common'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/fields_panel/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/fields_panel/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/fields_panel/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/fields_panel/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/search_panel/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/search_panel/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/search_panel/search_panel.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/search_panel/search_panel.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx index 267be982dead42..a43b680720a2aa 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/components/search_panel/search_panel.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/components/search_panel/search_panel.tsx @@ -23,11 +23,11 @@ import { i18n } from '@kbn/i18n'; import { IndexPattern } from 'ui/index_patterns'; -import { SEARCH_QUERY_LANGUAGE } from '../../../../../common/constants/search'; +import { SEARCH_QUERY_LANGUAGE } from '../../../../../../common/constants/search'; import { SavedSearchQuery } from '../../../../contexts/kibana'; // @ts-ignore -import { KqlFilterBar } from '../../../../components/kql_filter_bar'; +import { KqlFilterBar } from '../../../../components/kql_filter_bar/index'; interface Props { indexPattern: IndexPattern; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/data_loader/data_loader.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/data_loader/data_loader.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts index f0bb998a276145..fe0d69fdeec6b9 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/data_loader/data_loader.ts +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/data_loader.ts @@ -10,7 +10,7 @@ import { toastNotifications } from 'ui/notify'; import { IndexPattern } from 'ui/index_patterns'; import { SavedSearchQuery } from '../../../contexts/kibana'; -import { IndexPatternTitle } from '../../../../common/types/kibana'; +import { IndexPatternTitle } from '../../../../../common/types/kibana'; import { ml } from '../../../services/ml_api_service'; import { FieldRequestConfig } from '../common'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/data_loader/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/data_loader/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/data_loader/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/directive.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/directive.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/directive.tsx index df152b80c315ee..58cd1c2c6fd0c0 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/directive.tsx @@ -13,7 +13,7 @@ const module = uiModules.get('apps/ml', ['react']); import { I18nContext } from 'ui/i18n'; import { IndexPatterns } from 'ui/index_patterns'; -import { InjectorService } from '../../../common/types/angular'; +import { InjectorService } from '../../../../common/types/angular'; import { KibanaConfigTypeFix, KibanaContext } from '../../contexts/kibana/kibana_context'; import { createSearchItems } from '../../jobs/new_job/utils/new_job_utils'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/index.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/index.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/index.ts diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx index cf07fdf0ab2ca0..1caa0686206180 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx +++ b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/page.tsx @@ -22,10 +22,10 @@ import { EuiSpacer, EuiTitle, } from '@elastic/eui'; -import { KBN_FIELD_TYPES, esQuery } from '../../../../../../../src/plugins/data/public'; +import { KBN_FIELD_TYPES, esQuery } from '../../../../../../../../src/plugins/data/public'; import { NavigationMenu } from '../../components/navigation_menu'; -import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; -import { SEARCH_QUERY_LANGUAGE } from '../../../common/constants/search'; +import { ML_JOB_FIELD_TYPES } from '../../../../common/constants/field_types'; +import { SEARCH_QUERY_LANGUAGE } from '../../../../common/constants/search'; import { isFullLicense } from '../../license/check_license'; import { FullTimeRangeSelector } from '../../components/full_time_range_selector'; import { mlTimefilterRefresh$ } from '../../services/timefilter_refresh_service'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts b/x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts rename to x-pack/legacy/plugins/ml/public/application/datavisualizer/index_based/route.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/__mocks__/mock_anomalies_table_data.json b/x-pack/legacy/plugins/ml/public/application/explorer/__mocks__/mock_anomalies_table_data.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/__mocks__/mock_anomalies_table_data.json rename to x-pack/legacy/plugins/ml/public/application/explorer/__mocks__/mock_anomalies_table_data.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/__mocks__/mock_overall_swimlane.json b/x-pack/legacy/plugins/ml/public/application/explorer/__mocks__/mock_overall_swimlane.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/__mocks__/mock_overall_swimlane.json rename to x-pack/legacy/plugins/ml/public/application/explorer/__mocks__/mock_overall_swimlane.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/__snapshots__/explorer_swimlane.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/__snapshots__/explorer_swimlane.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/__snapshots__/explorer_swimlane.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/__snapshots__/explorer_swimlane.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/__tests__/explorer_controller.js b/x-pack/legacy/plugins/ml/public/application/explorer/__tests__/explorer_controller.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/__tests__/explorer_controller.js rename to x-pack/legacy/plugins/ml/public/application/explorer/__tests__/explorer_controller.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/_explorer.scss b/x-pack/legacy/plugins/ml/public/application/explorer/_explorer.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/_explorer.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/_explorer.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/_index.scss b/x-pack/legacy/plugins/ml/public/application/explorer/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/_index.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/breadcrumbs.js b/x-pack/legacy/plugins/ml/public/application/explorer/breadcrumbs.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/explorer/breadcrumbs.js rename to x-pack/legacy/plugins/ml/public/application/explorer/breadcrumbs.js index 9f70505fc8dcad..243adecaec78f1 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/breadcrumbs.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/breadcrumbs.js @@ -5,7 +5,7 @@ */ -import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB } from '../breadcrumbs'; +import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB } from '../../breadcrumbs'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/__snapshots__/explorer_no_influencers_found.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/__snapshots__/explorer_no_influencers_found.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/__snapshots__/explorer_no_influencers_found.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/__snapshots__/explorer_no_influencers_found.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/explorer_no_influencers_found.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_influencers_found/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_influencers_found/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/__snapshots__/explorer_no_jobs_found.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/explorer_no_jobs_found.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_jobs_found/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_jobs_found/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/__snapshots__/explorer_no_results_found.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/__snapshots__/explorer_no_results_found.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/__snapshots__/explorer_no_results_found.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/__snapshots__/explorer_no_results_found.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/explorer_no_results_found.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/explorer_no_results_found.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/explorer_no_results_found.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/explorer_no_results_found.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/explorer_no_results_found.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/explorer_no_results_found.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/explorer_no_results_found.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/explorer_no_results_found.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/explorer_no_results_found/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/explorer_no_results_found/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/components/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/components/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/components/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/components/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/explorer/explorer.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer.js index 1acdd041c40522..985282df18f6a8 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer.js @@ -41,7 +41,7 @@ import { getBoundsRoundedToInterval } from '../util/time_buckets'; import { getSelectedJobIds } from '../components/job_selector/job_select_service_utils'; import { InfluencersList } from '../components/influencers_list'; import { ALLOW_CELL_RANGE_SELECTION, dragSelect$, explorer$ } from './explorer_dashboard_service'; -import { mlResultsService } from 'plugins/ml/services/results_service'; +import { mlResultsService } from '../services/results_service'; import { LoadingIndicator } from '../components/loading_indicator/loading_indicator'; import { NavigationMenu } from '../components/navigation_menu'; import { CheckboxShowCharts, showCharts$ } from '../components/controls/checkbox_showcharts'; @@ -89,7 +89,7 @@ import { SWIMLANE_TYPE, VIEW_BY_JOB_LABEL, } from './explorer_constants'; -import { ML_RESULTS_INDEX_PATTERN } from '../../common/constants/index_patterns'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../common/constants/index_patterns'; // Explorer Charts import { ExplorerChartsContainer } from './explorer_charts/explorer_charts_container'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_anomaly_chart_records.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_anomaly_chart_records.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_anomaly_chart_records.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_anomaly_chart_records.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_anomaly_record.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_anomaly_record.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_anomaly_record.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_anomaly_record.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_chart_data.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_chart_data.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_chart_data.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_chart_data.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_chart_data_rare.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_chart_data_rare.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_chart_data_rare.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_chart_data_rare.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_detectors_by_job.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_detectors_by_job.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_detectors_by_job.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_detectors_by_job.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_job_config.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_job_config.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_job_config.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_job_config.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_config_filebeat.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_config_filebeat.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_config_filebeat.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_config_filebeat.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_config_rare.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_config_rare.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_config_rare.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_config_rare.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_promises_response.json b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_promises_response.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__mocks__/mock_series_promises_response.json rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__mocks__/mock_series_promises_response.json diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_chart_config_builder.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_chart_config_builder.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_chart_config_builder.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_chart_config_builder.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_chart_info_tooltip.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_chart_info_tooltip.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_chart_info_tooltip.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_chart_info_tooltip.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_charts_container_service.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_charts_container_service.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/__snapshots__/explorer_charts_container_service.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/__snapshots__/explorer_charts_container_service.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_chart.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_chart.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_chart.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_chart.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_chart_tooltip.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_chart_tooltip.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_chart_tooltip.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_chart_tooltip.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_charts_container.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_charts_container.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_explorer_charts_container.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_explorer_charts_container.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_index.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/_index.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label_badge.test.js.snap b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label_badge.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label_badge.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/__snapshots__/explorer_chart_label_badge.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label_badge.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label_badge.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label_badge.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_explorer_chart_label_badge.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_index.scss b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/_index.scss rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/explorer_chart_label_badge.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/components/explorer_chart_label/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/components/explorer_chart_label/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_config_builder.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js similarity index 94% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_config_builder.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js index e62707d60a2a12..6d89d2de44498b 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_config_builder.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.js @@ -13,8 +13,8 @@ import _ from 'lodash'; -import { parseInterval } from '../../../common/util/parse_interval'; -import { getEntityFieldList } from '../../../common/util/anomaly_utils'; +import { parseInterval } from '../../../../common/util/parse_interval'; +import { getEntityFieldList } from '../../../../common/util/anomaly_utils'; import { buildConfigFromDetector } from '../../util/chart_config_builder'; import { mlJobService } from '../../services/job_service'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_config_builder.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_config_builder.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_config_builder.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js index 588c3e3d6f1e9f..1544e3a8660013 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.js @@ -21,7 +21,7 @@ import moment from 'moment'; // because it won't work with the jest tests import { formatHumanReadableDateTime } from '../../util/date_utils'; import { formatValue } from '../../formatters/format_value'; -import { getSeverityColor, getSeverityWithLow } from '../../../common/util/anomaly_utils'; +import { getSeverityColor, getSeverityWithLow } from '../../../../common/util/anomaly_utils'; import { getChartType, getTickValues, diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_distribution.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_distribution.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_info_tooltip.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_info_tooltip.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js index be85af5a70c403..963da9e1d5efac 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.js @@ -25,7 +25,7 @@ import { getSeverityColor, getSeverityWithLow, getMultiBucketImpactLabel, -} from '../../../common/util/anomaly_utils'; +} from '../../../../common/util/anomaly_utils'; import { LINE_CHART_ANOMALY_RADIUS, MULTI_BUCKET_SYMBOL_SIZE, diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_chart_single_metric.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_chart_single_metric.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js index 9d7e6e81e48967..01afd9ffb602fd 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js @@ -19,8 +19,8 @@ import { getChartType } from '../../util/chart_utils'; -import { getEntityFieldList } from '../../../common/util/anomaly_utils'; -import { isSourceDataChartableForDetector, isModelPlotEnabled } from '../../../common/util/job_utils'; +import { getEntityFieldList } from '../../../../common/util/anomaly_utils'; +import { isSourceDataChartableForDetector, isModelPlotEnabled } from '../../../../common/util/job_utils'; import { mlResultsService } from '../../services/results_service'; import { mlJobService } from '../../services/job_service'; import { severity$ } from '../../components/controls/select_severity/select_severity'; @@ -124,7 +124,7 @@ export function explorerChartsContainerServiceFactory(callback) { range.min, range.max, config.interval - ); + ).toPromise(); } else { // Extract the partition, by, over fields on which to filter. const criteriaFields = []; @@ -169,7 +169,7 @@ export function explorerChartsContainerServiceFactory(callback) { range.min, range.max, interval - ) + ).toPromise() .then((resp) => { // Return data in format required by the explorer charts. const results = resp.results; @@ -201,7 +201,7 @@ export function explorerChartsContainerServiceFactory(callback) { range.min, range.max, ANOMALIES_MAX_RESULTS - ); + ).toPromise(); } // Query 3 - load any scheduled events for the job. @@ -213,7 +213,7 @@ export function explorerChartsContainerServiceFactory(callback) { config.interval, 1, MAX_SCHEDULED_EVENTS - ); + ).toPromise(); } // Query 4 - load context data distribution diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js similarity index 86% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js index b907cd92df10c1..f8ed067a3de542 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js @@ -47,36 +47,39 @@ jest.mock('../../services/job_service', () => ({ } })); -jest.mock('../../services/results_service', () => ({ - mlResultsService: { - getMetricData(indices) { +jest.mock('../../services/results_service', () => { + const { of } = require('rxjs'); + return { + mlResultsService: { + getMetricData(indices) { // this is for 'call anomalyChangeListener with actual series config' - if (indices[0] === 'farequote-2017') { - return Promise.resolve(mockSeriesPromisesResponse[0][0]); - } - // this is for 'filtering should skip values of null' - return Promise.resolve(mockMetricClone); - }, - getRecordsForCriteria() { - return Promise.resolve(mockSeriesPromisesResponse[0][1]); - }, - getScheduledEventsByBucket() { - return Promise.resolve(mockSeriesPromisesResponse[0][2]); - }, - getEventDistributionData(indices) { + if (indices[0] === 'farequote-2017') { + return of(mockSeriesPromisesResponse[0][0]); + } + // this is for 'filtering should skip values of null' + return of(mockMetricClone); + }, + getRecordsForCriteria() { + return of(mockSeriesPromisesResponse[0][1]); + }, + getScheduledEventsByBucket() { + return of(mockSeriesPromisesResponse[0][2]); + }, + getEventDistributionData(indices) { // this is for 'call anomalyChangeListener with actual series config' - if (indices[0] === 'farequote-2017') { - return Promise.resolve([]); + if (indices[0] === 'farequote-2017') { + return Promise.resolve([]); + } + // this is for 'filtering should skip values of null' and + // resolves with a dummy object to trigger the processing + // of the event distribution chartdata filtering + return Promise.resolve([{ + entity: 'mock' + }]); } - // this is for 'filtering should skip values of null' and - // resolves with a dummy object to trigger the processing - // of the event distribution chartdata filtering - return Promise.resolve([{ - entity: 'mock' - }]); } - } -})); + }; +}); jest.mock('../../util/string_utils', () => ({ mlEscape(d) { return d; } diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/explorer_charts_container_service.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/index.js similarity index 84% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_charts/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/index.js index 46e1b19edfed23..6d799758188709 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_charts/index.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_charts/index.js @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import 'plugins/ml/components/chart_tooltip'; +import '../../components/chart_tooltip'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_constants.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_constants.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_constants.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_constants.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_controller.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_controller.js index 3bedd90f05c374..c33b86bacf9421 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_controller.js @@ -24,10 +24,10 @@ import { getAnomalyExplorerBreadcrumbs } from './breadcrumbs'; import { checkFullLicense } from '../license/check_license'; import { checkGetJobsPrivilege } from '../privilege/check_privilege'; import { loadIndexPatterns } from '../util/index_utils'; -import { TimeBuckets } from 'plugins/ml/util/time_buckets'; +import { TimeBuckets } from '../util/time_buckets'; import { explorer$ } from './explorer_dashboard_service'; import { mlTimefilterRefresh$ } from '../services/timefilter_refresh_service'; -import { mlFieldFormatService } from 'plugins/ml/services/field_format_service'; +import { mlFieldFormatService } from '../services/field_format_service'; import { mlJobService } from '../services/job_service'; import { getSelectedJobIds, jobSelectServiceFactory } from '../components/job_selector/job_select_service_utils'; import { timefilter } from 'ui/timefilter'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_dashboard_service.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_dashboard_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_dashboard_service.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_dashboard_service.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_react_wrapper_directive.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_react_wrapper_directive.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_react_wrapper_directive.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_react_wrapper_directive.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.js index 2ee725b6fda865..bd35241ff4e85e 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.js @@ -21,7 +21,7 @@ import moment from 'moment'; // because it won't work with the jest tests import { formatHumanReadableDateTime } from '../util/date_utils'; import { numTicksForDateFormat } from '../util/chart_utils'; -import { getSeverityColor } from '../../common/util/anomaly_utils'; +import { getSeverityColor } from '../../../common/util/anomaly_utils'; import { mlEscape } from '../util/string_utils'; import { mlChartTooltipService } from '../components/chart_tooltip/chart_tooltip_service'; import { ALLOW_CELL_RANGE_SELECTION, dragSelect$ } from './explorer_dashboard_service'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_swimlane.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_swimlane.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_utils.js b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/explorer/explorer_utils.js rename to x-pack/legacy/plugins/ml/public/application/explorer/explorer_utils.js index 2f8b259b594bb1..5ca8681d167494 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_utils.js +++ b/x-pack/legacy/plugins/ml/public/application/explorer/explorer_utils.js @@ -10,12 +10,12 @@ import { chain, each, get, union, uniq } from 'lodash'; -import { getEntityFieldList } from '../../common/util/anomaly_utils'; -import { isSourceDataChartableForDetector, isModelPlotEnabled } from '../../common/util/job_utils'; -import { parseInterval } from '../../common/util/parse_interval'; +import { getEntityFieldList } from '../../../common/util/anomaly_utils'; +import { isSourceDataChartableForDetector, isModelPlotEnabled } from '../../../common/util/job_utils'; +import { parseInterval } from '../../../common/util/parse_interval'; import { ml } from '../services/ml_api_service'; import { mlJobService } from '../services/job_service'; -import { mlResultsService } from 'plugins/ml/services/results_service'; +import { mlResultsService } from '../services/results_service'; import { MAX_CATEGORY_EXAMPLES, @@ -26,7 +26,7 @@ import { import { ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE, ANOMALIES_TABLE_DEFAULT_QUERY_SIZE -} from '../../common/constants/search'; +} from '../../../common/constants/search'; import { i18n } from '@kbn/i18n'; import chrome from 'ui/chrome'; @@ -417,7 +417,7 @@ export function loadAnnotationsTableData(selectedCells, selectedJobs, interval, earliestMs: timeRange.earliestMs, latestMs: timeRange.latestMs, maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE - }).then((resp) => { + }).toPromise().then((resp) => { if (resp.error !== undefined || resp.annotations === undefined) { return resolve([]); } @@ -477,7 +477,7 @@ export async function loadAnomaliesTableData( ANOMALIES_TABLE_DEFAULT_QUERY_SIZE, MAX_CATEGORY_EXAMPLES, influencersFilterQuery - ).then((resp) => { + ).toPromise().then((resp) => { const anomalies = resp.anomalies; const detectorsByJob = mlJobService.detectorsByJob; anomalies.forEach((anomaly) => { diff --git a/x-pack/legacy/plugins/ml/public/application/explorer/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/index.js new file mode 100644 index 00000000000000..ebd3eb9c12662c --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/explorer/index.js @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + + + +import '../explorer/explorer_controller'; +import '../explorer/explorer_dashboard_service'; +import '../explorer/explorer_react_wrapper_directive'; +import '../explorer/explorer_charts'; +import '../explorer/select_limit'; +import '../components/job_selector'; diff --git a/x-pack/legacy/plugins/ml/public/explorer/legacy_utils.js b/x-pack/legacy/plugins/ml/public/application/explorer/legacy_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/legacy_utils.js rename to x-pack/legacy/plugins/ml/public/application/explorer/legacy_utils.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/select_limit/index.js b/x-pack/legacy/plugins/ml/public/application/explorer/select_limit/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/select_limit/index.js rename to x-pack/legacy/plugins/ml/public/application/explorer/select_limit/index.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit.js b/x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit.js rename to x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit.test.js b/x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit.test.js rename to x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit.test.js diff --git a/x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit_service.js b/x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/explorer/select_limit/select_limit_service.js rename to x-pack/legacy/plugins/ml/public/application/explorer/select_limit/select_limit_service.js diff --git a/x-pack/legacy/plugins/ml/public/formatters/abbreviate_whole_number.test.ts b/x-pack/legacy/plugins/ml/public/application/formatters/abbreviate_whole_number.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/abbreviate_whole_number.test.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/abbreviate_whole_number.test.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/abbreviate_whole_number.ts b/x-pack/legacy/plugins/ml/public/application/formatters/abbreviate_whole_number.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/abbreviate_whole_number.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/abbreviate_whole_number.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/format_value.test.ts b/x-pack/legacy/plugins/ml/public/application/formatters/format_value.test.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/formatters/format_value.test.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/format_value.test.ts index 5f146aef97fccf..bfed06a537a878 100644 --- a/x-pack/legacy/plugins/ml/public/formatters/format_value.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/formatters/format_value.test.ts @@ -5,7 +5,7 @@ */ import moment from 'moment-timezone'; -import { AnomalyRecordDoc } from '../../common/types/anomalies'; +import { AnomalyRecordDoc } from '../../../common/types/anomalies'; import { formatValue } from './format_value'; describe('ML - formatValue formatter', () => { diff --git a/x-pack/legacy/plugins/ml/public/formatters/format_value.ts b/x-pack/legacy/plugins/ml/public/application/formatters/format_value.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/formatters/format_value.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/format_value.ts index 9360957c4a9119..abafe656151566 100644 --- a/x-pack/legacy/plugins/ml/public/formatters/format_value.ts +++ b/x-pack/legacy/plugins/ml/public/application/formatters/format_value.ts @@ -12,7 +12,7 @@ */ import moment from 'moment'; -import { AnomalyRecordDoc } from '../../common/types/anomalies'; +import { AnomalyRecordDoc } from '../../../common/types/anomalies'; const SIGFIGS_IF_ROUNDING = 3; // Number of sigfigs to use for values < 10 // Formats the value of an actual or typical field from a machine learning anomaly record. diff --git a/x-pack/legacy/plugins/ml/public/formatters/kibana_field_format.ts b/x-pack/legacy/plugins/ml/public/application/formatters/kibana_field_format.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/kibana_field_format.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/kibana_field_format.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/metric_change_description.test.ts b/x-pack/legacy/plugins/ml/public/application/formatters/metric_change_description.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/metric_change_description.test.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/metric_change_description.test.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/metric_change_description.ts b/x-pack/legacy/plugins/ml/public/application/formatters/metric_change_description.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/metric_change_description.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/metric_change_description.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/number_as_ordinal.test.ts b/x-pack/legacy/plugins/ml/public/application/formatters/number_as_ordinal.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/number_as_ordinal.test.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/number_as_ordinal.test.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/number_as_ordinal.ts b/x-pack/legacy/plugins/ml/public/application/formatters/number_as_ordinal.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/number_as_ordinal.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/number_as_ordinal.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/round_to_decimal_place.test.ts b/x-pack/legacy/plugins/ml/public/application/formatters/round_to_decimal_place.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/round_to_decimal_place.test.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/round_to_decimal_place.test.ts diff --git a/x-pack/legacy/plugins/ml/public/formatters/round_to_decimal_place.ts b/x-pack/legacy/plugins/ml/public/application/formatters/round_to_decimal_place.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/formatters/round_to_decimal_place.ts rename to x-pack/legacy/plugins/ml/public/application/formatters/round_to_decimal_place.ts diff --git a/x-pack/legacy/plugins/ml/public/hacks/toggle_app_link_in_nav.js b/x-pack/legacy/plugins/ml/public/application/hacks/toggle_app_link_in_nav.js similarity index 90% rename from x-pack/legacy/plugins/ml/public/hacks/toggle_app_link_in_nav.js rename to x-pack/legacy/plugins/ml/public/application/hacks/toggle_app_link_in_nav.js index 892d530c327350..7c6d8345736b50 100644 --- a/x-pack/legacy/plugins/ml/public/hacks/toggle_app_link_in_nav.js +++ b/x-pack/legacy/plugins/ml/public/application/hacks/toggle_app_link_in_nav.js @@ -4,9 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ - - -import { xpackInfo } from 'plugins/xpack_main/services/xpack_info'; +import { xpackInfo } from '../../../../xpack_main/public/services/xpack_info'; import { uiModules } from 'ui/modules'; import { npStart } from 'ui/new_platform'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/jobs/breadcrumbs.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/breadcrumbs.ts index 35e9c3326a4ccf..f2954548ea5474 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/breadcrumbs.ts @@ -10,7 +10,7 @@ import { ANOMALY_DETECTION_BREADCRUMB, DATA_VISUALIZER_BREADCRUMB, ML_BREADCRUMB, -} from '../breadcrumbs'; +} from '../../breadcrumbs'; export function getJobManagementBreadcrumbs(): Breadcrumb[] { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/__snapshots__/editor.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/__snapshots__/list.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/__snapshots__/list.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/__snapshots__/list.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/_custom_url_editor.scss b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/_custom_url_editor.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/_custom_url_editor.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/_custom_url_editor.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/constants.ts b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/constants.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/constants.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/constants.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/editor.js b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/editor.js rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.js index 6edee63a07132f..bbf3c3cfbadcef 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/editor.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.js @@ -28,7 +28,7 @@ import { EuiTitle, } from '@elastic/eui'; -import { isValidCustomUrlSettingsTimeRange } from '../../../jobs/components/custom_url_editor/utils'; +import { isValidCustomUrlSettingsTimeRange } from './utils'; import { isValidLabel } from '../../../util/custom_url_utils'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/editor.test.js b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/editor.test.js rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.test.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/list.test.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/list.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/list.test.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/list.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/list.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/list.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/list.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/list.tsx index c23fdef324da79..ffb552da8ecf37 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/list.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/list.tsx @@ -23,9 +23,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { isValidLabel, openCustomUrlWindow } from '../../../util/custom_url_utils'; import { getTestUrl } from './utils'; -import { parseInterval } from '../../../../common/util/parse_interval'; +import { parseInterval } from '../../../../../common/util/parse_interval'; import { TIME_RANGE_TYPE } from './constants'; -import { KibanaUrlConfig } from '../../../../common/types/custom_urls'; +import { KibanaUrlConfig } from '../../../../../common/types/custom_urls'; import { Job } from '../../new_job/common/job_creator/configs'; function isValidTimeRange(timeRange: KibanaUrlConfig['time_range']): boolean { diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.d.ts b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.d.ts similarity index 83% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.d.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.d.ts index f8f618ae067629..ee9312aace1192 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.d.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.d.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { KibanaUrlConfig } from '../../../../common/types/custom_urls'; +import { KibanaUrlConfig } from '../../../../../common/types/custom_urls'; import { Job } from '../../new_job/common/job_creator/configs'; export function getTestUrl(job: Job, customUrl: KibanaUrlConfig): Promise; diff --git a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.js b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.js rename to x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js index 83317b505d5992..06391ad7895cb2 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/components/custom_url_editor/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js @@ -12,9 +12,9 @@ import { import chrome from 'ui/chrome'; import rison from 'rison-node'; -import { ML_RESULTS_INDEX_PATTERN } from '../../../../common/constants/index_patterns'; -import { getPartitioningFieldNames } from '../../../../common/util/job_utils'; -import { parseInterval } from '../../../../common/util/parse_interval'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../../../common/constants/index_patterns'; +import { getPartitioningFieldNames } from '../../../../../common/util/job_utils'; +import { parseInterval } from '../../../../../common/util/parse_interval'; import { replaceTokensInUrlValue, isValidLabel } from '../../../util/custom_url_utils'; import { ml } from '../../../services/ml_api_service'; import { mlJobService } from '../../../services/job_service'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/_jobs_list.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/_jobs_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/_jobs_list.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/_jobs_list.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_flyout.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_flyout.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_flyout.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_flyout.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_service.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_service.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_service.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js index 716ece4b0e2dcd..248096ffbd8257 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/create_watch_view.js @@ -27,7 +27,7 @@ import { has } from 'lodash'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; -import { parseInterval } from '../../../../../common/util/parse_interval'; +import { parseInterval } from '../../../../../../common/util/parse_interval'; import { ml } from '../../../../services/ml_api_service'; import { SelectSeverity } from '../../../../components/controls/select_severity/select_severity'; import { mlCreateWatchService } from './create_watch_service'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/email.html b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/email.html rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/email_influencers.html b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email_influencers.html similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/email_influencers.html rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email_influencers.html diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/watch.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/watch.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/watch.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/watch.js index c45894c36b702d..447869ff8fdb43 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/create_watch_flyout/watch.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/watch.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ML_RESULTS_INDEX_PATTERN } from '../../../../../common/constants/index_patterns'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../../../../common/constants/index_patterns'; export const watch = { trigger: { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js index 9d61d79b1d3e5d..a9a81723244f99 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/delete_job_modal.js @@ -19,7 +19,7 @@ import { } from '@elastic/eui'; import { deleteJobs } from '../utils'; -import { DELETING_JOBS_REFRESH_INTERVAL_MS } from '../../../../../common/constants/jobs_list'; +import { DELETING_JOBS_REFRESH_INTERVAL_MS } from '../../../../../../common/constants/jobs_list'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; export const DeleteJobModal = injectI18n(class extends Component { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/delete_job_modal/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/delete_job_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/delete_job_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/_edit_job_flyout.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/_edit_job_flyout.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/_edit_job_flyout.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/_edit_job_flyout.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_utils.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_utils.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_utils.js index 2b01a848945648..c1c98cddaf3680 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_utils.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_utils.js @@ -8,8 +8,8 @@ import { difference } from 'lodash'; import chrome from 'ui/chrome'; import { getNewJobLimits } from '../../../../services/ml_server_info'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { processCreatedBy } from '../../../../../common/util/job_utils'; +import { mlJobService } from '../../../../services/job_service'; +import { processCreatedBy } from '../../../../../../common/util/job_utils'; export function saveJob(job, newJobData, finish) { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/custom_urls.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/custom_urls.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/custom_urls.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/custom_urls.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js index b09162b0e84cff..a1b4f82e79e66e 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js @@ -18,9 +18,9 @@ import { EuiFieldNumber, } from '@elastic/eui'; -import { calculateDatafeedFrequencyDefaultSeconds } from 'plugins/ml/../common/util/job_utils'; +import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../common/util/job_utils'; import { getNewJobDefaults } from '../../../../../services/ml_server_info'; -import { parseInterval } from 'plugins/ml/../common/util/parse_interval'; +import { parseInterval } from '../../../../../../../common/util/parse_interval'; import { MLJobEditor } from '../../ml_job_editor'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js similarity index 93% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js index 06fe88fcd8714d..5c7d040ddbf270 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/detectors.js @@ -17,8 +17,8 @@ import { EuiSpacer, } from '@elastic/eui'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { detectorToString } from 'plugins/ml/util/string_utils'; +import { mlJobService } from '../../../../../services/job_service'; +import { detectorToString } from '../../../../../util/string_utils'; export class Detectors extends Component { constructor(props) { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js index dbdc19d411481f..3db5cb970315a8 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js @@ -18,7 +18,7 @@ import { EuiComboBox, } from '@elastic/eui'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { ml } from '../../../../../services/ml_api_service'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; class JobDetailsUI extends Component { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/management.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/management.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/management.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/management.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/results.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_actions/results.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_actions/results.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/_job_details.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/_job_details.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/_job_details.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/_job_details.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/datafeed_preview_tab.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/datafeed_preview_tab.js similarity index 92% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/datafeed_preview_tab.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/datafeed_preview_tab.js index b4bc0185191701..a32bb3e1625d27 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/datafeed_preview_tab.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/datafeed_preview_tab.js @@ -17,9 +17,9 @@ import { EuiLoadingSpinner } from '@elastic/eui'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { checkPermission } from 'plugins/ml/privilege/check_privilege'; -import { ML_DATA_PREVIEW_COUNT } from 'plugins/ml/../common/util/job_utils'; +import { mlJobService } from '../../../../services/job_service'; +import { checkPermission } from '../../../../privilege/check_privilege'; +import { ML_DATA_PREVIEW_COUNT } from '../../../../../../common/util/job_utils'; import { MLJobEditor } from '../ml_job_editor'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/extract_job_details.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/extract_job_details.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js index 4586109512c1c3..028e6a10d6abcf 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/extract_job_details.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/extract_job_details.js @@ -7,7 +7,7 @@ import React from 'react'; import { EuiLink } from '@elastic/eui'; import chrome from 'ui/chrome'; -import { detectorToString } from 'plugins/ml/util/string_utils'; +import { detectorToString } from '../../../../util/string_utils'; import { formatValues, filterObjects } from './format_values'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js index 369b9711ab9389..3df869174c146b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js @@ -25,11 +25,11 @@ import { import { formatDate, formatNumber } from '@elastic/eui/lib/services/format'; import chrome from 'ui/chrome'; -import { FORECAST_REQUEST_STATE } from 'plugins/ml/../common/constants/states'; -import { addItemToRecentlyAccessed } from 'plugins/ml/util/recently_accessed'; -import { mlForecastService } from 'plugins/ml/services/forecast_service'; +import { FORECAST_REQUEST_STATE } from '../../../../../../../common/constants/states'; +import { addItemToRecentlyAccessed } from '../../../../../util/recently_accessed'; +import { mlForecastService } from '../../../../../services/forecast_service'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; -import { getLatestDataOrBucketTimestamp, isTimeSeriesViewJob } from '../../../../../../common/util/job_utils'; +import { getLatestDataOrBucketTimestamp, isTimeSeriesViewJob } from '../../../../../../../common/util/job_utils'; const MAX_FORECASTS = 500; const TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/forecasts_table/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/forecasts_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/forecasts_table/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/forecasts_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/format_values.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/format_values.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/format_values.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/format_values.js index 1d89650c51cae3..7513ed355e5440 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/format_values.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/format_values.js @@ -7,7 +7,7 @@ import numeral from '@elastic/numeral'; import { formatDate } from '@elastic/eui/lib/services/format'; -import { toLocaleString } from 'plugins/ml/util/string_utils'; +import { toLocaleString } from '../../../../util/string_utils'; const TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; const DATA_FORMAT = '0.0 b'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_details.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_details.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_details_pane.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details_pane.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_details_pane.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_details_pane.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_messages_pane.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_messages_pane.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx index ca80012767c2d0..fbb64db94cd56c 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/job_messages_pane.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/job_messages_pane.tsx @@ -8,7 +8,7 @@ import React, { FC, useEffect, useState } from 'react'; import { ml } from '../../../../services/ml_api_service'; import { JobMessages } from '../../../../components/job_messages'; -import { JobMessage } from '../../../../../common/types/audit_message'; +import { JobMessage } from '../../../../../../common/types/audit_message'; interface JobMessagesPaneProps { jobId: string; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/json_tab.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/json_tab.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_details/json_tab.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_details/json_tab.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/_job_filter_bar.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/_job_filter_bar.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/_job_filter_bar.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/_job_filter_bar.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js index dabfc33e0f6aff..60925434c35c72 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js @@ -11,7 +11,7 @@ import React, { Fragment, } from 'react'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { ml } from '../../../../services/ml_api_service'; import { JobGroup } from '../job_group'; import { getSelectedJobIdFromUrl, clearSelectedJobIdFromUrl } from '../utils'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/_job_group.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/_job_group.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/_job_group.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/_job_group.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/job_group.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/job_group.js similarity index 91% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/job_group.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/job_group.js index b0e10a975b8633..d93f9ff7ff4542 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/job_group/job_group.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/job_group/job_group.js @@ -5,7 +5,7 @@ */ -import { tabColor } from '../../../../../common/util/group_color_utils'; +import { tabColor } from '../../../../../../common/util/group_color_utils'; import PropTypes from 'prop-types'; import React from 'react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/_jobs_list.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/_jobs_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/_jobs_list.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/_jobs_list.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/job_description.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/job_description.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/job_description.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/job_description.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list/jobs_list.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/_jobs_list_view.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/_jobs_list_view.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/_jobs_list_view.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/_jobs_list_view.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js index c160be429817ec..fc07d4d2a02940 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_list_view/jobs_list_view.js @@ -9,7 +9,7 @@ import { timefilter } from 'ui/timefilter'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { ml } from '../../../../services/ml_api_service'; import { checkForAutoStartDatafeed, filterJobs, loadFullJob } from '../utils'; import { JobsList } from '../jobs_list'; import { JobDetails } from '../job_details'; @@ -30,7 +30,7 @@ import { DEFAULT_REFRESH_INTERVAL_MS, DELETING_JOBS_REFRESH_INTERVAL_MS, MINIMUM_REFRESH_INTERVAL_MS, -} from '../../../../../common/constants/jobs_list'; +} from '../../../../../../common/constants/jobs_list'; let jobsRefreshInterval = null; let deletingJobsRefreshTimeout = null; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_stats_bar/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_stats_bar/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_stats_bar/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_stats_bar/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js index 83116579a2adb1..98f8180f4b9807 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/jobs_stats_bar/jobs_stats_bar.js @@ -5,7 +5,7 @@ */ -import { JOB_STATE, DATAFEED_STATE } from 'plugins/ml/../common/constants/states'; +import { JOB_STATE, DATAFEED_STATE } from '../../../../../../common/constants/states'; import { StatsBar } from '../../../../components/stats_bar'; import PropTypes from 'prop-types'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/ml_job_editor.d.ts b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/ml_job_editor.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/ml_job_editor.d.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/ml_job_editor.d.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/ml_job_editor.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/ml_job_editor.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/ml_job_editor/ml_job_editor.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/ml_job_editor/ml_job_editor.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/_multi_job_actions.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/_multi_job_actions.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/_multi_job_actions.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/_multi_job_actions.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/actions_menu.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/actions_menu.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js index 499d911371d4a1..6ba3f531dfb577 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/actions_menu.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/actions_menu.js @@ -5,8 +5,8 @@ */ -import { checkPermission } from 'plugins/ml/privilege/check_privilege'; -import { mlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes'; +import { checkPermission } from '../../../../privilege/check_privilege'; +import { mlNodesAvailable } from '../../../../ml_nodes_check/check_ml_nodes'; import PropTypes from 'prop-types'; import React, { Component, diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/_group_selector.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/_group_selector.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/_group_selector.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/_group_selector.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_group_list.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_group_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_group_list.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_group_list.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/group_list.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/group_list.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/group_list.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/group_list.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_list/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js index d104d2e02d07b6..945f960f4aebe5 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js @@ -5,7 +5,7 @@ */ -import { checkPermission } from 'plugins/ml/privilege/check_privilege'; +import { checkPermission } from '../../../../../privilege/check_privilege'; import PropTypes from 'prop-types'; import React, { Component, diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_new_group_input.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_new_group_input.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_new_group_input.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/_new_group_input.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/group_selector/new_group_input/new_group_input.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/multi_job_actions.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/multi_job_actions.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/multi_job_actions.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/multi_job_actions/multi_job_actions.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/new_job_button/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/new_job_button/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/new_job_button/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/new_job_button/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/new_job_button/new_job_button.js similarity index 85% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/new_job_button/new_job_button.js index 381c9fb0f26713..a94161ee85836e 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/new_job_button/new_job_button.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/new_job_button/new_job_button.js @@ -6,8 +6,8 @@ -import { checkPermission } from 'plugins/ml/privilege/check_privilege'; -import { mlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes'; +import { checkPermission } from '../../../../privilege/check_privilege'; +import { mlNodesAvailable } from '../../../../ml_nodes_check/check_ml_nodes'; import React from 'react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/refresh_jobs_list_button/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/refresh_jobs_list_button/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/refresh_jobs_list_button/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/refresh_jobs_list_button/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/refresh_jobs_list_button/refresh_jobs_list_button.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/refresh_jobs_list_button/refresh_jobs_list_button.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/refresh_jobs_list_button/refresh_jobs_list_button.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/refresh_jobs_list_button/refresh_jobs_list_button.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/start_datafeed_modal.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_index.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_index.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_time_range_selector.scss b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_time_range_selector.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_time_range_selector.scss rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/_time_range_selector.scss diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/start_datafeed_modal/time_range_selector/time_range_selector.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/utils.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/utils.js index 08c8993585da24..2bb2fd310d175e 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/utils.js @@ -6,14 +6,14 @@ import { each } from 'lodash'; import { toastNotifications } from 'ui/notify'; -import { mlMessageBarService } from 'plugins/ml/components/messagebar'; +import { mlMessageBarService } from '../../../components/messagebar'; import rison from 'rison-node'; import chrome from 'ui/chrome'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { ml } from 'plugins/ml/services/ml_api_service'; -import { JOB_STATE, DATAFEED_STATE } from 'plugins/ml/../common/constants/states'; -import { parseInterval } from '../../../../common/util/parse_interval'; +import { mlJobService } from '../../../services/job_service'; +import { ml } from '../../../services/ml_api_service'; +import { JOB_STATE, DATAFEED_STATE } from '../../../../../common/constants/states'; +import { parseInterval } from '../../../../../common/util/parse_interval'; import { i18n } from '@kbn/i18n'; export function loadFullJob(jobId) { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/validate_job.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/validate_job.js index e55075b0eb8506..5fb1b93f7c5640 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/validate_job.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/components/validate_job.js @@ -12,7 +12,7 @@ import { validateModelMemoryLimit as validateModelMemoryLimitUtils, validateGroupNames as validateGroupNamesUtils, validateModelMemoryLimitUnits as validateModelMemoryLimitUnitsUtils, -} from '../../../../common/util/job_utils'; +} from '../../../../../common/util/job_utils'; import { isValidLabel, isValidTimeRange } from '../../../util/custom_url_utils'; export function validateModelMemoryLimit(mml) { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/directive.js similarity index 74% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/directive.js index 4b6f3f485d49de..f549ec3826cb57 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/directive.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/directive.js @@ -11,12 +11,12 @@ import React from 'react'; import { uiModules } from 'ui/modules'; const module = uiModules.get('apps/ml', ['react']); -import { loadIndexPatterns } from 'plugins/ml/util/index_utils'; -import { checkFullLicense } from 'plugins/ml/license/check_license'; -import { checkGetJobsPrivilege } from 'plugins/ml/privilege/check_privilege'; -import { getMlNodeCount } from 'plugins/ml/ml_nodes_check/check_ml_nodes'; -import { getJobManagementBreadcrumbs } from 'plugins/ml/jobs/breadcrumbs'; -import { loadMlServerInfo } from 'plugins/ml/services/ml_server_info'; +import { loadIndexPatterns } from '../../util/index_utils'; +import { checkFullLicense } from '../../license/check_license'; +import { checkGetJobsPrivilege } from '../../privilege/check_privilege'; +import { getMlNodeCount } from '../../ml_nodes_check/check_ml_nodes'; +import { getJobManagementBreadcrumbs } from '../../jobs/breadcrumbs'; +import { loadMlServerInfo } from '../../services/ml_server_info'; import uiRoutes from 'ui/routes'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/index.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/index.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/index.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js b/x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/jobs.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js rename to x-pack/legacy/plugins/ml/public/application/jobs/jobs_list/jobs.js diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/chart_loader.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/chart_loader.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts index f80d2e8e0fd559..502a88ecf60040 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/chart_loader.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/chart_loader.ts @@ -7,8 +7,8 @@ import memoizeOne from 'memoize-one'; import { isEqual } from 'lodash'; import { IndexPattern } from 'ui/index_patterns'; -import { IndexPatternTitle } from '../../../../../common/types/kibana'; -import { Field, SplitField, AggFieldPair } from '../../../../../common/types/fields'; +import { IndexPatternTitle } from '../../../../../../common/types/kibana'; +import { Field, SplitField, AggFieldPair } from '../../../../../../common/types/fields'; import { ml } from '../../../../services/ml_api_service'; import { mlResultsService } from '../../../../services/results_service'; import { getCategoryFields as getCategoryFieldsOrig } from './searches'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/searches.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/searches.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/chart_loader/searches.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/chart_loader/searches.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/job_groups_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/job_groups_input.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/job_groups_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/job_groups_input.tsx index a71a264662fee6..7211c034617f12 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/job_groups_input.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/job_groups_input.tsx @@ -8,7 +8,7 @@ import React, { FC, memo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; import { Validation } from '../job_validator'; -import { tabColor } from '../../../../../common/util/group_color_utils'; +import { tabColor } from '../../../../../../common/util/group_color_utils'; import { Description } from '../../pages/components/job_details_step/components/groups/description'; export interface JobGroupsInputProps { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/time_range_picker.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/components/time_range_picker.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/components/time_range_picker.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/index_pattern_context.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/index_pattern_context.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/index_pattern_context.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/advanced_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/advanced_job_creator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts index 54e704767b9928..22aebc2b88a886 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/advanced_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/advanced_job_creator.ts @@ -8,12 +8,12 @@ import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/type import { IndexPattern } from 'ui/index_patterns'; import { JobCreator } from './job_creator'; -import { Field, Aggregation, SplitField } from '../../../../../common/types/fields'; +import { Field, Aggregation, SplitField } from '../../../../../../common/types/fields'; import { Job, Datafeed, Detector, CustomRule } from './configs'; import { createBasicDetector } from './util/default_configs'; import { JOB_TYPE } from './util/constants'; import { getRichDetectors } from './util/general'; -import { isValidJson } from '../../../../../common/util/validation_utils'; +import { isValidJson } from '../../../../../../common/util/validation_utils'; import { ml } from '../../../../services/ml_api_service'; export interface RichDetector { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/combined_job.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/combined_job.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/combined_job.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/combined_job.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/datafeed.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/datafeed.ts similarity index 91% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/datafeed.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/datafeed.ts index 68ee45881586b0..6c7493c5e52d3b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/datafeed.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/datafeed.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { IndexPatternTitle } from '../../../../../../common/types/kibana'; +import { IndexPatternTitle } from '../../../../../../../common/types/kibana'; import { JobId } from './job'; export type DatafeedId = string; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/job.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/job.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/configs/job.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/configs/job.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/job_creator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts index e5c6964f0f118a..86a61e84b445cb 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator.ts @@ -6,17 +6,17 @@ import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/types'; import { IndexPattern } from 'ui/index_patterns'; -import { IndexPatternTitle } from '../../../../../common/types/kibana'; -import { ML_JOB_AGGREGATION } from '../../../../../common/constants/aggregation_types'; -import { ES_FIELD_TYPES } from '../../../../../../../../../src/plugins/data/public'; +import { IndexPatternTitle } from '../../../../../../common/types/kibana'; +import { ML_JOB_AGGREGATION } from '../../../../../../common/constants/aggregation_types'; +import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; import { Job, Datafeed, Detector, JobId, DatafeedId, BucketSpan } from './configs'; -import { Aggregation, Field } from '../../../../../common/types/fields'; +import { Aggregation, Field } from '../../../../../../common/types/fields'; import { createEmptyJob, createEmptyDatafeed } from './util/default_configs'; import { mlJobService } from '../../../../services/job_service'; import { JobRunner, ProgressSubscriber } from '../job_runner'; import { JOB_TYPE, CREATED_BY_LABEL, SHARED_RESULTS_INDEX_NAME } from './util/constants'; import { isSparseDataJob } from './util/general'; -import { parseInterval } from '../../../../../common/util/parse_interval'; +import { parseInterval } from '../../../../../../common/util/parse_interval'; export class JobCreator { protected _type: JOB_TYPE = JOB_TYPE.SINGLE_METRIC; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/job_creator_factory.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/job_creator_factory.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/job_creator_factory.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/multi_metric_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/multi_metric_job_creator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts index 05a253a0962e9a..fea328acb58b3c 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/multi_metric_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/multi_metric_job_creator.ts @@ -7,7 +7,12 @@ import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/types'; import { IndexPattern } from 'ui/index_patterns'; import { JobCreator } from './job_creator'; -import { Field, Aggregation, SplitField, AggFieldPair } from '../../../../../common/types/fields'; +import { + Field, + Aggregation, + SplitField, + AggFieldPair, +} from '../../../../../../common/types/fields'; import { Job, Datafeed, Detector } from './configs'; import { createBasicDetector } from './util/default_configs'; import { JOB_TYPE, CREATED_BY_LABEL, DEFAULT_MODEL_MEMORY_LIMIT } from './util/constants'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/population_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/population_job_creator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts index ac7161422628de..9e9ccf8ab63e42 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/population_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/population_job_creator.ts @@ -7,7 +7,12 @@ import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/types'; import { IndexPattern } from 'ui/index_patterns'; import { JobCreator } from './job_creator'; -import { Field, Aggregation, SplitField, AggFieldPair } from '../../../../../common/types/fields'; +import { + Field, + Aggregation, + SplitField, + AggFieldPair, +} from '../../../../../../common/types/fields'; import { Job, Datafeed, Detector } from './configs'; import { createBasicDetector } from './util/default_configs'; import { JOB_TYPE, CREATED_BY_LABEL } from './util/constants'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/single_metric_job_creator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/single_metric_job_creator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts index aba3b08f330e84..5f3f6ff310d289 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/single_metric_job_creator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/single_metric_job_creator.ts @@ -6,15 +6,15 @@ import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/types'; import { IndexPattern } from 'ui/index_patterns'; -import { parseInterval } from '../../../../../common/util/parse_interval'; +import { parseInterval } from '../../../../../../common/util/parse_interval'; import { JobCreator } from './job_creator'; -import { Field, Aggregation, AggFieldPair } from '../../../../../common/types/fields'; +import { Field, Aggregation, AggFieldPair } from '../../../../../../common/types/fields'; import { Job, Datafeed, Detector, BucketSpan } from './configs'; import { createBasicDetector } from './util/default_configs'; import { ML_JOB_AGGREGATION, ES_AGGREGATION, -} from '../../../../../common/constants/aggregation_types'; +} from '../../../../../../common/constants/aggregation_types'; import { JOB_TYPE, CREATED_BY_LABEL } from './util/constants'; import { getRichDetectors } from './util/general'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/type_guards.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/type_guards.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/type_guards.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/type_guards.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/constants.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/constants.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/constants.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/constants.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/default_configs.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts similarity index 90% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/default_configs.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts index 2a09415c50bc42..1160401478ab7e 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/default_configs.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/default_configs.ts @@ -5,8 +5,8 @@ */ import { Job, Datafeed } from '../configs'; -import { IndexPatternTitle } from '../../../../../../common/types/kibana'; -import { Field, Aggregation, EVENT_RATE_FIELD_ID } from '../../../../../../common/types/fields'; +import { IndexPatternTitle } from '../../../../../../../common/types/kibana'; +import { Field, Aggregation, EVENT_RATE_FIELD_ID } from '../../../../../../../common/types/fields'; import { Detector } from '../configs'; export function createEmptyJob(): Job { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/general.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/general.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts index 71535ab98c74f7..a73c27d954afe9 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_creator/util/general.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_creator/util/general.ts @@ -10,16 +10,16 @@ import { newJobCapsService } from '../../../../../services/new_job_capabilities_ import { ML_JOB_AGGREGATION, SPARSE_DATA_AGGREGATIONS, -} from '../../../../../../common/constants/aggregation_types'; -import { MLCATEGORY } from '../../../../../../common/constants/field_types'; +} from '../../../../../../../common/constants/aggregation_types'; +import { MLCATEGORY } from '../../../../../../../common/constants/field_types'; import { EVENT_RATE_FIELD_ID, Field, AggFieldPair, mlCategory, -} from '../../../../../../common/types/fields'; +} from '../../../../../../../common/types/fields'; import { mlJobService } from '../../../../../services/job_service'; -import { JobCreatorType, isMultiMetricJobCreator, isPopulationJobCreator } from '../'; +import { JobCreatorType, isMultiMetricJobCreator, isPopulationJobCreator } from '../index'; import { CREATED_BY_LABEL, JOB_TYPE } from './constants'; const getFieldByIdFactory = (scriptFields: Field[]) => (id: string) => { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_runner/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_runner/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_runner/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_runner/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_runner/job_runner.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_runner/job_runner.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_runner/job_runner.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_runner/job_runner.ts index 4da87dedf14ddd..9627d2e4775281 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_runner/job_runner.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_runner/job_runner.ts @@ -9,7 +9,7 @@ import { ml } from '../../../../services/ml_api_service'; import { mlJobService } from '../../../../services/job_service'; import { JobCreator } from '../job_creator'; import { DatafeedId, JobId } from '../job_creator/configs'; -import { DATAFEED_STATE } from '../../../../../common/constants/states'; +import { DATAFEED_STATE } from '../../../../../../common/constants/states'; const REFRESH_INTERVAL_MS = 100; const TARGET_PROGRESS_DELTA = 2; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/job_validator.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/job_validator.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/job_validator.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/job_validator.ts index 82b1684b7b72f3..550b579c93392d 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/job_validator.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/job_validator.ts @@ -5,7 +5,10 @@ */ import { ReactElement } from 'react'; -import { basicJobValidation, basicDatafeedValidation } from '../../../../../common/util/job_utils'; +import { + basicJobValidation, + basicDatafeedValidation, +} from '../../../../../../common/util/job_utils'; import { getNewJobLimits } from '../../../../services/ml_server_info'; import { JobCreatorType } from '../job_creator'; import { populateValidationMessages, checkForExistingJobAndGroupIds } from './util'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/util.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/util.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/util.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/util.ts index b1bd352db387bf..ab33afb23ef514 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/job_validator/util.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/job_validator/util.ts @@ -7,9 +7,12 @@ import { i18n } from '@kbn/i18n'; import { BasicValidations } from './job_validator'; import { Job, Datafeed } from '../job_creator/configs'; -import { ALLOWED_DATA_UNITS, JOB_ID_MAX_LENGTH } from '../../../../../common/constants/validation'; +import { + ALLOWED_DATA_UNITS, + JOB_ID_MAX_LENGTH, +} from '../../../../../../common/constants/validation'; import { getNewJobLimits } from '../../../../services/ml_server_info'; -import { ValidationResults, ValidationMessage } from '../../../../../common/util/job_utils'; +import { ValidationResults, ValidationMessage } from '../../../../../../common/util/job_utils'; import { ExistingJobsAndGroups } from '../../../../services/job_service'; export function populateValidationMessages( diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/results_loader.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/results_loader.ts similarity index 92% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/results_loader.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/results_loader.ts index c9f78c9e8c096c..82808ef3d37ee0 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/results_loader.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/results_loader.ts @@ -8,13 +8,13 @@ import { BehaviorSubject } from 'rxjs'; import { JobCreatorType, isMultiMetricJobCreator } from '../job_creator'; import { mlResultsService, ModelPlotOutputResults } from '../../../../services/results_service'; import { TimeBuckets } from '../../../../util/time_buckets'; -import { getSeverityType } from '../../../../../common/util/anomaly_utils'; -import { parseInterval } from '../../../../../common/util/parse_interval'; -import { ANOMALY_SEVERITY } from '../../../../../common/constants/anomalies'; +import { getSeverityType } from '../../../../../../common/util/anomaly_utils'; +import { parseInterval } from '../../../../../../common/util/parse_interval'; +import { ANOMALY_SEVERITY } from '../../../../../../common/constants/anomalies'; import { getScoresByRecord } from './searches'; import { JOB_TYPE } from '../job_creator/util/constants'; import { ChartLoader } from '../chart_loader'; -import { ES_AGGREGATION } from '../../../../../common/constants/aggregation_types'; +import { ES_AGGREGATION } from '../../../../../../common/constants/aggregation_types'; export interface Results { progress: number; @@ -150,15 +150,17 @@ export class ResultsLoader { if (agg === null) { return { [dtrIndex]: [emptyModelItem] }; } - const resp = await mlResultsService.getModelPlotOutput( - this._jobCreator.jobId, - dtrIndex, - [], - this._lastModelTimeStamp, - this._jobCreator.end, - `${this._chartInterval.getInterval().asMilliseconds()}ms`, - agg.mlModelPlotAgg - ); + const resp = await mlResultsService + .getModelPlotOutput( + this._jobCreator.jobId, + dtrIndex, + [], + this._lastModelTimeStamp, + this._jobCreator.end, + `${this._chartInterval.getInterval().asMilliseconds()}ms`, + agg.mlModelPlotAgg + ) + .toPromise(); return this._createModel(resp, dtrIndex); } diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/searches.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/searches.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/searches.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/searches.ts index 2e1b022a33b3fd..724a6146854af8 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/common/results_loader/searches.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/common/results_loader/searches.ts @@ -6,7 +6,7 @@ import { get } from 'lodash'; -import { ML_RESULTS_INDEX_PATTERN } from './../../../../../common/constants/index_patterns'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../../../../common/constants/index_patterns'; import { escapeForElasticsearchQuery } from '../../../../util/string_utils'; import { ml } from '../../../../services/ml_api_service'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx index 1fef1d804e6f24..c5188d045d84fd 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/anomalies.tsx @@ -13,8 +13,8 @@ import React, { Fragment, FC } from 'react'; import { AnnotationDomainTypes, getAnnotationId, LineAnnotation } from '@elastic/charts'; import { Anomaly } from '../../../../common/results_loader'; -import { getSeverityColor } from '../../../../../../../common/util/anomaly_utils'; -import { ANOMALY_THRESHOLD } from '../../../../../../../common/constants/anomalies'; +import { getSeverityColor } from '../../../../../../../../common/util/anomaly_utils'; +import { ANOMALY_THRESHOLD } from '../../../../../../../../common/constants/anomalies'; interface Props { anomalyData?: Anomaly[]; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/anomaly_chart.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/anomaly_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/anomaly_chart.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/anomaly_chart.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/line.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/line.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/line.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/line.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/model_bounds.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/model_bounds.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/model_bounds.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/model_bounds.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/scatter.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/scatter.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/anomaly_chart/scatter.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/anomaly_chart/scatter.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/axes.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/axes.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/axes.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/axes.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/settings.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/settings.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/settings.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/settings.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/utils.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/utils.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/common/utils.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/common/utils.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/event_rate_chart/event_rate_chart.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/event_rate_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/event_rate_chart/event_rate_chart.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/event_rate_chart.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/event_rate_chart/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/event_rate_chart/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/event_rate_chart/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/loading_wrapper/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/loading_wrapper/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/loading_wrapper/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/loading_wrapper/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/loading_wrapper/loading_wrapper.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/loading_wrapper/loading_wrapper.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/charts/loading_wrapper/loading_wrapper.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/charts/loading_wrapper/loading_wrapper.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx index a284bd20b7ce12..7f5d2bfbe0e90c 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/datafeed_preview_flyout.tsx @@ -22,7 +22,7 @@ import { CombinedJob } from '../../../../common/job_creator/configs'; import { MLJobEditor } from '../../../../../jobs_list/components/ml_job_editor'; import { JobCreatorContext } from '../../job_creator_context'; import { mlJobService } from '../../../../../../services/job_service'; -import { ML_DATA_PREVIEW_COUNT } from '../../../../../../../common/util/job_utils'; +import { ML_DATA_PREVIEW_COUNT } from '../../../../../../../../common/util/job_utils'; const EDITOR_HEIGHT = '800px'; export enum EDITOR_MODE { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/datafeed_preview_flyout/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/datafeed_preview_flyout/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/datafeed_preview_flyout/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/json_editor_flyout/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/json_editor_flyout/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx index cf26d6f532d0db..4815629ddd5c8e 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/json_editor_flyout/json_editor_flyout.tsx @@ -20,7 +20,7 @@ import { } from '@elastic/eui'; import { Datafeed } from '../../../../common/job_creator/configs'; import { MLJobEditor } from '../../../../../jobs_list/components/ml_job_editor'; -import { isValidJson } from '../../../../../../../common/util/validation_utils'; +import { isValidJson } from '../../../../../../../../common/util/validation_utils'; import { JobCreatorContext } from '../../job_creator_context'; const EDITOR_HEIGHT = '800px'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/common/model_memory_limit/model_memory_limit_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx index 924eacbc4b13c5..63283666268940 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/frequency_input.tsx @@ -8,7 +8,7 @@ import React, { FC, useState, useContext, useEffect } from 'react'; import { EuiFieldText } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; import { Description } from './description'; -import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../../common/util/job_utils'; +import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../../../common/util/job_utils'; import { useStringifiedValue } from '../hooks'; export const FrequencyInput: FC = () => { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/frequency/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/frequency/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/hooks.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/hooks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/hooks.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/hooks.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx index dfcedfe7c796e5..fa1e7838f5938d 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query/query_input.tsx @@ -8,7 +8,7 @@ import React, { FC, useState, useContext, useEffect } from 'react'; import { JobCreatorContext } from '../../../job_creator_context'; import { MLJobEditor } from '../../../../../../jobs_list/components/ml_job_editor'; import { Description } from './description'; -import { isValidJson } from '../../../../../../../../common/util/validation_utils'; +import { isValidJson } from '../../../../../../../../../common/util/validation_utils'; import { AdvancedJobCreator } from '../../../../../common/job_creator'; const EDITOR_HEIGHT = '400px'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/query_delay/query_delay_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/scroll_size/scroll_size_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx index 3b1993f8e2c7e5..f2e25168668352 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/components/time_field/time_field_select.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; -import { Field } from '../../../../../../../../common/types/fields'; +import { Field } from '../../../../../../../../../common/types/fields'; import { createFieldOptions } from '../../../../../common/job_creator/util/general'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/datafeed.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/datafeed.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/datafeed.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/datafeed_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/datafeed_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_creator_context.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_creator_context.ts similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_creator_context.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_creator_context.ts index 5fd3c98ed54c95..229fb8c3fd5f2b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_creator_context.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_creator_context.ts @@ -5,7 +5,7 @@ */ import { createContext } from 'react'; -import { Field, Aggregation } from '../../../../../common/types/fields'; +import { Field, Aggregation } from '../../../../../../common/types/fields'; import { TimeBuckets } from '../../../../util/time_buckets'; import { JobCreatorType, SingleMetricJobCreator } from '../../common/job_creator'; import { ChartLoader } from '../../common/chart_loader'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/additional_section.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/additional_section.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/additional_section.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/additional_section.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/calendars_selection.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/components/calendars/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/additional_section/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/additional_section/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/advanced_section.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/advanced_section.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/advanced_section.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/advanced_section.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/dedicated_index_switch.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/dedicated_index/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/components/model_plot/model_plot_switch.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/advanced_section/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/advanced_section/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx index d40b756857f461..cf0be9d3c0c4ee 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/groups_input.tsx @@ -8,7 +8,7 @@ import React, { FC, useState, useContext, useEffect } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { JobCreatorContext } from '../../../job_creator_context'; -import { tabColor } from '../../../../../../../../common/util/group_color_utils'; +import { tabColor } from '../../../../../../../../../common/util/group_color_utils'; import { Description } from './description'; export const GroupsInput: FC = () => { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/groups/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/groups/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_description/job_description_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/components/job_id/job_id_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/job_details.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/job_details_step/job_details.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/job_details_step/job_details.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx index 5f93361982ea0d..06c8068a9c0052 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/advanced_detector_modal.tsx @@ -26,7 +26,7 @@ import { Aggregation, EVENT_RATE_FIELD_ID, mlCategory, -} from '../../../../../../../../common/types/fields'; +} from '../../../../../../../../../common/types/fields'; import { RichDetector } from '../../../../../common/job_creator/advanced_job_creator'; import { ModalWrapper } from './modal_wrapper'; import { detectorToString } from '../../../../../../../util/string_utils'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/descriptions.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/index.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/index.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/index.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/index.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/modal_wrapper.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/modal_wrapper.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/modal_wrapper.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_detector_modal/modal_wrapper.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/advanced_view.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/detector_list.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/extra.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/extra.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/extra.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/extra.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx index cb3dbb59f894a7..c4b94c61ac4fbb 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection.tsx @@ -9,7 +9,7 @@ import React, { Fragment, FC, useContext, useState } from 'react'; import { JobCreatorContext } from '../../../job_creator_context'; import { AdvancedJobCreator } from '../../../../../common/job_creator'; import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; -import { Aggregation, Field } from '../../../../../../../../common/types/fields'; +import { Aggregation, Field } from '../../../../../../../../../common/types/fields'; import { MetricSelector } from './metric_selector'; import { RichDetector } from '../../../../../common/job_creator/advanced_job_creator'; import { DetectorList } from './detector_list'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection_summary.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection_summary.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selection_summary.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx index 5bc38ca934165a..104b629efd3cbb 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/metric_selector.tsx @@ -7,7 +7,7 @@ import React, { FC, Fragment } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFormRow, EuiFlexGroup, EuiFlexItem, EuiButton } from '@elastic/eui'; -import { Aggregation, Field } from '../../../../../../../../common/types/fields'; +import { Aggregation, Field } from '../../../../../../../../../common/types/fields'; import { AdvancedDetectorModal, ModalPayload } from '../advanced_detector_modal'; import { RichDetector } from '../../../../../common/job_creator/advanced_job_creator'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/settings.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/settings.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/settings.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/advanced_view/settings.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx index bda29b244a5b1b..a2434f3c33559b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/agg_select.tsx @@ -8,7 +8,7 @@ import React, { FC, useContext, useState, useEffect } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps, EuiFormRow } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; -import { Field, Aggregation, AggFieldPair } from '../../../../../../../../common/types/fields'; +import { Field, Aggregation, AggFieldPair } from '../../../../../../../../../common/types/fields'; // The display label used for an aggregation e.g. sum(bytes). export type Label = string; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/agg_select/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/agg_select/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/agg_select/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span_input.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span_input.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span_input.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/bucket_span_input.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/bucket_span_estimator.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts index f86baaccb84d39..4a1626ffcef899 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts @@ -7,7 +7,7 @@ import { useContext, useState } from 'react'; import { JobCreatorContext } from '../../../job_creator_context'; -import { EVENT_RATE_FIELD_ID } from '../../../../../../../../common/types/fields'; +import { EVENT_RATE_FIELD_ID } from '../../../../../../../../../common/types/fields'; import { isMultiMetricJobCreator, isPopulationJobCreator, diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/bucket_span_estimator/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx index f9fdba31a0ad41..d995d40284abae 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/categorization_field_select.tsx @@ -8,7 +8,7 @@ import React, { FC, useContext } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; -import { Field } from '../../../../../../../../common/types/fields'; +import { Field } from '../../../../../../../../../common/types/fields'; import { createFieldOptions, createScriptFieldOptions, diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/categorization_field/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx index feac3b30dfa3bd..a44852b2ad625b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/detector_title/detector_title.tsx @@ -8,7 +8,7 @@ import React, { FC } from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiButtonIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Field, Aggregation, SplitField } from '../../../../../../../../common/types/fields'; +import { Field, Aggregation, SplitField } from '../../../../../../../../../common/types/fields'; interface DetectorTitleProps { index: number; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/detector_title/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/detector_title/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/detector_title/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/detector_title/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx index 293202415ced0c..639bdb9ec76bfd 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/influencers/influencers_select.tsx @@ -8,7 +8,7 @@ import React, { FC, useContext } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; -import { Field } from '../../../../../../../../common/types/fields'; +import { Field } from '../../../../../../../../../common/types/fields'; import { createFieldOptions, createScriptFieldOptions, diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx index e4dd46b159a6c4..b76fc120538f5d 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/chart_grid.tsx @@ -7,7 +7,7 @@ import React, { Fragment, FC } from 'react'; import { EuiFlexGrid, EuiFlexItem } from '@elastic/eui'; -import { AggFieldPair, SplitField } from '../../../../../../../../common/types/fields'; +import { AggFieldPair, SplitField } from '../../../../../../../../../common/types/fields'; import { ChartSettings } from '../../../charts/common/settings'; import { LineChartData } from '../../../../../common/chart_loader'; import { ModelItem, Anomaly } from '../../../../../common/results_loader'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx index b0a5049924cbc8..ffa991388fbe28 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx @@ -11,7 +11,7 @@ import { MultiMetricJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { DropDownLabel, DropDownProps } from '../agg_select'; import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; -import { AggFieldPair } from '../../../../../../../../common/types/fields'; +import { AggFieldPair } from '../../../../../../../../../common/types/fields'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { MetricSelector } from './metric_selector'; import { ChartGrid } from './chart_grid'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx index 42bdc2a19deda9..dd35dc136e70d7 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/metric_selector.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { Field, AggFieldPair } from '../../../../../../../../common/types/fields'; +import { Field, AggFieldPair } from '../../../../../../../../../common/types/fields'; import { AggSelect, DropDownLabel, DropDownProps } from '../agg_select'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/multi_metric_view.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/settings.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/settings.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/settings.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/multi_metric_view/settings.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx index e3374be22485cd..8cd533f8b2e297 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/chart_grid.tsx @@ -7,7 +7,7 @@ import React, { Fragment, FC } from 'react'; import { EuiFlexGrid, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { AggFieldPair, SplitField } from '../../../../../../../../common/types/fields'; +import { AggFieldPair, SplitField } from '../../../../../../../../../common/types/fields'; import { ChartSettings } from '../../../charts/common/settings'; import { LineChartData } from '../../../../../common/chart_loader'; import { ModelItem, Anomaly } from '../../../../../common/results_loader'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx index 9a24381c9e35fd..fe5d3ff0c29fbf 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection.tsx @@ -12,7 +12,7 @@ import { PopulationJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { DropDownLabel, DropDownProps } from '../agg_select'; import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; -import { Field, AggFieldPair } from '../../../../../../../../common/types/fields'; +import { Field, AggFieldPair } from '../../../../../../../../../common/types/fields'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { MetricSelector } from './metric_selector'; import { SplitFieldSelector } from '../split_field'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx index b13f8e3a73a10a..4474a2d6b54138 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx @@ -12,7 +12,7 @@ import { JobCreatorContext } from '../../../job_creator_context'; import { PopulationJobCreator } from '../../../../../common/job_creator'; import { Results, ModelItem, Anomaly } from '../../../../../common/results_loader'; import { LineChartData } from '../../../../../common/chart_loader'; -import { Field, AggFieldPair } from '../../../../../../../../common/types/fields'; +import { Field, AggFieldPair } from '../../../../../../../../../common/types/fields'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { ChartGrid } from './chart_grid'; import { mlMessageBarService } from '../../../../../../../components/messagebar'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx index b831f9033f9773..9857a585c14b89 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/metric_selector.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { Field, AggFieldPair } from '../../../../../../../../common/types/fields'; +import { Field, AggFieldPair } from '../../../../../../../../../common/types/fields'; import { AggSelect, DropDownLabel, DropDownProps } from '../agg_select'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/population_view.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/settings.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/settings.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/population_view/settings.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/population_view/settings.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx index 19ccca44dc0a51..f04b63f47789e6 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx @@ -10,7 +10,7 @@ import { SingleMetricJobCreator } from '../../../../../common/job_creator'; import { LineChartData } from '../../../../../common/chart_loader'; import { AggSelect, DropDownLabel, DropDownProps, createLabel } from '../agg_select'; import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; -import { AggFieldPair } from '../../../../../../../../common/types/fields'; +import { AggFieldPair } from '../../../../../../../../../common/types/fields'; import { AnomalyChart, CHART_TYPE } from '../../../charts/anomaly_chart'; import { getChartSettings } from '../../../charts/common/settings'; import { mlMessageBarService } from '../../../../../../../components/messagebar'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/settings.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/settings.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/settings.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/settings.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/single_metric_view/single_metric_view.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx index 76461e13063332..2884bce4d89ad2 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/sparse_data/sparse_data_switch.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { EuiSwitch } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; import { Description } from './description'; -import { ES_AGGREGATION } from '../../../../../../../../common/constants/aggregation_types'; +import { ES_AGGREGATION } from '../../../../../../../../../common/constants/aggregation_types'; export const SparseDataSwitch: FC = () => { const { jobCreator, jobCreatorUpdated, jobCreatorUpdate } = useContext(JobCreatorContext); diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/animate_split_hook.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/animate_split_hook.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/animate_split_hook.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/animate_split_hook.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx index b387d4a2fc34f2..918163572076ce 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_cards/split_cards.tsx @@ -8,7 +8,7 @@ import React, { FC, memo, Fragment } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; -import { SplitField } from '../../../../../../../../common/types/fields'; +import { SplitField } from '../../../../../../../../../common/types/fields'; import { JOB_TYPE } from '../../../../../common/job_creator/util/constants'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx index d08e989c49deac..fc78e8e2441938 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/by_field.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { SplitFieldSelect } from './split_field_select'; import { JobCreatorContext } from '../../../job_creator_context'; -import { Field } from '../../../../../../../../common/types/fields'; +import { Field } from '../../../../../../../../../common/types/fields'; import { newJobCapsService } from '../../../../../../../services/new_job_capabilities_service'; import { MultiMetricJobCreator, PopulationJobCreator } from '../../../../../common/job_creator'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx index 0dc76be9f8f07a..378c088332ed44 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/split_field/split_field_select.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; -import { Field, SplitField } from '../../../../../../../../common/types/fields'; +import { Field, SplitField } from '../../../../../../../../../common/types/fields'; interface DropDownLabel { label: string; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/description.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/description.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/description.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/description.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx index 2f240344e0ea56..efe32e3173cade 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/components/summary_count_field/summary_count_field_select.tsx @@ -8,7 +8,7 @@ import React, { FC, useContext } from 'react'; import { EuiComboBox, EuiComboBoxOptionProps } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; -import { Field } from '../../../../../../../../common/types/fields'; +import { Field } from '../../../../../../../../../common/types/fields'; import { createFieldOptions, createScriptFieldOptions, diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/pick_fields_step/pick_fields.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/step_types.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/step_types.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/step_types.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/step_types.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/common.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/common.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/common.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/common.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx index 5e1bf9f1ec889b..c624972aa07ea7 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/datafeed_details/datafeed_details.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiDescriptionList, EuiFormRow } from '@elastic/eui'; import { JobCreatorContext } from '../../../job_creator_context'; import { MLJobEditor } from '../../../../../../jobs_list/components/ml_job_editor'; -import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../../common/util/job_utils'; +import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../../../common/util/job_utils'; import { DEFAULT_QUERY_DELAY } from '../../../../../common/job_creator/util/constants'; import { getNewJobDefaults } from '../../../../../../../services/ml_server_info'; import { ListItems, defaultLabel, Italic } from '../common'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/datafeed_details/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/datafeed_details/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/datafeed_details/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/datafeed_details/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/detector_chart/detector_chart.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/detector_chart/detector_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/detector_chart/detector_chart.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/detector_chart/detector_chart.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/detector_chart/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/detector_chart/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/detector_chart/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/detector_chart/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_details/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_details/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_details/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_details/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_details/job_details.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_details/job_details.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_details/job_details.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_details/job_details.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_progress/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_progress/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_progress/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_progress/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_progress/job_progress.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_progress/job_progress.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/job_progress/job_progress.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/job_progress/job_progress.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/post_save_options/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/post_save_options/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx index a6ef18d4931b97..de019cbe86f9db 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/components/post_save_options/post_save_options.tsx @@ -12,9 +12,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { JobRunner } from '../../../../../common/job_runner'; // @ts-ignore -import { CreateWatchFlyout } from '../../../../../../jobs_list/components/create_watch_flyout'; -import { JobCreatorContext } from '../../../../components/job_creator_context'; -import { DATAFEED_STATE } from '../../../../../../../../common/constants/states'; +import { CreateWatchFlyout } from '../../../../../../jobs_list/components/create_watch_flyout/index'; +import { JobCreatorContext } from '../../../job_creator_context'; +import { DATAFEED_STATE } from '../../../../../../../../../common/constants/states'; interface Props { jobRunner: JobRunner | null; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/summary.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/summary_step/summary.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/summary_step/summary.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/time_range_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/time_range_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/time_range_step/time_range.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/time_range_step/time_range.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/time_range_step/time_range.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/validation_step/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/validation_step/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/validation_step/validation.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/validation_step/validation.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/validation_step/validation.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/wizard_nav/index.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/wizard_nav/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/wizard_nav/index.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/wizard_nav/index.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/wizard_nav/wizard_nav.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/wizard_nav/wizard_nav.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/components/wizard_nav/wizard_nav.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/components/wizard_nav/wizard_nav.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/__test__/directive.js b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/__test__/directive.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/__test__/directive.js rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/__test__/directive.js index bd63a16abfacda..ffa16930e79f20 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/__test__/directive.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/__test__/directive.js @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import sinon from 'sinon'; // Import this way to be able to stub/mock functions later on in the tests using sinon. -import * as indexUtils from 'plugins/ml/util/index_utils'; +import * as indexUtils from '../../../../../util/index_utils'; describe('ML - Index or Saved Search selection directive', () => { let $scope; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/directive.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/directive.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/directive.tsx index 7f3edf0896840e..9bd653708d9c01 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/directive.tsx @@ -13,7 +13,7 @@ const module = uiModules.get('apps/ml', ['react']); import { timefilter } from 'ui/timefilter'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../../common/types/angular'; +import { InjectorService } from '../../../../../../common/types/angular'; import { Page } from './page'; module.directive('mlIndexOrSearch', ($injector: InjectorService) => { diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/page.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/page.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/preconfigured_job_redirect.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/route.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/index_or_search/route.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/route.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/__test__/directive.js b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/__test__/directive.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/__test__/directive.js rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/__test__/directive.js index 5be526f2eb2c02..bdf65e3bafe962 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/__test__/directive.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/__test__/directive.js @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import sinon from 'sinon'; // Import this way to be able to stub/mock functions later on in the tests using sinon. -import * as indexUtils from 'plugins/ml/util/index_utils'; +import * as indexUtils from '../../../../../util/index_utils'; describe('ML - Job Type Directive', () => { let $scope; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/directive.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/directive.tsx similarity index 93% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/directive.tsx index 59dff64c1cd788..8d54ca65a2852a 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/directive.tsx @@ -14,8 +14,8 @@ import { timefilter } from 'ui/timefilter'; import { IndexPatterns } from 'ui/index_patterns'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../../common/types/angular'; -import { createSearchItems } from '../../../new_job/utils/new_job_utils'; +import { InjectorService } from '../../../../../../common/types/angular'; +import { createSearchItems } from '../../utils/new_job_utils'; import { Page } from './page'; import { KibanaContext, KibanaConfigTypeFix } from '../../../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/page.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/page.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/route.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/job_type/route.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/job_type/route.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/directive.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/directive.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/directive.tsx index 1725211861c0ca..db4078ba1bbc86 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/directive.tsx @@ -14,7 +14,7 @@ import { timefilter } from 'ui/timefilter'; import { IndexPatterns } from 'ui/index_patterns'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../../common/types/angular'; +import { InjectorService } from '../../../../../../common/types/angular'; import { createSearchItems } from '../../utils/new_job_utils'; import { Page, PageProps } from './page'; import { JOB_TYPE } from '../../common/job_creator/util/constants'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/page.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/page.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/page.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/route.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/route.ts similarity index 96% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/route.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/route.ts index 7f3f6c364e048e..a527d92342d4ce 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/route.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/route.ts @@ -17,7 +17,7 @@ import { getAdvancedJobConfigurationBreadcrumbs, } from '../../../breadcrumbs'; -import { Route } from '../../../../../common/types/kibana'; +import { Route } from '../../../../../../common/types/kibana'; import { loadNewJobCapabilities } from '../../../../services/new_job_capabilities_service'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard_horizontal_steps.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard_horizontal_steps.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard_horizontal_steps.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard_horizontal_steps.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard_steps.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard_steps.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/pages/new_job/wizard_steps.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/new_job/wizard_steps.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/__test__/directive.js b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/__test__/directive.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/__test__/directive.js rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/__test__/directive.js index 7cbf22bf45ec57..d5d5ee4438e329 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/__test__/directive.js +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/__test__/directive.js @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import sinon from 'sinon'; // Import this way to be able to stub/mock functions later on in the tests using sinon. -import * as indexUtils from 'plugins/ml/util/index_utils'; +import * as indexUtils from '../../../../util/index_utils'; describe('ML - Recognize job directive', () => { let $scope; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/create_result_callout.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/create_result_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/create_result_callout.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/create_result_callout.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/edit_job.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/edit_job.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx index 7ec8cddfe3ed5d..0dd222a1726ef6 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/edit_job.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/edit_job.tsx @@ -22,11 +22,11 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { ModuleJobUI } from '../page'; import { usePartialState } from '../../../../components/custom_hooks'; -import { composeValidators, maxLengthValidator } from '../../../../../common/util/validators'; -import { isJobIdValid } from '../../../../../common/util/job_utils'; -import { JOB_ID_MAX_LENGTH } from '../../../../../common/constants/validation'; +import { composeValidators, maxLengthValidator } from '../../../../../../common/util/validators'; +import { isJobIdValid } from '../../../../../../common/util/job_utils'; +import { JOB_ID_MAX_LENGTH } from '../../../../../../common/constants/validation'; import { JobGroupsInput } from '../../common/components'; -import { JobOverride } from '../../../../../common/types/modules'; +import { JobOverride } from '../../../../../../common/types/modules'; interface EditJobProps { job: ModuleJobUI; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_item.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_item.tsx similarity index 97% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_item.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_item.tsx index ace8409734b742..2a15a42ba04f88 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_item.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_item.tsx @@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { ModuleJobUI } from '../page'; import { SETUP_RESULTS_WIDTH } from './module_jobs'; -import { tabColor } from '../../../../../common/util/group_color_utils'; -import { JobOverride } from '../../../../../common/types/modules'; +import { tabColor } from '../../../../../../common/util/group_color_utils'; +import { JobOverride } from '../../../../../../common/types/modules'; interface JobItemProps { job: ModuleJobUI; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_settings_form.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_settings_form.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx index bae16d620af5bc..4046bd8b09afa5 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/job_settings_form.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/job_settings_form.tsx @@ -25,8 +25,8 @@ import { composeValidators, maxLengthValidator, patternValidator, -} from '../../../../../common/util/validators'; -import { JOB_ID_MAX_LENGTH } from '../../../../../common/constants/validation'; +} from '../../../../../../common/util/validators'; +import { JOB_ID_MAX_LENGTH } from '../../../../../../common/constants/validation'; import { usePartialState } from '../../../../components/custom_hooks'; import { TimeRange, TimeRangePicker } from '../../common/components'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/kibana_objects.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/kibana_objects.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/kibana_objects.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/kibana_objects.tsx diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/module_jobs.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/module_jobs.tsx similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/module_jobs.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/module_jobs.tsx index adae037305ff84..7c72dc63691fa9 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/components/module_jobs.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/components/module_jobs.tsx @@ -17,7 +17,7 @@ import { import { JobOverrides, ModuleJobUI, SAVE_STATE } from '../page'; import { JobItem } from './job_item'; import { EditJob } from './edit_job'; -import { JobOverride } from '../../../../../common/types/modules'; +import { JobOverride } from '../../../../../../common/types/modules'; interface ModuleJobsProps { jobs: ModuleJobUI[]; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/directive.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/directive.tsx similarity index 93% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/directive.tsx index 1882296f964188..2d08a1da074591 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/directive.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/directive.tsx @@ -14,9 +14,9 @@ import { timefilter } from 'ui/timefilter'; import { IndexPatterns } from 'ui/index_patterns'; import { I18nContext } from 'ui/i18n'; -import { InjectorService } from '../../../../common/types/angular'; +import { InjectorService } from '../../../../../common/types/angular'; -import { createSearchItems } from '../../new_job/utils/new_job_utils'; +import { createSearchItems } from '../utils/new_job_utils'; import { Page } from './page'; import { KibanaContext, KibanaConfigTypeFix } from '../../../contexts/kibana'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/page.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/page.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/page.tsx rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/page.tsx index f9a5230ef17d9f..11b2a8f01342db 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/page.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/page.tsx @@ -33,7 +33,7 @@ import { KibanaObjectResponse, Module, ModuleJob, -} from '../../../../common/types/modules'; +} from '../../../../../common/types/modules'; import { mlJobService } from '../../../services/job_service'; import { CreateResultCallout } from './components/create_result_callout'; import { KibanaObjects } from './components/kibana_objects'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/resolvers.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/resolvers.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/resolvers.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/resolvers.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/route.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/recognize/route.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/recognize/route.ts diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job/utils/new_job_utils.ts b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/jobs/new_job/utils/new_job_utils.ts rename to x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts index cb4e7a21997e6f..0e88b291e76fc9 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job/utils/new_job_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/utils/new_job_utils.ts @@ -7,7 +7,7 @@ import { IndexPattern } from 'ui/index_patterns'; import { SavedSearch } from 'src/legacy/core_plugins/kibana/public/discover/types'; import { KibanaConfigTypeFix } from '../../../contexts/kibana'; -import { esQuery, IIndexPattern } from '../../../../../../../../src/plugins/data/public'; +import { esQuery, IIndexPattern } from '../../../../../../../../../src/plugins/data/public'; export interface SearchItems { indexPattern: IIndexPattern; diff --git a/x-pack/legacy/plugins/ml/public/license/__tests__/check_license.js b/x-pack/legacy/plugins/ml/public/application/license/__tests__/check_license.js similarity index 84% rename from x-pack/legacy/plugins/ml/public/license/__tests__/check_license.js rename to x-pack/legacy/plugins/ml/public/application/license/__tests__/check_license.js index e620a29e1d7f1e..7d167fa066fdac 100644 --- a/x-pack/legacy/plugins/ml/public/license/__tests__/check_license.js +++ b/x-pack/legacy/plugins/ml/public/application/license/__tests__/check_license.js @@ -5,8 +5,8 @@ */ import expect from '@kbn/expect'; -import { xpackInfo } from '../../../../xpack_main/public/services/xpack_info'; -import { LICENSE_STATUS_VALID } from '../../../../../common/constants/license_status'; +import { xpackInfo } from '../../../../../xpack_main/public/services/xpack_info'; +import { LICENSE_STATUS_VALID } from '../../../../../../common/constants/license_status'; import { xpackFeatureAvailable, } from '../check_license'; diff --git a/x-pack/legacy/plugins/ml/public/license/check_license.tsx b/x-pack/legacy/plugins/ml/public/application/license/check_license.tsx similarity index 94% rename from x-pack/legacy/plugins/ml/public/license/check_license.tsx rename to x-pack/legacy/plugins/ml/public/application/license/check_license.tsx index 8457e462567cc3..c184a4d4e94e07 100644 --- a/x-pack/legacy/plugins/ml/public/license/check_license.tsx +++ b/x-pack/legacy/plugins/ml/public/application/license/check_license.tsx @@ -9,9 +9,9 @@ import React from 'react'; import { banners } from 'ui/notify'; import { EuiCallOut } from '@elastic/eui'; // @ts-ignore No declaration file for module -import { xpackInfo } from '../../../xpack_main/public/services/xpack_info'; -import { LICENSE_TYPE } from '../../common/constants/license'; -import { LICENSE_STATUS_VALID } from '../../../../common/constants/license_status'; +import { xpackInfo } from '../../../../xpack_main/public/services/xpack_info'; +import { LICENSE_TYPE } from '../../../common/constants/license'; +import { LICENSE_STATUS_VALID } from '../../../../../common/constants/license_status'; let licenseHasExpired = true; let licenseType: LICENSE_TYPE | null = null; diff --git a/x-pack/legacy/plugins/ml/public/application/management/_index.scss b/x-pack/legacy/plugins/ml/public/application/management/_index.scss new file mode 100644 index 00000000000000..e14df2d7c20395 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/management/_index.scss @@ -0,0 +1 @@ +@import 'jobs_list/index'; diff --git a/x-pack/legacy/plugins/ml/public/management/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/management/breadcrumbs.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/management/breadcrumbs.ts diff --git a/x-pack/legacy/plugins/ml/public/management/index.ts b/x-pack/legacy/plugins/ml/public/application/management/index.ts similarity index 87% rename from x-pack/legacy/plugins/ml/public/management/index.ts rename to x-pack/legacy/plugins/ml/public/application/management/index.ts index 744b03c3d592bc..092639cd5fbab1 100644 --- a/x-pack/legacy/plugins/ml/public/management/index.ts +++ b/x-pack/legacy/plugins/ml/public/application/management/index.ts @@ -11,12 +11,12 @@ */ import { management } from 'ui/management'; -// @ts-ignore No declaration file for module -import { xpackInfo } from 'plugins/xpack_main/services/xpack_info'; import { i18n } from '@kbn/i18n'; +// @ts-ignore No declaration file for module +import { xpackInfo } from '../../../../xpack_main/public/services/xpack_info'; import { JOBS_LIST_PATH } from './management_urls'; -import { LICENSE_TYPE } from '../../common/constants/license'; -import 'plugins/ml/management/jobs_list'; +import { LICENSE_TYPE } from '../../../common/constants/license'; +import './jobs_list'; if ( xpackInfo.get('features.ml.showLinks', false) === true && diff --git a/x-pack/legacy/plugins/ml/public/application/management/jobs_list/_index.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/_index.scss new file mode 100644 index 00000000000000..841415620d6917 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/_index.scss @@ -0,0 +1 @@ +@import 'components/index'; diff --git a/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/_index.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/_index.scss new file mode 100644 index 00000000000000..b9e7d17ca209f4 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/_index.scss @@ -0,0 +1,4 @@ +@import 'jobs_list_page/stats_bar'; +@import 'jobs_list_page/buttons'; +@import 'jobs_list_page/expanded_row'; +@import 'jobs_list_page/analytics_table'; diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/access_denied_page.tsx b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/access_denied_page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/access_denied_page.tsx rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/access_denied_page.tsx diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/index.ts b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/index.ts rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/index.ts diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_analytics_table.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_analytics_table.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_analytics_table.scss rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_analytics_table.scss diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_buttons.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_buttons.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_buttons.scss rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_buttons.scss diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_expanded_row.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_expanded_row.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_expanded_row.scss rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_expanded_row.scss diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_stats_bar.scss b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_stats_bar.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/_stats_bar.scss rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/_stats_bar.scss diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/index.ts b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/index.ts rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/index.ts diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx similarity index 99% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx index e3188c0892580e..a19a27d00e9b04 100644 --- a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx +++ b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx @@ -21,7 +21,7 @@ import { import { metadata } from 'ui/metadata'; // @ts-ignore undeclared module -import { JobsListView } from '../../../../jobs/jobs_list/components/jobs_list_view'; +import { JobsListView } from '../../../../jobs/jobs_list/components/jobs_list_view/index'; import { DataFrameAnalyticsList } from '../../../../data_frame_analytics/pages/analytics_management/components/analytics_list'; interface Props { diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/index.ts b/x-pack/legacy/plugins/ml/public/application/management/jobs_list/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/jobs_list/index.ts rename to x-pack/legacy/plugins/ml/public/application/management/jobs_list/index.ts diff --git a/x-pack/legacy/plugins/ml/public/management/management_urls.ts b/x-pack/legacy/plugins/ml/public/application/management/management_urls.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/management/management_urls.ts rename to x-pack/legacy/plugins/ml/public/application/management/management_urls.ts diff --git a/x-pack/legacy/plugins/ml/public/ml.svg b/x-pack/legacy/plugins/ml/public/application/ml.svg similarity index 100% rename from x-pack/legacy/plugins/ml/public/ml.svg rename to x-pack/legacy/plugins/ml/public/application/ml.svg diff --git a/x-pack/legacy/plugins/ml/public/ml_nodes_check/check_ml_nodes.ts b/x-pack/legacy/plugins/ml/public/application/ml_nodes_check/check_ml_nodes.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/ml_nodes_check/check_ml_nodes.ts rename to x-pack/legacy/plugins/ml/public/application/ml_nodes_check/check_ml_nodes.ts diff --git a/x-pack/legacy/plugins/ml/public/ml_nodes_check/index.ts b/x-pack/legacy/plugins/ml/public/application/ml_nodes_check/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/ml_nodes_check/index.ts rename to x-pack/legacy/plugins/ml/public/application/ml_nodes_check/index.ts diff --git a/x-pack/legacy/plugins/ml/public/application/overview/_index.scss b/x-pack/legacy/plugins/ml/public/application/overview/_index.scss new file mode 100644 index 00000000000000..841415620d6917 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/overview/_index.scss @@ -0,0 +1 @@ +@import 'components/index'; diff --git a/x-pack/legacy/plugins/ml/public/overview/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/overview/breadcrumbs.ts similarity index 92% rename from x-pack/legacy/plugins/ml/public/overview/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/overview/breadcrumbs.ts index 893ae5de450ad2..9df503b462b6c0 100644 --- a/x-pack/legacy/plugins/ml/public/overview/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/overview/breadcrumbs.ts @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore -import { ML_BREADCRUMB } from '../breadcrumbs'; +import { ML_BREADCRUMB } from '../../breadcrumbs'; export function getOverviewBreadcrumbs() { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/overview/components/_index.scss b/x-pack/legacy/plugins/ml/public/application/overview/components/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/components/_index.scss rename to x-pack/legacy/plugins/ml/public/application/overview/components/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/analytics_panel.tsx b/x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/analytics_panel.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/analytics_panel.tsx diff --git a/x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/index.ts b/x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/index.ts rename to x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/index.ts diff --git a/x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/table.tsx b/x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/table.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/table.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/table.tsx index 7ee9cff107db83..156e53b19874f0 100644 --- a/x-pack/legacy/plugins/ml/public/overview/components/analytics_panel/table.tsx +++ b/x-pack/legacy/plugins/ml/public/application/overview/components/analytics_panel/table.tsx @@ -8,7 +8,7 @@ import React, { FC, useState } from 'react'; import { EuiBadge } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { - MlInMemoryTable, + mlInMemoryTableFactory, SortDirection, SORT_DIRECTION, OnTableChangeArg, @@ -27,7 +27,7 @@ import { AnalyticsViewAction } from '../../../data_frame_analytics/pages/analyti import { formatHumanReadableDateTimeSeconds } from '../../../util/date_utils'; interface Props { - items: any[]; + items: DataFrameAnalyticsListRow[]; } export const AnalyticsTable: FC = ({ items }) => { const [pageIndex, setPageIndex] = useState(0); @@ -37,7 +37,7 @@ export const AnalyticsTable: FC = ({ items }) => { const [sortDirection, setSortDirection] = useState(SORT_DIRECTION.ASC); // id, type, status, progress, created time, view icon - const columns: ColumnType[] = [ + const columns: Array> = [ { field: DataFrameAnalyticsListColumn.id, name: i18n.translate('xpack.ml.overview.analyticsList.id', { defaultMessage: 'ID' }), @@ -113,6 +113,8 @@ export const AnalyticsTable: FC = ({ items }) => { }, }; + const MlInMemoryTable = mlInMemoryTableFactory(); + return ( ; diff --git a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/index.ts b/x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/index.ts rename to x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/index.ts diff --git a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/table.tsx b/x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/table.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/table.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/table.tsx index 9c863f115685b2..4a2d8ea24e7f51 100644 --- a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/table.tsx +++ b/x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/table.tsx @@ -17,7 +17,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { - MlInMemoryTable, + mlInMemoryTableFactory, SortDirection, SORT_DIRECTION, OnTableChangeArg, @@ -27,12 +27,12 @@ import { formatHumanReadableDateTimeSeconds } from '../../../util/date_utils'; import { ExplorerLink } from './actions'; import { getJobsFromGroup } from './utils'; import { GroupsDictionary, Group } from './anomaly_detection_panel'; -import { MlSummaryJobs } from '../../../../common/types/jobs'; +import { MlSummaryJobs } from '../../../../../common/types/jobs'; import { StatsBar, JobStatsBarStats } from '../../../components/stats_bar'; // @ts-ignore -import { JobSelectorBadge } from '../../../components/job_selector/job_selector_badge'; +import { JobSelectorBadge } from '../../../components/job_selector/job_selector_badge/index'; import { toLocaleString } from '../../../util/string_utils'; -import { getSeverityColor } from '../../../../common/util/anomaly_utils'; +import { getSeverityColor } from '../../../../../common/util/anomaly_utils'; // Used to pass on attribute names to table columns export enum AnomalyDetectionListColumns { @@ -59,7 +59,7 @@ export const AnomalyDetectionTable: FC = ({ items, jobsList, statsBarData const [sortDirection, setSortDirection] = useState(SORT_DIRECTION.ASC); // columns: group, max anomaly, jobs in group, latest timestamp, docs processed, action to explorer - const columns: ColumnType[] = [ + const columns: Array> = [ { field: AnomalyDetectionListColumns.id, name: i18n.translate('xpack.ml.overview.anomalyDetection.tableId', { @@ -195,6 +195,8 @@ export const AnomalyDetectionTable: FC = ({ items, jobsList, statsBarData }, }; + const MlInMemoryTable = mlInMemoryTableFactory(); + return ( diff --git a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/utils.ts b/x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/utils.ts similarity index 96% rename from x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/utils.ts rename to x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/utils.ts index db369d9228e6c7..01848bad2670ef 100644 --- a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/overview/components/anomaly_detection_panel/utils.ts @@ -5,9 +5,9 @@ */ import { i18n } from '@kbn/i18n'; -import { JOB_STATE, DATAFEED_STATE } from '../../../../common/constants/states'; +import { JOB_STATE, DATAFEED_STATE } from '../../../../../common/constants/states'; import { Group, GroupsDictionary } from './anomaly_detection_panel'; -import { MlSummaryJobs, MlSummaryJob } from '../../../../common/types/jobs'; +import { MlSummaryJobs, MlSummaryJob } from '../../../../../common/types/jobs'; export function getGroupsFromJobs( jobs: MlSummaryJobs diff --git a/x-pack/legacy/plugins/ml/public/overview/components/content.tsx b/x-pack/legacy/plugins/ml/public/application/overview/components/content.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/overview/components/content.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/components/content.tsx index a285d5c91a266e..8d2e4865ee6f40 100644 --- a/x-pack/legacy/plugins/ml/public/overview/components/content.tsx +++ b/x-pack/legacy/plugins/ml/public/application/overview/components/content.tsx @@ -7,7 +7,7 @@ import React, { FC } from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { AnomalyDetectionPanel } from './anomaly_detection_panel'; -import { AnalyticsPanel } from './analytics_panel/'; +import { AnalyticsPanel } from './analytics_panel'; interface Props { createAnomalyDetectionJobDisabled: boolean; diff --git a/x-pack/legacy/plugins/ml/public/overview/components/sidebar.tsx b/x-pack/legacy/plugins/ml/public/application/overview/components/sidebar.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/components/sidebar.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/components/sidebar.tsx diff --git a/x-pack/legacy/plugins/ml/public/overview/directive.tsx b/x-pack/legacy/plugins/ml/public/application/overview/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/overview/index.ts b/x-pack/legacy/plugins/ml/public/application/overview/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/index.ts rename to x-pack/legacy/plugins/ml/public/application/overview/index.ts diff --git a/x-pack/legacy/plugins/ml/public/overview/overview_page.tsx b/x-pack/legacy/plugins/ml/public/application/overview/overview_page.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/overview_page.tsx rename to x-pack/legacy/plugins/ml/public/application/overview/overview_page.tsx diff --git a/x-pack/legacy/plugins/ml/public/overview/route.ts b/x-pack/legacy/plugins/ml/public/application/overview/route.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/overview/route.ts rename to x-pack/legacy/plugins/ml/public/application/overview/route.ts diff --git a/x-pack/legacy/plugins/ml/public/privilege/check_privilege.ts b/x-pack/legacy/plugins/ml/public/application/privilege/check_privilege.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/privilege/check_privilege.ts rename to x-pack/legacy/plugins/ml/public/application/privilege/check_privilege.ts index 2c0cb71cd876cd..6cc06231a08d04 100644 --- a/x-pack/legacy/plugins/ml/public/privilege/check_privilege.ts +++ b/x-pack/legacy/plugins/ml/public/application/privilege/check_privilege.ts @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import { hasLicenseExpired } from '../license/check_license'; -import { Privileges, getDefaultPrivileges } from '../../common/types/privileges'; +import { Privileges, getDefaultPrivileges } from '../../../common/types/privileges'; import { getPrivileges, getManageMlPrivileges } from './get_privileges'; import { ACCESS_DENIED_PATH } from '../management/management_urls'; diff --git a/x-pack/legacy/plugins/ml/public/privilege/get_privileges.ts b/x-pack/legacy/plugins/ml/public/application/privilege/get_privileges.ts similarity index 93% rename from x-pack/legacy/plugins/ml/public/privilege/get_privileges.ts rename to x-pack/legacy/plugins/ml/public/application/privilege/get_privileges.ts index adca02b434e383..a3811779333d99 100644 --- a/x-pack/legacy/plugins/ml/public/privilege/get_privileges.ts +++ b/x-pack/legacy/plugins/ml/public/application/privilege/get_privileges.ts @@ -7,7 +7,7 @@ import { ml } from '../services/ml_api_service'; import { setUpgradeInProgress } from '../services/upgrade_service'; -import { PrivilegesResponse } from '../../common/types/privileges'; +import { PrivilegesResponse } from '../../../common/types/privileges'; export function getPrivileges(): Promise { return new Promise((resolve, reject) => { diff --git a/x-pack/legacy/plugins/ml/public/services/__mocks__/cloudwatch_job_caps_response.json b/x-pack/legacy/plugins/ml/public/application/services/__mocks__/cloudwatch_job_caps_response.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/__mocks__/cloudwatch_job_caps_response.json rename to x-pack/legacy/plugins/ml/public/application/services/__mocks__/cloudwatch_job_caps_response.json diff --git a/x-pack/legacy/plugins/ml/public/services/__mocks__/ml_info_response.json b/x-pack/legacy/plugins/ml/public/application/services/__mocks__/ml_info_response.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/__mocks__/ml_info_response.json rename to x-pack/legacy/plugins/ml/public/application/services/__mocks__/ml_info_response.json diff --git a/x-pack/legacy/plugins/ml/public/services/annotations_service.test.tsx b/x-pack/legacy/plugins/ml/public/application/services/annotations_service.test.tsx similarity index 95% rename from x-pack/legacy/plugins/ml/public/services/annotations_service.test.tsx rename to x-pack/legacy/plugins/ml/public/application/services/annotations_service.test.tsx index 3e2410292629b9..eed9e46a477453 100644 --- a/x-pack/legacy/plugins/ml/public/services/annotations_service.test.tsx +++ b/x-pack/legacy/plugins/ml/public/application/services/annotations_service.test.tsx @@ -6,7 +6,7 @@ import mockAnnotations from '../components/annotations/annotations_table/__mocks__/mock_annotations.json'; -import { Annotation } from '../../common/types/annotations'; +import { Annotation } from '../../../common/types/annotations'; import { annotation$, annotationsRefresh$ } from './annotations_service'; describe('annotations_service', () => { diff --git a/x-pack/legacy/plugins/ml/public/services/annotations_service.tsx b/x-pack/legacy/plugins/ml/public/application/services/annotations_service.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/services/annotations_service.tsx rename to x-pack/legacy/plugins/ml/public/application/services/annotations_service.tsx index 4e8b0ad99d3711..051c6ab4451022 100644 --- a/x-pack/legacy/plugins/ml/public/services/annotations_service.tsx +++ b/x-pack/legacy/plugins/ml/public/application/services/annotations_service.tsx @@ -6,7 +6,7 @@ import { BehaviorSubject, Subject } from 'rxjs'; -import { Annotation } from '../../common/types/annotations'; +import { Annotation } from '../../../common/types/annotations'; /* A TypeScript helper type to allow a given component state attribute to be either an annotation or null. @@ -41,7 +41,7 @@ export type AnnotationState = Annotation | null; There are two ways to deal with updates of the observable: - 1. Inline subscription in an existing component. + 1. Inline subscription in an existing component. This requires the component to be a class component and manage its own state. - To react to an update, use `annotation$.subscribe(annotation => { })`. diff --git a/x-pack/legacy/plugins/ml/public/services/calendar_service.js b/x-pack/legacy/plugins/ml/public/application/services/calendar_service.js similarity index 93% rename from x-pack/legacy/plugins/ml/public/services/calendar_service.js rename to x-pack/legacy/plugins/ml/public/application/services/calendar_service.js index 09e3001a0f7f56..dafb6b49ad14d5 100644 --- a/x-pack/legacy/plugins/ml/public/services/calendar_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/calendar_service.js @@ -9,9 +9,9 @@ import _ from 'lodash'; import { i18n } from '@kbn/i18n'; -import { ml } from 'plugins/ml/services/ml_api_service'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { mlMessageBarService } from 'plugins/ml/components/messagebar'; +import { ml } from '../services/ml_api_service'; +import { mlJobService } from '../services/job_service'; +import { mlMessageBarService } from '../components/messagebar'; diff --git a/x-pack/legacy/plugins/ml/public/services/field_format_service.ts b/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/services/field_format_service.ts rename to x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts index e4341adebda7ab..ce6bc7896c44cf 100644 --- a/x-pack/legacy/plugins/ml/public/services/field_format_service.ts +++ b/x-pack/legacy/plugins/ml/public/application/services/field_format_service.ts @@ -5,9 +5,9 @@ */ import { IndexPattern } from 'ui/index_patterns'; -import { mlFunctionToESAggregation } from '../../common/util/job_utils'; +import { mlFunctionToESAggregation } from '../../../common/util/job_utils'; import { getIndexPatternById, getIndexPatternIdFromName } from '../util/index_utils'; -import { mlJobService } from '../services/job_service'; +import { mlJobService } from './job_service'; type FormatsByJobId = Record; type IndexPatternIdsByJob = Record; diff --git a/x-pack/legacy/plugins/ml/public/application/services/forecast_service.d.ts b/x-pack/legacy/plugins/ml/public/application/services/forecast_service.d.ts new file mode 100644 index 00000000000000..19f77d97a57080 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/services/forecast_service.d.ts @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Observable } from 'rxjs'; +import { Job } from '../jobs/new_job/common/job_creator/configs'; + +export interface ForecastData { + success: boolean; + results: any; +} + +export const mlForecastService: { + getForecastData: ( + job: Job, + detectorIndex: number, + forecastId: string, + entityFields: any[], + earliestMs: number, + latestMs: number, + interval: string, + aggType: any + ) => Observable; +}; diff --git a/x-pack/legacy/plugins/ml/public/services/forecast_service.js b/x-pack/legacy/plugins/ml/public/application/services/forecast_service.js similarity index 72% rename from x-pack/legacy/plugins/ml/public/services/forecast_service.js rename to x-pack/legacy/plugins/ml/public/application/services/forecast_service.js index 4ec8a9dd1fec4c..4b6ce19b5e6c68 100644 --- a/x-pack/legacy/plugins/ml/public/services/forecast_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/forecast_service.js @@ -9,8 +9,9 @@ // Service for carrying out requests to run ML forecasts and to obtain // data on forecasts that have been performed. import _ from 'lodash'; +import { map } from 'rxjs/operators'; -import { ML_RESULTS_INDEX_PATTERN } from '../../common/constants/index_patterns'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../common/constants/index_patterns'; import { ml } from './ml_api_service'; // Gets a basic summary of the most recently run forecasts for the specified @@ -192,117 +193,112 @@ function getForecastData( } } - return new Promise((resolve, reject) => { - const obj = { - success: true, - results: {} - }; - - // Build the criteria to use in the bool filter part of the request. - // Add criteria for the job ID, forecast ID, detector index, result type and time range. - const filterCriteria = [{ - query_string: { - query: 'result_type:model_forecast', - analyze_wildcard: true - } - }, - { - term: { job_id: job.job_id } - }, - { - term: { forecast_id: forecastId } - }, - { - term: { detector_index: detectorIndex } - }, - { - range: { - timestamp: { - gte: earliestMs, - lte: latestMs, - format: 'epoch_millis' - } + const obj = { + success: true, + results: {} + }; + + // Build the criteria to use in the bool filter part of the request. + // Add criteria for the job ID, forecast ID, detector index, result type and time range. + const filterCriteria = [{ + query_string: { + query: 'result_type:model_forecast', + analyze_wildcard: true + } + }, + { + term: { job_id: job.job_id } + }, + { + term: { forecast_id: forecastId } + }, + { + term: { detector_index: detectorIndex } + }, + { + range: { + timestamp: { + gte: earliestMs, + lte: latestMs, + format: 'epoch_millis' } - }]; + } + }]; - // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { - filterCriteria.push({ - term: { - [criteria.fieldName]: criteria.fieldValue - } - }); + // Add in term queries for each of the specified criteria. + _.each(criteriaFields, (criteria) => { + filterCriteria.push({ + term: { + [criteria.fieldName]: criteria.fieldValue + } }); + }); - // If an aggType object has been passed in, use it. - // Otherwise default to avg, min and max aggs for the - // forecast prediction, upper and lower - const forecastAggs = (aggType === undefined) ? - { avg: 'avg', max: 'max', min: 'min' } : - { - avg: aggType.avg, - max: aggType.max, - min: aggType.min - }; + // If an aggType object has been passed in, use it. + // Otherwise default to avg, min and max aggs for the + // forecast prediction, upper and lower + const forecastAggs = (aggType === undefined) ? + { avg: 'avg', max: 'max', min: 'min' } : + { + avg: aggType.avg, + max: aggType.max, + min: aggType.min + }; - ml.esSearch({ - index: ML_RESULTS_INDEX_PATTERN, - size: 0, - body: { - query: { - bool: { - filter: filterCriteria - } - }, - aggs: { - times: { - date_histogram: { - field: 'timestamp', - interval: interval, - min_doc_count: 1 + return ml.esSearch$({ + index: ML_RESULTS_INDEX_PATTERN, + size: 0, + body: { + query: { + bool: { + filter: filterCriteria + } + }, + aggs: { + times: { + date_histogram: { + field: 'timestamp', + interval: interval, + min_doc_count: 1 + }, + aggs: { + prediction: { + [forecastAggs.avg]: { + field: 'forecast_prediction' + } + }, + forecastUpper: { + [forecastAggs.max]: { + field: 'forecast_upper' + } }, - aggs: { - prediction: { - [forecastAggs.avg]: { - field: 'forecast_prediction' - } - }, - forecastUpper: { - [forecastAggs.max]: { - field: 'forecast_upper' - } - }, - forecastLower: { - [forecastAggs.min]: { - field: 'forecast_lower' - } + forecastLower: { + [forecastAggs.min]: { + field: 'forecast_lower' } } } } } - }) - .then((resp) => { - const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); - _.each(aggregationsByTime, (dataForTime) => { - const time = dataForTime.key; - obj.results[time] = { - prediction: _.get(dataForTime, ['prediction', 'value']), - forecastUpper: _.get(dataForTime, ['forecastUpper', 'value']), - forecastLower: _.get(dataForTime, ['forecastLower', 'value']) - }; - }); - - resolve(obj); - }) - .catch((resp) => { - reject(resp); + } + }).pipe( + map(resp => { + const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); + _.each(aggregationsByTime, (dataForTime) => { + const time = dataForTime.key; + obj.results[time] = { + prediction: _.get(dataForTime, ['prediction', 'value']), + forecastUpper: _.get(dataForTime, ['forecastUpper', 'value']), + forecastLower: _.get(dataForTime, ['forecastLower', 'value']) + }; }); - }); + return obj; + }) + ); } // Runs a forecast diff --git a/x-pack/legacy/plugins/ml/public/application/services/http_service.ts b/x-pack/legacy/plugins/ml/public/application/services/http_service.ts new file mode 100644 index 00000000000000..1d68ec5b886eb0 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/services/http_service.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// service for interacting with the server + +import chrome from 'ui/chrome'; + +// @ts-ignore +import { addSystemApiHeader } from 'ui/system_api'; +import { fromFetch } from 'rxjs/fetch'; +import { from, Observable } from 'rxjs'; +import { switchMap } from 'rxjs/operators'; + +export interface HttpOptions { + url?: string; +} + +function getResultHeaders(headers: HeadersInit): HeadersInit { + return addSystemApiHeader({ + 'Content-Type': 'application/json', + 'kbn-version': chrome.getXsrfToken(), + ...headers, + }); +} + +export function http(options: any) { + return new Promise((resolve, reject) => { + if (options && options.url) { + let url = ''; + url = url + (options.url || ''); + const headers: Record = addSystemApiHeader({ + 'Content-Type': 'application/json', + 'kbn-version': chrome.getXsrfToken(), + ...options.headers, + }); + + const allHeaders = + options.headers === undefined ? headers : { ...options.headers, ...headers }; + const body = options.data === undefined ? null : JSON.stringify(options.data); + + const payload: RequestInit = { + method: options.method || 'GET', + headers: allHeaders, + credentials: 'same-origin', + }; + + if (body !== null) { + payload.body = body; + } + + fetch(url, payload) + .then(resp => { + resp.json().then(resp.ok === true ? resolve : reject); + }) + .catch(resp => { + reject(resp); + }); + } else { + reject(); + } + }); +} + +interface RequestOptions extends RequestInit { + body: BodyInit | any; +} + +export function http$(url: string, options: RequestOptions): Observable { + const requestInit: RequestInit = { + ...options, + credentials: 'same-origin', + method: options.method || 'GET', + ...(options.body ? { body: JSON.stringify(options.body) as string } : {}), + headers: getResultHeaders(options.headers ?? {}), + }; + + return fromFetch(url, requestInit).pipe( + switchMap(response => { + if (response.ok) { + return from(response.json() as Promise); + } else { + throw new Error(String(response.status)); + } + }) + ); +} diff --git a/x-pack/legacy/plugins/ml/public/services/job_messages_service.js b/x-pack/legacy/plugins/ml/public/application/services/job_messages_service.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/services/job_messages_service.js rename to x-pack/legacy/plugins/ml/public/application/services/job_messages_service.js index 725de9e9c62375..fcd4d6088b44bf 100644 --- a/x-pack/legacy/plugins/ml/public/services/job_messages_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/job_messages_service.js @@ -10,8 +10,8 @@ // Service for carrying out Elasticsearch queries to obtain data for the // Ml Results dashboards. -import { ML_NOTIFICATION_INDEX_PATTERN } from 'plugins/ml/../common/constants/index_patterns'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { ML_NOTIFICATION_INDEX_PATTERN } from '../../../common/constants/index_patterns'; +import { ml } from '../services/ml_api_service'; // filter to match job_type: 'anomaly_detector' or no job_type field at all // if no job_type field exist, we can assume the message is for an anomaly detector job diff --git a/x-pack/legacy/plugins/ml/public/services/job_service.d.ts b/x-pack/legacy/plugins/ml/public/application/services/job_service.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/job_service.d.ts rename to x-pack/legacy/plugins/ml/public/application/services/job_service.d.ts diff --git a/x-pack/legacy/plugins/ml/public/services/job_service.js b/x-pack/legacy/plugins/ml/public/application/services/job_service.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/services/job_service.js rename to x-pack/legacy/plugins/ml/public/application/services/job_service.js index 27dcd0135ad77d..3db2b6c6dd88e1 100644 --- a/x-pack/legacy/plugins/ml/public/services/job_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/job_service.js @@ -15,8 +15,8 @@ import { ml } from './ml_api_service'; import { mlMessageBarService } from '../components/messagebar'; import { isWebUrl } from '../util/url_utils'; -import { ML_DATA_PREVIEW_COUNT } from '../../common/util/job_utils'; -import { parseInterval } from '../../common/util/parse_interval'; +import { ML_DATA_PREVIEW_COUNT } from '../../../common/util/job_utils'; +import { parseInterval } from '../../../common/util/parse_interval'; const msgs = mlMessageBarService; let jobs = []; diff --git a/x-pack/legacy/plugins/ml/public/services/mapping_service.js b/x-pack/legacy/plugins/ml/public/application/services/mapping_service.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/services/mapping_service.js rename to x-pack/legacy/plugins/ml/public/application/services/mapping_service.js index c206930e12cd63..3ee49fda20819b 100644 --- a/x-pack/legacy/plugins/ml/public/services/mapping_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/mapping_service.js @@ -8,7 +8,7 @@ import _ from 'lodash'; -import { ml } from '../services/ml_api_service'; +import { ml } from './ml_api_service'; // Returns the mapping type of the specified field. // Accepts fieldName containing dots representing a nested sub-field. diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/annotations.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/annotations.ts similarity index 55% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/annotations.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/annotations.ts index c889d0e98ad3e9..54d55159646f64 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/annotations.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/annotations.ts @@ -4,33 +4,36 @@ * you may not use this file except in compliance with the Elastic License. */ - - import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { Annotation } from '../../../../common/types/annotations'; +import { http, http$ } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); export const annotations = { - getAnnotations(obj) { - return http({ - url: `${basePath}/annotations`, + getAnnotations(obj: { + jobIds: string[]; + earliestMs: number; + latestMs: number; + maxAnnotations: number; + }) { + return http$<{ annotations: Record }>(`${basePath}/annotations`, { method: 'POST', - data: obj + body: obj, }); }, - indexAnnotation(obj) { + indexAnnotation(obj: any) { return http({ url: `${basePath}/annotations/index`, method: 'PUT', - data: obj + data: obj, }); }, - deleteAnnotation(id) { + deleteAnnotation(id: string) { return http({ url: `${basePath}/annotations/delete/${id}`, - method: 'DELETE' + method: 'DELETE', }); - } + }, }; diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/data_frame_analytics.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/data_frame_analytics.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.js index 3f987a1763140e..d29793366b9a20 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/data_frame_analytics.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/data_frame_analytics.js @@ -8,7 +8,7 @@ import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/datavisualizer.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/datavisualizer.js similarity index 95% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/datavisualizer.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/datavisualizer.js index 323a70a6912b4f..eb4c84ce5764c6 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/datavisualizer.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/datavisualizer.js @@ -6,7 +6,7 @@ import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/filters.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/filters.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/filters.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/filters.js index 7f07e227e4167d..18b7d93b0ca2e9 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/filters.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/filters.js @@ -9,7 +9,7 @@ import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.d.ts similarity index 87% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.d.ts index 12f39bfa78dc0d..7c0b22b0e19662 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.d.ts +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.d.ts @@ -4,17 +4,19 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Annotation } from '../../../common/types/annotations'; -import { AggFieldNamePair } from '../../../common/types/fields'; +import { Observable } from 'rxjs'; +import { Annotation } from '../../../../common/types/annotations'; +import { AggFieldNamePair } from '../../../../common/types/fields'; import { ExistingJobsAndGroups } from '../job_service'; -import { PrivilegesResponse } from '../../../common/types/privileges'; -import { MlSummaryJobs } from '../../../common/types/jobs'; -import { MlServerDefaults, MlServerLimits } from '../../services/ml_server_info'; -import { ES_AGGREGATION } from '../../../common/constants/aggregation_types'; +import { PrivilegesResponse } from '../../../../common/types/privileges'; +import { MlSummaryJobs } from '../../../../common/types/jobs'; +import { MlServerDefaults, MlServerLimits } from '../ml_server_info'; +import { ES_AGGREGATION } from '../../../../common/constants/aggregation_types'; import { DataFrameAnalyticsStats } from '../../data_frame_analytics/pages/analytics_management/components/analytics_list/common'; -import { JobMessage } from '../../../common/types/audit_message'; +import { JobMessage } from '../../../../common/types/audit_message'; import { DataFrameAnalyticsConfig } from '../../data_frame_analytics/common/analytics'; -import { DeepPartial } from '../../../common/types/common'; +import { DeepPartial } from '../../../../common/types/common'; +import { annotations } from './annotations'; // TODO This is not a complete representation of all methods of `ml.*`. // It just satisfies needs for other parts of the code area which use @@ -65,6 +67,7 @@ declare interface Ml { annotations: { deleteAnnotation(id: string | undefined): Promise; indexAnnotation(annotation: Annotation): Promise; + getAnnotations: typeof annotations.getAnnotations; }; dataFrameAnalytics: { @@ -92,6 +95,7 @@ declare interface Ml { getJobStats(obj: object): Promise; getDatafeedStats(obj: object): Promise; esSearch(obj: object): any; + esSearch$(obj: object): Observable; getIndices(): Promise; dataRecognizerModuleJobsExist(obj: { moduleId: string }): Promise; getDataRecognizerModule(obj: { moduleId: string }): Promise; @@ -159,6 +163,7 @@ declare interface Ml { mlNodeCount(): Promise<{ count: number }>; mlInfo(): Promise; + getCardinalityOfFields(obj: Record): any; } declare const ml: Ml; diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/index.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.js index 94c79fe470236d..34d9f9ec16f83a 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/index.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/index.js @@ -9,7 +9,7 @@ import { pick } from 'lodash'; import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http, http$ } from '../http_service'; import { annotations } from './annotations'; import { dataFrameAnalytics } from './data_frame_analytics'; @@ -444,6 +444,13 @@ export const ml = { }); }, + esSearch$(obj) { + return http$(`${basePath}/es_search`, { + method: 'POST', + body: obj + }); + }, + getIndices() { const tempBasePath = chrome.addBasePath('/api'); return http({ diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/jobs.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/jobs.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/jobs.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/jobs.js index 39b646998b4261..4ff1ca785d2261 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/jobs.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/jobs.js @@ -6,7 +6,7 @@ import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); diff --git a/x-pack/legacy/plugins/ml/public/services/ml_api_service/results.js b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/results.js similarity index 92% rename from x-pack/legacy/plugins/ml/public/services/ml_api_service/results.js rename to x-pack/legacy/plugins/ml/public/application/services/ml_api_service/results.js index 7a776d61dca21a..f9874cca840a75 100644 --- a/x-pack/legacy/plugins/ml/public/services/ml_api_service/results.js +++ b/x-pack/legacy/plugins/ml/public/application/services/ml_api_service/results.js @@ -8,7 +8,7 @@ import chrome from 'ui/chrome'; -import { http } from '../../services/http_service'; +import { http, http$ } from '../http_service'; const basePath = chrome.addBasePath('/api/ml'); @@ -25,11 +25,9 @@ export const results = { maxRecords, maxExamples, influencersFilterQuery) { - - return http({ - url: `${basePath}/results/anomalies_table_data`, + return http$(`${basePath}/results/anomalies_table_data`, { method: 'POST', - data: { + body: { jobIds, criteriaFields, influencers, diff --git a/x-pack/legacy/plugins/ml/public/services/ml_server_info.test.ts b/x-pack/legacy/plugins/ml/public/application/services/ml_server_info.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/ml_server_info.test.ts rename to x-pack/legacy/plugins/ml/public/application/services/ml_server_info.test.ts diff --git a/x-pack/legacy/plugins/ml/public/services/ml_server_info.ts b/x-pack/legacy/plugins/ml/public/application/services/ml_server_info.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/ml_server_info.ts rename to x-pack/legacy/plugins/ml/public/application/services/ml_server_info.ts diff --git a/x-pack/legacy/plugins/ml/public/services/new_job_capabilities._service.test.ts b/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/new_job_capabilities._service.test.ts rename to x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities._service.test.ts diff --git a/x-pack/legacy/plugins/ml/public/services/new_job_capabilities_service.ts b/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities_service.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/services/new_job_capabilities_service.ts rename to x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities_service.ts index ded9aa410766e5..a614be547abde8 100644 --- a/x-pack/legacy/plugins/ml/public/services/new_job_capabilities_service.ts +++ b/x-pack/legacy/plugins/ml/public/application/services/new_job_capabilities_service.ts @@ -14,8 +14,8 @@ import { FieldId, NewJobCaps, EVENT_RATE_FIELD_ID, -} from '../../common/types/fields'; -import { ES_FIELD_TYPES } from '../../../../../../src/plugins/data/public'; +} from '../../../common/types/fields'; +import { ES_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; import { ml } from './ml_api_service'; // called in the angular routing resolve block to initialize the diff --git a/x-pack/legacy/plugins/ml/public/application/services/results_service/index.ts b/x-pack/legacy/plugins/ml/public/application/services/results_service/index.ts new file mode 100644 index 00000000000000..9ab14aa7495a70 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/services/results_service/index.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + getMetricData, + getModelPlotOutput, + getRecordsForCriteria, + getScheduledEventsByBucket, +} from './result_service_rx'; +import { + getEventDistributionData, + getEventRateData, + getInfluencerValueMaxScoreByTime, + getOverallBucketScores, + getRecordInfluencers, + getRecordMaxScoreByTime, + getRecords, + getRecordsForDetector, + getRecordsForInfluencer, + getScoresByBucket, + getTopInfluencers, + getTopInfluencerValues, +} from './results_service'; + +export const mlResultsService = { + getScoresByBucket, + getScheduledEventsByBucket, + getTopInfluencers, + getTopInfluencerValues, + getOverallBucketScores, + getInfluencerValueMaxScoreByTime, + getRecordInfluencers, + getRecordsForInfluencer, + getRecordsForDetector, + getRecords, + getRecordsForCriteria, + getMetricData, + getEventRateData, + getEventDistributionData, + getModelPlotOutput, + getRecordMaxScoreByTime, +}; + +type time = string; +export interface ModelPlotOutputResults { + results: Record; +} + +export interface CriteriaField { + fieldName: string; + fieldValue: any; +} diff --git a/x-pack/legacy/plugins/ml/public/application/services/results_service/result_service_rx.ts b/x-pack/legacy/plugins/ml/public/application/services/results_service/result_service_rx.ts new file mode 100644 index 00000000000000..2341ae15a3378c --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/services/results_service/result_service_rx.ts @@ -0,0 +1,534 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +// Queries Elasticsearch to obtain metric aggregation results. +// index can be a String, or String[], of index names to search. +// entityFields parameter must be an array, with each object in the array having 'fieldName' +// and 'fieldValue' properties. +// Extra query object can be supplied, or pass null if no additional query +// to that built from the supplied entity fields. +// Returned response contains a results property containing the requested aggregation. +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import _ from 'lodash'; +import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; +import { ml } from '../ml_api_service'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../../common/constants/index_patterns'; +import { CriteriaField } from './index'; + +interface ResultResponse { + success: boolean; +} + +export interface MetricData extends ResultResponse { + results: Record; +} + +export function getMetricData( + index: string, + entityFields: any[], + query: object | undefined, + metricFunction: string, // ES aggregation name + metricFieldName: string, + timeFieldName: string, + earliestMs: number, + latestMs: number, + interval: string +): Observable { + // Build the criteria to use in the bool filter part of the request. + // Add criteria for the time range, entity fields, + // plus any additional supplied query. + const shouldCriteria: object[] = []; + const mustCriteria: object[] = [ + { + range: { + [timeFieldName]: { + gte: earliestMs, + lte: latestMs, + format: 'epoch_millis', + }, + }, + }, + ...(query ? [query] : []), + ]; + + entityFields.forEach(entity => { + if (entity.fieldValue.length !== 0) { + mustCriteria.push({ + term: { + [entity.fieldName]: entity.fieldValue, + }, + }); + } else { + // Add special handling for blank entity field values, checking for either + // an empty string or the field not existing. + shouldCriteria.push({ + bool: { + must: [ + { + term: { + [entity.fieldName]: '', + }, + }, + ], + }, + }); + shouldCriteria.push({ + bool: { + must_not: [ + { + exists: { field: entity.fieldName }, + }, + ], + }, + }); + } + }); + + const body: any = { + query: { + bool: { + must: mustCriteria, + }, + }, + size: 0, + _source: { + excludes: [], + }, + aggs: { + byTime: { + date_histogram: { + field: timeFieldName, + interval, + min_doc_count: 0, + }, + }, + }, + }; + + if (shouldCriteria.length > 0) { + body.query.bool.should = shouldCriteria; + body.query.bool.minimum_should_match = shouldCriteria.length / 2; + } + + if (metricFieldName !== undefined && metricFieldName !== '') { + body.aggs.byTime.aggs = {}; + + const metricAgg: any = { + [metricFunction]: { + field: metricFieldName, + }, + }; + + if (metricFunction === 'percentiles') { + metricAgg[metricFunction].percents = [ML_MEDIAN_PERCENTS]; + } + body.aggs.byTime.aggs.metric = metricAgg; + } + + return ml.esSearch$({ index, body }).pipe( + map((resp: any) => { + const obj: MetricData = { success: true, results: {} }; + const dataByTime = resp?.aggregations?.byTime?.buckets ?? []; + dataByTime.forEach((dataForTime: any) => { + if (metricFunction === 'count') { + obj.results[dataForTime.key] = dataForTime.doc_count; + } else { + const value = dataForTime?.metric?.value; + const values = dataForTime?.metric?.values; + if (dataForTime.doc_count === 0) { + obj.results[dataForTime.key] = null; + } else if (value !== undefined) { + obj.results[dataForTime.key] = value; + } else if (values !== undefined) { + // Percentiles agg currently returns NaN rather than null when none of the docs in the + // bucket contain the field used in the aggregation + // (see elasticsearch issue https://github.com/elastic/elasticsearch/issues/29066). + // Store as null, so values can be handled in the same manner downstream as other aggs + // (min, mean, max) which return null. + const medianValues = values[ML_MEDIAN_PERCENTS]; + obj.results[dataForTime.key] = !isNaN(medianValues) ? medianValues : null; + } else { + obj.results[dataForTime.key] = null; + } + } + }); + + return obj; + }) + ); +} + +export interface ModelPlotOutput extends ResultResponse { + results: Record; +} + +export function getModelPlotOutput( + jobId: string, + detectorIndex: number, + criteriaFields: any[], + earliestMs: number, + latestMs: number, + interval: string, + aggType?: { min: any; max: any } +): Observable { + const obj: ModelPlotOutput = { + success: true, + results: {}, + }; + + // if an aggType object has been passed in, use it. + // otherwise default to min and max aggs for the upper and lower bounds + const modelAggs = + aggType === undefined + ? { max: 'max', min: 'min' } + : { + max: aggType.max, + min: aggType.min, + }; + + // Build the criteria to use in the bool filter part of the request. + // Add criteria for the job ID and time range. + const mustCriteria: object[] = [ + { + term: { job_id: jobId }, + }, + { + range: { + timestamp: { + gte: earliestMs, + lte: latestMs, + format: 'epoch_millis', + }, + }, + }, + ]; + + // Add in term queries for each of the specified criteria. + _.each(criteriaFields, criteria => { + mustCriteria.push({ + term: { + [criteria.fieldName]: criteria.fieldValue, + }, + }); + }); + + // Add criteria for the detector index. Results from jobs created before 6.1 will not + // contain a detector_index field, so use a should criteria with a 'not exists' check. + const shouldCriteria = [ + { + term: { detector_index: detectorIndex }, + }, + { + bool: { + must_not: [ + { + exists: { field: 'detector_index' }, + }, + ], + }, + }, + ]; + + return ml + .esSearch$({ + index: ML_RESULTS_INDEX_PATTERN, + size: 0, + body: { + query: { + bool: { + filter: [ + { + query_string: { + query: 'result_type:model_plot', + analyze_wildcard: true, + }, + }, + { + bool: { + must: mustCriteria, + should: shouldCriteria, + minimum_should_match: 1, + }, + }, + ], + }, + }, + aggs: { + times: { + date_histogram: { + field: 'timestamp', + interval, + min_doc_count: 0, + }, + aggs: { + actual: { + avg: { + field: 'actual', + }, + }, + modelUpper: { + [modelAggs.max]: { + field: 'model_upper', + }, + }, + modelLower: { + [modelAggs.min]: { + field: 'model_lower', + }, + }, + }, + }, + }, + }, + }) + .pipe( + map(resp => { + const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); + _.each(aggregationsByTime, (dataForTime: any) => { + const time = dataForTime.key; + const modelUpper: number | undefined = _.get(dataForTime, ['modelUpper', 'value']); + const modelLower: number | undefined = _.get(dataForTime, ['modelLower', 'value']); + const actual = _.get(dataForTime, ['actual', 'value']); + + obj.results[time] = { + actual, + modelUpper: + modelUpper === undefined || isFinite(modelUpper) === false ? null : modelUpper, + modelLower: + modelLower === undefined || isFinite(modelLower) === false ? null : modelLower, + }; + }); + + return obj; + }) + ); +} + +export interface RecordsForCriteria extends ResultResponse { + records: any[]; +} + +// Queries Elasticsearch to obtain the record level results matching the given criteria, +// for the specified job(s), time range, and record score threshold. +// criteriaFields parameter must be an array, with each object in the array having 'fieldName' +// 'fieldValue' properties. +// Pass an empty array or ['*'] to search over all job IDs. +export function getRecordsForCriteria( + jobIds: string[] | undefined, + criteriaFields: CriteriaField[], + threshold: any, + earliestMs: number, + latestMs: number, + maxResults: number | undefined +): Observable { + const obj: RecordsForCriteria = { success: true, records: [] }; + + // Build the criteria to use in the bool filter part of the request. + // Add criteria for the time range, record score, plus any specified job IDs. + const boolCriteria: any[] = [ + { + range: { + timestamp: { + gte: earliestMs, + lte: latestMs, + format: 'epoch_millis', + }, + }, + }, + { + range: { + record_score: { + gte: threshold, + }, + }, + }, + ]; + + if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { + let jobIdFilterStr = ''; + _.each(jobIds, (jobId, i) => { + if (i > 0) { + jobIdFilterStr += ' OR '; + } + jobIdFilterStr += 'job_id:'; + jobIdFilterStr += jobId; + }); + boolCriteria.push({ + query_string: { + analyze_wildcard: false, + query: jobIdFilterStr, + }, + }); + } + + // Add in term queries for each of the specified criteria. + _.each(criteriaFields, criteria => { + boolCriteria.push({ + term: { + [criteria.fieldName]: criteria.fieldValue, + }, + }); + }); + + return ml + .esSearch$({ + index: ML_RESULTS_INDEX_PATTERN, + rest_total_hits_as_int: true, + size: maxResults !== undefined ? maxResults : 100, + body: { + query: { + bool: { + filter: [ + { + query_string: { + query: 'result_type:record', + analyze_wildcard: false, + }, + }, + { + bool: { + must: boolCriteria, + }, + }, + ], + }, + }, + sort: [{ record_score: { order: 'desc' } }], + }, + }) + .pipe( + map(resp => { + if (resp.hits.total !== 0) { + _.each(resp.hits.hits, (hit: any) => { + obj.records.push(hit._source); + }); + } + return obj; + }) + ); +} + +export interface ScheduledEventsByBucket extends ResultResponse { + events: Record; +} + +// Obtains a list of scheduled events by job ID and time. +// Pass an empty array or ['*'] to search over all job IDs. +// Returned response contains a events property, which will only +// contains keys for jobs which have scheduled events for the specified time range. +export function getScheduledEventsByBucket( + jobIds: string[] | undefined, + earliestMs: number, + latestMs: number, + interval: string, + maxJobs: number, + maxEvents: number +): Observable { + const obj: ScheduledEventsByBucket = { + success: true, + events: {}, + }; + + // Build the criteria to use in the bool filter part of the request. + // Adds criteria for the time range plus any specified job IDs. + const boolCriteria: any[] = [ + { + range: { + timestamp: { + gte: earliestMs, + lte: latestMs, + format: 'epoch_millis', + }, + }, + }, + { + exists: { field: 'scheduled_events' }, + }, + ]; + + if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { + let jobIdFilterStr = ''; + _.each(jobIds, (jobId, i) => { + jobIdFilterStr += `${i > 0 ? ' OR ' : ''}job_id:${jobId}`; + }); + boolCriteria.push({ + query_string: { + analyze_wildcard: false, + query: jobIdFilterStr, + }, + }); + } + + return ml + .esSearch$({ + index: ML_RESULTS_INDEX_PATTERN, + size: 0, + body: { + query: { + bool: { + filter: [ + { + query_string: { + query: 'result_type:bucket', + analyze_wildcard: false, + }, + }, + { + bool: { + must: boolCriteria, + }, + }, + ], + }, + }, + aggs: { + jobs: { + terms: { + field: 'job_id', + min_doc_count: 1, + size: maxJobs, + }, + aggs: { + times: { + date_histogram: { + field: 'timestamp', + interval, + min_doc_count: 1, + }, + aggs: { + events: { + terms: { + field: 'scheduled_events', + size: maxEvents, + }, + }, + }, + }, + }, + }, + }, + }, + }) + .pipe( + map(resp => { + const dataByJobId = _.get(resp, ['aggregations', 'jobs', 'buckets'], []); + _.each(dataByJobId, (dataForJob: any) => { + const jobId: string = dataForJob.key; + const resultsForTime: Record = {}; + const dataByTime = _.get(dataForJob, ['times', 'buckets'], []); + _.each(dataByTime, (dataForTime: any) => { + const time: string = dataForTime.key; + const events: object[] = _.get(dataForTime, ['events', 'buckets']); + resultsForTime[time] = _.map(events, 'key'); + }); + obj.events[jobId] = resultsForTime; + }); + + return obj; + }) + ); +} diff --git a/x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.d.ts b/x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.d.ts new file mode 100644 index 00000000000000..473477a15c2f71 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.d.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export function getScoresByBucket( + jobIds: string[], + earliestMs: number, + latestMs: number, + interval: string | number, + maxResults: number +): Promise; +export function getTopInfluencers(): Promise; +export function getTopInfluencerValues(): Promise; +export function getOverallBucketScores( + jobIds: any, + topN: any, + earliestMs: any, + latestMs: any, + interval?: any +): Promise; +export function getInfluencerValueMaxScoreByTime(): Promise; +export function getRecordInfluencers(): Promise; +export function getRecordsForInfluencer(): Promise; +export function getRecordsForDetector(): Promise; +export function getRecords(): Promise; +export function getEventRateData( + index: string, + query: any, + timeFieldName: string, + earliestMs: number, + latestMs: number, + interval: string | number +): Promise; +export function getEventDistributionData(): Promise; +export function getRecordMaxScoreByTime(): Promise; diff --git a/x-pack/legacy/plugins/ml/public/services/results_service.js b/x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.js similarity index 70% rename from x-pack/legacy/plugins/ml/public/services/results_service.js rename to x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.js index 640600159084de..080ba718964c41 100644 --- a/x-pack/legacy/plugins/ml/public/services/results_service.js +++ b/x-pack/legacy/plugins/ml/public/application/services/results_service/results_service.js @@ -11,17 +11,17 @@ import _ from 'lodash'; // import d3 from 'd3'; -import { ML_MEDIAN_PERCENTS } from '../../common/util/job_utils'; -import { escapeForElasticsearchQuery } from '../util/string_utils'; -import { ML_RESULTS_INDEX_PATTERN } from '../../common/constants/index_patterns'; +import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; +import { escapeForElasticsearchQuery } from '../../util/string_utils'; +import { ML_RESULTS_INDEX_PATTERN } from '../../../../common/constants/index_patterns'; -import { ml } from '../services/ml_api_service'; +import { ml } from '../ml_api_service'; // Obtains the maximum bucket anomaly scores by job ID and time. // Pass an empty array or ['*'] to search over all job IDs. // Returned response contains a results property, with a key for job // which has results for the specified time range. -function getScoresByBucket(jobIds, earliestMs, latestMs, interval, maxResults) { +export function getScoresByBucket(jobIds, earliestMs, latestMs, interval, maxResults) { return new Promise((resolve, reject) => { const obj = { success: true, @@ -141,129 +141,13 @@ function getScoresByBucket(jobIds, earliestMs, latestMs, interval, maxResults) { }); } -// Obtains a list of scheduled events by job ID and time. -// Pass an empty array or ['*'] to search over all job IDs. -// Returned response contains a events property, which will only -// contains keys for jobs which have scheduled events for the specified time range. -function getScheduledEventsByBucket( - jobIds, - earliestMs, - latestMs, - interval, - maxJobs, - maxEvents) { - return new Promise((resolve, reject) => { - const obj = { - success: true, - events: {} - }; - - // Build the criteria to use in the bool filter part of the request. - // Adds criteria for the time range plus any specified job IDs. - const boolCriteria = [ - { - range: { - timestamp: { - gte: earliestMs, - lte: latestMs, - format: 'epoch_millis' - } - } - }, - { - exists: { field: 'scheduled_events' } - } - ]; - - if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { - let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { - jobIdFilterStr += `${i > 0 ? ' OR ' : ''}job_id:${jobId}`; - }); - boolCriteria.push({ - query_string: { - analyze_wildcard: false, - query: jobIdFilterStr - } - }); - } - - ml.esSearch({ - index: ML_RESULTS_INDEX_PATTERN, - size: 0, - body: { - query: { - bool: { - filter: [{ - query_string: { - query: 'result_type:bucket', - analyze_wildcard: false - } - }, { - bool: { - must: boolCriteria - } - }] - } - }, - aggs: { - jobs: { - terms: { - field: 'job_id', - min_doc_count: 1, - size: maxJobs - }, - aggs: { - times: { - date_histogram: { - field: 'timestamp', - interval: interval, - min_doc_count: 1 - }, - aggs: { - events: { - terms: { - field: 'scheduled_events', - size: maxEvents - } - } - } - } - } - } - } - } - }) - .then((resp) => { - const dataByJobId = _.get(resp, ['aggregations', 'jobs', 'buckets'], []); - _.each(dataByJobId, (dataForJob) => { - const jobId = dataForJob.key; - const resultsForTime = {}; - const dataByTime = _.get(dataForJob, ['times', 'buckets'], []); - _.each(dataByTime, (dataForTime) => { - const time = dataForTime.key; - const events = _.get(dataForTime, ['events', 'buckets']); - resultsForTime[time] = _.map(events, 'key'); - }); - obj.events[jobId] = resultsForTime; - }); - - resolve(obj); - }) - .catch((resp) => { - reject(resp); - }); - }); -} - - // Obtains the top influencers, by maximum influencer score, for the specified index, time range and job ID(s). // Pass an empty array or ['*'] to search over all job IDs. // An optional array of influencers may be supplied, with each object in the array having 'fieldName' // and 'fieldValue' properties, to limit data to the supplied list of influencers. // Returned response contains an influencers property, with a key for each of the influencer field names, // whose value is an array of objects containing influencerFieldValue, maxAnomalyScore and sumAnomalyScore keys. -function getTopInfluencers( +export function getTopInfluencers( jobIds, earliestMs, latestMs, @@ -428,7 +312,7 @@ function getTopInfluencers( // Pass an empty array or ['*'] to search over all job IDs. // Returned response contains a results property, which is an array of objects // containing influencerFieldValue, maxAnomalyScore and sumAnomalyScore keys. -function getTopInfluencerValues(jobIds, influencerFieldName, earliestMs, latestMs, maxResults) { +export function getTopInfluencerValues(jobIds, influencerFieldName, earliestMs, latestMs, maxResults) { return new Promise((resolve, reject) => { const obj = { success: true, results: [] }; @@ -528,7 +412,7 @@ function getTopInfluencerValues(jobIds, influencerFieldName, earliestMs, latestM // Obtains the overall bucket scores for the specified job ID(s). // Pass ['*'] to search over all job IDs. // Returned response contains a results property as an object of max score by time. -function getOverallBucketScores(jobIds, topN, earliestMs, latestMs, interval) { +export function getOverallBucketScores(jobIds, topN, earliestMs, latestMs, interval) { return new Promise((resolve, reject) => { const obj = { success: true, results: {} }; @@ -561,7 +445,7 @@ function getOverallBucketScores(jobIds, topN, earliestMs, latestMs, interval) { // values (pass an empty array to search over all field values). // Returned response contains a results property with influencer field values keyed // against max score by time. -function getInfluencerValueMaxScoreByTime( +export function getInfluencerValueMaxScoreByTime( jobIds, influencerFieldName, influencerFieldValues, @@ -720,7 +604,7 @@ function getInfluencerValueMaxScoreByTime( // Pass an empty array or ['*'] to search over all job IDs. // Returned response contains a records property, with each record containing // only the fields job_id, detector_index, record_score and influencers. -function getRecordInfluencers(jobIds, threshold, earliestMs, latestMs, maxResults) { +export function getRecordInfluencers(jobIds, threshold, earliestMs, latestMs, maxResults) { return new Promise((resolve, reject) => { const obj = { success: true, records: [] }; @@ -826,7 +710,7 @@ function getRecordInfluencers(jobIds, threshold, earliestMs, latestMs, maxResult // 'fieldValue' properties. The influencer array uses 'should' for the nested bool query, // so this returns record level results which have at least one of the influencers. // Pass an empty array or ['*'] to search over all job IDs. -function getRecordsForInfluencer(jobIds, influencers, threshold, earliestMs, latestMs, maxResults, influencersFilterQuery) { +export function getRecordsForInfluencer(jobIds, influencers, threshold, earliestMs, latestMs, maxResults, influencersFilterQuery) { return new Promise((resolve, reject) => { const obj = { success: true, records: [] }; @@ -949,7 +833,7 @@ function getRecordsForInfluencer(jobIds, influencers, threshold, earliestMs, lat // Queries Elasticsearch to obtain the record level results for the specified job and detector, // time range, record score threshold, and whether to only return results containing influencers. // An additional, optional influencer field name and value may also be provided. -function getRecordsForDetector( +export function getRecordsForDetector( jobId, detectorIndex, checkForInfluencers, @@ -1076,270 +960,17 @@ function getRecordsForDetector( // and record score threshold. // Pass an empty array or ['*'] to search over all job IDs. // Returned response contains a records property, which is an array of the matching results. -function getRecords(jobIds, threshold, earliestMs, latestMs, maxResults) { +export function getRecords(jobIds, threshold, earliestMs, latestMs, maxResults) { return this.getRecordsForInfluencer(jobIds, [], threshold, earliestMs, latestMs, maxResults); } -// Queries Elasticsearch to obtain the record level results matching the given criteria, -// for the specified job(s), time range, and record score threshold. -// criteriaFields parameter must be an array, with each object in the array having 'fieldName' -// 'fieldValue' properties. -// Pass an empty array or ['*'] to search over all job IDs. -function getRecordsForCriteria(jobIds, criteriaFields, threshold, earliestMs, latestMs, maxResults) { - return new Promise((resolve, reject) => { - const obj = { success: true, records: [] }; - - // Build the criteria to use in the bool filter part of the request. - // Add criteria for the time range, record score, plus any specified job IDs. - const boolCriteria = [ - { - range: { - timestamp: { - gte: earliestMs, - lte: latestMs, - format: 'epoch_millis' - } - } - }, - { - range: { - record_score: { - gte: threshold, - } - } - } - ]; - - if (jobIds && jobIds.length > 0 && !(jobIds.length === 1 && jobIds[0] === '*')) { - let jobIdFilterStr = ''; - _.each(jobIds, (jobId, i) => { - if (i > 0) { - jobIdFilterStr += ' OR '; - } - jobIdFilterStr += 'job_id:'; - jobIdFilterStr += jobId; - }); - boolCriteria.push({ - query_string: { - analyze_wildcard: false, - query: jobIdFilterStr - } - }); - } - - // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { - boolCriteria.push({ - term: { - [criteria.fieldName]: criteria.fieldValue - } - }); - }); - - ml.esSearch({ - index: ML_RESULTS_INDEX_PATTERN, - rest_total_hits_as_int: true, - size: maxResults !== undefined ? maxResults : 100, - body: { - query: { - bool: { - filter: [ - { - query_string: { - query: 'result_type:record', - analyze_wildcard: false - } - }, - { - bool: { - must: boolCriteria - } - } - ] - } - }, - sort: [ - { record_score: { order: 'desc' } } - ], - } - }) - .then((resp) => { - if (resp.hits.total !== 0) { - _.each(resp.hits.hits, (hit) => { - obj.records.push(hit._source); - }); - } - resolve(obj); - }) - .catch((resp) => { - reject(resp); - }); - }); -} - - -// Queries Elasticsearch to obtain metric aggregation results. -// index can be a String, or String[], of index names to search. -// entityFields parameter must be an array, with each object in the array having 'fieldName' -// and 'fieldValue' properties. -// Extra query object can be supplied, or pass null if no additional query -// to that built from the supplied entity fields. -// Returned response contains a results property containing the requested aggregation. -function getMetricData( - index, - entityFields, - query, - metricFunction, // ES aggregation name - metricFieldName, - timeFieldName, - earliestMs, - latestMs, - interval) { - return new Promise((resolve, reject) => { - const obj = { success: true, results: {} }; - - // Build the criteria to use in the bool filter part of the request. - // Add criteria for the time range, entity fields, - // plus any additional supplied query. - const mustCriteria = []; - const shouldCriteria = []; - - mustCriteria.push({ - range: { - [timeFieldName]: { - gte: earliestMs, - lte: latestMs, - format: 'epoch_millis' - } - } - }); - - if (query) { - mustCriteria.push(query); - } - - _.each(entityFields, (entity) => { - if (entity.fieldValue.length !== 0) { - mustCriteria.push({ - term: { - [entity.fieldName]: entity.fieldValue - } - }); - - } else { - // Add special handling for blank entity field values, checking for either - // an empty string or the field not existing. - shouldCriteria.push({ - bool: { - must: [ - { - term: { - [entity.fieldName]: '' - } - } - ] - } - }); - shouldCriteria.push({ - bool: { - must_not: [ - { - exists: { field: entity.fieldName } - } - ] - } - }); - } - - }); - - const body = { - query: { - bool: { - must: mustCriteria - } - }, - size: 0, - _source: { - excludes: [] - }, - aggs: { - byTime: { - date_histogram: { - field: timeFieldName, - interval: interval, - min_doc_count: 0 - } - - } - } - }; - - if (shouldCriteria.length > 0) { - body.query.bool.should = shouldCriteria; - body.query.bool.minimum_should_match = shouldCriteria.length / 2; - } - - if (metricFieldName !== undefined && metricFieldName !== '') { - body.aggs.byTime.aggs = {}; - - const metricAgg = { - [metricFunction]: { - field: metricFieldName - } - }; - - if (metricFunction === 'percentiles') { - metricAgg[metricFunction].percents = [ML_MEDIAN_PERCENTS]; - } - body.aggs.byTime.aggs.metric = metricAgg; - } - - ml.esSearch({ - index, - body - }) - .then((resp) => { - const dataByTime = _.get(resp, ['aggregations', 'byTime', 'buckets'], []); - _.each(dataByTime, (dataForTime) => { - if (metricFunction === 'count') { - obj.results[dataForTime.key] = dataForTime.doc_count; - } else { - const value = _.get(dataForTime, ['metric', 'value']); - const values = _.get(dataForTime, ['metric', 'values']); - if (dataForTime.doc_count === 0) { - obj.results[dataForTime.key] = null; - } else if (value !== undefined) { - obj.results[dataForTime.key] = value; - } else if (values !== undefined) { - // Percentiles agg currently returns NaN rather than null when none of the docs in the - // bucket contain the field used in the aggregation - // (see elasticsearch issue https://github.com/elastic/elasticsearch/issues/29066). - // Store as null, so values can be handled in the same manner downstream as other aggs - // (min, mean, max) which return null. - const medianValues = values[ML_MEDIAN_PERCENTS]; - obj.results[dataForTime.key] = !isNaN(medianValues) ? medianValues : null; - } else { - obj.results[dataForTime.key] = null; - } - } - }); - - resolve(obj); - }) - .catch((resp) => { - reject(resp); - }); - }); -} - // Queries Elasticsearch to obtain event rate data i.e. the count // of documents over time. // index can be a String, or String[], of index names to search. // Extra query object can be supplied, or pass null if no additional query. // Returned response contains a results property, which is an object // of document counts against time (epoch millis). -function getEventRateData( +export function getEventRateData( index, query, timeFieldName, @@ -1420,7 +1051,7 @@ const SAMPLER_TOP_TERMS_SHARD_SIZE = 20000; const ENTITY_AGGREGATION_SIZE = 10; const AGGREGATION_MIN_DOC_COUNT = 1; const CARDINALITY_PRECISION_THRESHOLD = 100; -function getEventDistributionData( +export function getEventDistributionData( index, splitField, filterField = null, @@ -1583,155 +1214,11 @@ function getEventDistributionData( }); } -function getModelPlotOutput( - jobId, - detectorIndex, - criteriaFields, - earliestMs, - latestMs, - interval, - aggType) { - return new Promise((resolve, reject) => { - const obj = { - success: true, - results: {} - }; - - // if an aggType object has been passed in, use it. - // otherwise default to min and max aggs for the upper and lower bounds - const modelAggs = (aggType === undefined) ? - { max: 'max', min: 'min' } : - { - max: aggType.max, - min: aggType.min - }; - - // Build the criteria to use in the bool filter part of the request. - // Add criteria for the job ID and time range. - const mustCriteria = [ - { - term: { job_id: jobId } - }, - { - range: { - timestamp: { - gte: earliestMs, - lte: latestMs, - format: 'epoch_millis' - } - } - } - ]; - - // Add in term queries for each of the specified criteria. - _.each(criteriaFields, (criteria) => { - mustCriteria.push({ - term: { - [criteria.fieldName]: criteria.fieldValue - } - }); - }); - - // Add criteria for the detector index. Results from jobs created before 6.1 will not - // contain a detector_index field, so use a should criteria with a 'not exists' check. - const shouldCriteria = [ - { - term: { detector_index: detectorIndex } - }, - { - bool: { - must_not: [ - { - exists: { field: 'detector_index' } - } - ] - } - } - ]; - - ml.esSearch({ - index: ML_RESULTS_INDEX_PATTERN, - size: 0, - body: { - query: { - bool: { - filter: [{ - query_string: { - query: 'result_type:model_plot', - analyze_wildcard: true - } - }, { - bool: { - must: mustCriteria, - should: shouldCriteria, - minimum_should_match: 1 - } - }] - } - }, - aggs: { - times: { - date_histogram: { - field: 'timestamp', - interval: interval, - min_doc_count: 0 - }, - aggs: { - actual: { - avg: { - field: 'actual' - } - }, - modelUpper: { - [modelAggs.max]: { - field: 'model_upper' - } - }, - modelLower: { - [modelAggs.min]: { - field: 'model_lower' - } - } - } - } - } - } - }) - .then((resp) => { - const aggregationsByTime = _.get(resp, ['aggregations', 'times', 'buckets'], []); - _.each(aggregationsByTime, (dataForTime) => { - const time = dataForTime.key; - let modelUpper = _.get(dataForTime, ['modelUpper', 'value']); - let modelLower = _.get(dataForTime, ['modelLower', 'value']); - const actual = _.get(dataForTime, ['actual', 'value']); - - if (modelUpper === undefined || isFinite(modelUpper) === false) { - modelUpper = null; - } - if (modelLower === undefined || isFinite(modelLower) === false) { - modelLower = null; - } - - obj.results[time] = { - actual, - modelUpper, - modelLower - }; - }); - - resolve(obj); - }) - .catch((resp) => { - reject(resp); - }); - }); -} - // Queries Elasticsearch to obtain the max record score over time for the specified job, // criteria, time range, and aggregation interval. // criteriaFields parameter must be an array, with each object in the array having 'fieldName' // 'fieldValue' properties. -function getRecordMaxScoreByTime(jobId, criteriaFields, earliestMs, latestMs, interval) { +export function getRecordMaxScoreByTime(jobId, criteriaFields, earliestMs, latestMs, interval) { return new Promise((resolve, reject) => { const obj = { success: true, @@ -1840,22 +1327,3 @@ function getRecordMaxScoreByTime(jobId, criteriaFields, earliestMs, latestMs, in }); }); } - -export const mlResultsService = { - getScoresByBucket, - getScheduledEventsByBucket, - getTopInfluencers, - getTopInfluencerValues, - getOverallBucketScores, - getInfluencerValueMaxScoreByTime, - getRecordInfluencers, - getRecordsForInfluencer, - getRecordsForDetector, - getRecords, - getRecordsForCriteria, - getMetricData, - getEventRateData, - getEventDistributionData, - getModelPlotOutput, - getRecordMaxScoreByTime -}; diff --git a/x-pack/legacy/plugins/ml/public/services/table_service.js b/x-pack/legacy/plugins/ml/public/application/services/table_service.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/table_service.js rename to x-pack/legacy/plugins/ml/public/application/services/table_service.js diff --git a/x-pack/legacy/plugins/ml/public/services/timefilter_refresh_service.tsx b/x-pack/legacy/plugins/ml/public/application/services/timefilter_refresh_service.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/timefilter_refresh_service.tsx rename to x-pack/legacy/plugins/ml/public/application/services/timefilter_refresh_service.tsx diff --git a/x-pack/legacy/plugins/ml/public/services/upgrade_service.ts b/x-pack/legacy/plugins/ml/public/application/services/upgrade_service.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/services/upgrade_service.ts rename to x-pack/legacy/plugins/ml/public/application/services/upgrade_service.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/_settings.scss b/x-pack/legacy/plugins/ml/public/application/settings/_settings.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/_settings.scss rename to x-pack/legacy/plugins/ml/public/application/settings/_settings.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/breadcrumbs.ts b/x-pack/legacy/plugins/ml/public/application/settings/breadcrumbs.ts similarity index 98% rename from x-pack/legacy/plugins/ml/public/settings/breadcrumbs.ts rename to x-pack/legacy/plugins/ml/public/application/settings/breadcrumbs.ts index 2cdfa5bfcf4d03..bd04003c9eca4e 100644 --- a/x-pack/legacy/plugins/ml/public/settings/breadcrumbs.ts +++ b/x-pack/legacy/plugins/ml/public/application/settings/breadcrumbs.ts @@ -5,7 +5,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB, SETTINGS } from '../breadcrumbs'; +import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB, SETTINGS } from '../../breadcrumbs'; export function getSettingsBreadcrumbs() { // Whilst top level nav menu with tabs remains, diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/calendars/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/__snapshots__/new_calendar.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/__snapshots__/new_calendar.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/__snapshots__/new_calendar.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/__snapshots__/new_calendar.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/_edit.scss b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/_edit.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/_edit.scss rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/_edit.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/__snapshots__/calendar_form.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/calendar_form.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/calendar_form.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.js index fe1788db7f3fc9..5754104b0e9047 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/calendar_form.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.js @@ -23,7 +23,7 @@ import { } from '@elastic/eui'; import chrome from 'ui/chrome'; -import { EventsTable } from '../events_table/'; +import { EventsTable } from '../events_table'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/calendar_form.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/calendar_form.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/calendar_form/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/calendar_form/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/directive.tsx b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/__snapshots__/events_table.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/__snapshots__/events_table.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/__snapshots__/events_table.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/__snapshots__/events_table.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/events_table.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/events_table.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/events_table.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/events_table.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/events_table.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/events_table/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/events_table/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/__snapshots__/import_modal.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/import_modal.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/import_modal.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/import_modal.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/import_modal.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/import_modal.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/utils.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/import_modal/utils.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/import_modal/utils.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/__snapshots__/imported_events.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/imported_events.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/imported_events.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.js index e3ba5a4851fad2..153860e73829ed 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/imported_events.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.js @@ -12,7 +12,7 @@ import { EuiText, EuiSpacer } from '@elastic/eui'; -import { EventsTable } from '../events_table/'; +import { EventsTable } from '../events_table'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/imported_events.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/imported_events.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/imported_events.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/imported_events/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/imported_events/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.d.ts b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.d.ts rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.d.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.js index 12c8339c52d719..feabd60d8d3a0a 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.js @@ -24,8 +24,8 @@ import { toastNotifications } from 'ui/notify'; import { NavigationMenu } from '../../../components/navigation_menu'; import { getCalendarSettingsData, validateCalendarId } from './utils'; -import { CalendarForm } from './calendar_form/'; -import { NewEventModal } from './new_event_modal/'; +import { CalendarForm } from './calendar_form'; +import { NewEventModal } from './new_event_modal'; import { ImportModal } from './import_modal'; import { ml } from '../../../services/ml_api_service'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/new_event_modal.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/new_event_modal.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.js index 2b554c2d46c1b4..949e93bec76bc0 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/new_event_modal.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.js @@ -28,7 +28,7 @@ import { EuiFlexItem, } from '@elastic/eui'; import moment from 'moment'; -import { TIME_FORMAT } from '../events_table/'; +import { TIME_FORMAT } from '../events_table'; import { generateTempId } from '../utils'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/new_event_modal.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_event_modal/new_event_modal.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/new_event_modal/new_event_modal.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/utils.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/utils.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/settings/calendars/edit/utils.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/utils.js index ef7ea0c2562961..d97a6f62c716aa 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/edit/utils.js @@ -7,7 +7,7 @@ import { ml } from '../../../services/ml_api_service'; -import { isJobIdValid } from '../../../../common/util/job_utils'; +import { isJobIdValid } from '../../../../../common/util/job_utils'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/__snapshots__/calendars_list.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/__snapshots__/calendars_list.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/__snapshots__/calendars_list.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/__snapshots__/calendars_list.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/__snapshots__/header.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/__snapshots__/header.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/__snapshots__/header.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/__snapshots__/header.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/_list.scss b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/_list.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/_list.scss rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/_list.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.d.ts b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.d.ts rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.d.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.js index b7ad2c36f3b43d..ef12a6ecc16189 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.js @@ -19,7 +19,7 @@ import { import { NavigationMenu } from '../../../components/navigation_menu'; import { CalendarsListHeader } from './header'; -import { CalendarsListTable } from './table/'; +import { CalendarsListTable } from './table'; import { ml } from '../../../services/ml_api_service'; import { toastNotifications } from 'ui/notify'; import { mlNodesAvailable } from '../../../ml_nodes_check/check_ml_nodes'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/delete_calendars.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/delete_calendars.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/delete_calendars.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/delete_calendars.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/directive.tsx b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/header.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/header.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/header.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/header.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/header.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/header.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/header.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/header.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/__snapshots__/table.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/table/__snapshots__/table.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/__snapshots__/table.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/table/index.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/table/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/table/table.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/table.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/table/table.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/table.js diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/table/table.test.js b/x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/table.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/calendars/list/table/table.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/calendars/list/table/table.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/_filter_lists.scss b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/_filter_lists.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/_filter_lists.scss rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/_filter_lists.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/__snapshots__/add_item_popover.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/__snapshots__/add_item_popover.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/__snapshots__/add_item_popover.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/__snapshots__/add_item_popover.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/add_item_popover.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/add_item_popover.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/add_item_popover.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/add_item_popover.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/add_item_popover.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/index.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/add_item_popover/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/add_item_popover/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/__snapshots__/delete_filter_list_modal.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_list_modal.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_lists.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_lists.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/delete_filter_lists.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_lists.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/index.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/delete_filter_list_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/__snapshots__/edit_description_popover.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/__snapshots__/edit_description_popover.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/__snapshots__/edit_description_popover.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/__snapshots__/edit_description_popover.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/edit_description_popover.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/edit_description_popover.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/edit_description_popover.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/index.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/edit_description_popover/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/edit_description_popover/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/__snapshots__/filter_list_usage_popover.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/__snapshots__/filter_list_usage_popover.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/__snapshots__/filter_list_usage_popover.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/__snapshots__/filter_list_usage_popover.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/filter_list_usage_popover.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/index.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/components/filter_list_usage_popover/index.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/components/filter_list_usage_popover/index.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/edit_filter_list.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/edit_filter_list.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/edit_filter_list.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/edit_filter_list.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/header.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/header.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/header.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/__snapshots__/toolbar.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/_edit.scss b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/_edit.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/_edit.scss rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/_edit.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/_index.scss b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/_index.scss rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/directive.tsx b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.d.ts b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.d.ts rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.d.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/header.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/header.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/header.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/header.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/header.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/header.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/header.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/header.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/toolbar.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/toolbar.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/toolbar.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/toolbar.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/toolbar.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/toolbar.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/toolbar.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/utils.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/utils.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/utils.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/utils.js index 6303963ab3a144..a29487672ad901 100644 --- a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/utils.js +++ b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/edit/utils.js @@ -6,8 +6,8 @@ import { i18n } from '@kbn/i18n'; import { toastNotifications } from 'ui/notify'; -import { isJobIdValid } from 'plugins/ml/../common/util/job_utils'; -import { ml } from 'plugins/ml/services/ml_api_service'; +import { isJobIdValid } from '../../../../../common/util/job_utils'; +import { ml } from '../../../services/ml_api_service'; export function isValidFilterListId(id) { // Filter List ID requires the same format as a Job ID, therefore isJobIdValid can be used diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/filter_lists.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/filter_lists.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/filter_lists.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/filter_lists.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/header.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/header.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/header.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/table.test.js.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/__snapshots__/table.test.js.snap rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/__snapshots__/table.test.js.snap diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/directive.tsx b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/directive.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.d.ts b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.d.ts rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.d.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/header.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/header.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/header.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/header.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/header.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/header.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/header.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/header.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/table.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/table.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/table.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/table.js diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/table.test.js b/x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/table.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/filter_lists/list/table.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/filter_lists/list/table.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/index.ts b/x-pack/legacy/plugins/ml/public/application/settings/index.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/index.ts rename to x-pack/legacy/plugins/ml/public/application/settings/index.ts diff --git a/x-pack/legacy/plugins/ml/public/settings/settings.test.js b/x-pack/legacy/plugins/ml/public/application/settings/settings.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/settings.test.js rename to x-pack/legacy/plugins/ml/public/application/settings/settings.test.js diff --git a/x-pack/legacy/plugins/ml/public/settings/settings.tsx b/x-pack/legacy/plugins/ml/public/application/settings/settings.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/settings.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/settings.tsx diff --git a/x-pack/legacy/plugins/ml/public/settings/settings_directive.tsx b/x-pack/legacy/plugins/ml/public/application/settings/settings_directive.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/settings/settings_directive.tsx rename to x-pack/legacy/plugins/ml/public/application/settings/settings_directive.tsx diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/__tests__/timeseriesexplorer_directive.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/__tests__/timeseriesexplorer_directive.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/__tests__/timeseriesexplorer_directive.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/__tests__/timeseriesexplorer_directive.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/_index.scss b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_index.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/_index.scss rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_index.scss diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/_timeseriesexplorer.scss b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_timeseriesexplorer.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/_timeseriesexplorer.scss rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_timeseriesexplorer.scss diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/_timeseriesexplorer_annotations.scss b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_timeseriesexplorer_annotations.scss similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/_timeseriesexplorer_annotations.scss rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/_timeseriesexplorer_annotations.scss diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/breadcrumbs.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/breadcrumbs.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/breadcrumbs.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/breadcrumbs.js index fd32a7c4d04b1b..2aa4c845b125d7 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/breadcrumbs.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/breadcrumbs.js @@ -5,7 +5,7 @@ */ -import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB } from '../breadcrumbs'; +import { ML_BREADCRUMB, ANOMALY_DETECTION_BREADCRUMB } from '../../breadcrumbs'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/context_chart_mask/context_chart_mask.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/context_chart_mask/context_chart_mask.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/context_chart_mask/context_chart_mask.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/context_chart_mask/context_chart_mask.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/context_chart_mask/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/context_chart_mask/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/context_chart_mask/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/context_chart_mask/index.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/entity_control/entity_control.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_control.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/entity_control/entity_control.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/entity_control/entity_control.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/entity_control/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/entity_control/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/entity_control/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/entity_control/index.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecast_progress.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecast_progress.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecast_progress.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecast_progress.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js index 00812d56ade4ac..26fffb5e481eea 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js @@ -24,15 +24,15 @@ import { timefilter } from 'ui/timefilter'; // don't use something like plugins/ml/../common // because it won't work with the jest tests -import { FORECAST_REQUEST_STATE, JOB_STATE } from '../../../../common/constants/states'; -import { MESSAGE_LEVEL } from '../../../../common/constants/message_levels'; -import { isJobVersionGte } from '../../../../common/util/job_utils'; -import { parseInterval } from '../../../../common/util/parse_interval'; +import { FORECAST_REQUEST_STATE, JOB_STATE } from '../../../../../common/constants/states'; +import { MESSAGE_LEVEL } from '../../../../../common/constants/message_levels'; +import { isJobVersionGte } from '../../../../../common/util/job_utils'; +import { parseInterval } from '../../../../../common/util/parse_interval'; import { Modal } from './modal'; import { PROGRESS_STATES } from './progress_states'; -import { ml } from 'plugins/ml/services/ml_api_service'; -import { mlJobService } from 'plugins/ml/services/job_service'; -import { mlForecastService } from 'plugins/ml/services/forecast_service'; +import { ml } from '../../../services/ml_api_service'; +import { mlJobService } from '../../../services/job_service'; +import { mlForecastService } from '../../../services/forecast_service'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; export const FORECAST_DURATION_MAX_DAYS = 3650; // Max forecast duration allowed by analytics. diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasts_list.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasts_list.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasts_list.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasts_list.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/index.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/modal.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/modal.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/modal.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/modal.js index dcde78e5e0b32c..47051eecf9d046 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/modal.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/modal.js @@ -25,7 +25,7 @@ import { } from '@elastic/eui'; -import { MessageCallOut } from 'plugins/ml/components/message_call_out'; +import { MessageCallOut } from '../../../components/message_call_out'; import { ForecastsList } from './forecasts_list'; import { RunControls } from './run_controls'; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/progress_icon.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/progress_icon.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/progress_icon.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/progress_icon.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/progress_states.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/progress_states.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/progress_states.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/progress_states.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/run_controls.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/run_controls.js similarity index 96% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/run_controls.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/run_controls.js index 0b2a35fb3e39ad..fef992719749e4 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/run_controls.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/run_controls.js @@ -28,11 +28,11 @@ import { // don't use something like plugins/ml/../common // because it won't work with the jest tests -import { JOB_STATE } from '../../../../common/constants/states'; +import { JOB_STATE } from '../../../../../common/constants/states'; import { FORECAST_DURATION_MAX_DAYS } from './forecasting_modal'; import { ForecastProgress } from './forecast_progress'; -import { mlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes'; -import { checkPermission, createPermissionFailureMessage } from 'plugins/ml/privilege/check_privilege'; +import { mlNodesAvailable } from '../../../ml_nodes_check/check_ml_nodes'; +import { checkPermission, createPermissionFailureMessage } from '../../../privilege/check_privilege'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/__mocks__/mock_annotations_overlap.json b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/__mocks__/mock_annotations_overlap.json similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/__mocks__/mock_annotations_overlap.json rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/__mocks__/mock_annotations_overlap.json diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts similarity index 79% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts index 62ba8cfbe7d34f..1f49ec1826422a 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.d.ts @@ -6,8 +6,8 @@ import d3 from 'd3'; -import { Annotation } from '../../../../common/types/annotations'; -import { MlJob } from '../../../../common/types/jobs'; +import { Annotation } from '../../../../../common/types/annotations'; +import { MlJob } from '../../../../../common/types/jobs'; interface Props { selectedJob: MlJob; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index 81852f025fb1f0..eb4dfae3f5ff34 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -24,7 +24,7 @@ import chrome from 'ui/chrome'; import { getSeverityWithLow, getMultiBucketImpactLabel, -} from '../../../../common/util/anomaly_utils'; +} from '../../../../../common/util/anomaly_utils'; import { annotation$ } from '../../../services/annotations_service'; import { injectObservablesAsProps } from '../../../util/observable_utils'; import { formatValue } from '../../../formatters/format_value'; @@ -1081,10 +1081,6 @@ const TimeseriesChartIntl = injectI18n(class TimeseriesChart extends React.Compo const that = this; function brushed() { - if (that.props.skipRefresh) { - return; - } - const isEmpty = brush.empty(); const selectedBounds = isEmpty ? contextXScale.domain() : brush.extent(); diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.mocks.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.mocks.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.mocks.ts rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.test.mocks.ts diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.test.ts diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts index e668b39edd7846..925107eb5f573d 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart_annotations.ts @@ -7,9 +7,9 @@ import d3 from 'd3'; import moment from 'moment'; -import { ANNOTATION_TYPE } from '../../../../common/constants/annotations'; -import { Annotation, Annotations } from '../../../../common/types/annotations'; -import { Dictionary } from '../../../../common/types/common'; +import { ANNOTATION_TYPE } from '../../../../../common/constants/annotations'; +import { Annotation, Annotations } from '../../../../../common/types/annotations'; +import { Dictionary } from '../../../../../common/types/common'; // @ts-ignore import { mlChartTooltipService } from '../../../components/chart_tooltip/chart_tooltip_service'; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/index.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/timeseriesexplorer_no_chart_data.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/timeseriesexplorer_no_chart_data.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/timeseriesexplorer_no_chart_data.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_chart_data/timeseriesexplorer_no_chart_data.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/index.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/index.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/timeseriesexplorer_no_jobs_found.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/timeseriesexplorer_no_jobs_found.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/timeseriesexplorer_no_jobs_found.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/components/timeseriesexplorer_no_jobs_found/timeseriesexplorer_no_jobs_found.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/index.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/index.js similarity index 71% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/index.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/index.js index 946312d08e9ce5..5aa6cfe8835ad5 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/index.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/index.js @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import './timeseriesexplorer_directive.js'; -import './timeseriesexplorer_route.js'; -import './timeseries_search_service.js'; +import './timeseriesexplorer_directive'; +import './timeseriesexplorer_route'; +import './timeseries_search_service'; import '../components/job_selector'; import '../components/chart_tooltip'; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseries_search_service.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts similarity index 68% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseries_search_service.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts index 520cce3c732601..65bcc9d355fd69 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseries_search_service.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts @@ -4,44 +4,59 @@ * you may not use this file except in compliance with the Elastic License. */ - - import _ from 'lodash'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { ml } from '../services/ml_api_service'; -import { isModelPlotEnabled } from '../../common/util/job_utils'; +import { isModelPlotEnabled } from '../../../common/util/job_utils'; +// @ts-ignore import { buildConfigFromDetector } from '../util/chart_config_builder'; import { mlResultsService } from '../services/results_service'; - -function getMetricData(job, detectorIndex, entityFields, earliestMs, latestMs, interval) { +import { ModelPlotOutput } from '../services/results_service/result_service_rx'; +import { Job } from '../jobs/new_job/common/job_creator/configs'; + +function getMetricData( + job: Job, + detectorIndex: number, + entityFields: object[], + earliestMs: number, + latestMs: number, + interval: string +): Observable { if (isModelPlotEnabled(job, detectorIndex, entityFields)) { // Extract the partition, by, over fields on which to filter. const criteriaFields = []; const detector = job.analysis_config.detectors[detectorIndex]; if (_.has(detector, 'partition_field_name')) { - const partitionEntity = _.find(entityFields, { 'fieldName': detector.partition_field_name }); + const partitionEntity: any = _.find(entityFields, { + fieldName: detector.partition_field_name, + }); if (partitionEntity !== undefined) { criteriaFields.push( { fieldName: 'partition_field_name', fieldValue: partitionEntity.fieldName }, - { fieldName: 'partition_field_value', fieldValue: partitionEntity.fieldValue }); + { fieldName: 'partition_field_value', fieldValue: partitionEntity.fieldValue } + ); } } if (_.has(detector, 'over_field_name')) { - const overEntity = _.find(entityFields, { 'fieldName': detector.over_field_name }); + const overEntity: any = _.find(entityFields, { fieldName: detector.over_field_name }); if (overEntity !== undefined) { criteriaFields.push( { fieldName: 'over_field_name', fieldValue: overEntity.fieldName }, - { fieldName: 'over_field_value', fieldValue: overEntity.fieldValue }); + { fieldName: 'over_field_value', fieldValue: overEntity.fieldValue } + ); } } if (_.has(detector, 'by_field_name')) { - const byEntity = _.find(entityFields, { 'fieldName': detector.by_field_name }); + const byEntity: any = _.find(entityFields, { fieldName: detector.by_field_name }); if (byEntity !== undefined) { criteriaFields.push( { fieldName: 'by_field_name', fieldValue: byEntity.fieldName }, - { fieldName: 'by_field_value', fieldValue: byEntity.fieldValue }); + { fieldName: 'by_field_value', fieldValue: byEntity.fieldValue } + ); } } @@ -54,15 +69,15 @@ function getMetricData(job, detectorIndex, entityFields, earliestMs, latestMs, i interval ); } else { - return new Promise((resolve, reject) => { - const obj = { - success: true, - results: {} - }; + const obj: ModelPlotOutput = { + success: true, + results: {}, + }; - const chartConfig = buildConfigFromDetector(job, detectorIndex); + const chartConfig = buildConfigFromDetector(job, detectorIndex); - mlResultsService.getMetricData( + return mlResultsService + .getMetricData( chartConfig.datafeedConfig.indices, entityFields, chartConfig.datafeedConfig.query, @@ -73,20 +88,17 @@ function getMetricData(job, detectorIndex, entityFields, earliestMs, latestMs, i latestMs, interval ) - .then((resp) => { + .pipe( + map(resp => { _.each(resp.results, (value, time) => { + // @ts-ignore obj.results[time] = { - 'actual': value + actual: value, }; }); - - resolve(obj); + return obj; }) - .catch((resp) => { - reject(resp); - }); - - }); + ); } } @@ -94,9 +106,18 @@ function getMetricData(job, detectorIndex, entityFields, earliestMs, latestMs, i // in the title area of the time series chart. // Queries Elasticsearch if necessary to obtain the distinct count of entities // for which data is being plotted. -function getChartDetails(job, detectorIndex, entityFields, earliestMs, latestMs) { +function getChartDetails( + job: Job, + detectorIndex: number, + entityFields: any[], + earliestMs: number, + latestMs: number +) { return new Promise((resolve, reject) => { - const obj = { success: true, results: { functionLabel: '', entityData: { entities: [] } } }; + const obj: any = { + success: true, + results: { functionLabel: '', entityData: { entities: [] } }, + }; const chartConfig = buildConfigFromDetector(job, detectorIndex); let functionLabel = chartConfig.metricFunction; @@ -106,7 +127,7 @@ function getChartDetails(job, detectorIndex, entityFields, earliestMs, latestMs) } obj.results.functionLabel = functionLabel; - const blankEntityFields = _.filter(entityFields, (entity) => { + const blankEntityFields = _.filter(entityFields, entity => { return entity.fieldValue.length === 0; }); @@ -124,29 +145,28 @@ function getChartDetails(job, detectorIndex, entityFields, earliestMs, latestMs) query: chartConfig.datafeedConfig.query, timeFieldName: chartConfig.timeField, earliestMs, - latestMs + latestMs, }) - .then((results) => { - _.each(blankEntityFields, (field) => { + .then((results: any) => { + _.each(blankEntityFields, field => { // results will not contain keys for non-aggregatable fields, // so store as 0 to indicate over all field values. obj.results.entityData.entities.push({ fieldName: field.fieldName, - cardinality: _.get(results, field.fieldName, 0) + cardinality: _.get(results, field.fieldName, 0), }); }); resolve(obj); }) - .catch((resp) => { + .catch((resp: any) => { reject(resp); }); } - }); } export const mlTimeSeriesSearchService = { getMetricData, - getChartDetails + getChartDetails, }; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js similarity index 85% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js index 1dec12a3965783..02e29c1117ffc6 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer.js @@ -8,9 +8,10 @@ * React component for rendering Single Metric Viewer. */ -import { chain, difference, each, find, filter, first, get, has, isEqual, without } from 'lodash'; +import { chain, difference, each, find, first, get, has, isEqual, without } from 'lodash'; import moment from 'moment-timezone'; -import { Subscription } from 'rxjs'; +import { Subject, Subscription, forkJoin } from 'rxjs'; +import { map, debounceTime, switchMap, tap, withLatestFrom } from 'rxjs/operators'; import PropTypes from 'prop-types'; import React, { createRef, Fragment } from 'react'; @@ -32,17 +33,17 @@ import { import chrome from 'ui/chrome'; import { toastNotifications } from 'ui/notify'; -import { ResizeChecker } from '../../../../../../src/plugins/kibana_utils/public'; +import { ResizeChecker } from '../../../../../../../src/plugins/kibana_utils/public'; -import { ANOMALIES_TABLE_DEFAULT_QUERY_SIZE } from '../../common/constants/search'; -import { parseInterval } from '../../common/util/parse_interval'; +import { ANOMALIES_TABLE_DEFAULT_QUERY_SIZE } from '../../../common/constants/search'; +import { parseInterval } from '../../../common/util/parse_interval'; import { isModelPlotEnabled, isSourceDataChartableForDetector, isTimeSeriesViewJob, isTimeSeriesViewDetector, mlFunctionToESAggregation, -} from '../../common/util/job_utils'; +} from '../../../common/util/job_utils'; import { ChartTooltip } from '../components/chart_tooltip'; import { jobSelectServiceFactory, setGlobalState, getSelectedJobIds } from '../components/job_selector/job_select_service_utils'; @@ -78,11 +79,10 @@ import { calculateInitialFocusRange, createTimeSeriesJobData, getAutoZoomDuration, - getFocusData, processForecastResults, processMetricPlotResults, processRecordScoreResults, -} from './timeseriesexplorer_utils'; + getFocusData } from './timeseriesexplorer_utils'; const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false); @@ -179,6 +179,11 @@ export class TimeSeriesExplorer extends React.Component { }); } + /** + * Subject for listening brush time range selection. + */ + contextChart$ = new Subject(); + detectorIndexChangeHandler = (e) => { const id = e.target.value; if (id !== undefined) { @@ -252,109 +257,85 @@ export class TimeSeriesExplorer extends React.Component { } contextChartSelectedInitCallDone = false; - contextChartSelected = (selection) => { - const { appStateHandler } = this.props; + /** + * Gets default range from component state. + */ + getDefaultRangeFromState() { const { autoZoomDuration, contextAggregationInterval, contextChartData, contextForecastData, - focusChartData, - jobs, - selectedJob, - zoomFromFocusLoaded, - zoomToFocusLoaded, } = this.state; - - if ((contextChartData === undefined || contextChartData.length === 0) && - (contextForecastData === undefined || contextForecastData.length === 0)) { - return; - } - - const stateUpdate = {}; - - const defaultRange = calculateDefaultFocusRange( + return calculateDefaultFocusRange( autoZoomDuration, contextAggregationInterval, contextChartData, contextForecastData, ); + } - if ((selection.from.getTime() !== defaultRange[0].getTime() || selection.to.getTime() !== defaultRange[1].getTime()) && - (isNaN(Date.parse(selection.from)) === false && isNaN(Date.parse(selection.to)) === false)) { - const zoomState = { from: selection.from.toISOString(), to: selection.to.toISOString() }; - appStateHandler(APP_STATE_ACTION.SET_ZOOM, zoomState); - } else { - appStateHandler(APP_STATE_ACTION.UNSET_ZOOM); - } + getFocusAggregationInterval(selection) { + const { + jobs, + selectedJob, + } = this.state; - this.setState({ - zoomFrom: selection.from, - zoomTo: selection.to, - }); + // Calculate the aggregation interval for the focus chart. + const bounds = { min: moment(selection.from), max: moment(selection.to) }; - if ( - (this.contextChartSelectedInitCallDone === false && focusChartData === undefined) || - (zoomFromFocusLoaded.getTime() !== selection.from.getTime()) || - (zoomToFocusLoaded.getTime() !== selection.to.getTime()) - ) { - this.contextChartSelectedInitCallDone = true; + return calculateAggregationInterval( + bounds, + CHARTS_POINT_TARGET, + jobs, + selectedJob, + ); + } - // Calculate the aggregation interval for the focus chart. - const bounds = { min: moment(selection.from), max: moment(selection.to) }; - const focusAggregationInterval = calculateAggregationInterval( - bounds, - CHARTS_POINT_TARGET, - jobs, - selectedJob, - ); - stateUpdate.focusAggregationInterval = focusAggregationInterval; + /** + * Gets focus data for the current component state/ + */ + getFocusData(selection) { + const { + detectorId, + entities, + modelPlotEnabled, + selectedJob, + } = this.state; - // Ensure the search bounds align to the bucketing interval so that the first and last buckets are complete. - // For sum or count detectors, short buckets would hold smaller values, and model bounds would also be affected - // to some extent with all detector functions if not searching complete buckets. - const searchBounds = getBoundsRoundedToInterval(bounds, focusAggregationInterval, false); + const { appStateHandler } = this.props; - const { - detectorId, - entities, - modelPlotEnabled, - } = this.state; - - this.setState({ - loading: true, - fullRefresh: false, - zoomFrom: selection.from, - zoomTo: selection.to, - }); + // Calculate the aggregation interval for the focus chart. + const bounds = { min: moment(selection.from), max: moment(selection.to) }; - getFocusData( - this._criteriaFields, - +detectorId, - focusAggregationInterval, - appStateHandler(APP_STATE_ACTION.GET_FORECAST_ID), - modelPlotEnabled, - filter(entities, entity => entity.fieldValue.length > 0), - searchBounds, - selectedJob, - TIME_FIELD_NAME, - ).then((refreshFocusData) => { - // All the data is ready now for a state update. - this.setState({ - ...stateUpdate, - ...refreshFocusData, - loading: false, - showModelBoundsCheckbox: (modelPlotEnabled === true) && (refreshFocusData.focusChartData.length > 0), - zoomFromFocusLoaded: selection.from, - zoomToFocusLoaded: selection.to, - }); - }); + const focusAggregationInterval = this.getFocusAggregationInterval(selection); - // Load the data for the anomalies table. - this.loadAnomaliesTableData(searchBounds.min.valueOf(), searchBounds.max.valueOf()); - } + // Ensure the search bounds align to the bucketing interval so that the first and last buckets are complete. + // For sum or count detectors, short buckets would hold smaller values, and model bounds would also be affected + // to some extent with all detector functions if not searching complete buckets. + const searchBounds = getBoundsRoundedToInterval( + bounds, + focusAggregationInterval, + false + ); + + return getFocusData( + this._criteriaFields, + +detectorId, + focusAggregationInterval, + appStateHandler(APP_STATE_ACTION.GET_FORECAST_ID), + modelPlotEnabled, + entities.filter(entity => entity.fieldValue.length > 0), + searchBounds, + selectedJob, + TIME_FIELD_NAME + ); + } + + contextChartSelected = (selection) => { + this.contextChart$.next(selection); } entityFieldValueChanged = (entity, fieldValue) => { @@ -380,7 +361,7 @@ export class TimeSeriesExplorer extends React.Component { const { dateFormatTz } = this.props; const { selectedJob } = this.state; - ml.results.getAnomaliesTableData( + return ml.results.getAnomaliesTableData( [selectedJob.job_id], this._criteriaFields, [], @@ -390,43 +371,43 @@ export class TimeSeriesExplorer extends React.Component { latestMs, dateFormatTz, ANOMALIES_TABLE_DEFAULT_QUERY_SIZE - ).then((resp) => { - const anomalies = resp.anomalies; - const detectorsByJob = mlJobService.detectorsByJob; - anomalies.forEach((anomaly) => { - // Add a detector property to each anomaly. - // Default to functionDescription if no description available. - // TODO - when job_service is moved server_side, move this to server endpoint. - const jobId = anomaly.jobId; - const detector = get(detectorsByJob, [jobId, anomaly.detectorIndex]); - anomaly.detector = get(detector, - ['detector_description'], - anomaly.source.function_description); - - // For detectors with rules, add a property with the rule count. - const customRules = detector.custom_rules; - if (customRules !== undefined) { - anomaly.rulesLength = customRules.length; - } + ).pipe( + map(resp => { + const anomalies = resp.anomalies; + const detectorsByJob = mlJobService.detectorsByJob; + anomalies.forEach((anomaly) => { + // Add a detector property to each anomaly. + // Default to functionDescription if no description available. + // TODO - when job_service is moved server_side, move this to server endpoint. + const jobId = anomaly.jobId; + const detector = get(detectorsByJob, [jobId, anomaly.detectorIndex]); + anomaly.detector = get(detector, + ['detector_description'], + anomaly.source.function_description); + + // For detectors with rules, add a property with the rule count. + const customRules = detector.custom_rules; + if (customRules !== undefined) { + anomaly.rulesLength = customRules.length; + } - // Add properties used for building the links menu. - // TODO - when job_service is moved server_side, move this to server endpoint. - if (has(mlJobService.customUrlsByJob, jobId)) { - anomaly.customUrls = mlJobService.customUrlsByJob[jobId]; - } - }); + // Add properties used for building the links menu. + // TODO - when job_service is moved server_side, move this to server endpoint. + if (has(mlJobService.customUrlsByJob, jobId)) { + anomaly.customUrls = mlJobService.customUrlsByJob[jobId]; + } + }); - this.setState({ - tableData: { - anomalies, - interval: resp.interval, - examplesByJobId: resp.examplesByJobId, - showViewSeriesLink: false - } - }); - }).catch((resp) => { - console.log('Time series explorer - error loading data for anomalies table:', resp); - }); + return { + tableData: { + anomalies, + interval: resp.interval, + examplesByJobId: resp.examplesByJobId, + showViewSeriesLink: false + } + }; + }) + ); } loadEntityValues = (callback = () => {}) => { @@ -445,6 +426,7 @@ export class TimeSeriesExplorer extends React.Component { bounds.min.valueOf(), bounds.max.valueOf(), ANOMALIES_TABLE_DEFAULT_QUERY_SIZE) + .toPromise() .then((resp) => { if (resp.records && resp.records.length > 0) { const firstRec = resp.records[0]; @@ -604,7 +586,7 @@ export class TimeSeriesExplorer extends React.Component { } }; - const nonBlankEntities = filter(currentEntities, (entity) => { return entity.fieldValue.length > 0; }); + const nonBlankEntities = currentEntities.filter((entity) => { return entity.fieldValue.length > 0; }); if (modelPlotEnabled === false && isSourceDataChartableForDetector(selectedJob, detectorIndex) === false && @@ -646,7 +628,7 @@ export class TimeSeriesExplorer extends React.Component { searchBounds.min.valueOf(), searchBounds.max.valueOf(), stateUpdate.contextAggregationInterval.expression - ).then((resp) => { + ).toPromise().then((resp) => { const fullRangeChartData = processMetricPlotResults(resp.results, modelPlotEnabled); stateUpdate.contextChartData = fullRangeChartData; finish(counter); @@ -702,7 +684,8 @@ export class TimeSeriesExplorer extends React.Component { searchBounds.min.valueOf(), searchBounds.max.valueOf(), stateUpdate.contextAggregationInterval.expression, - aggType) + aggType + ).toPromise() .then((resp) => { stateUpdate.contextForecastData = processForecastResults(resp.results); finish(counter); @@ -762,7 +745,7 @@ export class TimeSeriesExplorer extends React.Component { */ updateCriteriaFields(detectorIndex, entities) { // Only filter on the entity if the field has a value. - const nonBlankEntities = filter(entities, (entity) => { return entity.fieldValue.length > 0; }); + const nonBlankEntities = entities.filter(entity => entity.fieldValue.length > 0); this._criteriaFields = [ { fieldName: 'detector_index', @@ -868,7 +851,8 @@ export class TimeSeriesExplorer extends React.Component { const tableControlsListener = () => { const { zoomFrom, zoomTo } = this.state; if (zoomFrom !== undefined && zoomTo !== undefined) { - this.loadAnomaliesTableData(zoomFrom.getTime(), zoomTo.getTime()); + this.loadAnomaliesTableData(zoomFrom.getTime(), zoomTo.getTime()).subscribe(res => + this.setState(res)); } }; @@ -978,6 +962,97 @@ export class TimeSeriesExplorer extends React.Component { this.resizeHandler(); }); this.resizeHandler(); + + // Listen for context chart updates. + this.subscriptions.add(this.contextChart$ + .pipe( + tap(selection => { + this.setState({ + zoomFrom: selection.from, + zoomTo: selection.to, + }); + }), + debounceTime(500), + tap((selection) => { + const { + contextChartData, + contextForecastData, + focusChartData, + zoomFromFocusLoaded, + zoomToFocusLoaded, + } = this.state; + + if ((contextChartData === undefined || contextChartData.length === 0) && + (contextForecastData === undefined || contextForecastData.length === 0)) { + return; + } + + const defaultRange = this.getDefaultRangeFromState(); + + if ((selection.from.getTime() !== defaultRange[0].getTime() || selection.to.getTime() !== defaultRange[1].getTime()) && + (isNaN(Date.parse(selection.from)) === false && isNaN(Date.parse(selection.to)) === false)) { + const zoomState = { from: selection.from.toISOString(), to: selection.to.toISOString() }; + appStateHandler(APP_STATE_ACTION.SET_ZOOM, zoomState); + } else { + appStateHandler(APP_STATE_ACTION.UNSET_ZOOM); + } + + if ( + (this.contextChartSelectedInitCallDone === false && focusChartData === undefined) || + (zoomFromFocusLoaded.getTime() !== selection.from.getTime()) || + (zoomToFocusLoaded.getTime() !== selection.to.getTime()) + ) { + this.contextChartSelectedInitCallDone = true; + + this.setState({ + loading: true, + fullRefresh: false, + }); + } + }), + switchMap(selection => { + const { + jobs, + selectedJob + } = this.state; + + // Calculate the aggregation interval for the focus chart. + const bounds = { min: moment(selection.from), max: moment(selection.to) }; + const focusAggregationInterval = calculateAggregationInterval( + bounds, + CHARTS_POINT_TARGET, + jobs, + selectedJob, + ); + + // Ensure the search bounds align to the bucketing interval so that the first and last buckets are complete. + // For sum or count detectors, short buckets would hold smaller values, and model bounds would also be affected + // to some extent with all detector functions if not searching complete buckets. + const searchBounds = getBoundsRoundedToInterval(bounds, focusAggregationInterval, false); + return forkJoin([ + this.getFocusData(selection), + // Load the data for the anomalies table. + this.loadAnomaliesTableData(searchBounds.min.valueOf(), searchBounds.max.valueOf()) + ]); + }), + withLatestFrom(this.contextChart$) + ) + .subscribe(([[refreshFocusData, tableData], selection]) => { + const { + modelPlotEnabled, + } = this.state; + + // All the data is ready now for a state update. + this.setState({ + focusAggregationInterval: this.getFocusAggregationInterval({ from: selection.from, to: selection.to }), + loading: false, + showModelBoundsCheckbox: modelPlotEnabled && (refreshFocusData.focusChartData.length > 0), + zoomFromFocusLoaded: selection.from, + zoomToFocusLoaded: selection.to, + ...refreshFocusData, + ...tableData + }); + })); } componentWillUnmount() { diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_constants.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_constants.ts similarity index 99% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_constants.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_constants.ts index 52590bb6824c1f..29a5facf64c0fc 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_constants.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_constants.ts @@ -8,7 +8,6 @@ * Contains values for ML time series explorer. */ - export const APP_STATE_ACTION = { CLEAR: 'CLEAR', GET_DETECTOR_INDEX: 'GET_DETECTOR_INDEX', diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_directive.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_directive.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_directive.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_directive.js diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_route.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_route.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_route.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_route.js diff --git a/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/get_focus_data.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/get_focus_data.ts new file mode 100644 index 00000000000000..03fe718de9bedc --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/get_focus_data.ts @@ -0,0 +1,164 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { forkJoin, Observable, of } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import chrome from 'ui/chrome'; +import { ml } from '../../services/ml_api_service'; +import { + ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE, + ANOMALIES_TABLE_DEFAULT_QUERY_SIZE, +} from '../../../../common/constants/search'; +import { mlTimeSeriesSearchService } from '../timeseries_search_service'; +import { mlResultsService, CriteriaField } from '../../services/results_service'; +import { Job } from '../../jobs/new_job/common/job_creator/configs'; +import { MAX_SCHEDULED_EVENTS, TIME_FIELD_NAME } from '../timeseriesexplorer_constants'; +import { + processDataForFocusAnomalies, + processForecastResults, + processMetricPlotResults, + processScheduledEventsForChart, +} from './timeseriesexplorer_utils'; +import { mlForecastService } from '../../services/forecast_service'; +import { mlFunctionToESAggregation } from '../../../../common/util/job_utils'; +import { Annotation } from '../../../../common/types/annotations'; + +const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false); + +export interface Interval { + asMilliseconds: () => number; + expression: string; +} + +export interface FocusData { + focusChartData: any; + anomalyRecords: any; + scheduledEvents: any; + showForecastCheckbox?: any; + focusAnnotationData?: any; + focusForecastData?: any; +} + +export function getFocusData( + criteriaFields: CriteriaField[], + detectorIndex: number, + focusAggregationInterval: Interval, + forecastId: string, + modelPlotEnabled: boolean, + nonBlankEntities: any[], + searchBounds: any, + selectedJob: Job +): Observable { + return forkJoin([ + // Query 1 - load metric data across selected time range. + mlTimeSeriesSearchService.getMetricData( + selectedJob, + detectorIndex, + nonBlankEntities, + searchBounds.min.valueOf(), + searchBounds.max.valueOf(), + focusAggregationInterval.expression + ), + // Query 2 - load all the records across selected time range for the chart anomaly markers. + mlResultsService.getRecordsForCriteria( + [selectedJob.job_id], + criteriaFields, + 0, + searchBounds.min.valueOf(), + searchBounds.max.valueOf(), + ANOMALIES_TABLE_DEFAULT_QUERY_SIZE + ), + // Query 3 - load any scheduled events for the selected job. + mlResultsService.getScheduledEventsByBucket( + [selectedJob.job_id], + searchBounds.min.valueOf(), + searchBounds.max.valueOf(), + focusAggregationInterval.expression, + 1, + MAX_SCHEDULED_EVENTS + ), + // Query 4 - load any annotations for the selected job. + mlAnnotationsEnabled + ? ml.annotations + .getAnnotations({ + jobIds: [selectedJob.job_id], + earliestMs: searchBounds.min.valueOf(), + latestMs: searchBounds.max.valueOf(), + maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE, + }) + .pipe( + catchError(() => { + // silent fail + return of({ annotations: {} as Record }); + }) + ) + : of(null), + // Plus query for forecast data if there is a forecastId stored in the appState. + forecastId !== undefined + ? (() => { + let aggType; + const detector = selectedJob.analysis_config.detectors[detectorIndex]; + const esAgg = mlFunctionToESAggregation(detector.function); + if (!modelPlotEnabled && (esAgg === 'sum' || esAgg === 'count')) { + aggType = { avg: 'sum', max: 'sum', min: 'sum' }; + } + return mlForecastService.getForecastData( + selectedJob, + detectorIndex, + forecastId, + nonBlankEntities, + searchBounds.min.valueOf(), + searchBounds.max.valueOf(), + focusAggregationInterval.expression, + aggType + ); + })() + : of(null), + ]).pipe( + map(([metricData, recordsForCriteria, scheduledEventsByBucket, annotations, forecastData]) => { + // Sort in descending time order before storing in scope. + const anomalyRecords = recordsForCriteria.records + .sort((a, b) => a[TIME_FIELD_NAME] - b[TIME_FIELD_NAME]) + .reverse(); + + const scheduledEvents = scheduledEventsByBucket.events[selectedJob.job_id]; + + let focusChartData = processMetricPlotResults(metricData.results, modelPlotEnabled); + // Tell the results container directives to render the focus chart. + focusChartData = processDataForFocusAnomalies( + focusChartData, + anomalyRecords, + focusAggregationInterval, + modelPlotEnabled + ); + focusChartData = processScheduledEventsForChart(focusChartData, scheduledEvents); + + const refreshFocusData: FocusData = { + scheduledEvents, + anomalyRecords, + focusChartData, + }; + + if (annotations) { + refreshFocusData.focusAnnotationData = (annotations.annotations[selectedJob.job_id] ?? []) + .sort((a, b) => { + return a.timestamp - b.timestamp; + }) + .map((d, i) => { + d.key = String.fromCharCode(65 + i); + return d; + }); + } + + if (forecastData) { + refreshFocusData.focusForecastData = processForecastResults(forecastData.results); + refreshFocusData.showForecastCheckbox = refreshFocusData.focusForecastData.length > 0; + } + + return refreshFocusData; + }) + ); +} diff --git a/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/index.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/index.ts new file mode 100644 index 00000000000000..578dbdf1277a05 --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { getFocusData } from './get_focus_data'; +export * from './timeseriesexplorer_utils'; diff --git a/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.d.ts b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.d.ts new file mode 100644 index 00000000000000..1528ac887ad76e --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.d.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export function createTimeSeriesJobData(jobs: any): any; + +export function processMetricPlotResults(metricPlotData: any, modelPlotEnabled: any): any; + +export function processForecastResults(forecastData: any): any; + +export function processRecordScoreResults(scoreData: any): any; + +export function processDataForFocusAnomalies( + chartData: any, + anomalyRecords: any, + aggregationInterval: any, + modelPlotEnabled: any +): any; + +export function processScheduledEventsForChart(chartData: any, scheduledEvents: any): any; + +export function findNearestChartPointToTime(chartData: any, time: any): any; + +export function findChartPointForAnomalyTime( + chartData: any, + anomalyTime: any, + aggregationInterval: any +): any; + +export function calculateAggregationInterval( + bounds: any, + bucketsTarget: any, + jobs: any, + selectedJob: any +): any; + +export function calculateDefaultFocusRange( + autoZoomDuration: any, + contextAggregationInterval: any, + contextChartData: any, + contextForecastData: any +): any; + +export function calculateInitialFocusRange( + zoomState: any, + contextAggregationInterval: any, + timefilter: any +): any; + +export function getAutoZoomDuration(jobs: any, selectedJob: any): any; diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_utils.js b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js similarity index 70% rename from x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_utils.js rename to x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js index fb741702841ed1..b9c9ed87ddbc78 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer_utils.js +++ b/x-pack/legacy/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js @@ -15,31 +15,17 @@ import _ from 'lodash'; import moment from 'moment-timezone'; -import { - ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE, - ANOMALIES_TABLE_DEFAULT_QUERY_SIZE -} from '../../common/constants/search'; import { isTimeSeriesViewJob, - mlFunctionToESAggregation, -} from '../../common/util/job_utils'; -import { parseInterval } from '../../common/util/parse_interval'; - -import { ml } from '../services/ml_api_service'; -import { mlForecastService } from '../services/forecast_service'; -import { mlResultsService } from '../services/results_service'; -import { TimeBuckets, getBoundsRoundedToInterval } from '../util/time_buckets'; +} from '../../../../common/util/job_utils'; +import { parseInterval } from '../../../../common/util/parse_interval'; -import { mlTimeSeriesSearchService } from './timeseries_search_service'; +import { TimeBuckets, getBoundsRoundedToInterval } from '../../util/time_buckets'; import { CHARTS_POINT_TARGET, - MAX_SCHEDULED_EVENTS, TIME_FIELD_NAME, -} from './timeseriesexplorer_constants'; - -import chrome from 'ui/chrome'; -const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false); +} from '../timeseriesexplorer_constants'; // create new job objects based on standard job config objects // new job objects just contain job id, bucket span in seconds and a selected flag. @@ -301,154 +287,6 @@ export function findChartPointForAnomalyTime(chartData, anomalyTime, aggregation return chartPoint; } -export const getFocusData = function ( - criteriaFields, - detectorIndex, - focusAggregationInterval, - forecastId, - modelPlotEnabled, - nonBlankEntities, - searchBounds, - selectedJob, -) { - return new Promise((resolve, reject) => { - // Counter to keep track of the queries to populate the chart. - let awaitingCount = 4; - - // This object is used to store the results of individual remote requests - // before we transform it into the final data and apply it to $scope. Otherwise - // we might trigger multiple $digest cycles and depending on how deep $watches - // listen for changes we could miss updates. - const refreshFocusData = {}; - - // finish() function, called after each data set has been loaded and processed. - // The last one to call it will trigger the page render. - function finish() { - awaitingCount--; - if (awaitingCount === 0) { - // Tell the results container directives to render the focus chart. - refreshFocusData.focusChartData = processDataForFocusAnomalies( - refreshFocusData.focusChartData, - refreshFocusData.anomalyRecords, - focusAggregationInterval, - modelPlotEnabled, - ); - - refreshFocusData.focusChartData = processScheduledEventsForChart( - refreshFocusData.focusChartData, - refreshFocusData.scheduledEvents); - - resolve(refreshFocusData); - } - } - - // Query 1 - load metric data across selected time range. - mlTimeSeriesSearchService.getMetricData( - selectedJob, - detectorIndex, - nonBlankEntities, - searchBounds.min.valueOf(), - searchBounds.max.valueOf(), - focusAggregationInterval.expression - ).then((resp) => { - refreshFocusData.focusChartData = processMetricPlotResults(resp.results, modelPlotEnabled); - finish(); - }).catch((resp) => { - console.log('Time series explorer - error getting metric data from elasticsearch:', resp); - reject(); - }); - - // Query 2 - load all the records across selected time range for the chart anomaly markers. - mlResultsService.getRecordsForCriteria( - [selectedJob.job_id], - criteriaFields, - 0, - searchBounds.min.valueOf(), - searchBounds.max.valueOf(), - ANOMALIES_TABLE_DEFAULT_QUERY_SIZE - ).then((resp) => { - // Sort in descending time order before storing in scope. - refreshFocusData.anomalyRecords = _.chain(resp.records) - .sortBy(record => record[TIME_FIELD_NAME]) - .reverse() - .value(); - finish(); - }); - - // Query 3 - load any scheduled events for the selected job. - mlResultsService.getScheduledEventsByBucket( - [selectedJob.job_id], - searchBounds.min.valueOf(), - searchBounds.max.valueOf(), - focusAggregationInterval.expression, - 1, - MAX_SCHEDULED_EVENTS - ).then((resp) => { - refreshFocusData.scheduledEvents = resp.events[selectedJob.job_id]; - finish(); - }).catch((resp) => { - console.log('Time series explorer - error getting scheduled events from elasticsearch:', resp); - reject(); - }); - - // Query 4 - load any annotations for the selected job. - if (mlAnnotationsEnabled) { - ml.annotations.getAnnotations({ - jobIds: [selectedJob.job_id], - earliestMs: searchBounds.min.valueOf(), - latestMs: searchBounds.max.valueOf(), - maxAnnotations: ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE - }).then((resp) => { - refreshFocusData.focusAnnotationData = resp.annotations[selectedJob.job_id] - .sort((a, b) => { - return a.timestamp - b.timestamp; - }) - .map((d, i) => { - d.key = String.fromCharCode(65 + i); - return d; - }); - - finish(); - }).catch(() => { - // silent fail - refreshFocusData.focusAnnotationData = []; - finish(); - }); - } else { - finish(); - } - - // Plus query for forecast data if there is a forecastId stored in the appState. - if (forecastId !== undefined) { - awaitingCount++; - let aggType = undefined; - const detector = selectedJob.analysis_config.detectors[detectorIndex]; - const esAgg = mlFunctionToESAggregation(detector.function); - if (modelPlotEnabled === false && (esAgg === 'sum' || esAgg === 'count')) { - aggType = { avg: 'sum', max: 'sum', min: 'sum' }; - } - - mlForecastService.getForecastData( - selectedJob, - detectorIndex, - forecastId, - nonBlankEntities, - searchBounds.min.valueOf(), - searchBounds.max.valueOf(), - focusAggregationInterval.expression, - aggType) - .then((resp) => { - refreshFocusData.focusForecastData = processForecastResults(resp.results); - refreshFocusData.showForecastCheckbox = (refreshFocusData.focusForecastData.length > 0); - finish(); - }).catch((resp) => { - console.log(`Time series explorer - error loading data for forecast ID ${forecastId}`, resp); - reject(); - }); - } - }); -}; - export function calculateAggregationInterval( bounds, bucketsTarget, diff --git a/x-pack/legacy/plugins/ml/public/util/__snapshots__/observable_utils.test.tsx.snap b/x-pack/legacy/plugins/ml/public/application/util/__snapshots__/observable_utils.test.tsx.snap similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/__snapshots__/observable_utils.test.tsx.snap rename to x-pack/legacy/plugins/ml/public/application/util/__snapshots__/observable_utils.test.tsx.snap diff --git a/x-pack/legacy/plugins/ml/public/util/__tests__/app_state_utils.js b/x-pack/legacy/plugins/ml/public/application/util/__tests__/app_state_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/__tests__/app_state_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/__tests__/app_state_utils.js diff --git a/x-pack/legacy/plugins/ml/public/util/__tests__/calc_auto_interval.js b/x-pack/legacy/plugins/ml/public/application/util/__tests__/calc_auto_interval.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/__tests__/calc_auto_interval.js rename to x-pack/legacy/plugins/ml/public/application/util/__tests__/calc_auto_interval.js diff --git a/x-pack/legacy/plugins/ml/public/util/__tests__/chart_utils.js b/x-pack/legacy/plugins/ml/public/application/util/__tests__/chart_utils.js similarity index 99% rename from x-pack/legacy/plugins/ml/public/util/__tests__/chart_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/__tests__/chart_utils.js index a6c8a9ed1ec174..9c107034359d6f 100644 --- a/x-pack/legacy/plugins/ml/public/util/__tests__/chart_utils.js +++ b/x-pack/legacy/plugins/ml/public/application/util/__tests__/chart_utils.js @@ -17,7 +17,7 @@ import { showMultiBucketAnomalyMarker, showMultiBucketAnomalyTooltip, } from '../chart_utils'; -import { MULTI_BUCKET_IMPACT } from '../../../common/constants/multi_bucket_impact'; +import { MULTI_BUCKET_IMPACT } from '../../../../common/constants/multi_bucket_impact'; import { CHART_TYPE } from '../../explorer/explorer_constants'; describe('ML - chart utils', () => { diff --git a/x-pack/legacy/plugins/ml/public/util/__tests__/ml_time_buckets.js b/x-pack/legacy/plugins/ml/public/application/util/__tests__/ml_time_buckets.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/__tests__/ml_time_buckets.js rename to x-pack/legacy/plugins/ml/public/application/util/__tests__/ml_time_buckets.js diff --git a/x-pack/legacy/plugins/ml/public/util/__tests__/string_utils.js b/x-pack/legacy/plugins/ml/public/application/util/__tests__/string_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/__tests__/string_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/__tests__/string_utils.js diff --git a/x-pack/legacy/plugins/ml/public/util/app_state_utils.js b/x-pack/legacy/plugins/ml/public/application/util/app_state_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/app_state_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/app_state_utils.js diff --git a/x-pack/legacy/plugins/ml/public/util/calc_auto_interval.js b/x-pack/legacy/plugins/ml/public/application/util/calc_auto_interval.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/calc_auto_interval.js rename to x-pack/legacy/plugins/ml/public/application/util/calc_auto_interval.js diff --git a/x-pack/legacy/plugins/ml/public/util/chart_config_builder.js b/x-pack/legacy/plugins/ml/public/application/util/chart_config_builder.js similarity index 97% rename from x-pack/legacy/plugins/ml/public/util/chart_config_builder.js rename to x-pack/legacy/plugins/ml/public/application/util/chart_config_builder.js index 1529ea868d4e6e..844d46001b8e78 100644 --- a/x-pack/legacy/plugins/ml/public/util/chart_config_builder.js +++ b/x-pack/legacy/plugins/ml/public/application/util/chart_config_builder.js @@ -13,7 +13,7 @@ import _ from 'lodash'; -import { mlFunctionToESAggregation } from '../../common/util/job_utils'; +import { mlFunctionToESAggregation } from '../../../common/util/job_utils'; // Builds the basic configuration to plot a chart of the source data // analyzed by the the detector at the given index from the specified ML job. diff --git a/x-pack/legacy/plugins/ml/public/util/chart_utils.js b/x-pack/legacy/plugins/ml/public/application/util/chart_utils.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/util/chart_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/chart_utils.js index c73c89ad8c16cd..8aa933eb5e53fe 100644 --- a/x-pack/legacy/plugins/ml/public/util/chart_utils.js +++ b/x-pack/legacy/plugins/ml/public/application/util/chart_utils.js @@ -7,8 +7,8 @@ import d3 from 'd3'; -import { calculateTextWidth } from '../util/string_utils'; -import { MULTI_BUCKET_IMPACT } from '../../common/constants/multi_bucket_impact'; +import { calculateTextWidth } from './string_utils'; +import { MULTI_BUCKET_IMPACT } from '../../../common/constants/multi_bucket_impact'; import moment from 'moment'; import rison from 'rison-node'; diff --git a/x-pack/legacy/plugins/ml/public/util/chart_utils.test.js b/x-pack/legacy/plugins/ml/public/application/util/chart_utils.test.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/chart_utils.test.js rename to x-pack/legacy/plugins/ml/public/application/util/chart_utils.test.js diff --git a/x-pack/legacy/plugins/ml/public/util/custom_url_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.test.ts similarity index 99% rename from x-pack/legacy/plugins/ml/public/util/custom_url_utils.test.ts rename to x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.test.ts index ff97c3fffbf1c0..6684ad3fa3e9ba 100644 --- a/x-pack/legacy/plugins/ml/public/util/custom_url_utils.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.test.ts @@ -10,12 +10,12 @@ import { isValidLabel, isValidTimeRange, } from './custom_url_utils'; -import { AnomalyRecordDoc } from '../../common/types/anomalies'; +import { AnomalyRecordDoc } from '../../../common/types/anomalies'; import { CustomUrlAnomalyRecordDoc, KibanaUrlConfig, UrlConfig, -} from '../../common/types/custom_urls'; +} from '../../../common/types/custom_urls'; describe('ML - custom URL utils', () => { const TEST_DOC: AnomalyRecordDoc = { diff --git a/x-pack/legacy/plugins/ml/public/util/custom_url_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.ts similarity index 97% rename from x-pack/legacy/plugins/ml/public/util/custom_url_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.ts index 0d21aed222cadb..1a15f607e13c24 100644 --- a/x-pack/legacy/plugins/ml/public/util/custom_url_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/custom_url_utils.ts @@ -9,14 +9,14 @@ import { get, flow } from 'lodash'; import moment from 'moment'; -import { parseInterval } from '../../common/util/parse_interval'; +import { parseInterval } from '../../../common/util/parse_interval'; import { escapeForElasticsearchQuery, replaceStringTokens } from './string_utils'; import { UrlConfig, KibanaUrlConfig, CustomUrlAnomalyRecordDoc, -} from '../../common/types/custom_urls'; -import { AnomalyRecordDoc } from '../../common/types/anomalies'; +} from '../../../common/types/custom_urls'; +import { AnomalyRecordDoc } from '../../../common/types/anomalies'; // Value of custom_url time_range property indicating drilldown time range is calculated automatically // depending on the context in which the URL is being opened. diff --git a/x-pack/legacy/plugins/ml/public/util/date_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/date_utils.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/date_utils.test.ts rename to x-pack/legacy/plugins/ml/public/application/util/date_utils.test.ts diff --git a/x-pack/legacy/plugins/ml/public/util/date_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/date_utils.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/date_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/date_utils.ts diff --git a/x-pack/legacy/plugins/ml/public/util/field_types_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts similarity index 95% rename from x-pack/legacy/plugins/ml/public/util/field_types_utils.test.ts rename to x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts index 3ca1adeb08f955..2abb8097598d2a 100644 --- a/x-pack/legacy/plugins/ml/public/util/field_types_utils.test.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.test.ts @@ -5,8 +5,8 @@ */ import { FieldType } from 'ui/index_patterns'; -import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/public'; -import { ML_JOB_FIELD_TYPES } from './../../common/constants/field_types'; +import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; import { kbnTypeToMLJobType, getMLJobTypeAriaLabel, diff --git a/x-pack/legacy/plugins/ml/public/util/field_types_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts similarity index 94% rename from x-pack/legacy/plugins/ml/public/util/field_types_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts index e97ff11bc2bb7b..e2b876aa8dbcd5 100644 --- a/x-pack/legacy/plugins/ml/public/util/field_types_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/field_types_utils.ts @@ -6,9 +6,9 @@ import { i18n } from '@kbn/i18n'; import { FieldType } from 'ui/index_patterns'; -import { ML_JOB_FIELD_TYPES } from './../../common/constants/field_types'; +import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; -import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/public'; +import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; // convert kibana types to ML Job types // this is needed because kibana types only have string and not text and keyword. diff --git a/x-pack/legacy/plugins/ml/public/util/index_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/index_utils.ts similarity index 93% rename from x-pack/legacy/plugins/ml/public/util/index_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/index_utils.ts index 5c15cdd6b8df0a..f25821e8ca1ca3 100644 --- a/x-pack/legacy/plugins/ml/public/util/index_utils.ts +++ b/x-pack/legacy/plugins/ml/public/application/util/index_utils.ts @@ -9,8 +9,8 @@ import { i18n } from '@kbn/i18n'; import { IndexPattern, IndexPatterns } from 'ui/index_patterns'; import { SavedObjectAttributes, SimpleSavedObject } from 'kibana/public'; import chrome from 'ui/chrome'; -import { SavedSearchLoader } from '../../../../../../src/legacy/core_plugins/kibana/public/discover/types'; -import { start as data } from '../../../../../../src/legacy/core_plugins/data/public/legacy'; +import { SavedSearchLoader } from '../../../../../../../src/legacy/core_plugins/kibana/public/discover/types'; +import { start as data } from '../../../../../../../src/legacy/core_plugins/data/public/legacy'; type IndexPatternSavedObject = SimpleSavedObject; diff --git a/x-pack/legacy/plugins/ml/public/util/inherits.js b/x-pack/legacy/plugins/ml/public/application/util/inherits.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/inherits.js rename to x-pack/legacy/plugins/ml/public/application/util/inherits.js diff --git a/x-pack/legacy/plugins/ml/public/util/ml_error.js b/x-pack/legacy/plugins/ml/public/application/util/ml_error.js similarity index 90% rename from x-pack/legacy/plugins/ml/public/util/ml_error.js rename to x-pack/legacy/plugins/ml/public/application/util/ml_error.js index d5a3507ffaa150..2d319a395af542 100644 --- a/x-pack/legacy/plugins/ml/public/util/ml_error.js +++ b/x-pack/legacy/plugins/ml/public/application/util/ml_error.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { KbnError } from '../../../../../../src/plugins/kibana_utils/public'; +import { KbnError } from '../../../../../../../src/plugins/kibana_utils/public'; export class MLRequestFailure extends KbnError { // takes an Error object and and optional response object diff --git a/x-pack/legacy/plugins/ml/public/util/object_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/object_utils.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/object_utils.test.ts rename to x-pack/legacy/plugins/ml/public/application/util/object_utils.test.ts diff --git a/x-pack/legacy/plugins/ml/public/util/object_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/object_utils.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/object_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/object_utils.ts diff --git a/x-pack/legacy/plugins/ml/public/util/observable_utils.test.tsx b/x-pack/legacy/plugins/ml/public/application/util/observable_utils.test.tsx similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/observable_utils.test.tsx rename to x-pack/legacy/plugins/ml/public/application/util/observable_utils.test.tsx diff --git a/x-pack/legacy/plugins/ml/public/util/observable_utils.tsx b/x-pack/legacy/plugins/ml/public/application/util/observable_utils.tsx similarity index 96% rename from x-pack/legacy/plugins/ml/public/util/observable_utils.tsx rename to x-pack/legacy/plugins/ml/public/application/util/observable_utils.tsx index bdc6c70aac7498..7f1fc366bc5bb4 100644 --- a/x-pack/legacy/plugins/ml/public/util/observable_utils.tsx +++ b/x-pack/legacy/plugins/ml/public/application/util/observable_utils.tsx @@ -7,7 +7,7 @@ import React, { Component, ComponentType } from 'react'; import { BehaviorSubject, Subscription } from 'rxjs'; -import { Dictionary } from '../../common/types/common'; +import { Dictionary } from '../../../common/types/common'; // Sets up a ObservableComponent which subscribes to given observable updates and // and passes them on as prop values to the given WrappedComponent. diff --git a/x-pack/legacy/plugins/ml/public/util/recently_accessed.ts b/x-pack/legacy/plugins/ml/public/application/util/recently_accessed.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/recently_accessed.ts rename to x-pack/legacy/plugins/ml/public/application/util/recently_accessed.ts diff --git a/x-pack/legacy/plugins/ml/public/util/string_utils.d.ts b/x-pack/legacy/plugins/ml/public/application/util/string_utils.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/string_utils.d.ts rename to x-pack/legacy/plugins/ml/public/application/util/string_utils.d.ts diff --git a/x-pack/legacy/plugins/ml/public/util/string_utils.js b/x-pack/legacy/plugins/ml/public/application/util/string_utils.js similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/string_utils.js rename to x-pack/legacy/plugins/ml/public/application/util/string_utils.js diff --git a/x-pack/legacy/plugins/ml/public/util/test_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/test_utils.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/test_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/test_utils.ts diff --git a/x-pack/legacy/plugins/ml/public/util/time_buckets.d.ts b/x-pack/legacy/plugins/ml/public/application/util/time_buckets.d.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/time_buckets.d.ts rename to x-pack/legacy/plugins/ml/public/application/util/time_buckets.d.ts diff --git a/x-pack/legacy/plugins/ml/public/util/time_buckets.js b/x-pack/legacy/plugins/ml/public/application/util/time_buckets.js similarity index 98% rename from x-pack/legacy/plugins/ml/public/util/time_buckets.js rename to x-pack/legacy/plugins/ml/public/application/util/time_buckets.js index 98cb677a4851af..45181ab9f4f62f 100644 --- a/x-pack/legacy/plugins/ml/public/util/time_buckets.js +++ b/x-pack/legacy/plugins/ml/public/application/util/time_buckets.js @@ -12,8 +12,8 @@ import chrome from 'ui/chrome'; import { npStart } from 'ui/new_platform'; import { timeBucketsCalcAutoIntervalProvider } from './calc_auto_interval'; -import { parseInterval } from '../../common/util/parse_interval'; -import { FIELD_FORMAT_IDS } from '../../../../../../src/plugins/data/public'; +import { parseInterval } from '../../../common/util/parse_interval'; +import { FIELD_FORMAT_IDS } from '../../../../../../../src/plugins/data/public'; const unitsDesc = dateMath.unitsDesc; const largeMax = unitsDesc.indexOf('w'); // Multiple units of week or longer converted to days for ES intervals. diff --git a/x-pack/legacy/plugins/ml/public/util/url_utils.test.ts b/x-pack/legacy/plugins/ml/public/application/util/url_utils.test.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/url_utils.test.ts rename to x-pack/legacy/plugins/ml/public/application/util/url_utils.test.ts diff --git a/x-pack/legacy/plugins/ml/public/util/url_utils.ts b/x-pack/legacy/plugins/ml/public/application/util/url_utils.ts similarity index 100% rename from x-pack/legacy/plugins/ml/public/util/url_utils.ts rename to x-pack/legacy/plugins/ml/public/application/util/url_utils.ts diff --git a/x-pack/legacy/plugins/ml/public/explorer/index.js b/x-pack/legacy/plugins/ml/public/explorer/index.js deleted file mode 100644 index ba21c463083609..00000000000000 --- a/x-pack/legacy/plugins/ml/public/explorer/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - - - -import 'plugins/ml/explorer/explorer_controller'; -import 'plugins/ml/explorer/explorer_dashboard_service'; -import 'plugins/ml/explorer/explorer_react_wrapper_directive'; -import 'plugins/ml/explorer/explorer_charts'; -import 'plugins/ml/explorer/select_limit'; -import 'plugins/ml/components/job_selector'; diff --git a/x-pack/legacy/plugins/ml/public/index.scss b/x-pack/legacy/plugins/ml/public/index.scss index 97f0e037e2648c..c3216773c1a324 100644 --- a/x-pack/legacy/plugins/ml/public/index.scss +++ b/x-pack/legacy/plugins/ml/public/index.scss @@ -6,11 +6,11 @@ @import '@elastic/eui/src/components/panel/mixins'; // ML has it's own variables for coloring -@import 'variables'; +@import 'application/variables'; // Kibana management page ML section #kibanaManagementMLSection { - @import 'management/index'; + @import 'application/management/index'; } // Protect the rest of Kibana from ML generic namespacing @@ -18,33 +18,33 @@ #ml-app { // App level - @import 'app'; + @import 'application/app'; // Sub applications - @import 'data_frame_analytics/index'; - @import 'datavisualizer/index'; - @import 'explorer/index'; // SASSTODO: This file needs to be rewritten - @import 'jobs/index'; // SASSTODO: This collection of sass files has multiple problems - @import 'overview/index'; - @import 'settings/index'; - @import 'timeseriesexplorer/index'; + @import 'application/data_frame_analytics/index'; + @import 'application/datavisualizer/index'; + @import 'application/explorer/index'; // SASSTODO: This file needs to be rewritten + @import 'application/jobs/index'; // SASSTODO: This collection of sass files has multiple problems + @import 'application/overview/index'; + @import 'application/settings/index'; + @import 'application/timeseriesexplorer/index'; // Components - @import 'components/annotations/annotation_description_list/index'; // SASSTODO: This file overwrites EUI directly - @import 'components/anomalies_table/index'; // SASSTODO: This file overwrites EUI directly - @import 'components/chart_tooltip/index'; - @import 'components/controls/index'; - @import 'components/entity_cell/index'; - @import 'components/field_title_bar/index'; - @import 'components/field_type_icon/index'; - @import 'components/influencers_list/index'; - @import 'components/items_grid/index'; - @import 'components/job_selector/index'; - @import 'components/loading_indicator/index'; // SASSTODO: This component should be replaced with EuiLoadingSpinner - @import 'components/navigation_menu/index'; - @import 'components/rule_editor/index'; // SASSTODO: This file overwrites EUI directly - @import 'components/stats_bar/index'; + @import 'application/components/annotations/annotation_description_list/index'; // SASSTODO: This file overwrites EUI directly + @import 'application/components/anomalies_table/index'; // SASSTODO: This file overwrites EUI directly + @import 'application/components/chart_tooltip/index'; + @import 'application/components/controls/index'; + @import 'application/components/entity_cell/index'; + @import 'application/components/field_title_bar/index'; + @import 'application/components/field_type_icon/index'; + @import 'application/components/influencers_list/index'; + @import 'application/components/items_grid/index'; + @import 'application/components/job_selector/index'; + @import 'application/components/loading_indicator/index'; // SASSTODO: This component should be replaced with EuiLoadingSpinner + @import 'application/components/navigation_menu/index'; + @import 'application/components/rule_editor/index'; // SASSTODO: This file overwrites EUI directly + @import 'application/components/stats_bar/index'; // Hacks are last so they can overwrite anything above if needed - @import 'hacks'; + @import 'application/hacks'; } diff --git a/x-pack/legacy/plugins/ml/public/management/_index.scss b/x-pack/legacy/plugins/ml/public/management/_index.scss deleted file mode 100644 index d527197a5c2c63..00000000000000 --- a/x-pack/legacy/plugins/ml/public/management/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import './jobs_list/index'; diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/_index.scss b/x-pack/legacy/plugins/ml/public/management/jobs_list/_index.scss deleted file mode 100644 index 192091fb04e3c9..00000000000000 --- a/x-pack/legacy/plugins/ml/public/management/jobs_list/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import './components/index'; diff --git a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/_index.scss b/x-pack/legacy/plugins/ml/public/management/jobs_list/components/_index.scss deleted file mode 100644 index 883ecd96745b42..00000000000000 --- a/x-pack/legacy/plugins/ml/public/management/jobs_list/components/_index.scss +++ /dev/null @@ -1,4 +0,0 @@ -@import './jobs_list_page/stats_bar'; -@import './jobs_list_page/buttons'; -@import './jobs_list_page/expanded_row'; -@import './jobs_list_page/analytics_table'; diff --git a/x-pack/legacy/plugins/ml/public/overview/_index.scss b/x-pack/legacy/plugins/ml/public/overview/_index.scss deleted file mode 100644 index 192091fb04e3c9..00000000000000 --- a/x-pack/legacy/plugins/ml/public/overview/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import './components/index'; diff --git a/x-pack/legacy/plugins/ml/public/services/http_service.js b/x-pack/legacy/plugins/ml/public/services/http_service.js deleted file mode 100644 index f0bef4396e4f3e..00000000000000 --- a/x-pack/legacy/plugins/ml/public/services/http_service.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - - - -// service for interacting with the server - -import chrome from 'ui/chrome'; - -import { addSystemApiHeader } from 'ui/system_api'; - -export function http(options) { - return new Promise((resolve, reject) => { - if(options && options.url) { - let url = ''; - url = url + (options.url || ''); - const headers = addSystemApiHeader({ - 'Content-Type': 'application/json', - 'kbn-version': chrome.getXsrfToken(), - ...options.headers - }); - - const allHeaders = (options.headers === undefined) ? headers : { ...options.headers, ...headers }; - const body = (options.data === undefined) ? null : JSON.stringify(options.data); - - const payload = { - method: (options.method || 'GET'), - headers: allHeaders, - credentials: 'same-origin' - }; - - if (body !== null) { - payload.body = body; - } - - fetch(url, payload) - .then((resp) => { - resp.json().then((resp.ok === true) ? resolve : reject); - }) - .catch((resp) => { - reject(resp); - }); - } else { - reject(); - } - }); -} diff --git a/x-pack/legacy/plugins/ml/public/services/results_service.d.ts b/x-pack/legacy/plugins/ml/public/services/results_service.d.ts deleted file mode 100644 index 2bbe37c3fc05d6..00000000000000 --- a/x-pack/legacy/plugins/ml/public/services/results_service.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -type time = string; -export interface ModelPlotOutputResults { - results: Record; -} - -declare interface MlResultsService { - getScoresByBucket: ( - jobIds: string[], - earliestMs: number, - latestMs: number, - interval: string | number, - maxResults: number - ) => Promise; - getScheduledEventsByBucket: () => Promise; - getTopInfluencers: () => Promise; - getTopInfluencerValues: () => Promise; - getOverallBucketScores: ( - jobIds: any, - topN: any, - earliestMs: any, - latestMs: any, - interval?: any - ) => Promise; - getInfluencerValueMaxScoreByTime: () => Promise; - getRecordInfluencers: () => Promise; - getRecordsForInfluencer: () => Promise; - getRecordsForDetector: () => Promise; - getRecords: () => Promise; - getRecordsForCriteria: () => Promise; - getMetricData: () => Promise; - getEventRateData: ( - index: string, - query: any, - timeFieldName: string, - earliestMs: number, - latestMs: number, - interval: string | number - ) => Promise; - getEventDistributionData: () => Promise; - getModelPlotOutput: ( - jobId: string, - detectorIndex: number, - criteriaFields: string[], - earliestMs: number, - latestMs: number, - interval: string | number, - aggType: { - min: string; - max: string; - } - ) => Promise; - getRecordMaxScoreByTime: () => Promise; -} - -export const mlResultsService: MlResultsService; diff --git a/x-pack/legacy/plugins/siem/package.json b/x-pack/legacy/plugins/siem/package.json index ca5fefe52bcc42..29c26c5f674e38 100644 --- a/x-pack/legacy/plugins/siem/package.json +++ b/x-pack/legacy/plugins/siem/package.json @@ -7,7 +7,7 @@ "scripts": { "build-graphql-types": "node scripts/generate_types_from_graphql.js", "cypress:open": "../../../node_modules/.bin/cypress open", - "cypress:run": "../../../node_modules/.bin/cypress run --spec ./cypress/integration/**/*.spec.ts --reporter ../../../node_modules/cypress-multi-reporters --reporter-options configFile=./reporter_config.json; ../../../node_modules/.bin/mochawesome-merge --reportDir ../../../../target/kibana-siem/cypress/results > ../../../../target/kibana-siem/cypress/results/output.json; ../../../../node_modules/.bin/marge ../../../../target/kibana-siem/cypress/results/output.json --reportDir ../../../../target/kibana-siem/cypress/results; mkdir -p ../../../../target/junit && cp ../../../../target/kibana-siem/cypress/results/*.xml ../../../../target/junit/" + "cypress:run": "../../../node_modules/.bin/cypress run --spec ./cypress/integration/**/*.spec.ts --reporter ../../../node_modules/cypress-multi-reporters --reporter-options configFile=./reporter_config.json; status=$?; ../../../node_modules/.bin/mochawesome-merge --reportDir ../../../../target/kibana-siem/cypress/results > ../../../../target/kibana-siem/cypress/results/output.json; ../../../../node_modules/.bin/marge ../../../../target/kibana-siem/cypress/results/output.json --reportDir ../../../../target/kibana-siem/cypress/results; mkdir -p ../../../../target/junit && cp ../../../../target/kibana-siem/cypress/results/*.xml ../../../../target/junit/ && exit $status;" }, "devDependencies": { "@types/lodash": "^4.14.110", diff --git a/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/index.tsx b/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/index.tsx new file mode 100644 index 00000000000000..2337f2cd7512ac --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/index.tsx @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { MatrixHistogramBasicProps } from '../matrix_histogram/types'; +import { MatrixOverTimeHistogramData } from '../../graphql/types'; +import { MatrixHistogram } from '../matrix_histogram'; +import * as i18n from './translation'; + +export const AnomaliesOverTimeHistogram = ( + props: MatrixHistogramBasicProps +) => { + const dataKey = 'anomaliesOverTime'; + const { totalCount } = props; + const subtitle = `${i18n.SHOWING}: ${totalCount.toLocaleString()} ${i18n.UNIT(totalCount)}`; + const { ...matrixOverTimeProps } = props; + + return ( + + ); +}; diff --git a/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/translation.ts b/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/translation.ts new file mode 100644 index 00000000000000..f28a7176fd09d2 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/components/anomalies_over_time/translation.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const ANOMALIES_COUNT_FREQUENCY_BY_ACTION = i18n.translate( + 'xpack.siem.anomaliesOverTime.anomaliesCountFrequencyByJobTile', + { + defaultMessage: 'Anomalies count by job', + } +); + +export const SHOWING = i18n.translate('xpack.siem.anomaliesOverTime.showing', { + defaultMessage: 'Showing', +}); + +export const UNIT = (totalCount: number) => + i18n.translate('xpack.siem.anomaliesOverTime.unit', { + values: { totalCount }, + defaultMessage: `{totalCount, plural, =1 {anomaly} other {anomalies}}`, + }); diff --git a/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx b/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx index 168cacf3e97e12..53365a4daa34a4 100644 --- a/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/header_global/index.tsx @@ -35,7 +35,7 @@ FlexItem.displayName = 'FlexItem'; interface HeaderGlobalProps { hideDetectionEngine?: boolean; } -export const HeaderGlobal = React.memo(({ hideDetectionEngine = true }) => ( +export const HeaderGlobal = React.memo(({ hideDetectionEngine = false }) => ( diff --git a/x-pack/legacy/plugins/siem/public/components/header_page/index.tsx b/x-pack/legacy/plugins/siem/public/components/header_page/index.tsx index 4db2a35c600e9c..9877372ff9f41f 100644 --- a/x-pack/legacy/plugins/siem/public/components/header_page/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/header_page/index.tsx @@ -4,7 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import { EuiBetaBadge, EuiBadge, EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui'; +import { + EuiBetaBadge, + EuiBadge, + EuiFlexGroup, + EuiFlexItem, + EuiProgress, + EuiTitle, +} from '@elastic/eui'; import React from 'react'; import styled, { css } from 'styled-components'; @@ -14,6 +21,7 @@ import { Subtitle, SubtitleProps } from '../subtitle'; interface HeaderProps { border?: boolean; + isLoading?: boolean; } const Header = styled.header.attrs({ @@ -26,6 +34,9 @@ const Header = styled.header.attrs({ css` border-bottom: ${theme.eui.euiBorderThin}; padding-bottom: ${theme.eui.paddingSizes.l}; + .euiProgress { + top: ${theme.eui.paddingSizes.l}; + } `} `} `; @@ -85,6 +96,7 @@ export const HeaderPage = React.memo( border, children, draggableArguments, + isLoading, subtitle, subtitle2, title, @@ -132,6 +144,7 @@ export const HeaderPage = React.memo( {subtitle && } {subtitle2 && } + {border && isLoading && } {children && ( diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network_stats/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network_stats/index.tsx index cee2c18710e74e..8f592c7bbba60b 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network_stats/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network_stats/index.tsx @@ -73,7 +73,7 @@ const overviewNetworkStats = (data: OverviewNetworkData) => [ title: ( ), id: 'filebeatPanw', diff --git a/x-pack/legacy/plugins/siem/public/components/query_bar/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/query_bar/index.test.tsx index d619b515ccc7a2..ce102d7ade53b4 100644 --- a/x-pack/legacy/plugins/siem/public/components/query_bar/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/query_bar/index.test.tsx @@ -84,6 +84,7 @@ describe('QueryBar ', () => { } = wrapper.find(SearchBar).props(); expect(searchBarProps).toEqual({ + dataTestSubj: undefined, dateRangeFrom: 'now-24h', dateRangeTo: 'now', filters: [], @@ -178,6 +179,7 @@ describe('QueryBar ', () => { title: 'filebeat-*,auditbeat-*,packetbeat-*', }, ], + isLoading: false, isRefreshPaused: true, query: { language: 'kuery', diff --git a/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx b/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx index 8b5f3b0f4d4258..3f460560b79b58 100644 --- a/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/query_bar/index.tsx @@ -25,6 +25,7 @@ export interface QueryBarComponentProps { dateRangeTo?: string; hideSavedQuery?: boolean; indexPattern: StaticIndexPattern; + isLoading?: boolean; isRefreshPaused?: boolean; filterQuery: Query; filterManager: FilterManager; @@ -42,6 +43,7 @@ export const QueryBar = memo( dateRangeTo, hideSavedQuery = false, indexPattern, + isLoading = false, isRefreshPaused, filterQuery, filterManager, @@ -125,6 +127,7 @@ export const QueryBar = memo( dateRangeTo={dateRangeTo} filters={filters} indexPatterns={indexPatterns} + isLoading={isLoading} isRefreshPaused={isRefreshPaused} query={draftQuery} onClearSavedQuery={onClearSavedQuery} diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/anomalies_over_time.gql_query.ts b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/anomalies_over_time.gql_query.ts new file mode 100644 index 00000000000000..498cdaec131e86 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/anomalies_over_time.gql_query.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import gql from 'graphql-tag'; + +export const AnomaliesOverTimeGqlQuery = gql` + query GetAnomaliesOverTimeQuery( + $sourceId: ID! + $timerange: TimerangeInput! + $defaultIndex: [String!]! + $filterQuery: String + $inspect: Boolean! + ) { + source(id: $sourceId) { + id + AnomaliesOverTime( + timerange: $timerange + filterQuery: $filterQuery + defaultIndex: $defaultIndex + ) { + anomaliesOverTime { + x + y + g + } + totalCount + inspect @include(if: $inspect) { + dsl + response + } + } + } + } +`; diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/index.tsx b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/index.tsx new file mode 100644 index 00000000000000..0d1ffba1ecd824 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/index.tsx @@ -0,0 +1,86 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { getOr } from 'lodash/fp'; +import React from 'react'; +import { Query } from 'react-apollo'; +import { connect } from 'react-redux'; + +import { State, inputsSelectors } from '../../../store'; +import { getDefaultFetchPolicy } from '../../helpers'; +import { QueryTemplate } from '../../query_template'; + +import { AnomaliesOverTimeGqlQuery } from './anomalies_over_time.gql_query'; +import { GetAnomaliesOverTimeQuery } from '../../../graphql/types'; +import { AnomaliesOverTimeProps, OwnProps } from './types'; + +const ID = 'anomaliesOverTimeQuery'; + +class AnomaliesOverTimeComponentQuery extends QueryTemplate< + AnomaliesOverTimeProps, + GetAnomaliesOverTimeQuery.Query, + GetAnomaliesOverTimeQuery.Variables +> { + public render() { + const { + children, + endDate, + filterQuery, + id = ID, + isInspected, + sourceId, + startDate, + } = this.props; + + return ( + + query={AnomaliesOverTimeGqlQuery} + fetchPolicy={getDefaultFetchPolicy()} + notifyOnNetworkStatusChange + variables={{ + filterQuery, + sourceId, + timerange: { + interval: 'day', + from: startDate!, + to: endDate!, + }, + defaultIndex: ['.ml-anomalies-*'], + inspect: isInspected, + }} + > + {({ data, loading, refetch }) => { + const source = getOr({}, `source.AnomaliesOverTime`, data); + const anomaliesOverTime = getOr([], `anomaliesOverTime`, source); + const totalCount = getOr(-1, 'totalCount', source); + return children!({ + endDate: endDate!, + anomaliesOverTime, + id, + inspect: getOr(null, 'inspect', source), + loading, + refetch, + startDate: startDate!, + totalCount, + }); + }} + + ); + } +} + +const makeMapStateToProps = () => { + const getQuery = inputsSelectors.globalQueryByIdSelector(); + const mapStateToProps = (state: State, { id = ID }: OwnProps) => { + const { isInspected } = getQuery(state, id); + return { + isInspected, + }; + }; + return mapStateToProps; +}; + +export const AnomaliesOverTimeQuery = connect(makeMapStateToProps)(AnomaliesOverTimeComponentQuery); diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/types.ts b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/types.ts new file mode 100644 index 00000000000000..e6ece4a46e44f1 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_over_time/types.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { QueryTemplateProps } from '../../query_template'; +import { inputsModel, hostsModel, networkModel } from '../../../store'; +import { MatrixOverTimeHistogramData } from '../../../graphql/types'; + +export interface AnomaliesArgs { + endDate: number; + anomaliesOverTime: MatrixOverTimeHistogramData[]; + id: string; + inspect: inputsModel.InspectQuery; + loading: boolean; + refetch: inputsModel.Refetch; + startDate: number; + totalCount: number; +} + +export interface OwnProps extends Omit { + filterQuery?: string; + children?: (args: AnomaliesArgs) => React.ReactNode; + type: hostsModel.HostsType | networkModel.NetworkType; +} + +export interface AnomaliesOverTimeComponentReduxProps { + isInspected: boolean; +} + +export type AnomaliesOverTimeProps = OwnProps & AnomaliesOverTimeComponentReduxProps; diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/index.tsx b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/index.tsx new file mode 100644 index 00000000000000..917f4dbcc211bb --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/index.tsx @@ -0,0 +1,93 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { EuiSpacer } from '@elastic/eui'; +import { AnomaliesQueryTabBodyProps } from './types'; +import { manageQuery } from '../../../components/page/manage_query'; +import { AnomaliesOverTimeHistogram } from '../../../components/anomalies_over_time'; +import { AnomaliesOverTimeQuery } from '../anomalies_over_time'; +import { getAnomaliesFilterQuery } from './utils'; +import { useSiemJobs } from '../../../components/ml_popover/hooks/use_siem_jobs'; +import { useKibanaUiSetting } from '../../../lib/settings/use_kibana_ui_setting'; +import { DEFAULT_ANOMALY_SCORE } from '../../../../common/constants'; + +const AnomaliesOverTimeManage = manageQuery(AnomaliesOverTimeHistogram); + +export const AnomaliesQueryTabBody = ({ + endDate, + skip, + startDate, + type, + narrowDateRange, + filterQuery, + anomaliesFilterQuery, + setQuery, + hideHistogramIfEmpty, + updateDateRange = () => {}, + AnomaliesTableComponent, + flowTarget, + ip, +}: AnomaliesQueryTabBodyProps) => { + const [siemJobsLoading, siemJobs] = useSiemJobs(true); + const [anomalyScore] = useKibanaUiSetting(DEFAULT_ANOMALY_SCORE); + + const mergedFilterQuery = getAnomaliesFilterQuery( + filterQuery, + anomaliesFilterQuery, + siemJobs, + anomalyScore, + flowTarget, + ip + ); + + return ( + <> + + {({ anomaliesOverTime, loading, id, inspect, refetch, totalCount }) => { + if (hideHistogramIfEmpty && !anomaliesOverTime.length) { + return
; + } + + return ( + <> + + + + ); + }} + + + + ); +}; + +AnomaliesQueryTabBody.displayName = 'AnomaliesQueryTabBody'; diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/types.ts b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/types.ts new file mode 100644 index 00000000000000..0aef02ddd929a8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/types.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ESTermQuery } from '../../../../common/typed_json'; +import { NarrowDateRange } from '../../../components/ml/types'; +import { UpdateDateRange } from '../../../components/charts/common'; +import { SetQuery } from '../../../pages/hosts/navigation/types'; +import { FlowTarget } from '../../../graphql/types'; +import { HostsType } from '../../../store/hosts/model'; +import { NetworkType } from '../../../store/network/model'; +import { AnomaliesHostTable } from '../../../components/ml/tables/anomalies_host_table'; +import { AnomaliesNetworkTable } from '../../../components/ml/tables/anomalies_network_table'; + +interface QueryTabBodyProps { + type: HostsType | NetworkType; + filterQuery?: string | ESTermQuery; +} + +export type AnomaliesQueryTabBodyProps = QueryTabBodyProps & { + startDate: number; + endDate: number; + skip: boolean; + setQuery: SetQuery; + narrowDateRange: NarrowDateRange; + updateDateRange?: UpdateDateRange; + anomaliesFilterQuery?: object; + hideHistogramIfEmpty?: boolean; + ip?: string; + flowTarget?: FlowTarget; + AnomaliesTableComponent: typeof AnomaliesHostTable | typeof AnomaliesNetworkTable; +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/utils.ts b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/utils.ts new file mode 100644 index 00000000000000..9609619916ab15 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/anomalies/anomalies_query_tab_body/utils.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import deepmerge from 'deepmerge'; +import { createFilter } from '../../helpers'; +import { ESTermQuery } from '../../../../common/typed_json'; +import { SiemJob } from '../../../components/ml_popover/types'; +import { FlowTarget } from '../../../graphql/types'; + +export const getAnomaliesFilterQuery = ( + filterQuery: string | ESTermQuery | undefined, + anomaliesFilterQuery: object = {}, + siemJobs: SiemJob[] = [], + anomalyScore: number, + flowTarget?: FlowTarget, + ip?: string +): string => { + const siemJobIds = siemJobs + .filter(job => job.isInstalled) + .map(job => job.id) + .map(jobId => ({ + match_phrase: { + job_id: jobId, + }, + })); + + const filterQueryString = createFilter(filterQuery); + const filterQueryObject = filterQueryString ? JSON.parse(filterQueryString) : {}; + const mergedFilterQuery = deepmerge.all([ + filterQueryObject, + anomaliesFilterQuery, + { + bool: { + filter: [ + { + bool: { + should: siemJobIds, + minimum_should_match: 1, + }, + }, + { + match_phrase: { + result_type: 'record', + }, + }, + flowTarget && + ip && { + match_phrase: { + [`${flowTarget}.ip`]: ip, + }, + }, + { + range: { + record_score: { + gte: anomalyScore, + }, + }, + }, + ], + }, + }, + ]); + + return JSON.stringify(mergedFilterQuery); +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts index 333baefe034fdb..798cf91612a856 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/api.ts @@ -6,15 +6,40 @@ import chrome from 'ui/chrome'; import { + AddRulesProps, DeleteRulesProps, DuplicateRulesProps, EnableRulesProps, FetchRulesProps, FetchRulesResponse, + NewRule, Rule, } from './types'; import { throwIfNotOk } from '../../../hooks/api/api'; +/** + * Add provided Rule + * + * @param rule to add + * @param kbnVersion current Kibana Version to use for headers + */ +export const addRule = async ({ rule, kbnVersion, signal }: AddRulesProps): Promise => { + const response = await fetch(`${chrome.getBasePath()}/api/detection_engine/rules`, { + method: 'POST', + credentials: 'same-origin', + headers: { + 'content-type': 'application/json', + 'kbn-version': kbnVersion, + 'kbn-xsrf': kbnVersion, + }, + body: JSON.stringify(rule), + signal, + }); + + await throwIfNotOk(response); + return response.json(); +}; + /** * Fetches all rules or single specified rule from the Detection Engine API * @@ -55,12 +80,6 @@ export const fetchRules = async ({ const response = await fetch(endpoint, { method: 'GET', - credentials: 'same-origin', - headers: { - 'content-type': 'application/json', - 'kbn-version': kbnVersion, - 'kbn-xsrf': kbnVersion, - }, signal, }); await throwIfNotOk(response); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx new file mode 100644 index 00000000000000..dbc148a96365d2 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/fetch_index_patterns.tsx @@ -0,0 +1,84 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { isEmpty, get } from 'lodash/fp'; +import { useEffect, useState, Dispatch, SetStateAction } from 'react'; +import { StaticIndexPattern } from 'ui/index_patterns'; + +import { getIndexFields, sourceQuery } from '../../../containers/source'; +import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; +import { SourceQuery } from '../../../graphql/types'; +import { useApolloClient } from '../../../utils/apollo_context'; + +import * as i18n from './translations'; + +interface FetchIndexPattern { + isLoading: boolean; + indices: string[]; + indicesExists: boolean; + indexPatterns: StaticIndexPattern | null; +} + +type Return = [FetchIndexPattern, Dispatch>]; + +export const useFetchIndexPatterns = (): Return => { + const apolloClient = useApolloClient(); + const [indices, setIndices] = useState([]); + const [indicesExists, setIndicesExists] = useState(false); + const [indexPatterns, setIndexPatterns] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const [, dispatchToaster] = useStateToaster(); + + useEffect(() => { + let isSubscribed = true; + const abortCtrl = new AbortController(); + + async function fetchIndexPatterns() { + if (apolloClient && !isEmpty(indices)) { + setIsLoading(true); + apolloClient + .query({ + query: sourceQuery, + fetchPolicy: 'cache-first', + variables: { + sourceId: 'default', + defaultIndex: indices, + }, + context: { + fetchOptions: { + signal: abortCtrl.signal, + }, + }, + }) + .then( + result => { + if (isSubscribed) { + setIsLoading(false); + setIndicesExists(get('data.source.status.indicesExist', result)); + setIndexPatterns( + getIndexFields(indices.join(), get('data.source.status.indexFields', result)) + ); + } + }, + error => { + if (isSubscribed) { + setIsLoading(false); + errorToToaster({ title: i18n.RULE_ADD_FAILURE, error, dispatchToaster }); + } + } + ); + } + } + fetchIndexPatterns(); + return () => { + isSubscribed = false; + abortCtrl.abort(); + }; + }, [indices]); + + return [{ isLoading, indices, indicesExists, indexPatterns }, setIndices]; +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx new file mode 100644 index 00000000000000..371d28aebf7f7b --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/persist_rule.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useEffect, useState, Dispatch } from 'react'; + +import { useKibanaUiSetting } from '../../../lib/settings/use_kibana_ui_setting'; +import { DEFAULT_KBN_VERSION } from '../../../../common/constants'; +import { useStateToaster } from '../../../components/toasters'; +import { errorToToaster } from '../../../components/ml/api/error_to_toaster'; + +import { addRule as persistRule } from './api'; +import * as i18n from './translations'; +import { NewRule } from './types'; + +interface PersistRuleReturn { + isLoading: boolean; + isSaved: boolean; +} + +type Return = [PersistRuleReturn, Dispatch]; + +export const usePersistRule = (): Return => { + const [rule, setRule] = useState(null); + const [isSaved, setIsSaved] = useState(false); + const [isLoading, setIsLoading] = useState(false); + const [kbnVersion] = useKibanaUiSetting(DEFAULT_KBN_VERSION); + const [, dispatchToaster] = useStateToaster(); + + useEffect(() => { + let isSubscribed = true; + const abortCtrl = new AbortController(); + setIsSaved(false); + async function saveRule() { + if (rule != null) { + try { + setIsLoading(true); + await persistRule({ rule, kbnVersion, signal: abortCtrl.signal }); + + if (isSubscribed) { + setIsSaved(true); + } + } catch (error) { + if (isSubscribed) { + errorToToaster({ title: i18n.RULE_ADD_FAILURE, error, dispatchToaster }); + } + } + if (isSubscribed) { + setIsLoading(false); + } + } + } + + saveRule(); + return () => { + isSubscribed = false; + abortCtrl.abort(); + }; + }, [rule]); + + return [{ isLoading, isSaved }, setRule]; +}; diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/translations.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/translations.ts index a1ea2afb822f9b..39efbde2ad5c24 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/translations.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/translations.ts @@ -9,3 +9,10 @@ import { i18n } from '@kbn/i18n'; export const RULE_FETCH_FAILURE = i18n.translate('xpack.siem.containers.detectionEngine.rules', { defaultMessage: 'Failed to fetch Rules', }); + +export const RULE_ADD_FAILURE = i18n.translate( + 'xpack.siem.containers.detectionEngine.addRuleFailDescription', + { + defaultMessage: 'Failed to add Rule', + } +); diff --git a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts index afb0158fea677f..fe6fb04800adc3 100644 --- a/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts +++ b/x-pack/legacy/plugins/siem/public/containers/detection_engine/rules/types.ts @@ -6,6 +6,41 @@ import * as t from 'io-ts'; +export const NewRuleSchema = t.intersection([ + t.type({ + description: t.string, + enabled: t.boolean, + index: t.array(t.string), + interval: t.string, + language: t.string, + name: t.string, + query: t.string, + severity: t.string, + type: t.union([t.literal('query'), t.literal('saved_query')]), + }), + t.partial({ + created_by: t.string, + false_positives: t.array(t.string), + from: t.string, + id: t.string, + max_signals: t.number, + references: t.array(t.string), + rule_id: t.string, + tags: t.array(t.string), + to: t.string, + updated_by: t.string, + }), +]); + +export const NewRulesSchema = t.array(NewRuleSchema); +export type NewRule = t.TypeOf; + +export interface AddRulesProps { + rule: NewRule; + kbnVersion: string; + signal: AbortSignal; +} + export const RuleSchema = t.intersection([ t.type({ created_by: t.string, diff --git a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx index ff6e5e4d0c788e..bc7b87cda6af9c 100644 --- a/x-pack/legacy/plugins/siem/public/containers/source/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/source/index.tsx @@ -7,7 +7,7 @@ import { isUndefined } from 'lodash'; import { get, keyBy, pick, set } from 'lodash/fp'; import { Query } from 'react-apollo'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; import memoizeOne from 'memoize-one'; import { StaticIndexPattern } from 'ui/index_patterns'; import chrome from 'ui/chrome'; @@ -16,6 +16,9 @@ import { DEFAULT_INDEX_KEY } from '../../../common/constants'; import { IndexField, SourceQuery } from '../../graphql/types'; import { sourceQuery } from './index.gql_query'; +import { useApolloClient } from '../../utils/apollo_context'; + +export { sourceQuery }; export interface BrowserField { aggregatable: boolean; @@ -57,7 +60,7 @@ interface WithSourceProps { sourceId: string; } -const getIndexFields = memoizeOne( +export const getIndexFields = memoizeOne( (title: string, fields: IndexField[]): StaticIndexPattern => fields && fields.length > 0 ? { @@ -110,3 +113,56 @@ WithSource.displayName = 'WithSource'; export const indicesExistOrDataTemporarilyUnavailable = (indicesExist: boolean | undefined) => indicesExist || isUndefined(indicesExist); + +export const useWithSource = (sourceId: string, indices: string[]) => { + const [loading, updateLoading] = useState(false); + const [indicesExist, setIndicesExist] = useState(undefined); + const [browserFields, setBrowserFields] = useState(null); + const [indexPattern, setIndexPattern] = useState(null); + const [errorMessage, updateErrorMessage] = useState(null); + + const apolloClient = useApolloClient(); + async function fetchSource(signal: AbortSignal) { + updateLoading(true); + if (apolloClient) { + apolloClient + .query({ + query: sourceQuery, + fetchPolicy: 'cache-first', + variables: { + sourceId, + defaultIndex: indices, + }, + context: { + fetchOptions: { + signal, + }, + }, + }) + .then( + result => { + updateLoading(false); + updateErrorMessage(null); + setIndicesExist(get('data.source.status.indicesExist', result)); + setBrowserFields(getBrowserFields(get('data.source.status.indexFields', result))); + setIndexPattern( + getIndexFields(indices.join(), get('data.source.status.indexFields', result)) + ); + }, + error => { + updateLoading(false); + updateErrorMessage(error.message); + } + ); + } + } + + useEffect(() => { + const abortCtrl = new AbortController(); + const signal = abortCtrl.signal; + fetchSource(signal); + return () => abortCtrl.abort(); + }, [apolloClient, sourceId, indices]); + + return { indicesExist, browserFields, indexPattern, loading, errorMessage }; +}; diff --git a/x-pack/legacy/plugins/siem/public/graphql/introspection.json b/x-pack/legacy/plugins/siem/public/graphql/introspection.json index a93168c835293a..7c173a9a90626b 100644 --- a/x-pack/legacy/plugins/siem/public/graphql/introspection.json +++ b/x-pack/legacy/plugins/siem/public/graphql/introspection.json @@ -666,6 +666,53 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "AnomaliesOverTime", + "description": "", + "args": [ + { + "name": "timerange", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "INPUT_OBJECT", "name": "TimerangeInput", "ofType": null } + }, + "defaultValue": null + }, + { + "name": "filterQuery", + "description": "", + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, + "defaultValue": null + }, + { + "name": "defaultIndex", + "description": "", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "OBJECT", "name": "AnomaliesOverTimeData", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "Authentications", "description": "Gets Authentication success and failures based on a timerange", @@ -2491,6 +2538,159 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "AnomaliesOverTimeData", + "description": "", + "fields": [ + { + "name": "inspect", + "description": "", + "args": [], + "type": { "kind": "OBJECT", "name": "Inspect", "ofType": null }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "anomaliesOverTime", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MatrixOverTimeHistogramData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Inspect", + "description": "", + "fields": [ + { + "name": "dsl", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "response", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MatrixOverTimeHistogramData", + "description": "", + "fields": [ + { + "name": "x", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "y", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "g", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "INPUT_OBJECT", "name": "PaginationInputPaginated", @@ -3200,57 +3400,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "Inspect", - "description": "", - "fields": [ - { - "name": "dsl", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "response", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "OBJECT", "name": "AuthenticationsOverTimeData", @@ -3306,53 +3455,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "MatrixOverTimeHistogramData", - "description": "", - "fields": [ - { - "name": "x", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "y", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "Float", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "g", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "INPUT_OBJECT", "name": "PaginationInput", diff --git a/x-pack/legacy/plugins/siem/public/graphql/types.ts b/x-pack/legacy/plugins/siem/public/graphql/types.ts index ad05e42bcd859c..1464b556480351 100644 --- a/x-pack/legacy/plugins/siem/public/graphql/types.ts +++ b/x-pack/legacy/plugins/siem/public/graphql/types.ts @@ -456,6 +456,8 @@ export interface Source { configuration: SourceConfiguration; /** The status of the source */ status: SourceStatus; + + AnomaliesOverTime: AnomaliesOverTimeData; /** Gets Authentication success and failures based on a timerange */ Authentications: AuthenticationsData; @@ -556,6 +558,28 @@ export interface IndexField { format?: Maybe; } +export interface AnomaliesOverTimeData { + inspect?: Maybe; + + anomaliesOverTime: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface Inspect { + dsl: string[]; + + response: string[]; +} + +export interface MatrixOverTimeHistogramData { + x: number; + + y: number; + + g: string; +} + export interface AuthenticationsData { edges: AuthenticationsEdges[]; @@ -690,12 +714,6 @@ export interface PageInfoPaginated { showMorePagesIndicator: boolean; } -export interface Inspect { - dsl: string[]; - - response: string[]; -} - export interface AuthenticationsOverTimeData { inspect?: Maybe; @@ -704,14 +722,6 @@ export interface AuthenticationsOverTimeData { totalCount: number; } -export interface MatrixOverTimeHistogramData { - x: number; - - y: number; - - g: string; -} - export interface TimelineData { edges: TimelineEdges[]; @@ -2127,6 +2137,13 @@ export interface GetAllTimelineQueryArgs { onlyUserFavorite?: Maybe; } +export interface AnomaliesOverTimeSourceArgs { + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} export interface AuthenticationsSourceArgs { timerange: TimerangeInput; @@ -2421,6 +2438,58 @@ export interface DeleteTimelineMutationArgs { // Documents // ==================================================== +export namespace GetAnomaliesOverTimeQuery { + export type Variables = { + sourceId: string; + timerange: TimerangeInput; + defaultIndex: string[]; + filterQuery?: Maybe; + inspect: boolean; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'Source'; + + id: string; + + AnomaliesOverTime: AnomaliesOverTime; + }; + + export type AnomaliesOverTime = { + __typename?: 'AnomaliesOverTimeData'; + + anomaliesOverTime: _AnomaliesOverTime[]; + + totalCount: number; + + inspect: Maybe; + }; + + export type _AnomaliesOverTime = { + __typename?: 'MatrixOverTimeHistogramData'; + + x: number; + + y: number; + + g: string; + }; + + export type Inspect = { + __typename?: 'Inspect'; + + dsl: string[]; + + response: string[]; + }; +} + export namespace GetAuthenticationsOverTimeQuery { export type Variables = { sourceId: string; diff --git a/x-pack/legacy/plugins/siem/public/lib/theme/use_eui_theme.tsx b/x-pack/legacy/plugins/siem/public/lib/theme/use_eui_theme.tsx new file mode 100644 index 00000000000000..b1defcb34066d8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/lib/theme/use_eui_theme.tsx @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import darkTheme from '@elastic/eui/dist/eui_theme_dark.json'; +import lightTheme from '@elastic/eui/dist/eui_theme_light.json'; + +import { DEFAULT_DARK_MODE } from '../../../common/constants'; +import { useKibanaUiSetting } from '../settings/use_kibana_ui_setting'; + +export const useEuiTheme = () => { + const [darkMode] = useKibanaUiSetting(DEFAULT_DARK_MODE); + return darkMode ? darkTheme : lightTheme; +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/accordion_title/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/accordion_title/index.tsx new file mode 100644 index 00000000000000..66353a9613650a --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/accordion_title/index.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui'; +import React, { memo } from 'react'; + +import { RuleStatusIcon, RuleStatusIconProps } from '../status_icon'; + +interface AccordionTitleProps extends RuleStatusIconProps { + title: string; +} + +export const AccordionTitle = memo(({ name, title, type }) => ( + + + + + + +
{title}
+
+
+
+)); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/index.tsx new file mode 100644 index 00000000000000..6673262a159062 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/index.tsx @@ -0,0 +1,129 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiButtonEmpty, EuiButtonIcon, EuiFormRow, EuiFieldText, EuiSpacer } from '@elastic/eui'; +import { isEmpty, isEqual } from 'lodash/fp'; +import React, { ChangeEvent, useCallback, useEffect, useState, useRef } from 'react'; + +import { FieldHook, getFieldValidityAndErrorMessage } from '../shared_imports'; +import * as I18n from './translations'; + +interface AddItemProps { + addText: string; + field: FieldHook; + dataTestSubj: string; + idAria: string; + isDisabled: boolean; +} + +export const AddItem = ({ addText, dataTestSubj, field, idAria, isDisabled }: AddItemProps) => { + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + const [items, setItems] = useState(['']); + const [haveBeenKeyboardDeleted, setHaveBeenKeyboardDeleted] = useState(false); + + const lastInputRef = useRef(null); + + const removeItem = useCallback( + (index: number) => { + const values = field.value as string[]; + field.setValue([...values.slice(0, index), ...values.slice(index + 1)]); + }, + [field] + ); + + const addItem = useCallback(() => { + const values = field.value as string[]; + if (!isEmpty(values[values.length - 1])) { + field.setValue([...values, '']); + } + }, [field]); + + const updateItem = useCallback( + (event: ChangeEvent, index: number) => { + const values = field.value as string[]; + const value = event.target.value; + if (isEmpty(value)) { + setHaveBeenKeyboardDeleted(true); + field.setValue([...values.slice(0, index), ...values.slice(index + 1)]); + } else { + field.setValue([...values.slice(0, index), value, ...values.slice(index + 1)]); + } + }, + [field] + ); + + const handleLastInputRef = useCallback( + (element: HTMLInputElement | null) => { + lastInputRef.current = element; + }, + [lastInputRef] + ); + + useEffect(() => { + if (!isEqual(field.value, items)) { + setItems( + isEmpty(field.value) + ? [''] + : haveBeenKeyboardDeleted + ? [...(field.value as string[]), ''] + : (field.value as string[]) + ); + setHaveBeenKeyboardDeleted(false); + } + }, [field.value]); + + useEffect(() => { + if (!haveBeenKeyboardDeleted && lastInputRef != null && lastInputRef.current != null) { + lastInputRef.current.focus(); + } + }, [haveBeenKeyboardDeleted, lastInputRef]); + + return ( + + <> + {items.map((item, index) => { + const euiFieldProps = { + disabled: isDisabled, + ...(index === items.length - 1 ? { inputRef: handleLastInputRef } : {}), + }; + return ( +
+ removeItem(index)} + aria-label={I18n.DELETE} + /> + } + value={item} + onChange={e => updateItem(e, index)} + compressed + fullWidth + {...euiFieldProps} + /> + {items.length - 1 !== index && } +
+ ); + })} + + + {addText} + + +
+ ); +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/translations.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/translations.ts new file mode 100644 index 00000000000000..98c15606d88fe4 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/add_item_form/translations.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const DELETE = i18n.translate( + 'xpack.siem.detectionEngine.createRule.addItem.deleteDescription', + { + defaultMessage: 'Delete', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx new file mode 100644 index 00000000000000..4e7832c890255b --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/query_bar/index.tsx @@ -0,0 +1,193 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFormRow } from '@elastic/eui'; +import { isEqual } from 'lodash/fp'; +import React, { useCallback, useEffect, useState } from 'react'; +import { StaticIndexPattern } from 'ui/index_patterns'; +import { Subscription } from 'rxjs'; +import styled from 'styled-components'; + +import { SavedQueryTimeFilter } from '../../../../../../../../../../src/legacy/core_plugins/data/public/search'; +import { SavedQuery } from '../../../../../../../../../../src/legacy/core_plugins/data/public'; +import { + esFilters, + Query, + FilterManager, +} from '../../../../../../../../../../src/plugins/data/public'; + +import { QueryBar } from '../../../../../components/query_bar'; +import { useKibanaCore } from '../../../../../lib/compose/kibana_core'; +import { useSavedQueryServices } from '../../../../../utils/saved_query_services'; + +import { FieldHook, getFieldValidityAndErrorMessage } from '../shared_imports'; + +export interface FieldValueQueryBar { + filters: esFilters.Filter[]; + query: Query; + saved_id: string; +} +interface QueryBarDefineRuleProps { + dataTestSubj: string; + field: FieldHook; + idAria: string; + isLoading: boolean; + indexPattern: StaticIndexPattern; +} + +const StyledEuiFormRow = styled(EuiFormRow)` + .kbnTypeahead__items { + max-height: 14vh !important; + } + .globalQueryBar { + padding: 4px 0px 0px 0px; + .kbnQueryBar { + & > div:first-child { + margin: 0px 0px 0px 4px; + } + } + } +`; + +// TODO need to add disabled in the SearchBar + +export const QueryBarDefineRule = ({ + dataTestSubj, + field, + idAria, + indexPattern, + isLoading = false, +}: QueryBarDefineRuleProps) => { + const [savedQuery, setSavedQuery] = useState(null); + const [queryDraft, setQueryDraft] = useState({ query: '', language: 'kuery' }); + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + + const core = useKibanaCore(); + const [filterManager] = useState(new FilterManager(core.uiSettings)); + + const savedQueryServices = useSavedQueryServices(); + + useEffect(() => { + let isSubscribed = true; + const subscriptions = new Subscription(); + filterManager.setFilters([]); + + subscriptions.add( + filterManager.getUpdates$().subscribe({ + next: () => { + if (isSubscribed) { + const newFilters = filterManager.getFilters(); + const { filters } = field.value as FieldValueQueryBar; + + if (!isEqual(filters, newFilters)) { + field.setValue({ ...(field.value as FieldValueQueryBar), filters: newFilters }); + } + } + }, + }) + ); + + return () => { + isSubscribed = false; + subscriptions.unsubscribe(); + }; + }, [field.value]); + + useEffect(() => { + let isSubscribed = true; + async function updateFilterQueryFromValue() { + const { filters, query, saved_id: savedId } = field.value as FieldValueQueryBar; + if (!isEqual(query, queryDraft)) { + setQueryDraft(query); + } + if (!isEqual(filters, filterManager.getFilters())) { + filterManager.setFilters(filters); + } + if ( + (savedId != null && savedQuery != null && savedId !== savedQuery.id) || + (savedId != null && savedQuery == null) + ) { + try { + const mySavedQuery = await savedQueryServices.getSavedQuery(savedId); + if (isSubscribed && mySavedQuery != null) { + setSavedQuery(mySavedQuery); + } + } catch { + setSavedQuery(null); + } + } else if (savedId == null && savedQuery != null) { + setSavedQuery(null); + } + } + updateFilterQueryFromValue(); + return () => { + isSubscribed = false; + }; + }, [field.value]); + + const onSubmitQuery = useCallback( + (newQuery: Query, timefilter?: SavedQueryTimeFilter) => { + const { query } = field.value as FieldValueQueryBar; + if (!isEqual(query, newQuery)) { + field.setValue({ ...(field.value as FieldValueQueryBar), query: newQuery }); + } + }, + [field] + ); + + const onChangedQuery = useCallback( + (newQuery: Query) => { + const { query } = field.value as FieldValueQueryBar; + if (!isEqual(query, newQuery)) { + field.setValue({ ...(field.value as FieldValueQueryBar), query: newQuery }); + } + }, + [field] + ); + + const onSavedQuery = useCallback( + (newSavedQuery: SavedQuery | null) => { + if (newSavedQuery != null) { + const { saved_id: savedId } = field.value as FieldValueQueryBar; + if (newSavedQuery.id !== savedId) { + setSavedQuery(newSavedQuery); + field.setValue({ + filters: newSavedQuery.attributes.filters, + query: newSavedQuery.attributes.query, + saved_id: newSavedQuery.id, + }); + } + } + }, + [field.value] + ); + + return ( + + + + ); +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/index.tsx new file mode 100644 index 00000000000000..ebb365f6087a92 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/index.tsx @@ -0,0 +1,112 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFieldNumber, EuiFormRow, EuiSelect } from '@elastic/eui'; +import { isEmpty } from 'lodash/fp'; +import React, { useCallback, useEffect, useState } from 'react'; +import styled from 'styled-components'; + +import { FieldHook, getFieldValidityAndErrorMessage } from '../shared_imports'; + +import * as I18n from './translations'; + +interface ScheduleItemProps { + field: FieldHook; + dataTestSubj: string; + idAria: string; + isDisabled: boolean; +} + +const timeTypeOptions = [ + { value: 's', text: I18n.SECONDS }, + { value: 'm', text: I18n.MINUTES }, + { value: 'h', text: I18n.HOURS }, +]; + +const StyledEuiFormRow = styled(EuiFormRow)` + .euiFormControlLayout { + max-width: 200px !important; + } +`; + +export const ScheduleItem = ({ dataTestSubj, field, idAria, isDisabled }: ScheduleItemProps) => { + const [timeType, setTimeType] = useState('s'); + const [timeVal, setTimeVal] = useState(0); + const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field); + + const onChangeTimeType = useCallback(e => { + setTimeType(e.target.value); + }, []); + + const onChangeTimeVal = useCallback(e => { + const sanitizedValue: number = parseInt(e.target.value, 10); + setTimeVal(isNaN(sanitizedValue) ? 0 : sanitizedValue); + }, []); + + useEffect(() => { + if (!isEmpty(timeVal) && Number(timeVal) >= 0 && field.value !== `${timeVal}${timeType}`) { + field.setValue(`${timeVal}${timeType}`); + } + }, [field.value, timeType, timeVal]); + + useEffect(() => { + if (!isEmpty(field.value)) { + const filterTimeVal = (field.value as string).match(/\d+/g); + const filterTimeType = (field.value as string).match(/[a-zA-Z]+/g); + if ( + !isEmpty(filterTimeVal) && + filterTimeVal != null && + !isNaN(Number(filterTimeVal[0])) && + Number(filterTimeVal[0]) !== Number(timeVal) + ) { + setTimeVal(Number(filterTimeVal[0])); + } + if ( + !isEmpty(filterTimeType) && + filterTimeType != null && + ['s', 'm', 'h'].includes(filterTimeType[0]) && + filterTimeType[0] !== timeType + ) { + setTimeType(filterTimeType[0]); + } + } + }, [field.value]); + + // EUI missing some props + const rest = { disabled: isDisabled }; + + return ( + + + } + compressed + fullWidth + min={0} + onChange={onChangeTimeVal} + value={timeVal} + {...rest} + /> + + ); +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/translations.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/translations.ts new file mode 100644 index 00000000000000..1bc983814c330d --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/schedule_item_form/translations.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const SECONDS = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRuleForm.secondsOptionDescription', + { + defaultMessage: 'Seconds', + } +); + +export const MINUTES = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRuleForm.minutesOptionDescription', + { + defaultMessage: 'Minutes', + } +); + +export const HOURS = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRuleForm.hoursOptionDescription', + { + defaultMessage: 'Hours', + } +); + +export const INVALID_TIME = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRuleForm.invalidTimeMessageDescription', + { + defaultMessage: 'A time is required.', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/shared_imports.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/shared_imports.ts new file mode 100644 index 00000000000000..6c91c4a02edf90 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/shared_imports.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { + getUseField, + getFieldValidityAndErrorMessage, + FieldHook, + Form, + FormDataProvider, + UseField, + useForm, +} from '../../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +export { Field } from '../../../../../../../../../src/plugins/es_ui_shared/static/forms/components'; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/status_icon/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/status_icon/index.tsx new file mode 100644 index 00000000000000..ad0011ff8ed188 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/status_icon/index.tsx @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiAvatar, EuiIcon } from '@elastic/eui'; +import React, { memo } from 'react'; +import styled from 'styled-components'; + +import { useEuiTheme } from '../../../../../lib/theme/use_eui_theme'; + +export type RuleStatusType = 'passive' | 'active' | 'valid'; + +export interface RuleStatusIconProps { + name: string; + type: RuleStatusType; +} + +const RuleStatusIconStyled = styled.div` + position: relative; + svg { + position: absolute; + top: 8px; + left: 9px; + } +`; + +export const RuleStatusIcon = memo(({ name, type }) => { + const theme = useEuiTheme(); + const color = type === 'passive' ? theme.euiColorLightestShade : theme.euiColorDarkestShade; + return ( + + + {type === 'valid' ? : null} + + ); +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/data.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/data.ts new file mode 100644 index 00000000000000..7d6e434bcc8c6c --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/data.ts @@ -0,0 +1,28 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as I18n from './translations'; + +export type SeverityValue = 'low' | 'medium' | 'high' | 'critical'; + +interface SeverityOptionItem { + value: SeverityValue; + text: string; +} + +export const severityOptions: SeverityOptionItem[] = [ + { value: 'low', text: I18n.LOW }, + { value: 'medium', text: I18n.MEDIUM }, + { value: 'high', text: I18n.HIGH }, + { value: 'critical', text: I18n.CRITICAL }, +]; + +export const defaultRiskScoreBySeverity: Record = { + low: 21, + medium: 47, + high: 73, + critical: 99, +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/default_value.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/default_value.ts new file mode 100644 index 00000000000000..b94fa8c9339377 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/default_value.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const defaultValue = { + name: '', + description: '', + severity: 'low', + riskScore: 50, + references: [], + falsePositives: [], + tags: [], +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/index.tsx new file mode 100644 index 00000000000000..4393f39ad2f859 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/index.tsx @@ -0,0 +1,145 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiButton, EuiHorizontalRule, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import React, { memo, useCallback } from 'react'; + +import { RuleStepProps, RuleStep } from '../../types'; +import * as CreateRuleI18n from '../../translations'; +import { Field, Form, FormDataProvider, getUseField, UseField, useForm } from '../shared_imports'; +import { AddItem } from '../add_item_form'; +import { defaultRiskScoreBySeverity, severityOptions, SeverityValue } from './data'; +import { defaultValue } from './default_value'; +import { schema } from './schema'; +import * as I18n from './translations'; + +const CommonUseField = getUseField({ component: Field }); + +export const StepAboutRule = memo(({ isLoading, setStepData }) => { + const { form } = useForm({ + schema, + defaultValue, + options: { stripEmptyFields: false }, + }); + + const onSubmit = useCallback(async () => { + const { isValid: newIsValid, data } = await form.submit(); + if (newIsValid) { + setStepData(RuleStep.aboutRule, data, newIsValid); + } + }, [form]); + + return ( + <> +
+ + + + + + + + + {({ severity }) => { + const newRiskScore = defaultRiskScoreBySeverity[severity as SeverityValue]; + const riskScoreField = form.getFields().riskScore; + if (newRiskScore != null && riskScoreField.value !== newRiskScore) { + riskScoreField.setValue(newRiskScore); + } + return null; + }} + + + + + + + {CreateRuleI18n.CONTINUE} + + + + + ); +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/schema.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/schema.tsx new file mode 100644 index 00000000000000..97ad3d595a9384 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/schema.tsx @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiText } from '@elastic/eui'; +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { + FormSchema, + FIELD_TYPES, +} from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +import { fieldValidators } from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/helpers'; + +import * as CreateRuleI18n from '../../translations'; + +const { emptyField } = fieldValidators; + +export const schema: FormSchema = { + name: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.siem.detectionEngine.createRule.stepAboutRule.fieldNameLabel', { + defaultMessage: 'Name', + }), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.nameFieldRequiredError', + { + defaultMessage: 'A name is required.', + } + ) + ), + }, + ], + }, + description: { + type: FIELD_TYPES.TEXTAREA, + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.fieldDescriptionLabel', + { + defaultMessage: 'Description', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.descriptionFieldRequiredError', + { + defaultMessage: 'A description is required.', + } + ) + ), + }, + ], + }, + severity: { + type: FIELD_TYPES.SELECT, + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.fieldSeverityLabel', + { + defaultMessage: 'Severity', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.severityFieldRequiredError', + { + defaultMessage: 'A severity is required.', + } + ) + ), + }, + ], + }, + riskScore: { + type: FIELD_TYPES.RANGE, + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.fieldRiskScoreLabel', + { + defaultMessage: 'Risk score', + } + ), + }, + references: { + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.fieldReferenceUrlsLabel', + { + defaultMessage: 'Reference URLs', + } + ), + labelAppend: {CreateRuleI18n.OPTIONAL_FIELD}, + }, + falsePositives: { + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRule.fieldFalsePositiveLabel', + { + defaultMessage: 'False positives', + } + ), + labelAppend: {CreateRuleI18n.OPTIONAL_FIELD}, + }, + tags: { + type: FIELD_TYPES.COMBO_BOX, + label: i18n.translate('xpack.siem.detectionEngine.createRule.stepAboutRule.fieldTagsLabel', { + defaultMessage: 'Tags', + }), + labelAppend: {CreateRuleI18n.OPTIONAL_FIELD}, + }, +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/translations.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/translations.ts new file mode 100644 index 00000000000000..bd759b345d70d8 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_about_rule/translations.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const ADD_REFERENCE = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.addReferenceDescription', + { + defaultMessage: 'Add reference', + } +); + +export const ADD_FALSE_POSITIVE = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.addFalsePositiveDescription', + { + defaultMessage: 'Add false positive', + } +); + +export const LOW = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.severityOptionLowDescription', + { + defaultMessage: 'Low', + } +); + +export const MEDIUM = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.severityOptionMediumDescription', + { + defaultMessage: 'Medium', + } +); + +export const HIGH = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.severityOptionHighDescription', + { + defaultMessage: 'High', + } +); + +export const CRITICAL = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepAboutRuleForm.severityOptionCriticalDescription', + { + defaultMessage: 'Critical', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/index.tsx new file mode 100644 index 00000000000000..b09d0df962793f --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/index.tsx @@ -0,0 +1,159 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiHorizontalRule, EuiFlexGroup, EuiFlexItem, EuiButton } from '@elastic/eui'; +import { isEqual } from 'lodash/fp'; +import React, { memo, useCallback, useEffect, useState } from 'react'; + +import { useFetchIndexPatterns } from '../../../../../containers/detection_engine/rules/fetch_index_patterns'; +import { DEFAULT_INDEX_KEY, DEFAULT_SIGNALS_INDEX_KEY } from '../../../../../../common/constants'; +import { useKibanaUiSetting } from '../../../../../lib/settings/use_kibana_ui_setting'; +import * as CreateRuleI18n from '../../translations'; +import { RuleStep, RuleStepProps } from '../../types'; +import { QueryBarDefineRule } from '../query_bar'; +import { Field, Form, FormDataProvider, getUseField, UseField, useForm } from '../shared_imports'; +import { schema } from './schema'; +import * as I18n from './translations'; + +const CommonUseField = getUseField({ component: Field }); + +export const StepDefineRule = memo(({ isLoading, setStepData }) => { + const [initializeOutputIndex, setInitializeOutputIndex] = useState(true); + const [localUseIndicesConfig, setLocalUseIndicesConfig] = useState(''); + const [ + { indexPatterns: indexPatternQueryBar, isLoading: indexPatternLoadingQueryBar }, + setIndices, + ] = useFetchIndexPatterns(); + const [indicesConfig] = useKibanaUiSetting(DEFAULT_INDEX_KEY); + const [signalIndexConfig] = useKibanaUiSetting(DEFAULT_SIGNALS_INDEX_KEY); + + const { form } = useForm({ + schema, + defaultValue: { + index: indicesConfig || [], + outputIndex: signalIndexConfig, + queryBar: { + query: { query: '', language: 'kuery' }, + filters: [], + saved_id: null, + }, + useIndicesConfig: 'true', + }, + options: { stripEmptyFields: false }, + }); + + const onSubmit = useCallback(async () => { + const { isValid: newIsValid, data } = await form.submit(); + if (newIsValid) { + setStepData(RuleStep.defineRule, data, newIsValid); + } + }, [form]); + + useEffect(() => { + if (signalIndexConfig != null && initializeOutputIndex) { + const outputIndexField = form.getFields().outputIndex; + outputIndexField.setValue(signalIndexConfig); + setInitializeOutputIndex(false); + } + }, [initializeOutputIndex, signalIndexConfig, form]); + + return ( + <> +
+ + + + + + {({ useIndicesConfig }) => { + if (localUseIndicesConfig !== useIndicesConfig) { + const indexField = form.getFields().index; + if ( + indexField != null && + useIndicesConfig === 'true' && + !isEqual(indexField.value, indicesConfig) + ) { + indexField.setValue(indicesConfig); + setIndices(indicesConfig); + } else if ( + indexField != null && + useIndicesConfig === 'false' && + !isEqual(indexField.value, []) + ) { + indexField.setValue([]); + setIndices([]); + } + setLocalUseIndicesConfig(useIndicesConfig); + } + + return null; + }} + + + + + + + {CreateRuleI18n.CONTINUE} + + + + + ); +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/schema.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/schema.tsx new file mode 100644 index 00000000000000..500557a2c2a96f --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/schema.tsx @@ -0,0 +1,123 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; +import { EuiText } from '@elastic/eui'; +import { fromKueryExpression } from '@kbn/es-query'; +import { isEmpty } from 'lodash/fp'; +import React from 'react'; + +import { + FormSchema, + FIELD_TYPES, + ValidationFunc, +} from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; +import { fieldValidators } from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/helpers'; +import { ERROR_CODE } from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/helpers/field_validators/types'; + +import * as CreateRuleI18n from '../../translations'; + +import { FieldValueQueryBar } from '../query_bar'; +import { CUSTOM_QUERY_REQUIRED, INVALID_CUSTOM_QUERY } from './translations'; + +const { emptyField } = fieldValidators; + +export const schema: FormSchema = { + outputIndex: { + type: FIELD_TYPES.TEXT, + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.fieldOutputIndiceNameLabel', + { + defaultMessage: 'Output index name', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.outputIndiceNameFieldRequiredError', + { + defaultMessage: 'An output indice name for signals is required.', + } + ) + ), + }, + ], + }, + useIndicesConfig: { + type: FIELD_TYPES.RADIO_GROUP, + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.fieldIndicesTypeLabel', + { + defaultMessage: 'Indices type', + } + ), + }, + index: { + type: FIELD_TYPES.COMBO_BOX, + label: i18n.translate('xpack.siem.detectionEngine.createRule.stepAboutRule.fiedIndicesLabel', { + defaultMessage: 'Indices', + }), + labelAppend: {CreateRuleI18n.OPTIONAL_FIELD}, + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.outputIndiceNameFieldRequiredError', + { + defaultMessage: 'An output indice name for signals is required.', + } + ) + ), + }, + ], + }, + queryBar: { + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.fieldQuerBarLabel', + { + defaultMessage: 'Custom query', + } + ), + validations: [ + { + validator: ( + ...args: Parameters + ): ReturnType> | undefined => { + const [{ value, path }] = args; + const { query, filters } = value as FieldValueQueryBar; + return isEmpty(query.query as string) && isEmpty(filters) + ? { + code: 'ERR_FIELD_MISSING', + path, + message: CUSTOM_QUERY_REQUIRED, + } + : undefined; + }, + }, + { + validator: ( + ...args: Parameters + ): ReturnType> | undefined => { + const [{ value, path }] = args; + const { query } = value as FieldValueQueryBar; + if (!isEmpty(query.query as string) && query.language === 'kuery') { + try { + fromKueryExpression(query.query); + } catch (err) { + return { + code: 'ERR_FIELD_FORMAT', + path, + message: INVALID_CUSTOM_QUERY, + }; + } + } + return undefined; + }, + }, + ], + }, +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/translations.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/translations.tsx new file mode 100644 index 00000000000000..0050c59a4a2c8b --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/translations.tsx @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const CUSTOM_QUERY_REQUIRED = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.customQueryFieldRequiredError', + { + defaultMessage: 'A custom query is required.', + } +); + +export const INVALID_CUSTOM_QUERY = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.customQueryFieldInvalidError', + { + defaultMessage: 'The KQL is invalid', + } +); + +export const CONFIG_INDICES = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.indicesFromConfigDescription', + { + defaultMessage: 'Use Elasticsearch indices from SIEM advanced settings', + } +); + +export const CUSTOM_INDICES = i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepDefineRule.indicesCustomDescription', + { + defaultMessage: 'Provide custom list of indices', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/types.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/types.ts new file mode 100644 index 00000000000000..df52b0c9ff64ef --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_define_rule/types.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FieldValueQueryBar } from '../query_bar'; + +export interface QueryBarStepDefineRule { + queryBar: FieldValueQueryBar; +} diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/index.tsx new file mode 100644 index 00000000000000..10b95ac6c87421 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/index.tsx @@ -0,0 +1,85 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiHorizontalRule, EuiFlexGroup, EuiFlexItem, EuiButton } from '@elastic/eui'; +import React, { memo, useCallback } from 'react'; + +import { RuleStep, RuleStepProps } from '../../types'; +import { ScheduleItem } from '../schedule_item_form'; +import { Form, UseField, useForm } from '../shared_imports'; +import { schema } from './schema'; +import * as I18n from './translations'; + +export const StepScheduleRule = memo(({ isLoading, setStepData }) => { + const { form } = useForm({ + schema, + defaultValue: { + interval: '5m', + from: '0m', + }, + options: { stripEmptyFields: false }, + }); + + const onSubmit = useCallback( + async (enabled: boolean) => { + const { isValid: newIsValid, data } = await form.submit(); + if (newIsValid) { + setStepData(RuleStep.scheduleRule, { ...data, enabled }, newIsValid); + } + }, + [form] + ); + + return ( + <> +
+ + + + + + + + {I18n.COMPLETE_WITHOUT_ACTIVATING} + + + + + {I18n.COMPLETE_WITH_ACTIVATING} + + + + + ); +}); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/schema.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/schema.tsx new file mode 100644 index 00000000000000..6192a3b9058794 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/schema.tsx @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiText } from '@elastic/eui'; +import React from 'react'; +import { i18n } from '@kbn/i18n'; + +import { FormSchema } from '../../../../../../../../../../src/plugins/es_ui_shared/static/forms/hook_form_lib'; + +import * as CreateRuleI18n from '../../translations'; + +export const schema: FormSchema = { + interval: { + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRule.fieldIntervalLabel', + { + defaultMessage: 'Rule run interval & look-back', + } + ), + helpText: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRule.fieldIntervalHelpText', + { + defaultMessage: 'How often and how far back this rule will search specified indices.', + } + ), + }, + from: { + label: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRule.fieldAdditionalLookBackLabel', + { + defaultMessage: 'Additional look-back', + } + ), + labelAppend: {CreateRuleI18n.OPTIONAL_FIELD}, + helpText: i18n.translate( + 'xpack.siem.detectionEngine.createRule.stepScheduleRule.fieldAdditionalLookBackHelpText', + { + defaultMessage: + 'Add more time to the look-back range in order to prevent potential gaps in signal reporting.', + } + ), + }, +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/translations.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/translations.tsx new file mode 100644 index 00000000000000..feaaf4e85b2af0 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/components/step_schedule_rule/translations.tsx @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const COMPLETE_WITHOUT_ACTIVATING = i18n.translate( + 'xpack.siem.detectionEngine.createRule. stepScheduleRule.completeWithoutActivatingTitle', + { + defaultMessage: 'Complete rule without activating', + } +); + +export const COMPLETE_WITH_ACTIVATING = i18n.translate( + 'xpack.siem.detectionEngine.createRule. stepScheduleRule.completeWithActivatingTitle', + { + defaultMessage: 'Complete rule & activate', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/helpers.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/helpers.ts new file mode 100644 index 00000000000000..b864260dd33384 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/helpers.ts @@ -0,0 +1,99 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { isEmpty } from 'lodash/fp'; +import moment from 'moment'; + +import { NewRule } from '../../../containers/detection_engine/rules/types'; + +import { + AboutStepRule, + DefineStepRule, + ScheduleStepRule, + DefineStepRuleJson, + ScheduleStepRuleJson, + AboutStepRuleJson, + FormatRuleType, +} from './types'; + +const getTimeTypeValue = (time: string): { unit: string; value: number } => { + const timeObj = { + unit: '', + value: 0, + }; + const filterTimeVal = (time as string).match(/\d+/g); + const filterTimeType = (time as string).match(/[a-zA-Z]+/g); + if (!isEmpty(filterTimeVal) && filterTimeVal != null && !isNaN(Number(filterTimeVal[0]))) { + timeObj.value = Number(filterTimeVal[0]); + } + if ( + !isEmpty(filterTimeType) && + filterTimeType != null && + ['s', 'm', 'h'].includes(filterTimeType[0]) + ) { + timeObj.unit = filterTimeType[0]; + } + return timeObj; +}; + +const formatDefineStepData = (defineStepData: DefineStepRule): DefineStepRuleJson => { + const { queryBar, useIndicesConfig, outputIndex, ...rest } = defineStepData; + const { filters, query, saved_id: savedId } = queryBar; + return { + ...rest, + language: query.language, + filters, + output_index: outputIndex, + query: query.query as string, + ...(savedId != null ? { saved_id: savedId } : {}), + }; +}; + +const formatScheduleStepData = (scheduleData: ScheduleStepRule): ScheduleStepRuleJson => { + const formatScheduleData = scheduleData; + + if (!isEmpty(formatScheduleData.interval) && !isEmpty(formatScheduleData.from)) { + const { unit: intervalUnit, value: intervalValue } = getTimeTypeValue( + formatScheduleData.interval + ); + const { unit: fromUnit, value: fromValue } = getTimeTypeValue(formatScheduleData.from); + const duration = moment.duration(intervalValue, intervalUnit as 's' | 'm' | 'h'); + duration.add(fromValue, fromUnit as 's' | 'm' | 'h'); + formatScheduleData.from = `now-${duration.asSeconds()}s`; + formatScheduleData.to = 'now'; + } + return formatScheduleData; +}; + +const formatAboutStepData = (aboutStepData: AboutStepRule): AboutStepRuleJson => { + const { falsePositives, references, riskScore, ...rest } = aboutStepData; + + return { + false_positives: falsePositives.filter(item => !isEmpty(item)), + references: references.filter(item => !isEmpty(item)), + risk_score: riskScore, + ...rest, + }; +}; + +export const formatRule = ( + defineStepData: DefineStepRule, + aboutStepData: AboutStepRule, + scheduleData: ScheduleStepRule +): NewRule => { + const type: FormatRuleType = defineStepData.queryBar.saved_id != null ? 'saved_query' : 'query'; + const persistData = { + type, + ...formatDefineStepData(defineStepData), + ...formatAboutStepData(aboutStepData), + ...formatScheduleStepData(scheduleData), + meta: { + from: scheduleData.from, + }, + }; + + return persistData; +}; diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/index.tsx index 47a3527aff99c7..c505124c25039f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/index.tsx @@ -4,22 +4,189 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import { EuiAccordion, EuiHorizontalRule, EuiPanel, EuiSpacer } from '@elastic/eui'; +import React, { useCallback, useRef, useState } from 'react'; +import { Redirect } from 'react-router-dom'; import { HeaderPage } from '../../../components/header_page'; import { WrapperPage } from '../../../components/wrapper_page'; +import { AccordionTitle } from './components/accordion_title'; +import { StepAboutRule } from './components/step_about_rule'; +import { StepDefineRule } from './components/step_define_rule'; +import { StepScheduleRule } from './components/step_schedule_rule'; +import { usePersistRule } from '../../../containers/detection_engine/rules/persist_rule'; import { SpyRoute } from '../../../utils/route/spy_routes'; + +import { formatRule } from './helpers'; import * as i18n from './translations'; +import { AboutStepRule, DefineStepRule, RuleStep, RuleStepData, ScheduleStepRule } from './types'; +import { DETECTION_ENGINE_PAGE_NAME } from '../../../components/link_to/redirect_to_detection_engine'; + +const stepsRuleOrder = [RuleStep.defineRule, RuleStep.aboutRule, RuleStep.scheduleRule]; export const CreateRuleComponent = React.memo(() => { + const [openAccordionId, setOpenAccordionId] = useState(RuleStep.defineRule); + const defineRuleRef = useRef(null); + const aboutRuleRef = useRef(null); + const scheduleRuleRef = useRef(null); + const stepsData = useRef>({ + [RuleStep.defineRule]: { isValid: false, data: {} }, + [RuleStep.aboutRule]: { isValid: false, data: {} }, + [RuleStep.scheduleRule]: { isValid: false, data: {} }, + }); + const [{ isLoading, isSaved }, setRule] = usePersistRule(); + + const setStepData = (step: RuleStep, data: unknown, isValid: boolean) => { + stepsData.current[step] = { data, isValid }; + if (isValid) { + const stepRuleIdx = stepsRuleOrder.findIndex(item => step === item); + if ([0, 1].includes(stepRuleIdx)) { + openCloseAccordion(step); + openCloseAccordion(stepsRuleOrder[stepRuleIdx + 1]); + setOpenAccordionId(stepsRuleOrder[stepRuleIdx + 1]); + } else if ( + stepRuleIdx === 2 && + stepsData.current[RuleStep.defineRule].isValid && + stepsData.current[RuleStep.aboutRule].isValid + ) { + setRule( + formatRule( + stepsData.current[RuleStep.defineRule].data as DefineStepRule, + stepsData.current[RuleStep.aboutRule].data as AboutStepRule, + stepsData.current[RuleStep.scheduleRule].data as ScheduleStepRule + ) + ); + } + } + }; + + const getAccordionType = useCallback( + (accordionId: RuleStep) => { + if (accordionId === openAccordionId) { + return 'active'; + } else if (stepsData.current[accordionId].isValid) { + return 'valid'; + } + return 'passive'; + }, + [openAccordionId, stepsData.current] + ); + + const defineRuleButton = ( + + ); + + const aboutRuleButton = ( + + ); + + const scheduleRuleButton = ( + + ); + + const openCloseAccordion = (accordionId: RuleStep | null) => { + if (accordionId != null) { + if (accordionId === RuleStep.defineRule && defineRuleRef.current != null) { + defineRuleRef.current.onToggle(); + } else if (accordionId === RuleStep.aboutRule && aboutRuleRef.current != null) { + aboutRuleRef.current.onToggle(); + } else if (accordionId === RuleStep.scheduleRule && scheduleRuleRef.current != null) { + scheduleRuleRef.current.onToggle(); + } + } + }; + + const manageAccordions = useCallback( + (id: RuleStep, isOpen: boolean) => { + const stepRuleIdx = stepsRuleOrder.findIndex(step => step === id); + const isLatestStepsRuleValid = + stepRuleIdx === 0 + ? true + : stepsRuleOrder + .filter((stepRule, index) => index < stepRuleIdx) + .every(stepRule => stepsData.current[stepRule].isValid); + + if ( + openAccordionId != null && + openAccordionId !== id && + !stepsData.current[openAccordionId].isValid && + isOpen + ) { + openCloseAccordion(id); + } else if (!isLatestStepsRuleValid && isOpen) { + openCloseAccordion(id); + } else if (openAccordionId != null && id !== openAccordionId && isOpen) { + openCloseAccordion(openAccordionId); + setOpenAccordionId(id); + } else if (openAccordionId == null && isOpen) { + setOpenAccordionId(id); + } + }, + [openAccordionId] + ); + + if (isSaved && stepsData.current[RuleStep.scheduleRule].isValid) { + return ; + } + return ( <> + + + + + + + + + + + + + + + + + + + + diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/translations.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/translations.ts index 884f3f3741228a..ca96566305a6b0 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/translations.ts +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/translations.ts @@ -9,3 +9,32 @@ import { i18n } from '@kbn/i18n'; export const PAGE_TITLE = i18n.translate('xpack.siem.detectionEngine.createRule.pageTitle', { defaultMessage: 'Create new rule', }); + +export const DEFINE_RULE = i18n.translate('xpack.siem.detectionEngine.createRule.defineRuleTitle', { + defaultMessage: 'Define Rule', +}); + +export const ABOUT_RULE = i18n.translate('xpack.siem.detectionEngine.createRule.aboutRuleTitle', { + defaultMessage: 'About Rule', +}); + +export const SCHEDULE_RULE = i18n.translate( + 'xpack.siem.detectionEngine.createRule.scheduleRuleTitle', + { + defaultMessage: 'Schedule Rule', + } +); + +export const OPTIONAL_FIELD = i18n.translate( + 'xpack.siem.detectionEngine.createRule.optionalFieldDescription', + { + defaultMessage: 'Optional', + } +); + +export const CONTINUE = i18n.translate( + 'xpack.siem.detectionEngine.createRule.continueButtonTitle', + { + defaultMessage: 'Continue', + } +); diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/types.ts b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/types.ts new file mode 100644 index 00000000000000..a03f6a0b11bee7 --- /dev/null +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/create_rule/types.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FieldValueQueryBar } from './components/query_bar'; +import { esFilters } from '../../../../../../../../src/plugins/data/common'; + +export enum RuleStep { + defineRule = 'define-rule', + aboutRule = 'about-rule', + scheduleRule = 'schedule-rule', +} + +export interface RuleStepData { + isValid: boolean; + data: unknown; +} + +export interface RuleStepProps { + setStepData: (step: RuleStep, data: unknown, isValid: boolean) => void; + isLoading: boolean; +} + +export interface DefineStepRule { + outputIndex: string; + useIndicesConfig: string; + index: string[]; + queryBar: FieldValueQueryBar; +} + +export interface DefineStepRuleJson { + output_index: string; + index: string[]; + filters: esFilters.Filter[]; + saved_id?: string; + query: string; + language: string; +} + +export interface AboutStepRule { + name: string; + description: string; + severity: string; + riskScore: number; + references: string[]; + falsePositives: string[]; + tags: string[]; +} + +export interface AboutStepRuleJson { + name: string; + description: string; + severity: string; + risk_score: number; + references: string[]; + false_positives: string[]; + tags: string[]; +} + +export interface ScheduleStepRule { + enabled: boolean; + interval: string; + from: string; + to?: string; +} +export type ScheduleStepRuleJson = ScheduleStepRule; + +export type FormatRuleType = 'query' | 'saved_query'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx index 48b6d34d0b28bb..1252c7031e8a5f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/details/details_tabs.tsx @@ -10,6 +10,8 @@ import { Route, Switch } from 'react-router-dom'; import { scoreIntervalToDateTime } from '../../../components/ml/score/score_interval_to_datetime'; import { Anomaly } from '../../../components/ml/types'; import { HostsTableType } from '../../../store/hosts/model'; +import { AnomaliesQueryTabBody } from '../../../containers/anomalies/anomalies_query_tab_body'; +import { AnomaliesHostTable } from '../../../components/ml/tables/anomalies_host_table'; import { HostDetailsTabsProps } from './types'; import { type } from './utils'; @@ -18,7 +20,6 @@ import { HostsQueryTabBody, AuthenticationsQueryTabBody, UncommonProcessQueryTabBody, - AnomaliesQueryTabBody, EventsQueryTabBody, } from '../navigation'; @@ -84,7 +85,9 @@ const HostDetailsTabs = React.memo( /> } + render={() => ( + + )} /> ( /> } + render={() => ( + + )} /> ( - -); - -AnomaliesQueryTabBody.displayName = 'AnomaliesQueryTabBody'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/index.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/index.ts index 8a8f23208363d0..f20138f5206205 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/index.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/index.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './anomalies_query_tab_body'; export * from './authentications_query_tab_body'; export * from './events_query_tab_body'; export * from './hosts_query_tab_body'; diff --git a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts index d567038a05bd8d..98d931dd7e275f 100644 --- a/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/hosts/navigation/types.ts @@ -25,6 +25,18 @@ type KeyHostsNavTab = KeyHostsNavTabWithoutMlPermission | KeyHostsNavTabWithMlPe export type HostsNavTab = Record; +export type SetQuery = ({ + id, + inspect, + loading, + refetch, +}: { + id: string; + inspect: InspectQuery | null; + loading: boolean; + refetch: Refetch; +}) => void; + interface QueryTabBodyProps { type: hostsModel.HostsType; startDate: number; @@ -32,30 +44,13 @@ interface QueryTabBodyProps { filterQuery?: string | ESTermQuery; } -export type AnomaliesQueryTabBodyProps = QueryTabBodyProps & { - skip: boolean; - narrowDateRange: NarrowDateRange; - hostName?: string; -}; - export type HostsComponentsQueryProps = QueryTabBodyProps & { deleteQuery?: ({ id }: { id: string }) => void; indexPattern: StaticIndexPattern; skip: boolean; - setQuery: ({ - id, - inspect, - loading, - refetch, - }: { - id: string; - inspect: InspectQuery | null; - loading: boolean; - refetch: Refetch; - }) => void; + setQuery: SetQuery; updateDateRange?: UpdateDateRange; narrowDateRange?: NarrowDateRange; }; export type CommonChildren = (args: HostsComponentsQueryProps) => JSX.Element; -export type AnomaliesChildren = (args: AnomaliesQueryTabBodyProps) => JSX.Element; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx index 96111f04799388..477f435b84b20b 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/ip_details/index.tsx @@ -39,6 +39,7 @@ import { NetworkTopNFlowQueryTable } from './network_top_n_flow_query_table'; import { TlsQueryTable } from './tls_query_table'; import { IPDetailsComponentProps } from './types'; import { UsersQueryTable } from './users_query_table'; +import { AnomaliesQueryTabBody } from '../../../containers/anomalies/anomalies_query_tab_body'; import { esQuery } from '../../../../../../../../src/plugins/data/public'; export { getBreadcrumbs } from './utils'; @@ -58,6 +59,7 @@ export const IPDetailsComponent = React.memo( setQuery, to, }) => { + const type = networkModel.NetworkType.details; const narrowDateRange = useCallback( (score, interval) => { const fromTo = scoreIntervalToDateTime(score, interval); @@ -108,7 +110,7 @@ export const IPDetailsComponent = React.memo( skip={isInitializing} sourceId="default" filterQuery={filterQuery} - type={networkModel.NetworkType.details} + type={type} ip={ip} > {({ id, inspect, ipOverviewData, loading, refetch }) => ( @@ -127,7 +129,7 @@ export const IPDetailsComponent = React.memo( anomaliesData={anomaliesData} loading={loading} isLoadingAnomaliesData={isLoadingAnomaliesData} - type={networkModel.NetworkType.details} + type={type} flowTarget={flowTarget} refetch={refetch} setQuery={setQuery} @@ -158,7 +160,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} indexPattern={indexPattern} /> @@ -172,7 +174,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} indexPattern={indexPattern} /> @@ -190,7 +192,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} indexPattern={indexPattern} /> @@ -204,7 +206,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} indexPattern={indexPattern} /> @@ -220,7 +222,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} /> @@ -232,7 +234,7 @@ export const IPDetailsComponent = React.memo( ip={ip} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} setQuery={setQuery} /> @@ -246,19 +248,23 @@ export const IPDetailsComponent = React.memo( setQuery={setQuery} skip={isInitializing} startDate={from} - type={networkModel.NetworkType.details} + type={type} /> - diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/anomalies_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/anomalies_query_tab_body.tsx deleted file mode 100644 index daf9cd2dd1d12b..00000000000000 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/anomalies_query_tab_body.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { AnomaliesQueryTabBodyProps } from './types'; -import { AnomaliesNetworkTable } from '../../../components/ml/tables/anomalies_network_table'; - -export const AnomaliesQueryTabBody = ({ - to, - isInitializing, - from, - type, - narrowDateRange, -}: AnomaliesQueryTabBodyProps) => ( - -); - -AnomaliesQueryTabBody.displayName = 'AnomaliesQueryTabBody'; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/countries_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/countries_query_tab_body.tsx index 0fe370c144049e..6ddd3bbec3a322 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/countries_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/countries_query_tab_body.tsx @@ -17,21 +17,21 @@ import { IPsQueryTabBodyProps as CountriesQueryTabBodyProps } from './types'; const NetworkTopCountriesTableManage = manageQuery(NetworkTopCountriesTable); export const CountriesQueryTabBody = ({ - to, + endDate, filterQuery, - isInitializing, - from, + skip, + startDate, setQuery, indexPattern, flowTarget, }: CountriesQueryTabBodyProps) => ( {({ diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/dns_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/dns_query_tab_body.tsx index 34ff35bd145a2e..da3c2fcfbc67b0 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/dns_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/dns_query_tab_body.tsx @@ -12,28 +12,28 @@ import { NetworkDnsTable } from '../../../components/page/network/network_dns_ta import { NetworkDnsQuery, NetworkDnsHistogramQuery } from '../../../containers/network_dns'; import { manageQuery } from '../../../components/page/manage_query'; -import { DnsQueryTabBodyProps } from './types'; +import { NetworkComponentQueryProps } from './types'; import { NetworkDnsHistogram } from '../../../components/page/network/dns_histogram'; const NetworkDnsTableManage = manageQuery(NetworkDnsTable); const NetworkDnsHistogramManage = manageQuery(NetworkDnsHistogram); export const DnsQueryTabBody = ({ - to, + endDate, filterQuery, - isInitializing, - from, + skip, + startDate, setQuery, type, updateDateRange = () => {}, -}: DnsQueryTabBodyProps) => ( +}: NetworkComponentQueryProps) => ( <> {({ totalCount, loading, id, inspect, refetch, histogram }) => ( @@ -41,8 +41,8 @@ export const DnsQueryTabBody = ({ id={id} loading={loading} data={histogram} - endDate={to} - startDate={from} + endDate={endDate} + startDate={startDate} inspect={inspect} refetch={refetch} setQuery={setQuery} @@ -53,11 +53,11 @@ export const DnsQueryTabBody = ({ {({ diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/http_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/http_query_tab_body.tsx index a20a212623fb84..639a14d354ced4 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/http_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/http_query_tab_body.tsx @@ -17,18 +17,18 @@ import { HttpQueryTabBodyProps } from './types'; const NetworkHttpTableManage = manageQuery(NetworkHttpTable); export const HttpQueryTabBody = ({ - to, + endDate, filterQuery, - isInitializing, - from, + skip, + startDate, setQuery, }: HttpQueryTabBodyProps) => ( {({ diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/index.ts b/x-pack/legacy/plugins/siem/public/pages/network/navigation/index.ts index 9e8b4c6215031f..44b78cb3077ffb 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/index.ts +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/index.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -export * from './anomalies_query_tab_body'; export * from './network_routes'; export * from './network_routes_loading'; export * from './nav_tabs'; diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/ips_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/ips_query_tab_body.tsx index 08ba75443b3332..95aaa90fe78651 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/ips_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/ips_query_tab_body.tsx @@ -17,21 +17,21 @@ import { IPsQueryTabBodyProps } from './types'; const NetworkTopNFlowTableManage = manageQuery(NetworkTopNFlowTable); export const IPsQueryTabBody = ({ - to, + endDate, filterQuery, - isInitializing, - from, + skip, + startDate, setQuery, indexPattern, flowTarget, }: IPsQueryTabBodyProps) => ( {({ diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/network_routes.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/network_routes.tsx index 0f373be94b45bf..681e1f8e1e34d7 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/network_routes.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/network_routes.tsx @@ -14,7 +14,8 @@ import { scoreIntervalToDateTime } from '../../../components/ml/score/score_inte import { IPsQueryTabBody } from './ips_query_tab_body'; import { CountriesQueryTabBody } from './countries_query_tab_body'; import { HttpQueryTabBody } from './http_query_tab_body'; -import { AnomaliesQueryTabBody } from './anomalies_query_tab_body'; +import { AnomaliesQueryTabBody } from '../../../containers/anomalies/anomalies_query_tab_body'; +import { AnomaliesNetworkTable } from '../../../components/ml/tables/anomalies_network_table'; import { DnsQueryTabBody } from './dns_query_tab_body'; import { ConditionalFlexGroup } from './conditional_flex_group'; import { NetworkRoutesProps, NetworkRouteType } from './types'; @@ -50,24 +51,44 @@ export const NetworkRoutes = ({ [from, to] ); - const tabProps = { - networkPagePath, + const networkAnomaliesFilterQuery = { + bool: { + should: [ + { + exists: { + field: 'source.ip', + }, + }, + { + exists: { + field: 'destination.ip', + }, + }, + ], + minimum_should_match: 1, + }, + }; + + const commonProps = { + startDate: from, + endDate: to, + skip: isInitializing, type, - to, + narrowDateRange, + setQuery, filterQuery, - isInitializing, - from, + }; + + const tabProps = { + ...commonProps, indexPattern, - setQuery, updateDateRange, }; const anomaliesProps = { - from, - to, - isInitializing, - type, - narrowDateRange, + ...commonProps, + anomaliesFilterQuery: networkAnomaliesFilterQuery, + AnomaliesTableComponent: AnomaliesNetworkTable, }; return ( @@ -115,7 +136,12 @@ export const NetworkRoutes = ({ /> } + render={() => ( + + )} /> ); diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/tls_query_tab_body.tsx b/x-pack/legacy/plugins/siem/public/pages/network/navigation/tls_query_tab_body.tsx index 1f93e293be8657..0adfec203e0a61 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/tls_query_tab_body.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/tls_query_tab_body.tsx @@ -13,23 +13,23 @@ import { TlsQueryTabBodyProps } from './types'; const TlsTableManage = manageQuery(TlsTable); export const TlsQueryTabBody = ({ - to, + endDate, filterQuery, flowTarget, ip = '', setQuery, - isInitializing, - from, + skip, + startDate, type, }: TlsQueryTabBodyProps) => ( {({ id, inspect, isInspected, tls, totalCount, pageInfo, loading, loadPage, refetch }) => ( diff --git a/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts b/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts index 5f5f0a026d375d..bc63e26f71ebaf 100644 --- a/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts +++ b/x-pack/legacy/plugins/siem/public/pages/network/navigation/types.ts @@ -10,41 +10,37 @@ import { NavTab } from '../../../components/navigation/types'; import { FlowTargetSourceDest } from '../../../graphql/types'; import { networkModel } from '../../../store'; import { ESTermQuery } from '../../../../common/typed_json'; -import { NarrowDateRange } from '../../../components/ml/types'; import { GlobalTimeArgs } from '../../../containers/global_time'; import { SetAbsoluteRangeDatePicker } from '../types'; import { UpdateDateRange } from '../../../components/charts/common'; +import { NarrowDateRange } from '../../../components/ml/types'; -interface QueryTabBodyProps { +interface QueryTabBodyProps extends Pick { + skip: boolean; type: networkModel.NetworkType; + startDate: number; + endDate: number; filterQuery?: string | ESTermQuery; updateDateRange?: UpdateDateRange; narrowDateRange?: NarrowDateRange; } -export type DnsQueryTabBodyProps = QueryTabBodyProps & GlobalTimeArgs; +export type NetworkComponentQueryProps = QueryTabBodyProps; -export type IPsQueryTabBodyProps = QueryTabBodyProps & - GlobalTimeArgs & { - indexPattern: StaticIndexPattern; - flowTarget: FlowTargetSourceDest; - }; +export type IPsQueryTabBodyProps = QueryTabBodyProps & { + indexPattern: StaticIndexPattern; + flowTarget: FlowTargetSourceDest; +}; -export type TlsQueryTabBodyProps = QueryTabBodyProps & - GlobalTimeArgs & { - flowTarget: FlowTargetSourceDest; - ip?: string; - }; +export type TlsQueryTabBodyProps = QueryTabBodyProps & { + flowTarget: FlowTargetSourceDest; + ip?: string; +}; -export type HttpQueryTabBodyProps = QueryTabBodyProps & - GlobalTimeArgs & { - ip?: string; - }; -export type AnomaliesQueryTabBodyProps = QueryTabBodyProps & - Pick & { - narrowDateRange: NarrowDateRange; - }; +export type HttpQueryTabBodyProps = QueryTabBodyProps & { + ip?: string; +}; export type NetworkRoutesProps = GlobalTimeArgs & { networkPagePath: string; diff --git a/x-pack/legacy/plugins/siem/server/graphql/anomalies/index.ts b/x-pack/legacy/plugins/siem/server/graphql/anomalies/index.ts new file mode 100644 index 00000000000000..4bfd6be173105d --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/graphql/anomalies/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { createAnomaliesResolvers } from './resolvers'; +export { anomaliesSchema } from './schema.gql'; diff --git a/x-pack/legacy/plugins/siem/server/graphql/anomalies/resolvers.ts b/x-pack/legacy/plugins/siem/server/graphql/anomalies/resolvers.ts new file mode 100644 index 00000000000000..47e227a8c0f840 --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/graphql/anomalies/resolvers.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Anomalies } from '../../lib/anomalies'; +import { AppResolverOf, ChildResolverOf } from '../../lib/framework'; +import { createOptions } from '../../utils/build_query/create_options'; +import { QuerySourceResolver } from '../sources/resolvers'; +import { SourceResolvers } from '../types'; + +export interface AnomaliesResolversDeps { + anomalies: Anomalies; +} + +type QueryAnomaliesOverTimeResolver = ChildResolverOf< + AppResolverOf, + QuerySourceResolver +>; + +export const createAnomaliesResolvers = ( + libs: AnomaliesResolversDeps +): { + Source: { + AnomaliesOverTime: QueryAnomaliesOverTimeResolver; + }; +} => ({ + Source: { + async AnomaliesOverTime(source, args, { req }, info) { + const options = { + ...createOptions(source, args, info), + defaultIndex: args.defaultIndex, + }; + return libs.anomalies.getAnomaliesOverTime(req, options); + }, + }, +}); diff --git a/x-pack/legacy/plugins/siem/server/graphql/anomalies/schema.gql.ts b/x-pack/legacy/plugins/siem/server/graphql/anomalies/schema.gql.ts new file mode 100644 index 00000000000000..1dad0aafd55b0a --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/graphql/anomalies/schema.gql.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import gql from 'graphql-tag'; + +export const anomaliesSchema = gql` + type AnomaliesOverTimeData { + inspect: Inspect + anomaliesOverTime: [MatrixOverTimeHistogramData!]! + totalCount: Float! + } + + extend type Source { + AnomaliesOverTime( + timerange: TimerangeInput! + filterQuery: String + defaultIndex: [String!]! + ): AnomaliesOverTimeData! + } +`; diff --git a/x-pack/legacy/plugins/siem/server/graphql/index.ts b/x-pack/legacy/plugins/siem/server/graphql/index.ts index 110a390c19531f..901d27295479a2 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/index.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/index.ts @@ -7,6 +7,7 @@ import { rootSchema } from '../../common/graphql/root'; import { sharedSchema } from '../../common/graphql/shared'; +import { anomaliesSchema } from './anomalies'; import { authenticationsSchema } from './authentications'; import { ecsSchema } from './ecs'; import { eventsSchema } from './events'; @@ -29,6 +30,7 @@ import { tlsSchema } from './tls'; import { uncommonProcessesSchema } from './uncommon_processes'; import { whoAmISchema } from './who_am_i'; export const schemas = [ + anomaliesSchema, authenticationsSchema, ecsSchema, eventsSchema, diff --git a/x-pack/legacy/plugins/siem/server/graphql/types.ts b/x-pack/legacy/plugins/siem/server/graphql/types.ts index 44cfc81339527d..fda79ad543bf6a 100644 --- a/x-pack/legacy/plugins/siem/server/graphql/types.ts +++ b/x-pack/legacy/plugins/siem/server/graphql/types.ts @@ -458,6 +458,8 @@ export interface Source { configuration: SourceConfiguration; /** The status of the source */ status: SourceStatus; + + AnomaliesOverTime: AnomaliesOverTimeData; /** Gets Authentication success and failures based on a timerange */ Authentications: AuthenticationsData; @@ -558,6 +560,28 @@ export interface IndexField { format?: Maybe; } +export interface AnomaliesOverTimeData { + inspect?: Maybe; + + anomaliesOverTime: MatrixOverTimeHistogramData[]; + + totalCount: number; +} + +export interface Inspect { + dsl: string[]; + + response: string[]; +} + +export interface MatrixOverTimeHistogramData { + x: number; + + y: number; + + g: string; +} + export interface AuthenticationsData { edges: AuthenticationsEdges[]; @@ -692,12 +716,6 @@ export interface PageInfoPaginated { showMorePagesIndicator: boolean; } -export interface Inspect { - dsl: string[]; - - response: string[]; -} - export interface AuthenticationsOverTimeData { inspect?: Maybe; @@ -706,14 +724,6 @@ export interface AuthenticationsOverTimeData { totalCount: number; } -export interface MatrixOverTimeHistogramData { - x: number; - - y: number; - - g: string; -} - export interface TimelineData { edges: TimelineEdges[]; @@ -2129,6 +2139,13 @@ export interface GetAllTimelineQueryArgs { onlyUserFavorite?: Maybe; } +export interface AnomaliesOverTimeSourceArgs { + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; +} export interface AuthenticationsSourceArgs { timerange: TimerangeInput; @@ -2763,6 +2780,8 @@ export namespace SourceResolvers { configuration?: ConfigurationResolver; /** The status of the source */ status?: StatusResolver; + + AnomaliesOverTime?: AnomaliesOverTimeResolver; /** Gets Authentication success and failures based on a timerange */ Authentications?: AuthenticationsResolver; @@ -2834,6 +2853,19 @@ export namespace SourceResolvers { Parent, TContext >; + export type AnomaliesOverTimeResolver< + R = AnomaliesOverTimeData, + Parent = Source, + TContext = SiemContext + > = Resolver; + export interface AnomaliesOverTimeArgs { + timerange: TimerangeInput; + + filterQuery?: Maybe; + + defaultIndex: string[]; + } + export type AuthenticationsResolver< R = AuthenticationsData, Parent = Source, @@ -3375,6 +3407,81 @@ export namespace IndexFieldResolvers { > = Resolver; } +export namespace AnomaliesOverTimeDataResolvers { + export interface Resolvers { + inspect?: InspectResolver, TypeParent, TContext>; + + anomaliesOverTime?: AnomaliesOverTimeResolver< + MatrixOverTimeHistogramData[], + TypeParent, + TContext + >; + + totalCount?: TotalCountResolver; + } + + export type InspectResolver< + R = Maybe, + Parent = AnomaliesOverTimeData, + TContext = SiemContext + > = Resolver; + export type AnomaliesOverTimeResolver< + R = MatrixOverTimeHistogramData[], + Parent = AnomaliesOverTimeData, + TContext = SiemContext + > = Resolver; + export type TotalCountResolver< + R = number, + Parent = AnomaliesOverTimeData, + TContext = SiemContext + > = Resolver; +} + +export namespace InspectResolvers { + export interface Resolvers { + dsl?: DslResolver; + + response?: ResponseResolver; + } + + export type DslResolver = Resolver< + R, + Parent, + TContext + >; + export type ResponseResolver = Resolver< + R, + Parent, + TContext + >; +} + +export namespace MatrixOverTimeHistogramDataResolvers { + export interface Resolvers { + x?: XResolver; + + y?: YResolver; + + g?: GResolver; + } + + export type XResolver< + R = number, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; + export type YResolver< + R = number, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; + export type GResolver< + R = string, + Parent = MatrixOverTimeHistogramData, + TContext = SiemContext + > = Resolver; +} + export namespace AuthenticationsDataResolvers { export interface Resolvers { edges?: EdgesResolver; @@ -3820,25 +3927,6 @@ export namespace PageInfoPaginatedResolvers { > = Resolver; } -export namespace InspectResolvers { - export interface Resolvers { - dsl?: DslResolver; - - response?: ResponseResolver; - } - - export type DslResolver = Resolver< - R, - Parent, - TContext - >; - export type ResponseResolver = Resolver< - R, - Parent, - TContext - >; -} - export namespace AuthenticationsOverTimeDataResolvers { export interface Resolvers { inspect?: InspectResolver, TypeParent, TContext>; @@ -3869,32 +3957,6 @@ export namespace AuthenticationsOverTimeDataResolvers { > = Resolver; } -export namespace MatrixOverTimeHistogramDataResolvers { - export interface Resolvers { - x?: XResolver; - - y?: YResolver; - - g?: GResolver; - } - - export type XResolver< - R = number, - Parent = MatrixOverTimeHistogramData, - TContext = SiemContext - > = Resolver; - export type YResolver< - R = number, - Parent = MatrixOverTimeHistogramData, - TContext = SiemContext - > = Resolver; - export type GResolver< - R = string, - Parent = MatrixOverTimeHistogramData, - TContext = SiemContext - > = Resolver; -} - export namespace TimelineDataResolvers { export interface Resolvers { edges?: EdgesResolver; @@ -8645,6 +8707,9 @@ export type IResolvers = { SourceFields?: SourceFieldsResolvers.Resolvers; SourceStatus?: SourceStatusResolvers.Resolvers; IndexField?: IndexFieldResolvers.Resolvers; + AnomaliesOverTimeData?: AnomaliesOverTimeDataResolvers.Resolvers; + Inspect?: InspectResolvers.Resolvers; + MatrixOverTimeHistogramData?: MatrixOverTimeHistogramDataResolvers.Resolvers; AuthenticationsData?: AuthenticationsDataResolvers.Resolvers; AuthenticationsEdges?: AuthenticationsEdgesResolvers.Resolvers; AuthenticationItem?: AuthenticationItemResolvers.Resolvers; @@ -8657,9 +8722,7 @@ export type IResolvers = { OsEcsFields?: OsEcsFieldsResolvers.Resolvers; CursorType?: CursorTypeResolvers.Resolvers; PageInfoPaginated?: PageInfoPaginatedResolvers.Resolvers; - Inspect?: InspectResolvers.Resolvers; AuthenticationsOverTimeData?: AuthenticationsOverTimeDataResolvers.Resolvers; - MatrixOverTimeHistogramData?: MatrixOverTimeHistogramDataResolvers.Resolvers; TimelineData?: TimelineDataResolvers.Resolvers; TimelineEdges?: TimelineEdgesResolvers.Resolvers; TimelineItem?: TimelineItemResolvers.Resolvers; diff --git a/x-pack/legacy/plugins/siem/server/init_server.ts b/x-pack/legacy/plugins/siem/server/init_server.ts index b040b773c1e536..08c481164d5394 100644 --- a/x-pack/legacy/plugins/siem/server/init_server.ts +++ b/x-pack/legacy/plugins/siem/server/init_server.ts @@ -6,6 +6,7 @@ import { IResolvers, makeExecutableSchema } from 'graphql-tools'; import { schemas } from './graphql'; +import { createAnomaliesResolvers } from './graphql/anomalies'; import { createAuthenticationsResolvers } from './graphql/authentications'; import { createScalarToStringArrayValueResolvers } from './graphql/ecs'; import { createEsValueResolvers, createEventsResolvers } from './graphql/events'; @@ -32,6 +33,7 @@ import { createTlsResolvers } from './graphql/tls'; export const initServer = (libs: AppBackendLibs) => { const schema = makeExecutableSchema({ resolvers: [ + createAnomaliesResolvers(libs) as IResolvers, createAuthenticationsResolvers(libs) as IResolvers, createEsValueResolvers() as IResolvers, createEventsResolvers(libs) as IResolvers, diff --git a/x-pack/legacy/plugins/siem/server/lib/anomalies/elasticsearch_adapter.ts b/x-pack/legacy/plugins/siem/server/lib/anomalies/elasticsearch_adapter.ts new file mode 100644 index 00000000000000..f4b7aff4854e5f --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/lib/anomalies/elasticsearch_adapter.ts @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { getOr } from 'lodash/fp'; + +import { AnomaliesOverTimeData } from '../../graphql/types'; +import { inspectStringifyObject } from '../../utils/build_query'; +import { FrameworkAdapter, FrameworkRequest, RequestBasicOptions } from '../framework'; +import { TermAggregation } from '../types'; + +import { AnomalyHit, AnomaliesAdapter, AnomaliesActionGroupData } from './types'; +import { buildAnomaliesOverTimeQuery } from './query.anomalies_over_time.dsl'; +import { MatrixOverTimeHistogramData } from '../../../public/graphql/types'; + +export class ElasticsearchAnomaliesAdapter implements AnomaliesAdapter { + constructor(private readonly framework: FrameworkAdapter) {} + + public async getAnomaliesOverTime( + request: FrameworkRequest, + options: RequestBasicOptions + ): Promise { + const dsl = buildAnomaliesOverTimeQuery(options); + + const response = await this.framework.callWithRequest( + request, + 'search', + dsl + ); + + const totalCount = getOr(0, 'hits.total.value', response); + const anomaliesOverTimeBucket = getOr([], 'aggregations.anomalyActionGroup.buckets', response); + + const inspect = { + dsl: [inspectStringifyObject(dsl)], + response: [inspectStringifyObject(response)], + }; + return { + inspect, + anomaliesOverTime: getAnomaliesOverTimeByJobId(anomaliesOverTimeBucket), + totalCount, + }; + } +} + +const getAnomaliesOverTimeByJobId = ( + data: AnomaliesActionGroupData[] +): MatrixOverTimeHistogramData[] => { + let result: MatrixOverTimeHistogramData[] = []; + data.forEach(({ key: group, anomalies }) => { + const anomaliesData = getOr([], 'buckets', anomalies).map( + ({ key, doc_count }: { key: number; doc_count: number }) => ({ + x: key, + y: doc_count, + g: group, + }) + ); + result = [...result, ...anomaliesData]; + }); + + return result; +}; diff --git a/x-pack/legacy/plugins/siem/server/lib/anomalies/index.ts b/x-pack/legacy/plugins/siem/server/lib/anomalies/index.ts new file mode 100644 index 00000000000000..7beeea4ad9e4ef --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/lib/anomalies/index.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FrameworkRequest, RequestBasicOptions } from '../framework'; +export * from './elasticsearch_adapter'; +import { AnomaliesAdapter } from './types'; +import { AnomaliesOverTimeData } from '../../../public/graphql/types'; + +export class Anomalies { + constructor(private readonly adapter: AnomaliesAdapter) {} + + public async getAnomaliesOverTime( + req: FrameworkRequest, + options: RequestBasicOptions + ): Promise { + return this.adapter.getAnomaliesOverTime(req, options); + } +} diff --git a/x-pack/legacy/plugins/siem/server/lib/anomalies/query.anomalies_over_time.dsl.ts b/x-pack/legacy/plugins/siem/server/lib/anomalies/query.anomalies_over_time.dsl.ts new file mode 100644 index 00000000000000..34a6a6a8f601f0 --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/lib/anomalies/query.anomalies_over_time.dsl.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createQueryFilterClauses, calculateTimeseriesInterval } from '../../utils/build_query'; +import { RequestBasicOptions } from '../framework'; + +export const buildAnomaliesOverTimeQuery = ({ + filterQuery, + timerange: { from, to }, + defaultIndex, +}: RequestBasicOptions) => { + const filter = [ + ...createQueryFilterClauses(filterQuery), + { + range: { + timestamp: { + gte: from, + lte: to, + }, + }, + }, + ]; + + const getHistogramAggregation = () => { + const interval = calculateTimeseriesInterval(from, to); + const histogramTimestampField = 'timestamp'; + const dateHistogram = { + date_histogram: { + field: histogramTimestampField, + fixed_interval: `${interval}s`, + }, + }; + const autoDateHistogram = { + auto_date_histogram: { + field: histogramTimestampField, + buckets: 36, + }, + }; + return { + anomalyActionGroup: { + terms: { + field: 'job_id', + order: { + _count: 'desc', + }, + size: 10, + }, + aggs: { + anomalies: interval ? dateHistogram : autoDateHistogram, + }, + }, + }; + }; + + const dslQuery = { + index: defaultIndex, + allowNoIndices: true, + ignoreUnavailable: true, + body: { + aggs: getHistogramAggregation(), + query: { + bool: { + filter, + }, + }, + size: 0, + track_total_hits: true, + }, + }; + + return dslQuery; +}; diff --git a/x-pack/legacy/plugins/siem/server/lib/anomalies/types.ts b/x-pack/legacy/plugins/siem/server/lib/anomalies/types.ts new file mode 100644 index 00000000000000..1e13ad88f8af3d --- /dev/null +++ b/x-pack/legacy/plugins/siem/server/lib/anomalies/types.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AnomaliesOverTimeData } from '../../graphql/types'; +import { FrameworkRequest, RequestBasicOptions } from '../framework'; +import { SearchHit } from '../types'; + +export interface AnomaliesAdapter { + getAnomaliesOverTime( + req: FrameworkRequest, + options: RequestBasicOptions + ): Promise; +} + +export interface AnomalySource { + [field: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any +} + +export interface AnomalyHit extends SearchHit { + sort: string[]; + _source: AnomalySource; + aggregations: { + [agg: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any + }; +} + +interface AnomaliesOverTimeHistogramData { + key_as_string: string; + key: number; + doc_count: number; +} + +export interface AnomaliesActionGroupData { + key: number; + anomalies: { + bucket: AnomaliesOverTimeHistogramData[]; + }; + doc_count: number; +} diff --git a/x-pack/legacy/plugins/siem/server/lib/authentications/query.authentications_over_time.dsl.ts b/x-pack/legacy/plugins/siem/server/lib/authentications/query.authentications_over_time.dsl.ts index e2ff0013e063cd..a6b788cb706578 100644 --- a/x-pack/legacy/plugins/siem/server/lib/authentications/query.authentications_over_time.dsl.ts +++ b/x-pack/legacy/plugins/siem/server/lib/authentications/query.authentications_over_time.dsl.ts @@ -27,8 +27,7 @@ export const buildAuthenticationsOverTimeQuery = ({ ]; const getHistogramAggregation = () => { - const minIntervalSeconds = 10; - const interval = calculateTimeseriesInterval(from, to, minIntervalSeconds); + const interval = calculateTimeseriesInterval(from, to); const histogramTimestampField = '@timestamp'; const dateHistogram = { date_histogram: { diff --git a/x-pack/legacy/plugins/siem/server/lib/compose/kibana.ts b/x-pack/legacy/plugins/siem/server/lib/compose/kibana.ts index c09db5bce5cc29..6e0c5e98206e4e 100644 --- a/x-pack/legacy/plugins/siem/server/lib/compose/kibana.ts +++ b/x-pack/legacy/plugins/siem/server/lib/compose/kibana.ts @@ -6,6 +6,8 @@ import { EnvironmentMode } from 'src/core/server'; import { ServerFacade } from '../../types'; +import { Anomalies } from '../anomalies'; +import { ElasticsearchAnomaliesAdapter } from '../anomalies/elasticsearch_adapter'; import { Authentications } from '../authentications'; import { ElasticsearchAuthenticationAdapter } from '../authentications/elasticsearch_adapter'; import { KibanaConfigurationAdapter } from '../configuration/kibana_configuration_adapter'; @@ -43,6 +45,7 @@ export function compose(server: ServerFacade, mode: EnvironmentMode): AppBackend const pinnedEvent = new PinnedEvent({ savedObjects: framework.getSavedObjectsService() }); const domainLibs: AppDomainLibs = { + anomalies: new Anomalies(new ElasticsearchAnomaliesAdapter(framework)), authentications: new Authentications(new ElasticsearchAuthenticationAdapter(framework)), events: new Events(new ElasticsearchEventsAdapter(framework)), fields: new IndexFields(new ElasticsearchIndexFieldAdapter(framework)), diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/README.md b/x-pack/legacy/plugins/siem/server/lib/detection_engine/README.md index c6fc67fde05edb..0a0439a9ace1b0 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/README.md +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/README.md @@ -177,6 +177,17 @@ Every 5 minutes if you get positive hits you will see messages on info like so: server log [09:54:59.013] [info][plugins][siem] Total signals found from signal rule "id: a556065c-0656-4ba1-ad64-a77ca9d2013b", "ruleId: rule-1": 10000 ``` +Signals are space aware and default to the "default" space for these scripts if you do not export +the variable of SPACE_URL. For example, if you want to post rules to the space `test-space` you would +set your SPACE_URL to be: + +```sh +export SPACE_URL=/s/test-space +``` + +So that the scripts prepend a `/s/test-space` in front of all the APIs to correctly create, modify, delete, and update +them from within that space. + See the scripts folder and the tools for more command line fun. Add the `.siem-signals-${your user id}` to your advanced SIEM settings to see any signals diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/create_signals.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/create_signals.ts index 9f472d060def73..420f9954314232 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/create_signals.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/create_signals.ts @@ -40,7 +40,7 @@ export const createSignals = async ({ name, tags: [], alertTypeId: SIGNALS_ID, - alertTypeParams: { + params: { description, ruleId, index, diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.test.ts index dde3f19b1c66dc..39d1fac8f7a09f 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.test.ts @@ -129,11 +129,11 @@ describe('read_signals', () => { test('should return a single value of rule-1 with multiple values', async () => { const result1 = getResult(); result1.id = '4baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result1.alertTypeParams.ruleId = 'rule-1'; + result1.params.ruleId = 'rule-1'; const result2 = getResult(); result2.id = '5baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result2.alertTypeParams.ruleId = 'rule-2'; + result2.params.ruleId = 'rule-2'; const alertsClient = alertsClientMock.create(); alertsClient.get.mockResolvedValue(getResult()); @@ -150,11 +150,11 @@ describe('read_signals', () => { test('should return a single value of rule-2 with multiple values', async () => { const result1 = getResult(); result1.id = '4baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result1.alertTypeParams.ruleId = 'rule-1'; + result1.params.ruleId = 'rule-1'; const result2 = getResult(); result2.id = '5baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result2.alertTypeParams.ruleId = 'rule-2'; + result2.params.ruleId = 'rule-2'; const alertsClient = alertsClientMock.create(); alertsClient.get.mockResolvedValue(getResult()); @@ -171,11 +171,11 @@ describe('read_signals', () => { test('should return null for a made up value with multiple values', async () => { const result1 = getResult(); result1.id = '4baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result1.alertTypeParams.ruleId = 'rule-1'; + result1.params.ruleId = 'rule-1'; const result2 = getResult(); result2.id = '5baa53f8-96da-44ee-ad58-41bccb7f9f3d'; - result2.alertTypeParams.ruleId = 'rule-2'; + result2.params.ruleId = 'rule-2'; const alertsClient = alertsClientMock.create(); alertsClient.get.mockResolvedValue(getResult()); @@ -194,8 +194,8 @@ describe('read_signals', () => { test('returns null if the objects are not of a signal rule type', () => { const signal = findSignalInArrayByRuleId( [ - { alertTypeId: 'made up 1', alertTypeParams: { ruleId: '123' } }, - { alertTypeId: 'made up 2', alertTypeParams: { ruleId: '456' } }, + { alertTypeId: 'made up 1', params: { ruleId: '123' } }, + { alertTypeId: 'made up 2', params: { ruleId: '456' } }, ], '123' ); @@ -205,30 +205,30 @@ describe('read_signals', () => { test('returns correct type if the objects are of a signal rule type', () => { const signal = findSignalInArrayByRuleId( [ - { alertTypeId: SIGNALS_ID, alertTypeParams: { ruleId: '123' } }, - { alertTypeId: 'made up 2', alertTypeParams: { ruleId: '456' } }, + { alertTypeId: SIGNALS_ID, params: { ruleId: '123' } }, + { alertTypeId: 'made up 2', params: { ruleId: '456' } }, ], '123' ); - expect(signal).toEqual({ alertTypeId: 'siem.signals', alertTypeParams: { ruleId: '123' } }); + expect(signal).toEqual({ alertTypeId: 'siem.signals', params: { ruleId: '123' } }); }); test('returns second correct type if the objects are of a signal rule type', () => { const signal = findSignalInArrayByRuleId( [ - { alertTypeId: SIGNALS_ID, alertTypeParams: { ruleId: '123' } }, - { alertTypeId: SIGNALS_ID, alertTypeParams: { ruleId: '456' } }, + { alertTypeId: SIGNALS_ID, params: { ruleId: '123' } }, + { alertTypeId: SIGNALS_ID, params: { ruleId: '456' } }, ], '456' ); - expect(signal).toEqual({ alertTypeId: 'siem.signals', alertTypeParams: { ruleId: '456' } }); + expect(signal).toEqual({ alertTypeId: 'siem.signals', params: { ruleId: '456' } }); }); test('returns null with correct types but data does not exist', () => { const signal = findSignalInArrayByRuleId( [ - { alertTypeId: SIGNALS_ID, alertTypeParams: { ruleId: '123' } }, - { alertTypeId: SIGNALS_ID, alertTypeParams: { ruleId: '456' } }, + { alertTypeId: SIGNALS_ID, params: { ruleId: '123' } }, + { alertTypeId: SIGNALS_ID, params: { ruleId: '456' } }, ], '892' ); diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.ts index f73074b560cb24..3c49112aaf50b5 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/read_signals.ts @@ -14,7 +14,7 @@ export const findSignalInArrayByRuleId = ( if (isAlertTypeArray(objects)) { const signals: SignalAlertType[] = objects; const signal: SignalAlertType[] = signals.filter(datum => { - return datum.alertTypeParams.ruleId === ruleId; + return datum.params.ruleId === ruleId; }); if (signal.length !== 0) { return signal[0]; diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/types.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/types.ts index 79e62538b1a7e1..9c6e1f99c672b2 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/types.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/alerts/types.ts @@ -137,7 +137,7 @@ export type AlertTypeParams = Omit ({ name: 'Detect Root/Admin Users', tags: [], alertTypeId: 'siem.signals', - alertTypeParams: { + params: { description: 'Detecting root and admin users', ruleId: 'rule-1', index: ['auditbeat-*', 'filebeat-*', 'packetbeat-*', 'winlogbeat-*'], diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts index 3d7f0a9fd049ac..22dd7be5fbba71 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.test.ts @@ -75,7 +75,7 @@ describe('utils', () => { test('should omit query if query is null', () => { const fullSignal = getResult(); - fullSignal.alertTypeParams.query = null; + fullSignal.params.query = null; const signal = transformAlertToSignal(fullSignal); expect(signal).toEqual({ created_by: 'elastic', @@ -105,7 +105,7 @@ describe('utils', () => { test('should omit query if query is undefined', () => { const fullSignal = getResult(); - fullSignal.alertTypeParams.query = undefined; + fullSignal.params.query = undefined; const signal = transformAlertToSignal(fullSignal); expect(signal).toEqual({ created_by: 'elastic', @@ -135,8 +135,8 @@ describe('utils', () => { test('should omit a mix of undefined, null, and missing fields', () => { const fullSignal = getResult(); - fullSignal.alertTypeParams.query = undefined; - fullSignal.alertTypeParams.language = null; + fullSignal.params.query = undefined; + fullSignal.params.language = null; const { from, enabled, ...omitData } = transformAlertToSignal(fullSignal); expect(omitData).toEqual({ created_by: 'elastic', @@ -194,7 +194,7 @@ describe('utils', () => { test('should return immutable is equal to false', () => { const fullSignal = getResult(); - fullSignal.alertTypeParams.immutable = false; + fullSignal.params.immutable = false; const signalWithEnabledFalse = transformAlertToSignal(fullSignal); expect(signalWithEnabledFalse).toEqual({ created_by: 'elastic', diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts index bf39d9d16b2b96..e3a677741efca2 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/utils.ts @@ -29,32 +29,32 @@ export const getIdError = ({ export const transformAlertToSignal = (signal: SignalAlertType): Partial => { return pickBy((value: unknown) => value != null, { created_by: signal.createdBy, - description: signal.alertTypeParams.description, + description: signal.params.description, enabled: signal.enabled, - false_positives: signal.alertTypeParams.falsePositives, - filter: signal.alertTypeParams.filter, - filters: signal.alertTypeParams.filters, - from: signal.alertTypeParams.from, + false_positives: signal.params.falsePositives, + filter: signal.params.filter, + filters: signal.params.filters, + from: signal.params.from, id: signal.id, - immutable: signal.alertTypeParams.immutable, - index: signal.alertTypeParams.index, + immutable: signal.params.immutable, + index: signal.params.index, interval: signal.interval, - rule_id: signal.alertTypeParams.ruleId, - language: signal.alertTypeParams.language, - output_index: signal.alertTypeParams.outputIndex, - max_signals: signal.alertTypeParams.maxSignals, - risk_score: signal.alertTypeParams.riskScore, + rule_id: signal.params.ruleId, + language: signal.params.language, + output_index: signal.params.outputIndex, + max_signals: signal.params.maxSignals, + risk_score: signal.params.riskScore, name: signal.name, - query: signal.alertTypeParams.query, - references: signal.alertTypeParams.references, - saved_id: signal.alertTypeParams.savedId, - meta: signal.alertTypeParams.meta, - severity: signal.alertTypeParams.severity, - size: signal.alertTypeParams.size, + query: signal.params.query, + references: signal.params.references, + saved_id: signal.params.savedId, + meta: signal.params.meta, + severity: signal.params.severity, + size: signal.params.size, updated_by: signal.updatedBy, - tags: signal.alertTypeParams.tags, - to: signal.alertTypeParams.to, - type: signal.alertTypeParams.type, + tags: signal.params.tags, + to: signal.params.to, + type: signal.params.type, }); }; diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_id.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_id.sh index 73882c78edfb83..25cd4bfd336284 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_id.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_id.sh @@ -13,4 +13,4 @@ set -e curl -s -k \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X DELETE ${KIBANA_URL}/api/detection_engine/rules?id="$1" | jq . + -X DELETE ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules?id="$1" | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_rule_id.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_rule_id.sh index 2b51146e6e1a0d..b74ee260ad8adb 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_rule_id.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/delete_signal_by_rule_id.sh @@ -13,4 +13,4 @@ set -e curl -s -k \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X DELETE ${KIBANA_URL}/api/detection_engine/rules?rule_id="$1" | jq . + -X DELETE ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules?rule_id="$1" | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_saved_object.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_saved_object.sh index 2b26c939a924c7..fbcd159cd24e8d 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_saved_object.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_saved_object.sh @@ -18,5 +18,5 @@ TYPE=${1:-alert} # https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html#saved-objects-api-find-request curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/saved_objects/_find?type=$TYPE \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/saved_objects/_find?type=$TYPE \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signal_by_filter.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signal_by_filter.sh index 6136f66025f3d0..34c3c401b41120 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signal_by_filter.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signal_by_filter.sh @@ -17,4 +17,4 @@ FILTER=${1:-'alert.attributes.enabled:%20true'} # Table of them for testing if needed: https://www.w3schools.com/tags/ref_urlencode.asp curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/detection_engine/rules/_find?filter=$FILTER | jq . + -X GET ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_find?filter=$FILTER | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals.sh index 473c7869361906..4542eb7c9a8273 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals.sh @@ -12,4 +12,4 @@ set -e # Example: ./find_signals.sh curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/detection_engine/rules/_find | jq . + -X GET ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_find | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals_sort.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals_sort.sh index 3f8bab28544e36..122f18bbb80e5b 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals_sort.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/find_signals_sort.sh @@ -15,5 +15,5 @@ ORDER=${2:-'asc'} # Example: ./find_signals_sort.sh enabled asc curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET "${KIBANA_URL}/api/detection_engine/rules/_find?sort_field=$SORT&sort_order=$ORDER" \ + -X GET "${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules/_find?sort_field=$SORT&sort_order=$ORDER" \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh index e2177bb750057b..7804439ce07345 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_instances.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/actions/README.md#get-apiaction_find-find-actions curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/action/_find \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/action/_find \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh index 7937f2f99a37f2..8d8cbdd70a8036 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_action_types.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/actions/README.md curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/action/types \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/action/types \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_instances.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_instances.sh index 3abc8c9adee621..f42d4a52594a7b 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_instances.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_instances.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/alerting/README.md#get-apialert_find-find-alerts curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/alert/_find \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/alert/_find \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_types.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_types.sh index 7f7361a6252bc5..a7c6fa567ecdd8 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_types.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_alert_types.sh @@ -13,5 +13,5 @@ set -e # https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/alerting/README.md#get-apialerttypes-list-alert-types curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/alert/types \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/alert/types \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_saved_objects.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_saved_objects.sh index 4829beba867437..5b5344bc205ff6 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_saved_objects.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_saved_objects.sh @@ -14,5 +14,5 @@ set -e # https://www.elastic.co/guide/en/kibana/master/saved-objects-api-get.html curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/saved_objects/$1/$2 \ + -X GET ${KIBANA_URL}${SPACE_URL}/api/saved_objects/$1/$2 \ | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_id.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_id.sh index d10f347ff1f9e8..239a04846b11ab 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_id.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_id.sh @@ -12,4 +12,4 @@ set -e # Example: ./get_signal_by_id.sh {rule_id} curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/detection_engine/rules?id="$1" | jq . + -X GET ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules?id="$1" | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_rule_id.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_rule_id.sh index 302936fcb523e2..5100caac32491b 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_rule_id.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/get_signal_by_rule_id.sh @@ -12,4 +12,4 @@ set -e # Example: ./get_signal_by_rule_id.sh {rule_id} curl -s -k \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X GET ${KIBANA_URL}/api/detection_engine/rules?rule_id="$1" | jq . + -X GET ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules?rule_id="$1" | jq . diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_signal.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_signal.sh index ee097578355041..8455e7d27ad472 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_signal.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_signal.sh @@ -23,7 +23,7 @@ do { -H 'Content-Type: application/json' \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X POST ${KIBANA_URL}/api/detection_engine/rules \ + -X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules \ -d "$POST" \ | jq .; } & diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_x_signals.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_x_signals.sh index 5a4afe6f1806dd..8362c576ff554c 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_x_signals.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/post_x_signals.sh @@ -20,7 +20,7 @@ do { -H 'Content-Type: application/json' \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X POST ${KIBANA_URL}/api/detection_engine/rules \ + -X POST ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules \ --data "{ \"rule_id\": \"${i}\", \"risk_score\": \"50\", diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_1.json b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_1.json index 4ecda8056837a4..d5559ebe23bdb6 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_1.json +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_1.json @@ -10,5 +10,5 @@ "type": "saved_query", "from": "now-6m", "to": "now", - "saved_id": "Test Query From SIEM" + "saved_id": "test-saveid" } diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_2.json b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_2.json index 4bf175c1622abb..e272273d817d29 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_2.json +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_2.json @@ -10,7 +10,7 @@ "type": "saved_query", "from": "now-6m", "to": "now", - "saved_id": "Test Query From SIEM Two", + "saved_id": "test-saveid-2", "query": "user.name: root or user.name: admin", "language": "kuery" } diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_3.json b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_3.json index d41921e367d874..9fc2c32c7daf11 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_3.json +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/signals/root_or_admin_saved_query_3.json @@ -10,5 +10,5 @@ "type": "saved_query", "from": "now-6m", "to": "now", - "saved_id": "Test Query From SIEM Three" + "saved_id": "test-saveid-3" } diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/update_signal.sh b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/update_signal.sh index 30ba9a709f449d..6984e7b4c810b0 100755 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/update_signal.sh +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/scripts/update_signal.sh @@ -23,7 +23,7 @@ do { -H 'Content-Type: application/json' \ -H 'kbn-xsrf: 123' \ -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \ - -X PUT ${KIBANA_URL}/api/detection_engine/rules \ + -X PUT ${KIBANA_URL}${SPACE_URL}/api/detection_engine/rules \ -d "$POST" \ | jq .; } & diff --git a/x-pack/legacy/plugins/siem/server/lib/events/query.events_over_time.dsl.ts b/x-pack/legacy/plugins/siem/server/lib/events/query.events_over_time.dsl.ts index e655485638e167..98bd6944c1b519 100644 --- a/x-pack/legacy/plugins/siem/server/lib/events/query.events_over_time.dsl.ts +++ b/x-pack/legacy/plugins/siem/server/lib/events/query.events_over_time.dsl.ts @@ -27,8 +27,7 @@ export const buildEventsOverTimeQuery = ({ ]; const getHistogramAggregation = () => { - const minIntervalSeconds = 10; - const interval = calculateTimeseriesInterval(from, to, minIntervalSeconds); + const interval = calculateTimeseriesInterval(from, to); const histogramTimestampField = '@timestamp'; const dateHistogram = { date_histogram: { diff --git a/x-pack/legacy/plugins/siem/server/lib/types.ts b/x-pack/legacy/plugins/siem/server/lib/types.ts index a5429ebf76517f..13d040b969545a 100644 --- a/x-pack/legacy/plugins/siem/server/lib/types.ts +++ b/x-pack/legacy/plugins/siem/server/lib/types.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Anomalies } from './anomalies'; import { Authentications } from './authentications'; import { ConfigurationAdapter } from './configuration'; import { Events } from './events'; @@ -27,6 +28,7 @@ import { SignalAlertParamsRest } from './detection_engine/alerts/types'; export * from './hosts'; export interface AppDomainLibs { + anomalies: Anomalies; authentications: Authentications; events: Events; fields: IndexFields; diff --git a/x-pack/legacy/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts b/x-pack/legacy/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts index 3eaaa6c30a4fa5..752c686b243ac6 100644 --- a/x-pack/legacy/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts +++ b/x-pack/legacy/plugins/siem/server/utils/build_query/calculate_timeseries_interval.ts @@ -91,8 +91,7 @@ export const calculateAuto = { export const calculateTimeseriesInterval = ( lowerBoundInMsSinceEpoch: number, - upperBoundInMsSinceEpoch: number, - minIntervalSeconds: number + upperBoundInMsSinceEpoch: number ) => { const duration = moment.duration(upperBoundInMsSinceEpoch - lowerBoundInMsSinceEpoch, 'ms'); diff --git a/x-pack/legacy/plugins/task_manager/index.ts b/x-pack/legacy/plugins/task_manager/index.ts index 0fda1490de7141..0487b003bc1efd 100644 --- a/x-pack/legacy/plugins/task_manager/index.ts +++ b/x-pack/legacy/plugins/task_manager/index.ts @@ -72,16 +72,7 @@ export function taskManager(kibana: any) { } ); this.kbnServer.afterPluginsInit(() => { - (async () => { - // The code block below can't await directly within "afterPluginsInit" - // callback due to circular dependency. The server isn't "ready" until - // this code block finishes. Migrations wait for server to be ready before - // executing. Saved objects repository waits for migrations to finish before - // finishing the request. To avoid this, we'll await within a separate - // function block. - await this.kbnServer.server.kibanaMigrator.runMigrations(); - plugin.start(); - })(); + plugin.start(); }); server.expose(setupContract); }, diff --git a/x-pack/legacy/plugins/transform/public/app/common/pivot_aggs.ts b/x-pack/legacy/plugins/transform/public/app/common/pivot_aggs.ts index adc4bfd1b59180..af55732691bb0e 100644 --- a/x-pack/legacy/plugins/transform/public/app/common/pivot_aggs.ts +++ b/x-pack/legacy/plugins/transform/public/app/common/pivot_aggs.ts @@ -5,7 +5,7 @@ */ import { Dictionary } from '../../../common/types/common'; -import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/common'; import { AggName } from './aggregations'; import { EsFieldName } from './fields'; diff --git a/x-pack/legacy/plugins/transform/public/app/common/pivot_group_by.ts b/x-pack/legacy/plugins/transform/public/app/common/pivot_group_by.ts index 85daad6c7fd52f..e6792958ab5d2f 100644 --- a/x-pack/legacy/plugins/transform/public/app/common/pivot_group_by.ts +++ b/x-pack/legacy/plugins/transform/public/app/common/pivot_group_by.ts @@ -5,7 +5,7 @@ */ import { Dictionary } from '../../../common/types/common'; -import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; +import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/common'; import { AggName } from './aggregations'; import { EsFieldName } from './fields'; diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/index.ts b/x-pack/legacy/plugins/transform/public/app/lib/kibana/index.ts index 08cf7d0046e971..82d5362e21c020 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/index.ts +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/index.ts @@ -5,10 +5,12 @@ */ export { - isKibanaContextInitialized, + useKibanaContext, + InitializedKibanaContextValue, KibanaContext, KibanaContextValue, SavedSearchQuery, + RenderOnlyWithInitializedKibanaContext, } from './kibana_context'; export { KibanaProvider } from './kibana_provider'; export { useCurrentIndexPattern } from './use_current_index_pattern'; diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx index 2e4f0dfd4696a9..e3515991e7bb1f 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/kibana_context.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { createContext } from 'react'; +import React, { createContext, useContext, FC } from 'react'; import { IndexPattern as IndexPatternType, @@ -15,14 +15,15 @@ import { SavedSearch } from '../../../../../../../../src/legacy/core_plugins/kib import { KibanaConfig } from '../../../../../../../../src/legacy/server/kbn_server'; // set() method is missing in original d.ts -export interface KibanaConfigTypeFix extends KibanaConfig { +interface KibanaConfigTypeFix extends KibanaConfig { set(key: string, value: any): void; } interface UninitializedKibanaContextValue { initialized: boolean; } -interface InitializedKibanaContextValue { + +export interface InitializedKibanaContextValue { combinedQuery: any; currentIndexPattern: IndexPatternType; currentSavedSearch: SavedSearch; @@ -41,3 +42,37 @@ export function isKibanaContextInitialized(arg: any): arg is InitializedKibanaCo export type SavedSearchQuery = object; export const KibanaContext = createContext({ initialized: false }); + +/** + * Custom hook to get the current kibanaContext. + * + * @remarks + * This hook should only be used in components wrapped in `RenderOnlyWithInitializedKibanaContext`, + * otherwise it will throw an error when KibanaContext hasn't been initialized yet. + * In return you get the benefit of not having to check if it's been initialized in the component + * where it's used. + * + * @returns `kibanaContext` + */ +export const useKibanaContext = () => { + const kibanaContext = useContext(KibanaContext); + + if (!isKibanaContextInitialized(kibanaContext)) { + throw new Error('useKibanaContext: kibanaContext not initialized'); + } + + return kibanaContext; +}; + +/** + * Wrapper component to render children only if `kibanaContext` has been initialized. + * In combination with `useKibanaContext` this avoids having to check for the initialization + * in consuming components. + * + * @returns `children` or `null` depending on whether `kibanaContext` is initialized or not. + */ +export const RenderOnlyWithInitializedKibanaContext: FC = ({ children }) => { + const kibanaContext = useContext(KibanaContext); + + return isKibanaContextInitialized(kibanaContext) ? <>{children} : null; +}; diff --git a/x-pack/legacy/plugins/transform/public/app/lib/kibana/use_current_index_pattern.ts b/x-pack/legacy/plugins/transform/public/app/lib/kibana/use_current_index_pattern.ts index e4b0725c324b4f..12c5bde171b8ba 100644 --- a/x-pack/legacy/plugins/transform/public/app/lib/kibana/use_current_index_pattern.ts +++ b/x-pack/legacy/plugins/transform/public/app/lib/kibana/use_current_index_pattern.ts @@ -12,7 +12,7 @@ export const useCurrentIndexPattern = () => { const context = useContext(KibanaContext); if (!isKibanaContextInitialized(context)) { - throw new Error('currentIndexPattern is undefined'); + throw new Error('useCurrentIndexPattern: kibanaContext not initialized'); } return context.currentIndexPattern; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx index 289ea62a57ab14..2b7d36cada3c6f 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/source_index_preview/source_index_preview.tsx @@ -31,7 +31,7 @@ import { import { ColumnType, - MlInMemoryTableBasic, + mlInMemoryTableBasicFactory, SortingPropType, SORT_DIRECTION, } from '../../../../../shared_imports'; @@ -183,8 +183,8 @@ export const SourceIndexPreview: React.FC = React.memo(({ cellClick, quer docFieldsCount = docFields.length; } - const columns: ColumnType[] = selectedFields.map(k => { - const column: ColumnType = { + const columns: Array> = selectedFields.map(k => { + const column: ColumnType = { field: `_source["${k}"]`, name: k, sortable: true, @@ -319,6 +319,8 @@ export const SourceIndexPreview: React.FC = React.memo(({ cellClick, quer defaultMessage: 'Copy Dev Console statement of the source index preview to the clipboard.', }); + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + return ( @@ -410,6 +412,9 @@ export const SourceIndexPreview: React.FC = React.memo(({ cellClick, quer itemId="_id" itemIdToExpandedRowMap={itemIdToExpandedRowMap} isExpandable={true} + rowProps={item => ({ + 'data-test-subj': `transformSourceIndexPreviewRow row-${item._id}`, + })} sorting={sorting} /> )} diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx index 9ab3edbe8ad6be..2ca3253d72b449 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_create/step_create_form.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { Fragment, FC, useContext, useEffect, useState } from 'react'; +import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { toastNotifications } from 'ui/notify'; @@ -32,7 +32,7 @@ import { import { toMountPoint } from '../../../../../../../../../../src/plugins/kibana_react/public'; import { ToastNotificationText } from '../../../../components'; import { useApi } from '../../../../hooks/use_api'; -import { isKibanaContextInitialized, KibanaContext } from '../../../../lib/kibana'; +import { useKibanaContext } from '../../../../lib/kibana'; import { RedirectToTransformManagement } from '../../../../common/navigation'; import { PROGRESS_REFRESH_INTERVAL_MS } from '../../../../../../common/constants'; @@ -73,7 +73,7 @@ export const StepCreateForm: FC = React.memo( undefined ); - const kibanaContext = useContext(KibanaContext); + const kibanaContext = useKibanaContext(); useEffect(() => { onChange({ created, started, indexPatternId }); @@ -83,10 +83,6 @@ export const StepCreateForm: FC = React.memo( const api = useApi(); - if (!isKibanaContextInitialized(kibanaContext)) { - return null; - } - async function createTransform() { setCreated(true); @@ -151,8 +147,8 @@ export const StepCreateForm: FC = React.memo( } async function createAndStartTransform() { - const success = await createTransform(); - if (success) { + const acknowledged = await createTransform(); + if (acknowledged) { await startTransform(); } } diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx index ad7ef04c397606..3f4c7e21d3947b 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/pivot_preview.tsx @@ -21,7 +21,11 @@ import { EuiTitle, } from '@elastic/eui'; -import { ColumnType, MlInMemoryTableBasic, SORT_DIRECTION } from '../../../../../shared_imports'; +import { + ColumnType, + mlInMemoryTableBasicFactory, + SORT_DIRECTION, +} from '../../../../../shared_imports'; import { dictionaryToArray } from '../../../../../../common/types/common'; import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils'; @@ -38,7 +42,7 @@ import { } from '../../../../common'; import { getPivotPreviewDevConsoleStatement } from './common'; -import { PIVOT_PREVIEW_STATUS, usePivotPreviewData } from './use_pivot_preview_data'; +import { PreviewItem, PIVOT_PREVIEW_STATUS, usePivotPreviewData } from './use_pivot_preview_data'; function sortColumns(groupByArr: PivotGroupByConfig[]) { return (a: string, b: string) => { @@ -210,7 +214,7 @@ export const PivotPreview: FC = React.memo(({ aggs, groupBy, columnKeys.sort(sortColumns(groupByArr)); const columns = columnKeys.map(k => { - const column: ColumnType = { + const column: ColumnType = { field: k, name: k, sortable: true, @@ -256,6 +260,8 @@ export const PivotPreview: FC = React.memo(({ aggs, groupBy, }, }; + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + return ( @@ -273,6 +279,9 @@ export const PivotPreview: FC = React.memo(({ aggs, groupBy, initialPageSize: 5, pageSizeOptions: [5, 10, 25], }} + rowProps={() => ({ + 'data-test-subj': 'transformPivotPreviewRow', + })} sorting={sorting} /> )} diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx index ebb0660cac55f2..b8f63ef697e78c 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_form.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { Fragment, FC, useContext, useEffect, useState } from 'react'; +import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; @@ -37,9 +37,8 @@ import { KqlFilterBar } from '../../../../../shared_imports'; import { SwitchModal } from './switch_modal'; import { - isKibanaContextInitialized, - KibanaContext, - KibanaContextValue, + useKibanaContext, + InitializedKibanaContextValue, SavedSearchQuery, } from '../../../../lib/kibana'; @@ -75,7 +74,7 @@ const defaultSearch = '*'; const emptySearch = ''; export function getDefaultStepDefineState( - kibanaContext: KibanaContextValue + kibanaContext: InitializedKibanaContextValue ): StepDefineExposedState { return { aggList: {} as PivotAggsConfigDict, @@ -83,13 +82,9 @@ export function getDefaultStepDefineState( isAdvancedPivotEditorEnabled: false, isAdvancedSourceEditorEnabled: false, searchString: - isKibanaContextInitialized(kibanaContext) && kibanaContext.currentSavedSearch !== undefined - ? kibanaContext.combinedQuery - : defaultSearch, + kibanaContext.currentSavedSearch !== undefined ? kibanaContext.combinedQuery : defaultSearch, searchQuery: - isKibanaContextInitialized(kibanaContext) && kibanaContext.currentSavedSearch !== undefined - ? kibanaContext.combinedQuery - : defaultSearch, + kibanaContext.currentSavedSearch !== undefined ? kibanaContext.combinedQuery : defaultSearch, sourceConfigUpdated: false, valid: false, }; @@ -196,7 +191,7 @@ interface Props { } export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange }) => { - const kibanaContext = useContext(KibanaContext); + const kibanaContext = useKibanaContext(); const defaults = { ...getDefaultStepDefineState(kibanaContext), ...overrides }; @@ -224,10 +219,6 @@ export const StepDefineForm: FC = React.memo(({ overrides = {}, onChange // The list of selected group by fields const [groupByList, setGroupByList] = useState(defaults.groupByList); - if (!isKibanaContextInitialized(kibanaContext)) { - return null; - } - const indexPattern = kibanaContext.currentIndexPattern; const { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx index bb900766483df4..30c447f62c7600 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/step_define_summary.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useContext, Fragment, FC } from 'react'; +import React, { Fragment, FC } from 'react'; import { i18n } from '@kbn/i18n'; @@ -17,7 +17,7 @@ import { EuiText, } from '@elastic/eui'; -import { isKibanaContextInitialized, KibanaContext } from '../../../../lib/kibana'; +import { useKibanaContext } from '../../../../lib/kibana'; import { AggListSummary } from '../aggregation_list'; import { GroupByListSummary } from '../group_by_list'; @@ -35,11 +35,7 @@ export const StepDefineSummary: FC = ({ groupByList, aggList, }) => { - const kibanaContext = useContext(KibanaContext); - - if (!isKibanaContextInitialized(kibanaContext)) { - return null; - } + const kibanaContext = useKibanaContext(); const pivotQuery = getPivotQuery(searchQuery); let useCodeBlock = false; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts index 92e3bdded4f6a1..e02f2473fc10b8 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_define/use_pivot_preview_data.ts @@ -32,7 +32,8 @@ interface EsMappingType { type: ES_FIELD_TYPES; } -type PreviewData = Array>; +export type PreviewItem = Dictionary; +type PreviewData = PreviewItem[]; interface PreviewMappings { properties: Dictionary; } diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx index ef6159a1f7bb07..a01481fde343c0 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/step_details/step_details_form.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { Fragment, FC, useContext, useEffect, useState } from 'react'; +import React, { Fragment, FC, useEffect, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { metadata } from 'ui/metadata'; @@ -13,7 +13,7 @@ import { toastNotifications } from 'ui/notify'; import { EuiLink, EuiSwitch, EuiFieldText, EuiForm, EuiFormRow, EuiSelect } from '@elastic/eui'; import { toMountPoint } from '../../../../../../../../../../src/plugins/kibana_react/public'; -import { isKibanaContextInitialized, KibanaContext } from '../../../../lib/kibana'; +import { useKibanaContext } from '../../../../lib/kibana'; import { isValidIndexName } from '../../../../../../common/utils/es_utils'; import { ToastNotificationText } from '../../../../components'; @@ -55,7 +55,7 @@ interface Props { } export const StepDetailsForm: FC = React.memo(({ overrides = {}, onChange }) => { - const kibanaContext = useContext(KibanaContext); + const kibanaContext = useKibanaContext(); const defaults = { ...getDefaultStepDetailsState(), ...overrides }; @@ -80,56 +80,47 @@ export const StepDetailsForm: FC = React.memo(({ overrides = {}, onChange useEffect(() => { // use an IIFE to avoid returning a Promise to useEffect. (async function() { - if (isKibanaContextInitialized(kibanaContext)) { - try { - setTransformIds( - (await api.getTransforms()).transforms.map( - (transform: TransformPivotConfig) => transform.id - ) - ); - } catch (e) { - toastNotifications.addDanger({ - title: i18n.translate('xpack.transform.stepDetailsForm.errorGettingTransformList', { - defaultMessage: 'An error occurred getting the existing transform IDs:', - }), - text: toMountPoint(), - }); - } + try { + setTransformIds( + (await api.getTransforms()).transforms.map( + (transform: TransformPivotConfig) => transform.id + ) + ); + } catch (e) { + toastNotifications.addDanger({ + title: i18n.translate('xpack.transform.stepDetailsForm.errorGettingTransformList', { + defaultMessage: 'An error occurred getting the existing transform IDs:', + }), + text: toMountPoint(), + }); + } - try { - setIndexNames((await api.getIndices()).map(index => index.name)); - } catch (e) { - toastNotifications.addDanger({ - title: i18n.translate('xpack.transform.stepDetailsForm.errorGettingIndexNames', { - defaultMessage: 'An error occurred getting the existing index names:', - }), - text: toMountPoint(), - }); - } + try { + setIndexNames((await api.getIndices()).map(index => index.name)); + } catch (e) { + toastNotifications.addDanger({ + title: i18n.translate('xpack.transform.stepDetailsForm.errorGettingIndexNames', { + defaultMessage: 'An error occurred getting the existing index names:', + }), + text: toMountPoint(), + }); + } - try { - setIndexPatternTitles(await kibanaContext.indexPatterns.getTitles()); - } catch (e) { - toastNotifications.addDanger({ - title: i18n.translate( - 'xpack.transform.stepDetailsForm.errorGettingIndexPatternTitles', - { - defaultMessage: 'An error occurred getting the existing index pattern titles:', - } - ), - text: toMountPoint(), - }); - } + try { + setIndexPatternTitles(await kibanaContext.indexPatterns.getTitles()); + } catch (e) { + toastNotifications.addDanger({ + title: i18n.translate('xpack.transform.stepDetailsForm.errorGettingIndexPatternTitles', { + defaultMessage: 'An error occurred getting the existing index pattern titles:', + }), + text: toMountPoint(), + }); } })(); // custom comparison // eslint-disable-next-line react-hooks/exhaustive-deps }, [kibanaContext.initialized]); - if (!isKibanaContextInitialized(kibanaContext)) { - return null; - } - const dateFieldNames = kibanaContext.currentIndexPattern.fields .filter(f => f.type === 'date') .map(f => f.name) diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/wizard/wizard.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/wizard/wizard.tsx index 25d3915a1eae92..109cf81da6caaf 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/wizard/wizard.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/components/wizard/wizard.tsx @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { Fragment, FC, useContext, useEffect, useRef, useState } from 'react'; +import React, { Fragment, FC, useEffect, useRef, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSteps, EuiStepStatus } from '@elastic/eui'; -import { isKibanaContextInitialized, KibanaContext } from '../../../../lib/kibana'; +import { useKibanaContext } from '../../../../lib/kibana'; import { getCreateRequestBody } from '../../../../common'; @@ -68,7 +68,7 @@ const StepDefine: FC = ({ }; export const Wizard: FC = React.memo(() => { - const kibanaContext = useContext(KibanaContext); + const kibanaContext = useKibanaContext(); // The current WIZARD_STEP const [currentStep, setCurrentStep] = useState(WIZARD_STEPS.DEFINE); @@ -108,11 +108,6 @@ export const Wizard: FC = React.memo(() => { } }, []); - if (!isKibanaContextInitialized(kibanaContext)) { - // TODO proper loading indicator - return null; - } - const indexPattern = kibanaContext.currentIndexPattern; const transformConfig = getCreateRequestBody( @@ -134,18 +129,6 @@ export const Wizard: FC = React.memo(() => { ); - // scroll to the currently selected wizard step - /* - function scrollToRef() { - if (definePivotRef !== null && definePivotRef.current !== null) { - // TODO Fix types - const dummy = definePivotRef as any; - const headerOffset = 70; - window.scrollTo(0, dummy.current.offsetTop - headerOffset); - } - } - */ - const stepsConfig = [ { title: i18n.translate('xpack.transform.transformsWizard.stepDefineTitle', { @@ -171,7 +154,6 @@ export const Wizard: FC = React.memo(() => { { setCurrentStep(WIZARD_STEPS.DEFINE); - // scrollToRef(); }} next={() => setCurrentStep(WIZARD_STEPS.CREATE)} nextActive={stepDetailsState.valid} diff --git a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx index 2214d1f5adfff8..f63f3b6d6e7bef 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/create_transform/create_transform_section.tsx @@ -26,7 +26,7 @@ import { APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES } from '../../../../common/cons import { breadcrumbService, docTitleService, BREADCRUMB_SECTION } from '../../services/navigation'; import { documentationLinksService } from '../../services/documentation'; import { PrivilegesWrapper } from '../../lib/authorization'; -import { KibanaProvider } from '../../lib/kibana'; +import { KibanaProvider, RenderOnlyWithInitializedKibanaContext } from '../../lib/kibana'; import { Wizard } from './components/wizard'; @@ -82,7 +82,9 @@ export const CreateTransformSection: FC = ({ match }) => { - + + + diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap index 40ad836ad99692..1f134cd39948b4 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row.test.tsx.snap @@ -90,7 +90,8 @@ exports[`Transform: Transform List Minimal initialization 1`] = ] } />, - "id": "transform-details", + "data-test-subj": "transformDetailsTab", + "id": "transform-details-tab-fq_date_histogram_1m_1441", "name": "Transform details", } } @@ -188,7 +189,8 @@ exports[`Transform: Transform List Minimal initialization 1`] = ] } />, - "id": "transform-details", + "data-test-subj": "transformDetailsTab", + "id": "transform-details-tab-fq_date_histogram_1m_1441", "name": "Transform details", }, Object { @@ -229,14 +231,16 @@ exports[`Transform: Transform List Minimal initialization 1`] = } } />, - "id": "transform-json", + "data-test-subj": "transformJsonTab", + "id": "transform-json-tab-fq_date_histogram_1m_1441", "name": "JSON", }, Object { "content": , - "id": "transform-messages", + "data-test-subj": "transformMessagesTab", + "id": "transform-messages-tab-fq_date_histogram_1m_1441", "name": "Messages", }, Object { @@ -277,7 +281,8 @@ exports[`Transform: Transform List Minimal initialization 1`] = } } />, - "id": "transform-preview", + "data-test-subj": "transformPreviewTab", + "id": "transform-preview-tab-fq_date_histogram_1m_1441", "name": "Preview", }, ] diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_details_pane.test.tsx.snap b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_details_pane.test.tsx.snap index b55a1c410d687a..39964399f66dbb 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_details_pane.test.tsx.snap +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_details_pane.test.tsx.snap @@ -1,40 +1,44 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Transform: Job List Expanded Row Minimal initialization 1`] = ` - - + + - -
+ +
+ + - - - + +
`; exports[`Transform: Job List Expanded Row
Minimal initialization 1`] = ` diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_json_pane.test.tsx.snap b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_json_pane.test.tsx.snap index 0d4a80a94ee518..dea6f57bcaab08 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_json_pane.test.tsx.snap +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/__snapshots__/expanded_row_json_pane.test.tsx.snap @@ -1,22 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Transform: Transform List Expanded Row Minimal initialization 1`] = ` - - - - + + + + Minimal \\"version\\": \\"8.0.0\\", \\"create_time\\": 1564388146667 }" - /> - - -   - - + /> + + +   + + + `; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx index 19ab74cc9ed851..050dedbc8e0b43 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/columns.tsx @@ -88,14 +88,14 @@ export const getColumns = ( const columns: [ ExpanderColumnType, - FieldDataColumnType, - FieldDataColumnType, - FieldDataColumnType, - FieldDataColumnType, - ComputedColumnType, - ComputedColumnType, - ComputedColumnType, - ActionsColumnType + FieldDataColumnType, + FieldDataColumnType, + FieldDataColumnType, + FieldDataColumnType, + ComputedColumnType, + ComputedColumnType, + ComputedColumnType, + ActionsColumnType ] = [ { align: RIGHT_ALIGNMENT, diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx index 687bb0df3f5775..c02b7e9ce5b1bb 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row.tsx @@ -121,7 +121,8 @@ export const ExpandedRow: FC = ({ item }) => { const tabs = [ { - id: 'transform-details', + id: `transform-details-tab-${item.id}`, + 'data-test-subj': 'transformDetailsTab', name: i18n.translate( 'xpack.transform.transformList.transformDetails.tabs.transformSettingsLabel', { @@ -131,12 +132,14 @@ export const ExpandedRow: FC = ({ item }) => { content: , }, { - id: 'transform-json', + id: `transform-json-tab-${item.id}`, + 'data-test-subj': 'transformJsonTab', name: 'JSON', content: , }, { - id: 'transform-messages', + id: `transform-messages-tab-${item.id}`, + 'data-test-subj': 'transformMessagesTab', name: i18n.translate( 'xpack.transform.transformList.transformDetails.tabs.transformMessagesLabel', { @@ -146,7 +149,8 @@ export const ExpandedRow: FC = ({ item }) => { content: , }, { - id: 'transform-preview', + id: `transform-preview-tab-${item.id}`, + 'data-test-subj': 'transformPreviewTab', name: i18n.translate( 'xpack.transform.transformList.transformDetails.tabs.transformPreviewLabel', { diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx index cae95286c464d7..527033c46b469a 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_details_pane.tsx @@ -50,27 +50,29 @@ interface ExpandedRowDetailsPaneProps { export const ExpandedRowDetailsPane: FC = ({ sections }) => { return ( - - - {sections - .filter(s => s.position === 'left') - .map(s => ( - - -
- - ))} - - - {sections - .filter(s => s.position === 'right') - .map(s => ( - - -
- - ))} - - +
+ + + {sections + .filter(s => s.position === 'left') + .map(s => ( + + +
+ + ))} + + + {sections + .filter(s => s.position === 'right') + .map(s => ( + + +
+ + ))} + + +
); }; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_json_pane.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_json_pane.tsx index ac7fdcb1295313..6792f4b80f665e 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_json_pane.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_json_pane.tsx @@ -20,18 +20,20 @@ interface Props { export const ExpandedRowJsonPane: FC = ({ json }) => { return ( - - - - - -   - +
+ + + + + +   + +
); }; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_messages_pane.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_messages_pane.tsx index 3f0a9a410f17e2..1aeb93c162847d 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_messages_pane.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_messages_pane.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { Fragment, useState } from 'react'; +import React, { useState } from 'react'; import { EuiSpacer, EuiBasicTable } from '@elastic/eui'; // @ts-ignore @@ -143,7 +143,7 @@ export const ExpandedRowMessagesPane: React.FC = ({ transformId }) => { }; return ( - +
= ({ transformId }) => { pagination={pagination} onChange={onChange} /> - +
); }; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx index 68f2964d41e578..5a5e8308b8d571 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/expanded_row_preview_pane.tsx @@ -14,12 +14,13 @@ import { useApi } from '../../../../hooks/use_api'; import { getFlattenedFields, useRefreshTransformList, + EsDoc, PreviewRequestBody, TransformPivotConfig, } from '../../../../common'; import { ES_FIELD_TYPES } from '../../../../../../../../../../src/plugins/data/public'; import { formatHumanReadableDateTimeSeconds } from '../../../../../../common/utils/date_utils'; -import { TransformTable } from './transform_table'; +import { transformTableFactory } from './transform_table'; interface Props { transformConfig: TransformPivotConfig; @@ -45,12 +46,14 @@ function getDataFromTransform( transformConfig: TransformPivotConfig ): { previewRequest: PreviewRequestBody; groupByArr: string[] | [] } { const index = transformConfig.source.index; + const query = transformConfig.source.query; const pivot = transformConfig.pivot; const groupByArr = []; const previewRequest: PreviewRequestBody = { source: { index, + query, }, pivot, }; @@ -67,8 +70,8 @@ function getDataFromTransform( } export const ExpandedRowPreviewPane: FC = ({ transformConfig }) => { - const [previewData, setPreviewData] = useState([]); - const [columns, setColumns] = useState([]); + const [previewData, setPreviewData] = useState([]); + const [columns, setColumns] = useState> | []>([]); const [pageIndex, setPageIndex] = useState(0); const [pageSize, setPageSize] = useState(10); const [sortField, setSortField] = useState(''); @@ -97,8 +100,8 @@ export const ExpandedRowPreviewPane: FC = ({ transformConfig }) => { const columnKeys = getFlattenedFields(resp.preview[0]); columnKeys.sort(sortColumns(groupByArr)); - const tableColumns: FieldDataColumnType[] = columnKeys.map(k => { - const column: FieldDataColumnType = { + const tableColumns: Array> = columnKeys.map(k => { + const column: FieldDataColumnType = { field: k, name: k, sortable: true, @@ -191,17 +194,27 @@ export const ExpandedRowPreviewPane: FC = ({ transformConfig }) => { setSortDirection(direction); }; + const transformTableLoading = previewData.length === 0 && isLoading === true; + const dataTestSubj = `transformPreviewTabContent${!transformTableLoading ? ' loaded' : ''}`; + + const TransformTable = transformTableFactory(); + return ( - +
+ ({ + 'data-test-subj': 'transformPreviewTabContentRow', + })} + sorting={sorting} + error={errorMessage} + /> +
); }; diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx index 02abadb85fbd0f..e1a65f631df3c6 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_list.tsx @@ -42,7 +42,7 @@ import { StopAction } from './action_stop'; import { ItemIdToExpandedRowMap, Query, Clause } from './common'; import { getColumns } from './columns'; import { ExpandedRow } from './expanded_row'; -import { ProgressBar, TransformTable } from './transform_table'; +import { ProgressBar, transformTableFactory } from './transform_table'; function getItemIdToExpandedRowMap( itemIds: TransformId[], @@ -374,6 +374,8 @@ export const TransformList: FC = ({ onSelectionChange: (selected: TransformListRow[]) => setTransformSelection(selected), }; + const TransformTable = transformTableFactory(); + return (
diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_table.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_table.tsx index cd6f6654a8e9ea..8c7920c124beff 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_table.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/transform_list/transform_table.tsx @@ -11,7 +11,7 @@ import React, { Fragment } from 'react'; import { EuiProgress } from '@elastic/eui'; -import { MlInMemoryTableBasic } from '../../../../../shared_imports'; +import { mlInMemoryTableBasicFactory } from '../../../../../shared_imports'; // The built in loading progress bar of EuiInMemoryTable causes a full DOM replacement // of the table and doesn't play well with auto-refreshing. That's why we're displaying @@ -73,32 +73,35 @@ const getInitialSorting = (columns: any, sorting: any) => { }; }; -export class TransformTable extends MlInMemoryTableBasic { - static getDerivedStateFromProps(nextProps: any, prevState: any) { - const derivedState = { - ...prevState.prevProps, - pageIndex: nextProps.pagination.initialPageIndex, - pageSize: nextProps.pagination.initialPageSize, - }; +export function transformTableFactory() { + const MlInMemoryTableBasic = mlInMemoryTableBasicFactory(); + return class TransformTable extends MlInMemoryTableBasic { + static getDerivedStateFromProps(nextProps: any, prevState: any) { + const derivedState = { + ...prevState.prevProps, + pageIndex: nextProps.pagination.initialPageIndex, + pageSize: nextProps.pagination.initialPageSize, + }; - if (nextProps.items !== prevState.prevProps.items) { - Object.assign(derivedState, { - prevProps: { - items: nextProps.items, - }, - }); - } + if (nextProps.items !== prevState.prevProps.items) { + Object.assign(derivedState, { + prevProps: { + items: nextProps.items, + }, + }); + } - const { sortName, sortDirection } = getInitialSorting(nextProps.columns, nextProps.sorting); - if ( - sortName !== prevState.prevProps.sortName || - sortDirection !== prevState.prevProps.sortDirection - ) { - Object.assign(derivedState, { - sortName, - sortDirection, - }); + const { sortName, sortDirection } = getInitialSorting(nextProps.columns, nextProps.sorting); + if ( + sortName !== prevState.prevProps.sortName || + sortDirection !== prevState.prevProps.sortDirection + ) { + Object.assign(derivedState, { + sortName, + sortDirection, + }); + } + return derivedState; } - return derivedState; - } + }; } diff --git a/x-pack/legacy/plugins/transform/public/shared_imports.ts b/x-pack/legacy/plugins/transform/public/shared_imports.ts index 35bcac16921b96..fe9fe8b8e695be 100644 --- a/x-pack/legacy/plugins/transform/public/shared_imports.ts +++ b/x-pack/legacy/plugins/transform/public/shared_imports.ts @@ -25,12 +25,12 @@ export { ExpanderColumnType, FieldDataColumnType, ColumnType, - MlInMemoryTableBasic, + mlInMemoryTableBasicFactory, OnTableChangeArg, SortingPropType, SortDirection, SORT_DIRECTION, -} from '../../ml/public/components/ml_in_memory_table'; +} from '../../ml/public/application/components/ml_in_memory_table'; // @ts-ignore: could not find declaration file for module -export { KqlFilterBar } from '../../ml/public/components/kql_filter_bar'; +export { KqlFilterBar } from '../../ml/public/application/components/kql_filter_bar'; diff --git a/x-pack/package.json b/x-pack/package.json index 84ce92bf8e9e6e..f84db22fe5c40e 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -244,7 +244,7 @@ "graphql-tag": "^2.9.2", "graphql-tools": "^3.0.2", "h2o2": "^8.1.2", - "handlebars": "4.3.5", + "handlebars": "4.5.3", "history": "4.9.0", "history-extra": "^5.0.1", "i18n-iso-countries": "^4.3.1", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 3dd141a164e3e2..f83d0c9ea3c9a3 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -616,8 +616,6 @@ "core.euiSelectable.noAvailableOptions": "利用可能なオプションがありません", "core.euiSelectable.noMatchingOptions": "{searchValue} はどのオプションにも一致していません", "core.euiStat.loadingText": "統計を読み込み中です", - "core.euiStep.completeStep": "手順", - "core.euiStep.incompleteStep": "未完了の手順", "core.euiStepHorizontal.buttonTitle": "ステップ {step}: {title}{titleAppendix, select, completed { が完了} 無効 { が無効} other {}}", "core.euiStepHorizontal.step": "手順", "core.euiStepNumber.hasErrors": "エラーがあります", @@ -10595,7 +10593,7 @@ "xpack.siem.overview.feedbackTitle": "フィードバック", "xpack.siem.overview.filebeatCiscoTitle": "Filebeat Cisco", "xpack.siem.overview.filebeatNetflowTitle": "Filebeat Netflow", - "xpack.siem.overview.filebeatPanwTitle": "Filebeat Palo Alto Network", + "xpack.siem.overview.filebeatPanwTitle": "Filebeat Palo Alto Networks", "xpack.siem.overview.fileBeatSuricataTitle": "Filebeat Suricata", "xpack.siem.overview.filebeatSystemModuleTitle": "Filebeat システムモジュール", "xpack.siem.overview.fileBeatZeekTitle": "Filebeat Zeek", @@ -12759,4 +12757,4 @@ "xpack.licensing.check.errorUnavailableMessage": "現在ライセンス情報が利用できないため {pluginName} を使用できません。", "xpack.licensing.check.errorUnsupportedMessage": "ご使用の {licenseType} ライセンスは {pluginName} をサポートしていません。ライセンスをアップグレードしてください。" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index fb5b7cc191e61c..a830eaacd29e35 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -617,8 +617,6 @@ "core.euiSelectable.noAvailableOptions": "没有任何可用选项", "core.euiSelectable.noMatchingOptions": "{searchValue} 不匹配任何选项", "core.euiStat.loadingText": "统计正在加载", - "core.euiStep.completeStep": "步骤", - "core.euiStep.incompleteStep": "未完成步骤", "core.euiStepHorizontal.buttonTitle": "第 {step} 步:{title}{titleAppendix, select, completed {已完成} disabled {已禁用} other {}}", "core.euiStepHorizontal.step": "步骤", "core.euiStepNumber.hasErrors": "有错误", @@ -12848,4 +12846,4 @@ "xpack.licensing.check.errorUnavailableMessage": "您不能使用 {pluginName},因为许可证信息当前不可用。", "xpack.licensing.check.errorUnsupportedMessage": "您的{licenseType}许可证不支持 {pluginName}。请升级您的许可证。" } -} \ No newline at end of file +} diff --git a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts index 4fbb13b2290035..57b4b3b6c26c67 100644 --- a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts +++ b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts @@ -183,7 +183,7 @@ export class AlertUtils { throttle: '1m', tags: [], alertTypeId: 'test.always-firing', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference, }, diff --git a/x-pack/test/alerting_api_integration/common/lib/get_test_alert_data.ts b/x-pack/test/alerting_api_integration/common/lib/get_test_alert_data.ts index d7fba7e43c3723..ae382652b62344 100644 --- a/x-pack/test/alerting_api_integration/common/lib/get_test_alert_data.ts +++ b/x-pack/test/alerting_api_integration/common/lib/get_test_alert_data.ts @@ -13,7 +13,7 @@ export function getTestAlertData(overwrites = {}) { interval: '1m', throttle: '1m', actions: [], - alertTypeParams: {}, + params: {}, ...overwrites, }; } diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts index c43e159bbe8ca5..09a642d1d14bbb 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/alerts.ts @@ -166,7 +166,7 @@ export default function alertTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.always-firing', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference: 'create-test-2', }, @@ -258,7 +258,7 @@ export default function alertTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.authorization', - alertTypeParams: { + params: { callClusterAuthorizationIndex: authorizationIndex, savedObjectsClientType: 'dashboard', savedObjectsClientId: '1', @@ -356,7 +356,7 @@ export default function alertTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.always-firing', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference, }, @@ -491,7 +491,7 @@ export default function alertTests({ getService }: FtrProviderContext) { reference, overwrites: { interval: '1s', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference, groupsToScheduleActionsInSeries: ['default', 'other'], @@ -560,7 +560,7 @@ export default function alertTests({ getService }: FtrProviderContext) { reference, overwrites: { interval: '1s', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference, groupsToScheduleActionsInSeries: ['default', null, 'default'], diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts index d94556d6cedda3..bf61ee2e3f1375 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/create.ts @@ -59,7 +59,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { actions: [], enabled: true, alertTypeId: 'test.noop', - alertTypeParams: {}, + params: {}, createdBy: user.username, interval: '1m', scheduledTaskId: response.body.scheduledTaskId, @@ -173,10 +173,10 @@ export default function createAlertTests({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'child "name" fails because ["name" is required]. child "alertTypeId" fails because ["alertTypeId" is required]. child "interval" fails because ["interval" is required]. child "alertTypeParams" fails because ["alertTypeParams" is required]. child "actions" fails because ["actions" is required]', + 'child "name" fails because ["name" is required]. child "alertTypeId" fails because ["alertTypeId" is required]. child "interval" fails because ["interval" is required]. child "params" fails because ["params" is required]. child "actions" fails because ["actions" is required]', validation: { source: 'payload', - keys: ['name', 'alertTypeId', 'interval', 'alertTypeParams', 'actions'], + keys: ['name', 'alertTypeId', 'interval', 'params', 'actions'], }, }); break; @@ -185,7 +185,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { } }); - it(`should handle create alert request appropriately when alertTypeParams isn't valid`, async () => { + it(`should handle create alert request appropriately when params isn't valid`, async () => { const response = await supertestWithoutAuth .post(`${getUrlPrefix(space.id)}/api/alert`) .set('kbn-xsrf', 'foo') @@ -214,7 +214,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]', + 'params invalid: [param1]: expected value of type [string] but got [undefined]', }); break; default: diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts index b04c0f44e7dd43..31af7a0acffbb8 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/find.ts @@ -62,7 +62,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { interval: '1m', enabled: true, actions: [], - alertTypeParams: {}, + params: {}, createdBy: 'elastic', scheduledTaskId: match.scheduledTaskId, throttle: '1m', @@ -119,7 +119,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { interval: '1m', enabled: true, actions: [], - alertTypeParams: {}, + params: {}, createdBy: 'elastic', scheduledTaskId: match.scheduledTaskId, throttle: '1m', diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts index cfb2f34ca8056a..1a8109f6b6b3c6 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/get.ts @@ -56,7 +56,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { interval: '1m', enabled: true, actions: [], - alertTypeParams: {}, + params: {}, createdBy: 'elastic', scheduledTaskId: response.body.scheduledTaskId, throttle: '1m', diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts index 78f70ddb13eddb..1b1bcef9ad23ff 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/update.ts @@ -33,7 +33,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { const updatedData = { name: 'bcd', tags: ['bar'], - alertTypeParams: { + params: { foo: true, }, interval: '12s', @@ -93,7 +93,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .send({ name: 'bcd', tags: ['bar'], - alertTypeParams: { + params: { foo: true, }, interval: '12s', @@ -142,7 +142,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { tags: ['bar'], throttle: '1m', alertTypeId: '1', - alertTypeParams: { + params: { foo: true, }, interval: '12s', @@ -203,10 +203,10 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'child "throttle" fails because ["throttle" is required]. child "name" fails because ["name" is required]. child "tags" fails because ["tags" is required]. child "interval" fails because ["interval" is required]. child "alertTypeParams" fails because ["alertTypeParams" is required]. child "actions" fails because ["actions" is required]', + 'child "throttle" fails because ["throttle" is required]. child "name" fails because ["name" is required]. child "tags" fails because ["tags" is required]. child "interval" fails because ["interval" is required]. child "params" fails because ["params" is required]. child "actions" fails because ["actions" is required]', validation: { source: 'payload', - keys: ['throttle', 'name', 'tags', 'interval', 'alertTypeParams', 'actions'], + keys: ['throttle', 'name', 'tags', 'interval', 'params', 'actions'], }, }); break; @@ -222,7 +222,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.validation', - alertTypeParams: { + params: { param1: 'test', }, }) @@ -239,7 +239,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { tags: ['bar'], interval: '1m', throttle: '1m', - alertTypeParams: {}, + params: {}, actions: [], }); @@ -261,7 +261,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'alertTypeParams invalid: [param1]: expected value of type [string] but got [undefined]', + 'params invalid: [param1]: expected value of type [string] but got [undefined]', }); break; default: diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts index 28634c46b6350a..9af4848c57d7d1 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts.ts @@ -125,7 +125,7 @@ export default function alertTests({ getService }: FtrProviderContext) { getTestAlertData({ interval: '1m', alertTypeId: 'test.always-firing', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference: 'create-test-2', }, @@ -193,7 +193,7 @@ export default function alertTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.authorization', - alertTypeParams: { + params: { callClusterAuthorizationIndex: authorizationIndex, savedObjectsClientType: 'dashboard', savedObjectsClientId: '1', @@ -238,7 +238,7 @@ export default function alertTests({ getService }: FtrProviderContext) { .send( getTestAlertData({ alertTypeId: 'test.always-firing', - alertTypeParams: { + params: { index: ES_TEST_INDEX_NAME, reference, }, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts index 80459690af7329..3018f8efffffeb 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/create.ts @@ -41,7 +41,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) { actions: [], enabled: true, alertTypeId: 'test.noop', - alertTypeParams: {}, + params: {}, createdBy: null, interval: '1m', scheduledTaskId: response.body.scheduledTaskId, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts index f49d774fc1e927..0d12af6db79b2b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/find.ts @@ -45,7 +45,7 @@ export default function createFindTests({ getService }: FtrProviderContext) { interval: '1m', enabled: true, actions: [], - alertTypeParams: {}, + params: {}, createdBy: null, scheduledTaskId: match.scheduledTaskId, updatedBy: null, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts index ef27a2713e98a2..9e4797bcbf7ad2 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get.ts @@ -39,7 +39,7 @@ export default function createGetTests({ getService }: FtrProviderContext) { interval: '1m', enabled: true, actions: [], - alertTypeParams: {}, + params: {}, createdBy: null, scheduledTaskId: response.body.scheduledTaskId, updatedBy: null, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts index 942eff0766722e..a6eccf88d9e269 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/update.ts @@ -28,7 +28,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { const updatedData = { name: 'bcd', tags: ['bar'], - alertTypeParams: { + params: { foo: true, }, interval: '12s', @@ -68,7 +68,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .send({ name: 'bcd', tags: ['foo'], - alertTypeParams: { + params: { foo: true, }, interval: '12s', diff --git a/x-pack/test/functional/apps/transform/creation.ts b/x-pack/test/functional/apps/transform/creation_index_pattern.ts similarity index 91% rename from x-pack/test/functional/apps/transform/creation.ts rename to x-pack/test/functional/apps/transform/creation_index_pattern.ts index 3ab17c0d90a830..3dbf61221abf96 100644 --- a/x-pack/test/functional/apps/transform/creation.ts +++ b/x-pack/test/functional/apps/transform/creation_index_pattern.ts @@ -17,7 +17,7 @@ export default function({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const transform = getService('transform'); - describe('creation', function() { + describe('creation_index_pattern', function() { this.tags(['smoke']); before(async () => { await esArchiver.load('ml/ecommerce'); @@ -56,11 +56,19 @@ export default function({ getService }: FtrProviderContext) { return `dest_${this.transformId}`; }, expected: { + pivotPreview: { + column: 0, + values: [`Men's Accessories`], + }, row: { status: 'stopped', mode: 'batch', progress: '100', }, + sourcePreview: { + columns: 6, + rows: 5, + }, }, }, ]; @@ -96,6 +104,13 @@ export default function({ getService }: FtrProviderContext) { await transform.wizard.assertSourceIndexPreviewLoaded(); }); + it('shows the source index preview', async () => { + await transform.wizard.assertSourceIndexPreview( + testData.expected.sourcePreview.columns, + testData.expected.sourcePreview.rows + ); + }); + it('displays an empty pivot preview', async () => { await transform.wizard.assertPivotPreviewEmpty(); }); @@ -140,6 +155,13 @@ export default function({ getService }: FtrProviderContext) { await transform.wizard.assertPivotPreviewLoaded(); }); + it('shows the pivot preview', async () => { + await transform.wizard.assertPivotPreviewColumnValues( + testData.expected.pivotPreview.column, + testData.expected.pivotPreview.values + ); + }); + it('loads the details step', async () => { await transform.wizard.advanceToDetailsStep(); }); diff --git a/x-pack/test/functional/apps/transform/creation_saved_search.ts b/x-pack/test/functional/apps/transform/creation_saved_search.ts new file mode 100644 index 00000000000000..8a69700bee578c --- /dev/null +++ b/x-pack/test/functional/apps/transform/creation_saved_search.ts @@ -0,0 +1,256 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../ftr_provider_context'; + +interface GroupByEntry { + identifier: string; + label: string; + intervalLabel?: string; +} + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const transform = getService('transform'); + + describe('creation_saved_search', function() { + this.tags(['smoke']); + before(async () => { + await esArchiver.load('ml/farequote'); + }); + + // after(async () => { + // await esArchiver.unload('ml/farequote'); + // await transform.api.cleanTransformIndices(); + // }); + + const testDataList = [ + { + suiteTitle: 'batch transform with terms groups and avg agg with saved search filter', + source: 'farequote_filter', + groupByEntries: [ + { + identifier: 'terms(airline)', + label: 'airline', + } as GroupByEntry, + ], + aggregationEntries: [ + { + identifier: 'avg(responsetime)', + label: 'responsetime.avg', + }, + ], + transformId: `fq_1_${Date.now()}`, + transformDescription: + 'farequote batch transform with groups terms(airline) and aggregation avg(responsetime.avg) with saved search filter', + get destinationIndex(): string { + return `dest_${this.transformId}`; + }, + expected: { + pivotPreview: { + column: 0, + values: ['ASA'], + }, + row: { + status: 'stopped', + mode: 'batch', + progress: '100', + }, + sourceIndex: 'farequote', + sourcePreview: { + column: 3, + values: ['ASA'], + }, + }, + }, + ]; + + for (const testData of testDataList) { + describe(`${testData.suiteTitle}`, function() { + after(async () => { + await transform.api.deleteIndices(testData.destinationIndex); + }); + + it('loads the home page', async () => { + await transform.navigation.navigateTo(); + await transform.management.assertTransformListPageExists(); + }); + + it('displays the stats bar', async () => { + await transform.management.assertTransformStatsBarExists(); + }); + + it('loads the source selection modal', async () => { + await transform.management.startTransformCreation(); + }); + + it('selects the source data', async () => { + await transform.sourceSelection.selectSource(testData.source); + }); + + it('displays the define pivot step', async () => { + await transform.wizard.assertDefineStepActive(); + }); + + it('loads the source index preview', async () => { + await transform.wizard.assertSourceIndexPreviewLoaded(); + }); + + it('shows the filtered source index preview', async () => { + await transform.wizard.assertSourceIndexPreviewColumnValues( + testData.expected.sourcePreview.column, + testData.expected.sourcePreview.values + ); + }); + + it('displays an empty pivot preview', async () => { + await transform.wizard.assertPivotPreviewEmpty(); + }); + + it('hides the query input', async () => { + await transform.wizard.assertQueryInputMissing(); + }); + + it('hides the advanced query editor switch', async () => { + await transform.wizard.assertAdvancedQueryEditorSwitchMissing(); + }); + + it('adds the group by entries', async () => { + for (const [index, entry] of testData.groupByEntries.entries()) { + await transform.wizard.assertGroupByInputExists(); + await transform.wizard.assertGroupByInputValue([]); + await transform.wizard.addGroupByEntry( + index, + entry.identifier, + entry.label, + entry.intervalLabel + ); + } + }); + + it('adds the aggregation entries', async () => { + for (const [index, agg] of testData.aggregationEntries.entries()) { + await transform.wizard.assertAggregationInputExists(); + await transform.wizard.assertAggregationInputValue([]); + await transform.wizard.addAggregationEntry(index, agg.identifier, agg.label); + } + }); + + it('displays the advanced pivot editor switch', async () => { + await transform.wizard.assertAdvancedPivotEditorSwitchExists(); + await transform.wizard.assertAdvancedPivotEditorSwitchCheckState(false); + }); + + it('loads the pivot preview', async () => { + await transform.wizard.assertPivotPreviewLoaded(); + }); + + it('shows the pivot preview', async () => { + await transform.wizard.assertPivotPreviewColumnValues( + testData.expected.pivotPreview.column, + testData.expected.pivotPreview.values + ); + }); + + it('loads the details step', async () => { + await transform.wizard.advanceToDetailsStep(); + }); + + it('inputs the transform id', async () => { + await transform.wizard.assertTransformIdInputExists(); + await transform.wizard.assertTransformIdValue(''); + await transform.wizard.setTransformId(testData.transformId); + }); + + it('inputs the transform description', async () => { + await transform.wizard.assertTransformDescriptionInputExists(); + await transform.wizard.assertTransformDescriptionValue(''); + await transform.wizard.setTransformDescription(testData.transformDescription); + }); + + it('inputs the destination index', async () => { + await transform.wizard.assertDestinationIndexInputExists(); + await transform.wizard.assertDestinationIndexValue(''); + await transform.wizard.setDestinationIndex(testData.destinationIndex); + }); + + it('displays the create index pattern switch', async () => { + await transform.wizard.assertCreateIndexPatternSwitchExists(); + await transform.wizard.assertCreateIndexPatternSwitchCheckState(true); + }); + + it('displays the continuous mode switch', async () => { + await transform.wizard.assertContinuousModeSwitchExists(); + await transform.wizard.assertContinuousModeSwitchCheckState(false); + }); + + it('loads the create step', async () => { + await transform.wizard.advanceToCreateStep(); + }); + + it('displays the create and start button', async () => { + await transform.wizard.assertCreateAndStartButtonExists(); + }); + + it('displays the create button', async () => { + await transform.wizard.assertCreateButtonExists(); + }); + + it('displays the copy to clipboard button', async () => { + await transform.wizard.assertCreateAndStartButtonExists(); + }); + + it('creates the transform', async () => { + await transform.wizard.createTransform(); + }); + + it('starts the transform and finishes processing', async () => { + await transform.wizard.startTransform(); + await transform.wizard.waitForProgressBarComplete(); + }); + + it('returns to the management page', async () => { + await transform.wizard.returnToManagement(); + }); + + it('displays the transforms table', async () => { + await transform.management.assertTransformsTableExists(); + }); + + it('displays the created transform in the transform list', async () => { + await transform.table.refreshTransformList(); + await transform.table.filterWithSearchString(testData.transformId); + const rows = await transform.table.parseTransformTable(); + expect(rows.filter(row => row.id === testData.transformId)).to.have.length(1); + }); + + it('job creation displays details for the created job in the job list', async () => { + await transform.table.assertTransformRowFields(testData.transformId, { + id: testData.transformId, + description: testData.transformDescription, + sourceIndex: testData.expected.sourceIndex, + destinationIndex: testData.destinationIndex, + status: testData.expected.row.status, + mode: testData.expected.row.mode, + progress: testData.expected.row.progress, + }); + }); + + it('expands the transform management table row and walks through available tabs', async () => { + await transform.table.assertTransformExpandedRow(); + }); + + it('displays the transform preview in the expanded row', async () => { + await transform.table.assertTransformsExpandedRowPreviewColumnValues( + testData.expected.pivotPreview.column, + testData.expected.pivotPreview.values + ); + }); + }); + } + }); +} diff --git a/x-pack/test/functional/apps/transform/index.ts b/x-pack/test/functional/apps/transform/index.ts index adee997905a318..0a33ce0ebf08a8 100644 --- a/x-pack/test/functional/apps/transform/index.ts +++ b/x-pack/test/functional/apps/transform/index.ts @@ -9,6 +9,7 @@ export default function({ loadTestFile }: FtrProviderContext) { describe('transform', function() { this.tags(['ciGroup9', 'transform']); - loadTestFile(require.resolve('./creation')); + loadTestFile(require.resolve('./creation_index_pattern')); + loadTestFile(require.resolve('./creation_saved_search')); }); } diff --git a/x-pack/test/functional/es_archives/hybrid/kibana/mappings.json b/x-pack/test/functional/es_archives/hybrid/kibana/mappings.json index 18b359d37aaa6a..5256e29956f4f0 100644 --- a/x-pack/test/functional/es_archives/hybrid/kibana/mappings.json +++ b/x-pack/test/functional/es_archives/hybrid/kibana/mappings.json @@ -99,7 +99,7 @@ "alertTypeId": { "type": "keyword" }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, @@ -1068,4 +1068,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/lens/basic/mappings.json b/x-pack/test/functional/es_archives/lens/basic/mappings.json index b87dbe12a70053..f2a29f022ff5e4 100644 --- a/x-pack/test/functional/es_archives/lens/basic/mappings.json +++ b/x-pack/test/functional/es_archives/lens/basic/mappings.json @@ -100,7 +100,7 @@ "alertTypeId": { "type": "keyword" }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, @@ -1291,4 +1291,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/lens/reporting/mappings.json b/x-pack/test/functional/es_archives/lens/reporting/mappings.json index 0321d57bc2df60..8b8e5a0e6e7f64 100644 --- a/x-pack/test/functional/es_archives/lens/reporting/mappings.json +++ b/x-pack/test/functional/es_archives/lens/reporting/mappings.json @@ -100,7 +100,7 @@ "alertTypeId": { "type": "keyword" }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, @@ -1300,4 +1300,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/ml/farequote/mappings.json b/x-pack/test/functional/es_archives/ml/farequote/mappings.json index 4fe559cc85fe15..b00545c015a74b 100644 --- a/x-pack/test/functional/es_archives/ml/farequote/mappings.json +++ b/x-pack/test/functional/es_archives/ml/farequote/mappings.json @@ -133,7 +133,7 @@ "alertTypeId": { "type": "keyword" }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, diff --git a/x-pack/test/functional/es_archives/reporting/nanos/mappings.json b/x-pack/test/functional/es_archives/reporting/nanos/mappings.json index 34420b6bb63e17..dd717387a26436 100644 --- a/x-pack/test/functional/es_archives/reporting/nanos/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/nanos/mappings.json @@ -84,7 +84,7 @@ "alertTypeId": { "type": "keyword" }, - "alertTypeParams": { + "params": { "enabled": false, "type": "object" }, @@ -1091,4 +1091,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/services/transform_ui/transform_table.ts b/x-pack/test/functional/services/transform_ui/transform_table.ts index b9eff5e2b2435a..ebd7fe527b45ff 100644 --- a/x-pack/test/functional/services/transform_ui/transform_table.ts +++ b/x-pack/test/functional/services/transform_ui/transform_table.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export function TransformTableProvider({ getService }: FtrProviderContext) { + const retry = getService('retry'); const testSubjects = getService('testSubjects'); return new (class TransformTable { @@ -60,6 +61,51 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { return rows; } + async parseEuiInMemoryTable(tableSubj: string) { + const table = await testSubjects.find(`~${tableSubj}`); + const $ = await table.parseDomContent(); + const rows = []; + + // For each row, get the content of each cell and + // add its values as an array to each row. + for (const tr of $.findTestSubjects(`~${tableSubj}Row`).toArray()) { + rows.push( + $(tr) + .find('.euiTableCellContent') + .toArray() + .map(cell => + $(cell) + .text() + .trim() + ) + ); + } + + return rows; + } + + async assertEuiInMemoryTableColumnValues( + tableSubj: string, + column: number, + expectedColumnValues: string[] + ) { + await retry.tryForTime(2000, async () => { + // get a 2D array of rows and cell values + const rows = await this.parseEuiInMemoryTable(tableSubj); + + // reduce the rows data to an array of unique values in the specified column + const uniqueColumnValues = rows + .map(row => row[column]) + .flat() + .filter((v, i, a) => a.indexOf(v) === i); + + uniqueColumnValues.sort(); + + // check if the returned unique value matches the supplied filter value + expect(uniqueColumnValues).to.eql(expectedColumnValues); + }); + } + public async refreshTransformList() { await testSubjects.click('transformRefreshTransformListButton'); await this.waitForTransformsToLoad(); @@ -83,5 +129,36 @@ export function TransformTableProvider({ getService }: FtrProviderContext) { const transformRow = rows.filter(row => row.id === transformId)[0]; expect(transformRow).to.eql(expectedRow); } + + public async assertTransformExpandedRow() { + await testSubjects.click('transformListRowDetailsToggle'); + + // The expanded row should show the details tab content by default + await testSubjects.existOrFail('transformDetailsTab'); + await testSubjects.existOrFail('~transformDetailsTabContent'); + + // Walk through the rest of the tabs and check if the corresponding content shows up + await testSubjects.existOrFail('transformJsonTab'); + await testSubjects.click('transformJsonTab'); + await testSubjects.existOrFail('~transformJsonTabContent'); + + await testSubjects.existOrFail('transformMessagesTab'); + await testSubjects.click('transformMessagesTab'); + await testSubjects.existOrFail('~transformMessagesTabContent'); + + await testSubjects.existOrFail('transformPreviewTab'); + await testSubjects.click('transformPreviewTab'); + await testSubjects.existOrFail('~transformPreviewTabContent'); + } + + public async waitForTransformsExpandedRowPreviewTabToLoad() { + await testSubjects.existOrFail('~transformPreviewTabContent', { timeout: 60 * 1000 }); + await testSubjects.existOrFail('transformPreviewTabContent loaded', { timeout: 30 * 1000 }); + } + + async assertTransformsExpandedRowPreviewColumnValues(column: number, values: string[]) { + await this.waitForTransformsExpandedRowPreviewTabToLoad(); + await this.assertEuiInMemoryTableColumnValues('transformPreviewTabContent', column, values); + } })(); } diff --git a/x-pack/test/functional/services/transform_ui/wizard.ts b/x-pack/test/functional/services/transform_ui/wizard.ts index c80aa62cd49127..db7cdd148fd996 100644 --- a/x-pack/test/functional/services/transform_ui/wizard.ts +++ b/x-pack/test/functional/services/transform_ui/wizard.ts @@ -75,6 +75,81 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) { await testSubjects.existOrFail(selector); }, + async parseEuiInMemoryTable(tableSubj: string) { + const table = await testSubjects.find(`~${tableSubj}`); + const $ = await table.parseDomContent(); + const rows = []; + + // For each row, get the content of each cell and + // add its values as an array to each row. + for (const tr of $.findTestSubjects(`~${tableSubj}Row`).toArray()) { + rows.push( + $(tr) + .find('.euiTableCellContent') + .toArray() + .map(cell => + $(cell) + .text() + .trim() + ) + ); + } + + return rows; + }, + + async assertEuiInMemoryTableColumnValues( + tableSubj: string, + column: number, + expectedColumnValues: string[] + ) { + await retry.tryForTime(2000, async () => { + // get a 2D array of rows and cell values + const rows = await this.parseEuiInMemoryTable(tableSubj); + + // reduce the rows data to an array of unique values in the specified column + const uniqueColumnValues = rows + .map(row => row[column]) + .flat() + .filter((v, i, a) => a.indexOf(v) === i); + + uniqueColumnValues.sort(); + + // check if the returned unique value matches the supplied filter value + expect(uniqueColumnValues).to.eql( + expectedColumnValues, + `Unique EuiInMemoryTable column values should be '${expectedColumnValues.join()}' (got ${uniqueColumnValues.join()})` + ); + }); + }, + + async assertSourceIndexPreview(columns: number, rows: number) { + await retry.tryForTime(2000, async () => { + // get a 2D array of rows and cell values + const rowsData = await this.parseEuiInMemoryTable('transformSourceIndexPreview'); + + expect(rowsData).to.length( + rows, + `EuiInMemoryTable rows should be ${rows} (got ${rowsData.length})` + ); + + rowsData.map((r, i) => + expect(r).to.length( + columns, + `EuiInMemoryTable row #${i + 1} column count should be ${columns} (got ${r.length})` + ) + ); + }); + }, + + async assertSourceIndexPreviewColumnValues(column: number, values: string[]) { + await this.assertEuiInMemoryTableColumnValues('transformSourceIndexPreview', column, values); + }, + + async assertPivotPreviewColumnValues(column: number, values: string[]) { + await this.assertEuiInMemoryTableColumnValues('transformPivotPreview', column, values); + }, + async assertPivotPreviewLoaded() { await this.assertPivotPreviewExists('loaded'); }, @@ -87,6 +162,10 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) { await testSubjects.existOrFail('tarnsformQueryInput'); }, + async assertQueryInputMissing() { + await testSubjects.missingOrFail('tarnsformQueryInput'); + }, + async assertQueryValue(expectedQuery: string) { const actualQuery = await testSubjects.getVisibleText('tarnsformQueryInput'); expect(actualQuery).to.eql( @@ -99,6 +178,10 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) { await testSubjects.existOrFail(`transformAdvancedQueryEditorSwitch`, { allowHidden: true }); }, + async assertAdvancedQueryEditorSwitchMissing() { + await testSubjects.missingOrFail(`transformAdvancedQueryEditorSwitch`); + }, + async assertAdvancedQueryEditorSwitchCheckState(expectedCheckState: boolean) { const actualCheckState = (await testSubjects.getAttribute('transformAdvancedQueryEditorSwitch', 'aria-checked')) === diff --git a/yarn.lock b/yarn.lock index 68b9a74829281f..3296fc013c48d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9719,15 +9719,10 @@ deep-object-diff@^1.1.0: resolved "https://registry.yarnpkg.com/deep-object-diff/-/deep-object-diff-1.1.0.tgz#d6fabf476c2ed1751fc94d5ca693d2ed8c18bc5a" integrity sha512-b+QLs5vHgS+IoSNcUE4n9HP2NwcHj7aqnJWsjPtuG75Rh5TOaGt0OjAYInh77d5T16V5cRDC+Pw/6ZZZiETBGw== -deepmerge@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" - integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== - -deepmerge@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.0.0.tgz#3e3110ca29205f120d7cb064960a39c3d2087c09" - integrity sha512-YZ1rOP5+kHor4hMAH+HRQnBQHg+wvS1un1hAOuIcxcBy0hzcUf6Jg2a1w65kpoOUnurOfZbERwjI1TfZxNjcww== +deepmerge@3.2.0, deepmerge@^4.0.0, deepmerge@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" + integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== default-compare@^1.0.0: version "1.0.0" @@ -14315,10 +14310,10 @@ handle-thing@^2.0.0: resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== -handlebars@4.3.5: - version "4.3.5" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.3.5.tgz#d6c2d0a0f08b4479e3949f8321c0f3893bb691be" - integrity sha512-I16T/l8X9DV3sEkY9sK9lsPRgDsj82ayBY/4pAZyP2BcX5WeRM3O06bw9kIs2GLrHvFB/DNzWWJyFvof8wQGqw== +handlebars@4.5.3: + version "4.5.3" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.3.tgz#5cf75bd8714f7605713511a56be7c349becb0482" + integrity sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA== dependencies: neo-async "^2.6.0" optimist "^0.6.1"