-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(query assist) update styles for callout and combo box (#1675)
Signed-off-by: Joshua Li <[email protected]>
- Loading branch information
1 parent
c14c3f8
commit 7163e2e
Showing
9 changed files
with
754 additions
and
464 deletions.
There are no files selected for viewing
825 changes: 475 additions & 350 deletions
825
public/components/common/search/__tests__/__snapshots__/search.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
...ents/event_analytics/explorer/query_assist/__tests__/__snapshots__/callouts.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Callouts spec EmptyQueryCallOut should match snapshot 1`] = ` | ||
<div> | ||
<div | ||
class="euiCallOut euiCallOut--warning euiCallOut--small" | ||
data-test-subj="query-assist-empty-callout" | ||
> | ||
<div | ||
class="euiCallOutHeader" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
height="16" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z" | ||
/> | ||
</svg> | ||
<span | ||
class="euiCallOutHeader__title" | ||
> | ||
Enter a natural language question to automatically generate a query to view results. | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Callouts spec PPLGeneratedCallOut should match snapshot 1`] = ` | ||
<div> | ||
<div | ||
class="euiCallOut euiCallOut--success euiCallOut--small" | ||
data-test-subj="query-assist-ppl-callout" | ||
> | ||
<div | ||
class="euiCallOutHeader" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
height="16" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z" | ||
/> | ||
</svg> | ||
<span | ||
class="euiCallOutHeader__title" | ||
> | ||
PPL query generated | ||
</span> | ||
</div> | ||
<button | ||
aria-label="dismissible_icon" | ||
class="euiButtonIcon euiButtonIcon--primary euiButtonIcon--empty euiButtonIcon--xSmall euiCallOut__closeIcon" | ||
data-test-subj="closeCallOutButton" | ||
type="button" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonIcon__icon" | ||
focusable="false" | ||
height="16" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z" | ||
/> | ||
</svg> | ||
</button> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`Callouts spec ProhibitedQueryCallOut should match snapshot 1`] = ` | ||
<div> | ||
<div | ||
class="euiCallOut euiCallOut--danger euiCallOut--small" | ||
data-test-subj="query-assist-guard-callout" | ||
> | ||
<div | ||
class="euiCallOutHeader" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
height="16" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="16" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z" | ||
/> | ||
</svg> | ||
<span | ||
class="euiCallOutHeader__title" | ||
> | ||
I am unable to respond to this query. Try another question. | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
40 changes: 40 additions & 0 deletions
40
public/components/event_analytics/explorer/query_assist/__tests__/callouts.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiCallOutProps } from '@elastic/eui'; | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { EmptyQueryCallOut, PPLGeneratedCallOut, ProhibitedQueryCallOut } from '../callouts'; | ||
|
||
const renderCallouts = ( | ||
Component: React.FC, | ||
overrideProps: Partial<Pick<EuiCallOutProps, 'onDismiss'>> = {} | ||
) => { | ||
const props: Pick<EuiCallOutProps, 'onDismiss'> = Object.assign( | ||
{ | ||
onDismiss: jest.fn(), | ||
}, | ||
overrideProps | ||
); | ||
const component = render(<Component {...props} />); | ||
return { component, props }; | ||
}; | ||
|
||
describe('Callouts spec', () => { | ||
test('ProhibitedQueryCallOut should match snapshot', () => { | ||
const { component } = renderCallouts(ProhibitedQueryCallOut); | ||
expect(component.container).toMatchSnapshot(); | ||
}); | ||
|
||
test('EmptyQueryCallOut should match snapshot', () => { | ||
const { component } = renderCallouts(EmptyQueryCallOut); | ||
expect(component.container).toMatchSnapshot(); | ||
}); | ||
|
||
test('PPLGeneratedCallOut should match snapshot', () => { | ||
const { component } = renderCallouts(PPLGeneratedCallOut); | ||
expect(component.container).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.