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

Additional visual fixes for anywhere flyout #507

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need div inside the EuiFlexItem?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wrapping button with a div means the button doesn't extend when the screen size increases. Want the button to stay the same size and wrapped around the text. Ex: https://oui.opensearch.org/1.2/#/layout/flex#flex-items-are-also-flex
You can look at the demo js for the "Unless you wrap them" button.

Copy link
Collaborator

Choose a reason for hiding this comment

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

got it

<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