Skip to content

Commit

Permalink
Fixes interfaced errors across Dashboards (#1409)
Browse files Browse the repository at this point in the history
* Fixes interfaced errors in dashboards

Signed-off-by: Bishoy Boktor <boktorbb@amazon.com>

* Fixes 2 failing unit tests

Signed-off-by: Bishoy Boktor <boktorbb@amazon.com>

* revert yarn.lock

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

Co-authored-by: Miki <miki@amazon.com>
  • Loading branch information
boktorbb and AMoo-Miki authored Apr 1, 2022
1 parent 0bd14bd commit 4c3f222
Show file tree
Hide file tree
Showing 12 changed files with 4,495 additions and 3,965 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"**/node-jose": "^2.1.0",
"**/qs": "^6.10.3",
"**/trim": "^0.0.3",
"**/typescript": "4.0.2"
"**/typescript": "4.0.2",
"**/@types/react": "^16.14.23"
},
"workspaces": {
"packages": [
Expand Down Expand Up @@ -248,16 +249,15 @@
"@types/babel__core": "^7.1.17",
"@types/bluebird": "^3.1.1",
"@types/chance": "^1.0.0",
"@types/cheerio": "^0.22.10",
"@types/cheerio": "^0.22.31",
"@types/chromedriver": "^81.0.0",
"@types/classnames": "^2.2.9",
"@types/color": "^3.0.0",
"@types/d3": "^3.5.43",
"@types/dedent": "^0.7.0",
"@types/deep-freeze-strict": "^1.1.0",
"@types/delete-empty": "^2.0.0",
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.10.5",
"@types/enzyme": "^3.10.7",
"@types/eslint": "^6.1.3",
"@types/fetch-mock": "^7.3.1",
"@types/flot": "^0.0.31",
Expand Down Expand Up @@ -338,15 +338,15 @@
"chance": "1.0.18",
"cheerio": "0.22.0",
"chromedriver": "^91.0.1",
"classnames": "2.2.6",
"classnames": "2.3.1",
"compare-versions": "3.5.1",
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"dedent": "^0.7.0",
"delete-empty": "^2.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.4",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.5.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-babel": "^5.3.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/osd-optimizer/src/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function readLimits(): Limits {
}
}

return yaml ? Yaml.safeLoad(yaml) : {};
return yaml ? (Yaml.safeLoad(yaml) as any) : {};
}

export function validateLimitsForAllBundles(log: ToolingLog, config: OptimizerConfig) {
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"dependencies": {
"classnames": "2.2.6",
"classnames": "2.3.1",
"lodash": "^4.17.21",
"prop-types": "^15.7.2",
"react": "^16.14.0",
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/apm_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

jest.mock('@elastic/apm-rum');
import { init, apm } from '@elastic/apm-rum';
import { init, apm, Transaction } from '@elastic/apm-rum';
import { ApmSystem } from './apm_system';

const initMock = init as jest.Mocked<typeof init>;
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/application/scoped_history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class ScopedHistory<HistoryLocationState = unknown>
*/
public get location() {
this.verifyActive();
return this.stripBasePath(this.parentHistory.location);
return this.stripBasePath(this.parentHistory.location as Location<HistoryLocationState>);
}

/**
Expand Down Expand Up @@ -336,7 +336,7 @@ export class ScopedHistory<HistoryLocationState = unknown>
}

[...this.listeners].forEach((listener) => {
listener(this.stripBasePath(location), action);
listener(this.stripBasePath(location as Location<HistoryLocationState>), action);
});
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/server/opensearch/opensearch_config.test.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
*/

export const mockReadFileSync = jest.fn();
jest.mock('fs', () => ({ readFileSync: mockReadFileSync }));
export const mockRead = jest.fn();
jest.mock('fs', () => ({ readFileSync: mockReadFileSync, read: mockRead }));

export const mockReadPkcs12Keystore = jest.fn();
export const mockReadPkcs12Truststore = jest.fn();
Expand Down
10 changes: 5 additions & 5 deletions src/core/server/rendering/rendering_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('RenderingService', () => {
it('renders "core" page', async () => {
const content = await render(createOpenSearchDashboardsRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('osd-injected-metadata').attr('data'));
const data = JSON.parse(dom('osd-injected-metadata').attr('data') || '');

expect(data).toMatchSnapshot(INJECTED_METADATA);
});
Expand All @@ -101,7 +101,7 @@ describe('RenderingService', () => {

const content = await render(createOpenSearchDashboardsRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('osd-injected-metadata').attr('data'));
const data = JSON.parse(dom('osd-injected-metadata').attr('data') || '');

expect(data).toMatchSnapshot(INJECTED_METADATA);
});
Expand All @@ -110,7 +110,7 @@ describe('RenderingService', () => {
uiSettings.getUserProvided.mockResolvedValue({ 'theme:darkMode': { userValue: true } });
const content = await render(createOpenSearchDashboardsRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('osd-injected-metadata').attr('data'));
const data = JSON.parse(dom('osd-injected-metadata').attr('data') || '');

expect(data).toMatchSnapshot(INJECTED_METADATA);
});
Expand All @@ -120,15 +120,15 @@ describe('RenderingService', () => {
includeUserSettings: false,
});
const dom = load(content);
const data = JSON.parse(dom('osd-injected-metadata').attr('data'));
const data = JSON.parse(dom('osd-injected-metadata').attr('data') || '');

expect(data).toMatchSnapshot(INJECTED_METADATA);
});

it('renders "core" from legacy request', async () => {
const content = await render(createRawRequest(), uiSettings);
const dom = load(content);
const data = JSON.parse(dom('osd-injected-metadata').attr('data'));
const data = JSON.parse(dom('osd-injected-metadata').attr('data') || '');

expect(data).toMatchSnapshot(INJECTED_METADATA);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import React from 'react';
import { skip } from 'rxjs/operators';
import { mount } from 'enzyme';
import { I18nProvider } from '@osd/i18n/react';
import sizeMe from 'react-sizeme';
import { nextTick } from 'test_utils/enzyme_helpers';
import { DashboardViewport, DashboardViewportProps } from './dashboard_viewport';
import { DashboardContainer, DashboardContainerOptions } from '../dashboard_container';
Expand All @@ -45,6 +46,8 @@ import { OpenSearchDashboardsContextProvider } from '../../../../../opensearch_d
import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
import { applicationServiceMock } from '../../../../../../core/public/mocks';

sizeMe.noPlaceholders = true;

let dashboardContainer: DashboardContainer | undefined;

const ExitFullScreenButton = () => <div data-test-subj="exitFullScreenModeText">EXIT</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function HasExtendedBoundsParamEditor(props: AggParamEditorProps<boolean>) {

setValue(value && agg.params.min_doc_count);
}
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, [agg.params.min_doc_count, setValue, value]);

return (
Expand Down
Loading

0 comments on commit 4c3f222

Please sign in to comment.