Skip to content

Commit

Permalink
Compress searchbar (#1426)
Browse files Browse the repository at this point in the history
* Reduce the gap between the elements of a compressed OuiSearchBar

Signed-off-by: Miki <miki@amazon.com>

* Deprecate Query.toESQuery and Query.toESQueryString in favor of Query.toOpenSearchQuery and Query.toOpenSearchQueryString

Also:
* Fix naming conventions in OuiSearchBar code and docs

Signed-off-by: Miki <miki@amazon.com>

* Update CHANGELOG

Signed-off-by: Miki <miki@amazon.com>

---------

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki authored Oct 2, 2024
1 parent 6e70f37 commit 078a904
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 159 deletions.
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@

### Deprecations

- Deprecate Query.toESQuery and Query.toESQueryString in favor of Query.toOpenSearchQuery and Query.toOpenSearchQueryString ([#1426](https://github.com/opensearch-project/oui/pull/1426))

### 🛡 Security


### 📈 Features/Enhancements

- Reduce the gap between the elements of a compressed OuiSearchBar ([#1426](https://github.com/opensearch-project/oui/pull/1426))

### 🐛 Bug Fixes

- Add Temporary fix for Chrome's problem with rendering mask images ([#1414](https://github.com/opensearch-project/oui/pull/1414))
- Additional borderRadius sizes on Panels ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Configuration of borderRadius on Cards ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Update components to respect new breakpoints ([#1416])(https://github.com/opensearch-project/oui/pull/1416)
- Fix naming conventions in OuiSearchBar code and docs ([#1426](https://github.com/opensearch-project/oui/pull/1426))

### 🚞 Infrastructure

Expand All @@ -32,6 +31,17 @@

### 🔩 Tests


## [`1.14.0`](https://github.com/opensearch-project/oui/tree/1.14)

### 🐛 Bug Fixes

- Add Temporary fix for Chrome's problem with rendering mask images ([#1414](https://github.com/opensearch-project/oui/pull/1414))
- Additional borderRadius sizes on Panels ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Configuration of borderRadius on Cards ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Update components to respect new breakpoints ([#1416](https://github.com/opensearch-project/oui/pull/1416))

### 🪛 Refactoring
- Make Side Nav variables themeable ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Make Links use font-weight `$ouiFontWeightSemiBold` (no change for existing themes) ([#1417](https://github.com/opensearch-project/oui/pull/1417))
- Enable themes to define background colors for Buttons ([#1417](https://github.com/opensearch-project/oui/pull/1417))
Expand Down
12 changes: 6 additions & 6 deletions src-docs/src/views/search_bar/props_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export const propsInfo = {
'static (query: #Query | string, items: Object[], options?: #ExecuteQueryOptions) => Object[]',
},
},
toESQuery: {
toOpenSearchQuery: {
description:
'Builds and returns an Elasticsearch query object out of the given query',
'Builds and returns an OpenSearch query object out of the given query',
type: {
name:
'static (query: #Query | string, options?: #ToESQueryOptions) => ESQuery',
'static (query: #Query | string, options?: #ToOpenSearchQueryOptions) => OpenSearchQuery',
},
},
},
Expand Down Expand Up @@ -458,21 +458,21 @@ export const propsInfo = {
},
},

ToESQueryOptions: {
ToOpenSearchQueryOptions: {
__docgenInfo: {
_ouiObjectType: 'type',
props: {
extraMustQueries: {
description:
'An array of additional queries to add as a `must` clause to the generated query',
required: false,
type: { name: 'ESQuery[]' },
type: { name: 'OpenSearchQuery[]' },
},
extraMustNotQueries: {
description:
'An array of additional queries to add as a `must_not` clause to the generated query',
required: false,
type: { name: 'ESQuery[]' },
type: { name: 'OpenSearchQuery[]' },
},
},
},
Expand Down
22 changes: 12 additions & 10 deletions src-docs/src/views/search_bar/search_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,39 +253,41 @@ export const SearchBar = () => {
return <OuiBasicTable items={queriedItems} columns={columns} />;
};

let esQueryDsl;
let esQueryString;
let opensearchQueryDsl;
let opensearchQueryString;

try {
esQueryDsl = OuiSearchBar.Query.toESQuery(query);
opensearchQueryDsl = OuiSearchBar.Query.toOpenSearchQuery(query);
} catch (e) {
esQueryDsl = e.toString();
opensearchQueryDsl = e.toString();
}
try {
esQueryString = OuiSearchBar.Query.toESQueryString(query);
opensearchQueryString = OuiSearchBar.Query.toOpenSearchQueryString(query);
} catch (e) {
esQueryString = e.toString();
opensearchQueryString = e.toString();
}

const content = renderError() || (
<OuiFlexGroup>
<OuiFlexItem grow={4}>
<OuiTitle size="s">
<h3>Elasticsearch Query String</h3>
<h3>OpenSearch Query String</h3>
</OuiTitle>
<OuiSpacer size="s" />
<OuiCodeBlock language="js">
{esQueryString ? esQueryString : ''}
{opensearchQueryString ? opensearchQueryString : ''}
</OuiCodeBlock>

<OuiSpacer size="l" />

<OuiTitle size="s">
<h3>Elasticsearch Query DSL</h3>
<h3>OpenSearch Query DSL</h3>
</OuiTitle>
<OuiSpacer size="s" />
<OuiCodeBlock language="js">
{esQueryDsl ? JSON.stringify(esQueryDsl, null, 2) : ''}
{opensearchQueryDsl
? JSON.stringify(opensearchQueryDsl, null, 2)
: ''}
</OuiCodeBlock>
</OuiFlexItem>

Expand Down
16 changes: 10 additions & 6 deletions src-docs/src/views/search_bar/search_bar_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,32 @@ export const SearchBarFilters = () => {
return <OuiBasicTable items={queriedItems} columns={columns} />;
};

const esQueryDsl = OuiSearchBar.Query.toESQuery(query);
const esQueryString = OuiSearchBar.Query.toESQueryString(query);
const opensearchQueryDsl = OuiSearchBar.Query.toOpenSearchQuery(query);
const opensearchQueryString = OuiSearchBar.Query.toOpenSearchQueryString(
query
);

const content = renderError() || (
<OuiFlexGroup>
<OuiFlexItem grow={4}>
<OuiTitle size="s">
<h3>Elasticsearch Query String</h3>
<h3>OpenSearch Query String</h3>
</OuiTitle>
<OuiSpacer size="s" />
<OuiCodeBlock language="js">
{esQueryString ? esQueryString : ''}
{opensearchQueryString ? opensearchQueryString : ''}
</OuiCodeBlock>

<OuiSpacer size="l" />

<OuiTitle size="s">
<h3>Elasticsearch Query DSL</h3>
<h3>OpenSearch Query DSL</h3>
</OuiTitle>
<OuiSpacer size="s" />
<OuiCodeBlock language="js">
{esQueryDsl ? JSON.stringify(esQueryDsl, null, 2) : ''}
{opensearchQueryDsl
? JSON.stringify(opensearchQueryDsl, null, 2)
: ''}
</OuiCodeBlock>
</OuiFlexItem>

Expand Down

This file was deleted.

Loading

0 comments on commit 078a904

Please sign in to comment.