-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e9e6e5
commit 7611a7d
Showing
4 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
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
8 changes: 8 additions & 0 deletions
8
...search/public/applications/app_search/components/result_settings/sample_response/index.ts
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,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { SampleResponse } from './sample_response'; |
19 changes: 19 additions & 0 deletions
19
...plications/app_search/components/result_settings/sample_response/sample_response.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,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { shallow } from 'enzyme'; | ||
|
||
import { SampleResponse } from './sample_response'; | ||
|
||
describe('SampleResponse', () => { | ||
it('renders', () => { | ||
const wrapper = shallow(<SampleResponse />); | ||
expect(wrapper.isEmptyRender()).toBe(false); | ||
}); | ||
}); |
102 changes: 102 additions & 0 deletions
102
...ic/applications/app_search/components/result_settings/sample_response/sample_response.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,102 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { | ||
EuiCodeBlock, | ||
EuiFieldSearch, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiPanel, | ||
EuiSpacer, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const SampleResponse: React.FC = () => { | ||
return ( | ||
<EuiPanel hasShadow> | ||
<EuiFlexGroup alignItems="center"> | ||
<EuiFlexItem> | ||
<EuiTitle size="s"> | ||
<h3> | ||
{i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.resultSettings.sampleResponseTitle', | ||
{ defaultMessage: 'Sample response' } | ||
)} | ||
</h3> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
{/* TODO <QueryPerformance queryPerformanceRating={queryPerformanceRating} /> */} | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiSpacer /> | ||
<EuiFieldSearch | ||
// TODO onChange={(e) => setQuery(e.target.value || '')} | ||
placeholder={i18n.translate( | ||
'xpack.enterpriseSearch.appSearch.engine.resultSettings.sampleResponse.inputPlaceholder', | ||
{ defaultMessage: 'Type a search query to test a response...' } | ||
)} | ||
data-test-subj="ResultSettingsQuerySampleResponse" | ||
/> | ||
<EuiSpacer /> | ||
<EuiCodeBlock language="json" whiteSpace="pre-wrap"> | ||
{/* TODO Replace this static content with dynamic content */} | ||
{JSON.stringify( | ||
{ | ||
visitors: { | ||
raw: 776218, | ||
}, | ||
nps_image_url: { | ||
raw: | ||
'https://www.nps.gov/common/uploads/banner_image/imr/homepage/9E7FC0DB-1DD8-B71B-0BC3880DC2250415.jpg', | ||
}, | ||
square_km: { | ||
raw: 1366.2, | ||
}, | ||
world_heritage_site: { | ||
raw: 'false', | ||
}, | ||
date_established: { | ||
raw: '1964-09-12T05:00:00+00:00', | ||
}, | ||
image_url: { | ||
raw: | ||
'https://storage.googleapis.com/public-demo-assets.swiftype.info/swiftype-dot-com-search-ui-national-parks-demo/9E7FC0DB-1DD8-B71B-0BC3880DC2250415.jpg', | ||
}, | ||
description: { | ||
raw: | ||
'This landscape was eroded into a maze of canyons, buttes, and mesas by the combined efforts of the Colorado River, Green River, and their tributaries, which divide the park into three districts. The park also contains rock pinnacles and arches, as well as artifacts from Ancient Pueblo peoples.', | ||
}, | ||
location: { | ||
raw: '38.2,-109.93', | ||
}, | ||
acres: { | ||
raw: '337597.83', | ||
}, | ||
title: { | ||
raw: 'Canyonlands', | ||
}, | ||
nps_link: { | ||
raw: 'https://www.nps.gov/cany/index.htm', | ||
}, | ||
states: { | ||
raw: ['Utah'], | ||
}, | ||
id: { | ||
raw: 'park_canyonlands', | ||
}, | ||
}, | ||
null, | ||
2 | ||
)} | ||
</EuiCodeBlock> | ||
</EuiPanel> | ||
); | ||
}; |