Skip to content

Commit

Permalink
Merge branch 'main' into console-remove-unused
Browse files Browse the repository at this point in the history
Signed-off-by: Sirazh Gabdullin <[email protected]>
  • Loading branch information
curq authored May 16, 2023
2 parents 8f51a9b + 873b7f3 commit bf5243e
Show file tree
Hide file tree
Showing 38 changed files with 169 additions and 100 deletions.
8 changes: 6 additions & 2 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# https://docs.codecov.com/docs/codecov-yaml
codecov:
require_ci_to_pass: yes

coverage:
status:
project:
default:
# https://docs.codecov.com/docs/commit-status#target
target: auto # coverage must be equal or above the previous commit
target: auto
threshold: 2% # the leniency in hitting the target

16 changes: 14 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@

### Issues Resolved

<!-- List any issues this PR will resolve. -->
<!-- Example: closes #1234 -->
<!-- List any issues this PR will resolve. Prefix the issue with the keyword closes, fixes, fix -->
<!-- Example: closes #1234 or fixes <Issue_URL> -->

## Screenshot

<!-- Attach any relevant screenshots. Any change to the UI requires an attached screenshot in the PR Description -->

## Testing the changes

<!--
Please provide detailed steps for validating your changes. This could involve specific commands to run,
pages to visit, scenarios to try or any other information that would help reviewers verify
the functionality of your change
-->

### Check List

Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ env:
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
TEST_OPENSEARCH_PORT: 9400
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
# Version 112.0.5615.0
CHROME_VERSION: 1109208

jobs:
build-lint-test:
Expand Down Expand Up @@ -122,6 +124,7 @@ jobs:
functional-tests:
name: Run functional tests on ${{ matrix.name }} (ciGroup${{ matrix.group }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
Expand All @@ -134,6 +137,22 @@ jobs:
steps:
- run: echo Running functional tests for ciGroup${{ matrix.group }}

- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: ${{ env.CHROME_VERSION }}

- name: Set Chrome Path
if: matrix.os != 'windows-latest'
run: |
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
- name: Set Chrome Path (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
- name: Configure git's autocrlf (Windows only)
if: matrix.os == 'windows-latest'
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797))
- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816))
- Cleanup unused url ([#3847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3847))
- [BUG] Docked navigation impacts visibility of bottom bar component ([#3978](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3978))

### 🚞 Infrastructure

Expand All @@ -148,6 +149,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Upgrade yarn version to be compatible with @openearch-project/opensearch ([#3443](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3443))
- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514))
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))
- 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))
- Adds threshold to code coverage config to prevent workflow failures ([#4040](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4040))

### 📝 Documentation

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

### 🔩 Tests

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

### 🚞 Infrastructure

Expand Down
21 changes: 19 additions & 2 deletions scripts/upgrade_chromedriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,34 @@ const versionCheckCommands = [];
switch (process.platform) {
case 'win32':
versionCheckCommands.push(
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"'
...[
...(process.env.TEST_BROWSER_BINARY_PATH
? [
`powershell "(Get-Item \\"${process.env.TEST_BROWSER_BINARY_PATH}\\").VersionInfo.FileVersion"`,
]
: []),
'powershell "(Get-Item \\"$Env:Programfiles/Google/Chrome/Application/chrome.exe\\").VersionInfo.FileVersion"',
]
);
break;

case 'darwin':
versionCheckCommands.push(
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version'
...[
...(process.env.TEST_BROWSER_BINARY_PATH
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
: []),
'/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version',
]
);
break;

default:
versionCheckCommands.push(
...(process.env.TEST_BROWSER_BINARY_PATH
? [`${process.env.TEST_BROWSER_BINARY_PATH} --version`]
: [])
);
versionCheckCommands.push(
...[
'/usr/bin',
Expand Down
1 change: 0 additions & 1 deletion src/core/public/rendering/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
// SASSTODO: Naming here is too embedded and high up that changing them could cause major breaks
#opensearch-dashboards-body {
overflow-x: hidden;
min-height: 100%;
}

Expand Down
3 changes: 3 additions & 0 deletions src/core/public/rendering/app_containers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('AppWrapper', () => {
expect(component.getDOMNode()).toMatchInlineSnapshot(`
<div
class="app-wrapper"
id="app-wrapper"
>
app-content
</div>
Expand All @@ -53,6 +54,7 @@ describe('AppWrapper', () => {
expect(component.getDOMNode()).toMatchInlineSnapshot(`
<div
class="app-wrapper hidden-chrome"
id="app-wrapper"
>
app-content
</div>
Expand All @@ -63,6 +65,7 @@ describe('AppWrapper', () => {
expect(component.getDOMNode()).toMatchInlineSnapshot(`
<div
class="app-wrapper"
id="app-wrapper"
>
app-content
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/core/public/rendering/app_containers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export const AppWrapper: React.FunctionComponent<{
chromeVisible$: Observable<boolean>;
}> = ({ chromeVisible$, children }) => {
const visible = useObservable(chromeVisible$);
return <div className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>{children}</div>;
return (
<div id="app-wrapper" className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>
{children}
</div>
);
};

export const AppContainer: React.FunctionComponent<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,3 @@
.mgtAdvancedSettingsForm__button {
width: 100%;
}

.osdBody--mgtAdvancedSettingsHasBottomBar .mgtPage__body {
padding-bottom: $euiSizeXL * 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { FieldSetting } from '../../types';
import { UiSettingsType, StringValidation } from '../../../../../../core/public';
import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks';

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

jest.mock('brace/theme/textmate', () => 'brace/theme/textmate');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,30 @@
*/

import React from 'react';
import ReactDOM from 'react-dom';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
import { UiSettingsType } from '../../../../../../core/public';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

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

jest.mock('react-dom', () => ({
...jest.requireActual('react-dom'),
createPortal: jest.fn((element) => element),
}));

jest.mock('../field', () => ({
Field: () => {
return 'field';
},
}));

beforeAll(() => {
ReactDOM.createPortal = jest.fn((children: any) => children);

const localStorage: Record<string, any> = {
'core.chrome.isLocked': true,
};
Expand All @@ -60,6 +68,7 @@ beforeAll(() => {
});

afterAll(() => {
(ReactDOM.createPortal as jest.Mock).mockClear();
delete (window as any).localStorage;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ import {
import { FormattedMessage } from '@osd/i18n/react';
import { isEmpty } from 'lodash';
import { i18n } from '@osd/i18n';
import { DocLinksStart, ToastsStart } from 'opensearch-dashboards/public';
import { createPortal } from 'react-dom';
import { toMountPoint } from '../../../../../opensearch_dashboards_react/public';
import { DocLinksStart, ToastsStart } from '../../../../../../core/public';

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

renderBottomBar = () => {
const areChangesInvalid = this.areChangesInvalid();
return (
<EuiBottomBar data-test-subj="advancedSetting-bottomBar">
<EuiFlexGroup
justifyContent="spaceBetween"
alignItems="center"
responsive={false}
gutterSize="s"
>
<EuiFlexItem grow={false} className="mgtAdvancedSettingsForm__unsavedCount">
<p id="aria-describedby.countOfUnsavedSettings">{this.renderCountOfUnsaved()}</p>
</EuiFlexItem>
<EuiFlexItem />
<EuiFlexItem grow={false}>
<EuiButtonEmpty
color="ghost"
size="s"
iconType="cross"
onClick={this.clearAllUnsaved}
aria-describedby="aria-describedby.countOfUnsavedSettings"
data-test-subj="advancedSetting-cancelButton"
>
{i18n.translate('advancedSettings.form.cancelButtonLabel', {
defaultMessage: 'Cancel changes',
})}
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip
content={
areChangesInvalid &&
i18n.translate('advancedSettings.form.saveButtonTooltipWithInvalidChanges', {
defaultMessage: 'Fix invalid settings before saving.',
})
}
>
<EuiButton
className="mgtAdvancedSettingsForm__button"
disabled={areChangesInvalid}
color="secondary"
fill
try {
const areChangesInvalid = this.areChangesInvalid();
const bottomBar = (
<EuiBottomBar data-test-subj="advancedSetting-bottomBar" position="sticky">
<EuiFlexGroup
justifyContent="spaceBetween"
alignItems="center"
responsive={false}
gutterSize="s"
>
<EuiFlexItem grow={false} className="mgtAdvancedSettingsForm__unsavedCount">
<p id="aria-describedby.countOfUnsavedSettings">{this.renderCountOfUnsaved()}</p>
</EuiFlexItem>
<EuiFlexItem />
<EuiFlexItem grow={false}>
<EuiButtonEmpty
color="ghost"
size="s"
iconType="check"
onClick={this.saveAll}
iconType="cross"
onClick={this.clearAllUnsaved}
aria-describedby="aria-describedby.countOfUnsavedSettings"
isLoading={this.state.loading}
data-test-subj="advancedSetting-saveButton"
data-test-subj="advancedSetting-cancelButton"
>
{i18n.translate('advancedSettings.form.saveButtonLabel', {
defaultMessage: 'Save changes',
{i18n.translate('advancedSettings.form.cancelButtonLabel', {
defaultMessage: 'Cancel changes',
})}
</EuiButton>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
</EuiBottomBar>
);
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiToolTip
content={
areChangesInvalid &&
i18n.translate('advancedSettings.form.saveButtonTooltipWithInvalidChanges', {
defaultMessage: 'Fix invalid settings before saving.',
})
}
>
<EuiButton
className="mgtAdvancedSettingsForm__button"
disabled={areChangesInvalid}
color="secondary"
fill
size="s"
iconType="check"
onClick={this.saveAll}
aria-describedby="aria-describedby.countOfUnsavedSettings"
isLoading={this.state.loading}
data-test-subj="advancedSetting-saveButton"
>
{i18n.translate('advancedSettings.form.saveButtonLabel', {
defaultMessage: 'Save changes',
})}
</EuiButton>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
</EuiBottomBar>
);

return createPortal(bottomBar, document.getElementById('app-wrapper')!);
} catch (e) {
return null;
}
};

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

if (hasUnsavedChanges) {
document.body.classList.add('osdBody--mgtAdvancedSettingsHasBottomBar');
} else {
document.body.classList.remove('osdBody--mgtAdvancedSettingsHasBottomBar');
}

categories.forEach((category) => {
if (visibleSettings[category] && visibleSettings[category].length) {
currentCategories.push(category);
Expand Down
Loading

0 comments on commit bf5243e

Please sign in to comment.