diff --git a/x-pack/legacy/plugins/ml/public/app.js b/x-pack/legacy/plugins/ml/public/app.js index 406439f0becd..ca0427544e83 100644 --- a/x-pack/legacy/plugins/ml/public/app.js +++ b/x-pack/legacy/plugins/ml/public/app.js @@ -23,7 +23,6 @@ import 'plugins/ml/services/calendar_service'; import 'plugins/ml/components/messagebar'; import 'plugins/ml/data_frame'; import 'plugins/ml/data_frame_analytics'; -import 'plugins/ml/data_visualizer'; import 'plugins/ml/datavisualizer'; import 'plugins/ml/explorer'; import 'plugins/ml/timeseriesexplorer'; @@ -34,7 +33,6 @@ import 'plugins/ml/components/confirm_modal'; import 'plugins/ml/components/navigation_menu'; import 'plugins/ml/components/loading_indicator'; import 'plugins/ml/settings'; -import 'plugins/ml/file_datavisualizer'; import 'uiExports/autocompleteProviders'; import uiRoutes from 'ui/routes'; diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/_index.scss b/x-pack/legacy/plugins/ml/public/components/field_data_card/_index.scss deleted file mode 100644 index c39be8d5f17d..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'field_data_card'; \ No newline at end of file diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_boolean.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_boolean.html deleted file mode 100644 index 312d3600436d..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_boolean.html +++ /dev/null @@ -1,56 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
-
-
-
- true -
-
-
-
-
-
{{card.stats.trueCount}}
-
-
-
- false -
-
-
-
-
-
{{card.stats.falseCount}}
-
-
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_date.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_date.html deleted file mode 100644 index 6841252132cf..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_date.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
-
-
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_document_count.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_document_count.html deleted file mode 100644 index ab157a5f2319..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_document_count.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- -
- -
-
-
- diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_geo_point.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_geo_point.html deleted file mode 100644 index 21005c449ab4..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_geo_point.html +++ /dev/null @@ -1,36 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
-
-
-
-
- {{ example }} -
-
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_ip.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_ip.html deleted file mode 100644 index a6e8c7b47a9c..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_ip.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
- -
- -
-
- -
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_keyword.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_keyword.html deleted file mode 100644 index 750ee2a04c94..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_keyword.html +++ /dev/null @@ -1,32 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
-
- -
-
- -
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_number.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_number.html deleted file mode 100644 index 024ab88b0bef..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_number.html +++ /dev/null @@ -1,80 +0,0 @@ -
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
-
-
-
-
-
-
-
- - -
-
- - -
-
- - -
-
-
- -
- -
-
- -
- -
- -
-
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_other.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_other.html deleted file mode 100644 index dacbf4091eb4..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_other.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
-
-
- - ({{ 100 * card.stats.count / card.stats.sampleCount | number:1 }}%) -
-
- -
-
-
-
-
- {{ example }} -
-
-
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_text.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_text.html deleted file mode 100644 index 4ac856951087..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/content_types/card_text.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
-
-
- {{ example }} -
-
-
-
-

-

-

-
-
- -
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/display_value_directive.js b/x-pack/legacy/plugins/ml/public/components/field_data_card/display_value_directive.js deleted file mode 100644 index f94e721319c2..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/display_value_directive.js +++ /dev/null @@ -1,21 +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 'ngreact'; -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml', ['react']); - -import { DisplayValue } from '../../components/display_value'; - -module.directive('mlDisplayValue', function (reactDirective) { - return reactDirective( - DisplayValue, - undefined, - { restrict: 'E' } - ); -}); diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/document_count_chart_directive.js b/x-pack/legacy/plugins/ml/public/components/field_data_card/document_count_chart_directive.js deleted file mode 100644 index 1550d8077afd..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/document_count_chart_directive.js +++ /dev/null @@ -1,190 +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. - */ - - - -/* - * AngularJS directive for rendering a chart showing - * document count on the field data card. - */ - -import _ from 'lodash'; -import { i18n } from '@kbn/i18n'; -import d3 from 'd3'; -import moment from 'moment'; - -import { parseInterval } from 'ui/utils/parse_interval'; -import { numTicksForDateFormat } from '../../util/chart_utils'; -import { calculateTextWidth } from '../../util/string_utils'; -import { MlTimeBuckets } from '../../util/ml_time_buckets'; -import { mlChartTooltipService } from '../../components/chart_tooltip/chart_tooltip_service'; -import { formatHumanReadableDateTime } from '../../util/date_utils'; - -import { uiModules } from 'ui/modules'; -import { timefilter } from 'ui/timefilter'; -const module = uiModules.get('apps/ml'); - -module.directive('mlDocumentCountChart', function () { - function link(scope, element, attrs) { - const svgWidth = attrs.width ? +attrs.width : 400; - const svgHeight = scope.height = attrs.height ? +attrs.height : 400; - - const margin = { top: 0, right: 5, bottom: 20, left: 15 }; - - let chartWidth = svgWidth - (margin.left + margin.right); - const chartHeight = svgHeight - (margin.top + margin.bottom); - - let xScale = null; - let yScale = d3.scale.linear().range([chartHeight, 0]); - let xAxisTickFormat = 'YYYY-MM-DD HH:mm'; - - let barChartGroup; - let barWidth = 5; // Adjusted according to data aggregation interval. - - scope.chartData = []; - - element.on('$destroy', function () { - scope.$destroy(); - }); - - function processChartData() { - // Build the dataset in format used by the d3 chart i.e. array - // of Objects with keys time (epoch ms), date (JavaScript date) and value. - const bucketsData = _.get(scope, ['card', 'stats', 'documentCounts', 'buckets'], {}); - const chartData = []; - _.each(bucketsData, (value, time) => { - chartData.push({ - date: new Date(+time), - time: +time, - value - }); - }); - - scope.chartData = chartData; - } - - function render() { - // Clear any existing elements from the visualization, - // then build the svg elements for the bar chart. - const chartElement = d3.select(element.get(0)).select('.content-wrapper'); - chartElement.selectAll('*').remove(); - - if (scope.chartData === undefined) { - return; - } - - const svg = chartElement.append('svg') - .attr('width', svgWidth) - .attr('height', svgHeight); - - // Set the size of the left margin according to the width - // of the largest y axis tick label. - const maxYVal = d3.max(scope.chartData, (d) => d.value); - yScale = yScale.domain([0, maxYVal]); - - const yAxis = d3.svg.axis().scale(yScale).orient('left').outerTickSize(0); - - // barChartGroup translate doesn't seem to be relative - // to parent svg, so have to add an extra 5px on. - const maxYAxisLabelWidth = calculateTextWidth(maxYVal, true, svg); - margin.left = Math.max(maxYAxisLabelWidth + yAxis.tickPadding() + 5, 25); - chartWidth = Math.max(svgWidth - margin.left - margin.right, 0); - - const bounds = timefilter.getActiveBounds(); - xScale = d3.time.scale() - .domain([new Date(bounds.min.valueOf()), new Date(bounds.max.valueOf())]) - .range([0, chartWidth]); - - if (scope.chartData.length > 0) { - // x axis tick format and bar width determined by data aggregation interval. - const buckets = new MlTimeBuckets(); - const aggInterval = _.get(scope, ['card', 'stats', 'documentCounts', 'interval']); - buckets.setInterval(aggInterval); - buckets.setBounds(bounds); - xAxisTickFormat = buckets.getScaledDateFormat(); - - const intervalMs = parseInterval(aggInterval).asMilliseconds(); - barWidth = xScale(scope.chartData[0].time + intervalMs) - xScale(scope.chartData[0].time); - } - - const xAxis = d3.svg.axis().scale(xScale).orient('bottom') - .outerTickSize(0).ticks(numTicksForDateFormat(chartWidth, xAxisTickFormat)) - .tickFormat((d) => { - return moment(d).format(xAxisTickFormat); - }); - - barChartGroup = svg.append('g') - .attr('class', 'bar-chart') - .attr('transform', `translate(${margin.left}, ${margin.top})`); - - drawBarChartAxes(xAxis, yAxis); - drawBarChartPaths(); - } - - function drawBarChartAxes(xAxis, yAxis) { - const axes = barChartGroup.append('g'); - - axes.append('g') - .attr('class', 'x axis') - .attr('transform', `translate(0, ${chartHeight})`) - .call(xAxis); - - axes.append('g') - .attr('class', 'y axis') - .call(yAxis); - } - - function drawBarChartPaths() { - barChartGroup.selectAll('bar') - .data(scope.chartData) - .enter().append('rect') - .attr('class', 'bar') - .attr('x', (d) => { return xScale(d.time); }) - .attr('width', barWidth) - .attr('y', (d) => { return yScale(d.value); }) - .attr('height', (d) => { return chartHeight - yScale(d.value); }) - .on('mouseover', function (d) { - showChartTooltip(d, this); - }) - .on('mousemove', function (d) { - showChartTooltip(d, this); - }) - .on('mouseout', () => mlChartTooltipService.hide()); - - function showChartTooltip(data, rect) { - const formattedDate = formatHumanReadableDateTime(data.time); - const contents = i18n.translate('xpack.ml.fieldDataCard.documentCountChart.chartTooltip', { - defaultMessage: '{formattedDate}{br}{hr}count: {dataValue}', - values: { - formattedDate, - dataValue: data.value, - br: '
', - hr: '
', - }, - }); - - // Calculate the y offset. - // rectY are mouseY are relative to top of the chart area. - const rectY = d3.select(rect).attr('y'); - const mouseY = +(d3.mouse(rect)[1]); - - mlChartTooltipService.show(contents, rect, { - x: 5, - y: (mouseY - rectY) - }); - } - } - - // Process the data and then render the chart. - processChartData(); - render(); - } - - return { - scope: false, - link: link - }; -}); diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card.html b/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card.html deleted file mode 100644 index 4fbe5e465eed..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card.html +++ /dev/null @@ -1,24 +0,0 @@ -
- - -
- -
- -
-
-
- - -
diff --git a/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card_directive.js b/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card_directive.js deleted file mode 100644 index ff3a7b6238ae..000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_data_card/field_data_card_directive.js +++ /dev/null @@ -1,114 +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. - */ - - - -/* - * AngularJS directive for rendering a card showing data on a field in an index pattern. - */ - -import _ from 'lodash'; -import $ from 'jquery'; -import moment from 'moment'; -import chrome from 'ui/chrome'; - -import template from './field_data_card.html'; -import { ML_JOB_FIELD_TYPES } from 'plugins/ml/../common/constants/field_types'; -import { mlEscape } from 'plugins/ml/util/string_utils'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -module.directive('mlFieldDataCard', function (config) { - - function link(scope, element) { - scope.ML_JOB_FIELD_TYPES = ML_JOB_FIELD_TYPES; - scope.mlEscape = mlEscape; - - if (scope.card.type === ML_JOB_FIELD_TYPES.NUMBER) { - if (scope.card.fieldName) { - scope.$watch('card.stats', () => { - const cardinality = _.get(scope, ['card', 'stats', 'cardinality'], 0); - scope.detailsMode = cardinality > 100 ? 'distribution' : 'top'; - }); - - const cardinality = _.get(scope, ['card', 'stats', 'cardinality'], 0); - scope.detailsMode = cardinality > 100 ? 'distribution' : 'top'; - } - // Create a div for the chart tooltip. - $('.ml-field-data-card-tooltip').remove(); - $('body').append('