Skip to content

Commit

Permalink
make feature anywhere formatted detector name an assgiend value (open…
Browse files Browse the repository at this point in the history
…search-project#506)

* make feature anywhere formatted detector name an assgiend value to return

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* update feature anywhere documentation link

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* correct type

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

* correct typo

Signed-off-by: Jackie Han <jkhanjob@gmail.com>

---------

Signed-off-by: Jackie Han <jkhanjob@gmail.com>
  • Loading branch information
jackiehanyang authored and amitgalitz committed Jul 7, 2023
1 parent 1470204 commit cb693ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ export function visFeatureListToFormik(
export function formikToDetectorName(title) {
const detectorName =
title + '_anomaly_detector_' + Math.floor(100000 + Math.random() * 900000);
detectorName.replace(/[^a-zA-Z0-9-_]/g, '_');
return detectorName;
const formattedName = detectorName.replace(/[^a-zA-Z0-9\-_]/g, '_');
return formattedName;
}

const getFeatureNameFromVisParams = (id, seriesParams) => {
let name = find(seriesParams, function (param) {
const name = find(seriesParams, function (param) {
if (param.data.id === id) {
return true;
}
});

return name.data.label.replace(/[^a-zA-Z0-9-_]/g, '_');
const formattedFeatureName = name.data.label.replace(/[^a-zA-Z0-9-_]/g, '_');
return formattedFeatureName
};

function visAggregationToFormik(value) {
Expand Down
3 changes: 3 additions & 0 deletions public/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const AD_DOCS_LINK =
export const AD_HIGH_CARDINALITY_LINK =
'https://opensearch.org/docs/latest/observing-your-data/ad/index/#optional-set-category-fields-for-high-cardinality';

export const AD_FEATURE_ANYWHERE_LINK =
'https://opensearch.org/docs/latest/observing-your-data/ad/dashboards-anomaly-detection/';

export const MAX_DETECTORS = 1000;

export const MAX_ANOMALIES = 10000;
Expand Down
4 changes: 2 additions & 2 deletions public/utils/contextMenu/getActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import AnywhereParentFlyout from '../../components/FeatureAnywhereContextMenu/An
import { Provider } from 'react-redux';
import configureStore from '../../redux/configureStore';
import DocumentationTitle from '../../components/FeatureAnywhereContextMenu/DocumentationTitle/containers/DocumentationTitle';
import { AD_DOCS_LINK, APM_TRACE } from '../constants';
import { AD_FEATURE_ANYWHERE_LINK, APM_TRACE } from '../constants';
import { getClient, getOverlays } from '../../../public/services';
import { FLYOUT_MODES } from '../../../public/components/FeatureAnywhereContextMenu/AnywhereParentFlyout/constants';

Expand Down Expand Up @@ -80,7 +80,7 @@ export const getActions = () => {
icon: 'documentation' as EuiIconType,
order: 98,
onClick: () => {
window.open(AD_DOCS_LINK, '_blank');
window.open(AD_FEATURE_ANYWHERE_LINK, '_blank');
},
},
].map((options) => createADAction({ ...options, grouping }));
Expand Down

0 comments on commit cb693ea

Please sign in to comment.