Skip to content

Commit c730a32

Browse files
authored
Merge branch 'main' into bump-mocha
2 parents d3df5ab + 82eb0e8 commit c730a32

File tree

27 files changed

+672
-374
lines changed

27 files changed

+672
-374
lines changed

.github/workflows/backport.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ jobs:
1212
contents: write
1313
pull-requests: write
1414
name: Backport
15+
# Only react to merged PRs for security reasons.
16+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
17+
if: >
18+
github.event.pull_request.merged
19+
&& (
20+
github.event.action == 'closed'
21+
|| (
22+
github.event.action == 'labeled'
23+
&& contains(github.event.label.name, 'backport')
24+
)
25+
)
1526
steps:
1627
- name: GitHub App token
1728
id: github_app_token
@@ -22,10 +33,9 @@ jobs:
2233
# opensearch-trigger-bot installation ID
2334
installation_id: 22958780
2435

25-
# Using fork of https://github.com/tibdex/backport
26-
# https://github.com/tibdex/backport/pull/81
2736
- name: Backport
28-
uses: VachaShah/backport@v1.1.4
37+
uses: VachaShah/backport@v2.1.0
2938
with:
3039
github_token: ${{ steps.github_app_token.outputs.token }}
3140
branch_name: backport/backport-${{ github.event.number }}
41+
files_to_skip: "CHANGELOG.md"

.github/workflows/cypress_workflow.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ env:
1111
FTR_PATH: 'ftr'
1212
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch'
1313
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot'
14-
SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js,'
14+
SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,'
15+
CYPRESS_ENV: 'env CYPRESS_VISBUILDER_ENABLED=true '
1516

1617
jobs:
1718
cypress-tests:
@@ -75,7 +76,7 @@ jobs:
7576
working-directory: ${{ env.FTR_PATH }}
7677
start: ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }}
7778
wait-on: 'http://localhost:9200, http://localhost:5601'
78-
command: yarn cypress:run-without-security --browser chromium --spec ${{ env.SPEC }}
79+
command: ${{ env.CYPRESS_ENV }} yarn cypress:run-without-security --browser chromium --spec ${{ env.SPEC }}
7980

8081
# Screenshots are only captured on failure, will change this once we do visual regression tests
8182
- uses: actions/upload-artifact@v3

CHANGELOG.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3232
- [Vis Builder] Rename wizard to visBuilder in i18n id and formatted message id ([#2635](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2635))
3333
- [Vis Builder] Rename wizard to visBuilder in class name, type name and function name ([#2639](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2639))
3434
- [Vis Builder] Rename wizard on save modal and visualization table ([#2645](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2645))
35+
- [Vis Builder] Adds functional tests to CI ([#2728](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2728))
3536
- [Vis Builder] Enable VisBuilder by default ([#2725](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2725))
3637
- Change save object type, wizard id and name to visBuilder #2673 ([#2673](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2673))
37-
- Add extension point in saved object management to register namespaces and show filter ([#2656](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2656))
3838
- [Multi DataSource] Update MD data source documentation link ([#2693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2693))
39+
- [Save Object Aggregation View] Add extension point in saved object management to register namespaces and show filter ([#2656](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2656))
40+
- [Save Object Aggregation View] Fix for export all after scroll count response changed in PR#2656 ([#2696](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2696))
3941

4042
### 🐛 Bug Fixes
4143

@@ -51,7 +53,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
5153
- [Multi DataSource] Address UX comments on index pattern management stack ([#2611](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2611))
5254
- [Multi DataSource] Apply get indices error handling in step index pattern ([#2652](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2652))
5355
- [Vis Builder] Last Updated Timestamp for visbuilder savedobject is getting Generated ([#2628](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2628))
54-
- Removed Leftover X Pack references ([#2638](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2638))
56+
- Removed Leftover X Pack references ([#2638](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2638))
57+
- Removes Add Integration button ([#2723](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2723))
5558

5659
### 🚞 Infrastructure
5760

@@ -60,12 +63,16 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6063
### 📝 Documentation
6164

6265
* [MD] Add design documents of multiple data source feature [#2538](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2538)
66+
* [MD] Tweak multiple data source design doc [#2724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2724)
67+
6368
### 🛠 Maintenance
6469

6570
- Adding @zhongnansu as maintainer. ([#2590](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2590))
6671

6772
### 🪛 Refactoring
68-
* [MD] Refactor data source error handling ([#2661](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2661))
73+
74+
- [MD] Refactor data source error handling ([#2661](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2661))
75+
- Refactor and improve Discover field summaries ([#2391](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2391))
6976

7077
### 🔩 Tests
7178

docs/multi-datasource/client_management_design.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ This design is part of the OpenSearch Dashboards multi data source project [[RFC
3939

4040
### 4.0 Answer some critical design questions
4141

42-
**1.** **How to set up connection(clients) for different datasources?**
43-
Similar to how current OpenSearch Dashboards talks to default OS by creating opensearch node.js client using [opensearch-js](https://github.com/opensearch-project/opensearch-js) library, for datasources we also create clients for each. Critical params that differentiate data sources are `url` and `auth`
42+
**1.** **How to set up connection(clients) for different data sources?**
43+
Similar to how current OpenSearch Dashboards talks to default OpenSearch by creating a client using [opensearch-js](https://github.com/opensearch-project/opensearch-js) library, for data sources we also create clients for each connection. Critical params that differentiate data sources are `url` and `auth`
4444

4545
```ts
4646
const { Client } = require('@opensearch-project/opensearch');
@@ -59,7 +59,7 @@ dataSourceClient.ping();
5959
```
6060

6161
**2. How to expose datasource clients to callers through clean interfaces?**
62-
We create a `data source service`. Similar to existing `opensearch service` in core, which provides client of default OS cluster. This new service will be dedicated to provide clients for data sources. Following the same paradigm we can register this new service to `CoreStart`, `CoreRouteHandlerContext` , in order to expose data source client to plugins and modules. The interface is exposed from new service, and thus it doesn’t mess up with any existing services, and keeps the interface clean.
62+
We create a `data source service`. Similar to existing `opensearch service` in core, which provides client of default OpenSearch cluster. This new service will be dedicated to provide clients for data sources. Following the same paradigm we can register this new service to `CoreStart`, `CoreRouteHandlerContext` , in order to expose data source client to plugins and modules. The interface is exposed from new service, and thus it doesn’t mess up with any existing services, and keeps the interface clean.
6363

6464
```
6565
*// Existing*
@@ -77,14 +77,14 @@ The context is that user can only turn on/off multiple datasource feature by upd
7777

7878
**4.How to manage multiple clients/connection efficiently, and not consume all the memory?**
7979

80-
- For datasources with different endpoint, user client Pooling (E.g. LRU cache)
80+
- For data sources with different endpoint, user client Pooling (E.g. LRU cache)
8181
- For data sources with same endpoint, but different user, use connection pooling strategy (child client) provided by opensearch-js.
8282

8383
**5.Where should we implement the core logic?**
8484
Current `opensearch service` exists in core. The module we'll implement has similarity function wise, but we choose to implement `data source service` in plugin along with `crypto` service for the following reasons.
8585

86-
1. Data source is a feature that can be turned on or off. Plugin is born for such plugable use case.
87-
2. We don't mess up with OpenSearch Dashboards core, since this is an experimental feature, the potential risk of breaking existing behavior will be lower if we use plugin. Worst case, user could just uninstall the plugin.
86+
1. Data source is a feature that can be turned on or off. Plugin is born for such pluggable use case.
87+
2. We don't mess up with OpenSearch Dashboards core, since this is an experimental feature, the potential risk of breaking existing behavior will be lowered if we use plugin. Worst case, user could just uninstall the plugin.
8888
3. Complexity wise, it's about the same amount of work.
8989

9090
### 4.1 Data Source Plugin
@@ -130,14 +130,14 @@ We need to configure the data source client by either creating a new one, or loo
130130
}
131131
```
132132

133-
- Get root client: Look up client Pool by **endpoint**, return client if existed. If misses, we create new client instance and load into pool. At this step, the client won't have any auth info.
133+
- Get root client: Look up the client pool by **endpoint** and return the client if it exists. If a client was not found, a new client instance is created and loaded into pool. At this step, the client won't have any auth info.
134134

135135
- Get credentials: Call crypto service utilities to **decrypt** user credentials from `DataSource` Object.
136-
- Assemble the actual query client: With auth info and root client, we’ll leverage the openearch-js connection pooling strategy to create the actual query client from root client by `client.child()`.
136+
- Assemble the actual query client: With auth info and root client, we’ll leverage the `opensearch-js` connection pooling strategy to create the actual query client from root client by `client.child()`.
137137

138138
#### 4.2.1 Legacy Client
139139

140-
OpenSearch Dashboards is forked from Kibana 7.10. At the time of the fork happened, there are 2 types of client used in the codebase. One is the new client, which later was migrated as `opensearhc-js`, the other one is the legacy client which is `elasticsearc-js`. Legacy clients are still used many critical features, such as visualization, index pattern management, along with new client.
140+
OpenSearch Dashboards had two types of clients available for use when created. One was the "new client" which has since been separated into `opensearch-js`, and the other was the legacy client named `elasticsearch-js`. Legacy clients are still used by some core features like visualization and index pattern management.
141141

142142
```ts
143143
// legacy client
@@ -174,7 +174,7 @@ This is for plugin to access data source client via request handler. For example
174174
175175
### 4.4 Refactor data plugin search module to call core API to get datasource client
176176
177-
`Search strategy` is the low level API of data plugin search module. It retrieve clients and query OpenSearch. It needs to be refactored to switch between default client and datasource client, depending on whether a request is send to datasource or not.
177+
`Search strategy` is the low level API of data plugin search module. It retrieves clients and queries OpenSearch. It needs to be refactored to switch between the default client and the datasource client, depending on whether or not a request is sent to the datasource.
178178
179179
Currently default client is retrieved by search module of data plugin to interact with OpenSearch by this API call. Ref: [opensearch-search-strategy.ts](https://github.com/opensearch-project/opensearch-dashboards/blob/e3b34df1dea59a253884f6da4e49c3e717d362c9/src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts#L75)
180180
@@ -184,7 +184,7 @@ const client: OpenSearchClient = core.opensearch.client.asCurrentUser;
184184
client.search(params);
185185
```
186186
187-
Similarly we’ll have the following for datasource use case. `AsCurrentUser` is something doesn’t make sense for datasource, because it’s always the “current” user credential defined in the “datasource”, that we are using to create the client, or look up the client pool.
187+
Similarly we’ll have the following for datasource use case. `AsCurrentUser` doesn't really apply to a datasource because it’s always the “current” user's credentials, defined in the “datasource”, that gets used to initialize the client or lookup the client pool.
188188
189189
```ts
190190
if (request.dataSource) {

src/core/public/mocks.ts

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function createCoreSetupMock({
8383
uiSettings: uiSettingsServiceMock.createSetupContract(),
8484
injectedMetadata: {
8585
getInjectedVar: injectedMetadataServiceMock.createSetupContract().getInjectedVar,
86+
getBranding: injectedMetadataServiceMock.createSetupContract().getBranding,
8687
},
8788
};
8889

src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
import React from 'react';
32+
// @ts-ignore
3233
import { findTestSubject } from '@elastic/eui/lib/test';
3334
// @ts-ignore
3435
import stubbedLogstashFields from 'fixtures/logstash_fields';
@@ -99,8 +100,9 @@ function getComponent({
99100

100101
const props = {
101102
indexPattern,
103+
columns: [],
102104
field: finalField,
103-
getDetails: jest.fn(() => ({ buckets: [], error: '', exists: 1, total: true, columns: [] })),
105+
getDetails: jest.fn(() => ({ buckets: [], error: '', exists: 1, total: 1 })),
104106
onAddFilter: jest.fn(),
105107
onAddField: jest.fn(),
106108
onRemoveField: jest.fn(),

src/plugins/discover/public/application/components/sidebar/discover_field.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ import { getFieldTypeName } from './lib/get_field_type_name';
4040
import './discover_field.scss';
4141

4242
export interface DiscoverFieldProps {
43+
/**
44+
* the selected columns displayed in the doc table in discover
45+
*/
46+
columns: string[];
4347
/**
4448
* The displayed field
4549
*/
@@ -76,6 +80,7 @@ export interface DiscoverFieldProps {
7680
}
7781

7882
export function DiscoverField({
83+
columns,
7984
field,
8085
indexPattern,
8186
onAddField,
@@ -228,9 +233,10 @@ export function DiscoverField({
228233
</EuiPopoverTitle>
229234
{infoIsOpen && (
230235
<DiscoverFieldDetails
231-
indexPattern={indexPattern}
232-
field={field}
236+
columns={columns}
233237
details={getDetails(field)}
238+
field={field}
239+
indexPattern={indexPattern}
234240
onAddFilter={onAddFilter}
235241
/>
236242
)}

src/plugins/discover/public/application/components/sidebar/discover_field_bucket.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
6868
title={
6969
bucket.display === ''
7070
? emptyTxt
71-
: `${bucket.display}: ${bucket.count} (${bucket.percent}%)`
71+
: `${bucket.display}: ${bucket.count} (${bucket.percent.toFixed(1)}%)`
7272
}
7373
size="xs"
7474
className="eui-textTruncate"
@@ -78,7 +78,7 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
7878
</EuiFlexItem>
7979
<EuiFlexItem grow={false} className="eui-textTruncate">
8080
<EuiText color="secondary" size="xs" className="eui-textTruncate">
81-
{bucket.percent}%
81+
{bucket.percent.toFixed(1)}%
8282
</EuiText>
8383
</EuiFlexItem>
8484
</EuiFlexGroup>

0 commit comments

Comments
 (0)