Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data Explorer] Merge main conflicts #4800

Merged
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
5c5de03
[Saved Object Service] Adds Repository Factory Provider (#4149)
bandinib-amzn Jun 5, 2023
cb27336
add category option for context menus (#4144)
sikhote Jun 6, 2023
55b293a
[CCI] Add bluebird replaces for src/plugins/saved_objects (#4026)
Nicksqain Jun 8, 2023
2322c53
Validate and correct change log after 2.8 release (#4275)
zhongnansu Jun 10, 2023
1728318
[DEVELOPER_GUIDE] resolving links (#3989)
Aigerim-ai Jun 20, 2023
b337bea
Enable data client with sample data server side (#4268)
kristenTian Jun 20, 2023
84ec854
Upgrade the backport workflow (#4343)
AMoo-Miki Jun 21, 2023
f298e7e
Hide any output from `use_node` checking for Node compatibility (#4237)
AMoo-Miki Jun 21, 2023
333e2b3
[Vis Colors] Update default color in TSVB to use `ouiPaletteColorBlin…
manasvinibs Jun 22, 2023
93d543e
Add BWC tests for 2.7 and 2.8 (#4023)
manasvinibs Jun 23, 2023
d95504c
[Vis colors] Replace vis_type_timeline colors with `ouiPaletteColorBl…
manasvinibs Jun 23, 2023
2e10b22
[Lint] add custom stylelint rules and config (#4290)
kavilla Jun 23, 2023
931b915
Fix linked deps resolution (#4342)
AMoo-Miki Jun 23, 2023
fe1f1d1
Add configurable `defaults` to `uiSettings` (#4344)
AMoo-Miki Jun 23, 2023
0b54e84
Refactor hardcode color to use OUI in `maps_legacy` (#4294)
BSFishy Jun 26, 2023
fc4e696
Remove broken flot documentation link for Ruby API (#4384)
joshuarrrr Jun 26, 2023
6cee1a9
[CCI] Fix relationships header overflow (#4070)
SergeyMyssak Jun 26, 2023
70b3420
Refactor color maps to use OUI color palettes (#4293)
BSFishy Jun 26, 2023
1ef3e9f
[CCI] Remove unused tags in the navigation plugin (#3964)
andreymyssak Jun 27, 2023
d285ecb
[Stylelint] Add invalid properties rule (#4374)
BSFishy Jun 27, 2023
a44b09f
Migrate from legacy elasticsearch client to opensearch-js client in `…
manasvinibs Jun 27, 2023
e33b643
Chore (deps): Bump OUI to 1.1.2 to add anomoly detection icon (#4408)
joshuarrrr Jun 27, 2023
29d7a4b
Excludes broken sass-lang link from Link checker (#4415)
ashwin-pc Jun 28, 2023
88e2b2d
[Vis Colors] Update legacy seed colors to use `ouiPaletteColorBlind()…
manasvinibs Jun 28, 2023
d5ca03a
Release notes for 1.3.11 (#4423) (#4427)
opensearch-trigger-bot[bot] Jun 28, 2023
dcdc68d
Updates Release notes for 1.3.11 (#4428) (#4430)
opensearch-trigger-bot[bot] Jun 28, 2023
d95f642
[Stylelint] Add typing to Stylelint rules (#4392)
BSFishy Jun 28, 2023
5e8a4fd
[Vis colors] Update legacy mapped colors in charts plugin to use ouiP…
manasvinibs Jun 28, 2023
c75a025
[CVE-2022-25883] Resolve semver to 7.5.3 and remove unused package (#…
ananzh Jun 29, 2023
7c8aa4a
Enable sample data with Multiple datasource frontend (#4412)
kristenTian Jun 29, 2023
f6e22cb
Feature (home): Add vis audit sample dashboard (#4339)
joshuarrrr Jun 29, 2023
63b66f9
Add fonts for previewing the new theme (#4381)
AMoo-Miki Jun 30, 2023
1f1b333
possible fix for flakey ci9 test (#4450)
ashwin-pc Jun 30, 2023
4a778a7
Chore (VisBuilder): Update icon to use OUI icon (#4446)
joshuarrrr Jun 30, 2023
79988ed
Relocate tutorials imagery (#4382)
AMoo-Miki Jul 1, 2023
bbf8dfb
Update main menu to display 'Dashboards' for consistency (#4453)
gulderov Jul 1, 2023
3f357b5
Adding Matt as a maintainer (#4469)
ashwin-pc Jul 1, 2023
021671a
Add `color-scheme` to the root styling (#4477)
AMoo-Miki Jul 3, 2023
1560a6c
Refactor hardcoded color to use OUI in `region_map` (#4299)
BSFishy Jul 3, 2023
e07c5e6
[Console] Convert lib/mappings to TypeScript (#4008)
curq Jul 5, 2023
1358135
Enable plugins to augment visualizations with additional data and con…
ohltyler Jul 6, 2023
c9cbf31
Update header logo selection logic and assets (#4383)
AMoo-Miki Jul 7, 2023
24bde32
[CI] Split build and verify into parallel jobs (#4467)
AMoo-Miki Jul 7, 2023
d8f0c48
New management overview page and rename stack management to dashboard…
Hailong-am Jul 7, 2023
a509588
Retain the original sample data interface (#4526)
kristenTian Jul 9, 2023
1dc1060
[Vis Augmenter Add UT for few fns (#4516)
ohltyler Jul 10, 2023
9bc61b4
Bump tough-cookie from 4.0.0 to 4.1.3 (#4531)
dependabot[bot] Jul 10, 2023
6ae64b3
[Vis Augmenter] Update base vis height in view events flyout (#4535)
ohltyler Jul 10, 2023
1d41cfe
Dashboard De-Angularization (#4502)
abbyhu2000 Jul 11, 2023
c583838
Add v2.9.0 release notes (#4550)
manasvinibs Jul 12, 2023
b94a62f
Fix line to vega conversion bug (#4554)
lezzago Jul 12, 2023
d746595
Fix Node.js download link (#4556)
AMoo-Miki Jul 12, 2023
72e7068
[Vis Augmenter] Fix stats API visualization ID bug (#4565)
ohltyler Jul 13, 2023
41b1eda
[CCI] Add new or remove extra tags and styles in `saved_objects_manag…
SergeyMyssak Jul 13, 2023
0ab3233
Add documentation to vis_augmenter (#4527)
ohltyler Jul 14, 2023
1249d3d
[Vis Augmenter] Fix bug of undefined tooltip when all plugin layers a…
ohltyler Jul 14, 2023
2b725a9
[Dashboards] restructure folder to be more cohesive with the project …
kavilla Jul 17, 2023
e451d13
chore (home): Update visual consistency dashboard TSVB colors (#4501)
joshuarrrr Jul 18, 2023
78ffbf5
[VisLib] Replace legend color palette with OUI color palette (#4365)
joshuarrrr Jul 18, 2023
6849437
Bump word-wrap from 1.2.3 to 1.2.4 (#4589)
dependabot[bot] Jul 19, 2023
22a8943
Removed KUI usage in maps_legacy plugin (#3998)
miamia1999 Jul 19, 2023
feadcb4
Feature (home): Update visual consistency sample dashboard with more …
joshuarrrr Jul 19, 2023
f13e4c3
Optimize `augment-vis` saved obj searching by adding arg to saved obj…
ohltyler Jul 20, 2023
adb538e
[Markdown] Replace custom css styles and native html with OUI. (#4390)
curq Jul 20, 2023
c06b298
Add resource ID filtering in fetch `augment-vis` obj queries (#4608)
ohltyler Jul 24, 2023
f8ad83f
Fix (styles): Make ace code editor themes consistent (#4609)
joshuarrrr Jul 24, 2023
fe41677
Enable theme-switching via Advanced Settings to preview the Next them…
AMoo-Miki Jul 25, 2023
d94d7cb
[Console] Converted all ```/lib/autocomplete/**/*.js``` files to type…
curq Jul 25, 2023
5c2b22b
[Console] Convert all non-autocomplete lib files to typescript (#4150)
curq Jul 26, 2023
c3ea363
[Table Visualization] Replace div containers with OuiFlex components …
curq Jul 26, 2023
e2abd27
Chore(CHANGELOG): Update to CHANGELOG post 2.9 release (#4625)
manasvinibs Jul 26, 2023
983fc34
Refactor/remove breadcrumb styling main (#4621)
joshuarrrr Jul 26, 2023
6bab7ef
Feat (home): Add remaining vis type examples (#4619)
joshuarrrr Jul 26, 2023
92507a2
[i18n] fix generation scripts (#4252)
kavilla Jul 28, 2023
a52e95c
Feat (Discover): Update styles to be compatible with next theme (#4644)
joshuarrrr Aug 1, 2023
fc238b0
Fix (Legacy Maps): Add necessary specificity for dark mode style over…
joshuarrrr Aug 3, 2023
bf6e887
Bump `node-sass` to a version that uses a newer `libsass` (#4651)
AMoo-Miki Aug 3, 2023
e867585
Update webpack environment targets (#4649)
AMoo-Miki Aug 3, 2023
4bc1f55
Reduce the amount of comments in compiled CSS (#4648)
AMoo-Miki Aug 3, 2023
324919d
units test for utils folder (#4641)
abbyhu2000 Aug 4, 2023
04065fa
Fix --font-text CSS var usage and add more leaflet font overrides (#4…
joshuarrrr Aug 7, 2023
d8c7f48
Add saved objects service status api (#4696)
bandinib-amzn Aug 9, 2023
9253a37
Chore: Add 1.3.12 release notes (#4690) (#4709)
opensearch-trigger-bot[bot] Aug 10, 2023
b038322
Test (linkchecker): Exclude checking dead link (#4720)
joshuarrrr Aug 14, 2023
1674c97
[@osd/pm] Automate multi-target bootstrap and build (#4650)
AMoo-Miki Aug 14, 2023
1c8903d
[chore] Update CHANGELOG.md with 1.3.12 release (#4739)
manasvinibs Aug 15, 2023
ca70d5e
Feat (home): Remove color customizations from sample dashboards (#4741)
joshuarrrr Aug 15, 2023
7f1d85b
Bump version of tinygradient from 0.4.3 to 1.1.5 (#4742)
BSFishy Aug 16, 2023
454fdfb
Remove visualization editor background (#4719)
BSFishy Aug 16, 2023
86a3f1e
[Dashboard De-Angular] Add unit tests for dashboard_listing and dashb…
abbyhu2000 Aug 17, 2023
06a4903
[Stylelint] Add no_restricted_values linter rule (#4413)
BSFishy Aug 17, 2023
ff40d7c
Add @curq as co-maintainer (#4760)
joshuarrrr Aug 17, 2023
a9a8122
[Tests] Add BWC tests for 2.9 and 2.10 versions (#4762)
manasvinibs Aug 18, 2023
061e476
Updated README.md (#4769)
suyash5053 Aug 18, 2023
d7c5577
Refactor logo usage (#4702)
AMoo-Miki Aug 22, 2023
55a6825
Merge remote-tracking branch 'upstream/main' into merge-main-conflicts
ashwin-pc Aug 23, 2023
0b1bacc
fixes merge conflict resolution error
ashwin-pc Aug 23, 2023
73f82a6
fixes snapshot
ashwin-pc Aug 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Saved Object Service] Adds Repository Factory Provider (#4149)
* Adds Repository Factory Provider

Signed-off-by: Bandini Bhopi <bandinib@amazon.com>
bandinib-amzn authored Jun 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 5c5de0349a7614a20d8794c3631454ef0e9e1093
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Multiple Datasource] Support Amazon OpenSearch Serverless ([#3957](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3957))
- Add support for Node.js >=14.20.1 <19 ([#4071](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4071))
- Bundle Node.js 14 as a fallback for operating systems that cannot run Node.js 18 ([#4151](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4151))
- [Saved Object Service] Add Repository Factory Provider ([#4149](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4149))
- Enhance grouping for context menus ([#3924](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3924))

### 🐛 Bug Fixes
1 change: 1 addition & 0 deletions src/core/server/legacy/legacy_service.ts
Original file line number Diff line number Diff line change
@@ -275,6 +275,7 @@ export class LegacyService implements CoreService {
addClientWrapper: setupDeps.core.savedObjects.addClientWrapper,
registerType: setupDeps.core.savedObjects.registerType,
getImportExportObjectLimit: setupDeps.core.savedObjects.getImportExportObjectLimit,
setRepositoryFactoryProvider: setupDeps.core.savedObjects.setRepositoryFactoryProvider,
},
status: {
isStatusPageAnonymous: setupDeps.core.status.isStatusPageAnonymous,
1 change: 1 addition & 0 deletions src/core/server/plugins/plugin_context.ts
Original file line number Diff line number Diff line change
@@ -204,6 +204,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
addClientWrapper: deps.savedObjects.addClientWrapper,
registerType: deps.savedObjects.registerType,
getImportExportObjectLimit: deps.savedObjects.getImportExportObjectLimit,
setRepositoryFactoryProvider: deps.savedObjects.setRepositoryFactoryProvider,
},
status: {
core$: deps.status.core$,
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ const createSetupContractMock = () => {
addClientWrapper: jest.fn(),
registerType: jest.fn(),
getImportExportObjectLimit: jest.fn(),
setRepositoryFactoryProvider: jest.fn(),
};

setupContract.getImportExportObjectLimit.mockReturnValue(100);
63 changes: 62 additions & 1 deletion src/core/server/saved_objects/saved_objects_service.test.ts
Original file line number Diff line number Diff line change
@@ -41,14 +41,15 @@ import { errors as opensearchErrors } from '@opensearch-project/opensearch';
import { SavedObjectsService } from './saved_objects_service';
import { mockCoreContext } from '../core_context.mock';
import { Env } from '../config';
import { configServiceMock } from '../mocks';
import { configServiceMock, savedObjectsRepositoryMock } from '../mocks';
import { opensearchServiceMock } from '../opensearch/opensearch_service.mock';
import { opensearchClientMock } from '../opensearch/client/mocks';
import { httpServiceMock } from '../http/http_service.mock';
import { httpServerMock } from '../http/http_server.mocks';
import { SavedObjectsClientFactoryProvider } from './service/lib';
import { NodesVersionCompatibility } from '../opensearch/version_check/ensure_opensearch_version';
import { SavedObjectsRepository } from './service/lib/repository';
import { SavedObjectRepositoryFactoryProvider } from './service/lib/scoped_client_provider';

jest.mock('./service/lib/repository');

@@ -169,6 +170,27 @@ describe('SavedObjectsService', () => {
expect(typeRegistryInstanceMock.registerType).toHaveBeenCalledWith(type);
});
});

describe('#setRepositoryFactoryProvider', () => {
it('throws error if a repository is already registered', async () => {
const coreContext = createCoreContext();
const soService = new SavedObjectsService(coreContext);
const setup = await soService.setup(createSetupDeps());

const firstRepository: SavedObjectRepositoryFactoryProvider = () =>
savedObjectsRepositoryMock.create();
const secondRepository: SavedObjectRepositoryFactoryProvider = () =>
savedObjectsRepositoryMock.create();

setup.setRepositoryFactoryProvider(firstRepository);

expect(() => {
setup.setRepositoryFactoryProvider(secondRepository);
}).toThrowErrorMatchingInlineSnapshot(
`"custom repository factory is already set, and can only be set once"`
);
});
});
});

describe('#start()', () => {
@@ -281,6 +303,15 @@ describe('SavedObjectsService', () => {
}).toThrowErrorMatchingInlineSnapshot(
`"cannot call \`registerType\` after service startup."`
);

const customRpository: SavedObjectRepositoryFactoryProvider = () =>
savedObjectsRepositoryMock.create();

expect(() => {
setup.setRepositoryFactoryProvider(customRpository);
}).toThrowErrorMatchingInlineSnapshot(
'"cannot call `setRepositoryFactoryProvider` after service startup."'
);
});

describe('#getTypeRegistry', () => {
@@ -368,6 +399,36 @@ describe('SavedObjectsService', () => {

expect(includedHiddenTypes).toEqual(['someHiddenType']);
});

it('Should not create SavedObjectsRepository when custom repository is registered ', async () => {
const coreContext = createCoreContext({ skipMigration: false });
const soService = new SavedObjectsService(coreContext);
const coreSetup = createSetupDeps();
const setup = await soService.setup(coreSetup);

const customRpository: SavedObjectRepositoryFactoryProvider = () =>
savedObjectsRepositoryMock.create();
setup.setRepositoryFactoryProvider(customRpository);

const coreStart = createStartDeps();
const { createInternalRepository } = await soService.start(coreStart);
createInternalRepository();

expect(SavedObjectsRepository.createRepository as jest.Mocked<any>).not.toHaveBeenCalled();
});

it('Should create SavedObjectsRepository when no custom repository is registered ', async () => {
const coreContext = createCoreContext({ skipMigration: false });
const soService = new SavedObjectsService(coreContext);
const coreSetup = createSetupDeps();
await soService.setup(coreSetup);

const coreStart = createStartDeps();
const { createInternalRepository } = await soService.start(coreStart);
createInternalRepository();

expect(SavedObjectsRepository.createRepository as jest.Mocked<any>).toHaveBeenCalled();
});
});
});
});
42 changes: 35 additions & 7 deletions src/core/server/saved_objects/saved_objects_service.ts
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ import { ISavedObjectsRepository, SavedObjectsRepository } from './service/lib/r
import {
SavedObjectsClientFactoryProvider,
SavedObjectsClientWrapperFactory,
SavedObjectRepositoryFactoryProvider,
} from './service/lib/scoped_client_provider';
import { Logger } from '../logging';
import { SavedObjectTypeRegistry, ISavedObjectTypeRegistry } from './saved_objects_type_registry';
@@ -166,6 +167,14 @@ export interface SavedObjectsServiceSetup {
* Returns the maximum number of objects allowed for import or export operations.
*/
getImportExportObjectLimit: () => number;

/**
* Set the default {@link SavedObjectRepositoryFactoryProvider | factory provider} for creating Saved Objects repository.
* Only one repository can be set, subsequent calls to this method will fail.
*/
setRepositoryFactoryProvider: (
respositoryFactoryProvider: SavedObjectRepositoryFactoryProvider
) => void;
}

/**
@@ -291,6 +300,8 @@ export class SavedObjectsService
private typeRegistry = new SavedObjectTypeRegistry();
private started = false;

private respositoryFactoryProvider?: SavedObjectRepositoryFactoryProvider;

constructor(private readonly coreContext: CoreContext) {
this.logger = coreContext.logger.get('savedobjects-service');
}
@@ -348,6 +359,15 @@ export class SavedObjectsService
this.typeRegistry.registerType(type);
},
getImportExportObjectLimit: () => this.config!.maxImportExportSize,
setRepositoryFactoryProvider: (repositoryProvider) => {
if (this.started) {
throw new Error('cannot call `setRepositoryFactoryProvider` after service startup.');
}
if (this.respositoryFactoryProvider) {
throw new Error('custom repository factory is already set, and can only be set once');
}
this.respositoryFactoryProvider = repositoryProvider;
},
};
}

@@ -422,13 +442,21 @@ export class SavedObjectsService
opensearchClient: OpenSearchClient,
includedHiddenTypes: string[] = []
) => {
return SavedObjectsRepository.createRepository(
migrator,
this.typeRegistry,
opensearchDashboardsConfig.index,
opensearchClient,
includedHiddenTypes
);
if (this.respositoryFactoryProvider) {
return this.respositoryFactoryProvider({
migrator,
typeRegistry: this.typeRegistry,
includedHiddenTypes,
});
} else {
return SavedObjectsRepository.createRepository(
migrator,
this.typeRegistry,
opensearchDashboardsConfig.index,
opensearchClient,
includedHiddenTypes
);
}
};

const repositoryFactory: SavedObjectsRepositoryFactory = {
Original file line number Diff line number Diff line change
@@ -31,8 +31,31 @@
import { PriorityCollection } from './priority_collection';
import { SavedObjectsClientContract } from '../../types';
import { SavedObjectsRepositoryFactory } from '../../saved_objects_service';
import { ISavedObjectTypeRegistry } from '../../saved_objects_type_registry';
import {
ISavedObjectTypeRegistry,
SavedObjectTypeRegistry,
} from '../../saved_objects_type_registry';
import { OpenSearchDashboardsRequest } from '../../../http';
import { ISavedObjectsRepository } from './repository';
import { IOpenSearchDashboardsMigrator } from '../../migrations';

/**
* Options passed to each SavedObjectRepositoryFactoryProvider to aid in creating the repository instance.
* @public
*/
export interface SavedObjectsRepositoryOptions {
migrator: IOpenSearchDashboardsMigrator;
typeRegistry: SavedObjectTypeRegistry;
includedHiddenTypes: string[];
}

/**
* Provider to invoke to a factory function for creating ISavedObjectRepository {@link ISavedObjectRepository} instances.
* @public
*/
export type SavedObjectRepositoryFactoryProvider = (
options: SavedObjectsRepositoryOptions
) => ISavedObjectsRepository;

/**
* Options passed to each SavedObjectsClientWrapperFactory to aid in creating the wrapper instance.