{feature.featureName}
; }); }, @@ -451,7 +451,7 @@ export const getLatestAnomalyResultsByTimeRange = async ( ) ); - const searchAnomalyResponse = searchResponse.data.response; + const searchAnomalyResponse = searchResponse.response; const numHits = get(searchAnomalyResponse, 'hits.total.value', 0); if (numHits === 0) { @@ -502,7 +502,7 @@ export const getLatestAnomalyResultsForDetectorsByTimeRange = async ( ) ) ); - const searchAnomalyResponse = searchResponse.data.response; + const searchAnomalyResponse = searchResponse.response; const numHits = get(searchAnomalyResponse, 'hits.total.value', 0); if (numHits === 0) { @@ -530,14 +530,14 @@ export const getLatestAnomalyResultsForDetectorsByTimeRange = async ( numSingleBatchResults = anomalies.length; } while (numSingleBatchResults === MAX_ANOMALIES); - const filteredAnomalyResults = anomalyResults.filter(anomaly => + const filteredAnomalyResults = anomalyResults.filter((anomaly) => detectorAndIdMap.has(get(anomaly, AD_DOC_FIELDS.DETECTOR_ID, '')) ); const orderedLiveAnomalyData = orderBy( filteredAnomalyResults, // sort by data start time in desc order - anomalyData => get(anomalyData, AD_DOC_FIELDS.DATA_START_TIME, ''), + (anomalyData) => get(anomalyData, AD_DOC_FIELDS.DATA_START_TIME, ''), SORT_DIRECTION.DESC ); const latestAnomalousDetectorIds = selectLatestAnomalousDetectorIds( @@ -545,10 +545,11 @@ export const getLatestAnomalyResultsForDetectorsByTimeRange = async ( detectorNum ); if (!isEmpty(latestAnomalousDetectorIds)) { - const finalLiveAnomalyResult = orderedLiveAnomalyData.filter(anomalyData => - latestAnomalousDetectorIds.has( - get(anomalyData, AD_DOC_FIELDS.DETECTOR_ID, '') - ) + const finalLiveAnomalyResult = orderedLiveAnomalyData.filter( + (anomalyData) => + latestAnomalousDetectorIds.has( + get(anomalyData, AD_DOC_FIELDS.DETECTOR_ID, '') + ) ); return finalLiveAnomalyResult; } @@ -562,7 +563,7 @@ const buildDetectorAndIdMap = ( ): Map
- Custom expression:{' '}
-
+ Custom expression:{' '}
+
Field: {metaData.aggregationOf || ''}
-Aggregation method: {metaData.aggregationBy || ''}
-Field: {metaData.aggregationOf || ''}
+Aggregation method: {metaData.aggregationBy || ''}
+
- {`${setParamsText} ${previewText} `}
-
+ {`${setParamsText} ${previewText} `}
+
{title}
-{`(${count})`}
+{`(${count})`}
); diff --git a/server/index.ts b/server/index.ts new file mode 100644 index 00000000..2b4673a8 --- /dev/null +++ b/server/index.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file 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 { schema, TypeOf } from '@kbn/config-schema'; +import { + PluginConfigDescriptor, + PluginInitializerContext, +} from '../../../src/core/server'; +import { AnomalyDetectionKibanaPlugin } from './plugin'; + +export const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), +}); + +export type AnomalyDetectionKibanaPluginConfigType = TypeOf< + typeof configSchema +>; + +export const config: PluginConfigDescriptor