Skip to content

Commit

Permalink
incorporate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Nov 9, 2021
1 parent 95ad5fc commit af56f4e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/ml/public/maps/anomaly_job_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class AnomalyJobSelector extends Component<Props, State> {
return null;
}

const options = this.state.jobId ? [{ value: this.state.jobId, label: this.state.jobId }] : [];
return (
<EuiFormRow
label={i18n.translate('xpack.ml.maps.jobIdLabel', {
Expand All @@ -76,7 +75,9 @@ export class AnomalyJobSelector extends Component<Props, State> {
singleSelection={true}
onChange={this.onJobIdSelect}
options={this.state.jobIdList}
selectedOptions={options}
selectedOptions={
this.state.jobId ? [{ value: this.state.jobId, label: this.state.jobId }] : []
}
/>
</EuiFormRow>
);
Expand Down
20 changes: 17 additions & 3 deletions x-pack/plugins/ml/public/maps/anomaly_layer_wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
import { i18n } from '@kbn/i18n';
import React from 'react';
import uuid from 'uuid';
import { LAYER_TYPE, LAYER_WIZARD_CATEGORY, STYLE_TYPE } from '../../../maps/common';
import {
COLOR_MAP_TYPE,
FIELD_ORIGIN,
LAYER_TYPE,
LAYER_WIZARD_CATEGORY,
STYLE_TYPE,
} from '../../../maps/common';
import { AnomalySource, AnomalySourceDescriptor } from './anomaly_source';
import { CreateAnomalySourceEditor } from './create_anomaly_source_editor';
import {
Expand Down Expand Up @@ -51,9 +57,17 @@ export const anomalyLayerWizard: LayerWizard = {
type: 'VECTOR',
properties: {
fillColor: {
type: STYLE_TYPE.STATIC,
type: STYLE_TYPE.DYNAMIC,
options: {
color: 'rgb(255,0,0)',
color: 'Blue to Red',
colorCategory: 'palette_0',
fieldMetaOptions: { isEnabled: true, sigma: 3 },
type: COLOR_MAP_TYPE.ORDINAL,
field: {
name: 'record_score',
origin: FIELD_ORIGIN.SOURCE,
},
useCustomColorRamp: false,
},
},
} as unknown as VectorStylePropertiesDescriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React, { Component } from 'react';
import { EuiPanel } from '@elastic/eui';
import { AnomalySourceDescriptor } from './anomaly_source';
import { AnomalyJobSelector } from './anomaly_job_selector';
import { TypicalActualSelector } from './typical_actual_selector';
import { LayerSelector } from './layer_selector';

interface Props {
onSourceConfigChange: (sourceConfig: Partial<AnomalySourceDescriptor> | null) => void;
Expand Down Expand Up @@ -68,7 +68,7 @@ export class CreateAnomalySourceEditor extends Component<Props, State> {

render() {
const selector = this.state.jobId ? (
<TypicalActualSelector
<LayerSelector
onChange={this.onTypicalActualChange}
typicalActual={this.state.typicalActual || 'typical'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Props {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface State {}

export class TypicalActualSelector extends Component<Props, State> {
export class LayerSelector extends Component<Props, State> {
private _isMounted: boolean = false;

state: State = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { Fragment, Component } from 'react';

import { FormattedMessage } from '@kbn/i18n/react';
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { TypicalActualSelector } from './typical_actual_selector';
import { LayerSelector } from './layer_selector';

interface Props {
onChange: (...args: Array<{ propName: string; value: unknown }>) => void;
Expand All @@ -32,7 +32,7 @@ export class UpdateAnomalySourceEditor extends Component<Props, State> {
</h6>
</EuiTitle>
<EuiSpacer size="s" />
<TypicalActualSelector
<LayerSelector
onChange={(typicalActual: 'typical' | 'actual') => {
this.props.onChange({
propName: 'typicalActual',
Expand Down

0 comments on commit af56f4e

Please sign in to comment.