Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make feature anywhere formatted detector name an assgiend value #506

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export function visFeatureListToFormik(
}

export function formikToDetectorName(title) {
const detectorName =
let detectorName =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what is the reason of changing this to let from const?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no specific reason, the constant variable vs mutable variable difference doesn't matter here. I was just playing around trying to figure out the constant not getting reassigned issue, didn't change it back after making it work. Changed it back to const

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) => {
Expand All @@ -43,7 +43,8 @@ const getFeatureNameFromVisParams = (id, seriesParams) => {
}
});

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formattedFeatureName :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

return formatedFeatureName
};

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 =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this link just sends to the main opensearch.org doc page

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's because the doc side pr hasn’t merged yet. So the link doesn't exist yet

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it will be the link for feature anywhere documentation page

'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