Skip to content

Commit

Permalink
remove unnecessary type
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Jan 24, 2022
1 parent 2321384 commit 1ae5ddc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/public/maps/anomaly_source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class AnomalySource implements IVectorSource {
}

async getSupportedShapeTypes(): Promise<VECTOR_SHAPE_TYPE[]> {
return this._descriptor.typicalActual === 'typical to actual'
return this._descriptor.typicalActual === ML_ANOMALY_LAYERS.TYPICAL_TO_ACTUAL
? [VECTOR_SHAPE_TYPE.LINE]
: [VECTOR_SHAPE_TYPE.POINT];
}
Expand Down
7 changes: 3 additions & 4 deletions x-pack/plugins/ml/public/maps/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type { MlApiServices } from '../application/services/ml_api_service';
import { MLAnomalyDoc } from '../../common/types/anomalies';
import { VectorSourceRequestMeta } from '../../../maps/common';

export type MlAnomalyLayers = 'typical' | 'actual' | 'typical to actual';
export enum ML_ANOMALY_LAYERS {
TYPICAL = 'typical',
ACTUAL = 'actual',
Expand All @@ -33,7 +32,7 @@ function getCoordinates(actualCoordinateStr: string, round: boolean = false): nu
export async function getResultsForJobId(
mlResultsService: MlApiServices['results'],
jobId: string,
locationType: MlAnomalyLayers,
locationType: ML_ANOMALY_LAYERS,
searchFilters: VectorSourceRequestMeta
): Promise<FeatureCollection> {
const { timeFilters } = searchFilters;
Expand Down Expand Up @@ -102,10 +101,10 @@ export async function getResultsForJobId(
}

let geometry: Geometry;
if (locationType === 'typical' || locationType === 'actual') {
if (locationType === ML_ANOMALY_LAYERS.TYPICAL || locationType === ML_ANOMALY_LAYERS.ACTUAL) {
geometry = {
type: 'Point',
coordinates: locationType === 'typical' ? typical : actual,
coordinates: locationType === ML_ANOMALY_LAYERS.TYPICAL ? typical : actual,
};
} else {
geometry = {
Expand Down

0 comments on commit 1ae5ddc

Please sign in to comment.