Skip to content

Commit

Permalink
various bug fixes for anywhere features (opensearch-project#507)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
  • Loading branch information
amitgalitz committed Jul 7, 2023
1 parent cb693ea commit c6399b9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
5 changes: 1 addition & 4 deletions public/action/ad_dashboard_action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '../../../../src/plugins/ui_actions/public';
import { isReferenceOrValueEmbeddable } from '../../../../src/plugins/embeddable/public';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import { isEmpty } from 'lodash';
import { VisualizeEmbeddable } from '../../../../src/plugins/visualizations/public';
import { isEligibleForVisLayers } from '../../../../src/plugins/vis_augmenter/public';

Expand Down Expand Up @@ -65,15 +64,13 @@ export const createADAction = ({
embeddable.parent &&
isDashboard(embeddable.parent) &&
vis !== undefined &&
isEligibleForVisLayers(vis) &&
!isEmpty((embeddable as VisualizeEmbeddable).visLayers)
isEligibleForVisLayers(vis)
);
},
execute: async ({ embeddable }: ActionContext) => {
if (!isReferenceOrValueEmbeddable(embeddable)) {
throw new IncompatibleActionError();
}

onClick({ embeddable });
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,18 @@ function AssociatedDetectors({ embeddable, closeFlyout, setMode }) {
<h3>Visualization: {embeddableTitle}</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem>
<EuiButton
fill
iconType="link"
onClick={() => {
setMode('existing');
}}
>
Associate a detector
</EuiButton>
<EuiFlexItem grow={false}>
<div>
<EuiButton
fill
iconType="link"
onClick={() => {
setMode('existing');
}}
>
Associate a detector
</EuiButton>
</div>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { formikToDetectorName, visFeatureListToFormik } from './helpers';
import { AssociateExisting } from './AssociateExisting';
import { mountReactNode } from '../../../../../../src/core/public/utils';
import { FLYOUT_MODES } from '../AnywhereParentFlyout/constants';
import { DetectorListItem } from '../../../../public/models/interfaces';

function AddAnomalyDetector({
embeddable,
Expand Down Expand Up @@ -206,9 +207,7 @@ function AddAnomalyDetector({
}
});
} else {
notifications.toasts.addDanger(
'One or more features are required.'
);
notifications.toasts.addDanger('One or more features are required.');
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ export function AssociateExisting(
<p>
View existing anomaly detectors across your system and add the
detector(s) to a dashboard and visualization.{' '}
<a href={`${BASE_DOCS_LINK}/ad`} target="_blank">
<a
href={`${BASE_DOCS_LINK}/ad`}
target="_blank"
style={{ display: 'inline-block' }}
>
Learn more <EuiIcon type="popout" />
</a>
</p>
Expand Down Expand Up @@ -218,7 +222,7 @@ export function AssociateExisting(
}}
aria-label="Select an anomaly detector to associate"
isClearable
singleSelection
singleSelection={{ asPlainText: true }}
placeholder="Search for an anomaly detector"
/>
) : (
Expand All @@ -238,7 +242,12 @@ export function AssociateExisting(
</EuiHealth>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink href={`${PLUGIN_NAME}#/detectors/${detector.id}`}>
<EuiLink
style={{ paddingTop: '3px' }}
href={`${PLUGIN_NAME}#/detectors/${detector.id}`}
target="_blank"
icon="popout"
>
View detector page
</EuiLink>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const getFeatureNameFromVisParams = (id, seriesParams) => {
});

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

function visAggregationToFormik(value) {
Expand Down
5 changes: 1 addition & 4 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ import {
VisAugmenterSetup,
VisAugmenterStart,
} from '../../../src/plugins/vis_augmenter/public';
import {
UiActionsSetup,
UiActionsStart,
} from '../../../src/plugins/ui_actions/public';
import { UiActionsStart } from '../../../src/plugins/ui_actions/public';

declare module '../../../src/plugins/ui_actions/public' {
export interface ActionContextMapping {
Expand Down

0 comments on commit c6399b9

Please sign in to comment.