Skip to content

Commit bf5243e

Browse files
authored
Merge branch 'main' into console-remove-unused
Signed-off-by: Sirazh Gabdullin <sirazh.gabdullin@nu.edu.kz>
2 parents 8f51a9b + 873b7f3 commit bf5243e

File tree

38 files changed

+169
-100
lines changed

38 files changed

+169
-100
lines changed

.github/.codecov.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# https://docs.codecov.com/docs/codecov-yaml
2+
codecov:
3+
require_ci_to_pass: yes
4+
25
coverage:
36
status:
47
project:
58
default:
6-
# https://docs.codecov.com/docs/commit-status#target
7-
target: auto # coverage must be equal or above the previous commit
9+
target: auto
10+
threshold: 2% # the leniency in hitting the target
11+

.github/pull_request_template.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@
44

55
### Issues Resolved
66

7-
<!-- List any issues this PR will resolve. -->
8-
<!-- Example: closes #1234 -->
7+
<!-- List any issues this PR will resolve. Prefix the issue with the keyword closes, fixes, fix -->
8+
<!-- Example: closes #1234 or fixes <Issue_URL> -->
9+
10+
## Screenshot
11+
12+
<!-- Attach any relevant screenshots. Any change to the UI requires an attached screenshot in the PR Description -->
13+
14+
## Testing the changes
15+
16+
<!--
17+
Please provide detailed steps for validating your changes. This could involve specific commands to run,
18+
pages to visit, scenarios to try or any other information that would help reviewers verify
19+
the functionality of your change
20+
-->
921

1022
### Check List
1123

.github/workflows/build_and_test_workflow.yml

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ env:
2525
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
2626
TEST_OPENSEARCH_PORT: 9400
2727
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
28+
# Version 112.0.5615.0
29+
CHROME_VERSION: 1109208
2830

2931
jobs:
3032
build-lint-test:
@@ -122,6 +124,7 @@ jobs:
122124
functional-tests:
123125
name: Run functional tests on ${{ matrix.name }} (ciGroup${{ matrix.group }})
124126
strategy:
127+
fail-fast: false
125128
matrix:
126129
os: [ubuntu-latest, windows-latest]
127130
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
@@ -134,6 +137,22 @@ jobs:
134137
steps:
135138
- run: echo Running functional tests for ciGroup${{ matrix.group }}
136139

140+
- name: Setup Chrome
141+
id: setup-chrome
142+
uses: browser-actions/setup-chrome@v1
143+
with:
144+
chrome-version: ${{ env.CHROME_VERSION }}
145+
146+
- name: Set Chrome Path
147+
if: matrix.os != 'windows-latest'
148+
run: |
149+
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
150+
151+
- name: Set Chrome Path (Windows)
152+
if: matrix.os == 'windows-latest'
153+
run: |
154+
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
155+
137156
- name: Configure git's autocrlf (Windows only)
138157
if: matrix.os == 'windows-latest'
139158
run: |

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
134134
- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797))
135135
- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816))
136136
- Cleanup unused url ([#3847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3847))
137+
- [BUG] Docked navigation impacts visibility of bottom bar component ([#3978](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3978))
137138

138139
### 🚞 Infrastructure
139140

@@ -148,6 +149,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
148149
- Upgrade yarn version to be compatible with @openearch-project/opensearch ([#3443](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3443))
149150
- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514))
150151
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))
152+
- Install chrome driver for functional tests from path set by environment variable `TEST_BROWSER_BINARY_PATH`([#3997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3997))
153+
- Adds threshold to code coverage config to prevent workflow failures ([#4040](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4040))
151154

152155
### 📝 Documentation
153156

@@ -197,6 +200,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
197200
- [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629))
198201
- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693))
199202
- [Console] Remove unused ul element and its custom styling ([#3993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3993))
203+
- Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798))
200204

201205
### 🔩 Tests
202206

@@ -255,6 +259,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
255259
- [Console] Fix dev tool console autocomplete not loading issue ([#3775](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3775))
256260
- [Console] Fix dev tool console run command with query parameter error ([#3813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3813))
257261
- Add clarifying tooltips to header navigation ([#3573](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3573))
262+
- [Dashboards Listing] Fix listing limit to utilize `savedObjects:listingLimit` instead of `savedObjects:perPage` ([#4021](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4021))
258263

259264
### 🚞 Infrastructure
260265

scripts/upgrade_chromedriver.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,34 @@ const versionCheckCommands = [];
2525
switch (process.platform) {
2626
case 'win32':
2727
versionCheckCommands.push(
28-
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"'
28+
...[
29+
...(process.env.TEST_BROWSER_BINARY_PATH
30+
? [
31+
`powershell "(Get-Item \\"${process.env.TEST_BROWSER_BINARY_PATH}\\").VersionInfo.FileVersion"`,
32+
]
33+
: []),
34+
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"',
35+
]
2936
);
3037
break;
3138

3239
case 'darwin':
3340
versionCheckCommands.push(
34-
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version'
41+
...[
42+
...(process.env.TEST_BROWSER_BINARY_PATH
43+
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
44+
: []),
45+
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version',
46+
]
3547
);
3648
break;
3749

3850
default:
51+
versionCheckCommands.push(
52+
...(process.env.TEST_BROWSER_BINARY_PATH
53+
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
54+
: [])
55+
);
3956
versionCheckCommands.push(
4057
...[
4158
'/usr/bin',

src/core/public/rendering/_base.scss

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
// SASSTODO: Naming here is too embedded and high up that changing them could cause major breaks
77
#opensearch-dashboards-body {
8-
overflow-x: hidden;
98
min-height: 100%;
109
}
1110

src/core/public/rendering/app_containers.test.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('AppWrapper', () => {
4343
expect(component.getDOMNode()).toMatchInlineSnapshot(`
4444
<div
4545
class="app-wrapper"
46+
id="app-wrapper"
4647
>
4748
app-content
4849
</div>
@@ -53,6 +54,7 @@ describe('AppWrapper', () => {
5354
expect(component.getDOMNode()).toMatchInlineSnapshot(`
5455
<div
5556
class="app-wrapper hidden-chrome"
57+
id="app-wrapper"
5658
>
5759
app-content
5860
</div>
@@ -63,6 +65,7 @@ describe('AppWrapper', () => {
6365
expect(component.getDOMNode()).toMatchInlineSnapshot(`
6466
<div
6567
class="app-wrapper"
68+
id="app-wrapper"
6669
>
6770
app-content
6871
</div>

src/core/public/rendering/app_containers.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export const AppWrapper: React.FunctionComponent<{
3737
chromeVisible$: Observable<boolean>;
3838
}> = ({ chromeVisible$, children }) => {
3939
const visible = useObservable(chromeVisible$);
40-
return <div className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>{children}</div>;
40+
return (
41+
<div id="app-wrapper" className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>
42+
{children}
43+
</div>
44+
);
4145
};
4246

4347
export const AppContainer: React.FunctionComponent<{

src/plugins/advanced_settings/public/management_app/_advanced_settings.scss

-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,3 @@
7676
.mgtAdvancedSettingsForm__button {
7777
width: 100%;
7878
}
79-
80-
.osdBody--mgtAdvancedSettingsHasBottomBar .mgtPage__body {
81-
padding-bottom: $euiSizeXL * 2;
82-
}

src/plugins/advanced_settings/public/management_app/components/field/field.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { FieldSetting } from '../../types';
3636
import { UiSettingsType, StringValidation } from '../../../../../../core/public';
3737
import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks';
3838

39-
import { findTestSubject } from '@elastic/eui/lib/test';
39+
import { findTestSubject } from 'test_utils/helpers';
4040
import { Field, getEditableValue } from './field';
4141

4242
jest.mock('brace/theme/textmate', () => 'brace/theme/textmate');

src/plugins/advanced_settings/public/management_app/components/form/form.test.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,30 @@
2929
*/
3030

3131
import React from 'react';
32+
import ReactDOM from 'react-dom';
3233
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
3334
import { UiSettingsType } from '../../../../../../core/public';
3435

35-
import { findTestSubject } from '@elastic/eui/lib/test';
36+
import { findTestSubject } from 'test_utils/helpers';
3637

3738
import { notificationServiceMock } from '../../../../../../core/public/mocks';
3839
import { SettingsChanges } from '../../types';
3940
import { Form } from './form';
4041

42+
jest.mock('react-dom', () => ({
43+
...jest.requireActual('react-dom'),
44+
createPortal: jest.fn((element) => element),
45+
}));
46+
4147
jest.mock('../field', () => ({
4248
Field: () => {
4349
return 'field';
4450
},
4551
}));
4652

4753
beforeAll(() => {
54+
ReactDOM.createPortal = jest.fn((children: any) => children);
55+
4856
const localStorage: Record<string, any> = {
4957
'core.chrome.isLocked': true,
5058
};
@@ -60,6 +68,7 @@ beforeAll(() => {
6068
});
6169

6270
afterAll(() => {
71+
(ReactDOM.createPortal as jest.Mock).mockClear();
6372
delete (window as any).localStorage;
6473
});
6574

src/plugins/advanced_settings/public/management_app/components/form/form.tsx

+61-60
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ import {
4747
import { FormattedMessage } from '@osd/i18n/react';
4848
import { isEmpty } from 'lodash';
4949
import { i18n } from '@osd/i18n';
50+
import { DocLinksStart, ToastsStart } from 'opensearch-dashboards/public';
51+
import { createPortal } from 'react-dom';
5052
import { toMountPoint } from '../../../../../opensearch_dashboards_react/public';
51-
import { DocLinksStart, ToastsStart } from '../../../../../../core/public';
5253

5354
import { getCategoryName } from '../../lib';
5455
import { Field, getEditableValue } from '../field';
@@ -336,63 +337,69 @@ export class Form extends PureComponent<FormProps> {
336337
};
337338

338339
renderBottomBar = () => {
339-
const areChangesInvalid = this.areChangesInvalid();
340-
return (
341-
<EuiBottomBar data-test-subj="advancedSetting-bottomBar">
342-
<EuiFlexGroup
343-
justifyContent="spaceBetween"
344-
alignItems="center"
345-
responsive={false}
346-
gutterSize="s"
347-
>
348-
<EuiFlexItem grow={false} className="mgtAdvancedSettingsForm__unsavedCount">
349-
<p id="aria-describedby.countOfUnsavedSettings">{this.renderCountOfUnsaved()}</p>
350-
</EuiFlexItem>
351-
<EuiFlexItem />
352-
<EuiFlexItem grow={false}>
353-
<EuiButtonEmpty
354-
color="ghost"
355-
size="s"
356-
iconType="cross"
357-
onClick={this.clearAllUnsaved}
358-
aria-describedby="aria-describedby.countOfUnsavedSettings"
359-
data-test-subj="advancedSetting-cancelButton"
360-
>
361-
{i18n.translate('advancedSettings.form.cancelButtonLabel', {
362-
defaultMessage: 'Cancel changes',
363-
})}
364-
</EuiButtonEmpty>
365-
</EuiFlexItem>
366-
<EuiFlexItem grow={false}>
367-
<EuiToolTip
368-
content={
369-
areChangesInvalid &&
370-
i18n.translate('advancedSettings.form.saveButtonTooltipWithInvalidChanges', {
371-
defaultMessage: 'Fix invalid settings before saving.',
372-
})
373-
}
374-
>
375-
<EuiButton
376-
className="mgtAdvancedSettingsForm__button"
377-
disabled={areChangesInvalid}
378-
color="secondary"
379-
fill
340+
try {
341+
const areChangesInvalid = this.areChangesInvalid();
342+
const bottomBar = (
343+
<EuiBottomBar data-test-subj="advancedSetting-bottomBar" position="sticky">
344+
<EuiFlexGroup
345+
justifyContent="spaceBetween"
346+
alignItems="center"
347+
responsive={false}
348+
gutterSize="s"
349+
>
350+
<EuiFlexItem grow={false} className="mgtAdvancedSettingsForm__unsavedCount">
351+
<p id="aria-describedby.countOfUnsavedSettings">{this.renderCountOfUnsaved()}</p>
352+
</EuiFlexItem>
353+
<EuiFlexItem />
354+
<EuiFlexItem grow={false}>
355+
<EuiButtonEmpty
356+
color="ghost"
380357
size="s"
381-
iconType="check"
382-
onClick={this.saveAll}
358+
iconType="cross"
359+
onClick={this.clearAllUnsaved}
383360
aria-describedby="aria-describedby.countOfUnsavedSettings"
384-
isLoading={this.state.loading}
385-
data-test-subj="advancedSetting-saveButton"
361+
data-test-subj="advancedSetting-cancelButton"
386362
>
387-
{i18n.translate('advancedSettings.form.saveButtonLabel', {
388-
defaultMessage: 'Save changes',
363+
{i18n.translate('advancedSettings.form.cancelButtonLabel', {
364+
defaultMessage: 'Cancel changes',
389365
})}
390-
</EuiButton>
391-
</EuiToolTip>
392-
</EuiFlexItem>
393-
</EuiFlexGroup>
394-
</EuiBottomBar>
395-
);
366+
</EuiButtonEmpty>
367+
</EuiFlexItem>
368+
<EuiFlexItem grow={false}>
369+
<EuiToolTip
370+
content={
371+
areChangesInvalid &&
372+
i18n.translate('advancedSettings.form.saveButtonTooltipWithInvalidChanges', {
373+
defaultMessage: 'Fix invalid settings before saving.',
374+
})
375+
}
376+
>
377+
<EuiButton
378+
className="mgtAdvancedSettingsForm__button"
379+
disabled={areChangesInvalid}
380+
color="secondary"
381+
fill
382+
size="s"
383+
iconType="check"
384+
onClick={this.saveAll}
385+
aria-describedby="aria-describedby.countOfUnsavedSettings"
386+
isLoading={this.state.loading}
387+
data-test-subj="advancedSetting-saveButton"
388+
>
389+
{i18n.translate('advancedSettings.form.saveButtonLabel', {
390+
defaultMessage: 'Save changes',
391+
})}
392+
</EuiButton>
393+
</EuiToolTip>
394+
</EuiFlexItem>
395+
</EuiFlexGroup>
396+
</EuiBottomBar>
397+
);
398+
399+
return createPortal(bottomBar, document.getElementById('app-wrapper')!);
400+
} catch (e) {
401+
return null;
402+
}
396403
};
397404

398405
render() {
@@ -401,12 +408,6 @@ export class Form extends PureComponent<FormProps> {
401408
const currentCategories: Category[] = [];
402409
const hasUnsavedChanges = !isEmpty(unsavedChanges);
403410

404-
if (hasUnsavedChanges) {
405-
document.body.classList.add('osdBody--mgtAdvancedSettingsHasBottomBar');
406-
} else {
407-
document.body.classList.remove('osdBody--mgtAdvancedSettingsHasBottomBar');
408-
}
409-
410411
categories.forEach((category) => {
411412
if (visibleSettings[category] && visibleSettings[category].length) {
412413
currentCategories.push(category);

0 commit comments

Comments
 (0)