diff --git a/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx b/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx index 04b0493c..1cbdbc82 100644 --- a/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx +++ b/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx @@ -144,6 +144,11 @@ function AssociatedDetectors({ embeddable, closeFlyout, setMode }) { getAugmentVisSavedObjs(embeddable.vis.id, savedObjectLoader, uiSettings) .then((savedAugmentObjectsArr: any) => { if (savedAugmentObjectsArr != undefined) { + if (maxAssociatedCount <= savedAugmentObjectsArr.length) { + setAssociationLimitReached(true); + } else { + setAssociationLimitReached(false); + } const curSelectedDetectors = getAssociatedDetectors( Object.values(allDetectors), savedAugmentObjectsArr @@ -152,11 +157,6 @@ function AssociatedDetectors({ embeddable, closeFlyout, setMode }) { maxAssociatedCount = uiSettings.get( PLUGIN_AUGMENTATION_MAX_OBJECTS_SETTING ); - if (maxAssociatedCount <= curSelectedDetectors.length) { - setAssociationLimitReached(true); - } else { - setAssociationLimitReached(false); - } setIsLoadingFinalDetectors(false); } }) diff --git a/public/components/FeatureAnywhereContextMenu/CreateAnomalyDetector/AddAnomalyDetector.tsx b/public/components/FeatureAnywhereContextMenu/CreateAnomalyDetector/AddAnomalyDetector.tsx index 3131b399..106d0dff 100644 --- a/public/components/FeatureAnywhereContextMenu/CreateAnomalyDetector/AddAnomalyDetector.tsx +++ b/public/components/FeatureAnywhereContextMenu/CreateAnomalyDetector/AddAnomalyDetector.tsx @@ -983,6 +983,7 @@ function AddAnomalyDetector({ ) : ( { diff --git a/public/plugin.ts b/public/plugin.ts index 8d8f6db2..25ea0ebf 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -34,7 +34,7 @@ import { setSavedFeatureAnywhereLoader, setUiActions, setUISettings, - setQueryService + setQueryService, } from './services'; import { AnomalyDetectionOpenSearchDashboardsPluginStart } from 'public'; import { diff --git a/public/services.ts b/public/services.ts index 0ee47f2b..ef899307 100644 --- a/public/services.ts +++ b/public/services.ts @@ -36,8 +36,8 @@ export const [getUiActions, setUiActions] = export const [getUISettings, setUISettings] = createGetterSetter('UISettings'); -export const [getQueryService, setQueryService] = -createGetterSetter('Query'); +export const [getQueryService, setQueryService] = + createGetterSetter('Query'); // This is primarily used for mocking this module and each of its fns in tests. export default {