diff --git a/x-pack/plugins/file_data_visualizer/common/constants.ts b/x-pack/plugins/file_data_visualizer/common/constants.ts index f2a2e52a2267f9..819549a7eb4e6f 100644 --- a/x-pack/plugins/file_data_visualizer/common/constants.ts +++ b/x-pack/plugins/file_data_visualizer/common/constants.ts @@ -15,7 +15,7 @@ export const ABSOLUTE_MAX_FILE_SIZE_BYTES = 1073741274; // 1GB export const FILE_SIZE_DISPLAY_FORMAT = '0,0.[0] b'; // Value to use in the Elasticsearch index mapping meta data to identify the -// index as having been created by the ML File Data Visualizer. +// index as having been created by the File Data Visualizer. export const INDEX_META_DATA_CREATED_BY = 'file-data-visualizer'; export const JOB_FIELD_TYPES = { diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/_ml_embedded_map.scss b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_embedded_map.scss similarity index 100% rename from x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/_ml_embedded_map.scss rename to x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_embedded_map.scss diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss new file mode 100644 index 00000000000000..5b3c6b4990ff11 --- /dev/null +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/_index.scss @@ -0,0 +1 @@ +@import 'embedded_map'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/ml_embedded_map.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/embedded_map.tsx similarity index 100% rename from x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/ml_embedded_map.tsx rename to x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/embedded_map.tsx diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/index.ts b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts similarity index 81% rename from x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/index.ts rename to x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts index eda8ec6604eb2a..ee11a18345f64b 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/index.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/embedded_map/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { EmbeddedMapComponent } from './ml_embedded_map'; +export { EmbeddedMapComponent } from './embedded_map'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx index b33a084e410ef0..c395b06059e8f7 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/expanded_row/geo_point_content/geo_point_content.tsx @@ -11,7 +11,7 @@ import { EuiFlexItem } from '@elastic/eui'; import { Feature, Point } from 'geojson'; import type { FieldDataRowProps } from '../../stats_table/types/field_data_row'; import { DocumentStatsTable } from '../../stats_table/components/field_data_expanded_row/document_stats'; -import { EmbeddedMapComponent } from '../../ml_embedded_map'; +import { EmbeddedMapComponent } from '../../embedded_map'; import { convertWKTGeoToLonLat, getGeoPointsLayer } from './format_utils'; import { ExpandedRowContent } from '../../stats_table/components/field_data_expanded_row/expanded_row_content'; import { ExamplesList } from '../../examples_list'; @@ -38,7 +38,7 @@ export const GeoPointContent: FC = ({ config }) => { geoPointsFeatures.push({ type: 'Feature', - id: `ml-${config.fieldName}-${i}`, + id: `fileDataVisualizer-${config.fieldName}-${i}`, geometry: { type: 'Point', coordinates: [coordinates.lat, coordinates.lon], @@ -69,7 +69,7 @@ export const GeoPointContent: FC = ({ config }) => { )} {formattedResults && Array.isArray(formattedResults.layerList) && ( diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss index 016d5cd579e3fc..8b21620542ff75 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss +++ b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/_experimental_badge.scss @@ -1,4 +1,4 @@ -.ml-experimental-badge.euiBetaBadge { +.experimental-badge.euiBetaBadge { font-size: 10px; vertical-align: middle; margin-bottom: 5px; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx index 819c3b04b1ef92..a067cb198914ee 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/experimental_badge/experimental_badge.tsx @@ -14,7 +14,7 @@ export const ExperimentalBadge: FC<{ tooltipContent: string }> = ({ tooltipConte return ( = ({ if ( type !== undefined && !fieldTypesTracker.has(type) && - ML_JOB_FIELD_TYPES_OPTIONS[type] !== undefined + JOB_FIELD_TYPES_OPTIONS[type] !== undefined ) { - const item = ML_JOB_FIELD_TYPES_OPTIONS[type]; + const item = JOB_FIELD_TYPES_OPTIONS[type]; fieldTypesTracker.add(type); fieldTypes.push({ diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_field_stats_card.scss b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_field_stats_card.scss deleted file mode 100644 index d0af6d3f01d2f2..00000000000000 --- a/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_field_stats_card.scss +++ /dev/null @@ -1,150 +0,0 @@ -.card-container { - display: inline-grid; - display: -ms-inline-grid; - padding: 0 10px 10px 0; -} - -.ml-field-data-card { - // These styles should all be removed once the file data visualizer is using - // the same field_data_card component as the index based data visualizer. - height: 408px; - box-shadow: none; - border-color: $euiBorderColor; - - // Note the names of these styles need to match the type of the field they are displaying. - .boolean { - color: $euiColorVis5; - border-color: $euiColorVis5; - } - - .date { - color: $euiColorVis7; - border-color: $euiColorVis7; - } - - .document_count { - color: $euiColorVis2; - border-color: $euiColorVis2; - } - - .geo_point { - color: $euiColorVis8; - border-color: $euiColorVis8; - } - - .ip { - color: $euiColorVis3; - border-color: $euiColorVis3; - } - - .keyword { - color: $euiColorVis0; - border-color: $euiColorVis0; - } - - .number { - color: $euiColorVis1; - border-color: $euiColorVis1; - } - - .text { - color: $euiColorVis9; - border-color: $euiColorVis9; - } - - .type-other, - .unknown { - color: $euiColorVis6; - border-color: $euiColorVis6; - } - - // Use euiPanel styling - @include euiPanel($selector: '.card-contents'); - - .stats { - text-align: center; - } - - .stat { - padding-bottom: 6px; - } - - .stat.heading { - padding-bottom: 0; - } - - .stat.min, - .stat.max, - .stat.median { - width: 30%; - display: inline-block; - } - - .stat.min.value, - .stat.max.value, - .stat.median.value { - font-size: $euiFontSizeS; - @include euiTextTruncate; - } - - .valueWrapper { - display: inline; - } - - .not-exist-message { - padding: 50px 30px 0 30px; - text-align: center; - } - - .sampled-message { - font-size: 11px; - color: #555555; - text-align: center; - padding-top: 3px; - } - - .text-code { - font-family: $euiCodeFontFamily; - } - - .details-select { - text-align: center; - margin-top: 5px; - margin-bottom: 5px; - } - - .details-container { - padding-top: 5px; - } - - .top-value { - height: 21px; - font-size: 13px; - - .field-label { - @include euiTextTruncate; - - display: inline-block; - width: 100px; - text-align: right; - } - - .count-label { - display: inline-block; - width: 70px; - text-align: left; - overflow: hidden; - text-overflow: ellipsis; - } - - .top-value-bar-holder { - display: inline-block; - width: 160px; - } - - .top-value-bar { - height: 15px; - min-width: 3px; - } - } -} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_fields_stats.scss b/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_fields_stats.scss deleted file mode 100644 index 5decacfe1b7b87..00000000000000 --- a/x-pack/plugins/file_data_visualizer/public/application/components/fields_stats/_fields_stats.scss +++ /dev/null @@ -1,6 +0,0 @@ -.fields-stats { - padding: 10px; -} -.field { - margin-bottom: 10px; -} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx index 9c3f9b4ac886c7..d429f8dada6ec1 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/json_editor/json_editor.tsx @@ -12,7 +12,7 @@ import { expandLiteralStrings, XJsonMode } from '../../shared_imports'; export const EDITOR_MODE = { TEXT: 'text', JSON: 'json', XJSON: new XJsonMode() }; -interface MlJobEditorProps { +interface JobEditorProps { value: string; height?: string; width?: string; @@ -22,7 +22,7 @@ interface MlJobEditorProps { theme?: string; onChange?: EuiCodeEditorProps['onChange']; } -export const JsonEditor: FC = ({ +export const JsonEditor: FC = ({ value, height = '500px', width = '100%', diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/_index.scss deleted file mode 100644 index 6d0d30dae670ea..00000000000000 --- a/x-pack/plugins/file_data_visualizer/public/application/components/ml_embedded_map/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'ml_embedded_map'; diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss index 70ad81600692be..d317d324bae90c 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/_index.scss @@ -19,7 +19,7 @@ } } -.mlDataVisualizer { +.dataVisualizer { .euiTableRow > .euiTableRowCell { border-bottom: 0; border-top: $euiBorderThin; @@ -36,7 +36,7 @@ } } } - .mlDataVisualizerSummaryTable { + .dataVisualizerSummaryTable { max-width: 350px; min-width: 250px; .euiTableRow > .euiTableRowCell { @@ -46,10 +46,10 @@ display: none; } } - .mlDataVisualizerSummaryTableWrapper { + .dataVisualizerSummaryTableWrapper { max-width: 300px; } - .mlDataVisualizerMapWrapper { + .dataVisualizerMapWrapper { min-height: 300px; min-width: 600px; } diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx index 3f7ebb9d55849c..7c9ddcdab29c8e 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/boolean_content.tsx @@ -90,10 +90,10 @@ export const BooleanContent: FC = ({ config }) => { - + {summaryTableTitle} = ({ config }) => { return ( - + {summaryTableTitle} - className={'mlDataVisualizerSummaryTable'} + className={'dataVisualizerSummaryTable'} data-test-subj={'mlDateSummaryTable'} compressed items={summaryTableItems} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx index f0ebe741df6f77..f3ac0d94aa2551 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/components/field_data_expanded_row/document_stats.tsx @@ -78,11 +78,11 @@ export const DocumentStatsTable: FC = ({ config }) => { return ( {metaTableTitle} = ({ config }) => { return ( - + {summaryTableTitle} - className={'mlDataVisualizerSummaryTable'} + className={'dataVisualizerSummaryTable'} compressed items={summaryTableItems} columns={summaryTableColumns} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx index 97c44f49b733ec..bfa40c487a2ac4 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/data_visualizer_stats_table.tsx @@ -264,7 +264,7 @@ export const DataVisualizerTable = ({ return ( - className={'mlDataVisualizer'} + className={'dataVisualizer'} items={items} itemId={FIELD_NAME} columns={columns} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx index 5f0c0a401bedd1..58be31a53e9c52 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/stats_table/hooks/color_range_legend.tsx @@ -64,7 +64,7 @@ export const ColorRangeLegend: FC = ({ const wrapper = d3 .select(d3Container.current) - .classed('mlColorRangeLegend', true) + .classed('colorRangeLegend', true) .attr('width', wrapperWidth) .attr('height', wrapperHeight) .append('g') @@ -74,7 +74,7 @@ export const ColorRangeLegend: FC = ({ const gradient = wrapper .append('defs') .append('linearGradient') - .attr('id', 'mlColorRangeGradient') + .attr('id', 'colorRangeGradient') .attr('x1', '0%') .attr('y1', '0%') .attr('x2', '100%') @@ -95,7 +95,7 @@ export const ColorRangeLegend: FC = ({ .attr('y1', 0) .attr('width', legendWidth) .attr('height', legendHeight) - .style('fill', 'url(#mlColorRangeGradient)'); + .style('fill', 'url(#colorRangeGradient)'); const axisScale = d3.scale.linear().domain([0, 1]).range([0, legendWidth]); diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss index 75ee6aef1b7eb1..05fa1bfa94b2d7 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss +++ b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/_top_values.scss @@ -1,19 +1,19 @@ -.mlFieldDataTopValuesContainer { +.fieldDataTopValuesContainer { padding-top: $euiSizeXS; } -.mlTopValuesValueLabelContainer { +.topValuesValueLabelContainer { margin-right: $euiSizeM; - &.mlTopValuesValueLabelContainer--small { + &.topValuesValueLabelContainer--small { width:70px; } - &.mlTopValuesValueLabelContainer--large { + &.topValuesValueLabelContainer--large { width: 200px; } } -.mlTopValuesPercentLabelContainer { +.topValuesPercentLabelContainer { margin-left: $euiSizeM; width:70px; } diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx index 6b7323146f4792..c1815fad41de8e 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx +++ b/x-pack/plugins/file_data_visualizer/public/application/components/top_values/top_values.tsx @@ -57,7 +57,7 @@ export const TopValues: FC = ({ stats, fieldFormat, barColor, compressed /> -
+
{Array.isArray(topValues) && topValues.map((value) => ( @@ -65,8 +65,8 @@ export const TopValues: FC = ({ stats, fieldFormat, barColor, compressed grow={false} className={classNames( 'eui-textTruncate', - 'mlTopValuesValueLabelContainer', - `mlTopValuesValueLabelContainer--${compressed === true ? 'small' : 'large'}` + 'topValuesValueLabelContainer', + `topValuesValueLabelContainer--${compressed === true ? 'small' : 'large'}` )} > @@ -86,7 +86,7 @@ export const TopValues: FC = ({ stats, fieldFormat, barColor, compressed {progressBarMax !== undefined && ( {getPercentLabel(value.doc_count, progressBarMax)} diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts index c62725b58b1e7c..5e12302a598ff6 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/format_value.ts @@ -23,7 +23,7 @@ const SIGFIGS_IF_ROUNDING = 3; // Number of sigfigs to use for values < 10 // order to correctly format the day or week offset to the time of the anomaly. export function formatSingleValue( value: number, - mlFunction?: string, + func?: string, fieldFormat?: any, record?: any // TODO remove record, not needed for file upload ) { @@ -36,14 +36,14 @@ export function formatSingleValue( // start of the week / day, so need to manipulate to UTC moment of the start of the week / day // that the anomaly occurred using record timestamp if supplied, add on the offset, and finally // revert back to configured timezone for formatting. - if (mlFunction === 'time_of_week') { + if (func === 'time_of_week') { const d = record !== undefined && record.timestamp !== undefined ? new Date(record.timestamp) : new Date(); const utcMoment = moment.utc(d).startOf('week').add(value, 's'); return moment(utcMoment.valueOf()).format('ddd HH:mm'); - } else if (mlFunction === 'time_of_day') { + } else if (func === 'time_of_day') { const d = record !== undefined && record.timestamp !== undefined ? new Date(record.timestamp) diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts index 99dbd58d14624a..6990bf0923ac35 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/number_as_ordinal.test.ts @@ -7,7 +7,7 @@ import { numberAsOrdinal } from './number_as_ordinal'; -describe('ML - numberAsOrdinal formatter', () => { +describe('numberAsOrdinal formatter', () => { const tests = [ { number: 0, asOrdinal: '0th' }, { number: 1, asOrdinal: '1st' }, diff --git a/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts index dc4cee37ec67ed..151ae93a93815f 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/components/utils/round_to_decimal_place.test.ts @@ -7,7 +7,7 @@ import { roundToDecimalPlace } from './round_to_decimal_place'; -describe('ML - roundToDecimalPlace formatter', () => { +describe('roundToDecimalPlace formatter', () => { it('returns the correct format using default decimal place', () => { expect(roundToDecimalPlace(12)).toBe(12); expect(roundToDecimalPlace(12.3)).toBe(12.3); diff --git a/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts b/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts index 29c7cfe9bb553b..6752c322d42e3e 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/kibana_context.ts @@ -6,9 +6,8 @@ */ import { CoreStart } from 'kibana/public'; -import { useKibana, KibanaReactContextValue } from '../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import type { FileDataVisualizerStartDependencies } from '../plugin'; export type StartServices = CoreStart & FileDataVisualizerStartDependencies; export const useFileDataVisualizerKibana = () => useKibana(); -export type MlKibanaReactContextValue = KibanaReactContextValue; diff --git a/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts index aa909fb579b98a..6f81c0bf4e7d32 100644 --- a/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts +++ b/x-pack/plugins/file_data_visualizer/public/application/util/field_types_utils.test.ts @@ -8,19 +8,19 @@ import { JOB_FIELD_TYPES } from '../../../common'; import { getJobTypeAriaLabel, jobTypeAriaLabels } from './field_types_utils'; -describe('ML - field type utils', () => { +describe('field type utils', () => { describe('getJobTypeAriaLabel: Getting a field type aria label by passing what it is stored in constants', () => { test('should returns all JOB_FIELD_TYPES labels exactly as it is for each correct value', () => { - const mlKeys = Object.keys(JOB_FIELD_TYPES); - const receivedMlLabels: Record = {}; + const keys = Object.keys(JOB_FIELD_TYPES); + const receivedLabels: Record = {}; const testStorage = jobTypeAriaLabels; - mlKeys.forEach((constant) => { - receivedMlLabels[constant] = getJobTypeAriaLabel( + keys.forEach((constant) => { + receivedLabels[constant] = getJobTypeAriaLabel( JOB_FIELD_TYPES[constant as keyof typeof JOB_FIELD_TYPES] ); }); - expect(receivedMlLabels).toEqual(testStorage); + expect(receivedLabels).toEqual(testStorage); }); test('should returns NULL as JOB_FIELD_TYPES does not contain such a keyword', () => { expect(getJobTypeAriaLabel('JOB_FIELD_TYPES')).toBe(null);